/* ==========================================================================
   Student-Facing Styles (st-* prefix)
   Designed for K-12 special needs students on tablets.
   Uses CSS variables from style.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tokens
   -------------------------------------------------------------------------- */
:root {
    --st-bg: #FFFBF5;
    --st-bg-alt: #FFF7ED;
    --st-header-h: 56px;
    --st-radius: 16px;
    --st-radius-sm: 10px;
    --st-touch-min: 56px;
}

/* --------------------------------------------------------------------------
   Body / Main — uses teacher-app header (fixed, var(--header-height))
   -------------------------------------------------------------------------- */
.st-main {
    min-height: calc(100vh - var(--header-height, 56px) - 46px);
    background: #fff;
}

/* --------------------------------------------------------------------------
   Student Nav Bar (below fixed app header)
   -------------------------------------------------------------------------- */
.st-nav {
    position: fixed;
    top: var(--header-height, 56px);
    left: 0;
    right: 0;
    z-index: 90;
    background: #FAFBFC;
    border-bottom: 1px solid var(--color-border, #E4E4E7);
}

/* Push main content below fixed header + nav */
.teacher-app .st-main {
    margin-top: calc(var(--header-height, 56px) + 46px);
}

.st-nav-inner {
    max-width: 800px;
    margin: auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.st-nav-room {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted, #71717A);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.st-nav-room:hover { color: var(--color-brand, #F97316); text-decoration: none; }

.st-nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.st-nav-student {
    display: flex;
    align-items: center;
    gap: 8px;
}

.st-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--color-brand, #F97316);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}

.st-nav-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary, #18181B);
}

.st-nav-leave {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-muted, #71717A);
    padding: 5px 12px;
    border: 1px solid var(--color-border, #E4E4E7);
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.15s;
}
.st-nav-leave:hover { border-color: var(--color-text-muted, #71717A); color: #333; text-decoration: none; }

/* --------------------------------------------------------------------------
   Sub-header (back + title)
   -------------------------------------------------------------------------- */
.st-subheader {
    max-width: 800px;
    margin: 0 auto;
    padding: 16px 20px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.st-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--color-text-muted);
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
    text-decoration: none;
}

.st-back-btn:hover {
    background: var(--color-background-alt);
    color: var(--color-text-primary);
}

.st-subheader-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-primary);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.st-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--st-touch-min);
    padding: 12px 24px;
    border-radius: var(--st-radius-sm);
    font-size: 16px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.st-btn--primary {
    background: var(--color-brand);
    color: #fff;
}

.st-btn--primary:hover {
    background: var(--color-brand-hover);
    transform: translateY(-1px);
}

.st-btn--outline {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.st-btn--outline:hover {
    border-color: var(--color-brand);
    color: var(--color-brand);
}

.st-btn--lg {
    width: 100%;
    justify-content: center;
    font-size: 17px;
}

/* --------------------------------------------------------------------------
   PIN Page
   -------------------------------------------------------------------------- */
.st-pin-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(180deg, var(--st-bg) 0%, var(--st-bg-alt) 100%);
}

.st-pin-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px 32px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.st-pin-title {
    font-size: 26px;
    font-weight: 800;
    color: #18181B;
    margin: 0 0 8px;
}

.st-pin-subtitle {
    font-size: 15px;
    color: var(--color-text-muted);
    margin: 0 0 28px;
}

.st-pin-digits {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}

.st-pin-digit {
    width: 48px;
    height: 60px;
    border: 2px solid var(--color-border);
    border-radius: 12px;
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    color: #18181B;
    background: #fff;
    outline: none;
    caret-color: var(--color-brand);
}

.st-pin-digit:focus {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

.st-pin-error {
    color: var(--color-error);
    font-size: 14px;
    margin-top: 12px;
    font-weight: 500;
}

/* --------------------------------------------------------------------------
   Pick Name Page
   -------------------------------------------------------------------------- */
.st-pick-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(180deg, var(--st-bg) 0%, var(--st-bg-alt) 100%);
}

.st-pick-card {
    background: #fff;
    border-radius: 20px;
    padding: 32px;
    max-width: 560px;
    width: 100%;
    text-align: center;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.st-pick-title {
    font-size: 22px;
    font-weight: 700;
    color: #18181B;
    margin: 0 0 4px;
}

.st-pick-subtitle {
    font-size: 15px;
    color: var(--color-text-muted);
    margin: 0 0 24px;
}

.st-name-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 480px) {
    .st-name-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.st-name-btn {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--color-border);
    border-radius: 14px;
    background: #fff;
    font-size: 17px;
    font-weight: 600;
    color: #18181B;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.st-name-btn:hover {
    border-color: var(--color-brand);
    background: var(--color-brand-bg);
    transform: translateY(-1px);
}

.st-pick-back {
    text-align: center;
    margin-top: 20px;
}

.st-pick-back a {
    font-size: 14px;
    color: var(--color-brand);
    text-decoration: none;
}

.st-pick-back a:hover {
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Dashboard
   -------------------------------------------------------------------------- */
.st-dash {
    max-width: 720px;
    margin: 0 auto;
    padding: 20px 20px 48px;
}
.st-dash > *:first-child { margin-top: 0; }

.st-greeting {
    margin-bottom: 28px;
}

.st-greeting-hello {
    font-size: 26px;
    font-weight: 800;
    color: #18181B;
    margin: 0 0 4px;
}

.st-greeting-sub {
    font-size: 15px;
    color: var(--color-text-muted);
    margin: 0;
}

.st-section {
    margin-bottom: 28px;
}

.st-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text-primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0 0 12px;
}

.st-playlist-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #fff;
    border-radius: var(--st-radius);
    padding: 18px 20px;
    text-decoration: none;
    color: inherit;
    transition: all 0.15s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    margin-bottom: 10px;
}

.st-playlist-card:hover {
    box-shadow: 0 4px 16px rgba(249, 115, 22, 0.1);
    transform: translateY(-1px);
}

.st-playlist-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--color-brand-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.st-playlist-info {
    flex: 1;
    min-width: 0;
}

.st-playlist-title {
    font-size: 16px;
    font-weight: 600;
    color: #18181B;
    margin: 0 0 2px;
}

.st-playlist-meta {
    font-size: 13px;
    color: var(--color-text-muted);
}

.st-chevron {
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.st-activity-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: #fff;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: all 0.15s;
    margin-bottom: 8px;
    min-height: var(--st-touch-min);
}

.st-activity-item:hover {
    background: var(--color-brand-bg);
    transform: translateY(-1px);
}

.st-activity-status {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.st-activity-status--done {
    background: var(--color-success);
    border-color: var(--color-success);
    color: #fff;
}

.st-activity-info {
    flex: 1;
    min-width: 0;
}

.st-activity-title {
    font-size: 15px;
    font-weight: 500;
    color: #18181B;
}

.st-activity-meta {
    font-size: 12px;
    color: var(--color-text-muted);
}

.st-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--color-text-muted);
}

