/* LearnSlides — Academic Press aesthetic
   Newsreader (serif display) + DM Sans (body) + JetBrains Mono (numerals) */

:root {
    --bg-deep: #080b11;
    --bg-primary: #0c1017;
    --bg-secondary: #111720;
    --bg-card: #151c28;
    --bg-card-hover: #1a2335;
    --border: #1e2a3a;
    --border-hover: #2d3f56;
    --text-primary: #dce4ef;
    --text-secondary: #7a8da3;
    --text-muted: #4a5b70;
    --accent-amber: #d4a24e;
    --accent-amber-dim: rgba(212, 162, 78, 0.12);
    --accent-blue: #5b9cf5;
    --accent-green: #7ec88b;
    --accent-yellow: #e2b75a;
    --accent-red: #e06c75;
    --accent-purple: #b48eda;
    --accent-cyan: #56b6c2;

    --font-display: 'Newsreader', 'Georgia', serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
}

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

body {
    font-family: var(--font-body);
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Subtle film grain overlay for texture */
.grain-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* ========== NAVBAR ========== */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2.5rem;
    background: transparent;
    position: relative;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
}
.logo-mark {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 300;
    color: var(--accent-amber);
    border: 1px solid rgba(212, 162, 78, 0.3);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    letter-spacing: 0.08em;
}
.logo-text {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 400;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.user-name {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 300;
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-block;
    padding: 0.45rem 1rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-primary);
    text-decoration: none;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.01em;
}
.btn:hover {
    background: var(--bg-card);
    border-color: var(--border-hover);
}
.btn-primary {
    background: var(--accent-amber);
    color: var(--bg-deep);
    border-color: var(--accent-amber);
    font-weight: 600;
}
.btn-primary:hover {
    background: #deb05e;
    border-color: #deb05e;
}
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.76rem; }
.btn-admin {
    color: var(--accent-amber);
    border-color: rgba(212, 162, 78, 0.25);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 400;
}
.btn-admin:hover { background: rgba(212, 162, 78, 0.08); }
.btn-full { width: 100%; text-align: center; }

/* ========== HERO ========== */
.hero {
    position: relative;
    padding: 5rem 2.5rem 3rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.hero-glow {
    position: absolute;
    top: -40%;
    left: 50%;
    transform: translateX(-50%);
    width: 700px;
    height: 500px;
    background: radial-gradient(ellipse, rgba(212, 162, 78, 0.06) 0%, rgba(91, 156, 245, 0.03) 40%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.hero-inner {
    position: relative;
    z-index: 1;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 300;
}
.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}
.breadcrumb a:hover { color: var(--accent-amber); }
.breadcrumb-sep { color: var(--text-muted); opacity: 0.4; }
.breadcrumb span:last-child { color: var(--text-secondary); }

.hero-eyebrow {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1.2rem;
}
.eyebrow-line {
    display: block;
    width: 32px;
    height: 1px;
    background: var(--accent-amber);
}
.eyebrow-text {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent-amber);
}

.hero h1 {
    font-family: var(--font-display);
    font-size: 4.2rem;
    font-weight: 300;
    letter-spacing: -0.03em;
    line-height: 1.05;
    color: var(--text-primary);
    margin-bottom: 1.2rem;
}

.hero-sub {
    font-size: 1.02rem;
    font-weight: 300;
    line-height: 1.65;
    color: var(--text-secondary);
    max-width: 520px;
}

/* ========== LECTURES SECTION ========== */
.lectures-section {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    padding: 0 2.5rem 5rem;
}

.section-header {
    display: flex;
    align-items: baseline;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}
.section-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--text-primary);
    letter-spacing: 0.01em;
}
.section-count {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 300;
    color: var(--text-muted);
}

/* ========== SEARCH BAR ========== */
.search-bar {
    position: relative;
    margin-bottom: 1.5rem;
}
.search-bar input {
    width: 100%;
    padding: 0.7rem 1rem 0.7rem 2.4rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 300;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-bar input:focus {
    outline: none;
    border-color: var(--accent-amber);
    box-shadow: 0 0 0 2px rgba(212, 162, 78, 0.1);
}
.search-bar input::placeholder {
    color: var(--text-muted);
    font-weight: 300;
}
.search-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}

