:root {
    --labsa-chat-blue: #0d6efd;
    --labsa-chat-navy: #0b2f63;
    --labsa-chat-bg: #f3f7fc;
    --labsa-chat-border: #dce6f2;
    --labsa-chat-text: #172b4d;
    --labsa-chat-muted: #718096;
    --labsa-chat-green: #16a34a;
    --labsa-chat-red: #dc2626;
}

#labsa-exam-chat-launcher {
    position: fixed;
    right: 20px;
    bottom: 78px;
    z-index: 21010;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 10px 16px;
    color: #fff;
    background: linear-gradient(135deg, #0d6efd, #1594e8);
    border: 0;
    border-radius: 999px;
    box-shadow: 0 14px 34px rgba(13, 110, 253, 0.34);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

#labsa-exam-chat-launcher:hover,
#labsa-exam-chat-launcher.is-open {
    transform: translateY(-2px);
    box-shadow: 0 18px 40px rgba(13, 110, 253, 0.42);
}

#labsa-exam-chat-launcher i {
    font-size: 22px;
}

.labsa-chat-launcher-badge,
.labsa-chat-sidebar-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 5px;
    color: #fff;
    background: #ef4444;
    border: 2px solid #fff;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
}

.labsa-chat-launcher-badge {
    position: absolute;
    top: -6px;
    right: -4px;
}

#labsa-exam-chat-camera-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 28px;
    padding: 4px 8px;
    color: #fff;
    background: #0d6efd;
    border: 0;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

#labsa-exam-chat-camera-button:hover,
#labsa-exam-chat-camera-button.is-open {
    background: #138fdf;
}

#labsa-exam-chat-camera-button i {
    font-size: 18px;
}

.labsa-chat-camera-badge {
    position: absolute;
    top: -8px;
    right: -7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 23px;
    height: 23px;
    padding: 0 5px;
    color: #fff;
    background: #ef4444;
    border: 2px solid #fff;
    border-radius: 999px;
    font-size: 14px;
    line-height: 1;
}

.labsa-chat-camera-badge[hidden] {
    display: none !important;
}

#labsa-proctor-preview .labsa-proctor-preview-bar > strong {
    flex: 1 1 auto;
    overflow: hidden;
}

#labsa-proctor-preview .labsa-proctor-preview-status {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#labsa-proctor-preview.is-collapsed #labsa-exam-chat-camera-button span {
    display: none;
}

.labsa-chat-sidebar-badge {
    margin-left: auto;
    border-width: 0;
}

.labsa-chat-launcher-badge[hidden],
.labsa-chat-sidebar-badge[hidden] {
    display: none !important;
}

#labsa-exam-chat-panel {
    position: fixed;
    right: 20px;
    bottom: 136px;
    z-index: 21020;
    display: flex;
    flex-direction: column;
    width: min(390px, calc(100vw - 28px));
    height: min(590px, calc(100vh - 165px));
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--labsa-chat-border);
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(15, 38, 73, 0.26);
}

#labsa-exam-chat-panel[hidden] {
    display: none !important;
}

.labsa-chat-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 16px;
    color: #fff;
    background: linear-gradient(135deg, #0b4fb6, #118ce8);
}

.labsa-chat-panel-head > div {
    min-width: 0;
}

.labsa-chat-panel-head strong {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
}

.labsa-chat-panel-head strong i {
    font-size: 22px;
}

.labsa-chat-panel-head small {
    display: block;
    margin-top: 3px;
    overflow: hidden;
    color: #d8ebff;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.labsa-chat-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    padding: 0;
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    border: 0;
    border-radius: 9px;
}

.labsa-chat-close i {
    font-size: 23px;
}

.labsa-chat-help {
    padding: 9px 14px;
    color: #335578;
    background: #edf6ff;
    border-bottom: 1px solid #dcebf8;
    font-size: 14px;
    line-height: 1.45;
}

.labsa-chat-quick {
    display: flex;
    gap: 7px;
    padding: 10px 12px;
    overflow-x: auto;
    background: #fff;
    border-bottom: 1px solid #e7edf5;
}

.labsa-chat-quick button {
    flex: 0 0 auto;
    padding: 6px 9px;
    color: #24517d;
    background: #f5f9fd;
    border: 1px solid #d9e6f2;
    border-radius: 999px;
    font-size: 14px;
    cursor: pointer;
}

.labsa-chat-quick button:hover {
    color: #fff;
    background: var(--labsa-chat-blue);
    border-color: var(--labsa-chat-blue);
}

.labsa-chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    padding: 15px;
    overflow-y: auto;
    background: #f6f9fd;
}

.labsa-chat-message {
    display: flex;
    margin-bottom: 10px;
}

.labsa-chat-message.is-mine {
    justify-content: flex-end;
}

.labsa-chat-message.is-other {
    justify-content: flex-start;
}

