:root {
    color-scheme: dark;
    --bg: #06140c;
    --bg-card: #0c1f14;
    --bg-elevated: #122a1b;
    --purple: #39ff14;
    --purple-light: #7dff5c;
    --purple-glow: rgba(57, 255, 20, 0.28);
    --text: #e8ffe8;
    --text-muted: #8fb89a;
    --border: rgba(57, 255, 20, 0.12);
    --radius: 12px;
    --font: 'Sora', system-ui, sans-serif;
}

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

html {
    color-scheme: dark;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    color-scheme: dark;
}

a { color: inherit; text-decoration: none; }

/* Login — Netflix-style Bilú cinema behind the card */
.login-page {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1rem;
    background: var(--bg);
}

.login-cinema {
    position: absolute;
    inset: -8% -5%;
    z-index: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.1rem;
    transform: rotate(-6deg) scale(1.12);
    pointer-events: none;
    opacity: 0.55;
    filter: saturate(1.15) contrast(1.05);
}

.login-cinema-fade {
    position: absolute;
    inset: 0;
    z-index: 2;
    background:
        radial-gradient(ellipse at 50% 45%, rgba(6, 20, 12, 0.15) 0%, rgba(6, 20, 12, 0.72) 55%, rgba(6, 20, 12, 0.94) 100%),
        linear-gradient(180deg, rgba(6, 20, 12, 0.85), transparent 18%, transparent 82%, rgba(6, 20, 12, 0.9));
}

.login-row {
    overflow: hidden;
    width: 100%;
}

.login-row-track {
    display: flex;
    width: max-content;
    gap: 0.85rem;
    will-change: transform;
}

.login-row--ltr .login-row-track {
    animation: login-marquee-ltr 55s linear infinite;
}

.login-row--rtl .login-row-track {
    animation: login-marquee-rtl 48s linear infinite;
}

.login-row--slow .login-row-track {
    animation-duration: 70s;
}

.login-poster {
    flex: 0 0 auto;
    width: clamp(110px, 14vw, 168px);
    aspect-ratio: 3 / 4;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(57, 255, 20, 0.08);
    background: #041009;
}

.login-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: hue-rotate(-8deg) brightness(0.92);
}

@keyframes login-marquee-ltr {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

@keyframes login-marquee-rtl {
    from { transform: translateX(-50%); }
    to { transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
    .login-row-track { animation: none !important; }
}

.login-card {
    position: relative;
    z-index: 1;
    width: min(420px, 92vw);
    background: rgba(12, 31, 20, 0.88);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.65),
        0 0 0 1px rgba(57, 255, 20, 0.06),
        0 0 60px rgba(57, 255, 20, 0.08);
    backdrop-filter: blur(14px);
}

.brand { text-align: center; margin-bottom: 2rem; }
.brand h1 { font-size: 1.75rem; font-weight: 700; margin-top: 1rem; }
.brand p { color: var(--text-muted); font-size: 0.9rem; }

.brand-icon {
    width: 64px; height: 64px;
    margin: 0 auto;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--purple), #0d7a3f);
    color: #041009;
    display: grid; place-items: center;
    font-size: 1.75rem; font-weight: 700;
    box-shadow: 0 8px 32px var(--purple-glow);
}
.brand-icon.sm { width: 36px; height: 36px; font-size: 1rem; border-radius: 10px; }

.login-form label { display: block; margin-bottom: 1rem; }
.login-form span { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.login-form input {
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
}
.login-form input:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px var(--purple-glow);
}

.btn-primary {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.9rem;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--purple), #0d7a3f);
    color: #041009;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 24px var(--purple-glow); }

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
}
.btn-ghost:hover { border-color: var(--purple); color: var(--text); }

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* App shell */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px;
    background: #041009;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    margin-bottom: 2rem;
    padding: 0 0.5rem;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 0.15rem;
}

