/* ==========================================================================
   Mocksky design system — "Tech Purple" theme
   ========================================================================== */

/* Self-hosted fonts (replacing the Google Fonts CDN request) -- only the
   latin + bengali unicode subsets are kept, since this site only ever
   renders English and Assamese text (Assamese shares the Bengali Unicode
   block). font-display: swap avoids blocking text render while these load.
   Because these are plain @font-face declarations with no <link rel=preload>,
   browsers only fetch a given file when a character on the page actually
   needs it -- the font stacks below list system fonts first, so English-only
   pages never trigger the Noto Sans Bengali download at all. */
@font-face {
    font-family: 'IBM Plex Mono';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/assets/fonts/ibm-plex-mono-400.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'IBM Plex Mono';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/assets/fonts/ibm-plex-mono-500.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'IBM Plex Mono';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/assets/fonts/ibm-plex-mono-600.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Noto Sans Bengali';
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url('/assets/fonts/noto-sans-bengali-400.woff2') format('woff2');
    unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0, U+1CD2, U+1CD5-1CD6, U+1CD8, U+1CE1, U+1CEA, U+1CED, U+1CF2, U+1CF5-1CF7, U+200C-200D, U+20B9, U+25CC, U+A8F1;
}

:root {
    /* ---- Surfaces ---- */
    --bg-page: #F8F9FA;
    --bg-surface: #FFFFFF;
    --bg-surface-alt: #F1EEFB;

    /* ---- Text ---- */
    --text-heading: #1A1A1A;
    --text-body: #4A5568;
    /* WCAG AA fix: the previous #718096 fell to ~3.5-4:1 against the page's
       lightest surfaces (bg-surface-alt tag chips, bg-page); this clears
       4.5:1 against bg-page/bg-surface/bg-surface-alt alike. */
    --text-muted: #5B6472;

    /* ---- Brand ---- */
    --primary: #5D3EBC;             /* links, icons, interactive borders */
    --primary-solid: #5D3EBC;       /* solid fills (paired with --on-primary) */
    --on-primary: #FFFFFF;

    /* ---- Marketing accent / CTA ---- */
    --accent: #2563EB;              /* primary CTA fill — matches the blue CTA gradient family */
    --accent-alt: #00E5FF;          /* secondary CTA fill */
    --on-accent: #10160A;           /* text placed on --accent-alt (light cyan needs dark text) */

    /* ---- Status ---- */
    --success: #047857;             /* AA-compliant on light backgrounds (~5.5:1 vs white) */
    --on-success: #FFFFFF;
    --warning: #C08A28;
    --on-warning: #1A1A1A;
    --error: #FF0000;               /* foreground use: text/border against page bg */
    --error-solid: #FF0000;         /* fixed fill for solid danger buttons */
    --on-error: #FFFFFF;

    /* ---- Lines & shadow ---- */
    --border: rgba(26, 26, 26, 0.12);
    --border-strong: rgba(93, 62, 188, 0.35);
    --shadow: 0 1px 2px rgba(26, 26, 26, 0.06), 0 8px 24px rgba(26, 26, 26, 0.08);
    --shadow-hover: 0 4px 10px rgba(26, 26, 26, 0.08), 0 16px 32px rgba(93, 62, 188, 0.14);

    /* ---- Type ---- */
    /* 'Noto Sans Bengali' also covers the Assamese-specific letters ৰ and ৱ (same Unicode block) */
    --font-display: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans Bengali', sans-serif;
    --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans Bengali', sans-serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

    --radius: 14px;
    --radius-sm: 10px;
    --radius-lg: 22px;
    --radius-full: 999px;
    --tap: 48px;

    /* ---- Spacing (8px system) ---- */
    --space-1: 8px;
    --space-2: 16px;
    --space-3: 24px;
    --space-4: 32px;
    --space-5: 40px;
    --space-6: 48px;
    --space-8: 64px;
    --space-10: 80px;

    /* ---- Premium accents (built from the existing brand purple) ---- */
    --primary-light: #7657D6;
    --primary-gradient: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-solid) 100%);
    --shadow-sm: 0 1px 2px rgba(26, 26, 26, 0.05);
    --shadow-lg: 0 16px 32px rgba(26, 26, 26, 0.10), 0 28px 56px rgba(93, 62, 188, 0.14);
}

* { box-sizing: border-box; }

html {
    font-size: 106.25%; /* ~17px base — nudges every rem-based size up site-wide */
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg-page);
    color: var(--text-body);
    font-family: var(--font-body);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.2s ease, color 0.2s ease;
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.2;
    margin: 0 0 0.5em;
    color: var(--text-heading);
    text-wrap: balance;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 16px;
}

.container--narrow { max-width: 820px; }
.container--article { max-width: 760px; }

@media (min-width: 640px) {
    .container { padding: 0 20px; }
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---------- Touch & accessibility baseline ---------- */

a, button, input, select, textarea, summary {
    touch-action: manipulation;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

@media (hover: hover) and (pointer: fine) {
    .btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-hover); }
    .card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.95rem;
    min-height: var(--tap);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    touch-action: manipulation;
}

.btn:active { transform: translateY(0); box-shadow: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; pointer-events: none; }

