/* ==========================================================================
   Clarify.ai — Multi-Modal Study Hub (Left Sidebar Layout & Exam Mode)
   ========================================================================== */

/* Study Page Full-Screen Shell */
.study-hub-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: calc(100vh - 70px);
    background: var(--bg-primary);
}

/* Left Study Sidebar */
.study-left-sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 24px 16px;
    position: sticky;
    top: 70px;
    height: calc(100vh - 70px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 40;
}

.study-deck-meta-card {
    padding: 12px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.study-nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.study-nav-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: var(--transition-smooth);
}

.study-nav-btn:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.study-nav-btn.active {
    background: var(--gradient-brand);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
    border-color: transparent;
}

.study-nav-btn .nav-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.study-nav-btn .nav-count-badge {
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
}

/* Study Main Stage */
.study-main-stage {
    padding: 32px 40px 80px;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    overflow-y: auto;
}

/* Modality Panels */
.study-modality-panel {
    display: none;
    animation: fadeIn 0.25s ease-out;
}

.study-modality-panel.active {
    display: block;
}

/* 1. Layered Reading UI & Audio Read Aloud */
.reading-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    border-radius: var(--radius-full);
}

.reading-layers-control {
    display: inline-flex;
    gap: 4px;
}

.layer-btn {
    padding: 8px 18px;
    border-radius: var(--radius-full);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.layer-btn.active {
    background: var(--brand-primary);
    color: #ffffff;
}

.tts-player-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tts-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.tts-btn:hover {
    background: #10b981;
    color: #ffffff;
}

.reading-content-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    font-size: 1.15rem;
    line-height: 1.85;
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    position: relative;
}

.reading-content-card h3 {
    font-size: 1.4rem;
    margin: 24px 0 12px;
    color: #818cf8;
}

.reading-content-card ul, .reading-content-card ol {
    margin: 16px 0 20px 24px;
}

.reading-content-card li {
    margin-bottom: 10px;
}

.reading-content-card code {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.95em;
}

.cram-bullet-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cram-bullet-item {
    background: rgba(99, 102, 241, 0.08);
    border-left: 4px solid var(--brand-primary);
    padding: 16px 20px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-weight: 500;
    font-size: 1.05rem;
}

/* 2. SM-2 Flashcards */
.flashcard-container {
    max-width: 680px;
    margin: 0 auto;
    perspective: 1200px;
}

.flashcard-box {
    width: 100%;
    min-height: 380px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    position: relative;
    cursor: pointer;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 36px;
}

.flashcard-box.flipped {
    transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 36px;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.flashcard-back {
    transform: rotateY(180deg);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
    border-radius: var(--radius-lg);
}

.flashcard-category {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--brand-primary);
    font-weight: 700;
}

.flashcard-text {
    font-size: 1.45rem;
    font-weight: 600;
    line-height: 1.45;
    text-align: center;
    margin: auto 0;
}

.flashcard-hint-box {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.sm2-rating-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}

.sm2-btn {
    flex: 1;
    padding: 12px 10px;
    border-radius: var(--radius-sm);
    border: none;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: var(--transition-smooth);
}

.sm2-btn span.interval {
    font-size: 0.75rem;
    opacity: 0.8;
}

.sm2-again { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.sm2-again:hover { background: #ef4444; color: #fff; }

.sm2-hard { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.sm2-hard:hover { background: #f59e0b; color: #fff; }

.sm2-good { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; border: 1px solid rgba(99, 102, 241, 0.3); }
.sm2-good:hover { background: #6366f1; color: #fff; }

.sm2-easy { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.sm2-easy:hover { background: #10b981; color: #fff; }

/* 3. Exam Mode Quiz (One Question At a Time) */
.exam-quiz-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 36px;
    box-shadow: var(--shadow-md);
    max-width: 800px;
    margin: 0 auto;
}

.exam-quiz-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    margin-bottom: 24px;
    overflow: hidden;
}

.exam-quiz-progress-fill {
    height: 100%;
    background: var(--gradient-brand);
    transition: width 0.3s ease;
}

.quiz-option-item {
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.quiz-option-item:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--brand-primary);
}

.quiz-option-item.selected {
    border-color: var(--brand-primary);
    background: rgba(99, 102, 241, 0.15);
}

.quiz-option-item.correct {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.quiz-option-item.wrong {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* 4. Tinder Swipe Cards (Fixed Typography & Overflow) */
.swipe-deck-area {
    position: relative;
    max-width: 540px;
    height: 420px;
    margin: 0 auto;
}

.swipe-card {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 36px 30px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow-lg);
    user-select: none;
    overflow: hidden;
    word-break: break-word;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.swipe-card-content {
    font-size: clamp(1.1rem, 2.5vw, 1.35rem);
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    margin: auto 0;
    padding: 0 10px;
    overflow-y: auto;
    max-height: 220px;
}

.swipe-stamp {
    position: absolute;
    top: 20px;
    padding: 4px 14px;
    border-radius: 6px;
    font-size: 1.2rem;
    font-weight: 800;
    text-transform: uppercase;
    opacity: 0;
    z-index: 10;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.stamp-true {
    right: 20px;
    border: 3px solid #10b981;
    color: #10b981;
    transform: rotate(12deg);
}

.stamp-false {
    left: 20px;
    border: 3px solid #ef4444;
    color: #ef4444;
    transform: rotate(-12deg);
}

/* 5. References Tab (Multiple Video Players + PDF View) */
.reference-video-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 24px;
}

.video-player-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 16px;
}

.video-player-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* 6. Personal Notes & Highlights UI */
.student-note-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid #f59e0b;
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin-bottom: 16px;
    position: relative;
}

.note-quote {
    font-size: 0.85rem;
    color: #fbbf24;
    font-style: italic;
    margin-bottom: 6px;
    background: rgba(245, 158, 11, 0.08);
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

/* Responsive */
@media (max-width: 992px) {
    .study-hub-shell {
        grid-template-columns: 1fr;
    }
    .study-left-sidebar {
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    .study-main-stage {
        padding: 24px 16px;
    }
}

/* ==========================================================================
   Modular Custom Deck & Favorites Aggregator Styling
   ========================================================================== */
.compact-creator-chip {
    transition: transform 0.2s, border-color 0.2s, background 0.2s;
}
.compact-creator-chip:hover {
    border-color: rgba(99, 102, 241, 0.4) !important;
    background: rgba(30, 41, 59, 0.95) !important;
    transform: translateY(-2px);
}

.variation-item-card {
    transition: all 0.2s ease-in-out;
}
.variation-item-card:hover {
    border-color: rgba(99, 102, 241, 0.5) !important;
    background: rgba(30, 41, 59, 0.8) !important;
    transform: translateY(-2px);
}
.variation-item-card.selected-variation {
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.25);
    background: rgba(99, 102, 241, 0.08) !important;
}

.btn-favorite-deck {
    transition: transform 0.2s, color 0.2s;
}
.btn-favorite-deck:hover {
    transform: scale(1.2);
    color: #fbbf24 !important;
}
.btn-favorite-deck.active {
    color: #fbbf24 !important;
}

.btn-quick-star {
    transition: all 0.2s ease;
}
.btn-quick-star:hover {
    border-color: #fbbf24;
    color: #fbbf24;
}

.custom-tab-btn.active {
    background: var(--brand-primary) !important;
    color: #fff !important;
}
