/**
 * REVIEWER APP - MAIN STYLESHEET
 * Light, cute pink theme with modern animations
 */

/* =====================================================
   CUSTOM PROPERTIES (CSS VARIABLES)
   ===================================================== */
:root {
    /* Pink Theme Colors */
    --primary-pink: #ff9eb4;
    --primary-pink-light: #ffb8ca;
    --primary-pink-dark: #ff7a99;
    --secondary-pink: #ffd4e0;
    --accent-pink: #ff6b9d;
    
    /* Neutral Colors */
    --white: #ffffff;
    --off-white: #fef9fb;
    --light-gray: #f8f4f6;
    --medium-gray: #e6dce0;
    --dark-gray: #8b7a82;
    --text-dark: #4a3540;
    
    /* Accent Colors */
    --success: #a8e6cf;
    --warning: #ffd3b6;
    --danger: #ffaaa5;
    --info: #d4a5f5;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #ff9eb4 0%, #ffd4e0 100%);
    --gradient-accent: linear-gradient(135deg, #ff6b9d 0%, #ff9eb4 100%);
    --gradient-soft: linear-gradient(180deg, #fef9fb 0%, #ffffff 100%);
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(255, 158, 180, 0.1);
    --shadow-md: 0 4px 16px rgba(255, 158, 180, 0.15);
    --shadow-lg: 0 8px 32px rgba(255, 158, 180, 0.2);
    --shadow-xl: 0 16px 48px rgba(255, 158, 180, 0.25);
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
}

/* =====================================================
   GLOBAL STYLES
   ===================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Quicksand', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--gradient-soft);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* =====================================================
   TYPOGRAPHY
   ===================================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
    color: var(--text-dark);
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

p {
    margin-bottom: var(--spacing-md);
}

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width var(--transition-base), height var(--transition-base);
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-accent {
    background: var(--gradient-accent);
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: #dc3545;
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background: transparent;
    color: var(--primary-pink);
    border: 2px solid var(--primary-pink);
}

.btn-outline:hover {
    background: var(--primary-pink);
    color: var(--white);
}

.btn-light {
    background: var(--white);
    color: var(--primary-pink);
    border: 1px solid var(--medium-gray);
}

.btn-light:hover {
    background: var(--secondary-pink);
    border-color: var(--primary-pink);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.125rem;
}

/* =====================================================
   CARDS
   ===================================================== */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-lg);
    transition: all var(--transition-base);
    border: 1px solid var(--medium-gray);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.card-header {
    padding-bottom: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--secondary-pink);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.card-body {
    padding: var(--spacing-md) 0;
}

.card-footer {
    padding-top: var(--spacing-md);
    margin-top: var(--spacing-md);
    border-top: 1px solid var(--medium-gray);
}

/* =====================================================
   FORMS
   ===================================================== */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: 500;
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 2px solid var(--medium-gray);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    background: var(--white);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-pink);
    box-shadow: 0 0 0 3px rgba(255, 158, 180, 0.1);
}

.form-control::placeholder {
    color: var(--dark-gray);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* =====================================================
   ALERTS
   ===================================================== */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid var(--success);
}

.alert-error {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid var(--danger);
}

.alert-info {
    background: #f3e5f5;
    color: #6a1b9a;
    border-left: 4px solid var(--info);
}

.alert-warning {
    background: #fff3e0;
    color: #e65100;
    border-left: 4px solid var(--warning);
}

/* Site alert container (toasts) */
.site-alert-container {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}
.site-alert-container.top-right {
    right: 16px;
    top: 16px;
    bottom: auto;
}
.site-alert {
    pointer-events: auto;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: translateY(10px);
    opacity: 0;
    transition: transform 0.25s var(--transition-fast), opacity 0.25s var(--transition-fast);
    width: 340px;
}
.site-alert.show { transform: translateY(0); opacity: 1; }
.site-alert-info { border-left: 4px solid var(--info); }
.site-alert-content { padding: 12px; }

/* Chat notification styles */
.chat-notif { display: flex; flex-direction: column; gap: 8px; }
.chat-notif-top { display:flex; align-items:center; gap:10px; }
.chat-notif-avatar { width:40px; height:40px; border-radius:50%; object-fit:cover; }
.chat-notif-user { font-weight:700; color:var(--text-dark); }
.chat-notif-body { color:var(--dark-gray); font-size:0.95rem; max-height:3.6rem; overflow:hidden; text-overflow:ellipsis; }
.chat-notif-type { font-size:0.8rem; color:var(--primary-pink); text-transform:uppercase; font-weight:600; }

/* Highlight briefly when scrolled to from a notification */
.msg-highlight {
    box-shadow: 0 0 0 4px rgba(255, 200, 0, 0.25);
    transition: box-shadow 0.3s ease;
}

/* =====================================================
   MODAL
   ===================================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(74, 53, 64, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

/* Helper modal layout: constrain height and keep footer visible
   Use on modals by adding the `modal-helper-box` class to `.modal-content` */
.modal-helper-box {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 32px);
    overflow: hidden;
    width: 90%;
}
.modal-helper-box .modal-body {
    flex: 1 1 auto;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}
/* Ensure the homepage search input has explicit background/color in both themes */
.search-input {
    background: var(--white);
    color: var(--text-dark);
}
body.dark .search-input {
    background: var(--light-gray);
    color: var(--text-dark);
}
.modal-helper-box .modal-footer {
    flex: 0 0 auto;
    position: sticky;
    bottom: 0;
    z-index: 60;
    background: linear-gradient(180deg, rgba(255,255,255,0.0), rgba(255,255,255,0.98));
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 24px rgba(0,0,0,0.06);
}

/* =====================================================
   FLASHCARD COMPONENT
   ===================================================== */
.flashcards-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.flashcard {
    width: 220px;
    height: 140px;
    perspective: 1000px;
    cursor: pointer;
}
.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}
.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}
.flashcard-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    padding: 12px;
    justify-content: center;
}
.flashcard-front {
    background: linear-gradient(180deg,#fff7fb,#fff);
    border: 1px solid rgba(255,150,180,0.12);
}
.flashcard-back {
    background: linear-gradient(180deg,#fff,#fff7fb);
    border: 1px solid rgba(255,150,180,0.12);
    transform: rotateY(180deg);
}
.flashcard-title {
    font-weight: 600;
    margin-bottom: 6px;
}
.flashcard-text {
    font-size: 0.95rem;
    color: var(--dark-gray);
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Flashcard viewer adjustments */
/* Flashcard viewer adjustments */
/* Use column flex layout so header/body/footer split and body can grow */
#flashcardViewerModal .modal-content {
    display: flex;
    flex-direction: column;
    max-width: 760px;
    width: 90%;
    max-height: 80vh;
    height: 80vh; /* explicitly give viewer a fixed viewport height so body can flex */
    overflow: hidden; /* let inner body scroll if needed */
}
#flashcardViewerModal .modal-header { flex: 0 0 auto; }
#flashcardViewerModal .modal-body {
    flex: 1 1 auto;
    padding: 0; /* let the card fill fully without outer padding */
    display: flex;
    align-items: stretch;
    justify-content: center;
    min-height: 280px;
}
#flashcardViewerModal .modal-footer { flex: 0 0 auto; }

#flashcardViewerModal #fcViewerCard {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 12px; /* inner inset so the card doesn't touch edges */
    box-sizing: border-box;
}

/* Make the flashcard expand to fill the available viewer body */
#flashcardViewerModal .flashcard {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: stretch !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    flex: 1 1 auto !important;
}

#flashcardViewerModal .flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
}

#flashcardViewerModal .flashcard-face {
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    width: 100%;
    height: 100%;
}

#flashcardViewerModal .flashcard-text { white-space: normal; text-align: center; }

/* Counter placed inside the card at the bottom center */
#flashcardViewerModal .flashcard-counter {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255,255,255,0.9);
    color: var(--primary-pink-dark);
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    z-index: 6;
}


.modal.show {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: var(--spacing-lg);
    border-bottom: 2px solid var(--secondary-pink);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--dark-gray);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--secondary-pink);
    color: var(--primary-pink);
}

