/* =========================================================
   LMS — Student Theme
   Palette: ink #12213A, deep teal #0F5E56, paper #F6F4EE,
            amber accent #E4A421, coral #D65F4C, line #DAD4C4
   Type: 'Fraunces' (display) + 'Inter' (body/UI)
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,700&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --ink: #12213A;
    --teal: #0F5E56;
    --teal-dark: #0A423C;
    --paper: #F6F4EE;
    --paper-2: #EFEBE0;
    --amber: #E4A421;
    --coral: #D65F4C;
    --line: #DAD4C4;
    --white: #FFFFFF;
    --gray: #6B6E76;
    --radius: 10px;
    --shadow: 0 4px 16px rgba(18,33,58,0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Inter', sans-serif;
    background: var(--paper);
    color: var(--ink);
    line-height: 1.55;
}
h1, h2, h3, h4 { font-family: 'Fraunces', serif; font-weight: 700; margin: 0 0 .4em; letter-spacing: -0.01em; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

.container { max-width: 1140px; margin: 0 auto; padding: 0 24px; }

/* ---------- Top nav ---------- */
.navbar {
    background: var(--ink);
    color: var(--white);
    padding: 14px 0;
}
.navbar .container { display: flex; align-items: center; justify-content: space-between; }
.brand { font-family: 'Fraunces', serif; font-size: 1.4rem; font-weight: 700; color: var(--white); display:flex; align-items:center; gap:8px; }
.brand span { color: var(--amber); }
.navlinks { display: flex; gap: 22px; align-items: center; }
.navlinks a { color: #DCE2E8; font-weight: 500; font-size: .95rem; }
.navlinks a:hover { color: var(--amber); text-decoration: none; }
.navlinks .btn { margin-left: 6px; }
.nav-toggle { display: none; background: transparent; border: none; color: var(--white); font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 4px 6px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: .92rem;
    border: none;
    cursor: pointer;
    text-align: center;
}
.btn-primary { background: var(--teal); color: var(--white); }
.btn-primary:hover { background: var(--teal-dark); text-decoration: none; }
.btn-amber { background: var(--amber); color: var(--ink); }
.btn-amber:hover { background: #cf9214; text-decoration:none; }
.btn-outline { background: transparent; border: 1.5px solid var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--teal); color: var(--teal); text-decoration:none; }
.btn-danger { background: var(--coral); color: var(--white); }
.btn-sm { padding: 6px 14px; font-size: .82rem; }
.btn-block { width: 100%; }

/* ---------- Hero ---------- */
.hero {
    background: linear-gradient(160deg, var(--ink) 0%, var(--teal-dark) 100%);
    color: var(--white);
    padding: 70px 0 90px;
}
.hero h1 { font-size: 2.6rem; max-width: 640px; color: var(--white); }
.hero p { font-size: 1.1rem; color: #C9D3D6; max-width: 560px; }
.hero .eyebrow { color: var(--amber); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: .78rem; }

/* ---------- Cards ---------- */
.card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
}
.grid { display: grid; gap: 22px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.item-card { display:flex; flex-direction:column; gap:10px; }
.item-card .thumb { width:100%; height:150px; background:var(--paper-2); border-radius:8px; object-fit:cover; display:flex; align-items:center; justify-content:center; color:var(--gray); font-size:2rem;}
.item-card h3 { font-size: 1.1rem; margin-bottom: 2px; }
.item-card .meta { font-size: .82rem; color: var(--gray); }
.item-card p.desc { font-size: .92rem; color: #3d4250; flex-grow:1; }

/* ---------- Badges ---------- */
.badge { display:inline-block; padding: 3px 11px; border-radius: 20px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;}
.badge-free { background:#E6E6E0; color:#555; }
.badge-gold { background:#FBEACB; color:#8A5B00; }
.badge-premium { background:#E8D9F3; color:#5B2C86; }
.badge-locked { background:#FBE1DC; color:#A2372A; }

/* ---------- Forms ---------- */
.form-box { max-width: 440px; margin: 60px auto; }
.form-group { margin-bottom: 16px; }
label { display:block; font-weight:600; font-size:.88rem; margin-bottom:6px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], select, textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    font-size: .95rem;
    font-family: inherit;
    background: var(--white);
    color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal); }
textarea { resize: vertical; min-height: 90px; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: .92rem; }
.alert-success { background: #DFF3E4; color: #1D6B34; border:1px solid #B7E2C1;}
.alert-error { background: #FBE1DC; color: #A2372A; border:1px solid #F1BBAE; }
.alert-info { background: #E4EEF6; color: #1E5A85; border:1px solid #BFDCEF; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius); overflow:hidden; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: .9rem; }
th { background: var(--paper-2); font-weight: 700; text-transform: uppercase; font-size: .74rem; letter-spacing: .04em; color: var(--gray); }
tr:last-child td { border-bottom: none; }

/* ---------- Section headers ---------- */
.section-head { display:flex; align-items:center; justify-content:space-between; margin: 40px 0 18px; }
.section-head h2 { margin:0; font-size: 1.5rem; }

/* ---------- Sidebar layout (dashboard) ---------- */
.layout { display:flex; min-height: calc(100vh - 64px); }
.sidebar { width: 230px; background: var(--ink); color:#D9DEE3; padding: 24px 0; flex-shrink:0; }
.sidebar a { display:block; padding: 11px 26px; color:#C7CEDA; font-size:.92rem; font-weight:500; border-left:3px solid transparent; }
.sidebar a:hover, .sidebar a.active { background: rgba(255,255,255,.06); color: var(--white); border-left-color: var(--amber); text-decoration:none; }
.sidebar .side-title { padding: 0 26px 12px; text-transform:uppercase; font-size:.7rem; letter-spacing:.08em; color:#8993A4; margin-top:16px;}
.main-content { flex-grow:1; padding: 30px; }

/* ---------- Plan pricing cards ---------- */
.plan-card { text-align:center; position:relative; border-top: 5px solid var(--line); }
.plan-card.gold { border-top-color: var(--amber); }
.plan-card.premium { border-top-color: #7C42B0; }
.plan-card .price { font-family:'Fraunces',serif; font-size: 2.2rem; font-weight:700; margin: 10px 0; }
.plan-card .price span { font-size: .95rem; font-weight:400; color: var(--gray); }
.plan-card ul { list-style:none; padding:0; text-align:left; margin: 18px 0; }
.plan-card li { padding: 6px 0; font-size:.9rem; }
.plan-card li::before { content:"✓ "; color: var(--teal); font-weight:700; }
.toggle-wrap { display:flex; justify-content:center; gap:10px; align-items:center; margin: 20px 0; }

/* ---------- Stat cards (admin) ---------- */
.stat-card { text-align:center; padding: 24px; }
.stat-card .num { font-family:'Fraunces',serif; font-size:2rem; font-weight:700; color: var(--teal); }
.stat-card .label { font-size:.82rem; color: var(--gray); text-transform:uppercase; letter-spacing:.04em; }

/* ---------- Quiz ---------- */
.quiz-question { margin-bottom: 26px; padding-bottom:22px; border-bottom: 1px solid var(--line); }
.quiz-question h4 { font-size: 1rem; }
.option-label { display:block; padding: 10px 14px; border:1.5px solid var(--line); border-radius:8px; margin-bottom:8px; cursor:pointer; font-size:.92rem; }
.option-label:hover { border-color: var(--teal); }
.option-label input { margin-right: 10px; }
.timer-box { background: var(--ink); color:var(--white); padding: 10px 18px; border-radius:8px; font-weight:700; font-family:'Fraunces',serif; font-size:1.2rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color:#9AA3B0; padding: 26px 0; text-align:center; font-size:.85rem; margin-top: 60px; }

.locked-overlay { position:relative; }
.locked-overlay::after { content: "🔒 Upgrade to unlock"; position:absolute; inset:0; background:rgba(18,33,58,.82); color:white; display:flex; align-items:center; justify-content:center; font-weight:600; border-radius: var(--radius); font-size:.85rem; text-align:center; padding: 10px; }

.text-muted { color: var(--gray); }
.mt-0{margin-top:0} .mb-0{margin-bottom:0}

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

/* ---------- Tablets & below ---------- */
@media (max-width: 900px) {
    .grid-3, .grid-2 { grid-template-columns: 1fr; }

    /* Sidebar becomes a horizontal scrollable strip above content
       instead of a fixed left column — works for both admin and
       student layouts since they share .layout/.sidebar/.main-content */
    .layout { flex-direction: column; min-height: auto; }
    .sidebar {
        width: 100%;
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 10px 10px;
        gap: 4px;
        scrollbar-width: thin;
    }
    .sidebar .side-title { display: none; }
    .sidebar a {
        white-space: nowrap;
        padding: 9px 16px;
        border-left: none;
        border-radius: 20px;
        flex-shrink: 0;
    }
    .sidebar a:hover, .sidebar a.active {
        border-left: none;
        background: var(--amber);
        color: var(--ink);
    }
    .main-content { padding: 20px; }
}

/* ---------- Phones ---------- */
@media (max-width: 640px) {
    .container { padding: 0 16px; }

    /* Collapsible top nav */
    .navbar { position: relative; }
    .navbar .container { flex-wrap: wrap; }
    .nav-toggle { display: block; }
    .navlinks {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid rgba(255,255,255,.12);
    }
    .navlinks.open { display: flex; }
    .navlinks a, .navlinks span.badge, .navlinks .btn { margin-left: 0; }
    .navlinks a { padding: 8px 4px; }

    /* Hero */
    .hero { padding: 40px 0 50px; }
    .hero h1 { font-size: 1.65rem; max-width: 100%; }
    .hero p { font-size: .98rem; max-width: 100%; }

    /* Section headers */
    .section-head { flex-direction: column; align-items: flex-start; gap: 8px; margin: 28px 0 14px; }
    .section-head h2 { font-size: 1.25rem; }

    /* Cards */
    .card { padding: 16px; }
    .item-card .thumb { height: 120px; }

    /* Admin topbar */
    .admin-topbar { flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px 16px; }
    .main-content { padding: 16px; }

    /* Tables — scroll horizontally instead of squeezing columns */
    table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
    th, td { padding: 10px 12px; }

    /* Forms */
    .form-box { margin: 30px auto; padding: 0 4px; }

    /* Action rows / filters already wrap via flex-wrap, just tighten gap */
    .action-row, .filter-bar { gap: 8px; }

    /* Quiz */
    .timer-box { position: sticky; top: 8px; z-index: 10; display: inline-block; font-size: 1.05rem; padding: 8px 14px; }
    .option-label { padding: 12px 14px; font-size: .95rem; }

    /* Plan cards */
    .plan-card .price { font-size: 1.9rem; }

    /* Stat cards */
    .stat-card { padding: 18px; }
    .stat-card .num { font-size: 1.6rem; }
}
