/* =====================================================================
   TUTEURIA — Design System
   Inspiration: French school stationery — ink, chalk, highlighter,
   the red-pen correction mark, the "graded paper" score stamp.
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700;9..144,900&family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
    /* --- Color tokens --- */
    --ink:        #23246B;   /* deep fountain-pen indigo */
    --ink-soft:   #4A4D9E;
    --paper:      #F7F7FB;   /* crisp cool paper white   */
    --paper-alt:  #FFFFFF;
    --highlighter:#FFD93D;   /* highlighter yellow       */
    --correct:    #00C896;   /* mint green - correct/success */
    --correction: #FF5A5F;   /* red pen - errors/urgent  */
    --violet:     #7C4DFF;   /* electric violet - AI accent */
    --sky:        #3AB0FF;
    --ink-10:     rgba(35,36,107,0.06);
    --ink-20:     rgba(35,36,107,0.12);
    --text-main:  #1D1E3F;
    --text-mute:  #63658C;
    --border:     #E4E4F2;

    /* --- Type --- */
    --font-display: 'Fraunces', serif;
    --font-body: 'Space Grotesk', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;

    /* --- Radii / shadow --- */
    --r-sm: 10px;
    --r-md: 16px;
    --r-lg: 26px;
    --shadow-card: 0 4px 24px rgba(35,36,107,0.08);
    --shadow-pop: 0 12px 40px rgba(35,36,107,0.16);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--paper);
    color: var(--text-main);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 {
    font-family: var(--font-display);
    color: var(--ink);
    margin: 0 0 0.5em;
    line-height: 1.12;
}
p { margin: 0 0 1em; color: var(--text-mute); }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* =========================== BUTTONS =========================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--font-body); font-weight: 600; font-size: 15px;
    padding: 13px 26px; border-radius: 999px; border: 2px solid transparent;
    cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
    text-align: center;
}
.btn:active { transform: translateY(1px) scale(0.98); }
.btn-primary { background: var(--ink); color: #fff; box-shadow: 0 6px 0 #14154A; }
.btn-primary:hover { background: var(--ink-soft); }
.btn-primary:active { box-shadow: 0 2px 0 #14154A; transform: translateY(4px); }
.btn-accent { background: var(--highlighter); color: var(--ink); box-shadow: 0 6px 0 #CFA400; }
.btn-accent:hover { filter: brightness(1.04); }
.btn-accent:active { box-shadow: 0 2px 0 #CFA400; transform: translateY(4px); }
.btn-outline { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn-outline:hover { background: var(--ink); color: #fff; }
.btn-danger { background: var(--correction); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 9px 18px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* =========================== NAVBAR (public) =========================== */
.navbar {
    position: sticky; top: 0; z-index: 100;
    background: rgba(247,247,251,0.88); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.navbar-inner { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; max-width: 1180px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 22px; color: var(--ink); }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: var(--ink); color: var(--highlighter); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; font-size: 18px; transform: rotate(-6deg); }
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-links a { font-weight: 500; color: var(--text-main); font-size: 15px; }
.nav-links a:hover { color: var(--violet); }
.nav-cta { display: flex; gap: 12px; align-items: center; }

/* =========================== HERO =========================== */
.hero { padding: 84px 24px 60px; position: relative; overflow: hidden; }
.hero-grid { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 56px; align-items: center; }
.eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--ink-10); color: var(--ink); font-weight: 600; font-size: 13px;
    padding: 7px 16px; border-radius: 999px; margin-bottom: 20px;
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--correct); }
.hero h1 { font-size: 52px; font-weight: 700; letter-spacing: -0.5px; }
.hero h1 .hl { position: relative; white-space: nowrap; }
.hero h1 .hl::after {
    content: ''; position: absolute; left: -2px; right: -2px; bottom: 4px; height: 14px;
    background: var(--highlighter); z-index: -1; transform: rotate(-1deg);
}
.hero-lead { font-size: 18px; max-width: 480px; }
.hero-actions { display: flex; gap: 14px; margin-top: 28px; flex-wrap: wrap; }
.hero-trust { margin-top: 30px; display: flex; gap: 22px; flex-wrap: wrap; font-size: 13px; color: var(--text-mute); font-weight: 500; }
.hero-trust span { display: flex; align-items: center; gap: 6px; }

/* Signature element: graded exam paper card */
.paper-card {
    background: var(--paper-alt); border-radius: var(--r-lg); box-shadow: var(--shadow-pop);
    padding: 26px 26px 22px; position: relative; transform: rotate(2deg);
    border: 1px solid var(--border);
}
.paper-card::before {
    content: ''; position: absolute; inset: 10px; border: 1px dashed var(--border); border-radius: calc(var(--r-lg) - 10px); pointer-events: none;
}
.paper-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.paper-head .subj { font-family: var(--font-mono); font-size: 12px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 1px; }
.paper-head .timer { font-family: var(--font-mono); background: var(--ink); color: var(--highlighter); padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 14px; }
.paper-q { font-weight: 600; font-size: 15px; color: var(--text-main); margin-bottom: 14px; }
.paper-opt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--border); margin-bottom: 8px; font-size: 14px; }
.paper-opt.is-correct { border-color: var(--correct); background: rgba(0,200,150,0.08); }
.paper-opt .mark { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); flex-shrink: 0; display:flex; align-items:center; justify-content:center; font-size:12px; }
.paper-opt.is-correct .mark { border-color: var(--correct); background: var(--correct); color: #fff; }
.grade-stamp {
    position: absolute; top: -18px; right: -14px; width: 78px; height: 78px; border-radius: 50%;
    background: var(--correction); color: #fff; display: flex; align-items: center; justify-content: center;
    flex-direction: column; font-family: var(--font-mono); font-weight: 700; transform: rotate(12deg);
    box-shadow: 0 8px 20px rgba(255,90,95,0.35); border: 3px solid #fff;
}
.grade-stamp .num { font-size: 20px; line-height: 1; }
.grade-stamp .lbl { font-size: 8px; letter-spacing: 1px; margin-top: 2px; }

/* =========================== SECTIONS =========================== */
.section { padding: 76px 24px; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 48px; }
.section-head h2 { font-size: 36px; }
.section-tag { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 2px; font-size: 12px; color: var(--violet); font-weight: 600; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.feature-card {
    background: var(--paper-alt); border: 1px solid var(--border); border-radius: var(--r-md);
    padding: 26px; transition: transform .18s ease, box-shadow .18s ease;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-card); }
.feature-icon { width: 50px; height: 50px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 24px; margin-bottom: 16px; }
.feature-card h3 { font-size: 18px; margin-bottom: 8px; }
.feature-card p { font-size: 14px; margin: 0; }

/* subject pills */
.subject-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.subject-pill {
    background: var(--paper-alt); border: 1px solid var(--border); border-radius: var(--r-md);
    padding: 20px 14px; text-align: center; transition: all .15s ease; cursor: pointer;
}
.subject-pill:hover { border-color: var(--violet); transform: translateY(-3px); box-shadow: var(--shadow-card); }
.subject-pill .ic { font-size: 30px; margin-bottom: 10px; }
.subject-pill .nm { font-weight: 600; font-size: 14px; color: var(--ink); }

/* steps (how it works) - numbered because it IS a real sequence */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; counter-reset: step; }
.step { position: relative; padding-top: 8px; }
.step::before {
    counter-increment: step; content: counter(step);
    font-family: var(--font-display); font-size: 44px; font-weight: 700; color: var(--ink-20); display: block; margin-bottom: 6px;
}
.step h4 { font-size: 16px; margin-bottom: 6px; }
.step p { font-size: 13.5px; }

/* =========================== PRICING =========================== */
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; align-items: stretch; }
.price-card {
    background: var(--paper-alt); border: 1.5px solid var(--border); border-radius: var(--r-lg);
    padding: 30px 26px; display: flex; flex-direction: column; position: relative;
}
.price-card.featured { border-color: var(--ink); box-shadow: var(--shadow-pop); transform: scale(1.03); }
.price-card .ribbon {
    position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
    background: var(--highlighter); color: var(--ink); font-size: 12px; font-weight: 700;
    padding: 5px 16px; border-radius: 999px; white-space: nowrap;
}
.price-card h3 { font-size: 20px; margin-bottom: 4px; }
.price-amt { font-family: var(--font-display); font-size: 42px; font-weight: 700; color: var(--ink); margin: 10px 0; }
.price-amt span { font-family: var(--font-body); font-size: 15px; color: var(--text-mute); font-weight: 500; }
.price-list { list-style: none; padding: 0; margin: 18px 0 26px; flex-grow: 1; }
.price-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin-bottom: 11px; color: var(--text-main); }
.price-list li .chk { color: var(--correct); font-weight: 700; }

