/* ====================================================
   NEB Archive — Global Styles & Notes Page Additions
   ==================================================== */

/* ---------- Design System / Variables ---------- */
/* ====================================================
   DESIGN SYSTEM & THEME VARIABLES
   ==================================================== */
:root {
    /* Light Mode (Default) */
    --bg: #FAFAFA;
    --bg-alt: #FFFFFF;
    --text: #1A1A1A;
    --text-muted: #6B7280;
    --accent: #4F46E5;          /* Deep indigo */
    --accent-hover: #4338CA;
    --accent-light: #EEF2FF;
    --border: #E5E7EB;
    --success: #10B981;
    --success-light: #ECFDF5;
    --error: #EF4444;
    --error-light: #FEF2F2;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --card-shadow-hover: 0 12px 28px rgba(0, 0, 0, 0.08), 0 4px 10px rgba(0, 0, 0, 0.04);
    --navbar-bg: rgba(250, 250, 250, 0.85);

    /* Typography */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Spacing & layout */
    --container: 1140px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 20px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Theme */
[data-theme="dark"] {
    --bg: #0F172A;            /* Slate 900 */
    --bg-alt: #1E293B;        /* Slate 800 */
    --text: #F1F5F9;          /* Slate 100 */
    --text-muted: #94A3B8;    /* Slate 400 */
    --accent: #818CF8;        /* Indigo 400 (Brighter for dark mode) */
    --accent-hover: #6366F1;  /* Indigo 500 */
    --accent-light: #312E81;  /* Indigo 900 */
    --border: #334155;        /* Slate 700 */
    --success: #34D399;
    --success-light: #064E3B;
    --error: #F87171;
    --error-light: #7F1D1D;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.2);
    --card-shadow-hover: 0 12px 28px rgba(0, 0, 0, 0.5), 0 4px 10px rgba(0, 0, 0, 0.3);
    --navbar-bg: rgba(15, 23, 42, 0.85);
}

/* ====================================================
   DARK MODE TOGGLE BUTTON STYLES
   ==================================================== */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--transition);
    margin-left: 16px; /* Spacing from nav links */
}

.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-light);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

/* Show sun in light mode, hide moon */
.icon-sun { display: block; }
.icon-moon { display: none; }

/* Show moon in dark mode, hide sun */
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

/* ====================================================
   DARK MODE SPECIFIC TWEAKS
   ==================================================== */

