/* ==========================================================================
   GDZKEY - VIRTUAL CLASSROOM CSS (v2.5 - Cross-Platform Toasts & Dialogs)
   ========================================================================== */

.gdz-class-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1a202c;
    max-width: 1080px;
    margin: 0 auto 0 auto;
    padding: 0 8px 10px 8px;
    user-select: none;
    border-radius: 0 !important;
    transition: background-color 0.3s ease, color 0.3s ease;
    box-sizing: border-box;
}

/* 1. TOP BAR */
.class-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 8px;
    transition: all 0.3s ease;
}

.class-topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.class-badge-room {
    background: #ebf8ff;
    color: #2b6cb0;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    letter-spacing: 0.2px;
}

.class-online-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #4a5568;
    font-weight: 700;
}

.pulse-dot {
    width: 9px;
    height: 9px;
    background: #38a169;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(56, 161, 105, 0.7);
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(56, 161, 105, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(56, 161, 105, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(56, 161, 105, 0); }
}

.class-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.my-profile-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #ebf8ff;
    border: 1.5px solid #bee3f8;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 700;
    color: #2c5282;
}

.my-lvl {
    background: #3182ce;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 8px;
}

.my-seat-num {
    background: #c6f6d5;
    color: #22543d;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 8px;
}

.class-btn-icon {
    background: #f7fafc;
    border: 1.5px solid #cbd5e0;
    padding: 7px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    color: #2d3748;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
}
.class-btn-icon:hover, .class-btn-icon:active {
    background: #edf2f7;
    border-color: #a0aec0;
}

/* 2. BLACKBOARD */
.class-blackboard {
    margin-bottom: 16px;
}

.board-frame {
    background: #143627;
    border: 8px solid #7c4a24;
    border-radius: 12px;
    padding: 16px 18px 12px 18px;
    box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.5), 0 6px 18px rgba(0, 0, 0, 0.12);
    position: relative;
    color: #ffffff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

.board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px dashed rgba(255, 255, 255, 0.25);
    padding-bottom: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.board-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.3px;
    color: #ffffff;
}

.board-leader {
    background: rgba(255, 215, 0, 0.25);
    border: 1px solid #ffd700;
    color: #fff9c4;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12.5px;
    font-weight: 800;
}

.chalk-main-quote {
    font-size: 14.5px;
    font-style: italic;
    color: #e2f0d9;
    margin: 0 0 12px 0;
    line-height: 1.45;
}

.board-quick-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.board-action-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    color: #ffffff;
    padding: 7px 13px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}
.board-action-btn:hover, .board-action-btn:active {
    background: rgba(255, 255, 255, 0.3);
    border-color: #ffffff;
}

.board-btn-danger {
    background: rgba(229, 62, 62, 0.3);
    border-color: rgba(229, 62, 62, 0.6);
    color: #fed7d7;
}

/* ACTIVE VOTE IN BOARD */
.board-vote-box {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #ffd700;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
}

.vote-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.vote-badge {
    background: #ffd700;
    color: #1a202c;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
}

.vote-timer {
    font-weight: 800;
    color: #ffeb3b;
    font-size: 13px;
}

.vote-question {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #ffffff;
}

.vote-actions {
    display: flex;
    gap: 8px;
}

