/* ============================================================
   SeriesTracker — Main Stylesheet
   Dark-first design inspired by TV Time UX.
   ============================================================ */

/* --- CSS Variables --- */
:root,
.theme-dark {
    --bg-primary:       #0f0f1a;
    --bg-secondary:     #1a1a2e;
    --bg-card:          #1e1e36;
    --bg-card-hover:    #252545;
    --bg-input:         #252545;
    --bg-nav:           #14142a;
    --bg-modal:         rgba(0, 0, 0, 0.7);

    --text-primary:     #e8e8f0;
    --text-secondary:   #9a9ab0;
    --text-muted:       #6b6b85;
    --text-inverse:     #0f0f1a;

    --accent:           #0ea5e9;
    --accent-hover:     #38bdf8;
    --accent-dim:       rgba(14, 165, 233, 0.15);
    --accent-glow:      rgba(14, 165, 233, 0.3);

    --success:          #22c55e;
    --warning:          #eab308;
    --danger:           #ef4444;
    --info:             #3b82f6;

    --border:           #2a2a4a;
    --border-light:     #35355a;

    --radius-sm:        6px;
    --radius-md:        10px;
    --radius-lg:        16px;
    --radius-xl:        20px;

    --shadow-sm:        0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md:        0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg:        0 8px 30px rgba(0, 0, 0, 0.5);

    --font-family:      -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

    --nav-height:       64px;
    --mobile-nav-height: 60px;

    color-scheme: dark;
}

/* --- Light Theme --- */
.theme-light {
    --bg-primary:       #f5f5f8;
    --bg-secondary:     #ffffff;
    --bg-card:          #ffffff;
    --bg-card-hover:    #f0f0f5;
    --bg-input:         #f0f0f5;
    --bg-nav:           #ffffff;
    --bg-modal:         rgba(0, 0, 0, 0.4);

    --text-primary:     #1a1a2e;
    --text-secondary:   #555570;
    --text-muted:       #8888a0;
    --text-inverse:     #ffffff;

    --border:           #e0e0ea;
    --border-light:     #eaeaf0;

    --shadow-sm:        0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md:        0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg:        0 8px 30px rgba(0, 0, 0, 0.12);

    color-scheme: light;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover {
    color: var(--accent-hover);
}

img {
    max-width: 100%;
    display: block;
}

code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.9em;
}

/* --- Typography --- */
h1, h2, h3, h4 {
    font-weight: 600;
    line-height: 1.3;
}

.text-muted {
    color: var(--text-muted);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================================
   Layout
   ============================================================ */

.main-content {
    min-height: 100vh;
}
.main-content--auth {
    padding-top: var(--nav-height);
    padding-bottom: calc(var(--mobile-nav-height) + 1rem);
}

.page-header {
    padding: 1.5rem 1.5rem 0.5rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.page-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ============================================================
   Navigation
   ============================================================ */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    backdrop-filter: blur(12px);
}

.navbar__inner {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
}

.navbar__brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-primary);
    flex-shrink: 0;
}
.navbar__brand:hover {
    color: var(--text-primary);
}

.navbar__logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    color: white;
}

.navbar__title {
    font-weight: 700;
    font-size: 1.1rem;
}

.navbar__search {
    flex: 1;
    max-width: 360px;
}

.search-form {
    display: flex;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.search-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
}

.navbar__links {
    display: flex;
    gap: 0.25rem;
    flex: 1;
    justify-content: center;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}
.nav-link:hover {
    background: var(--accent-dim);
    color: var(--accent);
}
.nav-link--active {
    background: var(--accent-dim);
    color: var(--accent);
}
.nav-link--user {
    padding: 0.3rem 0.6rem;
}
.nav-link--logout {
    padding: 0.3rem;
    color: var(--text-muted);
}

.navbar__user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.navbar__username {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* --- Mobile Bottom Nav --- */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mobile-nav-height);
    background: var(--bg-nav);
    border-top: 1px solid var(--border);
    z-index: 100;
    justify-content: space-around;
    align-items: center;
    padding: 0 0.5rem;
}