.modal-body {
    padding: var(--spacing-lg);
}

.modal-footer {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--medium-gray);
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
}

/* Messenger-like modal styles (profile message modal) */
.message-modal {
    padding: 0;
    background: linear-gradient(180deg, #fff 0%, #fff 100%);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.mm-header {
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:14px 16px;
    border-bottom:1px solid var(--medium-gray);
    background: linear-gradient(90deg, rgba(255,158,180,0.04), rgba(255,210,220,0.02));
}
.mm-user { display:flex; align-items:center; gap:12px; }
.mm-user img { width:44px; height:44px; border-radius:999px; object-fit:cover; border:2px solid rgba(255,158,180,0.15); }
.mm-user-info { line-height:1; }
.mm-name { font-weight:700; color:var(--text-dark); }
.mm-sub { font-size:0.85rem; color:var(--dark-gray); }
.mm-actions .modal-close { background:none; border:none; font-size:20px; color:var(--dark-gray); cursor:pointer; }

.mm-thread-wrap { padding:12px 16px; background: transparent; flex:1 1 auto; overflow:hidden; }
.mm-thread { height:100%; max-height:60vh; overflow:auto; display:flex; flex-direction:column; gap:10px; padding-bottom:8px; }
.mm-empty { text-align:center; color:var(--dark-gray); padding:34px 8px; }

.mm-bubble { max-width:72%; padding:10px 12px; border-radius:12px; box-shadow: 0 3px 10px rgba(25,20,40,0.05); line-height:1.3; font-size:0.95rem; }
.mm-bubble .meta { font-size:0.8rem; color:var(--dark-gray); margin-bottom:6px; }
.mm-bubble.left { align-self:flex-start; background: var(--white); border:1px solid rgba(230,220,224,0.6); color: var(--text-dark); }
.mm-bubble.right { align-self:flex-end; background: linear-gradient(90deg, var(--primary-pink), var(--primary-pink-light)); color:white; }
.mm-bubble .time { font-size:0.75rem; color: rgba(0,0,0,0.45); margin-top:8px; display:block; }

.mm-input-area { display:flex; gap:10px; padding:12px; border-top:1px solid var(--medium-gray); align-items:flex-end; background: var(--white); }
.mm-input { flex:1; resize:none; padding:10px 12px; border-radius:18px; border:1px solid var(--medium-gray); font-family:inherit; font-size:0.95rem; min-height:42px; }
.mm-send { white-space:nowrap; padding:10px 14px; border-radius:18px; cursor:pointer; }

/* Message render adjustments for profile message modal */
.msg { display:flex; gap:12px; align-items:flex-end; }
.msg-self { flex-direction: row-reverse; }
.msg-avatar { width:44px; height:44px; border-radius:999px; object-fit:cover; border:2px solid rgba(255,158,180,0.15); }
.msg-avatar { margin-right:12px; }
.msg-self .msg-avatar { margin-left:12px; margin-right:8px; }
.msg-body { display:flex; flex-direction:column; max-width: calc(100% - 72px); }
.msg-bubble { padding:10px 14px; border-radius:12px; box-shadow: 0 3px 10px rgba(25,20,40,0.05); line-height:1.3; font-size:0.95rem; word-break:break-word; }
.msg-bubble.left { align-self:flex-start; background: var(--white); border:1px solid rgba(230,220,224,0.6); color:var(--text-dark); }
.msg-bubble.right { align-self:flex-end; background: linear-gradient(90deg, var(--primary-pink), var(--primary-pink-light)); color:white; }
.msg-time-below { font-size:0.75rem; color: rgba(0,0,0,0.45); margin-top:6px; }
.msg-self .msg-time-below { color: rgba(255,255,255,0.75); align-self: flex-end; }

/* Prevent avatar overlapping the scrollbar by adding right padding to thread container */
.mm-thread { padding-right: 20px; }

/* Input and send button styling to match provided design */
.mm-input { min-height:48px; border-radius:28px; padding:12px 16px; border:1px solid rgba(220,200,205,0.7); }
#sendMessageBtn, .mm-send { width:48px; height:48px; border-radius:999px; background: linear-gradient(90deg, var(--primary-pink), var(--primary-pink-light)); color:#fff; border:none; display:inline-flex; align-items:center; justify-content:center; box-shadow: 0 6px 20px rgba(255,105,150,0.12); }
#sendMessageBtn:hover, .mm-send:hover { transform: translateY(-2px); }

/* Modal helper sizing tweaks for mobile */
.modal-helper-box {
    max-height: 80vh !important;
    overflow: auto !important;
}
.modal-helper-box > div { /* header/body/footer */
    padding: 12px !important;
}
.modal-helper-box .btn { padding: 8px 12px !important; font-size: 0.95rem !important; }

@media (max-width: 600px) {
    .modal-helper-box { max-width: 360px !important; width: 92% !important; border-radius: 12px !important; max-height: 70vh !important; }
    .modal-helper-box { font-size: 0.9rem !important; }
    .modal-helper-header { padding: 10px 12px !important; font-size: 1rem !important; }
    .modal-helper-body { padding: 10px 12px !important; }
    .modal-helper-footer { padding: 8px 10px !important; }
    .modal-helper-box .btn { padding: 8px 10px !important; font-size: 0.9rem !important; }
}

/* Additional smaller breakpoint for very small devices */
@media (max-width: 380px) {
    .modal-helper-box { max-width: 320px !important; width: 94% !important; }
    .modal-helper-header { font-size: 0.95rem !important; }
    .modal-helper-body { font-size: 0.92rem !important; }
}

/* Force stricter sizing for helper modals to avoid full-height appearance */
.modal-helper-box {
    width: auto !important;
    max-width: 480px !important;
    max-height: 60vh !important;
    box-sizing: border-box !important;
}
.modal-helper-body {
    max-height: calc(60vh - 120px) !important;
    overflow: auto !important;
}

/* Compact small modal variant (like a lightweight alert) */
.modal-helper-small {
    max-width: 320px !important;
    width: 88% !important;
    border-radius: 10px !important;
}
.modal-helper-small .modal-helper-header { padding: 10px 12px !important; font-size: 1rem !important; }
.modal-helper-small .modal-helper-body { padding: 8px 12px !important; font-size: 0.95rem !important; }
.modal-helper-small .modal-helper-footer { padding: 8px 12px !important; }
.modal-helper-small .btn { padding: 6px 10px !important; font-size: 0.9rem !important; }
#sendMessageBtn:active, .mm-send:active { transform: translateY(0); }
#sendMessageBtn .icon, .mm-send .icon { pointer-events:none; }

/* Message bubble variants */
.mm-bubble.right .time { color: rgba(255,255,255,0.75); }

@media (max-width:600px) {
    .message-modal { width: 96%; max-width: 96%; }
    .mm-bubble { max-width:86%; }
    .mm-thread { max-height:56vh; }
}

/* Ensure message modal input area (send) stays visible on small screens */
.message-modal.modal-helper-box {
    display: flex;
    flex-direction: column;
}
.message-modal .mm-thread-wrap {
    flex: 1 1 auto;
    overflow: hidden;
}
.message-modal .mm-thread {
    overflow: auto;
    max-height: 60vh;
    padding-bottom: 12px; /* give room for sticky input */
}
.message-modal .mm-input-area {
    position: sticky;
    bottom: 0;
    z-index: 40;
    background: linear-gradient(180deg, rgba(255,255,255,0.0), rgba(255,255,255,0.98));
}

/* Mobile-friendly modal adjustments for reviewer/viewer modals */
@media (max-width: 480px) {
    .modal {
        align-items: flex-start; /* let modal content sit near top on small screens */
        padding: 8px;      /* small outer inset */
    }

    .modal-content {
        width: calc(100% - 16px) !important;
        max-width: calc(100% - 16px) !important;
        height: auto !important;
        max-height: calc(100vh - 16px) !important;
        border-radius: 12px !important;
        overflow: hidden;
        margin-top: 8px;
        display: flex;
        flex-direction: column;
    }

    /* Flashcard viewer mobile adjustments */
    #flashcardViewerModal .modal-content {
        width: calc(100% - 24px) !important;
        max-width: 520px !important;
        max-height: 92vh !important;
        height: 80vh !important;
        border-radius: 12px !important;
        display: flex !important;
        flex-direction: column !important;
    }

    #flashcardViewerModal .modal-body {
        padding: 0 !important;
        flex: 1 1 auto !important;
        display: flex !important;
        align-items: stretch !important;
        justify-content: center !important;
        overflow: hidden !important;
    }

    #flashcardViewerModal #fcViewerCard {
        padding: 12px !important;
        width: 100% !important;
        height: 100% !important;
        display: flex !important;
        align-items: stretch !important;
        box-sizing: border-box !important;
    }

    #flashcardViewerModal .flashcard {
        width: 100% !important;
        height: 100% !important;
        flex: 1 1 auto !important;
        display: flex !important;
        align-items: stretch !important;
        justify-content: center !important;
        box-sizing: border-box !important;
    }

    #flashcardViewerModal .flashcard-inner { 
        width: 100% !important;
        height: 100% !important;
    }

    #flashcardViewerModal .flashcard-face { 
        padding: 20px !important;
    }

    /* Stack footer controls to improve touch accessibility */
    #flashcardViewerModal .modal-footer { flex-direction: column; gap: 8px; align-items: stretch; }
    #flashcardViewerModal .modal-footer > div { display:flex; gap:8px; justify-content: center; }


