﻿/* ============================================================
   StudyBuddy — Study Hub (page 1)
   ============================================================ */

/* ---------- intake ---------- */
.intake {
    margin-bottom: 1.6rem;
}

.intake-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: end;
}

.intake-or {
    display: grid;
    place-items: center;
    padding-bottom: .7rem;
}

    .intake-or span {
        font-family: var(--mono);
        font-size: .72rem;
        color: var(--muted);
        background: var(--surface-2);
        border: 1px solid var(--line);
        width: 34px;
        height: 34px;
        border-radius: 50%;
        display: grid;
        place-items: center;
    }

.file-drop {
    border: 1.5px dashed var(--line-2);
    border-radius: var(--r-sm);
    padding: .65rem .85rem;
    display: flex;
    align-items: center;
    gap: .7rem;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
    background: var(--card);
}

    .file-drop:hover, .file-field.drag .file-drop {
        border-color: var(--accent);
        background: var(--accent-50);
    }

.fd-ic {
    font-size: 1.1rem;
}

.fd-text {
    font-weight: 600;
    font-size: .92rem;
}

.fd-hint {
    font-size: .76rem;
    margin-left: auto;
}

.intake-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.2rem;
}

    .intake-actions .btn-lg {
        margin-left: auto;
    }

@media (max-width: 720px) {
    .intake-grid {
        grid-template-columns: 1fr;
    }

    .intake-or {
        padding: 0;
    }

        .intake-or span {
            width: auto;
            height: auto;
            border-radius: 999px;
            padding: .15rem .8rem;
        }

    .intake-actions {
        flex-direction: column;
        align-items: stretch;
    }

        .intake-actions .btn-lg {
            margin-left: 0;
        }
}

/* ---------- tabs ---------- */
.workspace {
    animation: rise .35s ease both;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.tabs {
    display: flex;
    gap: .3rem;
    margin-bottom: 1.1rem;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
}

.tab {
    font-family: var(--body);
    font-size: .92rem;
    font-weight: 600;
    color: var(--muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: .7rem .85rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: color .15s ease;
}

    .tab:hover {
        color: var(--text);
    }

    .tab.is-active {
        color: var(--accent);
        border-bottom-color: var(--accent);
    }

.panel {
    display: none;
}

    .panel.is-active {
        display: block;
        animation: rise .25s ease both;
    }

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.1rem;
    flex-wrap: wrap;
}

    .panel-head h2 {
        font-size: 1.3rem;
    }

.empty {
    color: var(--muted);
    padding: 2.5rem 1rem;
    text-align: center;
    background: var(--surface-2);
    border-radius: var(--r);
    border: 1px dashed var(--line-2);
}

/* ---------- download menu ---------- */
.menu {
    position: relative;
}

.menu-pop {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 20;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    box-shadow: var(--shadow);
    padding: .3rem;
    min-width: 180px;
}

    .menu-pop button {
        display: block;
        width: 100%;
        text-align: left;
        background: none;
        border: none;
        padding: .5rem .6rem;
        border-radius: 7px;
        font: inherit;
        font-size: .9rem;
        cursor: pointer;
        color: var(--text);
    }

        .menu-pop button:hover {
            background: var(--surface-2);
        }

/* ---------- notes ---------- */
.notes-body {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 1.6rem 1.8rem;
    box-shadow: var(--shadow-sm);
    max-width: 78ch;
}

    .notes-body h1 {
        font-size: 1.6rem;
        margin: .2rem 0 1rem;
    }

    .notes-body h2 {
        font-size: 1.15rem;
        margin: 1.6rem 0 .6rem;
        padding-top: .2rem;
    }

    .notes-body h3 {
        font-size: 1rem;
        margin: 1.1rem 0 .4rem;
    }

    .notes-body p {
        color: #34373F;
    }

    .notes-body ul, .notes-body ol {
        margin: 0 0 1rem;
        padding-left: 1.3rem;
    }

    .notes-body li {
        margin: .25rem 0;
    }

    .notes-body blockquote {
        border-left: 3px solid var(--accent);
        background: var(--accent-50);
        margin: 1rem 0;
        padding: .6rem 1rem;
        border-radius: 0 8px 8px 0;
        color: #3A3A57;
    }

    .notes-body code {
        font-family: var(--mono);
        font-size: .86em;
        background: var(--surface-2);
        padding: .1em .35em;
        border-radius: 5px;
    }

    .notes-body strong {
        color: var(--text);
    }

/* ---------- quiz ---------- */
.quiz-q {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 1.1rem 1.2rem;
    margin-bottom: .9rem;
    box-shadow: var(--shadow-sm);
}

    .quiz-q .q-text {
        font-weight: 600;
        margin-bottom: .8rem;
    }

.quiz-opt {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .55rem .7rem;
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    margin-bottom: .5rem;
    cursor: pointer;
    transition: border-color .12s ease, background .12s ease;
}

    .quiz-opt:hover {
        border-color: var(--accent);
        background: var(--accent-50);
    }

    .quiz-opt input {
        accent-color: var(--accent);
        width: 17px;
        height: 17px;
    }

    .quiz-opt.correct {
        border-color: var(--go);
        background: var(--go-50);
    }

    .quiz-opt.wrong {
        border-color: var(--danger);
        background: var(--danger-50);
    }

.quiz-why {
    font-size: .85rem;
    color: var(--muted);
    margin-top: .5rem;
    padding-left: .2rem;
}

    .quiz-why.show {
        display: block;
    }

.quiz-submit {
    margin-top: .4rem;
}

.score-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--ink);
    color: var(--on-dark);
    border-radius: var(--r);
    padding: 1rem 1.3rem;
    margin-bottom: 1rem;
}

    .score-banner .big {
        font-family: var(--mono);
        font-size: 1.8rem;
        font-weight: 700;
    }

        .score-banner .big .small {
            font-size: 1rem;
            color: var(--on-dark-mut);
        }