.btn-vote {
    flex: 1;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 800;
    cursor: pointer;
    border: none;
}
.btn-vote-yes { background: #38a169; color: #fff; }
.btn-vote-no { background: #e53e3e; color: #fff; }

.board-chalk-tray {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}
.chalk-piece {
    display: inline-block;
    width: 24px;
    height: 7px;
    border-radius: 2px;
}
.chalk-white { background: #ffffff; }
.chalk-yellow { background: #fff59d; }
.chalk-pink { background: #f48fb1; }
.chalk-duster {
    margin-left: auto;
    font-size: 18px;
    cursor: pointer;
}

/* 3. ROW LABELS */
.class-rows-labels {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 10px;
}
.row-label {
    background: #edf2f7;
    text-align: center;
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 800;
    color: #4a5568;
    border: 1px solid #cbd5e0;
}

/* 4. DESKS GRID */
.class-desks-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 8px;
}

/* DESK CARD */
.desk-card {
    background: #fffaf0;
    border: 2px solid #dd6b20;
    border-radius: 12px;
    padding: 12px;
    min-height: 155px;
    position: relative;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
}

.desk-card.is-my-seat {
    border-color: #3182ce;
    background: #ebf8ff;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.25);
}

.desk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.desk-num-badge {
    background: #feebc8;
    color: #7b341e;
    font-weight: 800;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 6px;
    border: 1px solid #fbd38d;
}

.desk-item-icon {
    font-size: 18px;
}

/* EMPTY DESK */
.desk-card.is-empty {
    border: 2px dashed #cbd5e0;
    background: #f7fafc;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.desk-card.is-empty:hover, .desk-card.is-empty:active {
    border-color: #3182ce;
    background: #ebf8ff;
}

.btn-take-seat {
    white-space: nowrap;
    background: #ffffff;
    border: 2px solid #3182ce;
    color: #3182ce;
    font-weight: 800;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(49, 130, 206, 0.15);
}
.desk-card.is-empty:hover .btn-take-seat,
.desk-card.is-empty:active .btn-take-seat {
    white-space: nowrap;
    background: #3182ce;
    color: #ffffff;
}

/* OCCUPIED DESK */
.desk-body {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    position: relative;
}

.desk-avatar-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    position: relative;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    flex-shrink: 0;
}

.desk-avatar-circle.is-leader::after {
    content: '👑';
    position: absolute;
    top: -7px;
    right: -3px;
    font-size: 14px;
}

.desk-student-info {
    overflow: hidden;
    flex: 1;
}

.desk-student-name {
    font-weight: 900;
    font-size: 15px;
    color: #ffffff;
    text-shadow: 1px 1px 2px #000, -1px -1px 2px #000, 1px -1px 2px #000, -1px 1px 2px #000, 0 2px 4px rgba(0,0,0,0.9);
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
    line-height: 1.2;
}

.desk-planes-count {
    font-size: 11px;
    color: #718096;
    font-weight: 700;
}

/* SPEECH BUBBLE */
.desk-speech-bubble {
    background: #ffffff;
    border: 1.5px solid #1a202c;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12.5px;
    font-weight: 700;
    color: #111827;
    position: relative;
    margin-top: 4px;
    word-break: break-word;
    box-shadow: 2px 2px 0px #1a202c;
    line-height: 1.35;
}

.desk-speech-bubble::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 16px;
    border-width: 0 6px 6px 6px;
    border-style: solid;
    border-color: transparent transparent #1a202c transparent;
}

.desk-actions-row {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.btn-desk-action {
    flex: 1;
    background: #ffffff;
    border: 1.5px solid #cbd5e0;
    padding: 5px 6px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 800;
    color: #2d3748;
    cursor: pointer;
    text-align: center;
}
.btn-desk-action:hover, .btn-desk-action:active {
    background: #edf2f7;
    border-color: #a0aec0;
}

/* ==========================================================================
   5. MODALS & DIALOGS
   ========================================================================== */
.class-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    box-sizing: border-box;
}

.class-modal-card {
    background: #ffffff;
    border-radius: 16px;
    max-width: 480px;
    width: 100%;
    padding: 22px 18px 18px 18px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    position: relative;
    max-height: 88vh;
    overflow-y: auto;
    box-sizing: border-box;
    animation: modalPop 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.class-modal-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: #edf2f7;
    border: 1.5px solid #cbd5e0;
    border-radius: 50%;
    color: #2d3748;
    font-size: 18px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}
.class-modal-close-btn:hover, .class-modal-close-btn:active {
    background: #e2e8f0;
    color: #e53e3e;
    transform: scale(1.08);
}

.modal-header {
    padding-right: 32px;
    margin-bottom: 14px;
}
.modal-header h3 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 800;
    color: #1a202c;
}
.modal-header p {
    margin: 0;
    font-size: 13px;
    color: #4a5568;
    line-height: 1.35;
}

.modal-form-group {
    margin-bottom: 12px;
}
.modal-form-group label {
    display: block;
    font-weight: 800;
    font-size: 13px;
    color: #2d3748;
    margin-bottom: 6px;
}

.class-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #cbd5e0;
    border-radius: 10px;
    font-size: 14.5px;
    font-weight: 600;
    box-sizing: border-box;
    color: #1a202c;
    background: #ffffff;
}
.class-input:focus {
    outline: none;
    border-color: #3182ce;
}

/* AVATAR PICKER */
.avatar-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
}
.av-choice {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    border: 2px solid transparent;
}
.av-choice.selected {
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.4);
    transform: scale(1.1);
}