/* Ensure flashcard text is readable on all backgrounds and sizes */
#flashcardViewerModal .flashcard-text {
    color: var(--text-dark) !important;
    font-size: 1rem !important;
    line-height: 1.4 !important;
    padding: 8px 12px !important;
    text-align: center !important;
    word-break: break-word !important;
}

/* Make faces taller on small viewports so content isn't clipped */
#flashcardViewerModal .flashcard-face {
    min-height: 120px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: var(--text-dark) !important;
    text-shadow: 0 1px 0 rgba(255,255,255,0.6);
}


    /* Reviewer modal specific constraints */
    .modal-content.reviewer-modal {
        max-height: calc(100vh - 16px) !important;
        height: auto !important;
    }

    .modal-header {
        padding: 10px 12px;
        flex-shrink: 0;
    }

    .modal-title {
        font-size: 1.1rem !important;
    }

    .modal-body {
        padding: 10px 12px;
        flex: 1 1 auto;
        overflow-y: auto !important;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        max-height: none !important;
    }

    /* Ensure flashcard viewer body gives the card room to expand */
    #flashcardViewerModal .modal-body { padding: 8px 10px; }

    .modal-footer {
        padding: 10px 12px;
        display: flex;
        flex-direction: column !important;
        gap: 8px;
        align-items: stretch !important;
        flex-shrink: 0;
        border-top: 1px solid rgba(0,0,0,0.05);
    }

    .modal-footer.custom-footer {
        flex-direction: column !important;
    }

    .modal-footer.custom-footer > div {
        width: 100%;
        display: flex;
        gap: 6px;
        justify-content: center;
    }

    .modal-footer .right-actions {
        width: 100%;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap;
        gap: 6px !important;
        justify-content: center;
    }

    /* Adjust button sizing in footer */
    .modal-footer .btn {
        flex: 1 1 auto;
        min-width: 70px;
        padding: 8px 10px !important;
        font-size: 0.85rem !important;
        white-space: nowrap;
    }

    .modal-footer .heart-btn {
        padding: 8px 12px !important;
    }

    /* Hide text on danger button, show icon only */
    .modal-footer .btn-danger {
        min-width: 42px !important;
        flex: 0 0 42px !important;
        padding: 8px !important;
    }

    /* Reduce card rounding/padding so content uses space */
    .flashcard-face {
        border-radius: 10px;
        padding: 14px;
    }

    /* Cap pill-shaped buttons so narrow buttons don't look like ovals/circles */
    .btn {
        border-radius: 10px !important;
    }
    /* Preserve full-circle for icon-only buttons */
    .btn.btn-icon,
    .btn-sm.btn-icon {
        border-radius: 50% !important;
    }
}

/* Ensure modal footer stays visible and buttons don't overflow on small screens */
@media (max-width: 600px) {
    .modal-content {
        display: flex;
        flex-direction: column;
        max-height: 94vh;
        height: auto;
    }
    .modal-body {
        flex: 1 1 auto;
        overflow: auto;
    }
    .modal-footer {
        flex: 0 0 auto;
        position: sticky;
        bottom: 0;
        background: linear-gradient(180deg, rgba(255,255,255,0.0), rgba(255,255,255,0.95));
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
    .modal-footer .btn {
        flex: 1 1 auto;
        min-width: 96px;
    }
    body.dark .modal-footer {
        background: linear-gradient(180deg, transparent, var(--light-gray)) !important;
    }
}

/* Ensure modal footers with custom layout (used in index.html) are consistent across pages */
.modal-footer.custom-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.modal-footer .right-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* =====================================================
   BADGE
   ===================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background: var(--secondary-pink);
    color: var(--primary-pink-dark);
}

.badge-success {
    background: var(--success);
    color: #1b5e20;
}

.badge-danger {
    background: var(--danger);
    color: #b71c1c;
}

.badge-info {
    background: var(--info);
    color: #4a148c;
}

/* Developer badge: pink outlined variant */
.badge-dev {
    background: transparent;
    color: var(--primary-pink-dark);
    border: 1px solid var(--primary-pink);
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
}

.badge-dev i { margin-right: 6px; }

/* =====================================================
   SPINNER / LOADER
   ===================================================== */
.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--secondary-pink);
    border-top-color: var(--primary-pink);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

/* =====================================================
   NAVIGATION
   ===================================================== */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-md) 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
}

.nav-link {
    color: var(--text-dark);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-link:hover {
    background: var(--secondary-pink);
    color: var(--primary-pink-dark);
}

/* =====================================================
   Quill / Rendered Content fixes
   Ensure lists and block content produced by Quill keep their
   indentation when rendered inside modals and viewer areas.
   This counteracts the global * { padding:0; margin:0 } reset.
   ===================================================== */
.ql-editor, .reviewer-content, #viewReviewerContent, .rendered-reviewer, #modalContent, .reviewer-preview {
    color: var(--text-dark);
    line-height: 1.6;
    word-break: break-word;
    white-space: pre-wrap;
}

/* Lists: restore left padding and margin so bullets/numbers indent */
.ql-editor ul, .ql-editor ol,
#viewReviewerContent ul, #viewReviewerContent ol,
.reviewer-content ul, .reviewer-content ol,
.rendered-reviewer ul, .rendered-reviewer ol,
#modalContent ul, #modalContent ol,
.reviewer-preview ul, .reviewer-preview ol {
    margin: 0 0 1rem 0.95rem;
    padding-left: 1.05rem;
    list-style-position: outside;
}

/* Nested lists should indent further */
.ql-editor ul ul, .ql-editor ol ol,
#viewReviewerContent ul ul, #viewReviewerContent ol ol,
.reviewer-content ul ul, .reviewer-content ol ol,
.rendered-reviewer ul ul, .rendered-reviewer ol ol,
#modalContent ul ul, #modalContent ol ol,
.reviewer-preview ul ul, .reviewer-preview ol ol {
    margin-left: 1.6rem;
    padding-left: 0.6rem;
}

/* Ensure bullets are visible and not clipped by overflow or line-height issues */
.ql-editor li, #viewReviewerContent li, .reviewer-content li, .rendered-reviewer li, #modalContent li, .reviewer-preview li {
    display: list-item;
    list-style-type: disc;
}

/* Headings inside rendered content match page typography */
.ql-editor h1, .ql-editor h2, .ql-editor h3,
#viewReviewerContent h1, #viewReviewerContent h2, #viewReviewerContent h3,
.reviewer-content h1, .reviewer-content h2, .reviewer-content h3,
.rendered-reviewer h1, .rendered-reviewer h2, .rendered-reviewer h3 {
    margin-top: 0.6rem;
    margin-bottom: 0.6rem;
}