.btn-primary { background: var(--primary-gradient); color: var(--on-primary); box-shadow: 0 4px 14px rgba(93, 62, 188, 0.28); }
.btn-secondary { background: var(--accent-alt); color: var(--on-accent); }
.btn-gold { background: var(--warning); color: var(--on-warning); }
.btn-outline { background: transparent; color: var(--text-heading); border: 1px solid var(--border-strong); }
.btn-danger { background: var(--error-solid); color: var(--on-error); }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-sm { padding: 6px 18px; font-size: 0.85rem; min-height: var(--tap); }
.btn-lg { padding: 15px 32px; font-size: 1.05rem; border-radius: var(--radius); }

@media (hover: hover) and (pointer: fine) {
    .btn-primary:hover { box-shadow: 0 8px 22px rgba(93, 62, 188, 0.34); }
}

/* ---------- Flash messages ---------- */

.flash {
    margin: 20px 0;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-weight: 500;
}

.flash--success { background: var(--bg-surface-alt); border-color: var(--success); color: var(--success); }
.flash--error { background: var(--bg-surface-alt); border-color: var(--error); color: var(--error); }
.flash--info { background: var(--bg-surface-alt); border-color: var(--warning); color: var(--warning); }

/* ---------- Cards ---------- */

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.tag {
    font-size: 0.72rem;
    font-family: var(--font-mono);
    border: 1px solid transparent;
    background: var(--bg-surface-alt);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    display: inline-block;
}
.tag--cap { text-transform: capitalize; }

/* ---------- List card (paper/post rows: PYQ, study materials) ---------- */

.list-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    content-visibility: auto;
    contain-intrinsic-size: 1px 220px;
}

.list-card__meta { min-width: 0; }
.list-card__meta h3, .list-card__meta h4 { margin: 0 0 4px; }
.list-card__desc { margin-bottom: 4px; }
.list-card__filesize { font-size: 0.85rem; }
.list-card .btn { flex: none; }

@media (max-width: 480px) {
    .list-card { flex-direction: column; align-items: stretch; gap: 12px; }
    .list-card .btn { width: 100%; text-align: center; }
}

.auth-wrap {
    max-width: 420px;
    margin: 56px auto;
}

.form-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
}

.form-group { margin-bottom: 18px; }

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--text-heading);
}

.form-control {
    width: 100%;
    min-height: var(--tap);
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 1rem;
    background: var(--bg-surface);
    color: var(--text-heading);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(93, 62, 188, 0.15);
}

.password-field-wrap {
    position: relative;
}

.password-field-wrap .form-control {
    padding-right: 52px;
}

.password-toggle-btn {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 12px;
    min-width: var(--tap);
    min-height: var(--tap);
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle-btn:hover { color: var(--primary); }
.password-toggle-btn svg { width: 20px; height: 20px; }
.password-toggle-btn .icon-eye-off { display: none; }
.password-toggle-btn.is-visible .icon-eye { display: none; }
.password-toggle-btn.is-visible .icon-eye-off { display: block; }

.form-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.form-footer-link { text-align: center; margin-top: 16px; font-size: 0.9rem; }
.form-footer-link--right { text-align: right; margin-top: 6px; }

.auth-logo { display: flex; justify-content: center; margin-bottom: var(--space-2); }
.auth-logo img { width: 44px; height: 44px; object-fit: contain; }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }

table.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-surface);
    font-size: 0.92rem;
}

.data-table th, .data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.data-table th {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-strong);
}

.data-table tr:hover { background: var(--bg-surface-alt); }

.data-table .checkbox-col { width: 36px; }

/* ---------- Stat tiles ---------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.stat-tile {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    min-width: 0;
}

.stat-tile__label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.stat-tile__value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 800;
    margin-top: 4px;
    color: var(--text-heading);
    overflow-wrap: break-word;
}

.stat-tile__value.red { color: var(--error); }
.stat-tile__value.teal { color: var(--success); }
.stat-tile__value.gold { color: var(--warning); }
.stat-tile__value.brand { color: var(--primary); }


.question-panel__meta {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    border-bottom: 1px dashed var(--border);
    padding-bottom: 12px;
}

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

.filter-bar { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; align-items: end; }

.pagination { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-heading);
}
.pagination .current { background: var(--primary-solid); color: var(--on-primary); border-color: var(--primary-solid); }

/* ---------- Utility ---------- */

.mt-0 { margin-top: 0; }
.mt-sm { margin-top: 10px; }
.mt-md { margin-top: var(--space-4); }
.mt-lg { margin-top: var(--space-5); }
.mb-0 { margin-bottom: 0; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--error); }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.form-inline { display: inline; }
.page-py { padding-top: var(--space-5); padding-bottom: var(--space-8); }
.skip-link {
    position: absolute;
    left: 8px;
    top: -60px;
    z-index: 100;
    background: var(--primary-solid);
    color: var(--on-primary);
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    transition: top 0.15s ease;
}
.skip-link:focus { top: 8px; }

.data-table input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary-solid); cursor: pointer; }


@media (max-width: 600px) {
    .card { padding: 18px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .stat-tile { padding: 14px; }
    .stat-tile__value { font-size: 1.45rem; }
    .form-card { padding: 22px; }
    .auth-wrap { margin: 32px auto; }
    .question-panel__meta { flex-wrap: wrap; gap: 6px; }
    .data-table { font-size: 0.85rem; }
    .data-table th, .data-table td { padding: 8px 10px; white-space: nowrap; }
}