/* Plataformas na sidebar */
.platforms-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.platform-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.platform-item-row {
    display: flex;
    align-items: stretch;
    gap: 0.25rem;
}
.platform-item-row .platform-item {
    flex: 1;
    min-width: 0;
}
.platform-toggle {
    flex: 0 0 34px;
    width: 34px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: grid;
    place-items: center;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}
.platform-toggle:hover,
.platform-group.is-open .platform-toggle {
    background: rgba(57, 255, 20, 0.12);
    border-color: rgba(57, 255, 20, 0.35);
    color: var(--purple);
}
.platform-chevron {
    display: inline-block;
    font-size: 0.85rem;
    line-height: 1;
    transition: transform 0.15s ease;
}
.platform-group:not(.is-open) .platform-chevron {
    transform: rotate(-90deg);
}
.platform-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-start;
    padding: 0.7rem 0.75rem;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 500;
}
.platform-item:hover,
.platform-item.active {
    background: rgba(57, 255, 20, 0.12);
    border-color: rgba(57, 255, 20, 0.4);
    color: var(--purple);
}
.home-item .home-icon {
    font-size: 1.1rem;
    line-height: 1;
    color: inherit;
}
.platform-label {
    flex: 1;
    min-width: 0;
    line-height: 1.25;
}
.platform-count {
    flex: 0 0 auto;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    opacity: 0.85;
}
.platform-item.active .platform-count,
.platform-item:hover .platform-count {
    color: inherit;
}
.platform-submenu {
    list-style: none;
    margin: 0 0 0.25rem 0.35rem;
    padding: 0.2rem 0 0.2rem 0.55rem;
    border-left: 1px solid rgba(57, 255, 20, 0.22);
    max-height: min(42vh, 360px);
    overflow-y: auto;
}
.platform-subitem {
    display: block;
    padding: 0.4rem 0.55rem;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.3;
    transition: background 0.12s, color 0.12s;
}
.platform-subitem:hover,
.platform-subitem.active {
    background: rgba(57, 255, 20, 0.1);
    color: var(--purple-light);
}
.platform-submenu-empty {
    padding: 0.4rem 0.55rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    opacity: 0.8;
}
.platform-logo {
    display: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    color: var(--purple-light);
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}
.nav-item svg { width: 20px; height: 20px; }
.nav-item.active, .nav-item:hover {
    background: var(--purple);
    color: white;
}

