/* Student Library - Native Kotlin Portal Stylesheet */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

/* Global resets specifically for interactive views inside Layout wrapper */
.library-container,
.subject-detail-container,
.chapter-container,
.flashcard-screen,
.quiz-screen,
.summary-screen {
    font-family: 'Poppins', 'Google Sans Flex', sans-serif;
    color: var(--text-dark, #1A1B24);
    min-height: calc(100vh - 80px);
    background: var(--bg-gray, #F8FBFF);
    animation: fadeIn 0.4s ease-out forwards;
}

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

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

/* -------------------------------------------------------------
   1. MAIN LIBRARY VIEW (SUBJECTS BY GRADE)
   ------------------------------------------------------------- */
.library-container {
    padding: 40px 24px;
}

.library-content {
    max-width: 1200px;
    margin: 0 auto;
}

.library-title-section {
    margin-bottom: 40px;
}

.library-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--navy-dark, #1A1B24);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.library-subtitle {
    font-size: 1.1rem;
    color: var(--text-light, #666666);
}

.grade-section-header {
    margin-bottom: 24px;
}

.grade-section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--navy-dark, #1A1B24);
}

/* Grade selector strip (premium grid/flow layout) */
.grade-strip {
    display: flex;
    gap: 12px;
    margin-bottom: 36px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary, #0A34D3) transparent;
}

.grade-strip::-webkit-scrollbar {
    height: 6px;
}

.grade-strip::-webkit-scrollbar-thumb {
    background-color: rgba(10, 52, 211, 0.2);
    border-radius: 10px;
}

.grade-tile {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 16px;
    background: var(--surface-white, #FFFFFF);
    border: 4px solid #272727;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: none;
}

.grade-tile:hover {
    transform: translateY(-4px);
    border-color: #272727;
    box-shadow: 0 6px 0 #272727;
}

.grade-tile.active {
    background: #0A34D3 !important;
    border-color: #272727 !important;
    color: white !important;
    box-shadow: 0 4px 0 #272727;
    transform: translateY(-2px);
}

.grade-tile.active .grade-num,
.grade-tile.active .grade-sub {
    color: white !important;
}

.grade-num {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--navy-dark, #1A1B24);
}

.grade-sub {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-light, #666666);
}

/* Subjects grid layout */
.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.subject-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    background: var(--surface-white, #FFFFFF);
    border: 4px solid #272727;
    border-radius: 32px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: left;
    box-shadow: none;
    box-sizing: border-box;
}

.subject-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 0 #272727;
    border-color: #272727;
}

.subject-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: rgba(10, 52, 211, 0.05);
    color: var(--primary, #0A34D3);
    border: 3px solid #272727;
    border-radius: 16px;
    font-size: 1.8rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.subject-card:hover .subject-icon-wrap {
    background: #0A34D3;
    color: white;
    border-color: #272727;
}

.subject-info {
    flex: 1;
}

.subject-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--navy-dark, #1A1B24);
    margin-bottom: 4px;
}

.subject-chapters-count {
    font-size: 0.85rem;
    color: var(--text-light, #666666);
}

/* -------------------------------------------------------------
   2. SUBJECT DETAIL VIEW (CHAPTERS GRID)
   ------------------------------------------------------------- */
.subject-detail-container {
    padding: 40px 24px;
}

.subject-header-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.back-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--surface-white, #FFFFFF);
    border: 1px solid var(--border-gray, #C4C5D8);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition, all 0.25s ease5);
    color: var(--navy-dark, #1A1B24);
}

.back-link-btn:hover {
    border-color: var(--primary, #0A34D3);
    color: var(--primary, #0A34D3);
    transform: translateX(-2px);
}

.subject-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--navy-dark, #1A1B24);
    letter-spacing: -0.5px;
}

/* Chapter Card Styles */
.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.chapter-card {
    background: var(--surface-white, #FFFFFF);
    border: 4px solid #272727;
    border-radius: 32px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    height: 420px;
    display: flex;
    flex-direction: column;
    box-shadow: none;
    box-sizing: border-box;
}

.chapter-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 0 #272727;
    border-color: #272727;
}

.chapter-img-container {
    width: 100%;
    height: 190px;
    position: relative;
    overflow: hidden;
    background: #E9EEF5;
    border-bottom: 4px solid #272727;
}

.chapter-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.chapter-card:hover .chapter-img {
    transform: scale(1.05);
}

.chapter-card-locked-overlay {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.chapter-body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.chapter-header-info {
    margin-bottom: 12px;
}

.chapter-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--navy-dark, #1A1B24);
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.resource-pill-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.resource-pill {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    color: var(--navy-dark, #1A1B24);
}

.chapter-card-desc {
    font-size: 0.88rem;
    color: var(--text-light, #666666);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* -------------------------------------------------------------
   3. CHAPTER STUDY LANDING PAGE
   ------------------------------------------------------------- */
.chapter-container {
    padding-bottom: 60px;
}

.chapter-hero-banner {
    width: 100%;
    height: 280px;
    position: relative;
    overflow: hidden;
}

.chapter-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chapter-hero-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to top, rgba(26, 27, 36, 0.8) 0%, rgba(26, 27, 36, 0.2) 100%);
}

.chapter-hero-nav {
    position: absolute;
    top: 24px;
    left: 24px;
    z-index: 10;
}

.chapter-hero-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s;
    color: var(--navy-dark, #1A1B24);
}

.chapter-hero-back:hover {
    transform: scale(1.05) translateX(-2px);
}

.chapter-hero-title-box {
    position: absolute;
    bottom: 32px;
    left: 24px;
    right: 24px;
    color: white;
}

.chapter-hero-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 6px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.chapter-hero-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 400;
}

.chapter-study-content {
    max-width: 1000px;
    margin: -40px auto 0 auto;
    background: var(--bg-gray, #F8FBFF);
    border-top-left-radius: 32px;
    border-top-right-radius: 32px;
    position: relative;
    padding: 40px 24px;
    z-index: 5;
}

/* Friendly Lock Banner */
.chapter-access-locked-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #FFF9E6;
    border: 1px solid #FFD180;
    color: #8D6E63;
    padding: 16px 20px;
    border-radius: 16px;
    margin-bottom: 30px;
    font-weight: 600;
    font-size: 0.95rem;
}

.access-lock-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.chapter-study-desc {
    font-size: 1.05rem;
    color: var(--text-light, #666666);
    line-height: 1.6;
    margin-bottom: 36px;
}

/* Grid of Action Widgets */
.action-widgets-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 48px;
}

@media (max-width: 600px) {
    .action-widgets-grid {
        grid-template-columns: 1fr;
    }
}

.action-widget-card {
    background: var(--surface-white, #FFFFFF);
    border: 1px solid rgba(196, 197, 216, 0.4);
    border-radius: 24px;
    padding: 30px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
    transition: var(--transition, all 0.25s ease);
}

.action-widget-card.active {
    cursor: pointer;
}

.action-widget-card.active:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(10, 52, 211, 0.06);
    border-color: var(--primary, #0A34D3);
}

.action-widget-card.disabled {
    opacity: 0.55;
    cursor: not-allowed;
    filter: grayscale(0.8);
}

.widget-status-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #E8F5E9;
    color: #2E7D32;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    text-transform: uppercase;
}

.widget-icon-box {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    font-size: 1.8rem;
    position: relative;
}

.widget-icon-box.purple { background: #F3E8FF; color: #7C3AED; }
.widget-icon-box.blue { background: #E0F2FE; color: #0284C7; }
.widget-icon-box.green { background: #DCFCE7; color: #16A34A; }
.widget-icon-box.yellow { background: #FEF9C3; color: #CA8A04; }

.widget-sparkle {
    position: absolute;
    font-size: 1.1rem;
    top: -4px;
    right: -4px;
    animation: floatingSparkle 2s infinite;
}

@keyframes floatingSparkle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.widget-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--navy-dark, #1A1B24);
    margin-bottom: 6px;
}

.widget-desc {
    font-size: 0.85rem;
    color: var(--text-light, #666666);
    line-height: 1.4;
}

/* Footer level pagination between chapters */
.chapter-navigation-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-gray, #C4C5D8);
    padding-top: 24px;
    margin-top: 40px;
    gap: 16px;
}

.chapter-nav-arrow-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--surface-white, #FFFFFF);
    border: 1px solid var(--border-gray, #C4C5D8);
    border-radius: 14px;
    color: var(--navy-dark, #1A1B24);
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition, all 0.25s ease);
}

.chapter-nav-arrow-btn:hover {
    background: #F1F5F9;
    border-color: var(--primary, #0A34D3);
    color: var(--primary, #0A34D3);
    transform: translateY(-1px);
}

.chapter-nav-arrow-btn:active {
    transform: translateY(0);
}

/* -------------------------------------------------------------
   4. FULLSCREEN STUDY SPACES: QUIZ, FLASHCARDS, SUMMARY
   ------------------------------------------------------------- */
/* Header bars for study spaces */
.workspace-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: transparent;
    color: white;
}

.workspace-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    cursor: pointer;
    transition: var(--transition, all 0.25s ease);
}

.workspace-back-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.workspace-title {
    font-size: 1.15rem;
    font-weight: 700;
    text-align: center;
    flex: 1;
    margin: 0 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* A. FLASHCARDS SCREEN */
.flashcard-screen {
    background: linear-gradient(135deg, #1A35D6 0%, #764BA2 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

.flashcard-screen .workspace-title {
    color: white;
}

.flashcard-progress-box {
    padding: 0 24px;
    margin-bottom: 20px;
    text-align: center;
}

.flashcard-progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 6px;
    width: 100%;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.flashcard-progress-fill {
    height: 100%;
    background: white;
    width: 0%;
    transition: width 0.3s ease;
}

.flashcard-progress-text {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
}

/* 3D Flip Card Scene */
.flashcard-deck-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
    width: 100%;
    padding: 20px;
}

.flashcard-3d-scene {
    position: relative;
    width: 100%;
    max-width: 360px;
    height: 440px;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.flashcard-3d-scene.is-flipped {
    transform: rotateY(180deg);
}

.flashcard-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    background: var(--surface-white, #FFFFFF);
    border-radius: 28px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.flashcard-face.flashcard-back {
    transform: rotateY(180deg);
    background: #FFFDF0; /* soft warm yellow to indicate answer */
}

.flashcard-face h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--navy-dark, #1A1B24);
    line-height: 1.5;
}

.flashcard-face p.answer-body {
    font-size: 1.1rem;
    color: var(--navy-dark, #1A1B24);
    line-height: 1.6;
}

.flashcard-tap-instruction {
    position: absolute;
    bottom: 24px;
    color: #9CA3AF;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Swipe triggers / action buttons */
.flashcard-action-bar {
    padding: 32px 24px;
    display: flex;
    gap: 16px;
    justify-content: center;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
}

.flashcard-swipe-btn {
    flex: 1;
    padding: 16px;
    border-radius: 18px;
    border: none;
    color: white;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition, all 0.25s ease);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.flashcard-swipe-btn:active {
    transform: scale(0.97);
}

.flashcard-swipe-btn.swipe-dont-know {
    background: #EF4444;
}

.flashcard-swipe-btn.swipe-dont-know:hover {
    background: #DC2626;
}

.flashcard-swipe-btn.swipe-correct {
    background: #10B981;
}

.flashcard-swipe-btn.swipe-correct:hover {
    background: #059669;
}

/* B. QUIZ SPACE ENGINE */
.quiz-screen {
    background: linear-gradient(135deg, #0A34D3 0%, #1E293B 100%);
    display: flex;
    flex-direction: column;
}

.quiz-timer-box {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 6px;
}

.quiz-progress-section {
    padding: 0 24px 16px;
}

.quiz-progress-bar {
    height: 5px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
}

.quiz-progress-fill {
    height: 100%;
    background: #E87257; /* accent color */
    width: 0%;
    transition: width 0.3s ease;
}

.quiz-workspace-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quiz-card {
    background: var(--surface-white, #FFFFFF);
    border-radius: 28px;
    padding: 40px 32px;
    width: 100%;
    max-width: 620px;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.2);
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.quiz-question-text {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--navy-dark, #1A1B24);
    line-height: 1.5;
    margin-bottom: 28px;
}

.quiz-options-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quiz-option-button {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: #F3F4F6;
    border: 2px solid transparent;
    border-radius: 18px;
    cursor: pointer;
    transition: var(--transition, all 0.25s ease);
    width: 100%;
    text-align: left;
}

.quiz-option-button:hover {
    background: #E5E7EB;
}

.quiz-option-button.is-selected {
    background: #EEF2FF;
    border-color: var(--primary, #0A34D3);
}

.quiz-option-radio-circle {
    width: 22px;
    height: 22px;
    border: 2px solid #9CA3AF;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition, all 0.25s ease);
}

.quiz-option-button.is-selected .quiz-option-radio-circle {
    border-color: var(--primary, #0A34D3);
}

.quiz-option-radio-dot {
    width: 10px;
    height: 10px;
    background: var(--primary, #0A34D3);
    border-radius: 50%;
}

.quiz-option-content {
    font-size: 1rem;
    font-weight: 600;
    color: var(--navy-dark, #1A1B24);
}

/* Animations for quiz card transitions */
.slide-out {
    transform: translateX(-40px) scale(0.95);
    opacity: 0;
    pointer-events: none;
}

.slide-in {
    transform: translateX(40px) scale(0.95);
    opacity: 0;
}

/* C. RICH SUMMARY READING BOARD */
.summary-screen {
    background: var(--bg-gray, #F8FBFF);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.summary-nav-header {
    display: flex;
    align-items: center;
    padding: 20px 24px;
    background: var(--surface-white, #FFFFFF);
    border-bottom: 1px solid var(--border-gray, #C4C5D8);
    position: sticky;
    top: 0;
    z-index: 20;
}

.summary-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--navy-dark, #1A1B24);
}

.summary-nav-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--navy-dark, #1A1B24);
    margin-left: 12px;
}

.summary-scrollable-container {
    flex: 1;
    padding: 40px 24px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.summary-title-block {
    margin-bottom: 30px;
}

.summary-eyebrow {
    font-size: 0.85rem;
    color: var(--text-light, #666666);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.summary-main-heading {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--navy-dark, #1A1B24);
    line-height: 1.25;
}

/* The summary content container */
.summary-content-box {
    background: var(--surface-white, #FFFFFF);
    border: 1px solid rgba(196, 197, 216, 0.4);
    border-radius: 24px;
    padding: 40px;
    margin-bottom: 32px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
    position: relative;
}

.summary-content-box.is-locked {
    max-height: 250px;
    overflow: hidden;
}

.summary-bottom-locked-fade {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 160px;
    background: linear-gradient(to bottom, transparent, var(--surface-white, #FFFFFF) 90%);
    pointer-events: none;
}

/* Rich text tags styling for summary output */
.summary-rich-body h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--navy-dark, #1A1B24);
    margin-top: 24px;
    margin-bottom: 12px;
}

.summary-rich-body h3:first-child {
    margin-top: 0;
}

.summary-rich-body p {
    font-size: 1rem;
    color: var(--navy-dark, #1A1B24);
    line-height: 1.7;
    margin-bottom: 16px;
}

.summary-rich-body ul,
.summary-rich-body ol {
    margin-bottom: 20px;
    padding-left: 24px;
}

.summary-rich-body li {
    font-size: 1rem;
    color: var(--navy-dark, #1A1B24);
    line-height: 1.6;
    margin-bottom: 8px;
}

/* Interactive Download Card */
.summary-download-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--surface-white, #FFFFFF);
    border: 1px dashed var(--border-gray, #C4C5D8);
    border-radius: 16px;
    cursor: pointer;
    transition: var(--transition, all 0.25s ease);
    margin-bottom: 40px;
}

.summary-download-card:hover {
    border-color: var(--primary, #0A34D3);
    background: rgba(10, 52, 211, 0.02);
}

.summary-download-icon-box {
    width: 44px;
    height: 44px;
    background: #FFF3E0;
    color: #E65100;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.summary-download-text-box h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--navy-dark, #1A1B24);
    margin-bottom: 2px;
}

.summary-download-text-box p {
    font-size: 0.8rem;
    color: var(--text-light, #666666);
}

/* Floating overlay footer for locked summaries */
.summary-floating-gate-overlay {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(to top, rgba(248, 251, 255, 1) 0%, rgba(248, 251, 255, 1) 50%, rgba(248, 251, 255, 0.9) 80%, rgba(248, 251, 255, 0) 100%);
    padding: 80px 24px 32px 24px;
    z-index: 30;
    text-align: center;
}

.summary-gate-card {
    max-width: 600px;
    margin: 0 auto;
    background: var(--surface-white, #FFFFFF);
    padding: 32px 24px;
    border-radius: 24px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.1);
    border: 1px solid rgba(196, 197, 216, 0.3);
}

.summary-gate-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--navy-dark, #1A1B24);
    margin-bottom: 8px;
}

.summary-gate-subtitle {
    font-size: 0.92rem;
    color: var(--text-light, #666666);
    margin-bottom: 24px;
}

/* -------------------------------------------------------------
   5. RESULTS VIEW & ANALYTICS PANELS (FOR FLASHCARDS & QUIZ)
   ------------------------------------------------------------- */
.results-container {
    padding: 40px 24px;
    max-width: 620px;
    margin: 0 auto;
    width: 100%;
}

.results-card {
    background: var(--surface-white, #FFFFFF);
    border-radius: 28px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 16px 40px rgba(0,0,0,0.06);
    margin-bottom: 24px;
}

.results-heading {
    font-size: 2rem;
    font-weight: 800;
    color: var(--navy-dark, #1A1B24);
    margin-bottom: 30px;
}

/* Performance Donut Charts */
.results-stats-panel {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    gap: 24px;
}

.results-donut-box {
    position: relative;
    width: 130px;
    height: 130px;
}

.results-donut-text {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.results-donut-percentage {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--navy-dark, #1A1B24);
}

.results-donut-label {
    font-size: 0.75rem;
    color: var(--text-light, #666666);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.results-stat-meta-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}

.results-stat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--navy-dark, #1A1B24);
}

.results-bullet {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.results-bullet.success { background-color: #10B981; }
.results-bullet.danger { background-color: #EF4444; }

.results-action-panel {
    background: var(--surface-white, #FFFFFF);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.03);
}

.results-action-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--navy-dark, #1A1B24);
    margin-bottom: 16px;
    text-align: left;
}

.results-action-list-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #F9FAFB;
    border: none;
    border-radius: 14px;
    margin-bottom: 10px;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--navy-dark, #1A1B24);
    transition: var(--transition, all 0.25s ease);
}

.results-action-list-btn:hover {
    background: #F3F4F6;
    transform: translateX(4px);
}

.results-action-list-btn:last-child {
    margin-bottom: 0;
}

.results-action-icon {
    font-size: 1.25rem;
}

/* D. QUIZ EXAMINATIVE REVIEW BOARD */
.quiz-review-workspace {
    padding: 40px 24px;
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
}

.review-item-card {
    background: var(--surface-white, #FFFFFF);
    border-radius: 20px;
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.02);
}

.review-question-header {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--navy-dark, #1A1B24);
    margin-bottom: 16px;
    line-height: 1.5;
}

.review-options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.review-option-pill {
    padding: 14px 18px;
    background: #F9FAFB;
    border-radius: 12px;
    border: 2px solid transparent;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--navy-dark, #1A1B24);
}

.review-option-pill.correct-answer-pill {
    background: #DCFCE7;
    border-color: #10B981;
}

.review-option-pill.incorrect-answer-pill {
    background: #FEE2E2;
    border-color: #EF4444;
}

.review-badge-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: #059669;
    margin-top: 6px;
}

.review-badge-label.wrong {
    color: #DC2626;
}

/* -------------------------------------------------------------
   6. PREMIUM MOBILE APP STORE GATE (MODAL OVERLAY)
   ------------------------------------------------------------- */
.app-download-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(26, 27, 36, 0.6);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeOverlayIn 0.3s ease-out;
}

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

.app-download-modal {
    background: var(--surface-white, #FFFFFF);
    border-radius: 28px;
    padding: 44px 32px;
    max-width: 440px;
    width: 100%;
    text-align: center;
    position: relative;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
    animation: slideModalUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.modal-close-trigger {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #F3F4F6;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition, all 0.25s ease);
    color: #6B7280;
}

.modal-close-trigger:hover {
    background: #E5E7EB;
    transform: scale(1.08);
}

.store-modal-heading {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--navy-dark, #1A1B24);
    margin-bottom: 12px;
}

.store-modal-subtitle {
    font-size: 0.92rem;
    color: var(--text-light, #666666);
    line-height: 1.6;
    margin-bottom: 32px;
}

.store-download-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.app-store-brand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 24px;
    background: #000000;
    color: white;
    border-radius: 12px;
    text-decoration: none;
    transition: var(--transition, all 0.25s ease);
    width: 100%;
    max-width: 260px;
}

.app-store-brand-btn:hover {
    opacity: 0.88;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.app-store-brand-btn-text-block {
    text-align: left;
    line-height: 1.25;
}

.app-store-label-sm {
    display: block;
    font-size: 0.65rem;
    font-weight: 500;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.app-store-title-md {
    display: block;
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.3px;
}

/* -------------------------------------------------------------
   7. SKELETON LOADERS
   ------------------------------------------------------------- */
.loading-skeleton-container {
    padding: 40px 24px;
}

.skeleton-shimmer {
    background: linear-gradient(90deg, #F3F4F6 25%, #E5E7EB 50%, #F3F4F6 75%);
    background-size: 200% 100%;
    animation: shimmerLoading 1.5s infinite;
    border-radius: 8px;
}

@keyframes shimmerLoading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-line {
    height: 16px;
    margin-bottom: 12px;
    border-radius: 4px;
}

.skeleton-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
}

/* ==========================================
   AI Study Workspace Banners & FAB
   ========================================== */

/* Subjects / Chapters Selector Banner */
.library-promo-banner {
    display: flex;
    background: linear-gradient(135deg, #E6EEFF 0%, #FFFFFF 100%);
    border: 3px solid #1A1B24;
    border-radius: 28px;
    padding: 32px;
    margin-top: 10px;
    margin-bottom: 40px;
    box-shadow: 0 4px 0 #1A1B24;
    gap: 32px;
    align-items: center;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .library-promo-banner {
        flex-direction: column;
        padding: 24px;
        gap: 20px;
    }
}

.promo-left {
    flex: 1.2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.promo-badge {
    background: #FFF9E6;
    border: 2px solid #1A1B24;
    border-radius: 100px;
    padding: 4px 14px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #B45309;
}

.promo-left h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    color: #1A1B24;
    margin: 0;
    line-height: 1.3;
}

.promo-left p {
    font-size: 0.95rem;
    color: #4B5563;
    line-height: 1.5;
    margin: 0;
}

.promo-launch-btn {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    background: #0A34D3;
    color: #FFFFFF;
    border: 3px solid #1A1B24;
    padding: 12px 28px;
    border-radius: 16px;
    font-weight: 800;
    font-size: 1rem;
    text-decoration: none;
    box-shadow: 0 4px 0 #1A1B24;
    transition: all 0.2s ease;
}

.promo-launch-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #1A1B24;
}

.promo-launch-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #1A1B24;
}

.promo-right {
    flex: 0.8;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.promo-illustration-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    position: relative;
}

.promo-character-bubble {
    background: #FFFFFF;
    border: 2px solid #1A1B24;
    border-radius: 18px;
    padding: 12px 16px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #1A1B24;
    text-align: center;
    max-width: 220px;
    box-shadow: 2px 2px 0 #1A1B24;
    position: relative;
}

.promo-character-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px 8px 0;
    border-style: solid;
    border-color: #FFFFFF transparent;
    display: block;
    width: 0;
}

.promo-character-bubble::before {
    content: '';
    position: absolute;
    bottom: -11px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 9px 9px 0;
    border-style: solid;
    border-color: #1A1B24 transparent;
    display: block;
    width: 0;
    z-index: -1;
}

.promo-character-avatar {
    font-size: 3.5rem;
    line-height: 1;
    animation: bounceCharacter 3s ease-in-out infinite;
}

@keyframes bounceCharacter {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-8px) scale(1.05); }
}

/* Floating FAB widgets */
.floating-mitra-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #FFD54F;
    border: 3px solid #1A1B24;
    border-radius: 50px;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    box-shadow: 0 4px 0 #1A1B24;
    transition: all 0.2s ease;
    z-index: 999;
}

.floating-mitra-fab:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 0 #1A1B24;
}

.floating-mitra-fab:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #1A1B24;
}

.fab-avatar {
    font-size: 1.8rem;
}

.fab-text-column {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.fab-title {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 800;
    color: #1A1B24;
}

.fab-sub {
    font-size: 0.72rem;
    font-weight: 700;
    color: rgba(26,27,36,0.7);
}

/* Chapter Detail page Study Space banner */
.study-space-banner {
  background: linear-gradient(135deg, hsl(239 84% 67% / 0.1) 0%, hsl(314 93% 61% / 0.1) 100%);
  border: 3px solid #1A1B24;
  border-radius: 24px;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  margin-bottom: 30px;
  box-shadow: 0 4px 0 #1A1B24;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .study-space-banner {
    flex-direction: column;
    padding: 20px;
    align-items: flex-start;
  }
}

.study-space-banner:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 0 #1A1B24;
}

.study-space-banner-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.study-space-banner-content h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: #1a1b24;
  margin-top: 0;
  margin-bottom: 8px;
}

.study-space-banner-content p {
  font-size: 13.5px;
  color: #4b5563;
  max-width: 600px;
  line-height: 1.5;
  margin-top: 0;
  margin-bottom: 16px;
}

.banner-pill {
  display: inline-block;
  background: #0A34D3;
  color: white;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 12px;
  margin-bottom: 10px;
  text-transform: uppercase;
  border: 2px solid #1A1B24;
}

.study-space-banner .launch-btn {
  background: #FFD54F;
  border: 3px solid #1A1B24;
  color: #1A1B24;
  padding: 10px 24px;
  border-radius: 16px;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 0 #1A1B24;
}

.study-space-banner:hover .launch-btn {
  background: #FFC107;
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #1A1B24;
}

.study-space-banner-graphic {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .study-space-banner-graphic {
    align-self: center;
    margin-top: 15px;
  }
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(20px);
  opacity: 0.6;
}

.orb-purple {
  width: 70px;
  height: 70px;
  background: #0A34D3;
  top: 10px;
  left: 10px;
  animation: floatOrb 4s infinite alternate;
}

.orb-pink {
  width: 60px;
  height: 60px;
  background: #FF2E93;
  bottom: 10px;
  right: 10px;
  animation: floatOrb 4s infinite alternate-reverse;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(15px, 15px) scale(1.1); }
}

.multiplayer-badge {
  position: absolute;
  background: white;
  border: 2px solid #1A1B24;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
  color: #1A1B24;
  box-shadow: 2px 2px 0 #1A1B24;
  bottom: 20px;
  white-space: nowrap;
}

