@import url('https://fonts.googleapis.com/css2?family=Capriola&display=swap');

/* === THEMES === */
/* =========================
   1. DARK THEME (DEFAULT)
   ========================= */
:root {
    /* --- Core Colors --- */
    --bg-body: #121212;
    --bg-card: #1f1f1f;
    --bg-input: #121212;
    --bg-poster: #000000;
    
    --text-main: #e0e0e0;
    --text-sub: #a0a0a0;
    --text-alpha: #a0a0a0;

    /* --- RGB Triplets (For Opacity/Badges) --- */
    --rgb-accent: 121, 80, 242;      /* Purple */
    --rgb-movie: 76, 110, 245;       /* Blue */
    --rgb-series: 240, 62, 62;       /* Red */
    --rgb-collection: 230, 126, 34;  /* Orange */
    --rgb-text: 224, 224, 224;       /* Main Text */
    --rgb-danger: 224, 49, 49;       /* Error Red */

    /* --- Pre-composed Colors --- */
    --color-accent: rgb(var(--rgb-accent));
    --color-accent-hover: #5f3dc4;

    /* --- UI Utilities --- */
    --border-dim: rgba(255, 255, 255, 0.1);      /* Standard Borders */
    --border-faint: rgba(255, 255, 255, 0.05);   /* Subtle Dividers */
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);
    --shadow-hover: 0 10px 20px rgba(0, 0, 0, 0.4);
    --shadow-nav: 0 4px 12px rgba(0, 0, 0, 0.3);
    
    --text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8); /* For text on backgrounds */
    
    --overlay-bg: rgba(0, 0, 0, 0.85);           /* Modals */
    --overlay-dim: rgba(0, 0, 0, 0.75);          /* Image Overlays */
    --overlay-glass: rgba(0, 0, 0, 0.4);         /* Sidebar */
    --scrollbar-thumb: rgba(255, 255, 255, 0.15);
    
    --bg-tint-dim: rgba(255, 255, 255, 0.1);
}

/* =========================
   2. LIGHT THEME
   ========================= */
body.theme-light {
    /* --- Core Colors --- */
    --bg-body: #edebeb;
    --bg-card: #ffffff;
    --bg-input: #e5e7eb;
    --bg-poster: #e5e7eb; /* Light grey instead of black for empty posters */

    --text-main: #111827;
    --text-sub: #4b5563;
    --text-alpha: #ffffff;

    /* --- RGB Triplets --- */
    --rgb-accent: 37, 99, 235;       /* Blue */
    --rgb-movie: 37, 99, 235;        /* Blue */
    --rgb-series: 220, 38, 38;       /* Red */
    --rgb-collection: 217, 119, 6;   /* Orange */
    --rgb-text: 17, 24, 39;          /* Main Text */
    --rgb-danger: 220, 38, 38;       /* Error Red */

    /* --- Pre-composed Colors --- */
    --color-accent: rgb(var(--rgb-accent));
    --color-accent-hover: #1d4ed8;

    /* --- UI Utilities --- */
    --border-dim: rgba(0, 0, 0, 0.15);
    --border-faint: rgba(0, 0, 0, 0.05);
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.2);
    --shadow-hover: 0 10px 20px rgba(0, 0, 0, 0.15);
    --shadow-nav: none;
    
    --text-shadow: none; /* No dropshadow on light backgrounds */
    
    --overlay-bg: rgba(0, 0, 0, 0.6);
    --overlay-dim: rgba(255, 255, 255, 0.75);
    --overlay-glass: rgba(60, 68, 78, 0.6);
    --scrollbar-thumb: rgba(0, 0, 0, 0.2);
    
    --bg-tint-dim: rgba(0, 0, 0, 0.05);
}

/* =========================
   3. JELLYBRRY THEME
   ========================= */
