body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;

    background-color: #f4f4f4;
}

h2 {
    text-align: center;
    margin: 10px 0;
}

#roomInfo {
    padding: 10px;
    background-color: #e0e0e0;
    text-align: center;
    font-size: 0.9em;
}

#status {
    text-align: center;
    font-size: 0.8em;
    font-style: italic;
    color: #888;
    padding: 5px;
}

#messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message {
    max-width: 70%;
    padding: 8px 12px;
    border-radius: 12px;
    line-height: 1.4;
    word-wrap: break-word;

}

.my-message {
    background-color: #007bff;
    color: white;
    align-self: flex-end;
}

.other-message {
    background-color: #e0e0e0;
    align-self: flex-start;
}

.system-message {
    align-self: center;
    background-color: transparent;
    color: #555;
    font-style: italic;
    max-width: 90%;
    text-align: center;

}


.system-error {
    color: #dc3545;

    font-weight: bold;
}

.system-warning {
    color: #ffc107;

}

.system-success {
    color: #28a745;

}

.system-info {
    color: #17a2b8;

}


.download-link {
    color: #0056b3;
    text-decoration: underline;
    cursor: pointer;
}

.download-link:hover {
    color: #003d80;
}


.file-progress {
    display: flex;

    align-items: center;

    gap: 8px;

    background-color: #f0f0f0;

    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 12px;
    max-width: 90%;

    align-self: center;

    font-style: normal;

    text-align: left;

}

.file-progress .file-info {
    flex-shrink: 0;

    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;

}

.file-progress progress {
    flex-grow: 1;

    height: 10px;
    border-radius: 5px;
    overflow: hidden;

    appearance: none;

    border: none;

}


.file-progress progress::-webkit-progress-bar {
    background-color: #e0e0e0;
    border-radius: 5px;
}

.file-progress progress::-moz-progress-bar {

    background-color: #e0e0e0;
    border-radius: 5px;
}


.file-progress progress::-webkit-progress-value {
    background-color: #007bff;

    border-radius: 5px;
    transition: width 0.1s linear;

}

.file-progress progress::-moz-progress-bar {

    background-color: #007bff;
    border-radius: 5px;
    transition: width 0.1s linear;
}


.file-progress.error progress::-webkit-progress-value {
    background-color: #dc3545;

}

.file-progress.error progress::-moz-progress-bar {

    background-color: #dc3545;
}


.file-progress.success progress::-webkit-progress-value {
    background-color: #28a745;

}

.file-progress.success progress::-moz-progress-bar {

    background-color: #28a745;
}


.file-progress .file-percentage {
    font-size: 0.8em;
    color: #555;
    min-width: 35px;

    text-align: right;
}

.file-progress .cancel-button {
    background: none;
    border: none;
    color: #dc3545;

    cursor: pointer;
    padding: 0 5px;
    font-size: 1em;
    line-height: 1;

}

.file-progress .cancel-button:hover {
    color: #a71d2a;

}

.file-progress .cancel-button:disabled {
    color: #ccc;
    cursor: not-allowed;
}




#inputArea {
    display: flex;
    align-items: center;
    padding: 10px;
    background-color: #f9f9f9;
    border-top: 1px solid #ddd;
    position: relative;

}

#messageInput {
    flex: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    resize: none;

    min-height: 24px;

    max-height: 100px;

    overflow-y: auto;

}

#messageInput:disabled {
    background-color: #e0e0e0;
}

#sendButton {
    margin-left: 10px;
    padding: 8px 16px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    display: inline-flex;

    align-items: center;
    justify-content: center;
}

#sendButton i {
    color: white;

    font-size: 1em;

}


#sendButton:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

#optionsButton {
    margin-right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    padding: 5px;

    display: inline-flex;

    align-items: center;
    justify-content: center;
}

#optionsButton i {
    color: #333;

    font-size: 1em;

}

#optionsButton:disabled {
    color: #cccccc;
    cursor: not-allowed;
}

#optionsMenu {
    display: none;

    position: absolute;
    bottom: calc(100% + 5px);

    left: 10px;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    display: flex;

    flex-direction: row;

    padding: 5px;
    gap: 5px;

    z-index: 1000;
}


.menu-button {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background-color: #f0f0f0;
    position: relative;

    padding: 0;

}