/* =========================== FOOTER =========================== */
.site-footer { background: var(--ink); color: #C7C8EA; padding: 54px 24px 26px; margin-top: 40px; }
.footer-grid { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }
.site-footer h4 { color: #fff; font-family: var(--font-body); font-size: 14px; margin-bottom: 14px; }
.site-footer a { color: #C7C8EA; font-size: 13.5px; display: block; margin-bottom: 9px; }
.site-footer a:hover { color: var(--highlighter); }
.footer-bottom { max-width: 1180px; margin: 34px auto 0; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.12); font-size: 12.5px; display: flex; justify-content: space-between; color: #9A9BC4; flex-wrap: wrap; gap: 10px;}

/* =====================================================================
   APP SHELL (dashboard + admin)
   ===================================================================== */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 250px; flex-shrink: 0; background: var(--ink); color: #fff;
    display: flex; flex-direction: column; padding: 22px 16px; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { color: #fff; margin-bottom: 26px; padding: 0 6px; }
.sidebar .brand .brand-mark { background: var(--highlighter); color: var(--ink); }
.side-nav { display: flex; flex-direction: column; gap: 3px; flex-grow: 1; }
.side-nav a {
    display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px;
    font-size: 14.5px; font-weight: 500; color: #C7C8EA; transition: all .15s ease;
}
.side-nav a .ic { font-size: 17px; width: 20px; text-align: center; }
.side-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.side-nav a.active { background: var(--highlighter); color: var(--ink); font-weight: 700; }
.side-nav .divider { height: 1px; background: rgba(255,255,255,0.12); margin: 12px 6px; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,0.12); padding-top: 14px; margin-top: 10px; }
.plan-badge { display: inline-block; font-family: var(--font-mono); font-size: 11px; background: rgba(255,255,255,0.1); color: var(--highlighter); padding: 4px 10px; border-radius: 999px; margin-bottom: 10px; }

.main-content { flex-grow: 1; background: var(--paper); min-height: 100vh; }
.topbar {
    display: flex; align-items: center; justify-content: space-between; padding: 18px 30px;
    background: var(--paper-alt); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 22px; margin: 0; }
.page-body { padding: 30px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--violet); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }

/* Cards / stats used inside dashboard */
.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.card { background: var(--paper-alt); border: 1px solid var(--border); border-radius: var(--r-md); padding: 22px; }
.stat-card .stat-label { font-size: 12.5px; color: var(--text-mute); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat-card .stat-value { font-family: var(--font-display); font-size: 32px; color: var(--ink); margin-top: 6px; }
.stat-card .stat-sub { font-size: 12.5px; color: var(--correct); font-weight: 600; margin-top: 4px; }

/* forms */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13.5px; font-weight: 600; color: var(--text-main); margin-bottom: 7px; }
.form-control {
    width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: var(--r-sm);
    font-family: var(--font-body); font-size: 14.5px; background: var(--paper-alt); color: var(--text-main);
    transition: border-color .15s ease;
}
.form-control:focus { border-color: var(--violet); outline: none; }
textarea.form-control { resize: vertical; min-height: 110px; }
select.form-control { cursor: pointer; }
.form-hint { font-size: 12.5px; color: var(--text-mute); margin-top: 5px; }
.form-error { background: rgba(255,90,95,0.09); border: 1px solid rgba(255,90,95,0.3); color: #C8353A; padding: 12px 16px; border-radius: var(--r-sm); font-size: 13.5px; margin-bottom: 18px; }
.form-success { background: rgba(0,200,150,0.09); border: 1px solid rgba(0,200,150,0.3); color: #078D6C; padding: 12px 16px; border-radius: var(--r-sm); font-size: 13.5px; margin-bottom: 18px; }

/* auth pages */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--paper); padding: 24px; }
.auth-card { width: 100%; max-width: 420px; background: var(--paper-alt); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 38px 34px; box-shadow: var(--shadow-card); }
.auth-card .brand { justify-content: center; margin-bottom: 22px; }
.auth-card h2 { text-align: center; font-size: 24px; }
.auth-sub { text-align: center; font-size: 14px; margin-bottom: 26px; }
.auth-switch { text-align: center; font-size: 13.5px; margin-top: 18px; }
.auth-switch a { color: var(--violet); font-weight: 600; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; font-family: var(--font-mono); }
.badge-free { background: var(--ink-10); color: var(--ink); }
.badge-basic { background: rgba(58,176,255,0.12); color: #0D7FCC; }
.badge-premium { background: rgba(255,217,61,0.25); color: #8A6D00; }
.badge-success { background: rgba(0,200,150,0.12); color: #078D6C; }
.badge-danger { background: rgba(255,90,95,0.12); color: #C8353A; }

/* quiz / exam interface */
.quiz-timer {
    font-family: var(--font-mono); font-weight: 700; font-size: 20px; background: var(--ink); color: var(--highlighter);
    padding: 10px 20px; border-radius: 12px; display: inline-flex; align-items: center; gap: 8px;
}
.quiz-timer.low-time { background: var(--correction); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .6; } }
.quiz-progress { height: 8px; background: var(--ink-10); border-radius: 999px; overflow: hidden; margin: 18px 0; }
.quiz-progress-bar { height: 100%; background: var(--violet); border-radius: 999px; transition: width .3s ease; }
.quiz-option-btn {
    display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 16px 18px;
    border: 1.5px solid var(--border); border-radius: var(--r-md); background: var(--paper-alt); cursor: pointer;
    font-family: var(--font-body); font-size: 15px; margin-bottom: 12px; transition: all .12s ease;
}
.quiz-option-btn:hover { border-color: var(--violet); }
.quiz-option-btn.selected { border-color: var(--violet); background: rgba(124,77,255,0.06); }
.quiz-option-btn.correct { border-color: var(--correct); background: rgba(0,200,150,0.08); }
.quiz-option-btn.incorrect { border-color: var(--correction); background: rgba(255,90,95,0.08); }
.opt-letter { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--border); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; font-family: var(--font-mono); }
.quiz-option-btn.selected .opt-letter { background: var(--violet); border-color: var(--violet); color: #fff; }
.quiz-option-btn.correct .opt-letter { background: var(--correct); border-color: var(--correct); color: #fff; }
.quiz-option-btn.incorrect .opt-letter { background: var(--correction); border-color: var(--correction); color: #fff; }

/* chat tutor */
.chat-window { display: flex; flex-direction: column; gap: 16px; height: calc(100vh - 240px); overflow-y: auto; padding: 6px; }
.msg { max-width: 72%; padding: 13px 17px; border-radius: 16px; font-size: 14.5px; line-height: 1.5; }
.msg-user { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.msg-ai { align-self: flex-start; background: var(--paper-alt); border: 1px solid var(--border); border-bottom-left-radius: 4px; white-space: pre-wrap; }
.chat-input-bar { display: flex; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.typing-dots span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--text-mute); margin-right: 3px; animation: bounce 1.2s infinite; }
.typing-dots span:nth-child(2) { animation-delay: .15s; } .typing-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }

/* upload dropzone (homework / camera solver) */
.dropzone {
    border: 2px dashed var(--border); border-radius: var(--r-lg); padding: 42px 24px; text-align: center;
    background: var(--paper-alt); cursor: pointer; transition: all .15s ease;
}
.dropzone:hover, .dropzone.drag-over { border-color: var(--violet); background: rgba(124,77,255,0.04); }
.dropzone .dz-icon { font-size: 40px; margin-bottom: 12px; }

/* tables (admin) */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th { text-align: left; padding: 12px 14px; background: var(--ink-10); color: var(--ink); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text-main); }
.data-table tr:hover td { background: rgba(124,77,255,0.03); }

/* misc */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-mute); }
.empty-state .em-icon { font-size: 44px; margin-bottom: 14px; }

/* =========================== RESPONSIVE =========================== */
@media (max-width: 980px) {
    .hero-grid { grid-template-columns: 1fr; }
    .feature-grid, .steps, .pricing-grid, .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .subject-grid { grid-template-columns: repeat(3, 1fr); }
    .footer-grid { grid-template-columns: repeat(2, 1fr); }
    .price-card.featured { transform: none; }
}
@media (max-width: 720px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; overflow-x: auto; align-items: center; }
    .sidebar .brand { display: none; }
    .side-nav { flex-direction: row; }
    .sidebar-foot { display: none; }
    .hero h1 { font-size: 36px; }
    .feature-grid, .steps, .pricing-grid, .subject-grid, .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr 1fr; }
    .nav-links { display: none; }
}