body.theme-jellybrry {
    /* --- Core Colors --- */
    --bg-body: #160e1d;
    --bg-card: #23152c;
    --bg-input: #160e1d;
    --bg-poster: #000000;

    --text-main: #f8fafc;
    --text-sub: #a78bfa;
    --text-alpha: #f8fafc;

    /* --- RGB Triplets --- */
    --rgb-accent: 192, 38, 211;      /* Fuchsia */
    --rgb-movie: 25, 55, 223;       /* Blueberry */
    --rgb-series: 236, 72, 153;      /* Raspberry */
    --rgb-collection: 168, 85, 247;  /* Blackberry */
    --rgb-text: 248, 250, 252;       /* Main Text */
    --rgb-danger: 225, 29, 72;       /* Rose */

    /* --- Pre-composed Colors --- */
    --color-accent: rgb(var(--rgb-accent));
    --color-accent-hover: #a21caf;

    /* --- UI Utilities --- */
    --border-dim: rgba(255, 255, 255, 0.1);
    --border-faint: rgba(255, 255, 255, 0.05);
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);
    --shadow-hover: 0 10px 20px rgba(0, 0, 0, 0.4);
    --shadow-nav: 0 4px 12px rgba(0, 0, 0, 0.3);
    
    --text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    
    --overlay-bg: rgba(20, 10, 30, 0.9);
    --overlay-dim: rgba(0, 0, 0, 0.75);
    --overlay-glass: rgba(20, 0, 34, 0.4);
    --scrollbar-thumb: rgba(255, 255, 255, 0.15);
    
    --bg-tint-dim: rgba(255, 255, 255, 0.1);
}

/* =========================
   4. THEME OVERRIDES
   ========================= */
body.theme-light .sort-option:hover {
    background: rgba(0,0,0,0.05);
}

body.theme-light #userIdSelect {
    /* Dark arrow for select dropdown */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='black' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
}

/* === BASE CSS === */
/* === Core Defaults === */
body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease;
}

/* === Scrollbars (Global) === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb); 
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-dim); /* Slightly lighter on hover */
}

/* === Setup Page === */
.setup-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    color: var(--color-accent);
    font-size: 1.3rem;
    font-weight: 400;
    font-family: "Capriola", sans-serif;
    gap: 10px;
}

.setup-logo {
    height: 30px;
    width: auto;
}

.setup-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.setup-container {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-dim);
    color: var(--text-main);
    border-radius: 6px;
    box-sizing: border-box; 
}

/* Universal select inputs */
.form-group select, 
#userIdSelect {
    width: 100%;
    padding: 10px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-dim);
    color: var(--text-main);
    border-radius: 6px;
    cursor: pointer;
    appearance: none;
    /* Default White Arrow (Dark/Jellybrry) - Light theme overrides this */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: calc(100% - 12px) center;
    box-sizing: border-box;
}

#userIdSelect option {
    background-color: var(--bg-card);
    color: var(--text-main);
}

/* Password Toggle */
.password-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.password-wrapper input {
    padding-right: 40px; 
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-sub);
    transition: color 0.2s;
}

.toggle-password:hover {
    color: var(--text-main);
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
}

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

/* === Navbar === */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-faint);
    display: flex;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-nav);
    height: 60px;
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1600px;
    padding: 0 2rem;
    margin: 0 auto;
    box-sizing: border-box;
}

.nav-left {
    display: flex;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    margin-right: 20px;
    color: var(--color-accent); 
    font-size: 1.3rem;
    font-weight: 400;
    font-family: "Capriola", sans-serif;
    gap: 10px;
}

.nav-logo {
    height: 30px;
    width: auto;
}

.nav-center {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    justify-content: center;
}

.search-filter-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-body);
    padding: 4px;
    border-radius: 20px;
    border: 1px solid var(--border-faint);
}