/* ITEM PICKER */
.item-picker-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.item-choice {
    background: #edf2f7;
    border: 1.5px solid #cbd5e0;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    color: #2d3748;
}
.item-choice.selected {
    background: #ebf8ff;
    border-color: #3182ce;
    color: #2b6cb0;
}

.quick-phrase-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.chip {
    background: #edf2f7;
    border: 1px solid #cbd5e0;
    border-radius: 18px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    color: #2d3748;
}
.chip:hover, .chip:active {
    background: #e2e8f0;
}

/* MODAL ACTION BUTTONS */
.modal-actions-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 8px;
    margin-top: 14px;
}

.class-btn-primary {
    background: #3182ce;
    color: #ffffff;
    font-weight: 800;
    font-size: 14.5px;
    padding: 12px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
}
.class-btn-primary:hover, .class-btn-primary:active {
    background: #2b6cb0;
}

.class-btn-cancel {
    background: #edf2f7;
    border: 1.5px solid #cbd5e0;
    color: #4a5568;
    font-weight: 800;
    font-size: 13.5px;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
}
.class-btn-cancel:hover, .class-btn-cancel:active {
    background: #e2e8f0;
}

/* ==========================================================================
   6. CROSS-PLATFORM TOAST NOTIFICATIONS (CENTERED)
   ========================================================================== */
#classToastContainer {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    pointer-events: none;
    width: 90%;
    max-width: 440px;
}