.search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 20;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    display: none;
}
.search-results.visible { display: block; }

.search-result {
    display: block;
    padding: 0.7rem 1rem;
    text-decoration: none;
    border-bottom: 1px solid rgba(30, 42, 58, 0.4);
    transition: background 0.15s;
}
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--bg-card-hover); }

.search-result-heading {
    font-family: var(--font-display);
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.15rem;
}
.search-result-lecture {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--accent-amber);
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.3rem;
}
.search-result-snippet {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.5;
    font-weight: 300;
}
.search-result-snippet mark {
    background: rgba(212, 162, 78, 0.2);
    color: var(--accent-amber);
    border-radius: 2px;
    padding: 0 2px;
}
.search-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* ========== DECK (EXPANDABLE LECTURE) ========== */
.lectures-list {
    display: flex;
    flex-direction: column;
}

@keyframes slideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.deck {
    border-bottom: 1px solid rgba(30, 42, 58, 0.5);
    border-radius: 6px;
    margin-bottom: 2px;
    opacity: 0;
    transform: translateY(12px);
    animation: slideUp 0.5s ease forwards;
}
.deck:last-child { border-bottom: none; }

/* -- Deck Header (the clickable lecture row) -- */
.deck-header {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    gap: 1rem;
    align-items: center;
    padding: 1.25rem 1rem;
    cursor: pointer;
    transition: background 0.25s ease, padding-left 0.25s ease;
    border-radius: 6px;
    user-select: none;
    text-decoration: none;
    color: inherit;
}
.deck-header:visited { color: inherit; }
.deck-header:hover {
    background: var(--bg-card);
    padding-left: 1.4rem;
}

.deck-number {
    font-family: var(--font-mono);
    font-size: 1.3rem;
    font-weight: 300;
    color: var(--accent-amber);
    opacity: 0.7;
    transition: opacity 0.25s;
    text-align: center;
}
.deck-header:hover .deck-number { opacity: 1; }