.nav-search input {
    background: transparent;
    border: none;
    padding: 6px 10px;
    color: var(--text-main);
    width: 350px;
    outline: none;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.btn-icon-only {
    background: transparent;
    border: none;
    color: var(--text-sub);
    padding: 6px 10px;
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.2s;
}

.btn-icon-only:hover {
    color: var(--color-accent);
}

.nav-actions {
    display: flex;
    align-items: center;
}

.nav-actions .btn-icon {
    color: var(--text-sub);
    margin-left: 10px;
    text-decoration: none;
    font-size: 1.1rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.nav-actions .btn-icon:hover {
    color: var(--text-main);
}

/* === Menus & Dropdowns === */
.sort-menu {
    min-width: 200px !important;
    padding: 10px;
}

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

.sort-group span {
    display: block;
    font-size: 0.75rem;
    color: var(--text-sub);
    margin-bottom: 5px;
    text-transform: uppercase;
    font-weight: 600;
}

.sort-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

.sort-options.full-width {
    grid-template-columns: 1fr;
}

.sort-option {
    background: var(--bg-body);
    border: 1px solid var(--border-dim);
    color: var(--text-sub);
    padding: 5px;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.sort-option:hover {
    background: var(--border-dim);
    color: white;
}

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

.sort-divider {
    height: 1px;
    background: var(--border-dim);
    margin: 10px 0;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--bg-card);
    min-width: 200px;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    border-radius: 8px;
    border: 1px solid var(--border-dim);
    margin-top: 10px;
}

.mega-menu {
    display: none;
    position: absolute;
    top: 100%; 
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--bg-card);
    width: max-content;
    min-width: 400px;
    max-width: 95vw;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid var(--border-dim);
}

.dropdown-content.show {
    display: block;
}

.mega-menu-grid {
    display: grid;
    grid-template-columns: auto auto auto auto;
    gap: 30px;
}

.filter-column h4 {
    margin: 0 0 10px 0;
    color: var(--color-accent);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-dim);
    padding-bottom: 5px;
}

.column-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 0.8rem;
    color: var(--text-sub);
}

.column-controls span {
    cursor: pointer;
}

.column-controls span:hover {
    color: var(--text-main);
    text-decoration: underline;
}

.checkbox-list {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.scrollable-list {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Custom Checkbox Look */
.checkbox-list label {
    font-size: 0.85rem;
    color: var(--text-sub);
    background-color: var(--bg-tint-dim); 
    border: 1px solid var(--border-dim); 
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    user-select: none;
    font-weight: 500;
    white-space: nowrap;
}

.checkbox-list label:hover {
    background-color: var(--border-dim);
    color: var(--text-main);
    border-color: var(--text-sub);
}

.checkbox-list input[type="checkbox"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
    white-space: nowrap;
}

.checkbox-list label:has(input:checked) {
    background-color: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
    box-shadow: var(--shadow-sm); 
}

.mega-menu-footer {
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid var(--border-dim);
    text-align: right;
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-sub);
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 6px 10px;
}

/* === Main Layout === */
.main-container {
    padding: 2rem;
    max-width: 1600px;
    margin: 0 auto;
    box-sizing: border-box;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-faint);
    padding-bottom: 0.5rem;
}

.section-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.section-header .count {
    background: var(--color-accent);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-left: 10px;
    align-self: center;
    color: white;
}

/* === Grid System === */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); 
    gap: 20px;
    margin-bottom: 3rem;
}

/* === Grouped View System === */
.group-section {
    margin-bottom: 3rem;
}

.group-header {
    font-size: 1.2rem;
    color: var(--text-main);
    margin-bottom: 1rem;
    border-left: 4px solid var(--color-accent);
    padding-left: 10px;
}

.horizontal-scroll-container {
    display: flex;
    overflow-x: auto;
    gap: 15px;
    padding-bottom: 20px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.horizontal-scroll-container .media-card {
    min-width: 160px;
    max-width: 160px;
    flex-shrink: 0;
}

/* === Card Styles === */
.media-card {
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
    cursor: pointer; 
}

.media-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.poster-wrapper {
    position: relative;
    aspect-ratio: 2/3;
    background: var(--bg-poster);
}

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

.overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--overlay-dim);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    font-weight: bold;
    color: white;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-dim);
}