.labsa-chat-bubble {
    max-width: 82%;
    padding: 9px 11px 7px;
    color: var(--labsa-chat-text);
    background: #fff;
    border: 1px solid #dfe8f2;
    border-radius: 13px 13px 13px 4px;
    box-shadow: 0 4px 12px rgba(24, 53, 87, 0.05);
}

.labsa-chat-message.is-mine .labsa-chat-bubble {
    color: #fff;
    background: linear-gradient(135deg, #0d6efd, #178ee1);
    border-color: transparent;
    border-radius: 13px 13px 4px 13px;
}

.labsa-chat-bubble strong {
    display: block;
    margin-bottom: 3px;
    font-size: 14px;
}

.labsa-chat-bubble p {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.labsa-chat-bubble small {
    display: block;
    margin-top: 4px;
    color: #94a3b8;
    font-size: 14px;
    text-align: right;
}

.labsa-chat-message.is-mine .labsa-chat-bubble small {
    color: #d8eaff;
}

.labsa-chat-conversation-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    min-height: 100%;
    color: #7b8fa7;
    text-align: center;
}

.labsa-chat-conversation-empty i {
    margin-bottom: 7px;
    color: #a7bad0;
    font-size: 40px;
}

.labsa-chat-conversation-empty strong {
    color: #45627f;
    font-size: 14px;
}

.labsa-chat-conversation-empty span {
    margin-top: 3px;
    font-size: 14px;
}

.labsa-chat-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 11px;
    background: #fff;
    border-top: 1px solid #e1e9f2;
}

.labsa-chat-form textarea {
    width: 100%;
    min-height: 44px;
    max-height: 110px;
    padding: 10px 11px;
    resize: none;
    color: #1e293b;
    background: #f8fafc;
    border: 1px solid #d9e3ef;
    border-radius: 10px;
    font: inherit;
    font-size: 14px;
    outline: none;
}

.labsa-chat-form textarea:focus {
    background: #fff;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.labsa-chat-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    padding: 0;
    color: #fff;
    background: var(--labsa-chat-blue);
    border: 0;
    border-radius: 10px;
}

.labsa-chat-form button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.labsa-chat-form button i {
    font-size: 22px;
}

.labsa-chat-status {
    min-height: 27px;
    padding: 5px 12px 7px;
    color: #5f7893;
    background: #fff;
    font-size: 14px;
}

.labsa-chat-status.is-error {
    color: #b91c1c;
}

.labsa-chat-admin-shell {
    position: fixed;
    top: 70px;
    right: 0;
    bottom: 0;
    left: 260px;
    z-index: 910;
    padding: 22px;
    overflow: auto;
    background: var(--labsa-chat-bg);
}

.wrapper.toggled ~ .labsa-chat-admin-shell {
    left: 70px;
}

.labsa-chat-admin-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding: 16px 18px;
    background: #fff;
    border: 1px solid var(--labsa-chat-border);
    border-radius: 14px;
    box-shadow: 0 7px 22px rgba(15, 46, 87, 0.06);
}

.labsa-chat-admin-head > div {
    display: flex;
    align-items: center;
    gap: 12px;
}

.labsa-chat-admin-head > div > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    color: #fff;
    background: linear-gradient(135deg, #0d6efd, #1594e8);
    border-radius: 12px;
}

.labsa-chat-admin-head > div > span i {
    font-size: 25px;
}

.labsa-chat-admin-head h4,
.labsa-chat-admin-head p {
    margin: 0;
}

.labsa-chat-admin-head h4 {
    color: var(--labsa-chat-text);
    font-size: 18px;
    font-weight: 700;
}

.labsa-chat-admin-head p {
    margin-top: 3px;
    color: var(--labsa-chat-muted);
    font-size: 14px;
}

.labsa-chat-admin-head label {
    display: flex;
    align-items: center;
    width: min(310px, 38vw);
    padding: 0 11px;
    color: #7890aa;
    background: #f8fafc;
    border: 1px solid #d9e4ef;
    border-radius: 10px;
}

.labsa-chat-admin-head label i {
    font-size: 19px;
}

.labsa-chat-admin-head input {
    width: 100%;
    min-height: 42px;
    padding: 8px;
    background: transparent;
    border: 0;
    outline: 0;
    font-size: 14px;
}

.labsa-chat-admin-layout {
    display: grid;
    grid-template-columns: minmax(280px, 350px) minmax(0, 1fr);
    height: calc(100vh - 178px);
    min-height: 520px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--labsa-chat-border);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(15, 46, 87, 0.07);
}

.labsa-chat-participant-column {
    min-width: 0;
    overflow: hidden;
    background: #fbfdff;
    border-right: 1px solid var(--labsa-chat-border);
}

.labsa-chat-participant-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 58px;
    padding: 13px 15px;
    border-bottom: 1px solid var(--labsa-chat-border);
}

