/* Messenger Container Layout */
html:has(main > div.messenger) {
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
}

body:has(main > div.messenger) {
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    overscroll-behavior: none;
}

main:has(> div.messenger) {
    flex: 1 1 0%;
    min-height: 0;
    height: auto;
    overflow: hidden;
    overscroll-behavior: none;
}

body:has(main > div.messenger) header {
    flex-shrink: 0;
}

body:has(main > div.messenger) footer {
    flex-shrink: 0;
}

div.messenger {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    overflow: hidden;
}

@media only screen and (max-width: 768px) {
    main:has(> div.messenger) {
        padding: 0;
    }

    body:has(main > div.messenger) header {
        margin-bottom: 8px;
    }

    body:has(main > div.messenger) footer {
        margin-top: 8px;
    }
}

@media only screen and (max-width: 320px) {
    main:has(> div.messenger) {
        height: auto;
    }
}

/* Messenger Layout Style */
div.left_section {
    width: 30%;
    height: 100%;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: space-between;
    background-color: #ffffff;
    overflow: hidden;
}

div.right_section {
    width: 70%;
    height: 100%;
    margin-left: 10px;
    position: relative;
    background-color: #ffffff;
}

@media only screen and (max-width: 768px) {
    div.left_section {
        width: 100%;
    }

    div.right_section {
        width: 100%;
        margin-left: 0;
        display: none;
        position: absolute;
        z-index: 9;
    }

    div.right_section:has(> div.chat_window:not(:empty)) {
        display: block;
    }
}

/* Offline Notice Style */
blockquote.offline {
    width: 400px;
    min-height: 2em;
    margin: 0 2% 1% 2%;
    padding: 0.5% 1%;
    display: none;
    position: fixed;
    bottom: 4vh;
    z-index: 999;
    background-color: #dc2626;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(220, 38, 38, 0.35);
    backdrop-filter: blur(6px);
}

blockquote.offline p {
    margin-left: 10px;
    display: inline-block;
    font-size: 14px;
    text-transform: uppercase;
    color: white;
}

blockquote.offline span {
    padding: 0.75% 0;
    display: inline-block;
}

@media only screen and (max-width: 768px) {
    blockquote.offline {
        width: 96%;
        text-align: center;
    }
}

/* Scroll Bar Style */
.scrollbar::-webkit-scrollbar {
    width: 5px;
    height: 6px;
}

.scrollbar::-webkit-scrollbar-thumb {
    background-color: rgba(148, 163, 184, 0.55);
    border-radius: 99px;
}

.scrollbar::-webkit-scrollbar-thumb:hover {
    background-color: rgba(100, 116, 139, 0.8);
}

.scrollbar::-webkit-scrollbar-track {
    background-color: transparent;
}

@-moz-document url-prefix() {
    .scrollbar {
        scrollbar-width: thin;
        scrollbar-color: rgba(148, 163, 184, 0.55) transparent;
    }
}

/* Status Color Rules */
*.online {
    color: #10b981;
}

*.busy {
    color: #f43f5e;
}

*.idle {
    color: #f59e0b;
}

*.invisible {
    color: #94a3b8;
}

*.offline {
    color: #cbd5e1;
}

/* Status Icon Style */
.fa-circle-dot {
    width: 12px;
    height: 12px;
    min-width: 12px;
    min-height: 12px;
    display: inline-block;
    border-radius: 50%;
    box-sizing: border-box;
    background-color: currentColor;
    outline: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    vertical-align: middle;
    flex-shrink: 0;
}

.fa-circle-dot::before {
    content: none !important;
    display: none !important;
}

.fa-face-smile::before {
    content: "😊";
    font-style: normal;
    font-size: 16px;
    line-height: 1;
    display: block;
}

.fa-microphone::before {
    content: "🎤";
    font-style: normal;
    font-size: 13px;
    line-height: 1;
    display: block;
}

.fa-stop::before {
    content: "⏹";
    font-style: normal;
    font-size: 13px;
    line-height: 1;
    color: #dc2626;
    display: block;
}

/* Account Status View */
div.status_menu {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-end;

    div#status_toggle {
        width: fit-content;
        min-width: 28px;
        height: 24px;
        padding: 0 8px;
        box-sizing: border-box;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1px solid #e2e8f0;
        border-bottom: 0;
        border-radius: 8px 8px 0 0;
        background-color: #ffffff;
        margin-bottom: -1px;
        transition: background-color 0.15s ease, border-color 0.15s ease;
    }

    div#status_toggle:hover {
        background-color: #f8fafc;
    }

    div#status_toggle::after {
        content: "";
        display: block;
        width: 11px;
        height: 11px;
        border-radius: 50%;
        background-color: currentColor;
        box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
    }

    div#status_toggle.open {
        background-color: #f8fafc;
        border-color: #cbd5e1;
    }

    ul#status_change {
        width: 126px;
        margin: 0;
        padding: 4px;
        position: absolute;
        top: calc(100% + 4px);
        right: 0;
        z-index: 99;
        display: none;
        background-color: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        list-style: none;
        box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.12), 0 4px 10px -2px rgba(15, 23, 42, 0.05);

        li {
            display: flex;
            align-items: center;
            padding: 6px 8px;
            margin-bottom: 2px;
            border-bottom: 0;
            border-radius: 6px;
            cursor: pointer;
            transition: background-color 0.12s ease;

            b {
                display: flex;
                flex: 1;
                align-items: center;
                font-size: 13px;
                font-weight: 500;
                color: #334155;
            }

            span {
                display: inline-flex;
                align-items: center;
                justify-content: center;
                font-size: 14px;
                line-height: 1;
            }
        }

        li:hover {
            background-color: #f1f5f9;
        }

        li:last-child {
            margin-bottom: 0;
        }
    }
}