/* Blockquote styling */
.ql-editor blockquote, #viewReviewerContent blockquote, .reviewer-content blockquote, .rendered-reviewer blockquote {
    border-left: 4px solid rgba(0,0,0,0.06);
    padding-left: 12px;
    color: var(--dark-gray);
    margin: 0 0 1rem 0;
}

/* Preformatted code blocks inside content */
.ql-editor pre,
#viewReviewerContent pre,
.reviewer-content pre,
.rendered-reviewer pre,
#modalContent pre,
.reviewer-preview pre {
    background: #f3f0f5;
    border: 1px solid #e0d8e8;
    border-left: 4px solid var(--primary-pink, #ff9eb4);
    padding: 14px 16px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Consolas', 'Fira Mono', 'Courier New', monospace;
    font-size: 0.88rem;
    line-height: 1.6;
    margin: 12px 0;
    white-space: pre;
}

/* Inline code */
.ql-editor code,
#viewReviewerContent code,
.reviewer-content code,
.rendered-reviewer code,
#modalContent code,
.reviewer-preview code {
    background: #f3f0f5;
    border: 1px solid #e0d8e8;
    border-radius: 4px;
    padding: 1px 5px;
    font-family: 'Consolas', 'Fira Mono', 'Courier New', monospace;
    font-size: 0.88em;
    color: #c0156e;
}

/* Don't double-style inline code inside a pre block (only for non-highlighted blocks) */
.ql-editor pre code:not([data-highlighted]),
#viewReviewerContent pre code:not([data-highlighted]),
.reviewer-content pre code:not([data-highlighted]),
.rendered-reviewer pre code:not([data-highlighted]),
#modalContent pre code:not([data-highlighted]),
.reviewer-preview pre code:not([data-highlighted]) {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

/* Always strip the box styling from pre code — let hljs handle colors */
.ql-editor pre code,
#viewReviewerContent pre code,
.reviewer-content pre code,
.rendered-reviewer pre code,
#modalContent pre code,
.reviewer-preview pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
}

.nav-link.active {
    background: var(--gradient-primary);
    color: var(--white);
}

/* =====================================================
   SIDEBAR
   ===================================================== */
.sidebar {
    background: var(--white);
    width: 280px;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    box-shadow: var(--shadow-md);
    overflow-y: auto;
    transition: transform var(--transition-base);
    z-index: 200;
}

.sidebar-header {
    padding: var(--spacing-lg);
    background: var(--gradient-primary);
    color: var(--white);
}

.sidebar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--white);
}

.sidebar-nav {
    padding: var(--spacing-md);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 12px 16px;
    color: var(--text-dark);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    margin-bottom: var(--spacing-xs);
}

.sidebar-link:hover {
    background: var(--secondary-pink);
    color: var(--primary-pink-dark);
}

.sidebar-link.active {
    background: var(--gradient-primary);
    color: var(--white);
}

.sidebar-toggle {
    display: none;
}

/* Ensure settings links placed in the left sidebar look identical to other sidebar links */
.sidebar-link.settings-sidebar-link {
    padding: 12px 16px;
    gap: var(--spacing-sm);
    border-radius: var(--radius-md);
    width: 100%;
}

/* =====================================================
   MAIN CONTENT AREA
   ===================================================== */
.main-content {
    margin-left: 280px;
    padding: var(--spacing-xl);
    min-height: 100vh;
    transition: margin-left var(--transition-base);
}

/* =====================================================
   CHAT STYLES
   ===================================================== */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 600px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.chat-header {
    padding: var(--spacing-md);
    background: var(--gradient-primary);
    color: var(--white);
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    padding: var(--spacing-md);
    overflow-y: auto;
    background: var(--light-gray);
}

.chat-message { display:flex; gap:8px; align-items:center; margin-bottom: var(--spacing-md); }
.chat-message .msg-avatar { width:36px; height:36px; border-radius:999px; object-fit:cover; border:2px solid rgba(255,158,180,0.12); }
.chat-message .msg-body { display:flex; flex-direction:column; justify-content:center; align-items:flex-start; max-width: calc(100% - 56px); }
.chat-message.msg-self { flex-direction: row-reverse; }
.chat-message.msg-self .msg-avatar { margin-left:8px; margin-right:0; }
.chat-message.msg-self .msg-body { align-items:flex-end; }
.chat-message .msg-header { text-align:left; }
.chat-message.msg-self .msg-header { text-align:right; }

/* Ensure bubbles align nicely inside the column */
.chat-message .msg-bubble.left { align-self: flex-start; }
.chat-message .msg-bubble.right { align-self: flex-end; }
.chat-message .msg-avatar { margin-right:0; }

/* Make avatar link inline and remove default link decoration */
.msg-avatar-link { display:inline-flex; align-items:center; text-decoration:none; }
.msg-avatar-link .msg-avatar { display:block; }
.chat-message .msg-bubble { padding:12px 16px; border-radius:12px; box-shadow: 0 3px 10px rgba(25,20,40,0.05); word-break:break-word; }
.chat-message .msg-bubble.left { background: var(--white); border:1px solid rgba(230,220,224,0.6); color:var(--text-dark); }
.chat-message .msg-bubble.right { background: linear-gradient(90deg, var(--primary-pink), var(--primary-pink-light)); color: #fff; }
.chat-message .msg-time-below { font-size:0.75rem; color: rgba(0,0,0,0.45); margin-top:6px; }
.chat-message.msg-self .msg-time-below { color: var(--dark-gray); align-self:flex-end; }

/* Username header above the chat bubble */
.chat-message .msg-header { margin-bottom:6px; }
.chat-message .msg-header .msg-author { font-weight:700; font-size:0.95rem; color:var(--primary-pink-dark); }

/* Prevent avatar overlapping scrollbar */
.chat-messages { padding-right: 20px; }

/* Unread badge for chat tabs */
.chat-unread-badge {
    display: inline-block;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--danger);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 8px;
    vertical-align: middle;
    text-align: center;
}

.chat-message {
    margin-bottom: var(--spacing-md);
    animation: fadeIn 0.3s ease;
}

.chat-message-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
}

.chat-username {
    font-weight: 600;
    color: var(--primary-pink-dark);
}

.chat-timestamp {
    font-size: 0.75rem;
    color: var(--dark-gray);
}

.chat-message-body {
    background: var(--white);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    word-wrap: break-word;
}

.chat-input-container {
    padding: var(--spacing-md);
    background: var(--white);
    border-top: 1px solid var(--medium-gray);
    display: flex;
    gap: var(--spacing-sm);
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--medium-gray);
    border-radius: var(--radius-full);
    font-family: inherit;
    transition: all var(--transition-fast);
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-pink);
}

/* =====================================================
   RICH TEXT EDITOR
   ===================================================== */
.editor-toolbar {
    background: var(--light-gray);
    padding: var(--spacing-sm);
    border: 1px solid var(--medium-gray);
    border-bottom: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    display: flex;
    gap: var(--spacing-xs);
    flex-wrap: wrap;
}

.editor-btn {
    padding: 8px 12px;
    background: var(--white);
    border: 1px solid var(--medium-gray);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
}

.editor-btn:hover {
    background: var(--secondary-pink);
    border-color: var(--primary-pink);
}

.editor-btn.active {
    background: var(--primary-pink);
    color: var(--white);
    border-color: var(--primary-pink);
}

.editor-content {
    min-height: 300px;
    padding: 16px;
    border: 1px solid var(--medium-gray);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    background: var(--white);
    outline: none;
}

.editor-content:focus {
    border-color: var(--primary-pink);
}

/* =====================================================
   UTILITIES
   ===================================================== */
.text-center {
    text-align: center;
}

/* =====================================================
   SITE ALERT / TOASTS - bottom-right reusable
   ===================================================== */