.info {
    padding: 10px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.title {
    font-weight: bold;
    font-size: 0.95rem;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meta {
    font-size: 0.8rem;
    color: var(--text-sub);
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
}

.overview {
    display: none;
}

/* === Modal & Overlay === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 1000;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* === Details Modal === */
.details-content {
    max-width: 800px;
    padding: 0;
    overflow: hidden;
    background: var(--bg-body);
    display: flex;
    flex-direction: column;
}

.details-backdrop {
    width: 100%;
    height: 350px;
    background-size: cover;
    background-position: center top;
    position: relative;
}

.details-body {
    padding: 10px 20px 20px 20px;
    display: flex;
    gap: 25px;
    position: relative;
    margin-top: 0;
    z-index: 10;
    background-color: var(--bg-body);
}

.details-poster-container {
    flex-shrink: 0;
    width: 160px;
    height: 240px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-dim);
    background: var(--bg-poster);
    margin-top: -100px;
    position: relative;
    z-index: 20;
}

.details-poster-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.details-info {
    flex: 1;
    color: var(--text-main);
}

.details-info h2 {
    margin: 0 0 10px 0;
    font-size: 2rem;
    color: var(--text-main);
    text-shadow: var(--text-shadow);
}

.details-meta-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

/* Base Badge */
.badge {
    background: var(--bg-tint-dim);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
    border: 1px solid var(--border-dim);
}

/* Specific Badges using RGB variables for unified alpha handling */
.badge-type {
    text-transform: uppercase;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-main);
}

.badge-movie {
    background: rgba(var(--rgb-movie), 0.3);
    border-color: rgba(var(--rgb-movie), 0.5);
    color: rgba(var(--rgb-text), 0.8);
}

.badge-series {
    background: rgba(var(--rgb-series), 0.3);
    border-color: rgba(var(--rgb-series), 0.5);
    color: rgba(var(--rgb-text), 0.8);
}

.badge-collection {
    background: rgba(var(--rgb-collection), 0.3);
    border-color: rgba(var(--rgb-collection), 0.5);
    color: rgba(var(--rgb-text), 0.8);
}

.details-divider {
    height: 1px;
    background: var(--border-dim);
    margin: 15px 0;
}

.details-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.genre-chip {
    background: var(--bg-tint-dim);
    color: var(--text-main);
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-block;
    border: 1px solid var(--border-dim);
}

.details-tech-info {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-dim);
    font-size: 0.85rem;
    color: var(--text-sub);
}

.library-chip {
    background: var(--bg-card);
    color: var(--text-main);
    padding: 4px 12px;
    border-radius: 50px;
    font-family: monospace;
    font-size: 0.85rem;
    display: inline-block;
    border: 1px solid var(--border-dim);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 2rem;
    cursor: pointer;
    z-index: 20;
    text-shadow: var(--text-shadow);
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    gap: 15px;
}

.btn-danger {
    background: rgb(var(--rgb-danger));
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 1rem;
    cursor: pointer;
    text-align: center;
    min-width: 120px;
    display: inline-block;
    font-weight: 600;
}

.form-divider {
    height: 1px;
    background: var(--border-dim);
    margin: 1.5rem 0;
}

