* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: Arial, sans-serif;
    min-height: 100vh;
    padding: 40px 20px;
    background: linear-gradient(135deg, #0f172a, #111827);
    color: #f8fafc;
    transition: background 0.3s ease, color 0.3s ease;
}

.app {
    width: 100%;
    max-width: 850px;
    margin: auto;
}

/* HEADER */

.header {
    padding: 20px 20px 30px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}


/* =========================================================
   LOGO - ONLY COLOUR CHANGED TO PURPLE
   ========================================================= */

.logo {
    width: 92px;
    height: 76px;
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.cap {
    position: relative;
    width: 92px;
    height: 76px;
    overflow: visible;
}

.cap-top {
    position: absolute;
    width: 96px;
    height: 48px;
    left: -2px;
    top: 2px;

    background: linear-gradient(
        135deg,
        #9b6cff 0%,
        #7c3aed 50%,
        #5b21b6 100%
    );

    clip-path: polygon(
        50% 0%,
        100% 50%,
        50% 100%,
        0% 50%
    );

    filter: drop-shadow(
        0 5px 6px rgba(76, 29, 149, 0.40)
    );

    z-index: 5;
}

.cap-top::after {
    content: "";

    position: absolute;
    width: 10px;
    height: 10px;
    left: 43px;
    top: 19px;

    background: radial-gradient(
        circle at 35% 30%,
        #ddd6fe 0%,
        #c4b5fd 25%,
        #8b5cf6 65%,
        #4c1d95 100%
    );

    border-radius: 50%;

    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.40);

    z-index: 8;
}

.cap-body {
    position: absolute;
    width: 50px;
    height: 32px;
    left: 21px;
    top: 31px;

    background: linear-gradient(
        180deg,
        #8b5cf6 0%,
        #7c3aed 50%,
        #5b21b6 100%
    );

    clip-path: polygon(
        5% 0%,
        95% 0%,
        100% 58%,
        96% 76%,
        86% 89%,
        70% 96%,
        50% 100%,
        30% 96%,
        14% 89%,
        4% 76%,
        0% 58%
    );

    border-radius: 0 0 12px 12px;

    box-shadow:
        0 7px 10px rgba(15, 23, 42, 0.45);

    z-index: 3;
}

.cap-body::before {
    content: "";

    position: absolute;
    width: 31px;
    height: 4px;
    left: 9px;
    top: 3px;

    background: rgba(255, 255, 255, 0.18);

    border-radius: 50%;
}

.cap-tassel-line {
    position: absolute;
    width: 4px;
    height: 38px;
    left: 10px;
    top: 22px;

    background: linear-gradient(
        180deg,
        #c4b5fd 0%,
        #a78bfa 45%,
        #7c3aed 100%
    );

    border-radius: 5px;

    transform: rotate(9deg);
    transform-origin: top center;

    z-index: 7;
}

.cap-tassel-dot {
    position: absolute;
    width: 14px;
    height: 14px;
    left: 3px;
    top: 54px;

    background: linear-gradient(
        135deg,
        #c4b5fd 0%,
        #a855f7 45%,
        #7c3aed 100%
    );

    border-radius: 50%;

    box-shadow:
        0 3px 8px rgba(124, 58, 237, 0.45);

    z-index: 8;
}


/* BRAND TEXT */

.brand-text {
    min-width: 0;
}

.brand-text h1 {
    font-size: 34px;
    font-weight: 800;
    line-height: 1.1;
    color: #ffffff;
    letter-spacing: -0.7px;
}

.brand-text p {
    margin-top: 7px;
    color: #94a3b8;
    font-size: 15px;
    line-height: 1.4;
}


/* THEME BUTTON - UNCHANGED */

.theme-btn {
    border: none;
    min-width: 52px;
    height: 44px;
    padding: 0 15px;
    border-radius: 14px;

    background: linear-gradient(
        135deg,
        #4f46e5,
        #7c3aed
    );

    color: white;
    font-size: 19px;
    cursor: pointer;

    box-shadow:
        0 8px 18px rgba(79, 70, 229, 0.25);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.theme-btn:hover {
    transform: translateY(-2px);

    box-shadow:
        0 10px 22px rgba(79, 70, 229, 0.32);
}

.theme-btn:active {
    transform: scale(0.96);
}


/* COMMON CARDS */

.card,
.chat-card,
.quiz-card,
.dashboard-card {
    width: 100%;
    background: #1e293b;
    padding: 30px;
    margin-bottom: 25px;
    border-radius: 22px;
    border: 1px solid #334155;

    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.20);

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease;
}

