/* ============================================
   BASE & RESET
   ============================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background-color: #0f0f0f;
    color: #e0e0e0;
    min-height: 100vh;
}

/* ============================================
   HEADER & NAV
   ============================================ */

header {
    background: #1a1a1a;
    border-bottom: 1px solid #2a2a2a;
    padding: 14px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.header-content h1 {
    font-size: 1.4rem;
    color: #fff;
    letter-spacing: -0.5px;
}

.header-content p {
    font-size: 0.78rem;
    color: #777;
    margin-top: 2px;
}

nav {
    display: flex;
    gap: 8px;
}

.nav-btn {
    background: transparent;
    border: 1px solid #333;
    color: #aaa;
    padding: 7px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.nav-btn:hover {
    border-color: #555;
    color: #fff;
}

.nav-btn.active {
    background: #e50914;
    border-color: #e50914;
    color: #fff;
}

.account-btn {
    margin-left: auto;
    color: #aaa;
}

/* ============================================
   PAGES
   ============================================ */

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 1.3rem;
    color: #fff;
}

.page-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

#check-status {
    font-size: 0.75rem;
    color: #666;
}

/* ============================================
   SEARCH
   ============================================ */

.search-container {
    margin-bottom: 24px;
}

.search-box {
    display: flex;
    gap: 8px;
    max-width: 600px;
    margin: 0 auto;
}

.search-box input {
    flex: 1;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: #e50914;
}

.search-box input::placeholder {
    color: #555;
}

.search-box button {
    background: #e50914;
    border: none;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.2s;
    white-space: nowrap;
}

.search-box button:hover {
    background: #c2060f;
}

/* ============================================
   RESULTS GRID
   ============================================ */

.results-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

/* ============================================
   SEARCH CARDS
   ============================================ */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}

.card {
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #222;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    border-color: #444;
}

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

.card-poster-placeholder {
    width: 100%;
    aspect-ratio: 2 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #222;
    font-size: 3rem;
}

.card-info {
    padding: 10px;
}

.card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.card-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.card-meta {
    font-size: 0.75rem;
    color: #888;
}

.card-year {
    font-size: 0.75rem;
    color: #777;
}

.rating-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.25);
    padding: 1px 7px;
    border-radius: 10px;
    white-space: nowrap;
}

.card-badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.badge-movie {
    background: rgba(229, 9, 20, 0.2);
    color: #e50914;
    border: 1px solid rgba(229, 9, 20, 0.3);
}

