/* ===== Study Buddy Page ===== */

@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@500;600;700&display=swap');

/* auth.css's body is a centered flexbox built for a single login card —
   it shrink-wraps and vertically-centers direct children, which boxes in
   the full-width sticky top-nav instead of letting it sit flush. Reset to
   plain block flow so .top-nav behaves the same as on every other page. */
body {
    display: block;
    min-height: 100vh;
}

.sb-container {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 32px 24px;
}

.sb-header {
    text-align: center;
    margin-bottom: 24px;
}

.sb-header h1 {
    font-family: 'Caveat', cursive;
    font-size: 2.4rem;
    margin: 0 0 8px;
}

.sb-subtitle {
    color: var(--text-muted);
    font-size: 0.88rem;
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.5;
}

.sb-page-layout {
    display: flex;
    align-items: flex-start;
    gap: 32px;
}

.sb-main-column {
    flex: 1 1 auto;
    min-width: 0;
}

.sb-sidebar {
    flex: 0 0 230px;
    width: 230px;
    position: sticky;
    top: 88px; /* clears the fixed top-nav */
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sb-sidebar-label {
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.sb-sidebar-label i {
    font-style: italic;
    font-weight: 400;
}

.sb-journey-select {
    width: 100%;
    padding: 10px 14px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-white);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.sb-export-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sb-export-list .sb-btn {
    width: 100%;
    justify-content: flex-start;
}

.sb-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-light);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.sb-btn:hover {
    background: var(--glass-bg-hover);
    color: var(--text-white);
    transform: translateY(-1px);
}

.sb-btn:disabled {
    opacity: 0.6;
    cursor: default;
    transform: none;
}

.sb-btn-primary {
    background: linear-gradient(135deg, var(--purple-light), #8B7BFF);
    color: #fff;
    border-color: transparent;
}

/* Lined-paper look: a cream page with ruled horizontal lines, sitting on
   the site's normal dark background — like a notebook page on a desk.
   Scoped to .sb-module-card (not .profile-card generally) so student
   profile.html's cards elsewhere are untouched. */
/* The ruled-line grid unit. Every row of body text below the title
   uses exactly this line-height with zero extra margin, so each line
   lands in the gap between two rules instead of floating independently
   of the background pattern (a repeating-gradient tiles forever, so
   "align once" only works if nothing after it adds an odd-sized gap). */
:root {
    --sb-line: 32px;
}

.sb-module-card {
    text-align: left;
    background-color: #fbf7ea;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent calc(var(--sb-line) - 1px),
        rgba(90, 110, 190, 0.25) var(--sb-line)
    );
    background-position: 0 25px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.sb-module-card .profile-card-title {
    /* on the grid too now — one line-height tall, same unit as every row
       below it, so the whole card (title included) is one continuous
       ruled sequence instead of the title floating independently above it */
    font-family: 'Caveat', var(--font-display);
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--purple-dark);
    line-height: var(--sb-line);
    margin: 0;
}

.sb-module-body {
    display: flex;
    align-items: flex-start;
    gap: 24px;
}

.sb-module-main {
    flex: 1 1 60%;
    min-width: 0;
}

.sb-module-notes {
    flex: 1 1 40%;
    min-width: 0;
    border-left: 2px dashed rgba(210, 90, 100, 0.45);
    padding-left: 20px;
}

.sb-module-card .sb-section-label,
.sb-module-card .sb-meanings-list li,
.sb-module-card .sb-practice-desc,
.sb-module-card .sb-note-label,
.sb-module-card .sb-note-textarea {
    font-family: 'Caveat', cursive;
}

.sb-section-label {
    font-size: 1.05rem;
    line-height: var(--sb-line);
    color: #7a7290;
    margin: 0;
    text-decoration: underline;
}

.sb-field-label {
    font-family: 'Caveat', cursive;
    font-weight: 600;
}

.sb-module-card .sb-meanings-list {
    margin: 0;
    gap: 0;
}

.sb-module-card .sb-meanings-list li {
    display: block;
    margin: 0;
    font-size: 1.2rem;
    color: var(--purple-dark);
}

.sb-meaning-term-row,
.sb-meaning-def {
    line-height: var(--sb-line);
}

.sb-meaning-term {
    /* the code term stays monospace even on its own line — code written
       in cursive is illegible, and this keeps "what's code" and "what's
       the explanation" visually distinct at a glance */
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--purple-dark);
    background: rgba(90, 110, 190, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
}

.sb-meaning-def {
    color: var(--purple-dark);
}

.sb-practice {
    /* one blank ruled row of breathing room between the Meanings block
       and Practice — still a multiple of --sb-line, so the grid stays
       in phase rather than drifting out of sync with the background */
    margin-top: var(--sb-line);
}

.sb-module-card .sb-practice-desc {
    font-size: 1.15rem;
    line-height: var(--sb-line);
    color: #6b6480;
    margin: 0;
}

.sb-module-card .sb-code-block {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0 0 0 24px;
    margin: 0;
    line-height: var(--sb-line);
    color: var(--purple-dark);
}

.sb-module-card .sb-note-label {
    font-size: 1.05rem;
    color: #7a7290;
    text-transform: none;
    letter-spacing: normal;
}

.sb-module-card .sb-note-textarea {
    background: #fffdf6;
    border: 1px solid rgba(0, 0, 0, 0.12);
    color: var(--purple-dark);
    font-size: 1.3rem;
}

.sb-module-card .sb-note-save-btn {
    background: var(--purple-dark);
    border-color: transparent;
    color: #fdf9f0;
}

.sb-module-card .sb-note-save-btn:hover {
    background: var(--purple-mid);
    color: #fff;
}

.sb-meanings-list {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sb-meanings-list li {
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text-light);
}

.sb-meanings-list strong {
    color: var(--text-white);
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.sb-practice-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0 0 8px;
}

.sb-code-block {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    overflow-x: auto;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text-white);
    margin: 0 0 16px;
    white-space: pre;
}