.st-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.st-empty-text {
    font-size: 16px;
}

/* --------------------------------------------------------------------------
   Achievements Wrapper
   -------------------------------------------------------------------------- */
.st-achievements {
    background: var(--st-bg-alt);
    border-radius: var(--st-radius);
    padding: 16px 20px;
    margin-bottom: 24px;
}

/* --------------------------------------------------------------------------
   Playlist / Watch Page
   -------------------------------------------------------------------------- */
.st-watch-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px 48px;
}

.st-watch-player {
    background: #18181B;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 24px;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.st-watch-player iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.st-watch-placeholder {
    color: var(--color-text-muted);
    text-align: center;
    padding: 40px;
}

.st-watch-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.st-watch-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: 4px;
    min-height: 72px;
}

.st-watch-item:hover {
    background: var(--color-brand-bg);
}

.st-watch-item.active {
    background: var(--color-brand-bg);
    border-left: 3px solid var(--color-brand);
}

.st-watch-item-num {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-muted);
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.st-watch-item.active .st-watch-item-num {
    color: var(--color-brand);
}

.st-watch-item-thumb {
    width: 120px;
    height: 68px;
    background: #e5e7eb;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.st-watch-item-info {
    flex: 1;
    min-width: 0;
}

.st-watch-item-info h2 {
    margin: 0 0 2px;
    font-size: 15px;
    font-weight: 500;
}

.st-watch-item-info small {
    color: var(--color-text-muted);
    font-size: 13px;
}

.st-watch-playing-badge {
    font-size: 12px;
    color: var(--color-brand);
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   Activity Detail
   -------------------------------------------------------------------------- */
.st-activity-detail {
    max-width: 680px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}

.st-activity-card {
    background: #fff;
    border-radius: var(--st-radius);
    padding: 28px 24px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.st-activity-card-title {
    font-size: 22px;
    font-weight: 700;
    color: #18181B;
    margin: 0 0 12px;
}

.st-activity-card-desc {
    font-size: 15px;
    color: var(--color-text-secondary);
    margin: 0 0 20px;
    line-height: 1.6;
}

.st-question-block {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--color-border-light);
}

.st-question-block:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.st-question-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-brand);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    margin-right: 10px;
    flex-shrink: 0;
}

.st-question-title {
    font-size: 16px;
    font-weight: 600;
    color: #18181B;
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.st-question-desc {
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-left: 38px;
}

.st-question-image {
    max-width: 300px;
    max-height: 300px;
    border-radius: 8px;
    margin: 10px 0 0 38px;
}

/* --------------------------------------------------------------------------
   Practice Override
   -------------------------------------------------------------------------- */
.pr-wrapper {
    background: var(--st-bg);
}

/* --------------------------------------------------------------------------
   Responsive — Small Screens
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
    .st-nav-room {
        display: none;
    }
    .st-nav-name {
        display: none;
    }

    .st-pin-card {
        padding: 28px 20px;
    }

    .st-pin-digit {
        width: 42px;
        height: 52px;
        font-size: 24px;
    }

    .st-pick-card {
        padding: 24px 16px;
    }

    .st-name-grid {
        gap: 10px;
    }

    .st-name-btn {
        min-height: 54px;
        font-size: 16px;
    }
}

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