.card:hover,
.chat-card:hover,
.quiz-card:hover,
.dashboard-card:hover {
    transform: translateY(-2px);

    box-shadow:
        0 16px 35px rgba(0, 0, 0, 0.28);
}


/* HEADINGS */

.card h2,
.chat-card h2,
.quiz-card h2,
.dashboard-card h2 {
    font-size: 23px;
    color: #ffffff;
    margin-bottom: 9px;
}

.card > p,
.chat-card > p,
.quiz-card > p,
.dashboard-card > p {
    color: #94a3b8;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 20px;
}


/* INPUTS */

input,
textarea {
    width: 100%;
    border: 1px solid #334155;
    background: #0f172a;
    color: #f8fafc;
    border-radius: 12px;
    padding: 13px 15px;
    font-family: Arial, sans-serif;
    font-size: 15px;
    outline: none;
    margin-bottom: 14px;

    transition:
        border 0.2s ease,
        box-shadow 0.2s ease;
}

input:focus,
textarea:focus {
    border-color: #818cf8;

    box-shadow:
        0 0 0 3px rgba(99, 102, 241, 0.15);
}

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

input::placeholder,
textarea::placeholder {
    color: #64748b;
}

input[type="file"] {
    cursor: pointer;
}


/* BUTTONS */

.card button,
.chat-card button,
.quiz-card button {
    border: none;

    background: linear-gradient(
        135deg,
        #4f46e5,
        #7c3aed
    );

    color: white;

    padding: 13px 20px;

    border-radius: 12px;

    font-size: 15px;
    font-weight: 700;

    cursor: pointer;

    box-shadow:
        0 7px 16px rgba(79, 70, 229, 0.20);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.card button:hover,
.chat-card button:hover,
.quiz-card button:hover {
    transform: translateY(-2px);

    box-shadow:
        0 10px 20px rgba(79, 70, 229, 0.28);
}


/* STUDY PLAN */

#result {
    margin-top: 20px;
}

.plan-result {
    background: #17133b;
    border: 1px solid #4338ca;
    border-radius: 15px;
    padding: 20px;
    color: #ddd6fe;
    line-height: 1.7;
    white-space: pre-wrap;
}


/* CHAT */

#chatBox {
    margin-top: 20px;
}

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

.user-message,
.ai-message {
    padding: 14px 16px;
    border-radius: 14px;
    line-height: 1.6;
    font-size: 15px;
}

.user-message {
    align-self: flex-end;
    max-width: 85%;
    background: #4f46e5;
    color: white;
    border-bottom-right-radius: 5px;
}

.ai-message {
    align-self: flex-start;
    max-width: 90%;
    background: #0f172a;
    color: #cbd5e1;
    border-bottom-left-radius: 5px;
}


/* QUIZ */

#quizResult {
    margin-top: 20px;
}

.quiz-result {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.quiz-question {
    background: #0f172a;
    border: 1px solid #334155;
    padding: 20px;
    border-radius: 16px;
}

.quiz-question h3 {
    color: #ffffff;
    font-size: 17px;
    line-height: 1.5;
    margin-bottom: 14px;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.options label {
    display: block;
    padding: 12px 14px;
    border: 1px solid #334155;
    background: #1e293b;
    border-radius: 10px;
    cursor: pointer;
    color: #cbd5e1;

    transition:
        background 0.2s ease,
        border 0.2s ease;
}

.options label:hover {
    background: #312e81;
    border-color: #6366f1;
}

.options input[type="radio"] {
    width: auto;
    margin: 0 8px 0 0;
    accent-color: #4f46e5;
}

.quiz-score {
    padding: 20px;
    background: #17133b;
    border: 1px solid #4338ca;
    border-radius: 16px;
    text-align: center;
    color: #ddd6fe;
}

.quiz-score h3 {
    font-size: 26px;
    margin-bottom: 6px;
}


/* PDF */

#pdfResult {
    margin-top: 20px;
}

.pdf-result {
    background: #0f172a;
    border: 1px solid #334155;
    padding: 20px;
    border-radius: 15px;
    color: #cbd5e1;
    line-height: 1.7;
    white-space: pre-wrap;
}


/* DASHBOARD */

.dashboard-card {
    overflow: hidden;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-top: 20px;
}

.stat-box {
    padding: 20px 14px;
    text-align: center;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 16px;

    transition:
        transform 0.2s ease,
        background 0.2s ease;
}

.stat-box:hover {
    transform: translateY(-2px);
    background: #17133b;
}

.stat-icon {
    font-size: 27px;
    margin-bottom: 8px;
}

.stat-box h3 {
    font-size: 27px;
    color: #a78bfa;
    margin-bottom: 7px;
}

.stat-box p {
    color: #94a3b8;
    font-size: 13px;
    line-height: 1.4;
}


/* PROGRESS */

.progress-area {
    margin-top: 24px;
    padding: 20px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 16px;
}

.progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 12px;
}

