/* MyTvTime - TV Series Tracker Styles */

:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-input: #1a1a2e;
    --text-primary: #e4e6eb;
    --text-secondary: #b0b3b8;
    --text-muted: #8a8d91;
    --accent: #6c63ff;
    --accent-hover: #5a52d5;
    --success: #00c853;
    --danger: #ff5252;
    --warning: #ffc107;
    --border: #2d2d44;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --transition: 0.2s ease;
}

/* Explicit dark theme */
[data-theme="dark"] {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-input: #1a1a2e;
    --text-primary: #e4e6eb;
    --text-secondary: #b0b3b8;
    --text-muted: #8a8d91;
    --accent: #6c63ff;
    --accent-hover: #5a52d5;
    --success: #00c853;
    --danger: #ff5252;
    --warning: #ffc107;
    --border: #2d2d44;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

/* Explicit light theme */
[data-theme="light"] {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f0f0f5;
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a5a;
    --text-muted: #8a8a9a;
    --accent: #6c63ff;
    --accent-hover: #5a52d5;
    --success: #00c853;
    --danger: #ff5252;
    --warning: #ffc107;
    --border: #e0e0e8;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

/* Auto theme (system preference) */
@media (prefers-color-scheme: light) {
    :root:not([data-theme]) {
        --bg-primary: #f5f5f7;
        --bg-secondary: #ffffff;
        --bg-card: #ffffff;
        --bg-input: #f0f0f5;
        --text-primary: #1a1a2e;
        --text-secondary: #4a4a5a;
        --text-muted: #8a8a9a;
        --border: #e0e0e8;
        --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    }
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-hover);
}

/* Navigation */
nav {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

nav.hidden {
    display: none;
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 2rem;
    height: 56px;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary) !important;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
}

.nav-link {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary) !important;
    font-size: 0.9rem;
    transition: background var(--transition);
}

.nav-link:hover,
.nav-link.active {
    background: var(--bg-card);
    color: var(--text-primary) !important;
}

.nav-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

.nav-icon-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    color: var(--text-secondary);
}

.nav-icon-btn:hover {
    background: var(--bg-card);
    color: var(--accent);
}

/* Hamburger button (desktop: hidden) */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.nav-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile logout only visible inside the drawer */
.nav-logout-mobile { display: none; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-success {
    background: var(--success);
    color: white;
}

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

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

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

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
}

/* Auth pages */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

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

.auth-title {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.form-group input {
    padding: 0.65rem 0.85rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: border-color var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
}

.auth-switch {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Loading & Error */
.loading, .error, .empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.error {
    color: var(--danger);
}

.empty-state-large {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-large p {
    margin-bottom: 1.5rem;
    color: var(--text-muted);
    font-size: 1.2rem;
}

/* Dashboard */
.dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    border: 1px solid var(--border);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.dashboard-section {
    margin-bottom: 2.5rem;
}

.dashboard-section h2 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

/* Upcoming & Continue Watching cards */
.upcoming-list, .continue-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.upcoming-card, .continue-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    color: var(--text-primary) !important;
    transition: border-color var(--transition);
}

.upcoming-card:hover, .continue-card:hover {
    border-color: var(--accent);
}

.continue-main {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
    color: var(--text-primary) !important;
}

.continue-info {
    min-width: 0;
}

.continue-watch-btn {
    flex-shrink: 0;
}

.poster-sm {
    width: 50px;
    height: 75px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.upcoming-series, .continue-series {
    font-weight: 600;
    font-size: 0.95rem;
}

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

.upcoming-title, .continue-title {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.upcoming-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.upcoming-date {
    color: var(--warning);
    font-weight: 500;
}

.continue-next {
    color: var(--accent);
    font-size: 0.85rem;
}

/* Search */
.page-search {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.page-search h1 {
    margin-bottom: 1.5rem;
}

.search-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.search-bar input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--accent);
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-result-card {
    display: flex;
    gap: 1.25rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1rem;
    border: 1px solid var(--border);
}

.poster-md {
    width: 100px;
    height: 150px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.search-result-info h3 {
    margin-bottom: 0.25rem;
}

.search-result-info h3 a {
    color: var(--text-primary);
}

.search-result-info h3 a:hover {
    color: var(--accent);
}

.year {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.9rem;
}

.rating {
    font-size: 0.85rem;
    color: var(--warning);
    margin-bottom: 0.5rem;
}

.overview {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-result-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
}

.search-sharing-selector {
    margin-bottom: 0;
}

.search-co-watchers {
    width: 100%;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.65rem;
    background: var(--bg-primary);
}

.search-co-watchers-title {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 0.35rem;
}

.search-co-watchers-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.75rem;
}

.search-co-watcher-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-primary);
    font-size: 0.82rem;
}

.search-co-watcher-item input[type="checkbox"] {
    width: 0.95rem;
    height: 0.95rem;
    accent-color: var(--accent);
}

/* My Series */
.page-series {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.page-series h1 {
    margin-bottom: 1.5rem;
}

.count {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 1rem;
}

.series-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
}

.series-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    position: relative;
    transition: transform var(--transition), border-color var(--transition);
}

.series-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
}