.class-toast {
    background: #ffffff;
    border-radius: 18px;
    padding: 14px 16px;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(0, 0, 0, 0.08);
    border: 2px solid #e2e8f0;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    pointer-events: auto;
    width: 100%;
    box-sizing: border-box;
    animation: toastPopCenter 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

@keyframes toastPopCenter {
    0% { transform: scale(0.6); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.class-toast-icon {
    font-size: 24px;
    flex-shrink: 0;
    line-height: 1;
}

.class-toast-content {
    flex: 1;
    overflow: hidden;
}

.class-toast-title {
    font-weight: 800;
    font-size: 14.5px;
    color: #1a202c;
    margin-bottom: 2px;
}

.class-toast-text {
    font-size: 13px;
    color: #4a5568;
    line-height: 1.4;
    font-weight: 600;
}

.class-toast-close {
    background: none;
    border: none;
    color: #a0aec0;
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    font-weight: 900;
}
.class-toast-close:hover { color: #2d3748; }

.class-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3.5px;
    background: #3182ce;
    width: 100%;
}

.class-toast.toast-success { border-color: #38a169; }
.class-toast.toast-success .class-toast-progress { background: #38a169; }

.class-toast.toast-warning { border-color: #dd6b20; }
.class-toast.toast-warning .class-toast-progress { background: #dd6b20; }

.class-toast.toast-error { border-color: #e53e3e; }
.class-toast.toast-error .class-toast-progress { background: #e53e3e; }

.class-toast.toast-info { border-color: #3182ce; }
.class-toast.toast-info .class-toast-progress { background: #3182ce; }

/* CONFIRMATION DIALOG */
.confirm-dialog-card {
    max-width: 420px;
    text-align: center;
}
.confirm-dialog-icon {
    font-size: 40px;
    margin-bottom: 8px;
}
.confirm-dialog-title {
    font-size: 18px;
    font-weight: 800;
    color: #1a202c;
    margin-bottom: 6px;
}
.confirm-dialog-msg {
    font-size: 14px;
    color: #4a5568;
    margin-bottom: 18px;
    line-height: 1.45;
}
.confirm-dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* ==========================================================================
   7. DARK THEME
   ========================================================================== */
.gdz-class-wrapper.dark-mode {
    background: #111827;
    color: #f3f4f6;
    border-radius: 0 !important;
    padding: 4px 8px 10px 8px;
}

.gdz-class-wrapper.dark-mode .class-topbar {
    background: #1f2937;
    border-color: #374151;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.gdz-class-wrapper.dark-mode .class-badge-room {
    background: #1e3a8a;
    color: #93c5fd;
}

.gdz-class-wrapper.dark-mode .class-online-indicator { color: #9ca3af; }

.gdz-class-wrapper.dark-mode .my-profile-pill {
    background: #1e3a8a;
    border-color: #3b82f6;
    color: #bfdbfe;
}

.gdz-class-wrapper.dark-mode .my-seat-num {
    background: #065f46;
    color: #a7f3d0;
}

.gdz-class-wrapper.dark-mode .class-btn-icon {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}
.gdz-class-wrapper.dark-mode .class-btn-icon:hover { background: #4b5563; }

.gdz-class-wrapper.dark-mode .row-label {
    background: #1f2937;
    border-color: #374151;
    color: #9ca3af;
}

.gdz-class-wrapper.dark-mode .desk-card {
    background: #1f2937;
    border-color: #4b5563;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.gdz-class-wrapper.dark-mode .desk-card.is-my-seat {
    background: #1e3a8a;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.35);
}

.gdz-class-wrapper.dark-mode .desk-num-badge {
    background: #374151;
    color: #e5e7eb;
    border-color: #4b5563;
}

.gdz-class-wrapper.dark-mode .desk-student-name { color: #ffffff; text-shadow: 1px 1px 3px #000000, -1px -1px 3px #000000, 1px -1px 3px #000000, -1px 1px 3px #000000; }
.gdz-class-wrapper.dark-mode .desk-planes-count { color: #9ca3af; }

.gdz-class-wrapper.dark-mode .desk-card.is-empty {
    background: #161e2e;
    border-color: #374151;
}
.gdz-class-wrapper.dark-mode .desk-card.is-empty:hover {
    background: #1e293b;
    border-color: #60a5fa;
}

.gdz-class-wrapper.dark-mode .btn-take-seat {
    white-space: nowrap;
    background: #1f2937;
    border-color: #3b82f6;
    color: #93c5fd;
}
.gdz-class-wrapper.dark-mode .desk-card.is-empty:hover .btn-take-seat {
    white-space: nowrap;
    background: #3b82f6;
    color: #ffffff;
}

.gdz-class-wrapper.dark-mode .btn-desk-action {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}
.gdz-class-wrapper.dark-mode .btn-desk-action:hover { background: #4b5563; }

.gdz-class-wrapper.dark-mode .desk-speech-bubble {
    background: #374151;
    border-color: #e5e7eb;
    color: #ffffff;
    box-shadow: 2px 2px 0px #000000;
}
.gdz-class-wrapper.dark-mode .desk-speech-bubble::before {
    border-color: transparent transparent #e5e7eb transparent;
}

.gdz-class-wrapper.dark-mode .board-frame {
    background: #0d281a;
    border-color: #533118;
}

/* Dark Modals */
.class-modal-card.dark-modal {
    background: #1f2937;
    color: #f3f4f6;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.7);
}
.class-modal-card.dark-modal .modal-header h3 { color: #ffffff; }
.class-modal-card.dark-modal .modal-header p { color: #9ca3af; }
.class-modal-card.dark-modal .modal-form-group label { color: #e5e7eb; }

.class-modal-card.dark-modal .class-modal-close-btn {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}
.class-modal-card.dark-modal .class-modal-close-btn:hover {
    background: #4b5563;
    color: #f87171;
}

.class-modal-card.dark-modal .class-input {
    background: #374151;
    border-color: #4b5563;
    color: #ffffff;
}
.class-modal-card.dark-modal .class-input:focus { border-color: #60a5fa; }

.class-modal-card.dark-modal .item-choice {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}
.class-modal-card.dark-modal .item-choice.selected {
    background: #1e3a8a;
    border-color: #3b82f6;
    color: #93c5fd;
}

.class-modal-card.dark-modal .chip {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}
.class-modal-card.dark-modal .chip:hover { background: #4b5563; }

.class-modal-card.dark-modal .class-btn-cancel {
    background: #374151;
    border-color: #4b5563;
    color: #e5e7eb;
}

.class-modal-card.dark-modal .confirm-dialog-title { color: #ffffff; }
.class-modal-card.dark-modal .confirm-dialog-msg { color: #9ca3af; }

/* Dark Toasts */
.dark-toast {
    background: #1f2937 !important;
    border-color: #4b5563 !important;
    color: #f3f4f6 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6) !important;
}
.dark-toast .class-toast-title { color: #ffffff !important; }
.dark-toast .class-toast-text { color: #d1d5db !important; }
.dark-toast .class-toast-close { color: #9ca3af !important; }

/* ==========================================================================
   8. MOBILE RESPONSIVE
   ========================================================================== */
@media (max-width: 768px) {
    .class-rows-labels { display: none; }
    .class-desks-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .desk-card {
        padding: 9px;
        min-height: 140px;
    }
    .desk-avatar-circle {
        width: 38px;
        height: 38px;
        font-size: 19px;
    }
    .desk-student-name { font-size: 13px; }
    .desk-speech-bubble {
        font-size: 11.5px;
        padding: 5px 8px;
    }
    .btn-desk-action {
        font-size: 11px;
        padding: 4px;
    }
    .btn-text-hide-mob { display: none; }
    .avatar-picker-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
    .av-choice {
        width: 44px;
        height: 44px;
        font-size: 22px;
    }
    .board-frame {
        padding: 12px 14px 10px 14px;
        border-width: 6px;
    }
    .board-title { font-size: 16px; }
    .class-modal-card { padding: 18px 14px 14px 14px; }
    #classToastContainer { width: 94%; }
}

@media (max-width: 420px) {
    .class-desks-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    .desk-card { padding: 8px; }
}


/* AVATAR VECTOR IMAGES STYLES */
.desk-av-img, .av-choice-img, .lb-av-img, .topbar-av-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    display: block;
    pointer-events: none;
}
.desk-avatar-circle {
    overflow: visible !important;
    padding: 2px;
    box-sizing: border-box;
}
.av-choice {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2.5px solid transparent;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    padding: 3px;
    box-sizing: border-box;
    overflow: hidden;
}
.av-choice:hover {
    transform: scale(1.08);
}
.av-choice.selected {
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.4);
    transform: scale(1.12);
}
.lb-av {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 2px;
    box-sizing: border-box;
}
.my-av {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    vertical-align: middle;
}

/* ==========================================================================
   2. CLEAN BLACKBOARD WITH CHALK LOG (v2.5)
   ========================================================================== */
.class-blackboard {
    margin-bottom: 16px;
}

.board-frame {
    background: #143324;
    border: 8px solid #6b3f1f;
    border-radius: 12px;
    padding: 14px 18px 10px 18px;
    box-shadow: inset 0 0 35px rgba(0, 0, 0, 0.65), 0 8px 22px rgba(0, 0, 0, 0.18);
    position: relative;
    color: #ffffff;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    overflow: hidden;
}

.board-frame::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

.board-chalk-dust {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at 50% 40%, rgba(255,255,255,0.03) 0%, transparent 70%);
    pointer-events: none;
}

.board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1.5px dashed rgba(255, 255, 255, 0.22);
    padding-bottom: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}

.board-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #e2f0d9;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

.board-leader {
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid #ffd700;
    color: #fff9c4;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 800;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

/* CHALK LOG FEED */
.chalk-log-container {
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4px 2px;
}

.chalk-log-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chalk-log-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    line-height: 1.35;
    color: #f0fff4;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8), 0 0 1px rgba(255,255,255,0.4);
    animation: chalkWriteIn 0.35s ease-out forwards;
}

@keyframes chalkWriteIn {
    from { opacity: 0; transform: translateX(-6px); }
    to { opacity: 1; transform: translateX(0); }
}

.chalk-log-time {
    font-size: 11.5px;
    color: #81e6d9;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.35);
    padding: 1px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.chalk-log-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.chalk-log-text {
    flex-grow: 1;
    word-break: break-word;
}

.chalk-log-item.chalk-type-speech .chalk-log-text {
    color: #fff9c4;
    font-style: italic;
}
.chalk-log-item.chalk-type-vote .chalk-log-text {
    color: #ffd700;
    font-weight: 700;
}
.chalk-log-item.chalk-type-bell .chalk-log-text {
    color: #ff9a9e;
    font-weight: 800;
}
.chalk-log-item.chalk-type-wipe .chalk-log-text {
    color: #a7f3d0;
    font-style: italic;
}

.chalk-log-empty {
    font-size: 14px;
    font-style: italic;
    color: rgba(226, 240, 217, 0.7);
    text-align: center;
    padding: 12px 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

/* WIPE ANIMATION */
.board-frame.chalkboard-wiping .board-content {
    animation: wipeDustSweep 0.6s ease-in-out forwards;
}

@keyframes wipeDustSweep {
    0% { opacity: 1; filter: blur(0px); }
    50% { opacity: 0.2; filter: blur(4px); transform: scale(0.98); }
    100% { opacity: 1; filter: blur(0px); transform: scale(1); }
}

/* BOARD BOTTOM BAR */
.board-bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    flex-wrap: wrap;
    gap: 8px;
}

.board-chalk-tray {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chalk-piece {
    width: 22px;
    height: 7px;
    border-radius: 3px;
    display: inline-block;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.chalk-white { background: #ffffff; }
.chalk-yellow { background: #fef08a; }
.chalk-cyan { background: #a5f3fc; }
.chalk-pink { background: #fbcfe8; }

.chalk-tray-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
}
.chalk-tray-btn:hover, .chalk-tray-btn:active {
    background: rgba(255, 255, 255, 0.28);
    border-color: #ffffff;
    transform: translateY(-1px);
}

.board-quick-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.board-action-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}
.board-action-btn:hover, .board-action-btn:active {
    background: rgba(255, 255, 255, 0.3);
    border-color: #ffffff;
}

.board-btn-danger {
    background: rgba(229, 62, 62, 0.3);
    border-color: rgba(229, 62, 62, 0.6);
    color: #fed7d7;
}

/* DARK MODE BLACKBOARD */
.dark-mode .board-frame {
    background: #17231d;
    border-color: #4a2d18;
    box-shadow: inset 0 0 35px rgba(0, 0, 0, 0.85), 0 8px 22px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   CLEAN TOPBAR & BOARD CONTROLS BELOW BOARD (v2.5)
   ========================================================================== */

/* TOPBAR */
.class-topbar {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    background: #ffffff !important;
    border-radius: 12px !important;
    padding: 5px 10px !important;
    margin-bottom: 12px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
    border: 1px solid #e2e8f0 !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
}

.class-topbar-left {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.class-topbar-right {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
}

.class-btn-icon {
    background: #f7fafc !important;
    border: 1.5px solid #cbd5e0 !important;
    padding: 6px 12px !important;
    border-radius: 8px !important;
    font-size: 12.5px !important;
    font-weight: 700 !important;
    color: #2d3748 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    height: 34px !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
}
.class-btn-icon:hover {
    background: #edf2f7 !important;
    border-color: #a0aec0 !important;
}

/* BLACKBOARD FRAME (CLEAN SLATE ONLY) */
.class-blackboard {
    margin-bottom: 16px !important;
}

.board-frame {
    background: #143324 !important;
    border: 7px solid #6b3f1f !important;
    border-radius: 12px !important;
    padding: 14px 16px !important;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.65), 0 6px 18px rgba(0, 0, 0, 0.15) !important;
    position: relative !important;
    color: #ffffff !important;
    min-height: 150px !important;
    box-sizing: border-box !important;
}

.board-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-bottom: 1.5px dashed rgba(255, 255, 255, 0.2) !important;
    padding-bottom: 8px !important;
    margin-bottom: 10px !important;
}

.board-title {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #e2f0d9 !important;
}

.chalk-log-container {
    min-height: 100% !important;
    max-height: 280px !important;
    overflow-y: auto !important;
    padding-right: 4px !important;
}

.chalk-log-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
}

.chalk-log-item {
    font-size: 13.5px !important;
    line-height: 1.35 !important;
    color: #f0fff4 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

/* CONTROLS ROW BELOW BOARD */
.board-controls-bar {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin-top: 10px !important;
    flex-wrap: wrap !important;
}

.board-ctrl-btn {
    flex: 1 1 auto !important;
    padding: 5px 10px !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    border-radius: 9px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    border: none !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
    white-space: nowrap !important;
    min-height: 30px !important;
}

.btn-ctrl-duster {
    background: #f7fafc !important;
    border: 1.5px solid #cbd5e0 !important;
    color: #2d3748 !important;
}
.btn-ctrl-duster:hover {
    background: #edf2f7 !important;
    border-color: #a0aec0 !important;
}

.btn-ctrl-bell {
    background: #3182ce !important;
    color: #ffffff !important;
}
.btn-ctrl-bell:hover {
    background: #2b6cb0 !important;
}

.btn-ctrl-speech {
    background: #38a169 !important;
    color: #ffffff !important;
}
.btn-ctrl-speech:hover {
    background: #2f855a !important;
}

.btn-ctrl-leave {
    background: #e53e3e !important;
    color: #ffffff !important;
}
.btn-ctrl-leave:hover {
    background: #c53030 !important;
}

/* DARK MODE CONTROLS */
.dark-mode .class-topbar {
    background: #1f2937 !important;
    border-color: #374151 !important;
}
.dark-mode .class-btn-icon {
    background: #374151 !important;
    border-color: #4b5563 !important;
    color: #f3f4f6 !important;
}
.dark-mode .class-btn-icon:hover {
    background: #4b5563 !important;
}
.dark-mode .board-frame {
    background: #122119 !important;
    border-color: #4a2c16 !important;
}
.dark-mode .btn-ctrl-duster {
    background: #1f2937 !important;
    border-color: #374151 !important;
    color: #e5e7eb !important;
}
.dark-mode .btn-ctrl-duster:hover {
    background: #374151 !important;
}

/* MOBILE ADAPTATION */
@media (max-width: 600px) {
    .class-topbar {
        padding: 6px 10px !important;
    }
    .class-topbar-right {
        width: 100% !important;
        justify-content: space-between !important;
        margin-top: 4px !important;
    }
    .class-btn-icon {
        flex: 1 !important;
        padding: 6px 8px !important;
        font-size: 11.5px !important;
        justify-content: center !important;
    }
    .board-controls-bar {
        gap: 6px !important;
    }
    .board-ctrl-btn {
        flex: 1 1 45% !important;
        font-size: 12px !important;
        padding: 5px 6px !important;
        min-height: 28px !important;
        font-size: 11px !important;
    }
}

@media (max-width: 768px) {
    .btn-take-seat {
        font-size: 11px !important;
        padding: 5px 6px !important;
        border-width: 1px !important;
    }
    .board-frame {
        min-height: 380px !important;
    }
    .chalk-decor {
        display: none !important;
    }
}

.board-frame { min-height: 320px !important; }

/* LEADERBOARD ROW STYLES */
.lb-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid #e2e8f0;
    gap: 10px;
}
.dark-modal .lb-row {
    border-bottom-color: #374151;
}
.lb-row:last-child {
    border-bottom: none;
}
.lb-rank {
    font-weight: 800;
    font-size: 16px;
    width: 28px;
    text-align: center;
    color: #4a5568;
}
.dark-modal .lb-rank {
    color: #a0aec0;
}
.lb-rank-1 { color: #d69e2e !important; font-size: 20px; }
.lb-rank-2 { color: #718096 !important; font-size: 18px; }
.lb-rank-3 { color: #dd6b20 !important; font-size: 17px; }

.lb-av {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.lb-name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dark-modal .lb-name {
    color: #e2e8f0;
}
.lb-name small {
    font-weight: 400;
    font-size: 12px;
}
.lb-xp {
    font-weight: 700;
    font-size: 14px;
    color: #3182ce;
    white-space: nowrap;
}
.dark-modal .lb-xp {
    color: #63b3ed;
}

.chalk-log-container { justify-content: flex-start !important; }

.chalk-type-fish {
    background: rgba(72, 187, 120, 0.2);
    border-left: 3px solid #48bb78;
    padding: 2px 6px;
    border-radius: 4px;
}
@keyframes shake {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  10% { transform: translate(-1px, -2px) rotate(-1deg); }
  20% { transform: translate(-3px, 0px) rotate(1deg); }
  30% { transform: translate(3px, 2px) rotate(0deg); }
  40% { transform: translate(1px, -1px) rotate(1deg); }
  50% { transform: translate(-1px, 2px) rotate(-1deg); }
  60% { transform: translate(-3px, 1px) rotate(0deg); }
  70% { transform: translate(3px, 1px) rotate(-1deg); }
  80% { transform: translate(-1px, -1px) rotate(1deg); }
  90% { transform: translate(1px, 2px) rotate(0deg); }
  100% { transform: translate(1px, -2px) rotate(-1deg); }
}

@media (max-width: 480px) {
    .class-topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 10px !important;
    }
    .class-topbar-left {
        justify-content: space-between;
        width: 100%;
    }
    .class-topbar-right {
        width: 100% !important;
        justify-content: space-between !important;
        flex-wrap: wrap !important;
        gap: 4px;
    }
    .class-btn-icon {
        padding: 6px 8px !important;
        font-size: 11px !important;
        flex: 1;
        justify-content: center;
    }
    .my-profile-pill {
        flex: 1;
        justify-content: center;
        padding: 4px 6px !important;
        font-size: 11px !important;
    }
}

@media (max-width: 480px) {
    #themeText, #lbBtnText, #soundText {
        display: none !important;
    }
}

/* Custom dark scrollbar for the chat logs */
.chalk-log-container::-webkit-scrollbar {
    width: 6px;
}
.chalk-log-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}
.chalk-log-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}
.chalk-log-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}
/* For Firefox */
.chalk-log-list {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.2);
}