.sidebar-footer { margin-top: auto; }
.user-pill {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--purple);
    display: grid; place-items: center;
    font-size: 0.8rem; font-weight: 600;
    color: #fff;
    flex-shrink: 0;
    overflow: hidden;
}
.avatar--image {
    object-fit: cover;
    display: block;
    background: transparent;
}
.user-pill--link {
    text-decoration: none;
    color: inherit;
    border-radius: 10px;
    padding: 0.35rem 0.4rem;
    margin: 0 -0.4rem 0.75rem;
    transition: background 0.15s ease;
}
.user-pill--link:hover,
.user-pill--link.active {
    background: rgba(255,255,255,0.06);
    color: var(--text);
}
.profile-avatar-row {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}
.profile-avatar-preview {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    flex-shrink: 0;
}
.profile-avatar-fallback {
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--purple), #0d7a3f);
    color: #041009;
    font-size: 2rem;
    font-weight: 700;
}
.profile-avatar-fields {
    flex: 1;
    min-width: 0;
}
.file-field input[type="file"],
.profile-form input[type="file"],
.admin-card input[type="file"] {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background-color: var(--bg-elevated);
    color: var(--text-muted);
    font: inherit;
    font-size: 0.9rem;
    color-scheme: dark;
    cursor: pointer;
}
.file-field input[type="file"]::file-selector-button,
.profile-form input[type="file"]::file-selector-button,
.admin-card input[type="file"]::file-selector-button,
.file-field input[type="file"]::-webkit-file-upload-button,
.profile-form input[type="file"]::-webkit-file-upload-button,
.admin-card input[type="file"]::-webkit-file-upload-button {
    margin-right: 0.85rem;
    padding: 0.55rem 1rem;
    border: 1px solid rgba(57, 255, 20, 0.45);
    border-radius: 8px;
    background: linear-gradient(135deg, var(--purple), #0d7a3f);
    color: #041009;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}
.file-field input[type="file"]:hover::file-selector-button,
.profile-form input[type="file"]:hover::file-selector-button,
.admin-card input[type="file"]:hover::file-selector-button,
.file-field input[type="file"]:hover::-webkit-file-upload-button,
.profile-form input[type="file"]:hover::-webkit-file-upload-button,
.admin-card input[type="file"]:hover::-webkit-file-upload-button {
    filter: brightness(1.08);
}
.main-content {
    flex: 1;
    padding: 2rem 2.5rem 4rem;
    overflow-x: hidden;
}

.page-header { margin-bottom: 2.5rem; }
.page-header h1 { font-size: 2rem; font-weight: 700; }
.page-header p { color: var(--text-muted); margin-top: 0.25rem; }

.home-header {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.home-search-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem 1.25rem;
    width: 100%;
}

.home-search {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.65rem;
    flex: 1 1 520px;
    min-width: 0;
    max-width: 980px;
}

.home-course-count {
    flex: 0 0 auto;
    margin: 0;
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.92rem;
    white-space: nowrap;
    text-align: right;
}

.home-course-count strong {
    color: var(--purple);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.home-search__query {
    flex: 1 1 280px;
    min-width: 220px;
    position: relative;
    display: flex;
    align-items: center;
}

.home-search__icon {
    position: absolute;
    left: 0.9rem;
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
    line-height: 1;
}

.home-search__query input[type="search"],
.home-search__query input[type="text"],
.home-search input,
.home-search select {
    width: 100%;
    height: 44px;
    margin: 0;
    padding: 0 1rem 0 2.35rem;
    border: 1px solid var(--border) !important;
    border-radius: 999px !important;
    background-color: #1a1a1a !important;
    background-image: none !important;
    color: #ffffff !important;
    caret-color: #ffffff;
    font: inherit;
    font-size: 0.95rem;
    color-scheme: dark !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

.home-search__select,
.home-search select.home-search__select {
    flex: 0 1 180px;
    min-width: 150px;
    width: auto;
    padding: 0 2rem 0 0.95rem !important;
    background-color: #1a1a1a !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23a3a3a3' d='M1.4.6 6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.9rem center !important;
    color: #ffffff !important;
    font-size: 0.9rem;
    cursor: pointer;
}

.home-search__query input[type="search"]::placeholder,
.home-search__query input[type="text"]::placeholder,
.home-search input::placeholder {
    color: #a3a3a3 !important;
    opacity: 1;
}

.home-search__query input[type="search"]::-webkit-search-decoration,
.home-search__query input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}

.home-search__select option,
.home-search select option {
    background-color: #141414;
    color: #ffffff;
}

.home-search__query input:focus,
.home-search__select:focus,
.home-search input:focus,
.home-search select:focus {
    outline: none;
    border-color: var(--purple) !important;
    box-shadow: 0 0 0 3px var(--purple-glow);
}

/* Chrome/Edge autofill forces a pale yellow/white field otherwise */
.home-search input:-webkit-autofill,
.home-search input:-webkit-autofill:hover,
.home-search input:-webkit-autofill:focus {
    -webkit-text-fill-color: #ffffff !important;
    -webkit-box-shadow: 0 0 0 1000px #1a1a1a inset !important;
    transition: background-color 99999s ease-in-out 0s;
    caret-color: #ffffff;
}

.home-search__submit {
    flex: 0 0 auto;
    height: 44px;
    margin: 0;
    padding: 0 1.35rem;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--purple), #0d7a3f);
    color: #041009;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    width: auto;
}

.home-search__submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px var(--purple-glow);
}

.home-search__clear {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    margin: 0;
    padding: 0 1.1rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 0.9rem;
    white-space: nowrap;
    background: transparent;
}

.home-search__clear:hover {
    border-color: var(--purple);
    color: var(--text);
}

.section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.section-heading .section-title { margin-bottom: 0; }
.section-link {
    color: var(--purple-light);
    font-size: 0.9rem;
}
.section-link:hover { color: var(--text); }
.section-count {
    margin-left: 0.5rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
}

.search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
}
.search-grid .course-card {
    width: 100%;
    flex: none;
}
.is-hidden { display: none !important; }
.home-live-results { min-height: 12rem; }