div.status_menu:has(div#status_toggle.open) {
    z-index: 10;
}

/* Buddy Panel View */
div.buddy_panel {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    position: relative;
    flex-shrink: 0;
}

div.buddy_header {
    display: flex;
    flex-direction: row;
    align-items: center;
}

div.buddy_panel span.buddy_caption {
    width: fit-content;
    height: 24px;
    padding: 0 11px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    background-color: #f43f5e;
    border: 1px solid #e11d48;
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1;
    text-transform: uppercase;
    color: #ffffff;
    margin-bottom: -1px;
}

label.buddy_add {
    width: 20px;
    height: 20px;
    margin-left: 7px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #fff1f2;
    border: 1px solid #fecdd3;
    border-radius: 50%;
    color: #e11d48;
    padding: 0;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

label.buddy_add:hover {
    background-color: #f43f5e;
    border-color: #f43f5e;
    color: #ffffff;
    transform: scale(1.06);
}

/* Buddy Addition Modal */
input#buddyAdd {
    display: none;
}

form#buddyAddition label.modal_close {
    width: 28px;
    height: 28px;
    position: absolute;
    top: 14px;
    right: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.22);
    border-radius: 50%;
    color: white;
    z-index: 10;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

form#buddyAddition label.modal_close:hover {
    background-color: rgba(0, 0, 0, 0.5);
    transform: scale(1.08);
}

form#buddyAddition {
    width: 0;
    height: 0;
    overflow: hidden;
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 999;
    background: linear-gradient(145deg, #f43f5e, #e11d48);
    border-radius: 18px;
    box-shadow: 0 24px 48px rgba(225, 29, 72, 0.35), inset 1px 1px 2px rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1), height 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, visibility 0.35s ease;
    box-sizing: border-box;
}

input#buddyAdd:checked~form#buddyAddition {
    width: 100%;
    height: 90%;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    padding: 25vh 25% 0 25%;
    top: 51%;
    transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1), height 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

form#buddyAddition>span {
    margin-bottom: 12px;
    display: block;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-align: center;
    color: rgba(255, 255, 255, 0.95);
    text-transform: uppercase;
}

form#buddyAddition input[type=email],
form#buddyAddition input[type=tel] {
    width: 100%;
    margin-bottom: 14px;
    padding: 12px 16px;
    background-color: #ffffff;
    box-sizing: border-box;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    outline: none;
    font-family: inherit;
    font-size: 15px;
    font-weight: 450;
    letter-spacing: 0.015em;
    color: #0f172a;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.12), 0 2px 4px -2px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
}

form#buddyAddition input[type=email]::placeholder,
form#buddyAddition input[type=tel]::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

form#buddyAddition input[type=email]:focus,
form#buddyAddition input[type=tel]:focus {
    border-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.35), 0 6px 16px rgba(0, 0, 0, 0.18);
    transform: translateY(-1px);
}

form#buddyAddition input[type=email]:not(:placeholder-shown),
form#buddyAddition input[type=tel]:not(:placeholder-shown) {
    background-color: #fff1f2;
    border-color: #fda4af;
    color: #881337;
    box-shadow: 0 1px 4px rgba(159, 18, 57, 0.18);
}

form#buddyAddition input[type=email]:not(:placeholder-shown):focus,
form#buddyAddition input[type=tel]:not(:placeholder-shown):focus {
    background-color: #fff1f2;
    border-color: #ffffff;
    color: #881337;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.35), 0 4px 12px rgba(136, 19, 55, 0.22);
}

form#buddyAddition input[type=email]:disabled,
form#buddyAddition input[type=tel]:disabled {
    background-color: #f1f5f9;
    color: #94a3b8;
    border-color: #e2e8f0;
    opacity: 0.65;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

form#buddyAddition input[type=email]:disabled::placeholder,
form#buddyAddition input[type=tel]:disabled::placeholder {
    color: #cbd5e1;
}

form#buddyAddition button {
    width: auto;
    padding: 10px 22px;
    float: right;
    background-color: #0f172a;
    box-sizing: border-box;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
    transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

form#buddyAddition button:hover {
    background-color: #1e293b;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.32);
}

form#buddyAddition button:disabled {
    background-color: #64748b;
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

@media only screen and (max-width: 768px) {
    input#buddyAdd:checked~form#buddyAddition {
        padding: 15vh 2% 0 2%;
    }
}

/* Group Panel View */
div.group_panel {
    margin-top: 8px;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    position: relative;
    flex-shrink: 0;
}

div.group_header {
    display: flex;
    flex-direction: row;
    align-items: center;
}

div.group_panel span.group_caption {
    width: fit-content;
    height: 24px;
    padding: 0 11px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    background-color: #10b981;
    border: 1px solid #059669;
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1;
    text-transform: uppercase;
    color: #ffffff;
}

label.group_add {
    width: 20px;
    height: 20px;
    margin-left: 7px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 50%;
    color: #059669;
    padding: 0;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

label.group_add:hover {
    background-color: #10b981;
    border-color: #10b981;
    color: #ffffff;
    transform: scale(1.06);
}

/* Group Addition Modal */
input#groupAdd {
    display: none;
}

form#groupAddition label.modal_close,
form.group_update span.modal_close {
    width: 28px;
    height: 28px;
    position: absolute;
    top: 14px;
    right: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.22);
    border-radius: 50%;
    color: white;
    z-index: 10;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

form#groupAddition label.modal_close:hover,
form.group_update span.modal_close:hover {
    background-color: rgba(0, 0, 0, 0.5);
    transform: scale(1.08);
}