/* attempts */
.attempts {
    margin-top: 1.2rem;
}

.attempt-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .75rem .9rem;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    margin-bottom: .5rem;
    background: var(--card);
}

    .attempt-row .when {
        font-family: var(--mono);
        font-size: .82rem;
        color: var(--muted);
    }

    .attempt-row .pct {
        font-weight: 700;
        font-family: var(--mono);
    }

        .attempt-row .pct.good {
            color: var(--go);
        }

        .attempt-row .pct.mid {
            color: var(--flame);
        }

        .attempt-row .pct.low {
            color: var(--danger);
        }

    .attempt-row .btn {
        margin-left: auto;
    }

/* ---------- flashcards ---------- */
.deck {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.flashcard {
    width: min(440px, 100%);
    height: 250px;
    perspective: 1400px;
    cursor: pointer;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform .55s cubic-bezier(.2,.7,.2,1);
    transform-style: preserve-3d;
}

.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.fc-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: var(--r-lg);
    display: grid;
    place-items: center;
    text-align: center;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.fc-front {
    background: var(--card);
    border: 1px solid var(--line);
}

    .fc-front .fc-q {
        font-family: var(--display);
        font-size: 1.3rem;
        font-weight: 600;
    }

.fc-back {
    background: var(--ink);
    color: var(--on-dark);
    transform: rotateY(180deg);
}

    .fc-back .fc-a {
        font-size: 1.05rem;
        line-height: 1.5;
    }

.fc-tag {
    position: absolute;
    top: 14px;
    left: 16px;
    font-family: var(--mono);
    font-size: .68rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
}

.fc-back .fc-tag {
    color: var(--on-dark-mut);
}

.deck-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

    .deck-nav .pos {
        font-family: var(--mono);
        font-size: .9rem;
        color: var(--muted);
        min-width: 64px;
        text-align: center;
    }

/* ---------- videos ---------- */
.vid-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: .9rem;
}

.vid-card {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: 1.1rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
    transition: transform .12s ease, box-shadow .15s ease;
    text-decoration: none;
    color: var(--text);
}

    .vid-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow);
        text-decoration: none;
    }