/* Fix tag colors for dark mode (PYQs page) */
[data-theme="dark"] .tag.science { background: #064E3B; color: #34D399; }
[data-theme="dark"] .tag.management { background: #78350F; color: #FBBF24; }
[data-theme="dark"] .tag.humanities { background: #831843; color: #F472B6; }

/* Fix quiz feedback text colors for dark mode */
[data-theme="dark"] .quiz-option.correct { color: #6EE7B7; }
[data-theme="dark"] .quiz-option.incorrect { color: #FCA5A5; }

/* ---------- Reset ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* ---------- Layout Helpers ---------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.section { padding: 96px 0; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; padding: 12px 24px; font-family: inherit;
    font-size: 15px; font-weight: 600; border-radius: var(--radius-sm);
    border: 2px solid transparent; cursor: pointer; transition: all var(--transition); white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(79, 70, 229, 0.25); }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-lg { padding: 16px 36px; font-size: 16px; }

/* ====================================================
   NAVBAR (Shared)
   ==================================================== */
.navbar {
    position: sticky; top: 0; z-index: 1000;
    background: var(--navbar-bg);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}
.nav-container { max-width: var(--container); margin: 0 auto; padding: 0 24px; height: 68px; display: flex; align-items: center; justify-content: space-between; }
.logo { font-size: 20px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; letter-spacing: -0.5px; }
.logo-mark { color: var(--accent); font-size: 18px; }
.logo-accent { color: var(--accent); }

.nav-links { display: flex; align-items: center; gap: 32px; }
.nav-link { font-size: 15px; font-weight: 500; color: var(--text-muted); transition: color var(--transition); position: relative; }
.nav-link:hover, .nav-link.active { color: var(--text); }
.nav-link.active::after { content: ''; position: absolute; bottom: -6px; left: 0; right: 0; height: 2px; background: var(--accent); border-radius: 2px; }

.hamburger { display: none; flex-direction: column; justify-content: space-between; width: 26px; height: 20px; background: transparent; border: none; cursor: pointer; padding: 0; }
.hamburger span { display: block; height: 2.5px; width: 100%; background: var(--text); border-radius: 2px; transition: all var(--transition); }
.hamburger.active span:nth-child(1) { transform: translateY(8.5px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-8.5px) rotate(-45deg); }

/* ====================================================
   PAGE HEADER (Shared)
   ==================================================== */
.page-header {
    padding: 64px 0 32px;
    text-align: center;
    background: linear-gradient(180deg, var(--bg) 0%, var(--accent-light) 100%);
}

.badge {
    display: inline-block; background: var(--bg-alt); color: var(--accent);
    font-size: 13px; font-weight: 600; padding: 6px 14px;
    border-radius: 50px; border: 1px solid var(--border); margin-bottom: 20px;
}

.page-title {
    font-size: clamp(2rem, 4.5vw, 3rem);
    font-weight: 800; line-height: 1.1; letter-spacing: -1.5px;
    margin-bottom: 16px;
}

.page-subtitle {
    font-size: 1.1rem; color: var(--text-muted);
    max-width: 560px; margin: 0 auto;
}

/* ====================================================
   CONTROLS SECTION (Shared)
   ==================================================== */
.controls-section {
    background: var(--accent-light);
    padding-bottom: 48px;
}

.controls-wrapper {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 16px;
    align-items: center;
    background: var(--bg-alt);
    padding: 16px;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border);
}

/* Search Box */
.search-box {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    pointer-events: none;
}

#searchInput {
    width: 100%;
    padding: 14px 16px 14px 48px;
    font-family: inherit;
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

#searchInput:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-alt);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* Filter Dropdowns */
.filter-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 14px 40px 14px 16px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    background-color: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236B7280' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* ====================================================
   NOTES RESULTS & CARDS (Notes Page Specific)
   ==================================================== */
.notes-results-section {
    padding: 64px 0;
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.notes-card {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    transition: all var(--transition);
}

.notes-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
    border-color: transparent;
}

.notes-icon {
    font-size: 28px;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    border-radius: 12px;
    margin-bottom: 20px;
}

.notes-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
    color: var(--text);
}

.notes-card .chapter {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
    font-weight: 500;
}

.notes-actions {
    display: flex;
    gap: 10px;
    margin-top: auto; /* Pushes buttons to the bottom */
}

.notes-actions .btn {
    flex: 1; /* Makes buttons take equal width */
    padding: 10px 12px;
    font-size: 14px;
}

/* Shared Empty State */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-muted);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 1.2rem; color: var(--text); margin-bottom: 8px; }

/* ====================================================
   FOOTER (Shared)
   ==================================================== */
.footer { background: var(--bg); border-top: 1px solid var(--border); padding: 48px 0 24px; }
.footer-content { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 24px; padding-bottom: 32px; border-bottom: 1px solid var(--border); }
.footer-tagline { color: var(--text-muted); font-size: 14px; margin-top: 8px; }
.footer-links { display: flex; gap: 28px; }
.footer-links a { color: var(--text-muted); font-size: 14px; font-weight: 500; transition: color var(--transition); }
.footer-links a:hover { color: var(--accent); }
.footer-bottom { text-align: center; padding-top: 24px; color: var(--text-muted); font-size: 13.5px; }

/* ====================================================
   RESPONSIVE
   ==================================================== */
@media (max-width: 900px) {
    .notes-grid { grid-template-columns: repeat(2, 1fr); }
    .controls-wrapper { grid-template-columns: 1fr; }
    .filter-select { width: 100%; }
}

@media (max-width: 640px) {
    /* Mobile Nav */
    .nav-links {
        position: fixed; top: 68px; left: 0; right: 0; flex-direction: column;
        background: var(--bg-alt); padding: 24px; gap: 8px;
        border-bottom: 1px solid var(--border); box-shadow: 0 10px 20px rgba(0, 0, 0, 0.06);
        transform: translateY(-120%); opacity: 0; visibility: hidden;
        transition: all 0.35s ease; align-items: stretch;
    }
    .nav-links.open { transform: translateY(0); opacity: 1; visibility: visible; }
    .nav-link { padding: 12px 8px; font-size: 16px; border-radius: var(--radius-sm); }
    .nav-link.active::after { display: none; }
    .nav-link.active { background: var(--accent-light); color: var(--accent); }
    .nav-cta { margin-top: 8px; text-align: center; }
    .hamburger { display: flex; }

    .notes-grid { grid-template-columns: 1fr; }
    
    .footer-content { flex-direction: column; text-align: center; }
    .footer-links { justify-content: center; flex-wrap: wrap; }
}