.site-alert-container {
    position: fixed;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
    max-width: calc(100% - 40px);
}
.site-alert {
    transform: translateY(12px) scale(0.98);
    opacity: 0;
    transition: all 240ms ease;
    min-width: 200px;
    max-width: 360px;
    box-shadow: var(--shadow-md);
    border-radius: 8px;
    overflow: hidden;
}
.site-alert.show { transform: translateY(0) scale(1); opacity: 1; }
.site-alert .site-alert-content { padding: 10px 14px; font-weight: 600; }
.site-alert-success { background: #e6ffef; color: #0b7a3f; border: 1px solid #b8f2d1; }
.site-alert-error { background: #fff0f2; color: #a1123b; border: 1px solid #ffcad4; }
.site-alert-info { background: #f0f6ff; color: #08306b; border: 1px solid #cfe3ff; }

/* =====================================================
   REVIEWERS (shared)
   Moved from index.html to global stylesheet so other pages
   can reuse the same styles (user profile page, etc.)
===================================================== */
.reviewers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.reviewer-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    transition: all var(--transition-base);
    cursor: pointer;
    border: 1px solid var(--medium-gray);
}

.reviewer-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.reviewer-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-dark);
}

.reviewer-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 0.875rem;
    color: var(--dark-gray);
    min-width: 0;
}

.reviewer-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.reviewer-subject-meta {
    min-width: 0;
    flex: 1;
}

.reviewer-subject-meta i {
    flex-shrink: 0;
}

.reviewer-subject-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    width: 100%;
}

@media (max-width: 768px) {
    .reviewer-card {
        padding: 16px;
        padding-bottom: 54px;
    }

    .reviewer-meta {
        gap: 10px;
        margin-bottom: 12px;
    }

    .reviewer-meta .reviewer-meta-item:first-child {
        min-width: 0;
        flex-shrink: 0;
    }
}

.reviewer-preview {
    color: var(--text-dark);
    font-size: 0.9rem;
    line-height: 1.6;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Card-level actions (bottom-right) */
.reviewer-card { position: relative; padding-bottom: 56px; }
.reviewer-card .card-actions {
    position: absolute;
    right: 16px;
    bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-heart-btn {
    background: transparent;
    border: 2px solid var(--medium-gray);
    border-radius: 999px;
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--dark-gray);
    cursor: pointer;
}
.card-heart-btn.hearted {
    background: rgba(255, 158, 180, 0.08);
    border-color: var(--primary-pink);
    color: var(--primary-pink);
}
.card-heart-count { font-weight:600; min-width:18px; text-align:left; }

/* Modal heart button (shared) */
.heart-btn {
    background: transparent;
    border: 2px solid var(--medium-gray);
    border-radius: 999px;
    padding: 0 12px;
    height: 32px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--dark-gray);
    cursor: pointer;
}
.heart-btn.hearted {
    background: rgba(255, 158, 180, 0.08);
    border-color: var(--primary-pink);
    color: var(--primary-pink);
}

/* User profile header */
.user-header {
    display: flex;
    gap: 20px;
    align-items: center;
    padding: 12px 0 8px 0;
}

.user-header .avatar-lg {
    width: 96px;
    height: 96px;
    border-radius: 9999px;
    object-fit: cover;
    border: 2px solid rgba(0,0,0,0.06);
}

/* Small back button overlaying avatar in user profile */
#profileBackSmall {
    position: absolute;
    left: -12px;
    top: -12px;
    padding: 6px 10px;
    border-radius: 999px;
    height: 36px;
    line-height: 18px;
}

/* Message button in profile header (replaces Back) */
#messageBtn {
    min-width: 84px;
}

/* Profile message modal - conversation thread styles */
#messageModal .modal-content { max-width: 640px; }
.message-thread { max-height: 320px; overflow:auto; padding:12px; display:flex; flex-direction:column; gap:10px; }
.msg { display:flex; gap:10px; align-items:flex-start; }
.msg .msg-avatar { width:36px; height:36px; border-radius:999px; object-fit:cover; }
.msg .msg-bubble { max-width:78%; padding:10px 12px; border-radius:12px; background: #fff3f6; color:var(--text-dark); box-shadow: var(--shadow-sm); }
.msg .msg-meta { font-size:0.85rem; color:var(--dark-gray); margin-bottom:6px; }
.msg .msg-time { font-size:0.75rem; color:var(--dark-gray); margin-left:8px; }
.msg-self { flex-direction:row-reverse; }
.msg-self .msg-bubble { background: linear-gradient(135deg,#ffdfe7,#fff); border:1px solid rgba(255,158,180,0.35); }
.msg-author { font-weight:700; font-size:0.9rem; color:var(--primary-pink-dark); }
.msg-text { white-space:pre-wrap; word-break:break-word; }

/* scrollbar style for message thread */
.message-thread::-webkit-scrollbar { width:10px; }
.message-thread::-webkit-scrollbar-thumb { background: linear-gradient(180deg,var(--primary-pink),var(--secondary-pink)); border-radius:8px; }


@media (max-width: 768px) {
    .user-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 12px;
    }
}

/* User card and search */
.user-card { padding: 12px 20px; }

.user-search { display:flex; justify-content:flex-end; }
.user-search input.form-control { width: 420px; }
.user-search button.btn { white-space: nowrap; }

@media (max-width: 768px) {
    .user-search { justify-content:center; }
    .user-search div { width:100%; max-width:480px; display:flex; gap:8px; }
    .user-search input.form-control { width:100%; }
    .user-search button.btn { width:120px; }
}

/* H2 + search row for user page */
.user-h2-search h2 { font-size:1.25rem; }
.user-h2-search { align-items:center; }
@media (max-width: 768px) {
    .user-h2-search { flex-direction:column; align-items:flex-start; gap:8px; }
    .user-h2-search .user-search { width:100%; }
}

.text-right {
    text-align: right;
}

.d-flex {
    display: flex;
}

.justify-content-between {
    justify-content: space-between;
}

.justify-content-center {
    justify-content: center;
}

.align-items-center {
    align-items: center;
}

.gap-sm {
    gap: var(--spacing-sm);
}

.gap-md {
    gap: var(--spacing-md);
}

.gap-lg {
    gap: var(--spacing-lg);
}

.mt-1 {
    margin-top: var(--spacing-sm);
}

.mt-2 {
    margin-top: var(--spacing-md);
}

.mt-3 {
    margin-top: var(--spacing-lg);
}

.mb-1 {
    margin-bottom: var(--spacing-sm);
}

.mb-2 {
    margin-bottom: var(--spacing-md);
}

.mb-3 {
    margin-bottom: var(--spacing-lg);
}

.p-1 {
    padding: var(--spacing-sm);
}

.p-2 {
    padding: var(--spacing-md);
}

.p-3 {
    padding: var(--spacing-lg);
}

.w-100 {
    width: 100%;
}

.hidden {
    display: none;
}

/* =====================================================
   RESPONSIVE DESIGN
   ===================================================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: block;
        position: fixed;
        top: var(--spacing-md);
        left: var(--spacing-md);
        z-index: 300;
        background: var(--gradient-primary);
        color: var(--white);
        border: none;
        width: 48px;
        height: 48px;
        border-radius: 50%;
        box-shadow: var(--shadow-md);
        cursor: pointer;
        transition: all var(--transition-base);
    }

    .sidebar-toggle:hover {
        transform: scale(1.1);
    }

    .main-content {
        margin-left: 0;
        padding: var(--spacing-md);
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .modal-content {
        width: 95%;
    }

    /* Stack navbar items on smaller screens */
    .navbar #navActions.d-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .nav-brand {
        font-size: 1.2rem;
    }
}

/* Additional small-screen tweaks */
@media (max-width: 600px) {
    .hero h1 {
        font-size: 2rem;
        line-height: 1.1;
    }

    .nav-brand {
        font-size: 1.1rem;
    }

    .search-bar {
        padding: 0 8px;
    }
}