.vid-thumb {
    aspect-ratio: 16/9;
    border-radius: 9px;
    background: linear-gradient(135deg, #011425, #1F4959);
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.8rem;
}

.vid-card .v-title {
    font-weight: 600;
    font-size: .96rem;
}

.vid-card .v-sub {
    font-size: .8rem;
    color: var(--muted);
}

/* ---------- chat ---------- */
.chat {
    display: flex;
    flex-direction: column;
    gap: .7rem;
    min-height: 280px;
    max-height: 52vh;
    overflow-y: auto;
    padding: 1rem;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r);
    margin-bottom: .8rem;
}

.msg {
    max-width: 80%;
    padding: .6rem .85rem;
    border-radius: 14px;
    font-size: .93rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

    .msg.user {
        align-self: flex-end;
        background: var(--accent);
        color: #fff;
        border-bottom-right-radius: 4px;
    }

    .msg.ai {
        align-self: flex-start;
        background: var(--card);
        border: 1px solid var(--line);
        border-bottom-left-radius: 4px;
    }

        .msg.ai.thinking {
            color: var(--muted);
        }

.chat-empty {
    color: var(--muted);
    margin: auto;
    text-align: center;
    font-size: .9rem;
}

.chat-input {
    display: flex;
    gap: .6rem;
}

    .chat-input .input {
        flex: 1;
    }

/* ---------- progress report (per-topic score trend) ---------- */
.progress-report {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 1.2rem 1.3rem;
    margin-bottom: 1.2rem;
}

.pr-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: .9rem;
}

    .pr-head h3 {
        font-size: 1.05rem;
    }

.pr-trend {
    font-weight: 700;
    font-size: .85rem;
    padding: .25rem .7rem;
    border-radius: 999px;
}

    .pr-trend.good {
        background: #E2F2EE;
        color: #0F6E56;
    }

    .pr-trend.mid {
        background: #E6EDEF;
        color: #1F4959;
    }

    .pr-trend.low {
        background: #F7E8E6;
        color: #A32D2D;
    }

.pr-stats {
    display: flex;
    gap: .6rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.pr-stat {
    flex: 1;
    min-width: 70px;
    background: var(--surface-2);
    border-radius: var(--r-sm);
    padding: .6rem .4rem;
    text-align: center;
}

    .pr-stat b {
        display: block;
        font-family: var(--mono);
        font-size: 1.3rem;
        color: #1F4959;
        line-height: 1;
    }

    .pr-stat span {
        font-size: .72rem;
        color: var(--muted);
        text-transform: uppercase;
        letter-spacing: .05em;
    }

.pr-chart {
    width: 100%;
    height: 150px;
    display: block;
}

    .pr-chart .pgrid {
        stroke: var(--line);
        stroke-width: 1;
        stroke-dasharray: 3 4;
    }

    .pr-chart .pgl {
        fill: var(--muted);
        font-family: var(--mono);
        font-size: 10px;
    }

    .pr-chart .parea {
        fill: rgba(31,73,89,.10);
        stroke: none;
    }

    .pr-chart .pline {
        fill: none;
        stroke: #1F4959;
        stroke-width: 2.5;
        stroke-linejoin: round;
        stroke-linecap: round;
    }

    .pr-chart .pdot {
        fill: #fff;
        stroke: #1F4959;
        stroke-width: 2.5;
    }

.pr-note {
    font-size: .85rem;
    color: var(--muted);
    margin: .7rem 0 0;
}

/* ---------- option buttons (Lectures / Flashcards / Quiz / Discuss) ---------- */
.tools {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin: 1.4rem 0 1.6rem;
}

.tool {
    flex: 1;
    min-width: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    font-family: var(--body);
    font-weight: 600;
    font-size: .98rem;
    padding: .95rem 1rem;
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--line-2);
    border-radius: var(--r);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform .08s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
}

    .tool:hover {
        border-color: #1F4959;
        box-shadow: var(--shadow);
        transform: translateY(-1px);
    }

    .tool:active {
        transform: translateY(0);
    }

    .tool.is-active {
        background: #1F4959;
        color: #fff;
        border-color: #1F4959;
    }

@media (max-width: 620px) {
    .tool {
        min-width: calc(50% - .3rem);
    }
}
.quiz-why {
    display: none;
    font-size: .85rem;
    color: var(--muted);
    margin-top: .5rem;
    padding-left: .2rem;
}

    .quiz-why.show {
        display: block;
    }