.deck-info { min-width: 0; }
.deck-info h3 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 0.3rem;
    color: var(--text-primary);
    transition: color 0.25s;
    letter-spacing: -0.005em;
}
.deck-header:hover .deck-info h3 { color: var(--accent-amber); }
.deck-info p {
    font-size: 0.82rem;
    font-weight: 300;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.deck-toggle {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.deck-chevron {
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.25s, transform 0.3s ease;
}
.deck-header:hover .deck-chevron { opacity: 0.6; }
.deck.expanded .deck-chevron {
    opacity: 0.6;
    transform: rotate(180deg);
}
/* Lectures without notebooks: show arrow instead of chevron */
.deck:not(.deck-has-content) .deck-chevron { display: none; }
.deck:not(.deck-has-content) .deck-toggle {
    width: 20px;
    height: 20px;
    background: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%234a5b70' stroke-width='1.5' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 12h14M12 5l7 7-7 7'/%3E%3C/svg%3E") no-repeat center;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.25s, transform 0.25s;
}
.deck:not(.deck-has-content) .deck-header:hover .deck-toggle {
    opacity: 0.6;
    transform: translateX(0);
}

/* -- Deck Contents (slides + notebooks) -- */
.deck:not(.deck-has-content) .deck-contents { display: none; }
.deck-contents {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    padding-left: 1rem;
    padding-right: 1rem;
    transition: max-height 0.35s ease, opacity 0.3s ease, padding-bottom 0.35s ease;
}
.deck.expanded .deck-contents {
    max-height: 400px;
    opacity: 1;
    padding-bottom: 0.8rem;
}

.deck-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.8rem;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.2s ease;
    margin-bottom: 2px;
}
.deck-item:hover { background: var(--bg-card); }

.deck-item svg:first-child {
    flex-shrink: 0;
    opacity: 0.6;
}
.deck-item span {
    flex: 1;
    font-size: 0.84rem;
    font-weight: 400;
}

.deck-item-arrow {
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.2s, transform 0.2s;
    flex-shrink: 0;
}
.deck-item:hover .deck-item-arrow {
    opacity: 0.5;
    transform: translateX(0);
}

/* Slides item */
.deck-item-slides {
    color: var(--accent-amber);
}
.deck-item-slides span {
    font-family: var(--font-body);
    letter-spacing: 0.01em;
}

/* Notebook item */
.deck-item-notebook {
    color: var(--accent-purple);
}
.deck-item-notebook span {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 300;
}

/* ========== BADGES ========== */
.card-badges {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 0.18rem 0.5rem;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.badge-interactive {
    background: rgba(126, 200, 139, 0.08);
    color: var(--accent-green);
    border: 1px solid rgba(126, 200, 139, 0.15);
}
.badge-keynote {
    background: rgba(180, 142, 218, 0.08);
    color: var(--accent-purple);
    border: 1px solid rgba(180, 142, 218, 0.15);
    cursor: pointer;
}
.badge-keynote:hover {
    background: rgba(180, 142, 218, 0.18);
}

/* ========== FOOTER ========== */
footer {
    margin-top: auto;
    padding: 2rem 2.5rem;
    border-top: 1px solid var(--border);
}
.footer-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}
.footer-logo {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 300;
    color: var(--accent-amber);
    border: 1px solid rgba(212, 162, 78, 0.2);
    padding: 0.15rem 0.35rem;
    border-radius: 2px;
    letter-spacing: 0.08em;
    opacity: 0.5;
}
footer p {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-weight: 300;
}

/* ========== AUTH FORMS (shared with login/verify/profile pages) ========== */
.auth-container {
    max-width: 400px;
    margin: 3rem auto;
    padding: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.auth-container h2 {
    font-family: var(--font-display);
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--accent-amber);
    font-weight: 400;
    font-size: 1.4rem;
}

.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}
.form-group input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.88rem;
}
.form-group input:focus {
    outline: none;
    border-color: var(--accent-amber);
    box-shadow: 0 0 0 2px rgba(212, 162, 78, 0.12);
}

.auth-switch {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.auth-switch a { color: var(--accent-amber); }

/* Flash messages */
.flash {
    padding: 0.75rem 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}
.flash-error {
    background: rgba(224, 108, 117, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(224, 108, 117, 0.2);
}
.flash-success {
    background: rgba(126, 200, 139, 0.1);
    color: var(--accent-green);
    border: 1px solid rgba(126, 200, 139, 0.2);
}

/* Access code display */
.code-display { text-align: center; padding: 1rem; }
.access-code {
    font-size: 2rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent-amber);
    letter-spacing: 0.15em;
    padding: 1rem;
    background: var(--bg-deep);
    border-radius: 6px;
    margin: 1rem 0;
    border: 1px solid var(--border);
}
.small { font-size: 0.8rem; color: var(--text-secondary); }

/* ========== RESPONSIVE ========== */
@media (max-width: 720px) {
    .navbar { padding: 0.85rem 1.25rem; }
    .logo-text { display: none; }

    .hero { padding: 3rem 1.25rem 2rem; }
    .hero h1 { font-size: 2.6rem; }
    .hero-sub { font-size: 0.92rem; }
    .hero-glow { width: 400px; height: 300px; }

    .lectures-section { padding: 0 1.25rem 3rem; }
    .deck-header {
        grid-template-columns: 28px 1fr auto;
        gap: 0.8rem;
        padding: 1rem 0.5rem;
    }
    .deck-info h3 { font-size: 0.95rem; }
    .deck-info p {
        -webkit-line-clamp: 1;
        font-size: 0.78rem;
    }
    .deck-number { font-size: 1.1rem; }
    .deck-contents { padding-left: 52px; }

    .section-header { margin-bottom: 1rem; }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 2rem; }
    .eyebrow-text { font-size: 0.6rem; }
}