/* Group Modal Styling */
form#groupAddition,
form.group_update {
    width: 0;
    height: 0;
    overflow: hidden;
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 999;
    background: linear-gradient(145deg, #10b981, #059669);
    border-radius: 18px;
    box-shadow: 0 24px 48px rgba(5, 150, 105, 0.35), inset 1px 1px 2px rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1), height 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, visibility 0.35s ease;
    box-sizing: border-box;
}

input#groupAdd:checked~form#groupAddition,
form.group_update.open {
    width: 100%;
    height: 90%;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    padding: 25vh 25% 0 25%;
    top: 51%;
    transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1), height 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

form#groupAddition>span,
form.group_update>span {
    margin-bottom: 12px;
    display: block;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-align: center;
    color: rgba(255, 255, 255, 0.95);
    text-transform: uppercase;
}

form#groupAddition input[type=text],
form.group_update input[type=text] {
    width: 100%;
    margin-bottom: 14px;
    padding: 12px 16px;
    background-color: #ffffff;
    box-sizing: border-box;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    outline: none;
    font-family: inherit;
    font-size: 15px;
    font-weight: 450;
    letter-spacing: 0.015em;
    color: #0f172a;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.12), 0 2px 4px -2px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
}

form#groupAddition input[type=text]::placeholder,
form.group_update input[type=text]::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

form#groupAddition input[type=text]:focus,
form.group_update input[type=text]:focus {
    border-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.35), 0 6px 16px rgba(0, 0, 0, 0.18);
    transform: translateY(-1px);
}

form#groupAddition input[type=text]:not(:placeholder-shown),
form.group_update input[type=text]:not(:placeholder-shown) {
    background-color: #f0fdf4;
    border-color: #16a34a;
    color: #14532d;
    box-shadow: 0 1px 4px rgba(22, 163, 74, 0.15);
}

form#groupAddition input[type=text]:not(:placeholder-shown):focus,
form.group_update input[type=text]:not(:placeholder-shown):focus {
    background-color: #f0fdf4;
    border-color: #16a34a;
    color: #14532d;
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.25), 0 4px 12px rgba(22, 163, 74, 0.2);
}

/* Buddy Checklist Container */
form#groupAddition div.buddy_checklist,
form.group_update div.buddy_checklist {
    width: 100%;
    max-height: 190px;
    margin-bottom: 16px;
    padding: 8px;
    background-color: #ffffff;
    box-sizing: border-box;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

form#groupAddition div.buddy_checklist label.checklist_item,
form.group_update div.buddy_checklist label.checklist_item {
    position: relative;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border: 1.5px solid #e2e8f0;
    border-radius: 6px;
    background-color: #f8fafc;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
    box-sizing: border-box;
}

form#groupAddition div.buddy_checklist label.checklist_item:hover,
form.group_update div.buddy_checklist label.checklist_item:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

form#groupAddition div.buddy_checklist label.checklist_item:has(input[type="checkbox"]:checked),
form#groupAddition div.buddy_checklist label.checklist_item.selected,
form.group_update div.buddy_checklist label.checklist_item:has(input[type="checkbox"]:checked),
form.group_update div.buddy_checklist label.checklist_item.selected {
    background-color: #f0fdf4;
    border-color: #16a34a;
    box-shadow: 0 1px 4px rgba(22, 163, 74, 0.15);
}

form#groupAddition div.buddy_checklist label.checklist_item input[type="checkbox"],
form.group_update div.buddy_checklist label.checklist_item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid #cbd5e1;
    border-radius: 5px;
    outline: none;
    cursor: pointer;
    background-color: #ffffff;
    display: inline-grid;
    place-content: center;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
}

form#groupAddition div.buddy_checklist label.checklist_item input[type="checkbox"]::before,
form.group_update div.buddy_checklist label.checklist_item input[type="checkbox"]::before {
    content: "";
    width: 9px;
    height: 5px;
    border-left: 2px solid white;
    border-bottom: 2px solid white;
    transform: rotate(-45deg) translate(1px, -1px) scale(0);
    transition: transform 0.12s ease;
}

form#groupAddition div.buddy_checklist label.checklist_item input[type="checkbox"]:checked,
form.group_update div.buddy_checklist label.checklist_item input[type="checkbox"]:checked {
    background-color: #16a34a;
    border-color: #16a34a;
    box-shadow: 0 1px 3px rgba(22, 163, 74, 0.3);
}

form#groupAddition div.buddy_checklist label.checklist_item input[type="checkbox"]:checked::before,
form.group_update div.buddy_checklist label.checklist_item input[type="checkbox"]:checked::before {
    transform: rotate(-45deg) translate(1px, -1px) scale(1);
}

form#groupAddition div.buddy_checklist label.checklist_item span.name,
form.group_update div.buddy_checklist label.checklist_item span.name {
    margin: 0;
    padding: 0;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    color: #1e293b;
    text-transform: capitalize;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1 1 auto;
    text-align: left;
}