.welcome-empty {
    max-width: 560px;
    margin: 4rem auto;
    text-align: center;
    padding: 2.5rem 1.5rem;
    background: linear-gradient(180deg, rgba(57, 255, 20, 0.12), transparent);
    border: 1px solid var(--border);
    border-radius: 20px;
}
.welcome-empty .brand-icon {
    margin: 0 auto 1.25rem;
}
.welcome-empty h2 {
    font-size: 1.6rem;
    margin-bottom: 0.75rem;
}
.welcome-empty p {
    color: var(--text-muted);
}
.welcome-empty__hint {
    margin-top: 0.75rem;
    font-size: 0.95rem;
}

@media (max-width: 760px) {
    .home-search__select {
        flex: 1 1 calc(50% - 0.65rem);
    }
    .home-search__submit,
    .home-search__clear {
        flex: 1 1 auto;
    }
    .home-course-count {
        width: 100%;
        margin-left: 0;
        text-align: left;
    }
}

/* Carousel / Netflix cards */
.carousel-section { margin-bottom: 2.5rem; }
.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text);
}

.carousel-row {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    scrollbar-color: var(--purple) transparent;
}
.carousel-row::-webkit-scrollbar { height: 6px; }
.carousel-row::-webkit-scrollbar-thumb { background: var(--purple); border-radius: 3px; }

/* Desenho 101 — grade em colunas por subcategoria */
.d101-section { margin-bottom: 2.5rem; }
.d101-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}
.d101-grid .course-card {
    width: 100%;
    flex: none;
    max-width: 280px;
    justify-self: center;
}
.d101-card {
    flex: none;
    scroll-snap-align: unset;
}
.d101-card .course-card__overlay h3 {
    font-size: 0.75rem;
    line-height: 1.25;
    text-transform: none;
    letter-spacing: 0;
}

.course-card {
    flex: 0 0 260px;
    scroll-snap-align: start;
    transition: transform 0.25s ease;
}
.course-card:hover { transform: scale(1.05); z-index: 2; }

.course-card__media {
    aspect-ratio: 2/3;
    border-radius: var(--radius);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #111;
}
.course-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}
.course-card__media.has-bilu-placeholder img {
    object-position: center center;
    filter: contrast(1.05) saturate(1.1);
}
.course-card__media.has-bilu-placeholder::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at center, rgba(6, 20, 12, 0.15), rgba(6, 20, 12, 0.55)),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Ccircle cx='32' cy='32' r='18' fill='none' stroke='%2339ff14' stroke-width='2' opacity='0.9'/%3E%3Cpolygon points='28,22 46,32 28,42' fill='%2339ff14'/%3E%3C/svg%3E") center 42% / 72px 72px no-repeat;
    pointer-events: none;
    z-index: 1;
}

.course-hero__bg-wrap {
    position: absolute;
    inset: 0;
}
.course-hero__bg-wrap.has-bilu-placeholder::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at center, rgba(6, 20, 12, 0.2), rgba(6, 20, 12, 0.65)),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Ccircle cx='32' cy='32' r='18' fill='none' stroke='%2339ff14' stroke-width='2' opacity='0.9'/%3E%3Cpolygon points='28,22 46,32 28,42' fill='%2339ff14'/%3E%3C/svg%3E") center 40% / 96px 96px no-repeat;
    pointer-events: none;
    z-index: 1;
}