.mobile-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--text-muted);
    font-size: 0.65rem;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    min-width: 56px;
}
.mobile-nav__item:hover {
    color: var(--accent);
    background: var(--accent-dim);
}
.mobile-nav__item--active {
    color: var(--accent);
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.2rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.2;
}
.btn:hover {
    transform: translateY(-1px);
}
.btn:active {
    transform: translateY(0);
}

.btn--primary {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: white;
}
.btn--primary:hover {
    box-shadow: 0 4px 15px var(--accent-glow);
    color: white;
}

.btn--outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}
.btn--outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.btn--danger {
    background: var(--danger);
    color: white;
}
.btn--danger:hover {
    background: #dc2626;
}

.btn--text {
    background: none;
    color: var(--accent);
    padding: 0.3rem 0.6rem;
}
.btn--text:hover {
    background: var(--accent-dim);
    transform: none;
}

.btn--small {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
}

.btn--large {
    padding: 0.7rem 1.5rem;
    font-size: 1rem;
}

.btn--full {
    width: 100%;
    justify-content: center;
}

/* ============================================================
   Forms
   ============================================================ */

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.form-input {
    width: 100%;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-input::placeholder {
    color: var(--text-muted);
}

.form-input--inline {
    width: auto;
    display: inline-block;
}

.form-input--large {
    padding: 0.8rem 1.2rem;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}
.form-check label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

select.form-input {
    cursor: pointer;
}

/* ============================================================
   Auth Pages
   ============================================================ */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: radial-gradient(ellipse at center, var(--bg-secondary) 0%, var(--bg-primary) 70%);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.3rem;
    color: white;
    margin: 0 auto 1rem;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-form {
    margin-bottom: 1rem;
}

.auth-footer-text {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-link {
    color: var(--accent);
    font-weight: 600;
}

/* ============================================================
   Flash Messages
   ============================================================ */

.flash-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.5rem 1.5rem;
}

.flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    animation: slideIn 0.3s ease;
}

.flash--success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--success);
}

.flash--error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.flash--info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--info);
}

.flash--warning {
    background: rgba(234, 179, 8, 0.15);
    border: 1px solid rgba(234, 179, 8, 0.3);
    color: var(--warning);
}

.flash-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.7;
    padding: 0 0.3rem;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Stats Grid
   ============================================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    padding: 1rem 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: border-color 0.2s;
}
.stat-card:hover {
    border-color: var(--border-light);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-icon--shows   { background: rgba(14, 165, 233, 0.15); color: var(--accent); }
.stat-icon--episodes { background: rgba(124, 58, 237, 0.15); color: #a78bfa; }
.stat-icon--movies  { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.stat-icon--time    { background: rgba(234, 179, 8, 0.15); color: var(--warning); }

.stat-body {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    padding: 0 1.5rem;
    max-width: 1200px;
    margin: 0 auto 1rem;
}

/* ============================================================
   Dashboard Grid
   ============================================================ */

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.dashboard-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.2rem;
    margin-bottom: 1rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-link {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 500;
}

/* ============================================================
   Show Cards (Grid)
   ============================================================ */

.show-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
}

.show-cards--list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.show-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.2s;
    color: var(--text-primary);
}
.show-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--text-primary);
}