/* =====================================================
   SCROLLBAR STYLING
   ===================================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-gray);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-pink);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-pink-dark);
}

/* =====================================================
   ANIMATIONS
   ===================================================== */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.float-animation {
    animation: float 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.pulse-animation {
    animation: pulse 2s ease-in-out infinite;
}

/* Strong mobile overrides to force helper modals to look like compact alerts */
@media (max-width: 480px) {
    .modal-helper-box, .modal-content.modal-helper-box {
        width: min(92vw, 320px) !important;
        max-width: 320px !important;
        height: auto !important;
        max-height: 80vh !important;
        margin: 10vh auto !important;
        border-radius: 12px !important;
        overflow: visible !important;
        box-shadow: 0 12px 32px rgba(0,0,0,0.18) !important;
    }

    .modal-helper-body {
        max-height: calc(80vh - 120px) !important;
        overflow: auto !important;
        -webkit-overflow-scrolling: touch;
        padding: 10px !important;
    }

    .modal-helper-header { padding: 10px 12px !important; font-size: 1rem !important; }
    .modal-helper-footer { padding: 8px 10px !important; text-align: center !important; }

    /* Ensure the overlay places the modal near the top for easy reach */
    .modal { align-items: flex-start !important; padding-top: 8vh !important; }

    /* Make OK button compact and centered */
    .modal-helper-box .btn { padding: 8px 12px !important; font-size: 0.95rem !important; }

    /* If a modal-helper-small class exists, tighten it further */
    .modal-helper-small { width: min(86vw, 280px) !important; max-width: 280px !important; }
}

/* =====================================================
   REVIEWER CONTENT TABLE STYLES
   (tables inserted via Quill and stored as HTML)
   ===================================================== */
.reviewer-content table,
.ql-editor table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
    table-layout: fixed;
}
.reviewer-content table td,
.reviewer-content table th,
.ql-editor table td,
.ql-editor table th {
    border: 1px solid var(--medium-gray);
    padding: 8px 12px;
    min-width: 60px;
    word-break: break-word;
    vertical-align: top;
}
.reviewer-content table tr:first-child td,
.ql-editor table tr:first-child td {
    background: var(--secondary-pink);
    font-weight: 600;
}

/* Dark mode overrides for reviewer content */
body.dark .reviewer-content { background: var(--light-gray) !important; }
body.dark .reviewer-content table td,
body.dark .reviewer-content table th { border-color: var(--medium-gray); }
body.dark .reviewer-content table tr:first-child td { background: #3d2438; }

/* =====================================================
   NOTIFICATIONS
   ===================================================== */

/* Notification badge */
.notification-badge {
    display: inline-block;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 6px;
    vertical-align: middle;
    text-align: center;
    position: absolute;
    top: -6px;
    right: -6px;
    z-index: 10;
}

/* Notification button needs visible overflow for badge */
.notification-btn {
    overflow: visible !important;
}

/* Disable ripple animation on notification buttons — it overflows and covers badge */
.notification-btn::before {
    display: none !important;
}

/* Notification button wrapper */
#notificationBtn {
    position: relative;
}

#notificationWrapper {
    position: relative;
    display: none; /* Hidden by default, shown via JS when logged in */
}

#notificationWrapper[style*="display: block"] {
    display: inline-block !important;
}

/* Notification wrapper visibility */
.notification-wrapper-mobile {
    display: none !important;
}

.notification-wrapper-desktop {
    display: none !important;
}

/* Show mobile notification on small screens, desktop on large screens */
@media (max-width: 768px) {
    .notification-wrapper-mobile[style*="display: block"],
    .notification-wrapper-mobile[style*="display:block"] {
        display: inline-block !important;
    }
    .notification-wrapper-desktop {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .notification-wrapper-mobile {
        display: none !important;
    }
    .notification-wrapper-desktop[style*="display: block"],
    .notification-wrapper-desktop[style*="display:block"] {
        display: inline-block !important;
    }
}

/* Notification dropdown */
.notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    max-width: min(380px, calc(100vw - 20px));
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    overflow: hidden;
}

@media (max-width: 768px) {
    .notification-dropdown {
        position: fixed !important;
        top: 66px !important;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        max-width: none !important;
        max-height: calc(100vh - 80px);
        overflow: hidden;
    }
    .notification-list {
        max-height: calc(100vh - 160px) !important;
    }
}

/* Notification header */
.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--medium-gray);
    background: var(--off-white);
}

.notification-header a {
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

.notification-header a:hover {
    opacity: 0.7;
}

/* Notification list */
.notification-list {
    max-height: 400px;
    overflow-y: auto;
}

/* Notification item */
.notification-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--medium-gray);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.notification-item:hover {
    background: var(--off-white);
}

.notification-item.unread {
    background: var(--secondary-pink);
}

.notification-item.unread:hover {
    background: rgba(255, 212, 224, 0.6);
}

/* Notification avatar */
.notification-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
}

/* Notification content */
.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.notification-message {
    font-size: 0.85rem;
    color: var(--dark-gray);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--dark-gray);
}

/* Empty state */
.notification-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--dark-gray);
}

.notification-loading {
    padding: 40px 20px;
    text-align: center;
    color: var(--dark-gray);
}

/* Dark mode overrides */
body.dark .notification-dropdown {
    background: var(--light-gray);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

body.dark .notification-header {
    background: var(--off-white);
    border-bottom-color: var(--medium-gray);
}

body.dark .notification-item {
    border-bottom-color: var(--medium-gray);
}

body.dark .notification-item:hover {
    background: var(--off-white);
}

body.dark .notification-item.unread {
    background: #3d2438;
}

body.dark .notification-item.unread:hover {
    background: rgba(61, 36, 56, 0.7);
}

/* =====================================================
   DARK MODE
   ===================================================== */

/* Dark mode toggle button (floating, for non-sidebar pages) */
#darkModeFloatBtn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9000;
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-full);
    width: 46px;
    height: 46px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}
#darkModeFloatBtn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

/* Dark mode transition on all elements */
body, body * {
    transition:
        background-color 0.25s ease,
        background 0.25s ease,
        color 0.25s ease,
        border-color 0.25s ease,
        box-shadow 0.25s ease;
}