form#groupAddition button,
form.group_update button {
    width: auto;
    padding: 10px 22px;
    float: right;
    background-color: #0f172a;
    box-sizing: border-box;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
    transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

form#groupAddition button:hover,
form.group_update button:hover {
    background-color: #1e293b;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.32);
}

form#groupAddition button:disabled,
form.group_update button:disabled {
    background-color: #64748b;
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

@media only screen and (max-width: 768px) {

    input#groupAdd:checked~form#groupAddition,
    form.group_update.open {
        padding: 15vh 2% 0 2%;
    }
}

/* Buddy Group List */
ul.buddy_list,
ul.group_list {
    width: 100%;
    height: calc(50% - 25px);
    flex: 1 1 0;
    min-height: 0;
    padding: 4px;
    box-sizing: border-box;
    overflow-y: auto;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0 10px 10px 10px;
    list-style: none;
    position: relative;
    z-index: 2;
}

ul.buddy_list:empty::after,
ul.group_list:empty::after {
    width: fit-content;
    margin: 0px auto;
    display: list-item;
    position: relative;
    top: 49%;
    content: attr(placeholder);
    font-size: 80%;
    text-transform: uppercase;
    color: #94a3b8;
}

ul.buddy_list li,
ul.group_list li {
    margin-bottom: 3px;
    padding: 8px 10px 8px 9px;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    background-color: #ffffff;
    border: 1px solid transparent;
    border-left: 3px solid #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
    color: #1e293b;
    transition: background-color 0.15s ease, border-color 0.15s ease, border-left-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

ul.buddy_list li:last-child,
ul.group_list li:last-child {
    margin-bottom: 0;
}

ul.buddy_list li:not(.selected):hover {
    background-color: #fff1f2;
    border-color: #ffe4e6;
    border-left-color: #fb7185;
}

ul.group_list li:not(.selected):hover {
    background-color: #ecfdf5;
    border-color: #d1fae5;
    border-left-color: #34d399;
}

ul.buddy_list li.selected {
    background-color: #ffe4e6;
    color: #9f1239;
    border-color: #fecdd3;
    border-left: 3px solid #f43f5e;
    box-shadow: 0 1px 3px rgba(244, 63, 94, 0.1);
}

ul.group_list li.selected {
    background-color: #d1fae5;
    color: #065f46;
    border-color: #a7f3d0;
    border-left: 3px solid #10b981;
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.1);
}

ul.buddy_list li.selected img.avatar {
    border-color: #fb7185;
}

ul.group_list li.selected img.avatar {
    border-color: #34d399;
}

ul.buddy_list li img.avatar,
ul.group_list li img.avatar {
    width: 30px;
    height: 30px;
    object-fit: cover;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

ul.buddy_list li span.name,
ul.group_list li span.name {
    margin: auto 0 auto 10px;
    overflow: hidden;
    font-size: 16px;
    font-weight: 500;
    text-transform: capitalize;
    text-overflow: ellipsis;
    white-space: nowrap;
}

ul.buddy_list li span.status {
    margin: auto 10px auto 10px;
    font-size: 1.00em;
}

ul.group_list li span.members {
    margin: auto 10px auto 10px;
    font-family: Arial;
    font-size: 0.95em;
}

ul.buddy_list li span.unread,
ul.group_list li span.unread {
    margin: auto 0 auto auto;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
}

ul.buddy_list li.selected span.unread {
    color: #e11d48;
}

ul.group_list li.selected span.unread {
    color: #059669;
}

@media only screen and (max-width: 768px) {

    ul.buddy_list li img.avatar,
    ul.group_list li img.avatar {
        width: 35px;
        height: 35px;
    }

    ul.buddy_list li span.name,
    ul.group_list li span.name {
        font-size: 15px;
    }
}

/* Chat Window Frame */
div.chat_window {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: space-between;
    overflow: hidden;
    box-sizing: border-box;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

div.chat_window:empty::after {
    width: fit-content;
    margin: 0px auto;
    display: inline-block;
    position: relative;
    top: 49%;
    content: attr(placeholder);
    font-size: 80%;
    text-transform: uppercase;
    color: #94a3b8;
}

/* Chat Header Bar */
div.chat_header {
    width: 100%;
    padding: 8px 14px 8px 10px;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    border: 0;
    border-bottom: 1px solid #e2e8f0;
    color: #0f172a;
}

div.chat_window[data-buddyid] div.chat_header {
    background-color: #fff1f2;
}

div.chat_window[data-groupid] div.chat_header {
    background-color: #ecfdf5;
}

div.chat_window[data-buddyid] {
    border: 1px solid #fecdd3;
}

div.chat_window[data-groupid] {
    border: 1px solid #a7f3d0;
}

div.chat_window[data-buddyid] div.chat_header,
div.chat_window[data-buddyid] form.message_write {
    border-color: #fecdd3;
}

div.chat_window[data-groupid] div.chat_header,
div.chat_window[data-groupid] div.chat_header div.members ul.list,
div.chat_window[data-groupid] form.message_write {
    border-color: #a7f3d0;
}

div.chat_header img.avatar {
    width: 30px;
    height: 30px;
    object-fit: cover;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

div.chat_header span.name {
    margin: auto 10px auto 10px;
    overflow: hidden;
    font-size: 15.5px;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-transform: capitalize;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #0f172a;
}

div.chat_header span.status {
    margin: auto auto auto 0;
    font-size: 1.00em;
}

div.chat_header span.update {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    margin: auto auto auto 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-sizing: border-box;
    background-color: #ffffff;
    color: #059669;
    border: 1px solid #a7f3d0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    vertical-align: middle;
    flex-shrink: 0;
    line-height: 0;
    transition: transform 0.15s ease, background-color 0.15s ease;
}

div.chat_header span.update svg {
    display: block;
    width: 10px;
    height: 10px;
    pointer-events: none;
    margin: auto;
}

div.chat_header span.update:not(.disabled):hover {
    background-color: #10b981;
    border-color: #10b981;
    color: #ffffff;
    transform: scale(1.06);
}

div.chat_header span.update.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background-color: #f1f5f9;
    color: #94a3b8;
    border-color: #cbd5e1;
    box-shadow: none;
    pointer-events: auto;
}

div.chat_header span.call,
div.chat_header span.file,
div.chat_header div.members label.toggle {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    margin: auto 0 auto 8px;
    padding: 0;
    border: 1px solid rgba(15, 23, 42, 0.08);
    outline: none;
    box-sizing: border-box;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, color 0.15s ease;
    line-height: 0;
    vertical-align: middle;
}

div.chat_header span.call:hover,
div.chat_header span.file:hover,
div.chat_header div.members label.toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(15, 23, 42, 0.08);
}

div.chat_window[data-buddyid] div.chat_header span.call,
div.chat_window[data-buddyid] div.chat_header span.file {
    color: #e11d48;
}

div.chat_window[data-buddyid] div.chat_header span.call:hover,
div.chat_window[data-buddyid] div.chat_header span.file:hover {
    background-color: #f43f5e;
    border-color: #f43f5e;
    color: #ffffff;
}

div.chat_window[data-groupid] div.chat_header span.call,
div.chat_window[data-groupid] div.chat_header span.file,
div.chat_window[data-groupid] div.chat_header div.members label.toggle {
    color: #059669;
}

div.chat_window[data-groupid] div.chat_header span.call:hover,
div.chat_window[data-groupid] div.chat_header span.file:hover,
div.chat_window[data-groupid] div.chat_header div.members label.toggle:hover {
    background-color: #10b981;
    border-color: #10b981;
    color: #ffffff;
}

div.chat_header span.call svg,
div.chat_header span.file svg,
div.chat_header div.members label.toggle svg {
    display: block;
    width: 14px;
    height: 14px;
    pointer-events: none;
    margin: auto;
    flex-shrink: 0;
}

div.chat_header div.members {
    margin: auto 0 auto 0;
    position: relative;
    display: inline-flex;
    align-items: center;
}

div.chat_header div.members input.toggle {
    display: none;
}

div.chat_header div.members ul.list {
    padding: 8px 4px 4px 4px;
    position: absolute;
    top: 3vh;
    right: 0;
    z-index: -1;
    display: none;
    background-color: #ffffff;
    border: 1px solid #a7f3d0;
    border-top: 0;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.12);
    min-width: 155px;
    max-height: 250px;
    list-style: none;
    overflow-y: auto;
}

div.chat_header div.members ul.list li {
    padding: 5px 10px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
    font-weight: 400;
    color: #334155;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.15s ease;
}

div.chat_header div.members ul.list li span.name {
    margin: auto 12px auto 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 400;
    color: #334155;
}

div.chat_header div.members ul.list li span.status {
    font-size: 0.9em;
    line-height: 1;
    flex-shrink: 0;
}

div.chat_header div.members ul.list li:last-child {
    border-bottom: 0;
}

div.chat_header div.members input.toggle:checked~ul.list {
    display: block;
}

div.chat_header span.close {
    margin: auto 0 auto 15px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15em;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    color: #64748b;
    transition: background-color 0.15s ease, color 0.15s ease;
}

div.chat_header span.close:hover {
    background-color: rgba(0, 0, 0, 0.08);
    color: #0f172a;
}

div.chat_header span.close::before {
    content: "✕";
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
}

/* Message List View */
ul.message_list {
    flex: 1 1 0%;
    min-height: 0;
    height: auto;
    margin-bottom: 0;
    padding: 4px 0;
    position: relative;
    z-index: -2;
    overflow-y: auto;
    list-style: none;
    background-color: #f8fafc;
    border: 0;
}

ul.message_list:empty::after {
    width: fit-content;
    margin: 0px auto;
    display: list-item;
    position: relative;
    top: 49%;
    content: attr(placeholder);
    font-size: 80%;
    text-transform: uppercase;
    color: #94a3b8;
}

ul.message_list li {
    padding: 10px 14px;
    overflow: hidden;
    border-bottom: 1px solid #f1f5f9;
}

div.chat_window[data-buddyid] ul.message_list>li {
    border-color: #fecdd3;
}

div.chat_window[data-groupid] ul.message_list>li {
    border-color: #a7f3d0;
}

ul.message_list li.unread {
    background-color: #eff6ff;
    box-shadow: inset 3px 0 0 #3b82f6;
}

ul.message_list li span.name {
    margin-bottom: 5px;
    float: left;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #475569;
}

ul.message_list li span.date {
    margin-bottom: 5px;
    float: right;
    font-size: 11.5px;
    letter-spacing: -0.01em;
    color: #94a3b8;
}

ul.message_list li p.info {
    margin: 0 0 8px 0;
    padding: 5px 10px 3px 10px;
    clear: both;
    pointer-events: none;
    background-color: #f1f5f9;
    border-left: 2px solid #94a3b8;
    border-radius: 0 6px 6px 0;
    font-size: 12px;
    font-style: italic;
    font-weight: 500;
    line-height: 1.4;
    color: #64748b;
}

ul.message_list li p.info:empty {
    display: none;
}

ul.message_list li p.message {
    margin: 0;
    padding: 9px 13px;
    clear: both;
    pointer-events: none;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-left: 2px solid #94a3b8;
    border-radius: 0 10px 10px 10px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    font-size: 15px;
    font-weight: normal;
    line-height: 1.5;
    white-space: pre-line;
    overflow-wrap: break-word;
    color: #0f172a;
}

ul.message_list li p.message:empty {
    display: none;
}

ul.message_list li ul.files {
    margin: 0;
    padding: 8px 0 0 0;
    clear: both;
    display: flex;
    flex-flow: row wrap;
    gap: 8px;
    list-style: none;
}

ul.message_list li ul.files:empty {
    display: none;
}

ul.message_list li ul.files li {
    flex: 1 1 180px;
    min-width: 0;
    padding: 8px 38px 8px 11px;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-left: 2px solid #94a3b8;
    border-radius: 0 8px 8px 8px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #0f172a;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

ul.message_list li ul.files li:hover {
    background-color: #f0f9ff;
    border-color: #bae6fd;
    border-left-color: #0284c7;
    color: #0369a1;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.08);
}

ul.message_list li ul.files li::after {
    content: '↓';
    width: 22px;
    height: 22px;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    color: #0284c7;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

ul.message_list li ul.files li:hover::after {
    background-color: #0284c7;
    border-color: #0284c7;
    color: #ffffff;
}

ul.message_list li table.detail {
    margin: 8px 0 0 0;
    padding: 0;
    clear: both;
    border: 1px solid #64748b;
    border-collapse: collapse;
    color: #64748b;
}

ul.message_list li table.detail:empty {
    display: none;
}

ul.message_list li table.detail caption {
    padding: 3px 5px;
    float: left;
    clear: both;
    font-size: 12px;
    text-transform: uppercase;
    color: #64748b;
}

ul.message_list li table.detail tr {
    border: 1px solid #64748b;
}

ul.message_list li table.detail tr td {
    padding: 3px 5px;
    border: 1px solid #64748b;
    font-size: 14px;
    letter-spacing: 0.5px;
}

ul.message_list li div.action {
    margin-top: 5px;
    display: flex;
    gap: 10px;
    overflow: hidden;
    clear: both;
    float: right;
}

ul.message_list li div.action span {
    width: 22px;
    height: 22px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    cursor: pointer;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1;
    text-align: center;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

ul.message_list li div.action span svg {
    display: block;
    pointer-events: none;
}

ul.message_list li div.action span.edit {
    color: #4338ca;
    border-color: #6366f1;
}

ul.message_list li div.action span.edit:hover {
    background-color: #eef2ff;
}

ul.message_list li div.action span.fa-trash-can {
    color: #dc2626;
    border-color: #ef4444;
}

ul.message_list li div.action span.fa-trash-can:hover {
    background-color: #fef2f2;
}

ul.message_list li div.action span.fa-volume-low {
    color: #0284c7;
    border-color: #0ea5e9;
}

ul.message_list li div.action span.fa-volume-low:hover {
    background-color: #f0f9ff;
}

ul.message_list li div.action span.fa-volume-high {
    color: #ffffff;
    background-color: #0284c7;
    border-color: #0284c7;
}

ul.message_list li div.action span.fa-volume-high:hover {
    background-color: #0369a1;
    border-color: #0369a1;
}

ul.message_list li div.action span.receipt {
    width: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    color: #9ca3af;
    border-color: #d1d5db;
}

ul.message_list li div.action span.receipt.seen {
    color: #15803d;
    border-color: #16a34a;
}

ul.message_list li div.action span.receipt:hover {
    background-color: transparent;
}

@media only screen and (max-width: 768px) {
    ul.message_list li span.name {
        font-size: 80%;
    }

    ul.message_list li span.date {
        float: right;
        font-size: 80%;
    }

    ul.message_list li p.message {
        font-size: 16px;
    }
}

/* Typing Indicator Box */
div.typing_indicator {
    position: absolute;
    bottom: 84px;
    left: 12px;
    z-index: 10;
    pointer-events: none;
    font-size: 13px;
    font-style: italic;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 3px;
    line-height: 1;
}

div.typing_indicator span.typing_name {
    font-style: italic;
    font-weight: 500;
    color: #475569;
}

div.typing_indicator span.typing_text {
    font-style: italic;
    color: #64748b;
}

div.typing_indicator span.typing_dots {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: 2px;
}

div.typing_indicator span.dot {
    width: 3.5px;
    height: 3.5px;
    border-radius: 50%;
    background-color: #64748b;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

div.typing_indicator span.dot:nth-child(1) {
    animation-delay: -0.32s;
}

div.typing_indicator span.dot:nth-child(2) {
    animation-delay: -0.16s;
}

div.typing_indicator span.dot:nth-child(3) {
    animation-delay: 0s;
}

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.4;
    }

    40% {
        transform: scale(1.1);
        opacity: 1;
    }
}

/* Message Write Form */
form.message_write {
    width: 100%;
    height: 78px;
    padding: 8px 10px;
    gap: 8px;
    position: relative;
    z-index: -2;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: stretch;
    flex-shrink: 0;
    background-color: #ffffff;
    border: 0;
    border-top: 1px solid #e2e8f0;
    box-sizing: border-box;
}

form.message_write span {
    width: 24px;
    height: 24px;
    position: absolute;
    left: 17px;
    z-index: 9;
    cursor: pointer;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

form.message_write[data-buddyid] span {
    color: #f43f5e;
}

form.message_write[data-groupid] span {
    color: #10b981;
}

form.message_write span:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

form.message_write span:nth-child(1),
form.message_write span.fa-microphone {
    top: 14px;
}

form.message_write span:nth-child(2),
form.message_write span.fa-face-smile {
    bottom: 14px;
}

form.message_write ul.emoticons {
    min-width: 145px;
    height: 175px;
    margin: 0;
    padding: 6px;
    display: flex;
    flex-flow: row wrap;
    gap: 5px;
    position: absolute;
    left: 4px;
    bottom: 4px;
    z-index: 9;
    overflow-y: scroll;
    cursor: auto;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.12), 0 4px 10px -2px rgba(15, 23, 42, 0.05);
    font-family: Arial;
    font-size: 15px;
    line-height: 22px;
    text-align: center;
}

form.message_write ul.emoticons li {
    width: 34px;
    height: 34px;
    padding: 0;
    cursor: pointer;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    box-sizing: border-box;
    transition: background-color 0.12s ease, border-color 0.12s ease;
}

form.message_write ul.emoticons li:hover {
    background-color: #e2e8f0;
    border-color: #cbd5e1;
}

form.message_write textarea {
    height: 100%;
    padding: 8px 12px 8px 40px;
    display: block;
    flex: auto;
    resize: none;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
    background-color: #f8fafc;
    background-clip: padding-box;
    box-sizing: border-box;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 400;
    line-height: 1.45;
    color: #0f172a;
}

form.message_write textarea:focus {
    background-color: #ffffff;
}

form.message_write[data-buddyid] textarea::placeholder {
    color: rgba(244, 63, 94, 0.6);
}

form.message_write[data-groupid] textarea::placeholder {
    color: rgba(16, 185, 129, 0.6);
}

form.message_write[data-buddyid] textarea:focus {
    border-color: #f43f5e;
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.1);
}

form.message_write[data-groupid] textarea:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

form.message_write textarea:focus::placeholder {
    color: #94a3b8;
}

form.message_write button {
    height: 100%;
    min-width: 74px;
    padding: 0 18px;
    margin-left: 0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    transition: background-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

form.message_write[data-buddyid] button {
    background-color: #f43f5e;
    box-shadow: 0 1px 2px rgba(225, 29, 72, 0.2);
}

form.message_write[data-buddyid] button:not(:disabled):hover {
    background-color: #e11d48;
    box-shadow: 0 2px 6px rgba(225, 29, 72, 0.28);
}

form.message_write[data-groupid] button {
    background-color: #10b981;
    box-shadow: 0 1px 2px rgba(5, 150, 105, 0.2);
}

form.message_write[data-groupid] button:not(:disabled):hover {
    background-color: #059669;
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.28);
}

form.message_write.disabled {
    background-color: #f8fafc;
}

form.message_write.disabled span {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

form.message_write.disabled textarea {
    background-color: #f1f5f9;
    border-color: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
}

form.message_write.disabled textarea::placeholder {
    color: #94a3b8 !important;
}

form.message_write.disabled button {
    background-color: #cbd5e1 !important;
    color: #64748b !important;
    box-shadow: none !important;
    cursor: not-allowed;
    opacity: 0.8;
}

/* Shared Chat Dialog Styling */
@keyframes dialogPopIn {
    from {
        opacity: 0;
        transform: translate(-50%, -48%) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

form.message_update,
form.message_delete,
form.file_share,
form.file_download,
div.call_start {
    width: 380px;
    max-width: calc(100% - 24px);
    padding: 20px;
    position: absolute;
    z-index: 99;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    box-sizing: border-box;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 20px 45px -12px rgba(15, 23, 42, 0.18), 0 4px 12px -2px rgba(15, 23, 42, 0.06);
    color: #1e293b;
    animation: dialogPopIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

form.message_delete,
form.file_download {
    width: 360px;
}

form.message_update span.dialog_title,
form.message_delete span.dialog_title,
form.file_share span.dialog_title,
form.file_download span.dialog_title,
div.call_start span.dialog_title {
    display: block;
    margin: 0 0 12px 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #0f172a;
}

form.message_delete span#deleteNote,
form.file_download span#downloadNote,
div.call_start span#callDetails {
    margin: 0 0 18px 0;
    display: block;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    color: #475569;
}

form.message_delete span#deleteNote:empty,
form.file_download span#downloadNote:empty,
div.call_start span#callDetails:empty {
    display: none;
}

div.dialog_actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

div.dialog_actions button {
    width: auto;
    min-height: 38px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 9px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

div.dialog_actions button:disabled {
    background-color: #94a3b8;
    border-color: transparent;
    color: #f8fafc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

div.dialog_actions button[type="reset"] {
    margin-right: auto;
    background-color: #f1f5f9;
    border-color: #e2e8f0;
    color: #475569;
}

div.dialog_actions button[type="reset"]:hover {
    background-color: #e2e8f0;
    color: #0f172a;
}

form.message_update div.dialog_actions button[type="submit"],
form.file_share div.dialog_actions button[type="submit"],
form.file_download div.dialog_actions button[type="submit"] {
    background-color: #4f46e5;
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(79, 70, 229, 0.25);
}

form.message_update div.dialog_actions button[type="submit"]:not(:disabled):hover,
form.file_share div.dialog_actions button[type="submit"]:not(:disabled):hover,
form.file_download div.dialog_actions button[type="submit"]:not(:disabled):hover {
    background-color: #4338ca;
    box-shadow: 0 3px 8px rgba(79, 70, 229, 0.32);
}

/* Message Update Dialog */
form.message_update textarea {
    width: 100%;
    min-height: 92px;
    margin-bottom: 16px;
    padding: 11px 14px;
    resize: vertical;
    background-color: #f8fafc;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    outline: none;
    font-family: inherit;
    font-size: 14.5px;
    line-height: 1.5;
    color: #0f172a;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

form.message_update textarea::placeholder {
    color: #94a3b8;
}

form.message_update textarea:focus {
    background-color: #ffffff;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

/* Message Delete Dialog */
form.message_delete div.dialog_actions button[type="submit"] {
    background-color: #dc2626;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}

form.message_delete div.dialog_actions button[type="submit"]:not(:disabled):hover {
    background-color: #b91c1c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.32);
}

/* File Share Dialog */
form.file_share input[type=file] {
    width: 100%;
    margin: 0 0 12px 0;
    padding: 8px;
    box-sizing: border-box;
    background-color: #f8fafc;
    border: 1.5px dashed #cbd5e1;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

form.file_share input[type=file]:hover {
    border-color: #94a3b8;
    background-color: #f1f5f9;
}

form.file_share input[type=file]:valid {
    border-style: solid;
    border-color: #16a34a;
    background-color: #f0fdf4;
    color: #166534;
}

form.file_share input[type=file]::file-selector-button {
    margin-right: 12px;
    padding: 8px 14px;
    background-color: #0f172a;
    box-sizing: border-box;
    border: none;
    border-radius: 7px;
    outline: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    transition: background-color 0.2s ease;
}

form.file_share input[type=file]::file-selector-button:hover {
    background-color: #1e293b;
}

form.file_share input[type=file]:valid::file-selector-button {
    background-color: #16a34a;
}

form.file_share input[type=file]:valid::file-selector-button:hover {
    background-color: #15803d;
}

form.file_share input[type=text] {
    width: 100%;
    margin-bottom: 16px;
    padding: 10px 14px;
    background-color: #f8fafc;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    color: #0f172a;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

form.file_share input[type=text]::placeholder {
    color: #94a3b8;
}

form.file_share input[type=text]:focus {
    background-color: #ffffff;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

form.file_share input[type=text]:not(:placeholder-shown) {
    background-color: #ffffff;
    border-color: #94a3b8;
}

/* Call Info Dialog */
div.call_info {
    display: none;
}

/* Call Start Dialog */
div.call_start div.dialog_actions button[name="call_audio"] {
    background-color: #0284c7;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}

div.call_start div.dialog_actions button[name="call_audio"]:not(:disabled):hover {
    background-color: #0369a1;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.32);
}

div.call_start div.dialog_actions button[name="call_video"] {
    background-color: #7c3aed;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
}

div.call_start div.dialog_actions button[name="call_video"]:not(:disabled):hover {
    background-color: #6d28d9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.32);
}

/* Shared Call Modal Styling */
div.call_dial,
div.call_ring {
    max-width: 90vw;
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background-color: #0f172a;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    box-sizing: border-box;
    animation: dialogPopIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

div.call_dial span.dialog_title,
div.call_ring span.dialog_title {
    margin: 0 0 12px 0;
    color: #e2e8f0;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

div.call_dial span.dialog_title::before,
div.call_ring span.dialog_title::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    animation: dialPulse 1.5s infinite;
}

@keyframes dialPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

/* Call Dial Dialog */
div.call_dial {
    width: 320px;
    overflow: hidden;
    padding: 16px;
}

div.call_dial video.media_local {
    width: 100%;
    aspect-ratio: 4 / 3;
    outline: none;
    object-fit: contain;
    background-color: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    display: block;
    box-sizing: border-box;
}

div.call_dial div.dialog_actions {
    justify-content: center;
    margin-top: 16px;
}

div.call_dial div.dialog_actions button {
    min-width: 110px;
    padding: 9px 22px;
    background-color: #dc2626;
    border: none;
    outline: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    box-sizing: border-box;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

div.call_dial div.dialog_actions button:hover {
    background-color: #b91c1c;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4);
}

@media only screen and (max-width: 768px) {
    div.call_dial {
        width: 290px;
        padding: 14px;
    }

    div.call_dial span.dialog_title {
        font-size: 14px;
    }
}

/* Call Ring Dialog */
div.call_ring {
    width: 360px;
    padding: 20px;
}

div.call_ring span#callFrom {
    display: block;
    margin-bottom: 18px;
    text-align: center;
    font-size: 14px;
    line-height: 1.5;
    color: #cbd5e1;
}

div.call_ring div.dialog_actions button {
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
}

div.call_ring div.dialog_actions button[name="call_decline"] {
    margin-right: auto;
    background-color: #dc2626;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

div.call_ring div.dialog_actions button[name="call_decline"]:not(:disabled):hover {
    background-color: #b91c1c;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(220, 38, 38, 0.4);
}

div.call_ring div.dialog_actions button[name="call_audio"] {
    background-color: #16a34a;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

div.call_ring div.dialog_actions button[name="call_audio"]:not(:disabled):hover {
    background-color: #15803d;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(22, 163, 74, 0.4);
}

div.call_ring div.dialog_actions button[name="call_video"] {
    background-color: #2563eb;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

div.call_ring div.dialog_actions button[name="call_video"]:not(:disabled):hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

@media only screen and (max-width: 768px) {
    div.call_ring {
        width: 310px;
        padding: 16px;
    }

    div.call_ring span.dialog_title {
        font-size: 14px;
    }
}

/* Call View Dialog */
div.call_view {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    background-color: #0f172a;
    overflow: hidden;
}

div.call_view video.media_remote {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    outline: none;
    object-fit: contain;
    background-color: #0b0f19;
}

div.call_view video.media_local {
    width: 200px;
    max-width: 26vw;
    aspect-ratio: 4 / 3;
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    outline: none;
    object-fit: contain;
    background-color: #1e293b;
    border: 0;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

div.call_view div.dialog_actions {
    position: absolute;
    bottom: 24px;
    bottom: max(24px, env(safe-area-inset-bottom, 24px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 14px;
    padding: 8px 18px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 30px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

div.call_view div.dialog_actions button,
div.call_view button {
    min-width: 78px;
    min-height: 0;
    padding: 8px 16px;
    border: none;
    outline: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: #ffffff;
    background-color: #334155;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

div.call_view div.dialog_actions button:hover,
div.call_view button:hover {
    background-color: #475569;
    transform: translateY(-1px);
}

div.call_view div.dialog_actions button.active {
    background-color: #d97706;
}

div.call_view div.dialog_actions button[name="call_finish"] {
    background-color: #dc2626;
    min-width: 86px;
}

div.call_view div.dialog_actions button[name="call_finish"]:hover {
    background-color: #b91c1c;
}

@media only screen and (max-width: 768px) {
    div.call_view {
        height: 100vh;
        height: 100dvh;
        top: 0;
    }

    div.call_view video.media_local {
        width: 120px;
        max-width: 32vw;
        top: 12px;
        right: 12px;
        border-radius: 8px;
    }

    div.call_view div.dialog_actions {
        bottom: 30px;
        bottom: max(30px, calc(env(safe-area-inset-bottom, 0px) + 20px));
        gap: 8px;
        padding: 6px 12px;
    }

    div.call_view div.dialog_actions button,
    div.call_view button {
        min-width: 68px;
        padding: 7px 12px;
        font-size: 12px;
    }
}