.badge-tv {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* ============================================
   WATCHLIST CONTROLS (search + sort)
   ============================================ */

#watchlist-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.watchlist-filter-wrap {
    flex: 1;
    min-width: 160px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#watchlist-search {
    width: 100%;
    background: #111;
    border: 1px solid #333;
    color: #fff;
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

#watchlist-search:focus { border-color: #555; }
#watchlist-search::placeholder { color: #555; }

.filter-hint {
    font-size: 0.75rem;
    color: #555;
}

.inline-link {
    background: none;
    border: none;
    color: #6c63ff;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0;
    text-decoration: underline;
}

.inline-link:hover { color: #9d96ff; }

.add-show-btn {
    background: #6c63ff;
    border: 1px solid #6c63ff;
    color: #fff;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

.add-show-btn:hover {
    background: #5a52d5;
    border-color: #5a52d5;
}

#watchlist-sort {
    background: #111;
    border: 1px solid #333;
    color: #fff;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 0.875rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

#watchlist-sort:focus { border-color: #555; }
#watchlist-sort option { background: #111; color: #fff; }

/* ============================================
   WATCHLIST LIST VIEW
   ============================================ */

.wl-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.wl-row-wrap {
    background: #1a1a1a;
    border: 1px solid #222;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.15s;
}

.wl-row-wrap:hover {
    border-color: #333;
}

.wl-row-wrap.expanded {
    border-color: #3a3a3a;
}

.wl-row {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.wl-thumb {
    width: 44px;
    min-width: 44px;
    height: 66px;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}

.wl-thumb-placeholder {
    width: 44px;
    min-width: 44px;
    height: 66px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #222;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.wl-row-main {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.wl-row-title {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.wl-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
}

.wl-row-chips {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.wl-row-right {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 12px;
    flex-shrink: 0;
}

.status-pill {
    font-size: 0.7rem;
    padding: 2px 9px;
    border-radius: 12px;
    white-space: nowrap;
    font-weight: 500;
}

.status-pill.watching {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.status-pill.wanting_to_watch {
    background: rgba(156, 163, 175, 0.1);
    color: #9ca3af;
    border: 1px solid rgba(156, 163, 175, 0.2);
}

.status-pill.completed {
    background: rgba(34, 197, 94, 0.12);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.wl-status-select {
    background: #111;
    border: 1px solid #333;
    color: #aaa;
    padding: 4px 6px;
    border-radius: 5px;
    font-size: 0.75rem;
    cursor: pointer;
    outline: none;
}

.wl-status-select option { background: #111; color: #fff; }

.wl-chevron {
    color: #444;
    font-size: 0.75rem;
    transition: transform 0.2s;
    line-height: 1;
}

.wl-row-wrap.expanded .wl-chevron {
    transform: rotate(180deg);
    color: #666;
}

.wl-detail {
    display: none;
    border-top: 1px solid #222;
    padding: 12px 16px 14px;
    background: #161616;
}

.wl-row-wrap.expanded .wl-detail {
    display: block;
}

.wl-detail > * + * {
    margin-top: 8px;
}

.wl-detail-overview {
    font-size: 0.8rem;
    color: #777;
    line-height: 1.5;
}

.wl-detail-streaming {
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 4px;
}

.wl-streaming-label {
    color: #888;
    font-weight: 500;
    white-space: nowrap;
}

.wl-streaming-unavailable {
    color: #aaa;
    font-style: italic;
}

.wl-row-badges {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    min-height: 0;
}


.prod-badge {
    display: inline-block;
    font-size: 0.66rem;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 10px;
    white-space: nowrap;
    border: 1px solid;
}

.prod-returning {
    background: rgba(56, 189, 248, 0.1);
    border-color: rgba(56, 189, 248, 0.3);
    color: #38bdf8;
}

.prod-production {
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.3);
    color: #fbbf24;
}

.prod-ended {
    background: rgba(100, 116, 139, 0.1);
    border-color: rgba(100, 116, 139, 0.25);
    color: #64748b;
}

.prod-canceled {
    background: rgba(100, 116, 139, 0.1);
    border-color: rgba(100, 116, 139, 0.25);
    color: #64748b;
}

.new-ep-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.68rem;
    font-weight: 600;
    background: rgba(251, 146, 60, 0.12);
    border: 1px solid rgba(251, 146, 60, 0.35);
    color: #fb923c;
    padding: 1px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.wl-detail-alerts {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wl-detail-alert-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    background: rgba(251, 146, 60, 0.07);
    border: 1px solid rgba(251, 146, 60, 0.2);
    border-radius: 6px;
    padding: 7px 10px;
}

.wl-detail-alert-msg {
    font-size: 0.8rem;
    color: #fb923c;
    line-height: 1.4;
    flex: 1;
}

.alert-air-date {
    font-size: 0.75rem;
    color: #a06030;
    margin-left: 2px;
}

/* Group by Status view */

.wl-group {
    margin-bottom: 10px;
}

.wl-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 4px;
    cursor: pointer;
    user-select: none;
    color: #777;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid #222;
    margin-bottom: 6px;
    transition: color 0.15s;
}

.wl-group-header:hover { color: #aaa; }

.wl-group-count {
    background: #222;
    border: 1px solid #333;
    color: #666;
    font-size: 0.68rem;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 500;
}

.wl-group-chevron {
    margin-left: auto;
    transition: transform 0.2s;
    color: #555;
}

.wl-group.collapsed .wl-group-chevron {
    transform: rotate(-90deg);
}

.wl-group.collapsed .wl-group-rows {
    display: none;
}

.wl-group-rows {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* ============================================
   WATCHLIST SHARED COMPONENTS
   ============================================ */

.service-chip {
    display: inline-block;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #7eb8f7;
    padding: 1px 7px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 500;
}

.service-chip.rent {
    background: rgba(251, 191, 36, 0.08);
    border-color: rgba(251, 191, 36, 0.2);
    color: #d4a843;
}

.service-chip.broadcast {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.2);
    color: #5ebd82;
}

.wl-broadcast-note {
    font-size: 0.68rem;
    color: #555;
    font-style: italic;
}

.tv-meta {
    font-size: 0.78rem;
    color: #666;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.progress-display {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    color: #aaa;
}

.inline-edit-btn {
    background: transparent;
    border: 1px solid #333;
    color: #555;
    padding: 1px 7px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
    transition: all 0.15s;
}

.inline-edit-btn:hover {
    border-color: #555;
    color: #bbb;
}

.progress-input {
    width: 42px;
    background: #111;
    border: 1px solid #333;
    color: #fff;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    text-align: center;
    outline: none;
}

.progress-input:focus {
    border-color: #555;
}

.next-ep-date {
    color: #60a5fa;
}

.not-checked {
    color: #444;
}

.watchlist-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

@media (max-width: 600px) {
    .status-pill { display: none; }
    .wl-row-main { padding: 8px 10px; }
    .wl-row-right { gap: 6px; padding-right: 8px; }
}

/* ============================================
   SMALL BUTTONS
   ============================================ */

.small-btn {
    background: #252525;
    border: 1px solid #3a3a3a;
    color: #ccc;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.small-btn:hover {
    background: #333;
    color: #fff;
    border-color: #555;
}

.small-btn.danger {
    border-color: rgba(229, 9, 20, 0.35);
    color: #f87171;
}

.small-btn.danger:hover {
    background: rgba(229, 9, 20, 0.15);
    border-color: rgba(229, 9, 20, 0.6);
    color: #fca5a5;
}

.account-section {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 24px;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.account-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.account-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #666;
}

.account-field span:last-child {
    font-size: 0.95rem;
    color: #e0e0e0;
}

.btn-secondary {
    align-self: flex-start;
    padding: 8px 18px;
    border-radius: 6px;
    border: 1px solid #444;
    background: transparent;
    color: #aaa;
    font-size: 0.875rem;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.btn-secondary:hover {
    border-color: #666;
    color: #fff;
}

.danger-zone {
    margin: 40px 0 16px;
    padding: 20px 24px;
    border: 1px solid rgba(229, 9, 20, 0.3);
    border-radius: 8px;
    background: rgba(229, 9, 20, 0.05);
}

.danger-zone h3 {
    color: #f87171;
    margin-bottom: 8px;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.danger-zone p {
    color: #999;
    font-size: 0.875rem;
    margin-bottom: 16px;
}

.btn-danger {
    padding: 8px 18px;
    border-radius: 6px;
    border: 1px solid rgba(229, 9, 20, 0.5);
    background: transparent;
    color: #f87171;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.btn-danger:hover {
    background: rgba(229, 9, 20, 0.15);
    border-color: #e50914;
    color: #fca5a5;
}

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

/* ============================================
   SUBSCRIPTIONS
   ============================================ */

.sub-meta {
    font-size: 0.78rem;
    color: #666;
    margin-top: 3px;
}

.sub-view { display: flex; justify-content: space-between; align-items: center; width: 100%; }

.sub-edit { width: 100%; }
.sub-edit.hidden, .sub-view.hidden { display: none; }

.add-sub-btn { white-space: nowrap; }

/* Add-subscription modal */
.add-sub-modal-content { max-width: 480px; }

.add-sub-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-right: 36px; /* room for close btn */
}
.add-sub-modal-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

/* Section dividers */
.subs-section-header {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #555;
    padding: 4px 0 8px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    user-select: none;
}
.subs-section-header:first-child { margin-top: 0; }
.subs-section-header:hover { color: #888; }

.subs-section-paused { color: #d97706; }
.subs-section-paused:hover { color: #f59e0b; }

.subs-section-count {
    background: #222;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 0.7rem;
    color: #666;
    font-weight: 600;
}

.section-chevron {
    font-size: 0.75rem;
    transition: transform 0.15s;
}

/* Override grid on the subscriptions list — cards are full-width rows, not a tile grid */
#subscriptions-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

#subs-active-list,
#subs-paused-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

#subs-active-list.hidden,
#subs-paused-list.hidden { display: none; }

/* Price display row (shows formatted price + Edit button) */
.price-display-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0 4px;
}

.price-display-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: #e5e5e5;
}

.price-per-month {
    font-size: 0.8rem;
    font-weight: 400;
    color: #777;
}

.price-edit-btn {
    background: transparent;
    border: 1px solid #333;
    color: #666;
    cursor: pointer;
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 4px;
    transition: all 0.15s;
}
.price-edit-btn:hover {
    border-color: #555;
    color: #aaa;
}

.price-display-row.hidden { display: none; }

/* Inline edit form */
.sub-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
    margin-bottom: 12px;
}
.sub-form-full { grid-column: 1 / -1; }

.sub-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sub-form-group label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666;
}
.sub-input {
    background: #111;
    border: 1px solid #333;
    color: #fff;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}
.sub-input:focus { border-color: #555; }
.sub-input option { background: #111; color: #fff; }

.annual-price-display {
    font-size: 0.88rem;
    color: #4ade80;
    padding: 8px 0 4px;
    font-weight: 500;
}

.sub-form-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.sub-form-actions .action-btn { flex: 0 0 auto; padding: 7px 18px; }

@media (max-width: 500px) {
    .sub-form-grid { grid-template-columns: 1fr; }
    .sub-form-full { grid-column: 1; }
}

.subscription-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1a1a1a;
    border: 1px solid #222;
    border-radius: 8px;
    padding: 16px 20px;
    grid-column: 1 / -1;
    transition: opacity 0.25s;
}

.subscription-card.inactive {
    border-left: 3px solid #d97706;
    opacity: 0.75;
}

.subscription-name {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.paused-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #d97706;
    background: rgba(217, 119, 6, 0.12);
    border: 1px solid rgba(217, 119, 6, 0.3);
    border-radius: 4px;
    padding: 1px 6px;
}

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

.subscription-plan {
    font-size: 0.85rem;
    color: #aaa;
}

.subscription-actions {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    align-items: center;
}

.toggle-btn {
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid;
    transition: all 0.2s;
    white-space: nowrap;
}

/* Pause — subtle, grey */
.pause-btn {
    background: transparent;
    border-color: #3a3a3a;
    color: #666;
}
.pause-btn:hover {
    border-color: #555;
    color: #999;
    background: rgba(255,255,255,0.04);
}

/* Reactivate — prominent green */
.reactivate-btn {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.5);
    color: #4ade80;
}
.reactivate-btn:hover {
    background: rgba(34, 197, 94, 0.22);
    border-color: rgba(34, 197, 94, 0.7);
}

/* ============================================
   COST SUMMARY
   ============================================ */

.cost-amount {
    font-size: 1.6rem;
    font-weight: 700;
    color: #4ade80;
    line-height: 1;
}

.cost-label {
    font-size: 0.78rem;
    color: #777;
    margin-top: 3px;
}


/* ============================================
   MODAL
   ============================================ */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #1a1a1a;
    border: 1px solid #2e2e2e;
    border-radius: 12px;
    padding: 24px;
    max-width: 540px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #252525;
    border: 1px solid #3a3a3a;
    color: #aaa;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #333;
    color: #fff;
}

.modal-poster {
    width: 110px;
    border-radius: 6px;
    float: right;
    margin: 0 0 12px 16px;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
    margin-right: 130px;
    line-height: 1.3;
}

.modal-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    margin-right: 130px;
}

.modal-overview {
    font-size: 0.85rem;
    color: #999;
    line-height: 1.65;
    margin-bottom: 20px;
    clear: both;
}

/* ============================================
   STREAMING INFO
   ============================================ */

.streaming-section h3 {
    font-size: 0.95rem;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.streaming-summary {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 16px;
    line-height: 1.4;
}

.streaming-summary.free {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #4ade80;
}

.streaming-summary.rent {
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: #fbbf24;
}

.streaming-summary.unavailable {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid #2e2e2e;
    color: #777;
}

.provider-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.provider-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
}

.provider-tag.free {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.35);
    color: #4ade80;
}

.provider-tag.rent {
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.35);
    color: #fbbf24;
}

.provider-tag.buy {
    background: rgba(249, 115, 22, 0.15);
    border: 1px solid rgba(249, 115, 22, 0.35);
    color: #fb923c;
}

.provider-tag.elsewhere {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #3a3a3a;
    color: #888;
}

.provider-tag.broadcast {
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.25);
    color: #5ebd82;
}

/* ============================================
   MODAL ACTIONS
   ============================================ */

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.action-btn {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid;
    transition: all 0.2s;
}

.action-btn.primary {
    background: #e50914;
    border-color: #e50914;
    color: #fff;
}

.action-btn.primary:hover {
    background: #c2060f;
}

.action-btn.secondary {
    background: transparent;
    border-color: #3a3a3a;
    color: #aaa;
}

.action-btn.secondary:hover {
    background: #252525;
    color: #fff;
}

.action-btn.google {
    background: #fff;
    border-color: #dadce0;
    color: #3c4043;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.action-btn.google:hover {
    background: #f8f8f8;
    border-color: #bbb;
}

/* ============================================
   LOADING & EMPTY STATES
   ============================================ */

/* ============================================
   SPORTS — My Teams
   ============================================ */

/* Section per followed team */
.my-team-section {
    margin-bottom: 32px;
}

.my-team-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #222;
}

.my-team-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #e0e0e0;
}

.unfollow-btn {
    background: none;
    border: 1px solid #333;
    color: #666;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.unfollow-btn:hover { border-color: #f87171; color: #f87171; }

.team-games-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.no-games-msg {
    color: #555;
    font-size: 0.85rem;
    margin: 0;
    padding: 12px 0;
}

/* Add team panel */
.add-team-panel {
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 28px;
}

.add-team-panel.hidden { display: none; }

.add-team-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.add-team-panel-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.panel-close-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}
.panel-close-btn:hover { color: #e0e0e0; }

.add-team-panel input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    color: #e0e0e0;
    padding: 8px 12px;
    font-size: 0.9rem;
    margin-bottom: 14px;
}
.add-team-panel input[type="text"]:focus { outline: none; border-color: #555; }

.team-picker-list {
    max-height: 320px;
    overflow-y: auto;
}

.team-picker-group {
    margin-bottom: 12px;
}

.team-picker-div {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #555;
    margin-bottom: 5px;
    padding-left: 2px;
}

.team-picker-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: 1px solid #222;
    border-radius: 5px;
    color: #ccc;
    padding: 7px 12px;
    font-size: 0.88rem;
    cursor: pointer;
    margin-bottom: 3px;
    transition: background 0.15s, border-color 0.15s;
}
.team-picker-item:hover:not([disabled]) {
    background: #1e1e1e;
    border-color: #444;
    color: #e0e0e0;
}
.team-picker-item.following {
    color: #555;
    cursor: default;
}
.following-badge {
    color: #5ebd82;
    font-size: 0.78rem;
    margin-left: 6px;
}

/* One-off lookup collapsible */
.sports-lookup-details {
    margin-top: 28px;
    border: 1px solid #222;
    border-radius: 8px;
    padding: 12px 16px;
}

.sports-lookup-details summary {
    cursor: pointer;
    color: #888;
    font-size: 0.88rem;
    user-select: none;
    list-style: none;
}
.sports-lookup-details summary::-webkit-details-marker { display: none; }
.sports-lookup-details[open] summary { margin-bottom: 16px; color: #ccc; }

/* ============================================
   SPORTS — legacy league tabs / controls
   ============================================ */

.sports-league-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.league-tab {
    background: #1a1a1a;
    border: 1px solid #333;
    color: #ccc;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.league-tab.active {
    background: #6c63ff;
    border-color: #6c63ff;
    color: #fff;
}

.league-tab.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.sports-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.sports-controls select {
    background: #111;
    border: 1px solid #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    outline: none;
}

.sports-controls select:focus { border-color: #555; }

#mlb-team-select { flex: 1; min-width: 200px; }

.rsn-banner {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-left: 3px solid #6c63ff;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 0.875rem;
}

.rsn-banner.hidden { display: none; }

.rsn-info { margin-bottom: 6px; }
.rsn-label { color: #888; margin-right: 6px; }
.rsn-streaming { color: #666; font-size: 0.8rem; }
.rsn-note { color: #555; font-size: 0.78rem; margin: 0; }

/* Game cards */
.game-card {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 10px;
    transition: border-color 0.2s;
}

.game-card.game-covered { border-color: rgba(94, 189, 130, 0.3); }

.game-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}

.game-datetime { display: flex; flex-direction: column; gap: 2px; }
.game-date { font-weight: 600; color: #ccc; font-size: 0.875rem; }
.game-time { color: #666; font-size: 0.8rem; }

.game-status {
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
}

.game-status.covered   { background: rgba(94,189,130,0.12); color: #5ebd82; border: 1px solid rgba(94,189,130,0.2); }
.game-status.missing   { background: rgba(255,255,255,0.05); color: #888; border: 1px solid #333; }
.game-status.postponed { background: rgba(229,9,20,0.1); color: #f87171; border: 1px solid rgba(229,9,20,0.2); }

.game-matchup {
    font-size: 1rem;
    color: #eee;
    margin-bottom: 6px;
}

.vs-at { color: #555; margin: 0 4px; font-weight: normal; font-size: 0.85rem; }

.game-venue {
    font-size: 0.78rem;
    color: #555;
    margin-bottom: 10px;
}

.game-broadcasts {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
}

.broadcast-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.broadcast-group-label {
    font-size: 0.75rem;
    color: #555;
    min-width: 80px;
}

.bc-chip {
    font-size: 0.78rem;
    padding: 3px 10px;
    border-radius: 12px;
    background: #252525;
    border: 1px solid #333;
    color: #aaa;
}

.bc-chip.bc-clickable {
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.bc-chip.bc-clickable:hover {
    background: #2e2e2e;
    border-color: #555;
    color: #ccc;
}

.bc-chip.have {
    background: rgba(94,189,130,0.1);
    border-color: rgba(94,189,130,0.3);
    color: #5ebd82;
}
.bc-chip.have.bc-clickable:hover {
    background: rgba(94,189,130,0.18);
    border-color: rgba(94,189,130,0.5);
}

.bc-chip.exclusive {
    background: rgba(251,146,60,0.1);
    border-color: rgba(251,146,60,0.3);
    color: #fb923c;
}
.bc-chip.exclusive.bc-clickable:hover {
    background: rgba(251,146,60,0.18);
    border-color: rgba(251,146,60,0.5);
}

/* Broadcast info modal */
.broadcast-info-modal { padding: 4px 0; }
.bi-title { font-size: 1.2rem; font-weight: 700; color: #fff; margin-bottom: 4px; }
.bi-what  { font-size: 0.88rem; color: #888; margin-bottom: 16px; }
.bi-how-header { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: #555; margin-bottom: 8px; }
.bi-options {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}
.bi-options .bi-option {
    padding: 10px 12px;
    background: #1e1e1e;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
}
.bi-option-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 3px;
}
.bi-option-link {
    font-size: 0.92rem;
    font-weight: 600;
    color: #6ab0f5;
    text-decoration: none;
}
.bi-option-link:hover { text-decoration: underline; }
.bi-option-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: #ddd;
}
.bi-option-cost {
    font-size: 0.78rem;
    color: #888;
    white-space: nowrap;
    flex-shrink: 0;
}
.bi-option-desc {
    font-size: 0.8rem;
    color: #666;
    line-height: 1.35;
}
/* "You already have access" section */
.bi-have-section { margin-bottom: 16px; }
.bi-have-header { color: #4caf76 !important; }
.bi-have-item {
    border-color: #2a4a35 !important;
    background: #162a1f !important;
}
.bi-have-name {
    font-size: 0.92rem;
    font-weight: 700;
    color: #6ddb9a;
}
.bi-have-via {
    font-size: 0.78rem;
    color: #4a8a60;
    margin-left: 6px;
}
.bi-have-link {
    font-size: 0.82rem;
    color: #4caf76;
    text-decoration: none;
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
}
.bi-have-link:hover { text-decoration: underline; }
.bi-have-warn {
    color: #b8860b !important;
    margin-top: 4px;
}

.bi-note { font-size: 0.78rem; color: #666; margin-left: 4px; }
.bi-footnote { font-size: 0.78rem; color: #555; font-style: italic; margin-top: 4px; }

.broadcast-tbd { color: #555; font-size: 0.8rem; font-style: italic; }

.exclusive-note {
    font-size: 0.78rem;
    color: #777;
    margin: 8px 0 0;
    padding-top: 8px;
    border-top: 1px solid #222;
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    color: #666;
    padding: 48px;
    font-size: 0.9rem;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 64px 20px;
    color: #555;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 0.95rem;
}

/* ============================================
   ALERTS
   ============================================ */

.alerts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.alerts-title {
    font-size: 0.8rem;
    color: #fbbf24;
    font-weight: 500;
}

.dismiss-all-btn {
    background: transparent;
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: #9a7a1a;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.72rem;
    transition: all 0.15s;
}

.dismiss-all-btn:hover {
    border-color: rgba(251, 191, 36, 0.6);
    color: #fbbf24;
}

.alert-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(251, 191, 36, 0.06);
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: 8px;
    padding: 9px 12px;
    margin-bottom: 8px;
}

.alert-message {
    flex: 1;
    font-size: 0.85rem;
    color: #d97706;
    line-height: 1.4;
}

.alert-dismiss {
    background: transparent;
    border: none;
    color: #5a4010;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 2px 4px;
    border-radius: 3px;
    flex-shrink: 0;
    transition: color 0.15s;
}

.alert-dismiss:hover {
    color: #fbbf24;
}

.alert-price-change {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(99, 102, 241, 0.06);
}

.alert-price-change .alert-message {
    color: #a5b4fc;
}

.alert-price-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.alert-accept-price {
    background: #4f46e5;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 4px;
    transition: background 0.15s;
}

.alert-accept-price:hover {
    background: #6366f1;
}

.alert-price-change .alert-dismiss {
    font-size: 0.75rem;
    padding: 4px 8px;
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 4px;
    color: #818cf8;
}

.alert-price-change .alert-dismiss:hover {
    color: #a5b4fc;
    border-color: rgba(99, 102, 241, 0.6);
}

/* ============================================
   OPTIMIZER
   ============================================ */

.optimizer-prompt {
    text-align: center;
    padding: 48px 24px;
    color: #666;
    font-size: 0.95rem;
    line-height: 1.6;
}

.optimizer-stats {
    display: flex;
    gap: 32px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.opt-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.opt-stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.opt-stat-label {
    font-size: 0.78rem;
    color: #777;
}

.opt-section-header {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #555;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #222;
    margin-top: 8px;
}

/* Lock toggle button */
.lock-btn {
    background: transparent;
    border: 1px solid #333;
    color: #555;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.lock-btn:hover {
    border-color: #555;
    color: #aaa;
}

.lock-btn.locked {
    border-color: rgba(251, 191, 36, 0.4);
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.06);
}

/* Card left-border coloring per recommendation */
.service-card.svc-rec-cancel  { border-left: 3px solid #ef4444; }
.service-card.svc-rec-pause   { border-left: 3px solid #f59e0b; }
.service-card.svc-rec-keep    { border-left: 3px solid #22c55e; }
.service-card.svc-rec-subscribe { border-left: 3px solid #a855f7; }

/* Protected/locked card — mute the left border */
.service-card.svc-locked { border-left-color: #333; opacity: 0.75; }

/* Recommendation text inside service card */
.svc-rec-cancel   { color: #fca5a5; }
.svc-rec-pause    { color: #fcd34d; }
.svc-rec-keep     { color: #86efac; }
.svc-rec-subscribe { color: #d8b4fe; }

.svc-rec-icon {
    margin-right: 4px;
}

/* Service cards grid */
.service-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.service-card {
    background: #1a1a1a;
    border: 1px solid #222;
    border-radius: 8px;
    overflow: hidden;
}

.service-card-header {
    padding: 14px 18px;
    border-bottom: 1px solid #222;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.svc-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.svc-name {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}

.svc-cost {
    font-size: 0.82rem;
    color: #777;
}

.svc-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.svc-badge.active {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #4ade80;
}

.svc-badge.inactive {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid #3a3a3a;
    color: #666;
}

.svc-badge.unsubscribed {
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.3);
    color: #c084fc;
}

.svc-badge.bundled {
    background: rgba(100, 116, 139, 0.12);
    border: 1px solid rgba(100, 116, 139, 0.3);
    color: #94a3b8;
}

.svc-rec {
    font-size: 0.8rem;
    color: #aaa;
    line-height: 1.4;
}

/* "Airing now" badge on optimizer item rows */
.svc-item-airing {
    font-size: 0.7rem;
    color: #4ade80;
    background: rgba(74, 222, 128, 0.12);
    padding: 1px 6px;
    border-radius: 10px;
    white-space: nowrap;
}

/* Service item rows */
.svc-items {
    padding: 10px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.svc-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.svc-item-icon {
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.svc-item-title {
    color: #ccc;
    flex: 1;
    min-width: 0;
}

.svc-item-date {
    font-size: 0.76rem;
    color: #666;
    white-space: nowrap;
}

.svc-item.available .svc-item-icon { color: #4ade80; }
.svc-item.coming    .svc-item-icon { color: #f59e0b; }
.svc-item.coming    .svc-item-title { color: #aaa; }
.svc-item.completed .svc-item-icon { color: #555; }
.svc-item.completed .svc-item-title { color: #555; text-decoration: line-through; }

.svc-empty {
    font-size: 0.82rem;
    color: #444;
    font-style: italic;
    padding: 4px 0;
}

/* Inline date editor */
.set-date-btn {
    background: transparent;
    border: 1px solid #333;
    color: #666;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.72rem;
    transition: all 0.15s;
}

.set-date-btn:hover {
    border-color: #555;
    color: #bbb;
}

.date-input-inline {
    padding: 3px 8px !important;
    font-size: 0.8rem !important;
}

/* Optimizer stat unit (/mo suffix) and good state */
.opt-stat-unit {
    font-size: 1rem;
    font-weight: 400;
    color: #555;
}

.opt-stat.savings .opt-stat-value { color: #4ade80; }
.opt-stat.savings .opt-stat-label { color: #4ade80; opacity: 0.7; }

.opt-stat-good {
    font-size: 1rem;
    font-weight: 600;
    color: #4ade80;
}

/* ============================================
   SCROLLBAR
   ============================================ */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #111;
}

::-webkit-scrollbar-thumb {
    background: #2e2e2e;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #444;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 600px) {
    header {
        padding: 12px 16px;
    }

    .nav-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .results-container {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 12px;
    }

    .modal-content {
        padding: 16px;
    }

    .modal-poster {
        width: 80px;
    }

    .modal-title {
        margin-right: 96px;
        font-size: 1.1rem;
    }
}

/* ============================================
   ADMIN PAGE (admin.html — standalone)
   ============================================ */

.admin-gate {
    max-width: 380px;
    margin: 80px auto;
    padding: 32px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    text-align: center;
}

.admin-gate h2 {
    font-size: 1.2rem;
    color: #e0e0e0;
    margin-bottom: 8px;
}

.admin-gate-hint {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 20px;
}

.admin-gate input {
    width: 100%;
    padding: 10px 14px;
    background: #111;
    border: 1px solid #333;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 0.95rem;
    margin-bottom: 12px;
    outline: none;
}

.admin-gate input:focus {
    border-color: #555;
}

.admin-gate-error {
    font-size: 0.82rem;
    color: #f87171;
    margin-top: 8px;
}

.admin-summary {
    color: #aaa;
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.admin-user-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-user-card {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    padding: 16px;
}

.admin-user-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 12px;
}

.admin-user-email {
    font-weight: 600;
    font-size: 1rem;
    color: #e0e0e0;
}

.admin-user-status {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.status-active   { background: #14532d; color: #4ade80; }
.status-disabled { background: #450a0a; color: #f87171; }

.admin-user-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.admin-meta-item {
    font-size: 0.8rem;
    color: #888;
}
.admin-meta-item code {
    font-size: 0.75rem;
    background: #111;
    color: #a78bfa;
    padding: 1px 5px;
    border-radius: 4px;
    word-break: break-all;
}

.admin-user-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.admin-user-stats {
    display: flex;
    gap: 16px;
}

.admin-delete-btn {
    padding: 7px 16px;
    font-size: 0.82rem;
}

.admin-stat {
    background: #111;
    border-radius: 8px;
    padding: 8px 16px;
    text-align: center;
    min-width: 80px;
}

.admin-stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #e0e0e0;
}

.admin-stat-label {
    font-size: 0.72rem;
    color: #888;
    margin-top: 2px;
}

.loading-text { color: #888; padding: 16px 0; }
.error-text   { color: #f87171; padding: 16px 0; }
.empty-text   { color: #888; padding: 16px 0; }

/* ============================================================
   PUBLIC SEARCH PAGE (search.html)
   ============================================================ */

body.public-page {
  background: #0d0d0d;
  color: #e0e0e0;
  font-family: inherit;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.public-header {
  background: #111;
  border-bottom: 1px solid #222;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}
.public-header-inner {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.public-logo {
  font-size: 1.15rem;
  font-weight: 700;
  color: #e0e0e0;
  text-decoration: none;
  white-space: nowrap;
}

/* Auth bar */
.auth-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.auth-greeting {
  font-size: 0.85rem;
  color: #888;
}
.auth-btn {
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.auth-btn:hover { opacity: 0.85; }
.auth-btn-primary  { background: #6c63ff; color: #fff; }
.auth-btn-secondary {
  background: transparent;
  border: 1px solid #444;
  color: #ccc;
}
.auth-btn-google {
  background: #fff;
  border: 1px solid #dadce0;
  color: #3c4043;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.auth-btn-google:hover { background: #f8f8f8; opacity: 1; }

/* Hero */
.public-hero {
  text-align: center;
  padding: 52px 24px 36px;
  max-width: 700px;
  margin: 0 auto;
}
.public-hero h1 {
  font-size: 2rem;
  font-weight: 800;
  margin: 0 0 12px;
  color: #fff;
  line-height: 1.2;
}
.public-hero-sub {
  color: #888;
  font-size: 1rem;
  margin: 0 0 28px;
}
.public-search-bar {
  display: flex;
  gap: 10px;
  max-width: 560px;
  margin: 0 auto;
}
.public-search-bar input {
  flex: 1;
  padding: 13px 16px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 10px;
  color: #e0e0e0;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}
.public-search-bar input:focus { border-color: #6c63ff; }
.public-search-bar button {
  padding: 13px 24px;
  background: #6c63ff;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.public-search-bar button:hover { opacity: 0.85; }

/* Main content */
.public-main {
  flex: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 24px 40px;
  width: 100%;
  box-sizing: border-box;
}

/* Ad slots */
.ad-slot {
  max-width: 900px;
  margin: 0 auto;
  padding: 8px 24px;
  box-sizing: border-box;
}
.ad-slot-top    { margin-bottom: 8px; }
.ad-slot-inline { grid-column: 1 / -1; padding: 4px 0; }
.ad-slot-modal  { margin-top: 20px; border-top: 1px solid #222; padding-top: 16px; }

/* Public CTA box in modal */
.public-cta-box {
  margin-top: 20px;
  padding: 20px;
  background: #161616;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  text-align: center;
}
.public-cta-title {
  font-size: 1rem;
  font-weight: 600;
  color: #e0e0e0;
  margin: 0 0 14px;
}
.modal-cta-hint {
  font-size: 0.8rem;
  color: #666;
  margin: 10px 0 0;
  text-align: center;
}

/* ============================================
   HOW IT WORKS
   ============================================ */

.hiw-section {
  max-width: 860px;
  margin: 56px auto 0;
  padding: 0 20px;
  text-align: center;
}

.hiw-heading {
  font-size: 1.3rem;
  font-weight: 600;
  color: #e0e0e0;
  margin: 0 0 32px;
}

.hiw-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 36px;
}

@media (max-width: 600px) {
  .hiw-steps { grid-template-columns: 1fr; gap: 16px; }
}

.hiw-step {
  background: #111;
  border: 1px solid #222;
  border-radius: 10px;
  padding: 24px 20px;
  text-align: center;
}

.hiw-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.hiw-step h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e0e0e0;
  margin: 0 0 10px;
}

.hiw-step p {
  font-size: 0.84rem;
  color: #888;
  line-height: 1.55;
  margin: 0;
}

.hiw-cta {
  padding: 28px 0 0;
  border-top: 1px solid #1e1e1e;
}

.hiw-cta p {
  font-size: 0.85rem;
  color: #666;
  margin: 0 0 14px;
}

/* ============================================
   FAQ
   ============================================ */

.faq-section {
  max-width: 720px;
  margin: 48px auto 0;
  padding: 0 20px 60px;
}

.faq-heading {
  font-size: 1.15rem;
  font-weight: 600;
  color: #e0e0e0;
  margin: 0 0 20px;
  text-align: center;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.faq-item {
  border: 1px solid #1e1e1e;
  border-radius: 7px;
  overflow: hidden;
  background: #0d0d0d;
}

.faq-item + .faq-item { border-top-color: #1e1e1e; }

.faq-item summary {
  padding: 14px 18px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #d0d0d0;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}
.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: '+';
  font-size: 1.1rem;
  color: #555;
  flex-shrink: 0;
  margin-left: 12px;
  transition: transform 0.2s;
}

.faq-item[open] summary::after {
  content: '−';
}

.faq-item[open] summary {
  color: #e0e0e0;
  border-bottom: 1px solid #1e1e1e;
}

.faq-item p {
  margin: 0;
  padding: 14px 18px;
  font-size: 0.85rem;
  color: #888;
  line-height: 1.6;
}

/* Footer */
.public-footer {
  text-align: center;
  padding: 20px;
  font-size: 0.78rem;
  color: #555;
  border-top: 1px solid #1a1a1a;
}
.public-footer a { color: #666; }

/* Responsive */
@media (max-width: 500px) {
  .public-hero h1     { font-size: 1.5rem; }
  .public-search-bar  { flex-direction: column; }
  .auth-btn-secondary { display: none; }
}