/* ── Core variable overrides ── */
body.dark {
    /* Backgrounds */
    --white:           #1e1820;
    --off-white:       #251f28;
    --light-gray:      #2e2831;
    --medium-gray:     #443848;

    /* Text */
    --dark-gray:       #b09ab0;
    --text-dark:       #f0e6ee;

    /* Pink tones — primary stays vivid, secondary becomes a dark plum */
    --secondary-pink:  #3d2438;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #c95075 0%, #a03060 100%);
    --gradient-accent:  linear-gradient(135deg, #d4527a 0%, #c95075 100%);
    --gradient-soft:    linear-gradient(180deg, #251f28 0%, #1e1820 100%);

    /* Shadows — neutral dark */
    --shadow-sm:  0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-md:  0 4px 16px rgba(0, 0, 0, 0.45);
    --shadow-lg:  0 8px 32px rgba(0, 0, 0, 0.55);
    --shadow-xl:  0 16px 48px rgba(0, 0, 0, 0.65);

    /* Status — soften so they're not neon on dark */
    --success: #3a7a62;
    --warning: #7a5a3a;
    --danger:  #7a3a38;
    --info:    #5a3a7a;

    background: var(--off-white);
    color: var(--text-dark);
}

/* ── Quill editor dark mode ── */
body.dark .ql-toolbar,
body.dark #reviewerModal .ql-toolbar { background: #2e2831 !important; border-color: #443848 !important; }
body.dark .ql-container        { background: #251f28; border-color: #443848 !important; }
body.dark .ql-editor            { color: #f0e6ee; }
body.dark .ql-editor.ql-blank::before { color: #b09ab0; }
body.dark .ql-snow .ql-stroke   { stroke: #f0e6ee; }
body.dark .ql-snow .ql-fill,
body.dark .ql-snow .ql-stroke.ql-fill { fill: #f0e6ee; }
body.dark .ql-picker-label      { color: #f0e6ee; }
body.dark .ql-picker-options    { background: #2e2831; border-color: #443848; }
body.dark .ql-picker-item       { color: #f0e6ee; }
body.dark .ql-editor table td,
body.dark .ql-editor table th   { border-color: #443848; }
body.dark .ql-editor table tr:first-child td { background: #3d2438; }
body.dark #ql-table-picker      { background: #2e2831; border-color: #443848; }
body.dark .ql-tp-cell           { border-color: #443848; }

/* ── Modals ── */
body.dark .modal-content  { background: var(--light-gray); color: var(--text-dark); }
body.dark .modal-header   { border-bottom-color: var(--medium-gray); }
body.dark .modal-footer   { border-top-color: var(--medium-gray); background: none; }

/* ── Report modal dark mode (select arrow + hint text) ── */
body.dark #reportModal select.form-control {
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23b09ab0' d='M0 0h12L6 8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px 8px;
    padding-right: 36px;
}

/* ── Forms ── */
body.dark .form-control,
body.dark input[type="text"],
body.dark input[type="email"],
body.dark input[type="password"],
body.dark input[type="search"],
body.dark select,
body.dark textarea {
    background: var(--light-gray);
    color: var(--text-dark);
    border-color: var(--medium-gray);
}
body.dark .form-control:focus,
body.dark input:focus,
body.dark select:focus,
body.dark textarea:focus {
    border-color: var(--primary-pink);
    box-shadow: 0 0 0 3px rgba(199, 80, 117, 0.2);
}
body.dark .form-control::placeholder,
body.dark input::placeholder,
body.dark textarea::placeholder { color: var(--dark-gray); }

/* ── Sidebar ── */
body.dark .sidebar { background: #1a1620; }
body.dark .sidebar-link       { color: #d4c0d0; }
body.dark .sidebar-link:hover { background: var(--secondary-pink); color: var(--primary-pink-light); }
body.dark .sidebar-link.active { background: var(--gradient-primary); color: #fff; }

/* ── Cards / Panels ── */
body.dark .card,
body.dark .subject-card,
body.dark .reviewer-card,
body.dark .stat-card { background: var(--light-gray); border-color: var(--medium-gray); }

/* ── Tables (data tables on admin/reviewer pages) ── */
body.dark table th { background: var(--light-gray); color: var(--text-dark); border-color: var(--medium-gray); }
body.dark table td { color: var(--text-dark); border-color: var(--medium-gray); }
body.dark table tr:nth-child(even) { background: rgba(255, 255, 255, 0.03); }

/* ── Buttons ── */
body.dark .btn-light    { background: var(--medium-gray); color: var(--text-dark); }
body.dark .btn-outline  { border-color: var(--primary-pink); color: var(--primary-pink); }
body.dark .btn-outline:hover { background: var(--secondary-pink); }
body.dark .btn-accent   { background: var(--primary-pink); color: #fff; }

/* ── Nav / Topbar ── */
body.dark .nav, body.dark nav { background: #1a1620; border-color: var(--medium-gray); }
body.dark .nav-link { color: #d4c0d0; }

/* ── Chat ── */
body.dark .message-bubble { background: var(--light-gray); color: var(--text-dark); }
body.dark .message-bubble.own { background: var(--secondary-pink); }
body.dark .chat-input-area { background: #1a1620; border-top-color: var(--medium-gray); }
body.dark .chat-input-area input,
body.dark .chat-input-area textarea { background: var(--light-gray); color: var(--text-dark); }
body.dark .conversation-item:hover,
body.dark .conversation-item.active { background: var(--secondary-pink); }

/* ── Badges ── */
body.dark .badge { background: var(--secondary-pink); color: var(--primary-pink-light); }

/* ── Scrollbar ── */
body.dark ::-webkit-scrollbar-track { background: var(--light-gray); }
body.dark ::-webkit-scrollbar-thumb { background: var(--primary-pink-dark); }

/* ── Code blocks inside Quill & reviewer content (dark mode) ── */
body.dark .ql-editor pre,
body.dark #viewReviewerContent pre,
body.dark .reviewer-content pre,
body.dark .rendered-reviewer pre,
body.dark #modalContent pre,
body.dark .reviewer-preview pre {
    background: #1a1620;
    border-color: #3a2f40;
    color: #f0e6ee;
}

body.dark .ql-editor code,
body.dark #viewReviewerContent code,
body.dark .reviewer-content code,
body.dark .rendered-reviewer code,
body.dark #modalContent code,
body.dark .reviewer-preview code {
    background: #2e2831;
    border-color: #3a2f40;
    color: #f5a8d8;
}

body.dark .ql-editor pre code:not([data-highlighted]),
body.dark #viewReviewerContent pre code:not([data-highlighted]),
body.dark .reviewer-content pre code:not([data-highlighted]),
body.dark .rendered-reviewer pre code:not([data-highlighted]),
body.dark #modalContent pre code:not([data-highlighted]),
body.dark .reviewer-preview pre code:not([data-highlighted]) {
    background: none;
    border: none;
    color: inherit;
}

/* ── Inline hardcoded white overrides ── */
body.dark [style*="background: white"],
body.dark [style*="background:white"],
body.dark [style*="background-color: white"],
body.dark [style*="background-color:white"] {
    background: var(--light-gray) !important;
}
body.dark [style*="background: #fff"],
body.dark [style*="background:#fff"],
body.dark [style*="background-color: #fff"],
body.dark [style*="background-color:#fff"] {
    background: var(--light-gray) !important;
}
body.dark [style*="color: #"] { color: var(--text-dark); }
body.dark [style*="color: var(--dark-gray)"] { color: var(--dark-gray) !important; }

/* ── Toast / alert notifications ── */
body.dark .alert, body.dark .toast { background: var(--light-gray); color: var(--text-dark); border-color: var(--medium-gray); }

/* ── Reaction pills dark mode ── */
body.dark .reaction-pill {
    background: var(--light-gray);
    color: var(--text-dark);
    border-color: transparent;
}
body.dark .reaction-pill:hover {
    background: var(--medium-gray);
}
body.dark .reaction-pill.user-reacted {
    border-color: var(--primary-pink);
}

/* =====================================================
   Post Modal (Professional)
   ===================================================== */

#postModal .post-modal-card {
    border: 1px solid rgba(255, 158, 180, 0.18);
    background: linear-gradient(180deg, rgba(255, 158, 180, 0.05), rgba(255, 255, 255, 0));
}

#postModal .post-modal-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--medium-gray);
    background: linear-gradient(90deg, rgba(255, 158, 180, 0.12), rgba(255, 212, 224, 0.05));
}

#postModal .post-modal-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

#postModal .post-modal-title {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.25;
    margin: 0;
}

#postModal .post-modal-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

#postModal .post-modal-author {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

#postModal .post-modal-author img {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    object-fit: cover;
    border: 2px solid rgba(255, 158, 180, 0.18);
}

#postModal .post-modal-author .name {
    font-weight: 700;
    color: var(--text-dark);
}

#postModal .post-modal-author .time {
    color: var(--dark-gray);
    font-size: 0.85rem;
}

#postModal .post-modal-content {
    padding: 18px;
}

#postModal #postModalContent {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.75;
    font-size: 1rem;
    color: var(--text-dark);
}

#postModal .post-modal-reactions {
    margin-top: 14px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

#postModal .comments-section {
    margin-top: 18px;
    padding-top: 14px;
}

#postModal .comments-header {
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#postModal .comment-compose-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px;
    border: 1px solid rgba(230, 220, 224, 0.95);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.6);
}

#postModal .comment-avatar {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    object-fit: cover;
    border: 2px solid rgba(255, 158, 180, 0.18);
    flex-shrink: 0;
}

#postModal .comment-input-wrap {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    width: 100%;
}

#postModal #postCommentInput {
    flex: 1;
    resize: none;
    min-height: 46px;
    max-height: 140px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1.5px solid var(--medium-gray);
    outline: none;
    font-family: inherit;
    background: var(--white);
}

#postModal #postCommentInput:focus {
    border-color: var(--primary-pink);
    box-shadow: 0 0 0 3px rgba(255, 158, 180, 0.12);
}

#postModal .comment-send-btn {
    width: 46px;
    height: 46px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(90deg, var(--primary-pink), var(--primary-pink-light));
    color: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 22px rgba(255, 105, 150, 0.14);
    transition: transform 0.15s ease;
}

#postModal .comment-send-btn:hover {
    transform: translateY(-1px);
}

#postModal .comments-empty {
    padding: 18px;
    border-radius: 14px;
    border: 1px dashed rgba(255, 158, 180, 0.4);
    background: rgba(255, 158, 180, 0.06);
    color: var(--dark-gray);
    text-align: center;
    margin-top: 14px;
}

#postModal .comment-item {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(230, 220, 224, 0.55);
}