.progress-header h3 {
    font-size: 16px;
    color: #ffffff;
}

#progressText {
    font-size: 15px;
    font-weight: 800;
    color: #a78bfa;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: #334155;
    border-radius: 20px;
    overflow: hidden;
}

#overallProgress {
    width: 0%;
    height: 100%;

    background: linear-gradient(
        90deg,
        #4f46e5,
        #7c3aed,
        #a855f7
    );

    border-radius: 20px;
    transition: width 0.5s ease;
}


/* STREAK */

.streak-box {
    margin-top: 15px;
    padding: 18px 20px;

    display: flex;
    align-items: center;
    gap: 14px;

    background: linear-gradient(
        135deg,
        #17133b,
        #172554
    );

    border: 1px solid #4338ca;
    border-radius: 16px;
}

.streak-icon {
    font-size: 32px;
}

.streak-box h3 {
    font-size: 20px;
    color: #ffffff;
    margin-bottom: 4px;
}

.streak-box p {
    color: #94a3b8;
    font-size: 14px;
}


/* OLD DASHBOARD SUPPORT */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.dashboard-stat {
    padding: 20px;
    text-align: center;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 16px;
}

.dashboard-stat h3 {
    font-size: 28px;
    color: #a78bfa;
    margin-bottom: 8px;
}

.dashboard-stat p {
    color: #94a3b8;
    font-size: 14px;
}

.progress-container {
    margin-top: 22px;
}

.progress-fill {
    width: 0%;
    height: 100%;

    background: linear-gradient(
        90deg,
        #4f46e5,
        #a855f7
    );

    border-radius: 20px;
    transition: width 0.5s ease;
}

.progress-text {
    margin-top: 10px;
    color: #94a3b8;
    font-size: 14px;
}


/* FOOTER */

.footer {
    text-align: center;
    padding: 10px 20px 25px;
    color: #64748b;
    font-size: 14px;
}


/* LIGHT MODE */

body:not(.dark-mode) {
    background: linear-gradient(
        135deg,
        #f1f5f9,
        #e0e7ff
    );

    color: #172033;
}

body:not(.dark-mode) .card,
body:not(.dark-mode) .chat-card,
body:not(.dark-mode) .quiz-card,
body:not(.dark-mode) .dashboard-card {
    background: #ffffff;

    border-color: #e2e8f0;

    box-shadow:
        0 12px 30px rgba(15, 23, 42, 0.07);
}


/* HEADINGS STAY WHITE */

body:not(.dark-mode) .brand-text h1,
body:not(.dark-mode) .card h2,
body:not(.dark-mode) .chat-card h2,
body:not(.dark-mode) .quiz-card h2,
body:not(.dark-mode) .dashboard-card h2 {
    color: #ffffff;
}


/* MOBILE */

@media (max-width: 700px) {

    body {
        padding: 25px 15px;
    }

    .header {
        padding: 15px 10px 25px;
    }

    .brand-text h1 {
        font-size: 29px;
    }

    .brand-text p {
        font-size: 14px;
    }

    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .card,
    .chat-card,
    .quiz-card,
    .dashboard-card {
        padding: 24px;
    }
}


/* MOBILE LOGO */

@media (max-width: 520px) {

    body {
        padding: 18px 12px;
    }

    .header {
        padding: 10px 5px 22px;
        gap: 10px;
    }

    .brand {
        gap: 8px;
    }

    .logo {
        width: 66px;
        height: 60px;
    }

    .cap {
        transform: scale(0.72);
        transform-origin: center;
    }

    .brand-text h1 {
        font-size: 25px;
    }

    .brand-text p {
        font-size: 12px;
    }

    .theme-btn {
        min-width: 45px;
        width: 45px;
        height: 40px;
        padding: 0;
        font-size: 17px;
    }

    .card,
    .chat-card,
    .quiz-card,
    .dashboard-card {
        padding: 20px;
        border-radius: 18px;
        margin-bottom: 18px;
    }

    .card h2,
    .chat-card h2,
    .quiz-card h2,
    .dashboard-card h2 {
        font-size: 20px;
    }

    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-box {
        padding: 16px 10px;
    }

    .stat-icon {
        font-size: 24px;
    }

    .stat-box h3 {
        font-size: 23px;
    }

    .stat-box p {
        font-size: 12px;
    }

    .progress-area {
        padding: 16px;
    }

    .streak-box {
        padding: 16px;
    }

    .streak-icon {
        font-size: 28px;
    }

    .streak-box h3 {
        font-size: 18px;
    }
}