.menu-button i {
    font-size: 14px;
    color: #333;
}

.menu-button:disabled {
    background-color: #e0e0e0;
    cursor: not-allowed;
    opacity: 0.6;

}

.menu-button:disabled i {
    color: #888;

}


.menu-button:hover:not(:disabled) {
    background-color: #e0e0e0;
}




#fileInput {
    display: none;

}



#endCallButton {

    background-color: #fdd;

}

#endCallButton:hover:not(:disabled) {
    background-color: #fbb;

}

#endCallButton i {
    color: #dc3545;

}



.video-off {
    color: #dc3545;

}

.video-on {
    color: #28a745;

}

.video-requesting {
    animation: pulse 1.5s infinite;

}

.video-failed {
    color: #dc3545;

    opacity: 0.7;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}


#callStatus {
    text-align: center;
    font-size: 0.9em;
    color: #555;
    padding: 5px;
    min-height: 1.2em;

}

#incomingCallUI,
#incomingVideoRequestUI {
    display: none;

    position: fixed;
    top: 20px;

    left: 50%;
    transform: translateX(-50%);
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 15px 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    z-index: 1001;

    text-align: center;
    max-width: 90%;
}

#incomingCallUI div,
#incomingVideoRequestUI div {
    margin-bottom: 10px;
}

#acceptCallButton,
#rejectCallButton,
#acceptVideoButton,
#rejectVideoButton {
    padding: 8px 16px;
    margin: 0 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
}

#acceptCallButton,
#acceptVideoButton {
    background-color: #28a745;
    color: white;
}

#rejectCallButton,
#rejectVideoButton {
    background-color: #dc3545;
    color: white;
}

#videoStreams {
    display: none;

    position: relative;

    width: 100%;
    padding: 5px 0;

    background-color: #ddd;

}

#remoteVideo {
    display: block;

    width: 100%;
    height: auto;
    max-height: 50vh;

    border-radius: 0;

    background-color: #000;

    object-fit: contain;

}

#localVideo {
    position: absolute;
    bottom: 10px;

    right: 10px;
    width: 25%;
    max-width: 120px;
    height: auto;
    border-radius: 8px;
    background-color: #000;
    border: 2px solid #fff;
    z-index: 10;
    object-fit: cover;

}

#remoteAudio {
    display: none;

}


.system-dialog {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 2000;

    font-size: 0.9em;
    max-width: 80%;
    text-align: center;
}

.system-dialog--info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.system-dialog--warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.system-dialog--error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.system-dialog--success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}



.menu-button[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;

    left: 50%;
    transform: translateX(-50%) translateY(-5px);

    background-color: rgba(51, 51, 51, 0.9);

    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1001;

    pointer-events: none;

}


@media (max-width: 600px) {
    .message {
        max-width: 85%;

    }

    #inputArea {
        padding: 8px;
    }

    #messageInput {
        font-size: 1rem;

        padding: 10px;

    }

    #sendButton {
        padding: 10px 12px;

    }

    #optionsButton {
        padding: 8px;

    }

    #optionsMenu {
        bottom: calc(100% + 3px);

        left: 5px;
        gap: 3px;
    }

    .menu-button {
        width: 36px;

        height: 36px;
    }

    .menu-button i {
        font-size: 16px;

    }

    .menu-button[title]:hover::after {
        display: none;

    }

    #status {
        font-size: 0.75em;
    }



    #remoteVideo {
        max-height: 45vh;

    }

    #localVideo {
        width: 30%;
        max-width: 100px;
        bottom: 5px;
        right: 5px;
    }

    #incomingCallUI,
    #incomingVideoRequestUI {
        padding: 10px 15px;
        top: 10px;

    }

    #acceptCallButton,
    #rejectCallButton,
    #acceptVideoButton,
    #rejectVideoButton {
        padding: 6px 12px;
        font-size: 0.9em;
    }

    .system-dialog {
        font-size: 0.85em;
        max-width: 90%;
        top: 5px;
    }


    .file-progress {
        max-width: 95%;
        gap: 5px;
        padding: 6px 10px;
    }

    .file-progress .file-info {
        max-width: 100px;

        font-size: 0.85em;
    }

    .file-progress .file-percentage {
        font-size: 0.75em;
        min-width: 30px;
    }

    .file-progress .cancel-button {
        font-size: 0.9em;
    }
}