/**
 * Superable Course Player Engine — layout stylesheet.
 *
 * Generic course-player chrome (sidebar nav, module list, content area, nav
 * buttons). Consumes tenant branding as CSS custom properties set elsewhere
 * (--color-primary, --color-bg-light, --color-text-dark, etc.) rather than
 * hardcoding any tenant-specific values here — that's the interface boundary
 * between this file and the platform's tenant branding CSS.
 *
 * Extracted unchanged from player.php's former inline <style> block.
 */

.player-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

@media(min-width: 900px) {
    .player-layout {
        grid-template-columns: 320px 1fr; /* Slightly wider for nested nav */
    }
}

/* Sidebar Nav Styles */
.sidebar-nav {
    background: white;
    border-radius: 0.5rem;
    border: 1px solid #e5e5e5;
    padding: 1.5rem;
    height: fit-content;
    /* Sticky positioning for long reading */
    position: sticky;
    top: 2rem;
}

/* Accordion Overrides for Sidebar */
.sidebar-nav jw-accordion {
    display: block;
    margin-top: 1rem;
}

.sidebar-nav .jw-accordion-header {
    margin: 0;
    font-size: 1rem;
}

.sidebar-nav .jw-accordion-trigger {
    padding: 0.75rem;
    background: var(--color-bg-light);
    border: 1px solid #e5e5e5;
    border-radius: 0.25rem;
    font-weight: 700;
}

.sidebar-nav .jw-accordion-panel {
    padding: 0.5rem 0 0.5rem 1rem;
    border-left: 2px solid var(--color-primary);
}

.module-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.module-btn {
    width: 100%;
    text-align: left;
    padding: 0.75rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0.25rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text-dark);
    transition: all 0.2s ease;
    position: relative;
}

.module-btn:hover, .module-btn:focus-visible {
    background-color: var(--color-bg-light);
    border-color: var(--color-primary);
    outline-offset: -2px;
}

.module-btn[aria-current="true"] {
    background-color: var(--color-primary);
    color: white;
    font-weight: 700;
}

/* Add a checkmark visual for completed items */
.module-btn.completed::after {
    content: "✓";
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-success-text);
    font-weight: bold;
}

.module-btn[aria-current="true"].completed::after {
    color: white; /* Contrast fix when active */
}

/* Content Area Styles */
.content-area {
    background: white;
    border-radius: 0.5rem;
    border: 1px solid #e5e5e5;
    padding: 2rem;
    min-height: 50vh;
}

.resume-prompt-card {
    background-color: #f8fafc;
    color: var(--color-text-dark);
}

[data-theme="dark"] .sidebar-nav,
[data-theme="dark"] .content-area {
    background: #1E293B;
    border-color: #334155;
    color: #F8FAFC;
    /* Redefine the two tokens this file's own chrome (.module-btn, .nav-btn, the accordion
       trigger) reads via var(--color-bg-light)/var(--color-text-dark), scoped to these
       containers. Without this, a host page that never loads the platform's style.css --
       exactly what examples/vanilla-embed/ does by design, since this engine has no
       dependency on that file -- leaves those two custom properties at whatever light-mode
       default the host page set (or unset entirely), so .module-btn's text and .nav-btn's
       background/text stay light-mode-colored here even though this block just made their
       container dark: near-invisible course navigation. Found 2026-09-14 building the
       presenter/course integration proof-of-concept. */
    --color-bg-light: #1E293B;
    --color-text-dark: #F8FAFC;
}

[data-theme="dark"] .resume-prompt-card {
    background-color: #1E293B;
    color: #F8FAFC;
}

@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) .sidebar-nav,
    html:not([data-theme="light"]) .content-area {
        background: #1E293B;
        border-color: #334155;
        color: #F8FAFC;
        /* Mirrors the [data-theme="dark"] block's 2026-09-14 addition above -- keep in sync. */
        --color-bg-light: #1E293B;
        --color-text-dark: #F8FAFC;
    }

    html:not([data-theme="light"]) .resume-prompt-card {
        background-color: #1E293B;
        color: #F8FAFC;
    }
}

.completion-container {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px dashed #e5e5e5;
    text-align: right;
}

.content-loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Module Navigation Row */
.module-nav-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px dashed #e5e5e5;
}

.nav-btn {
    background-color: var(--color-bg-light);
    color: var(--color-text-dark);
    border: 2px solid var(--color-neutral-mid);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-btn:hover:not(:disabled) {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    visibility: hidden; /* Hide completely when at boundaries */
}
