@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap');

:root {
    --color-background: rgb(20, 20, 20); 
    --color-primary: white; 
}

* {
    margin: 0; 
    padding: 0; 
}

body {
    padding: 2em; 
    font-family: 'Noto Sans';
    background-color: var(--color-background);
    color: var(--color-primary); 
    overflow-x: hidden;  
}

h1 {
    margin: 1em 0; 
}

.item {
    display: flex; 
    flex-direction: column; 
    width: 20em;
}

.item img {
    width: 15em; 
    height: 15em;
}

body p {
    font-size: 2em;
    margin: 3em 0; 
}

#select {
    display: flex;
    gap: 10px;
    margin: 1em 0;
    flex-direction: row;
}

.voice-item {
    padding: 0.6em 1em;
    border: 2px solid #ccc;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    transition: 0.2s;
    font-size: 2em;
}

.voice-item:hover {
    border-color: #888;
}

.voice-item.active {
    border-color: #007bff;
    background: #e8f1ff;
    font-weight: bold;
}

#button {
    padding: 0.6em 1em;
    border-radius: 8px;
    background-color: #007bff;
    color: white; 
    border: none; 
    font-size: 2em; 
}

.chat-container {
    display: flex;
    height: 500px;
    border: 1px solid #ddd;
    border-radius: 10px;
    overflow: hidden;
}

.chat-area {
    flex: 1;
    padding: 15px;
    background: #fafafa;
    overflow-y: auto;
}

.message {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    align-items: flex-start;
}

.message .avatar {
    font-size: 28px;
}

.message .text {
    background: white;
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 70%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.settings-panel {
    width: 250px;
    background: #fff;
    padding: 15px;
    border-left: 1px solid #eee;
}

.voice-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.voice-item {
    padding: 8px 10px;
    border: 2px solid #ccc;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
}

.voice-item.active {
    border-color: #007bff;
    background: #e8f1ff;
}

/* Group Chat */ 
body:has(.group-chat) {
    padding: 0; 
}

body nav {
    width: 100%; 

    display: flex;
    flex-direction: row; 
    align-items: center;
    gap: 3em;
    padding: 1em 0 2em 1em;
}

body nav a {
    color: white; 

    font-size: 1.5em;
}

body nav h2 { 
    font-weight: 400; 
}

.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  padding: 8px 16px;
  background: black;
  color: white;
  font-weight: bold;
  text-decoration: none;
  transform: translateY(-100%);
}

.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid white;
}

.group-chat {
    /* display: flex;
    flex-direction: column; 
    gap: 1em; 
    justify-content: space-between; */

    /* height: 100%;
    overflow: hidden;   */
    overflow: hidden;
}

.group-chat > div:first-of-type {
    display: flex; 
    flex-direction: column; 
    gap: 1em;

    padding-bottom: 7em; 
}

/* .group-chat > div:first-of-type {
    overflow-y: scroll; 
} */

.group-chat > div:nth-of-type(2) {
    position: fixed; 
    bottom: 0; 
    right: 1em; 
    width: 100%;
    padding: 1em 0; 
     
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    gap: 1em;

    background-color:rgb(20, 20, 20);
}

.group-chat > div:nth-of-type(2) > input:first-of-type {
    width: 100%; 
    height: 2em; 
    background-color: rgb(255, 255, 255);
    margin-left: 1em;
    border-radius: 999px;
    padding-left: 1em;
    font-size: 1.5em;
}

.group-chat > div:nth-of-type(2) > button, .group-chat > div:nth-of-type(2) > div {
    height: 52px; 
    width: 52px;
    aspect-ratio: 1/1;
    border-radius: 999px; 
    border: none; 

    background-image: url(../assets/send-symbol.png);
    background-size: 32px 32px;
    background-position: center;
    background-repeat: no-repeat;

    background-color: grey;
}

#voiceSettings {
    position: relative; 
    height: 52px; 
    width: 52px;
    aspect-ratio: 1/1;
    border-radius: 999px; 
    border: none; 

    /* background-color: grey; */
    background-image: url(../assets/slider-settings.png);
    fill: white; 
    background-size: 32px 32px;
    background-position: center;
    background-repeat: no-repeat;

    background-color: grey;
}

#voiceSettings > input {
    height: 100%; 
    width: 100%;
    margin: 0;

    appearance: none;
}

#voiceSettings > fieldset {
    position: absolute; 
    bottom: 0; 
    right: 0; 
    transform: translateY(-40%); 
    /* transform: translate(-40%, -100%);  */
    font-size: 2em; 

    display: flex;
    flex-direction: row; 
    gap: 1em;

    display: none;

    padding: 1.5em 1em 1em 1em; 
    background-color: white;
    border-radius: 1em;
}

#voiceSettings > fieldset legend {
    color: black; 
    margin: 0; 
    font-size: 0.8em;

    position: absolute; 
    top: 0.5em; 
}

#voiceSettings > fieldset input {
    border: none; 
    background: none; 
}

#voiceSettings:has( > input:checked) > fieldset {
    display: flex; 
}

.group-chat div .text-bubble:has(div.v3), .group-chat div .text-bubble:has(div.v4), .group-chat div .text-bubble:has(div.v5) {
    margin-left: auto; 
    margin-right: 7em; 

    div {
        right: 0; 
        transform: translateX(140%); 
    }
}

.text-bubble {
    margin-left: 7em;

    position: relative;  

    display: flex; 
    flex-direction: column; 
    gap: 0.5em; 
    align-items: flex-start;
}

.text-bubble div {
    border-radius: 999px; 
    width: 4em; 
    height: 4em; 
    background-color: blue; 

    position: absolute; 
    top: 0; 
    transform: translateX(-140%); 
}

.text-bubble div[class="v1"] {
    background-color: red;
}

.text-bubble div[class="v2"] {
    background-color: blue;
}

.text-bubble div[class="v3"], .text-bubble div[class="v4"], .text-bubble div[class="v5"] {
    background-color: green;
}

.text-bubble button {
    border: none; 

    font-size: 1.5em; 
    margin: 0; 
    color: var(--color-primary); 

    background-color: rgb(130, 130, 130); 
    border-radius: 0.75em; 
    padding: 0.5em 0.5em;

    &:focus {
        font-size: 3em;
        background-color: rgb(50, 50, 50);
    }
}

body:has(.private-chat) {
    padding: 0; 
}

.private-chat {
    margin-top: 1em;
}

.private-chat div {
    display: flex; 
    flex-direction: column; 
    gap: 1em;
}

.private-chat div .text-bubble:nth-child(2n) {
    margin-left: auto; 
    margin-right: 7em; 

    display: flex; 
    align-items: end;

    div {
        right: 0; 
        transform: translateX(140%); 
    }
}

/* Chats index */ 
body:has(.chats) {
    padding: 0; 
}

body:has(.chats) h2 {
    margin: 1em 0;  
}

.chats {
    display: flex;
    flex-direction: column; 
}

.chats a {
    padding: 1em; 
    border-top: 4px solid white;
    border-bottom: 4px solid white;
    width: 100%; 

    color: white; 
    text-decoration: none;
    font-size: 2em;

    display: flex; 
    flex-direction: row; 
    gap: 1em; 
    align-items: center; 
}

.chats a div {
    height: 2em;
    width: 2em; 

    background-color: grey;
    border-radius: 999px; 
}

nav a:focus, nav h2:focus, .group-chat > div:nth-of-type(2) input:focus, .group-chat > div:nth-of-type(2) button:focus {
    border: 5px solid white; 
}