.card-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255,255,255,0.2);
    z-index: 2;
}
.card-progress span {
    display: block;
    height: 100%;
    background: var(--purple);
}

.course-card__image {
    aspect-ratio: 2/3;
    border-radius: var(--radius);
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
}

.course-card__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.35) 35%, transparent 55%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1rem;
}

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}
.badge {
    font-size: 0.55rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    background: rgba(0,0,0,0.55);
    color: rgba(255,255,255,0.9);
}

.course-card__overlay h3 {
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.professor {
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    letter-spacing: 0.05em;
}
.progress-text {
    font-size: 0.65rem;
    color: var(--purple-light);
    margin-top: 0.35rem;
}

/* Progress bars */
.progress-bar {
    height: 4px;
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.35rem;
}
.progress-bar.large { height: 6px; margin: 0.75rem 0 0.35rem; }
.progress-bar.thin { height: 3px; }
.progress-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--purple), var(--purple-light));
    border-radius: 2px;
    transition: width 0.3s ease;
}
.progress-label { font-size: 0.8rem; color: var(--text-muted); }

/* Continue watching */
.continue-section { margin-bottom: 2rem; }
.continue-card .course-card__overlay {
    background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, transparent 60%);
}
.continue-label {
    font-size: 0.8rem;
    font-weight: 600;
    display: block;
    margin-bottom: 0.35rem;
}
.continue-course {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Course detail */
.back-link {
    display: inline-block;
    color: var(--purple-light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}
.back-link:hover { color: var(--text); }

.course-hero {
    min-height: 360px;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
}
.course-hero__bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}
.course-hero__shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, #0a0a0a 0%, rgba(10,10,10,0.55) 35%, transparent 65%);
}
.course-hero__info {
    position: relative;
    z-index: 1;
    max-width: 600px;
}
.course-progress-block { margin-top: 1rem; }
.btn-resume {
    display: inline-block;
    width: auto;
    margin-top: 1rem;
    padding: 0.7rem 1.25rem;
    font-size: 0.9rem;
    text-align: center;
}
.course-hero h1 { font-size: 2.25rem; font-weight: 700; margin: 0.75rem 0; }
.course-hero p { color: #d4d4d4; font-size: 0.95rem; }

.module-block { margin-bottom: 2rem; }
.module-block h2 {
    font-size: 1.1rem;
    color: var(--purple-light);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.lessons-grid { display: grid; gap: 0.5rem; }
.lesson-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color 0.15s, background 0.15s;
}
.lesson-item:hover { border-color: var(--purple); background: var(--bg-elevated); }
.lesson-item.has-video .lesson-num { color: var(--purple-light); }
.lesson-num { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; min-width: 24px; }
.lesson-item strong { display: block; font-size: 0.9rem; }
.lesson-info { flex: 1; min-width: 0; }
.lesson-meta { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.lesson-item small { color: var(--text-muted); font-size: 0.75rem; }
.lesson-progress-tag { color: var(--purple-light) !important; }
.offline-tag { color: #4ade80 !important; }

/* Watch page */
.watch-layout { min-height: 100vh; background: var(--bg); }
.watch-header {
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    background: #041009;
}
.watch-header h1 { font-size: 1.1rem; margin-top: 0.25rem; }

.watch-body {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 0;
    min-height: calc(100vh - 80px);
}

.player-area {
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}
.player-wrap {
    width: 100%;
    position: relative;
}
.player-area video,
.player-area iframe {
    width: 100%;
    max-height: calc(100vh - 160px);
    aspect-ratio: 16/9;
    border: none;
    background: #000;
}
.player-area iframe.pdf-viewer {
    aspect-ratio: auto;
    min-height: calc(100vh - 200px);
    height: calc(100vh - 200px);
}
.pdf-actions {
    padding: 0.75rem;
    text-align: center;
}
.pdf-tag { color: var(--purple-light); }
.file-download-panel {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text);
}
.file-download-panel p {
    color: var(--text-muted);
    margin: 0.75rem 0 1.5rem;
}
.content-lesson-panel {
    width: 100%;
    min-height: 320px;
    max-height: min(75vh, 900px);
    overflow: auto;
    padding: 1.25rem 1.5rem;
    background: #0d0d0d;
    color: var(--text);
    text-align: left;
    border-radius: 0;
}
.content-lesson-panel a {
    color: var(--purple-light);
    word-break: break-word;
}
.content-lesson-panel img {
    max-width: 100%;
    height: auto;
}
.file-tag { color: #7dd3fc; }
.platform-logo--blend {
    width: 100%;
    height: auto;
    max-height: 48px;
    object-fit: contain;
    filter: none;
    mix-blend-mode: screen;
}
.player-controls-extra {
    display: flex;
    justify-content: flex-end;
    padding: 0.5rem 0.75rem;
    background: #0d0d0d;
    border-top: 1px solid var(--border);
}
.quality-select {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.quality-select select {
    background-color: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.35rem 0.5rem;
    font-family: inherit;
    color-scheme: dark;
}
.quality-select select option {
    background-color: var(--bg-card);
    color: var(--text);
}
.no-video {
    color: var(--text-muted);
    padding: 3rem;
    text-align: center;
}

.watch-sidebar {
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    padding: 1.25rem;
    overflow-y: auto;
    max-height: calc(100vh - 80px);
}
.watch-sidebar h3 { font-size: 0.9rem; margin-bottom: 1rem; color: var(--text-muted); }
.sidebar-module { margin-bottom: 1.25rem; }
.sidebar-module h4 {
    font-size: 0.8rem;
    color: var(--purple-light);
    margin-bottom: 0.5rem;
}
.sidebar-lesson {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}
.sidebar-lesson small { color: var(--purple-light); font-size: 0.7rem; flex-shrink: 0; }
.sidebar-lesson:hover { background: var(--bg-elevated); color: var(--text); }
.sidebar-lesson.active { background: var(--purple); color: #041009; }

.lesson-description {
    padding: 2rem;
    max-width: 900px;
    color: #d4d4d4;
    font-size: 0.95rem;
    line-height: 1.6;
}
.lesson-description h3 {
    margin: 0 0 0.75rem;
    color: var(--text);
    font-size: 1.05rem;
}
.lesson-description h4 { margin: 1rem 0 0.5rem; color: var(--text); }

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}
.empty-state code {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border-radius: 8px;
    color: var(--purple-light);
}

/* Admin */
.admin-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.admin-eyebrow {
    color: var(--purple-light);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.35rem;
}
.btn-inline {
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.25rem;
    margin-top: 0;
    text-decoration: none;
}
.alert-success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #86efac;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.error-list { margin: 0; padding-left: 1.1rem; }
.admin-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.admin-table th,
.admin-table td {
    padding: 0.9rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.admin-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-platforms-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.platform-chip {
    display: inline-flex;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    font-size: 0.72rem;
    color: var(--text-muted);
}
.admin-badge {
    display: inline-flex;
    margin-left: 0.4rem;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
}
.admin-badge.admin { background: rgba(57, 255, 20, 0.2); color: var(--purple-light); margin-left: 0; }
.admin-badge.student { background: rgba(255,255,255,0.06); color: var(--text-muted); margin-left: 0; }
.admin-badge.you { background: rgba(34, 197, 94, 0.15); color: #86efac; }
.admin-badge.active { background: rgba(34, 197, 94, 0.15); color: #86efac; margin-left: 0; }
.admin-badge.inactive { background: rgba(239, 68, 68, 0.15); color: #fca5a5; margin-left: 0; }
.admin-table tr.is-inactive td { opacity: 0.55; }
.admin-switch {
    display: flex !important;
    align-items: flex-start;
    gap: 0.75rem;
    margin-top: 0.5rem;
    cursor: pointer;
}
.admin-switch input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    margin-top: 0.2rem;
    accent-color: var(--purple);
    flex-shrink: 0;
}
.admin-switch strong {
    display: block;
    color: var(--text);
    font-size: 0.95rem;
}
.admin-switch small {
    display: block;
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-top: 0.15rem;
}
.password-reveal {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.password-reveal__label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}
.password-reveal__row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.password-reveal__input {
    flex: 1;
    min-width: 0;
}
.admin-actions {
    display: flex;
    gap: 0.4rem;
    justify-content: flex-end;
    white-space: nowrap;
}
.btn-ghost.danger { color: #fca5a5; }
.btn-ghost.danger:hover { border-color: #ef4444; color: #fecaca; }
.admin-form {
    display: grid;
    gap: 1rem;
    max-width: 760px;
}
.admin-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.4rem;
}
.admin-card h2 {
    font-size: 1rem;
    margin-bottom: 1rem;
}
.admin-card label {
    display: block;
    margin-bottom: 0.9rem;
}
.admin-card label span {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}
.admin-card input[type="text"],
.admin-card input[type="email"],
.admin-card input[type="password"],
.admin-card input[type="search"],
.admin-card select,
.admin-card textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background-color: var(--bg-elevated);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    color-scheme: dark;
}
.admin-card select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23a3a3a3' d='M1.4.6 6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    padding-right: 2rem;
}
.admin-card select option {
    background-color: var(--bg-card);
    color: var(--text);
}
.admin-card input[type="text"]:focus,
.admin-card input[type="email"]:focus,
.admin-card input[type="password"]:focus,
.admin-card input[type="search"]:focus,
.admin-card input[type="file"]:focus,
.admin-card select:focus,
.admin-card textarea:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px var(--purple-glow);
}
.form-hint {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-bottom: 0.85rem;
}
.platform-checks {
    display: grid;
    gap: 0.55rem;
}
.platform-check {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-elevated);
    cursor: pointer;
    margin-bottom: 0 !important;
}
.platform-check input {
    margin-top: 0.25rem;
    accent-color: var(--purple);
}
.platform-check-body {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.platform-check-body strong { font-size: 0.92rem; }
.platform-check-body small { color: var(--text-muted); font-size: 0.75rem; }
.admin-form-actions { margin-top: 0.25rem; }
.admin-reset-form { margin-top: 1.5rem; }
.admin-link {
    display: block;
    text-align: center;
    margin-bottom: 0.75rem;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
}
.admin-link:hover,
.admin-link.active {
    border-color: var(--purple);
    color: var(--text);
    background: rgba(57, 255, 20, 0.12);
}
.text-muted { color: var(--text-muted); }

/* Bilú AI agent */
.bilu-agent {
    position: fixed;
    right: 1.1rem;
    bottom: 1.1rem;
    z-index: 1200;
    font-family: var(--font);
}

.bilu-agent__fab {
    position: relative;
    width: 64px;
    height: 64px;
    border: 2px solid rgba(57, 255, 20, 0.55);
    border-radius: 50%;
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    background: #041009;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 0 24px rgba(57, 255, 20, 0.25);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.bilu-agent__fab:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5), 0 0 30px rgba(57, 255, 20, 0.35);
}

.bilu-agent__fab img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: contrast(1.05) saturate(1.1);
}

.bilu-agent__pulse {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(57, 255, 20, 0.45);
    animation: bilu-pulse 2.2s ease-out infinite;
    pointer-events: none;
}

@keyframes bilu-pulse {
    0% { transform: scale(0.92); opacity: 0.85; }
    70% { transform: scale(1.18); opacity: 0; }
    100% { opacity: 0; }
}

.bilu-agent__panel {
    position: absolute;
    right: 0;
    bottom: calc(64px + 0.75rem);
    width: min(380px, calc(100vw - 1.5rem));
    height: min(520px, calc(100vh - 7rem));
    display: flex;
    flex-direction: column;
    background: rgba(8, 22, 14, 0.96);
    border: 1px solid rgba(57, 255, 20, 0.22);
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), 0 0 40px rgba(57, 255, 20, 0.08);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.bilu-agent__panel[hidden] { display: none !important; }

.bilu-agent__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 0.95rem;
    border-bottom: 1px solid rgba(57, 255, 20, 0.12);
    background: linear-gradient(180deg, rgba(57, 255, 20, 0.08), transparent);
}

.bilu-agent__identity {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
}

.bilu-agent__identity img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(57, 255, 20, 0.35);
}

.bilu-agent__identity strong {
    display: block;
    font-size: 0.95rem;
    line-height: 1.2;
}

.bilu-agent__identity span {
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.bilu-agent__close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.bilu-agent__close:hover {
    color: var(--text);
    background: rgba(57, 255, 20, 0.1);
}

.bilu-agent__messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.bilu-msg { display: flex; }
.bilu-msg--user { justify-content: flex-end; }
.bilu-msg--assistant { justify-content: flex-start; }

.bilu-msg__bubble {
    max-width: 88%;
    padding: 0.7rem 0.85rem;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.45;
    word-break: break-word;
}

.bilu-msg--user .bilu-msg__bubble {
    background: rgba(57, 255, 20, 0.18);
    border: 1px solid rgba(57, 255, 20, 0.28);
    border-bottom-right-radius: 5px;
}

.bilu-msg--assistant .bilu-msg__bubble {
    background: rgba(18, 42, 27, 0.95);
    border: 1px solid rgba(57, 255, 20, 0.1);
    border-bottom-left-radius: 5px;
}

.bilu-msg__bubble a,
.bilu-inline-link {
    color: var(--purple-light);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 600;
    cursor: pointer;
}

.bilu-msg__chips {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.45rem;
    max-width: 95%;
}

.bilu-chip {
    display: block;
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    border: 1px solid rgba(57, 255, 20, 0.28);
    background: rgba(57, 255, 20, 0.1);
    color: var(--text) !important;
    text-decoration: none !important;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.3;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.bilu-chip:hover {
    background: rgba(57, 255, 20, 0.2);
    border-color: rgba(57, 255, 20, 0.55);
    transform: translateX(2px);
}

.bilu-msg--typing .bilu-msg__bubble {
    display: inline-flex;
    gap: 0.3rem;
    align-items: center;
    min-width: 48px;
}

.bilu-msg--typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--purple);
    opacity: 0.45;
    animation: bilu-dot 1s infinite ease-in-out;
}

.bilu-msg--typing span:nth-child(2) { animation-delay: 0.15s; }
.bilu-msg--typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bilu-dot {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
    40% { transform: translateY(-3px); opacity: 1; }
}

.bilu-agent__form {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid rgba(57, 255, 20, 0.12);
    background: rgba(6, 20, 12, 0.85);
}

.bilu-agent__form input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text);
    border-radius: 10px;
    padding: 0.7rem 0.85rem;
    font: inherit;
    font-size: 0.9rem;
}

.bilu-agent__form input:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px var(--purple-glow);
}

.bilu-agent__send {
    border: none;
    border-radius: 10px;
    padding: 0 0.95rem;
    background: linear-gradient(135deg, var(--purple), #0d7a3f);
    color: #041009;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.bilu-agent__send:disabled {
    opacity: 0.55;
    cursor: wait;
}

@media (max-width: 600px) {
    .bilu-agent { right: 0.75rem; bottom: 0.75rem; }
    .bilu-agent__panel {
        width: calc(100vw - 1.25rem);
        height: min(70vh, 520px);
    }
}

@media (max-width: 900px) {
    .app-shell { flex-direction: column; }
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }
    .sidebar-nav { display: none; }
    .watch-body { grid-template-columns: 1fr; }
    .watch-sidebar { max-height: none; border-left: none; border-top: 1px solid var(--border); }
}