.sb-note-section {
    height: 100%;
}

.sb-note-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sb-note-textarea {
    display: block;
    width: 100%;
    min-height: 80px;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    color: var(--text-white);
    font-family: var(--font-body);
    font-size: 0.85rem;
    line-height: 1.5;
    resize: vertical;
    margin-bottom: 10px;
    box-sizing: border-box;
}

.sb-note-textarea:focus {
    outline: none;
    border-color: var(--purple-light);
}

.sb-note-print-view {
    display: none;
}

@media (max-width: 900px) {
    .sb-page-layout { flex-direction: column; }
    .sb-sidebar {
        position: static;
        width: 100%;
        flex: 1 1 auto;
    }
}

@media (max-width: 640px) {
    .sb-container { padding: 20px 16px; }
    .sb-module-body { flex-direction: column; }
    .sb-module-notes {
        border-left: none;
        padding-left: 0;
        border-top: 1px solid var(--glass-border);
        padding-top: 14px;
        width: 100%;
    }
}

/* ===== Print ("Print My Notebook") — reuses the .no-print convention from certificate.html ===== */
@media print {
    @page { size: A4 portrait; margin: 18mm; }

    body { background: #fff !important; color: #000; }
    .no-print { display: none !important; }

    .sb-container { max-width: 100%; padding: 0; margin: 0; }

    /* Sidebar (export/journey controls) is .no-print; let the main
       column fill the page rather than staying flex-basis-constrained */
    .sb-page-layout { display: block; }

    /* Keep the printed notebook single-column regardless of screen width */
    .sb-module-body { flex-direction: column; }
    .sb-module-notes {
        border-left: none;
        padding-left: 0;
        border-top: 1px solid #ccc;
        padding-top: 10px;
        margin-top: 10px;
    }

    .profile-card.sb-module-card {
        background: #fff;
        border: none;
        border-bottom: 1px solid #ddd;
        border-radius: 0;
        backdrop-filter: none;
        box-shadow: none;
        page-break-inside: avoid;
        color: #000;
        padding: 16px 0;
    }

    .profile-card-title,
    .sb-meanings-list strong {
        color: #000 !important;
    }

    .sb-meanings-list li,
    .sb-practice-desc {
        color: #222 !important;
    }

    .sb-code-block {
        background: none;
        border: none;
        padding-left: 24px;
        color: #000;
    }

    .sb-note-print-view {
        display: block;
        white-space: pre-wrap;
        font-size: 0.85rem;
        color: #000;
        border-top: 1px solid #ccc;
        padding-top: 8px;
        margin-top: 4px;
    }
}