#postModal .comment-item:last-child {
    border-bottom: none;
}

#postModal .comment-body {
    flex: 1;
    min-width: 0;
}

#postModal .comment-bubble {
    background: rgba(248, 244, 246, 0.95);
    border: 1px solid rgba(230, 220, 224, 0.8);
    border-radius: 14px;
    padding: 12px;
}

#postModal .comment-user {
    font-weight: 800;
    margin-bottom: 6px;
    color: var(--text-dark);
}

#postModal .comment-text {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.6;
}

#postModal .comment-footer {
    margin-top: 8px;
    font-size: 0.82rem;
    color: var(--dark-gray);
}

#postModal .reaction-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1.5px solid rgba(230, 220, 224, 0.9);
    background: rgba(248, 244, 246, 0.95);
    color: var(--text-dark);
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    user-select: none;
}

#postModal .reaction-pill:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 158, 180, 0.9);
}

#postModal .reaction-pill.user-reacted {
    border-color: var(--primary-pink);
    background: rgba(255, 158, 180, 0.10);
}

#postModal .reaction-pill span:last-child {
    font-weight: 700;
    color: var(--primary-pink-dark);
}

/* Dark mode for post modal */
body.dark #postModal .comment-bubble {
    background: rgba(68, 56, 72, 0.25);
    border-color: var(--medium-gray);
}

body.dark #postModal .comment-compose-row {
    background: rgba(46, 40, 49, 0.25);
    border-color: var(--medium-gray);
}

body.dark #postModal #postCommentInput {
    background: var(--light-gray);
    border-color: var(--medium-gray);
}


/* ── Comment section dark mode ── */
body.dark .comment-bubble {
    background: var(--secondary-pink);
}
body.dark .comment-input-wrap {
    background: var(--light-gray);
    border-color: var(--medium-gray);
}
body.dark .reply-input-wrap {
    background: var(--light-gray);
    border-color: var(--medium-gray);
}

/* Prevent transition flash on page load */
body.dark-preload, body.dark-preload * { transition: none !important; }

/* ── Quiz Builder (dashboard + reviewer) ───────────────────────────────── */
.qb-question-row {
    background: var(--light-gray);
    border-radius: 14px;
    padding: 18px 20px;
    border: 1px solid var(--medium-gray);
}
.qb-q-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.qb-q-num {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 0.95rem;
}
.qb-options-wrapper { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.qb-option-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--white);
    border-radius: 8px;
    padding: 8px 12px;
    border: 1px solid var(--medium-gray);
}
.qb-option-row input[type="radio"] { cursor: pointer; accent-color: var(--primary-pink); width:16px; height:16px; flex-shrink:0; }
.qb-opt-letter {
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--light-gray); display: flex;
    align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.8rem; flex-shrink: 0; color: var(--text-dark);
}
.qb-opt-text { flex: 1; }

/* Question textarea auto-resize */
.qb-question-text { min-height: 44px; resize: none; overflow: hidden; }

/* Bulk paste panel */
.qb-paste-box {
    background: var(--off-white);
    border: 2px dashed var(--primary-pink);
    border-radius: 14px;
    padding: 18px 20px;
}
.qb-paste-example {
    background: var(--light-gray);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.8rem;
    line-height: 1.6;
    margin: 8px 0 0;
    white-space: pre-wrap;
    color: var(--text-dark);
    overflow-x: auto;
}

/* dark mode for quiz builder */
body.dark .qb-question-row { background: var(--off-white); border-color: var(--medium-gray); }
body.dark .qb-option-row   { background: var(--white); border-color: var(--medium-gray); }
body.dark .qb-opt-letter   { background: var(--light-gray); color: var(--text-dark); }
body.dark .qb-paste-box    { background: var(--light-gray); border-color: var(--primary-pink); }
body.dark .qb-paste-example { background: var(--off-white); }

/* ── AI Generate panels ── */
.ai-panel {
    background: linear-gradient(135deg, var(--off-white), var(--light-gray));
    border: 2px solid var(--primary-pink);
    border-radius: 14px;
    padding: 18px 20px;
}
.ai-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 8px;
    color: var(--primary-pink);
}
.ai-panel-hint {
    font-size: 0.83rem;
    color: var(--dark-gray);
    margin: 0 0 12px;
    line-height: 1.5;
}
.ai-drop-zone {
    border: 2px dashed var(--primary-pink);
    border-radius: 12px;
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: background 0.18s;
    background: var(--white);
}
.ai-drop-zone:hover { background: var(--secondary-pink); }
body.dark .ai-panel { background: linear-gradient(135deg, var(--bg-dark), var(--off-white)); }
body.dark .ai-drop-zone { background: var(--off-white); }
body.dark .ai-drop-zone:hover { background: var(--light-gray); }



/* ── Dark mode: timestamp colors ── */
body.dark .mm-bubble .time,
body.dark .msg-time-below,
body.dark .chat-message .msg-time-below { color: rgba(255, 255, 255, 0.5); }

/* ── Dark mode: message bubble left-side border ── */
body.dark .mm-bubble.left,
body.dark .msg-bubble.left,
body.dark .chat-message .msg-bubble.left { border-color: var(--medium-gray); }

/* ── Dark mode: general text & icon color ── */
body.dark { color: var(--text-dark); }
body.dark h1, body.dark h2, body.dark h3,
body.dark h4, body.dark h5, body.dark h6 { color: var(--text-dark); }
body.dark p, body.dark span, body.dark label,
body.dark li, body.dark td, body.dark th,
body.dark small, body.dark strong { color: inherit; }

/* Bootstrap Icons inherit parent text color — force light on dark panels */
body.dark .reviewer-header i,
body.dark .reviewer-content i,
body.dark .reviewer-actions i,
body.dark .settings-sidebar i,
body.dark .settings-content i,
body.dark .online-users i,
body.dark .contact-list-container i,
body.dark .chat-tab i,
body.dark .sidebar i { color: var(--text-dark); }

/* Pink-accented action buttons keep their highlight colors */
body.dark .btn-primary { color: #fff; }
body.dark .btn-primary i,
body.dark .heart-btn i,
body.dark .back-link i { color: inherit; }

/* ── Dark mode: muted / secondary text ── */
body.dark .reviewer-date,
body.dark .subject-name,
body.dark .school-name,
body.dark .meta-right,
body.dark .card-date,
body.dark .reviewer-card .card-meta { color: var(--dark-gray); }

/* ── Dark mode: contact list / online users text ── */
body.dark .contact-item,
body.dark .contact-name,
body.dark .online-user-item,
body.dark .online-user-name { color: var(--text-dark); }
body.dark .contact-preview,
body.dark .online-user-status { color: var(--dark-gray); }

/* ── Dark mode: input placeholder icons in search bars ── */
body.dark .search-icon,
body.dark .input-icon { color: var(--dark-gray); }

/* ── Dark mode: chat tab & panel headers ── */
body.dark .chat-tab,
body.dark .chat-panel-header { color: var(--text-dark); border-color: var(--medium-gray); }
body.dark .chat-tab.active,
body.dark .settings-tab.active { color: var(--primary-pink-light); }

/* ── Dark mode: dividers / horizontal rules ── */
body.dark hr { border-color: var(--medium-gray); }

/* ── Dark mode: floating dark mode button icon ── */
#darkModeFloatBtn { color: #fff; }

/* ── MBID: hide empty placement shells after fill check ── */
.thinky-mbid-collapse-root.thinky-mbid--collapsed {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
    border: none !important;
    box-shadow: none !important;
}
.thinky-ad-modal-slot .ad-modal-no-fill-hint {
    display: none;
    font-size: 0.85rem;
    color: var(--dark-gray);
    margin-top: 12px;
    line-height: 1.4;
}
.thinky-ad-modal-slot.thinky-mbid-modal--show-hint .ad-modal-no-fill-hint {
    display: block;
}