.show-card__poster {
    aspect-ratio: 2/3;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.show-card__poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.show-card__initial {
    font-size: 2rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
}

.show-card__initial--large {
    font-size: 4rem;
}

.show-card__body {
    padding: 0.6rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.show-card__title {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.show-card__progress {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* --- Show Row (List) --- */
.show-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
    color: var(--text-primary);
}
.show-row:last-child {
    border-bottom: none;
}
.show-row:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.show-row__poster {
    width: 50px;
    height: 70px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.show-row__poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.show-row__body {
    flex: 1;
    min-width: 0;
}

.show-row__title {
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.show-row__meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.show-row__progress {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.3rem;
}

.show-row__count {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.show-row__action {
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ============================================================
   Progress Bars
   ============================================================ */

.progress-bar {
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    overflow: hidden;
    flex: 1;
}

.progress-bar--large {
    height: 8px;
    border-radius: 4px;
}

.progress-bar--small {
    height: 3px;
    width: 80px;
}

.progress-bar__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #7c3aed);
    border-radius: inherit;
    transition: width 0.4s ease;
}

/* ============================================================
   Status & Rating Badges
   ============================================================ */

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge--watching  { background: rgba(14, 165, 233, 0.15); color: var(--accent); }
.status-badge--to_watch  { background: rgba(234, 179, 8, 0.15); color: var(--warning); }
.status-badge--paused    { background: rgba(107, 107, 133, 0.15); color: var(--text-muted); }
.status-badge--completed { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.status-badge--dropped   { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.rating-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.4rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(234, 179, 8, 0.15);
    color: var(--warning);
}

.rating-badge--tmdb {
    background: rgba(14, 165, 233, 0.15);
    color: var(--accent);
}

.stars {
    display: inline-flex;
    gap: 1px;
    flex-shrink: 0;
}
.star {
    font-size: 1rem;
    line-height: 1;
}
.star--full {
    color: var(--warning);
}
.star--empty {
    color: var(--border-light);
}

.fav-badge {
    color: var(--warning);
    font-size: 1rem;
}
.fav-badge--fav {
    color: var(--danger);
}

.badge {
    display: inline-flex;
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}
.badge--show  { background: rgba(14, 165, 233, 0.15); color: var(--accent); }
.badge--movie { background: rgba(124, 58, 237, 0.15); color: #a78bfa; }
.badge--public { background: rgba(34, 197, 94, 0.15); color: var(--success); }

/* ============================================================
   Activity List
   ============================================================ */

.activity-list {
    display: flex;
    flex-direction: column;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}
.activity-item:last-child {
    border-bottom: none;
}

.activity-item--link {
    color: var(--text-primary);
    transition: background 0.15s;
    border-radius: var(--radius-sm);
    padding: 0.6rem;
    margin: 0 -0.6rem;
}
.activity-item--link:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.activity-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    flex-shrink: 0;
}

.activity-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    font-size: 0.85rem;
    min-width: 0;
}
.activity-body strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================================
   Next Episodes
   ============================================================ */

.next-episodes {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.next-episode-card {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: background 0.15s;
}
.next-episode-card:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.next-episode__poster {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.next-episode__body {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    font-size: 0.85rem;
    min-width: 0;
}

.next-episode__show {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.next-episode__ep {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.next-episode__date {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ============================================================
   Filter Tabs
   ============================================================ */

.filter-tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.filter-tab {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    white-space: nowrap;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.filter-tab:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.filter-tab--active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.filter-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.05rem 0.4rem;
    border-radius: 10px;
    font-size: 0.7rem;
}

/* ============================================================
   Show Detail
   ============================================================ */

.show-hero {
    padding: 2rem 1.5rem;
    position: relative;
}

.show-hero__inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.show-hero__poster {
    width: 200px;
    min-height: 280px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-lg);
}

.show-hero__poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.show-hero__info {
    flex: 1;
    min-width: 0;
}

.show-hero__title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.show-hero__original {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.show-hero__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.show-hero__overview {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    max-width: 700px;
}

.show-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.show-progress {
    margin-top: 1rem;
}

.show-progress__text {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* ============================================================
   Episodes / Seasons
   ============================================================ */

.show-episodes {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

.season-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.season-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.season-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}
.season-header:hover {
    background: var(--bg-card-hover);
}

.season-header__left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.season-chevron {
    transition: transform 0.2s;
    color: var(--text-muted);
}
.season-card--open .season-chevron {
    transform: rotate(90deg);
}

.season-title {
    font-size: 0.95rem;
    font-weight: 600;
}

.season-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.season-header__right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.season-body {
    display: none;
    border-top: 1px solid var(--border);
}
.season-card--open .season-body {
    display: block;
}

.episode-list {
    display: flex;
    flex-direction: column;
}

.episode-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(42, 42, 74, 0.5);
}
.episode-row:last-child {
    border-bottom: none;
}
.episode-row:hover {
    background: var(--bg-card-hover);
}

.episode-row--watched {
    opacity: 0.7;
}
.episode-row--watched:hover {
    opacity: 1;
}

.episode-check {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    display: flex;
}

.check-box {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.check-box--checked {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.episode-number {
    color: var(--text-muted);
    font-weight: 600;
    min-width: 2.2rem;
}

.episode-title {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.episode-date,
.episode-runtime {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.episode-rating {
    flex-shrink: 0;
}

.rating-select {
    padding: 0.15rem 0.3rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.75rem;
    cursor: pointer;
}

/* ============================================================
   Movie Detail Rating
   ============================================================ */

.movie-rating-section {
    margin-top: 1rem;
}
.movie-rating-section h3 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.star-rating {
    display: flex;
    gap: 0.3rem;
}

.star {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}
.star:hover,
.star--active {
    background: var(--warning);
    border-color: var(--warning);
    color: black;
}

/* ============================================================
   Lists
   ============================================================ */

.lists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.75rem;
    padding: 0 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.list-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.2rem;
    transition: all 0.2s;
    color: var(--text-primary);
}
.list-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--text-primary);
}

.list-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.3rem;
}

.list-card__title {
    font-size: 1rem;
    font-weight: 700;
}

.list-card__desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.list-card__meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ============================================================
   Search
   ============================================================ */

.search-page-form {
    padding: 0 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.search-input-group {
    display: flex;
    gap: 0.5rem;
}

.search-results {
    max-width: 1200px;
    margin: 1rem auto;
    padding: 0 1.5rem;
}

/* ============================================================
   Calendar
   ============================================================ */

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.calendar-title {
    font-size: 1.2rem;
    font-weight: 700;
}

.calendar-grid {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.5rem 0;
}

.calendar-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}
.calendar-day:hover {
    background: var(--bg-card-hover);
}
.calendar-day--other {
    color: var(--text-muted);
    opacity: 0.4;
}
.calendar-day--today {
    font-weight: 800;
    color: var(--accent);
}
.calendar-day--has-event::after {
    content: '';
    width: 5px;
    height: 5px;
    background: var(--accent);
    border-radius: 50%;
    position: absolute;
    bottom: 4px;
}
.calendar-day--selected {
    background: var(--accent-dim);
    border: 1px solid var(--accent);
}

.calendar-events {
    max-width: 1200px;
    margin: 1rem auto;
    padding: 0 1.5rem;
}

/* ============================================================
   Profile
   ============================================================ */

.profile-page {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.profile-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.profile-card h2 {
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
}

.profile-card__header {
    margin-bottom: 1rem;
}

.profile-card__header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.avatar {
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
}

.avatar--small {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
}

.avatar--large {
    width: 80px;
    height: 80px;
    font-size: 2rem;
}

.profile-form {
    max-width: 500px;
}

/* Cover */
.profile-cover {
    height: 180px;
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
}

.profile-cover__actions {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.4);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.6);
}

/* Profile Info */
.profile-info {
    text-align: center;
    margin-top: -40px;
    padding-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.profile-info__avatar {
    margin-bottom: 0.5rem;
}

.profile-info__avatar .avatar--large {
    margin: 0 auto;
    width: 80px;
    height: 80px;
    font-size: 2rem;
    border: 3px solid var(--bg-primary);
}

.profile-info__name {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.profile-info .btn--outline {
    border: 1px solid var(--border);
    color: var(--text-secondary);
    background: transparent;
    padding: 0.35rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 20px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    text-decoration: none;
    display: inline-block;
}

.profile-info .btn--outline:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* Stats on Profile */
.profile-stats {
    margin-bottom: 1rem;
}

.profile-stats__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stat-card__icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card__icon--series    { background: rgba(14, 165, 233, 0.15); color: var(--accent); }
.stat-card__icon--episodes  { background: rgba(124, 58, 237, 0.15); color: #a78bfa; }
.stat-card__icon--movies    { background: rgba(234, 179, 8, 0.15); color: var(--warning); }
.stat-card__icon--films     { background: rgba(34, 197, 94, 0.15); color: var(--success); }

.stat-card__body {
    flex: 1;
    min-width: 0;
}

.stat-card__title {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: block;
    margin-bottom: 0.2rem;
}

.stat-card__values {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
}

.stat-card__value {
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1.2;
}

.stat-card__unit {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: 1px;
}

/* Profile Section */
.profile-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.profile-section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.profile-section__title {
    font-size: 1rem;
    font-weight: 700;
}

.chevron-link {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    transition: color 0.15s;
}

.chevron-link:hover {
    color: var(--text-primary);
}

/* CTA */
.profile-cta {
    padding: 0.5rem 0;
}

.profile-cta__btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
    cursor: pointer;
}

.profile-cta__btn:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.profile-cta__plus {
    font-size: 2rem;
    font-weight: 300;
    line-height: 1;
    margin-bottom: 0.3rem;
}

.profile-cta__label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Poster Row */
.poster-row {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    scrollbar-width: thin;
}

.poster-row::-webkit-scrollbar {
    height: 4px;
}

.poster-row__item {
    flex-shrink: 0;
    width: 90px;
    height: 135px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: transform 0.15s;
}

.poster-row__item:hover {
    transform: scale(1.05);
}

.poster-row__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.poster-row__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.5);
}

/* ============================================================
   Genre Tags
   ============================================================ */

.genre-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.genre-tag {
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ============================================================
   Empty State
   ============================================================ */

.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
}

.empty-state__icon {
    margin-bottom: 0.75rem;
    opacity: 0.4;
}

.empty-state h3 {
    margin-bottom: 0.3rem;
    color: var(--text-secondary);
}

.empty-state p {
    margin-bottom: 1rem;
}

/* ============================================================
   Error Page
   ============================================================ */

.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-container {
    text-align: center;
}

.error-code {
    font-size: 5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
}

.error-message {
    color: var(--text-muted);
    margin: 1rem 0;
}

/* ============================================================
   Import
   ============================================================ */

.import-format-info {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
}
.import-format-info h3 {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}
.import-format-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .navbar__links {
        display: none;
    }

    .navbar__search {
        max-width: none;
    }

    .mobile-nav {
        display: flex;
    }

    .show-hero__inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .show-hero__poster {
        width: 160px;
        min-height: 220px;
    }

    .show-hero__meta {
        justify-content: center;
    }

    .show-actions {
        justify-content: center;
    }

    .show-hero__overview {
        margin-left: auto;
        margin-right: auto;
    }

    .show-progress__text {
        text-align: center;
    }

    .movie-rating-section {
        text-align: center;
    }
    .star-rating {
        justify-content: center;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .show-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .lists-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        padding: 1rem 1rem 0.5rem;
    }

    .stats-grid,
    .stats-row,
    .filter-tabs,
    .dashboard-grid,
    .calendar-nav,
    .calendar-grid,
    .calendar-events,
    .show-episodes,
    .search-page-form,
    .search-results {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .show-hero {
        padding: 1.5rem 1rem;
    }

    .show-hero__title {
        font-size: 1.5rem;
    }

    .show-hero__poster {
        width: 130px;
        min-height: 180px;
    }

    .auth-card {
        padding: 1.5rem;
    }

    .profile-page {
        padding: 0 1rem;
    }
}

@media (min-width: 1025px) {
    .mobile-nav {
        display: none !important;
    }
}