.flash-message {
    background: var(--color-accent);
    color: white;
    text-align: center;
    padding: 10px;
    font-weight: bold;
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    min-width: 300px;
    border-radius: 8px;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

/* === ALPHABET SIDEBAR === */
.alpha-sidebar {
    position: fixed;
    right: 2px;
    top: 55%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 1000;
    background: var(--overlay-glass);
    padding: 8px 4px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    border: 1px solid var(--border-dim);
}

.alpha-item {
    color: var(--text-alpha);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 1px 6px;
    text-align: center;
    font-weight: 600;
    transition: all 0.2s ease;
    user-select: none;
}

.alpha-item:hover {
    color: var(--text-main);
    transform: scale(1.4);
}

.alpha-item.active {
    color: var(--color-accent);
    transform: scale(1.4);
    font-weight: 800;
}

/* === Load More Button === */
.load-more-container {
    display: flex;
    justify-content: center;
    padding: 2rem 0;
    width: 100%;
}

.btn-load-more {
    background-color: var(--color-accent);
    color: #ffffff !important;
    border: 2px solid var(--color-accent);
    padding: 12px 40px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1rem;
    /*font-weight: 700;
    letter-spacing: 1px;*/
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.btn-load-more:hover {
    background-color: var(--color-accent-hover);
    color: #ffffff !important;
    box-shadow: var(--shadow-md);
}

.btn-load-more:active {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* === Utilities === */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* === Theme Selector UI (Settings) === */
.theme-selector-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

.theme-card {
    cursor: pointer;
    text-align: center;
    border: 1px solid var(--border-dim);
    border-radius: 8px;
    padding: 10px;
    background: var(--bg-body);
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.theme-card:hover {
    background: var(--border-dim);
    border-color: var(--text-sub);
}

.theme-card input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-card:has(input:checked) {
    border-color: var(--color-accent);
    background: rgba(var(--rgb-accent), 0.1);
    box-shadow: 0 0 0 1px var(--color-accent);
}

.theme-preview {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin-bottom: 5px;
    border: 2px solid var(--border-dim);
}

/* Added .thumb-img style to support SVGs in Index.html */
.thumb-img {
    width: 100%;
    height: auto;
    aspect-ratio: 150 / 100;
    border-radius: 4px;
    margin-bottom: 6px;
    display: block;
}

.preview-dark { background: linear-gradient(135deg, #121212 50%, #7950f2 50%); }
.preview-light { background: linear-gradient(135deg, #f3f4f6 50%, #2563eb 50%); }
.preview-jellybrry { background: linear-gradient(135deg, #160e1d 50%, #c026d3 50%); }
.preview-custom { background: linear-gradient(135deg, #333 50%, #888 50%); }

.color-input {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.color-input label {
    font-size: 0.8rem;
    color: var(--text-sub);
}

.color-input input {
    width: 100%;
    height: 35px;
    padding: 2px;
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
    border: 1px solid var(--border-dim);
}

.custom-color-section {
    margin-top: 10px;
    padding: 10px;
    background: var(--bg-body);
    border-radius: 8px;
    border: 1px solid var(--border-dim);
}

.color-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* === MOBILE === */

/* === Mobile View === */
@media (max-width: 768px) {
    .main-container {
        padding: 1rem;
    }

    .media-grid {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .media-grid .media-card {
        flex-direction: row;
        height: 120px;
    }

    .media-grid .poster-wrapper {
        width: 80px;
        aspect-ratio: auto;
        flex-shrink: 0;
    }

    .media-grid .title {
        font-size: 1rem;
        white-space: normal;
    }

    .media-grid .overview {
        font-size: 0.8rem;
        color: var(--text-sub); 
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .horizontal-scroll-container .media-card {
         min-width: 130px;
         max-width: 130px;
         height: auto;
         flex-direction: column;
    }
    
    .navbar {
        height: auto;
        padding: 1rem;
        flex-direction: column;
        align-items: stretch;
    }
    
    .nav-left {
        justify-content: center;
        margin-bottom: 10px;
    }
    
    .nav-search input {
        width: 100%;
    }
    
    .mega-menu {
        position: fixed;
        top: 60px;
        left: 0;
        transform: none;
        width: 100%;
        min-width: 0;
        height: calc(100vh - 60px);
        overflow-y: auto;
        border-radius: 0;
        border: none;
    }

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