.series-card a {
    color: var(--text-primary);
    display: block;
}

.series-card .poster {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    display: block;
}

.poster-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    font-size: 3rem;
}

.poster-placeholder.poster-sm {
    font-size: 1.5rem;
}

.series-card-info {
    padding: 0.75rem;
}

.series-card-info h3 {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.series-status {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.progress-bar-container {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.progress-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.remove-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    opacity: 0;
    transition: opacity var(--transition);
    border-radius: 50% !important;
    width: 28px;
    height: 28px;
    padding: 0 !important;
    font-size: 0.75rem;
}

.series-card:hover .remove-btn {
    opacity: 1;
}

/* Series Detail */
.series-detail {
    max-width: 1200px;
    margin: 0 auto;
}

.series-hero {
    padding: 3rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 1.5rem;
}

.series-hero-content {
    display: flex;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.poster-lg {
    width: 200px;
    height: 300px;
    object-fit: cover;
    border-radius: var(--radius);
    flex-shrink: 0;
    box-shadow: var(--shadow);
}

.series-hero-info {
    flex: 1;
}

.series-hero-info h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.series-meta {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.badge {
    background: var(--accent);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.series-overview {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1.5rem;
    max-width: 700px;
}

.series-actions {
    display: flex;
    gap: 0.75rem;
}

.seasons-container {
    padding: 2rem 1.5rem;
}

.seasons-container h2 {
    margin-bottom: 1rem;
}

.season-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.season-mobile-nav {
    display: none;
    margin-bottom: 1rem;
}

.season-mobile-nav label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.season-mobile-nav select {
    width: 100%;
    padding: 0.6rem 0.7rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.season-tab {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition);
}

.season-tab:hover,
.season-tab.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.episode-count {
    font-size: 0.75rem;
    opacity: 0.7;
}

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

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

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

.episode-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    transition: border-color var(--transition);
}

.episode-card.watched {
    opacity: 0.7;
    border-color: var(--success);
}

.episode-number {
    font-weight: 700;
    color: var(--accent);
    min-width: 36px;
    padding-top: 2px;
}

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

.episode-title {
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.episode-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.episode-overview {
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.watch-toggle {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    flex-shrink: 0;
    transition: transform var(--transition);
}

.watch-toggle:hover {
    transform: scale(1.2);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-success {
    background: var(--success);
    color: white;
}

.toast-error {
    background: var(--danger);
    color: white;
}

/* Settings Page */
.page-settings {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.page-settings h1 {
    margin-bottom: 2rem;
}

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

.settings-section h2 {
    font-size: 1.1rem;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.settings-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.theme-selector {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    min-width: 100px;
    color: var(--text-secondary);
}

.theme-option:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.theme-option.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.theme-icon {
    font-size: 1.75rem;
}

.theme-name {
    font-size: 0.85rem;
    font-weight: 500;
}

.account-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.info-value {
    color: var(--text-primary);
}

.backup-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.settings-help {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Series filter tabs */
.series-filter-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-tab {
    padding: 0.4rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.filter-tab:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.filter-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

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

.filter-tab:not(.active) .filter-count {
    background: var(--bg-secondary);
    color: var(--text-muted);
}

/* Sharing banner on series detail */
.sharing-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    width: fit-content;
    font-weight: 500;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.household-banner {
    background: rgba(108, 99, 255, 0.25);
    color: #ffffff;
    border: 1px solid rgba(108, 99, 255, 0.5);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.personal-banner {
    background: rgba(0, 200, 83, 0.25);
    color: #ffffff;
    border: 1px solid rgba(0, 200, 83, 0.5);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.sharing-banner-icon {
    font-size: 1.1rem;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.sharing-banner-sub {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8rem;
}

.sharing-banner-dots {
    display: flex;
    gap: 3px;
    margin-left: 0.25rem;
}

/* Small profile dot (for episode watchers) */
.profile-dot-sm {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.episode-watchers {
    display: inline-flex;
    gap: 2px;
    align-items: center;
    margin-left: 0.25rem;
}

/* Co-watcher section */
.co-watcher-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin: 0.75rem 0;
}

.co-watcher-header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

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

.co-watcher-sub {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.co-watcher-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.co-watcher-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    padding: 0.3rem 0.6rem;
    border-radius: 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
}

.co-watcher-item:hover {
    border-color: var(--accent);
}

.co-watcher-item input[type="checkbox"] {
    accent-color: var(--accent);
    width: 14px;
    height: 14px;
}

.co-watcher-name {
    font-size: 0.85rem;
}

.badge-sm {
    font-size: 0.65rem;
    background: var(--accent);
    color: white;
    padding: 1px 5px;
    border-radius: 8px;
    opacity: 0.8;
}

.co-watcher-hint {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Household activity feed */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 0.88rem;
    flex-wrap: wrap;
}

.activity-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
    color: var(--text-secondary);
}

.activity-member {
    font-weight: 600;
    color: var(--text-primary);
}

.activity-series {
    font-weight: 500;
    color: var(--accent);
}

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

.activity-ep-title {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.activity-date {
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
    margin-left: auto;
}

/* Profile Switcher */
.profile-switcher {
    position: relative;
}

.profile-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color var(--transition);
}

.profile-btn:hover {
    border-color: var(--accent);
}

.profile-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.profile-name {
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.profile-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    min-width: 180px;
    box-shadow: var(--shadow);
    z-index: 200;
    overflow: hidden;
}

.profile-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.65rem 1rem;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background var(--transition);
    text-align: left;
}

.profile-option:hover {
    background: var(--bg-secondary);
}

.profile-option.active {
    background: rgba(108, 99, 255, 0.15);
    color: var(--accent);
}

.owner-badge {
    margin-left: auto;
    font-size: 0.7rem;
    background: var(--accent);
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-weight: 600;
    white-space: nowrap;
}

/* Series card badges */
.series-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.35rem;
}

/* ===== Episode Detail Page ===== */
.ep-detail {
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.ep-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.ep-back-link,
.ep-back-season {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.ep-back-link:hover,
.ep-back-season:hover {
    text-decoration: underline;
}

.meta-sep {
    color: var(--text-muted);
    margin: 0 0.25rem;
}

.ep-hero {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
    align-items: start;
}

@media (max-width: 680px) {
    .ep-hero {
        grid-template-columns: 1fr;
    }
}

.ep-still-wrap {
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-secondary);
    aspect-ratio: 16/9;
}

.ep-still {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ep-still-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 1rem;
    text-align: center;
}

.ep-hero-info {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.ep-label {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
}

.ep-title {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.25;
    margin: 0;
}

.ep-meta {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.ep-rating {
    color: var(--warning);
    font-weight: 600;
}

.ep-crew-row {
    display: flex;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    align-items: baseline;
}

.ep-crew-label {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 60px;
    flex-shrink: 0;
}

.ep-watch-btn {
    margin-top: 0.5rem;
    align-self: flex-start;
}

.ep-section {
    margin-bottom: 2rem;
}

.ep-section-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.75rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.4rem;
}

.ep-overview {
    line-height: 1.7;
    color: var(--text-secondary);
    margin: 0;
}

.ep-cast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}

.ep-cast-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.4rem;
}

.ep-cast-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.ep-cast-photo-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
}

.ep-cast-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.ep-cast-char {
    font-size: 0.73rem;
    color: var(--text-muted);
    font-style: italic;
}

.ep-nav-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Make episode card info area a link */
.episode-card-link {
    color: inherit;
    text-decoration: none;
}

.episode-card:hover .episode-title {
    color: var(--accent);
}


.badge-household {
    background: rgba(108, 99, 255, 0.2);
    color: var(--accent);
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    border: 1px solid rgba(108, 99, 255, 0.3);
}

/* Edit Member Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.edit-form-group {
    margin-bottom: 1.5rem;
}

.edit-form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.color-picker {
    width: 100px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 2px;
}

.color-preview {
    display: inline-flex;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    justify-content: flex-end;
}

.badge-personal {
    background: rgba(0, 200, 83, 0.15);
    color: var(--success);
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    border: 1px solid rgba(0, 200, 83, 0.25);
}

.badge-addedby {
    background: var(--bg-secondary);
    color: var(--text-muted);
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-size: 0.65rem;
    border: 1px solid var(--border);
}

/* Sharing mode selector (series detail page) */
.sharing-mode-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.sharing-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;
}

.sharing-options {
    display: flex;
    gap: 0.4rem;
}

.sharing-option {
    padding: 0.35rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
}

.sharing-option:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.sharing-option.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* Household management in settings */
.members-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.member-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.member-name {
    font-weight: 500;
    flex: 1;
}

.member-actions {
    display: flex;
    gap: 0.4rem;
    margin-left: auto;
}

.household-add-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.household-add-form h3 {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.settings-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.input {
    flex: 1;
    padding: 0.6rem 0.85rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color var(--transition);
}

.input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Broadcast timeline */
.page-broadcast {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1.5rem;
}

.broadcast-header {
    margin-bottom: 1rem;
}

.broadcast-header h1 {
    margin-bottom: 0.25rem;
}

.broadcast-header p {
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.broadcast-viewport {
    height: calc(100vh - 180px);
    min-height: 440px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--bg-secondary), var(--bg-primary));
    padding: 0.75rem;
}

.broadcast-sentinel {
    height: 1px;
}

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

.broadcast-day-group {
    position: sticky;
    top: 0;
    z-index: 2;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0));
    padding-top: 0.35rem;
}

[data-theme="light"] .broadcast-day-group {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0));
}

.broadcast-day-title {
    display: inline-flex;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-card);
}

.broadcast-day-title.is-today {
    border-color: var(--accent);
    color: var(--accent);
}

.broadcast-today-anchor {
    margin: 0.6rem 0 0.3rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    opacity: 0.9;
}

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

.broadcast-card.watched {
    border-color: var(--success);
    opacity: 0.72;
}

.broadcast-card-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
    color: inherit;
}

.broadcast-card-link:hover .broadcast-series {
    color: var(--accent);
}

.broadcast-card-info {
    min-width: 0;
    flex: 1;
}

.broadcast-series {
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.broadcast-episode {
    font-size: 0.86rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.broadcast-meta {
    margin-top: 0.1rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.color-picker {
    width: 40px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    cursor: pointer;
    padding: 2px;
}

/* Responsive */
@media (max-width: 640px) {
    .nav-hamburger { display: flex; }

    .nav-inner {
        gap: 0.5rem;
        position: relative;
    }

    .nav-brand {
        font-size: 1rem;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: calc(100% + 1px);
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border);
        padding: 0.5rem 1rem 1rem;
        gap: 0.25rem;
        z-index: 120;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    }

    .nav-links.nav-open { display: flex; }

    .nav-link {
        padding: 0.8rem 1rem;
        font-size: 1rem;
        border-radius: var(--radius-sm);
        width: 100%;
    }

    .nav-logout-mobile {
        display: block;
        width: 100%;
        text-align: left;
        background: none;
        border: none;
        border-top: 1px solid var(--border);
        margin-top: 0.5rem;
        padding: 0.8rem 1rem;
        color: var(--text-secondary);
        font-size: 1rem;
        cursor: pointer;
        border-radius: var(--radius-sm);
    }

    .nav-logout-mobile:hover { background: var(--bg-card); color: var(--text-primary); }
    .nav-logout-desktop { display: none; }
    .nav-user {
        gap: 0.35rem;
        min-width: 0;
    }
    .nav-username {
        display: inline-block;
        font-size: 0.82rem;
        max-width: 7.5rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .profile-name {
        display: inline-block;
        max-width: 6.5rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .profile-btn {
        gap: 0.35rem;
        padding: 0.35rem 0.5rem;
        max-width: 9rem;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .nav-inner { gap: 0.75rem; }

    .series-hero-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .poster-lg {
        width: 150px;
        height: 225px;
    }

    .series-hero-info h1 {
        font-size: 1.5rem;
    }

    .series-meta {
        justify-content: center;
    }

    .series-overview {
        text-align: left;
    }

    .search-result-card {
        flex-direction: column;
    }

    .continue-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .continue-main {
        width: 100%;
    }

    .continue-watch-btn {
        width: 100%;
    }

    .poster-md {
        width: 100%;
        height: 200px;
    }

    .series-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem;
    }

    .broadcast-viewport {
        height: calc(100vh - 160px);
        min-height: 360px;
    }

    .broadcast-card {
        padding: 0.6rem;
    }

    .broadcast-episode {
        white-space: normal;
    }
    
    .member-actions {
        flex-direction: column;
    }

    .settings-row {
        flex-wrap: wrap;
    }
}

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

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

    .season-tabs {
        display: none;
    }

    .season-mobile-nav {
        display: block;
    }

    .run-selector {
        width: 100%;
    }

    .run-selector select {
        width: 100%;
        min-width: 0;
    }
}

/* Rewatch styles */
.badge-rewatch {
    background: var(--accent);
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    vertical-align: middle;
}

.seasons-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.seasons-header-row h2 {
    margin-bottom: 0;
}

.run-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.run-selector label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.run-selector select {
    min-width: 200px;
    padding: 0.45rem 0.6rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
}

.run-info-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.65rem 0.75rem;
    margin-bottom: 1.2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
}

.run-progress-text,
.run-watchers {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.rewatch-run-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.rewatch-run-selector label {
    color: var(--text-secondary);
    font-weight: 500;
}

.rewatch-run-selector select {
    padding: 0.35rem 0.7rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
}

.rewatch-info-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.rewatch-progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.rewatch-co-watchers {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Modal overlay & dialog */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-dialog {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    min-width: 320px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.modal-dialog h3 {
    margin: 0 0 0.25rem;
}

.modal-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0 0 1rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.25rem;
}