.labsa-chat-participant-summary strong {
    color: var(--labsa-chat-text);
    font-size: 14px;
}

.labsa-chat-participant-summary span {
    padding: 4px 8px;
    color: #166534;
    background: #dcfce7;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
}

.labsa-chat-participant-list {
    height: calc(100% - 58px);
    padding: 7px;
    overflow-y: auto;
}

.labsa-chat-participant-item {
    position: relative;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-bottom: 4px;
    padding: 10px;
    color: inherit;
    text-align: left;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 11px;
    cursor: pointer;
}

.labsa-chat-participant-item:hover {
    background: #f0f7ff;
}

.labsa-chat-participant-item.is-active {
    background: #eaf4ff;
    border-color: #bedcff;
}

.labsa-chat-participant-item.is-offline .labsa-chat-avatar {
    background: linear-gradient(135deg, #64748b, #94a3b8);
}

.labsa-chat-participant-item.is-offline:not(.is-active) {
    opacity: 0.82;
}

.labsa-chat-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    color: #fff;
    background: linear-gradient(135deg, #0d6efd, #32a5ea);
    border-radius: 12px;
    font-size: 16px;
    font-weight: 800;
}

.labsa-chat-participant-item > div {
    min-width: 0;
}

.labsa-chat-participant-item strong,
.labsa-chat-participant-item small,
.labsa-chat-participant-item p {
    display: block;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.labsa-chat-participant-item strong {
    color: #183451;
    font-size: 14px;
}

.labsa-chat-participant-item small {
    margin-top: 2px;
    color: #557493;
    font-size: 14px;
}

.labsa-chat-participant-item p {
    margin-top: 3px;
    color: #8799ad;
    font-size: 14px;
}

.labsa-chat-participant-item > b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 5px;
    color: #fff;
    background: #ef4444;
    border-radius: 999px;
    font-size: 14px;
}

.labsa-chat-list-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    min-height: 240px;
    padding: 25px;
    color: #8295aa;
    text-align: center;
    font-size: 14px;
}

.labsa-chat-list-empty i {
    margin-bottom: 8px;
    font-size: 34px;
}

.labsa-chat-admin-conversation {
    position: relative;
    min-width: 0;
    min-height: 0;
}

.labsa-chat-admin-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    height: 100%;
    padding: 30px;
    color: #8093aa;
    text-align: center;
}

.labsa-chat-admin-placeholder[hidden] {
    display: none !important;
}

.labsa-chat-admin-placeholder i {
    margin-bottom: 10px;
    color: #aec0d4;
    font-size: 58px;
}

.labsa-chat-admin-placeholder h5,
.labsa-chat-admin-placeholder p {
    margin: 0;
}

.labsa-chat-admin-placeholder h5 {
    color: #45627f;
    font-size: 16px;
}

.labsa-chat-admin-placeholder p {
    max-width: 360px;
    margin-top: 5px;
    font-size: 14px;
}

.labsa-chat-admin-thread {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.labsa-chat-admin-thread[hidden] {
    display: none !important;
}

.labsa-chat-admin-thread > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 59px;
    padding: 11px 15px;
    border-bottom: 1px solid var(--labsa-chat-border);
}

.labsa-chat-admin-thread > header strong,
.labsa-chat-admin-thread > header small {
    display: block;
}

.labsa-chat-admin-thread > header strong {
    color: var(--labsa-chat-text);
    font-size: 14px;
}

.labsa-chat-admin-thread > header small {
    margin-top: 2px;
    color: var(--labsa-chat-muted);
    font-size: 14px;
}

.labsa-chat-online {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #166534;
    font-size: 14px;
    font-weight: 700;
}

.labsa-chat-online::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
}

.labsa-chat-online.is-offline {
    color: #64748b;
}

.labsa-chat-online.is-offline::before {
    background: #94a3b8;
}

@media (max-width: 991px) {
    .labsa-chat-admin-shell {
        left: 0;
        padding: 16px;
    }

    .labsa-chat-admin-layout {
        grid-template-columns: 300px minmax(0, 1fr);
    }
}

@media (max-width: 767px) {
    #labsa-exam-chat-launcher {
        right: 12px;
        bottom: 70px;
    }

    #labsa-exam-chat-panel {
        right: 8px;
        bottom: 126px;
        width: calc(100vw - 16px);
        height: min(600px, calc(100vh - 138px));
    }

    #labsa-exam-chat-camera-button span {
        display: none;
    }

    .labsa-chat-admin-head {
        align-items: stretch;
        flex-direction: column;
    }

    .labsa-chat-admin-head label {
        width: 100%;
    }

    .labsa-chat-admin-layout {
        display: block;
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .labsa-chat-participant-column {
        height: 300px;
        border-right: 0;
        border-bottom: 1px solid var(--labsa-chat-border);
    }

    .labsa-chat-admin-conversation {
        height: 520px;
    }
}