/* VERY SMALL MOBILE */

@media (max-width: 380px) {

    .brand-text h1 {
        font-size: 22px;
    }

    .brand-text p {
        font-size: 11px;
    }

    .logo {
        width: 56px;
    }

    .cap {
        transform: scale(0.65);
    }

    .theme-btn {
        width: 40px;
        min-width: 40px;
        height: 38px;
    }

    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
/* ===============================
   FLASHCARD FLIP
================================ */

.flashcard {
    perspective: 1000px;
    cursor: pointer;
    min-height: 240px;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    min-height: 240px;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

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

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    min-height: 240px;
    padding: 25px;
    border-radius: 18px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.flashcard-front {
    transform: rotateY(0deg);
}

.flashcard-back {
    transform: rotateY(180deg);
}
/* =========================================
   PREMIUM AI FLASHCARDS
========================================= */

.flashcards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.flashcard {
    position: relative;
    min-height: 260px;
    perspective: 1200px;
    cursor: pointer;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    min-height: 260px;
    transform-style: preserve-3d;
    transition: transform 0.7s cubic-bezier(0.2, 0.75, 0.2, 1);
}

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

.flashcard-front,
.flashcard-back {
    position: absolute;
    inset: 0;
    min-height: 260px;

    padding: 28px;
    border-radius: 22px;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    text-align: center;

    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;

    border: 1px solid rgba(255, 255, 255, 0.15);

    box-shadow:
        0 15px 35px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* FRONT */

.flashcard-front {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: white;

    transform: rotateY(0deg);
}

.flashcard-front h3 {
    font-size: 21px;
    line-height: 1.5;
    margin: 15px 0;
}

.flashcard-front p {
    font-size: 14px;
    opacity: 0.85;
}

/* BACK */

.flashcard-back {
    background: linear-gradient(135deg, #059669, #0ea5e9);
    color: white;

    transform: rotateY(180deg);
}

.flashcard-back p {
    font-size: 18px;
    line-height: 1.6;
}

/* CARD NUMBER */

.flashcard-number {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;

    padding: 7px 13px;
    border-radius: 50px;

    background: rgba(255, 255, 255, 0.16);
}

/* HOVER EFFECT */

.flashcard:hover .flashcard-inner {
    transform: translateY(-6px);
}

.flashcard.flipped:hover .flashcard-inner {
    transform: rotateY(180deg) translateY(-6px);
}

/* CLICK FEEL */

.flashcard:active .flashcard-inner {
    transform: scale(0.98);
}

.flashcard.flipped:active .flashcard-inner {
    transform: rotateY(180deg) scale(0.98);
}

/* MOBILE */

@media (max-width: 600px) {

    .flashcards-grid {
        grid-template-columns: 1fr;
    }

    .flashcard,
    .flashcard-inner,
    .flashcard-front,
    .flashcard-back {
        min-height: 240px;
    }

    .flashcard-front,
    .flashcard-back {
        padding: 22px;
    }

    .flashcard-front h3 {
        font-size: 19px;
    }

    .flashcard-back p {
        font-size: 16px;
    }
}
/* =========================================
   STUDY PLAN — LIGHT MODE + TEXT WRAP FIX
   Dark Mode ko disturb nahi karega
========================================= */

/* Study Plan result box */
.plan-result {
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

/* Study Plan heading — LIGHT MODE */
body:not(.dark-mode) .plan-result h2 {
    color: #172554;
    font-weight: 800;
}

/* Study Plan answer — LIGHT MODE */
body:not(.dark-mode) .plan-result pre {
    color: #1e3a5f;
    background: #f8faff;
    border: 1px solid #dbe4ff;
    border-left: 4px solid #6366f1;
    border-radius: 14px;
    padding: 22px;
    margin-top: 15px;

    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;

    max-width: 100%;
    width: 100%;

    line-height: 1.7;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
}

/* DARK MODE — existing dark look maintain */
body.dark-mode .plan-result {
    overflow: hidden;
}

body.dark-mode .plan-result h2 {
    color: #ffffff;
}

body.dark-mode .plan-result pre {
    color: #e0e7ff;

    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;

    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

/* Long text / equations / URLs kabhi box ke bahar na jaaye */
.plan-result,
.plan-result pre {
    min-width: 0;
}

/* Mobile */
@media (max-width: 600px) {
    .plan-result {
        padding: 18px;
    }

    .plan-result pre {
        padding: 16px;
        font-size: 14px;
        line-height: 1.6;
    }
}
/* ===== FINAL STUDY PLAN FIX ===== */

.plan-result {
    max-width: 100%;
    overflow: hidden;
}

.plan-result h2 {
    color: #111827 !important;
}

.plan-result pre {
    color: #1e293b !important;
    background: #f8fafc !important;
    padding: 20px !important;
    border-radius: 14px;
    white-space: pre-wrap !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    max-width: 100% !important;
    width: 100%;
    box-sizing: border-box;
}

/* DARK MODE */
body.dark-mode .plan-result h2 {
    color: #ffffff !important;
}

body.dark-mode .plan-result pre {
    color: #e2e8f0 !important;
    background: #0f172a !important;
}
/* =========================================
   FINAL STUDY PLAN FIX
   Light Mode only + Text Overflow Fix
   Dark Mode unchanged
========================================= */

/* Light mode: Study Plan main heading */
body:not(.dark-mode) .app > .card:first-of-type h2 {
    color: #172554 !important;
}

/* Prevent result container from overflowing */
#result,
.plan-result {
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden !important;
}

/* Study Plan generated text */
.plan-result pre {
    display: block;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;

    white-space: pre-wrap !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;

    margin: 0;
    line-height: 1.7;
}

/* Light mode generated result */
body:not(.dark-mode) .plan-result h2 {
    color: #172554 !important;
}

body:not(.dark-mode) .plan-result pre {
    color: #1e293b !important;
    background: #f8fafc !important;
}

/* Dark mode — existing look preserved */
body.dark-mode .plan-result h2 {
    color: #ffffff !important;
}

body.dark-mode .plan-result pre {
    color: #e2e8f0 !important;
    background: #0f172a !important;
}
/* TEST - LIGHT MODE STUDY PLAN */
body:not(.dark-mode) .app > .card:first-of-type h2 {
    color: red !important;
    background: yellow !important;
}
/* =========================================
   FINAL LIGHT MODE TEXT FIX
   DARK MODE — NO CHANGE
========================================= */

body:not(.dark-mode) {
    color: #172033 !important;
}

/* ALL MAIN SECTION HEADINGS */
body:not(.dark-mode) .card h2,
body:not(.dark-mode) .chat-card h2,
body:not(.dark-mode) .quiz-card h2,
body:not(.dark-mode) .dashboard-card h2 {
    color: #172033 !important;
}

/* ALL PARAGRAPHS */
body:not(.dark-mode) .card p,
body:not(.dark-mode) .chat-card p,
body:not(.dark-mode) .quiz-card p,
body:not(.dark-mode) .dashboard-card p {
    color: #475569 !important;
}

/* INPUT + TEXTAREA */
body:not(.dark-mode) input,
body:not(.dark-mode) textarea {
    color: #172033 !important;
    background: #ffffff !important;
}

body:not(.dark-mode) input::placeholder,
body:not(.dark-mode) textarea::placeholder {
    color: #64748b !important;
}

/* DASHBOARD TEXT */
body:not(.dark-mode) .dashboard-card h3 {
    color: #172033 !important;
}

body:not(.dark-mode) .dashboard-card p {
    color: #475569 !important;
}

/* STUDY PLAN RESULT */
body:not(.dark-mode) .plan-result h2 {
    color: #172033 !important;
}

body:not(.dark-mode) .plan-result pre {
    color: #1e293b !important;
}

/* QUIZ RESULT */
body:not(.dark-mode) .quiz-result,
body:not(.dark-mode) .quiz-question {
    color: #172033 !important;
}

/* FLASHCARDS */
body:not(.dark-mode) #flashcardResult {
    color: #172033 !important;
}

body:not(.dark-mode) #flashcardResult h3 {
    color: #172033 !important;
}
/* =========================================
   LIGHT MODE — HEADING FINAL
========================================= */

/* StudyMate AI logo heading */
body:not(.dark-mode) .brand-text h1 {
    color: #0f172a !important;
}

/* All section headings — same as Ask AI */
body:not(.dark-mode) .card h2,
body:not(.dark-mode) .chat-card h2,
body:not(.dark-mode) .quiz-card h2,
body:not(.dark-mode) .dashboard-card h2 {
    color: #0f172a !important;
    background: transparent !important;
}

/* Remove accidental test yellow/red styling */
body:not(.dark-mode) .app > .card:first-of-type h2 {
    color: #0f172a !important;
    background: transparent !important;
}

/* Result headings */
body:not(.dark-mode) .plan-result h2 {
    color: #0f172a !important;
    background: transparent !important;
}
/* =========================================
   LIGHT MODE — DASHBOARD FINAL FIX
========================================= */

/* Dashboard stat cards */
body:not(.dark-mode) .dashboard-card .stat-box {
    background: #ffffff !important;
    border: 1px solid #dbe4f0 !important;
    color: #0f172a !important;
}

/* Numbers */
body:not(.dark-mode) .dashboard-card .stat-box h3 {
    color: #0f172a !important;
}

/* Labels */
body:not(.dark-mode) .dashboard-card .stat-box p {
    color: #475569 !important;
}

/* Stat icons */
body:not(.dark-mode) .dashboard-card .stat-icon {
    color: initial !important;
}

/* Overall Progress box */
body:not(.dark-mode) .dashboard-card .progress-area {
    background: #ffffff !important;
    border: 1px solid #dbe4f0 !important;
    color: #0f172a !important;
}

/* Overall Progress heading */
body:not(.dark-mode) .dashboard-card .progress-area h3 {
    color: #0f172a !important;
}

/* Progress percentage */
body:not(.dark-mode) .dashboard-card #progressText {
    color: #4f46e5 !important;
}

/* Progress track */
body:not(.dark-mode) .dashboard-card .progress-bar {
    background: #e2e8f0 !important;
}

/* Study Streak */
body:not(.dark-mode) .dashboard-card .streak-box {
    background: #ffffff !important;
    border: 1px solid #dbe4f0 !important;
    color: #0f172a !important;
}

/* Streak number */
body:not(.dark-mode) .dashboard-card .streak-box h3 {
    color: #0f172a !important;
}

/* Streak description */
body:not(.dark-mode) .dashboard-card .streak-box p {
    color: #475569 !important;
}
/* =========================================
   PREMIUM INTERACTIVE QUIZ
   Only Quiz UI — other sections untouched
========================================= */

.quiz-question {
    position: relative;
    background: #0f172a;
    border: 1px solid #334155;
    padding: 24px;
    border-radius: 18px;
    overflow: hidden;
}

.quiz-question::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(
        90deg,
        #4f46e5,
        #7c3aed,
        #a855f7
    );
}

.quiz-question h3 {
    color: #a78bfa;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.quiz-question h2 {
    color: #ffffff;
    font-size: 20px;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* OPTIONS */

.options {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.options button {
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    border: 1px solid #334155;
    border-radius: 12px;
    background: #1e293b;
    color: #e2e8f0;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition:
        transform 0.2s ease,
        background 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.options button:hover:not(:disabled) {
    transform: translateX(4px);
    background: #312e81;
    border-color: #6366f1;
    box-shadow: 0 5px 15px rgba(79, 70, 229, 0.18);
}

.options button:disabled {
    cursor: default;
}

/* SELECTED / CORRECT / WRONG */

.options button.selected {
    border-color: #818cf8;
    background: #312e81;
}

.options button.correct {
    background: #064e3b;
    border-color: #10b981;
    color: #d1fae5;
}

.options button.wrong {
    background: #4c0519;
    border-color: #f43f5e;
    color: #ffe4e6;
}

/* ANSWER FEEDBACK */

.answer-feedback {
    margin-top: 16px;
    padding: 13px 15px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
}

.answer-feedback.correct {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #6ee7b7;
}

.answer-feedback.wrong {
    background: rgba(244, 63, 94, 0.12);
    border: 1px solid rgba(244, 63, 94, 0.35);
    color: #fda4af;
}

/* NEXT BUTTON */

.next-question-btn {
    margin-top: 16px;
    width: 100%;
    padding: 13px 18px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(
        135deg,
        #4f46e5,
        #7c3aed
    );
    color: white;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.next-question-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(79, 70, 229, 0.3);
}

/* QUIZ SCORE */

.quiz-score {
    padding: 28px 22px;
    background: linear-gradient(
        135deg,
        #17133b,
        #1e1b4b
    );
    border: 1px solid #4338ca;
    border-radius: 18px;
    text-align: center;
}

.quiz-score h2 {
    color: #ffffff;
    margin-bottom: 10px;
}

.quiz-score h1 {
    color: #a78bfa;
    font-size: 32px;
    margin: 8px 0;
}

.quiz-score p {
    color: #cbd5e1;
    line-height: 1.6;
}

/* LIGHT MODE */

body:not(.dark-mode) .quiz-question {
    background: #ffffff;
    border-color: #dbe4f0;
}

body:not(.dark-mode) .quiz-question h3 {
    color: #4f46e5;
}

body:not(.dark-mode) .quiz-question h2 {
    color: #0f172a;
}

body:not(.dark-mode) .options button {
    background: #f8fafc;
    border-color: #dbe4f0;
    color: #172033;
}

body:not(.dark-mode) .options button:hover:not(:disabled) {
    background: #eef2ff;
    border-color: #6366f1;
}

body:not(.dark-mode) .options button.selected {
    background: #eef2ff;
    border-color: #6366f1;
}

body:not(.dark-mode) .options button.correct {
    background: #ecfdf5;
    border-color: #10b981;
    color: #047857;
}

body:not(.dark-mode) .options button.wrong {
    background: #fff1f2;
    border-color: #f43f5e;
    color: #be123c;
}

body:not(.dark-mode) .quiz-score {
    background: #ffffff;
    border-color: #c7d2fe;
}

body:not(.dark-mode) .quiz-score h2 {
    color: #0f172a;
}

body:not(.dark-mode) .quiz-score h1 {
    color: #4f46e5;
}

body:not(.dark-mode) .quiz-score p {
    color: #475569;
}

/* MOBILE */

@media (max-width: 600px) {

    .quiz-question {
        padding: 20px;
    }

    .quiz-question h2 {
        font-size: 18px;
    }

    .options button {
        padding: 13px 14px;
        font-size: 14px;
    }

    .quiz-score {
        padding: 24px 18px;
    }

    .quiz-score h1 {
        font-size: 28px;
    }
}
/* =========================================
   AI NOTES GENERATOR
========================================= */

.notes-card {
    position: relative;
}

.notes-result {
    margin-top: 24px;
    padding: 24px;
    border-radius: 18px;
    background: linear-gradient(
        145deg,
        rgba(15, 23, 42, 0.96),
        rgba(30, 41, 59, 0.92)
    );
    border: 1px solid rgba(129, 140, 248, 0.22);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.18);
}

.notes-header {
    margin-bottom: 20px;
}

.notes-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 10px;
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
}

.notes-header h2 {
    margin: 0;
    color: #ffffff;
}

.notes-overview,
.notes-section {
    margin-top: 20px;
    padding: 18px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.notes-overview h3,
.notes-section h3 {
    margin-top: 0;
    color: #c7d2fe;
}

.notes-overview p {
    margin-bottom: 0;
    line-height: 1.7;
    color: #dbe4f0;
    overflow-wrap: anywhere;
}

.notes-list {
    display: grid;
    gap: 10px;
}

.note-point {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.08);
}

.note-point span {
    font-weight: 800;
    color: #a5b4fc;
    flex-shrink: 0;
}

.note-point p {
    margin: 0;
    color: #dbe4f0;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.concept-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.concept-card {
    padding: 16px;
    border-radius: 12px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(96, 165, 250, 0.12);
}

.concept-card h4 {
    margin-top: 0;
    color: #ffffff;
}

.concept-card p {
    margin-bottom: 0;
    line-height: 1.6;
    color: #cbd5e1;
    overflow-wrap: anywhere;
}

.quick-revision {
    margin-bottom: 0;
}

.revision-list {
    display: grid;
    gap: 10px;
}

.revision-item {
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(139, 92, 246, 0.08);
    color: #e2e8f0;
    line-height: 1.6;
    overflow-wrap: anywhere;
}


/* =========================================
   LIGHT MODE
========================================= */

body:not(.dark-mode) .notes-result {
    background: #ffffff !important;
    border: 1px solid #dbe4f0 !important;
}

body:not(.dark-mode) .notes-header h2 {
    color: #0f172a !important;
}

body:not(.dark-mode) .notes-overview,
body:not(.dark-mode) .notes-section {
    background: #f8fafc !important;
    border: 1px solid #dbe4f0 !important;
}

body:not(.dark-mode) .notes-overview h3,
body:not(.dark-mode) .notes-section h3 {
    color: #334155 !important;
}

body:not(.dark-mode) .notes-overview p,
body:not(.dark-mode) .note-point p,
body:not(.dark-mode) .concept-card p,
body:not(.dark-mode) .revision-item {
    color: #475569 !important;
}

body:not(.dark-mode) .note-point {
    background: #eef2ff !important;
}

body:not(.dark-mode) .note-point span {
    color: #4f46e5 !important;
}

body:not(.dark-mode) .concept-card {
    background: #eff6ff !important;
}

body:not(.dark-mode) .concept-card h4 {
    color: #0f172a !important;
}

body:not(.dark-mode) .revision-item {
    background: #f5f3ff !important;
}


/* =========================================
   MOBILE
========================================= */

@media (max-width: 700px) {

    .notes-result {
        padding: 16px;
    }

    .concept-grid {
        grid-template-columns: 1fr;
    }

    .notes-overview,
    .notes-section {
        padding: 15px;
    }
}
/* ============================================================
   STUDYMATE AI - FINAL SINGLE APP UI
   ============================================================ */

body {
    padding: 20px;
}

.app {
    width: 100%;
    max-width: 1250px;
    margin: 0 auto;
}

/* Hide legacy page pieces if they exist */
.app > header,
.app > footer {
    display: none !important;
}

.sm-shell {
    width: 100%;
    min-height: calc(100vh - 40px);
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.sm-sidebar {
    position: sticky;
    top: 20px;
    padding: 18px 14px;
    border-radius: 22px;
    background: linear-gradient(180deg, #111827, #0b1220);
    border: 1px solid rgba(148, 163, 184, .15);
    box-shadow: 0 20px 50px rgba(0, 0, 0, .28);
    backdrop-filter: blur(18px);
}

.sm-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 8px 18px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(148, 163, 184, .12);
}

.sm-cap {
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    font-size: 23px;
    box-shadow: 0 10px 25px rgba(99, 102, 241, .25);
}

.sm-brand strong {
    display: block;
    color: #fff;
    font-size: 17px;
}

.sm-brand span {
    display: block;
    margin-top: 2px;
    color: #a5b4fc;
    font-size: 11px;
    letter-spacing: 1.5px;
    font-weight: 700;
}

.sm-nav {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.sm-nav-button {
    width: 100%;
    min-height: 50px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    border: 1px solid transparent;
    border-radius: 13px;
    background: transparent;
    color: #cbd5e1;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: .2s ease;
}

.sm-nav-button:hover {
    transform: translateX(3px);
    background: rgba(99, 102, 241, .12);
    color: #fff;
}

.sm-nav-button.sm-nav-active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 10px 28px rgba(99, 102, 241, .24);
}

.sm-nav-icon {
    width: 24px;
    min-width: 24px;
    text-align: center;
    font-size: 18px;
}

.sm-theme-wrap {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(148, 163, 184, .12);
}

.sm-theme-wrap button {
    width: 100%;
}

.sm-content {
    min-width: 0;
    width: 100%;
}

.sm-panel {
    display: none !important;
    width: 100%;
}

.sm-panel.sm-panel-active {
    display: block !important;
    animation: smPanelOpen .25s ease;
}

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

.sm-content > .card {
    width: 100%;
    margin-bottom: 0 !important;
}

.notes-actions-final {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid rgba(148, 163, 184, .12);
}

.notes-action-final {
    border: 0;
    border-radius: 11px;
    padding: 11px 15px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: .2s ease;
}

.notes-action-final:hover {
    transform: translateY(-2px);
}

.copy-final,
.regenerate-final,
.pdf-final {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
}

body:not(.dark-mode) .sm-sidebar {
    background: rgba(255, 255, 255, .96);
    border-color: rgba(15, 23, 42, .08);
    box-shadow: 0 20px 50px rgba(15, 23, 42, .10);
}

body:not(.dark-mode) .sm-brand {
    border-bottom-color: rgba(15, 23, 42, .08);
}

body:not(.dark-mode) .sm-brand strong {
    color: #111827;
}

body:not(.dark-mode) .sm-brand span {
    color: #6366f1;
}

body:not(.dark-mode) .sm-nav-button {
    color: #475569;
}

body:not(.dark-mode) .sm-nav-button:hover {
    color: #111827;
    background: rgba(99, 102, 241, .08);
}

@media (max-width: 850px) {
    body { padding: 10px; }

    .app { max-width: 100%; }

    .sm-shell {
        grid-template-columns: 1fr;
        gap: 14px;
        min-height: calc(100vh - 20px);
    }

    .sm-sidebar {
        position: sticky;
        top: 8px;
        padding: 10px;
        border-radius: 18px;
        z-index: 100;
    }

    .sm-brand { display: none; }

    .sm-nav {
        flex-direction: row;
        overflow-x: auto;
        gap: 7px;
    }

    .sm-nav-button {
        width: auto;
        min-width: max-content;
        min-height: 44px;
        padding: 9px 12px;
    }

    .sm-nav-button:hover { transform: none; }

    .sm-theme-wrap {
        display: none;
    }
}

@media (max-width: 520px) {
    .sm-nav-button { font-size: 12px; }
    .sm-nav-icon { font-size: 16px; }
    .notes-actions-final { flex-direction: column; }
    .notes-action-final { width: 100%; }
}
