/* =========================================================================
   1. CORE BASELINE, VARIABLES & RESET
   ========================================================================= */
:root {
    --bg-main: #0a0a0c;
    --bg-surface: #121216;
    --bg-card: #181820;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --success-bg: rgba(40, 167, 69, 0.15);
    --success-border: #28a745;
}

* { 
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: sans-serif;
}

body { 
    background-color: var(--bg-main);
    color: var(--text-primary);
    padding: 2rem;
}

.container { 
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

h1, h2, h3 { 
    margin-bottom: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

h2 { 
    color: var(--text-secondary);
    font-size: 1.4rem;
    margin-top: 2rem;
    border-left: 4px solid var(--accent);
    padding-left: 10px;
}


/* =========================================================================
   2. REUSABLE COMPONENTS
   ========================================================================= */

/* --- Buttons --- */
.btn { 
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 0.8rem;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    border: none;
    box-sizing: border-box;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
    background: var(--accent);
    color: #ffffff;
    font-size: 0.9rem;
    font-family: inherit;
    gap: 0.4rem;
    line-height: 1;
}

.btn span, 
.btn i {
    font-size: 0.9em;
    line-height: 1;
}

.btn:hover {
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.btn:active {
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.4);
}

.btn-sm { 
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 6px;
}

.btn-sec { 
    background: #1e293b !important;
    color: #93c5fd !important;
    border: 1px solid #1d4ed8 !important;
    padding: 0.6rem 1.2rem;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.btn-sec:hover { 
    background: #2563eb !important;
    color: #ffffff !important;
    border-color: #3b82f6 !important;
}

.btn-trailer {
    background: #990000;
    color: #fff;
    border: 1px solid #cc0000;
}

.btn-random {
    background-color: #6b21a8;
    color: #fff;
}

.btn-tmdb {
    margin: 0;
    background: #0d253f;
    color: #01b4e4;
    border: 1px solid #01b4e4;
}

.btn-imdb {
    margin: 0;
    background: #f5c518;
    color: #000;
    border: 1px solid #f5c518;
}

.btn-primary-custom {
    background-color: #238636;
    color: #ffffff !important;
    border: 1px solid rgba(240, 246, 252, 0.1);
}

.btn-primary-custom:hover {
    background-color: #2ea043;
}

.btn-secondary-custom {
    background-color: #21262d;
    color: #c9d1d9 !important;
    border: 1px solid #30363d;
}

.btn-secondary-custom:hover {
    background-color: #30363d;
    border-color: #8b949e;
}

.btn-tmdb-import {
    background-color: #01b4e4;
    color: #ffffff !important;
    font-weight: 600;
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    text-decoration: none;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: 4px;
}

.btn-tmdb-import:hover {
    background-color: #009ec8;
}

.btn-tmdb-sec {
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    text-decoration: none;
}

.btn-tmdb-search {
    background: #0d253f;
    color: #01b4e4;
    border: 1px solid #01b4e4;
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    font-weight: bold;
    white-space: nowrap;
}

.btn-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
}

.btn-more {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-more:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn-sync {
    background: #01b4e4;
    color: #fff;
}

.btn-del {
    background: rgba(220, 38, 38, 0.15);
    color: #f87171;
    border: 1px solid rgba(220, 38, 38, 0.4);
}

.btn-del:hover {
    background: rgba(220, 38, 38, 0.3);
}

/* --- Badges & Tags --- */
.badge { 
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    display: inline-block;
}

.badge.known {
    background: var(--success-border);
    color: white;
}

.badge.type {
    background: var(--bg-card);
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
}

.badge.type.badge-warning {
    background-color: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-none {
    opacity: 0.75;
    font-size: 0.75rem;
    color: var(--text-secondary);
    user-select: none;
}

.badge-beta {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
    border: 1px solid var(--accent);
    background-color: color-mix(in srgb, var(--accent) 15%, transparent);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    line-height: 1;
    vertical-align: middle;
}

.badge.fav {
    background: #ffb300;
    color: #000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.badge.seen {
    background: #0288d1;
    color: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.you-badge {
    font-size: 0.75rem;
    color: var(--accent, #007bff);
}

.media-type-badge {
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: rgba(255,255,255,0.06);
    color: var(--text-secondary);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-weight: bold;
    margin-left: 0.5rem;
    text-transform: uppercase;
    border: 1px solid #333;
    line-height: 1;
}

.movie-format span,
.badge-format {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    min-width: 40px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    box-sizing: border-box;
    white-space: nowrap;
    padding: 0 6px;
    background: #1e293b;
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.movie-format span.fmt-4k,
.badge-format.fmt-4k {
    background: #0f172a;
    color: #f59e0b;
    border: 1px solid #d97706;
}

.movie-format span.fmt-bd,
.badge-format.fmt-bd {
    background-color: rgba(24, 60, 110, 0.6);
    color: #8ab4f8;
    border: 1px solid rgba(66, 133, 244, 0.3);
}

.movie-format span.fmt-3d,
.badge-format.fmt-3d {
    background: #581c87;
    color: #f0abfc;
    border: 1px solid #a855f7;
}

.movie-format span.fmt-dvd,
.badge-format.fmt-dvd {
    background: #334155;
    color: #e2e8f0;
    border: 1px solid #64748b;
}

.format-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.tag-new {
    font-size: 0.7rem;
    color: #4ade80;
    background: rgba(74, 222, 128, 0.12);
    border: 1px solid rgba(74, 222, 128, 0.3);
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
}

.tag-exists {
    font-size: 0.7rem;
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.12);
    border: 1px solid rgba(96, 165, 250, 0.3);
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
}

.genre-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: background 0.2s ease;
}

.genre-tag:hover {
    background: rgba(255, 255, 255, 0.18);
}

.collection-badge-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.collection-split-pill {
    display: inline-flex;
    align-items: center;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 20px;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.collection-split-pill:hover {
    border-color: rgba(59, 130, 246, 0.5);
}

.collection-split-pill .pill-action-left {
    padding: 0.2rem 0.65rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #60a5fa;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.collection-split-pill .pill-action-left:hover {
    background: rgba(59, 130, 246, 0.2);
    color: #ffffff;
}

.collection-split-pill .pill-action-right {
    background: transparent;
    border: none;
    border-left: 1px solid rgba(59, 130, 246, 0.3);
    padding: 0.2rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #93c5fd;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.collection-split-pill .pill-action-right:hover {
    background: rgba(59, 130, 246, 0.3);
    color: #ffffff;
}

.status-badges-interactive {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.status-badges-interactive .badge-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.15s ease;
}

.status-badges-interactive .badge-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.status-badges-interactive .badge-btn.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.badge-btn:disabled {
    cursor: not-allowed;
}

/* --- Form Control Elements & Inputs --- */
.edit-form { 
    width: 100%;
}

.edit-form label { 
    display: block;
    margin-top: 1rem;
    margin-bottom: 0.3rem;
    font-weight: bold;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.edit-form input[type="text"], 
.edit-form input[type="number"], 
.edit-form input[type="password"], 
.edit-form textarea, 
.edit-form select { 
    width: 100%;
    background: var(--bg-card);
    border: 1px solid #444;
    color: white;
    padding: 0.8rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    outline: none;
    transition: border 0.2s;
    display: block;
}

.edit-form input:focus, 
.edit-form textarea:focus, 
.edit-form select:focus { 
    border-color: var(--accent);
}

.checkbox-card { 
    background: var(--bg-card);
    border: 1px solid #444;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.checkbox-item { 
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    color: #fff;
}

.checkbox-item input { 
    width: auto;
    height: auto;
    cursor: pointer;
}

.form-actions { 
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

/* --- System Alerts & Notifications --- */
.alert {
    position: fixed !important;
    top: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    width: auto !important;
    min-width: 300px;
    max-width: 90%;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    z-index: 2000 !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
    margin: 0;
}

.alert button {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
}

.alert button:hover,
.alert-close-btn:hover {
    opacity: 1;
}

.alert-success {
    background: rgba(40, 167, 69, 0.25);
    border-left-color: #28a745;
    color: #d4edda;
}

.alert-error {
    background: rgba(220, 53, 69, 0.25);
    border-left-color: #dc3545;
    color: #f8d7da;
}

.alert-warning {
    background: rgba(255, 193, 7, 0.25);
    border-left-color: #ffc107;
    color: #fff3cd;
}


/* =========================================================================
   3. LAYOUT STRUCTURE & NAVIGATION (Header & Footer)
   ========================================================================= */
.header-bar { 
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    padding: 1rem 1.5rem;
    box-sizing: border-box;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 1rem auto;
    border-radius: 12px;
    border: 1px solid #333;
}

.header-brand {
    font-size: 1.4rem;
    font-weight: bold;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.header-brand span { 
    color: var(--accent);
}

.header-actions-group { 
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-profile .user-info { 
    text-align: right;
    font-size: 0.85rem;
}

footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 4rem;
    border-top: 1px solid #222;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

footer p {
    margin: 0;
}

.tmdb-attribution {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    opacity: 0.75;
    font-size: 0.8rem;
}

.tmdb-attribution img {
    height: 14px;
    width: auto;
}


/* =========================================================================
   4. SEARCH ENGINE & FILTERS
   ========================================================================= */
.search-bar { 
    background: var(--bg-surface);
    border-radius: 10px;
    display: flex;
    gap: 0.6rem;
    align-items: center;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    width: 100%;
}

.search-bar .btn,
.search-bar .btn-toggle {
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.search-input-wrapper #searchInput { 
    flex: 1;
    min-width: 0;
    background: var(--bg-card);
    border: 1px solid #444;
    color: white;
    outline: none;
    transition: border-color 0.2s ease;
    width: 100%;
    height: 42px;
    padding-left: 2.6rem;
    padding-right: 2.2rem;
    box-sizing: border-box;
    border-radius: 6px;
}

.search-input-wrapper.has-mode-toggle #searchInput {
    padding-right: 6.8rem;
}

.search-input-wrapper #searchInput:focus { 
    border-color: var(--accent);
}

.search-submit-btn {
    position: absolute;
    left: 0.4rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 0.3rem 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color 0.15s ease, background 0.15s ease;
    z-index: 2;
}

.search-submit-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
}

.clear-search-btn {
    position: absolute;
    right: 0.6rem;
    background: none;
    border: none;
    color: var(--text-secondary, #888);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    line-height: 1;
    border-radius: 50%;
    transition: color 0.15s ease, background 0.15s ease;
    z-index: 2;
}

.search-input-wrapper.has-mode-toggle .clear-search-btn {
    right: 5.2rem;
}

.clear-search-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

#searchInput::-webkit-search-decoration,
#searchInput::-webkit-search-cancel-button,
#searchInput::-webkit-search-results-button,
#searchInput::-webkit-search-results-decoration {
    -webkit-appearance: none;
}

.search-results-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0.75rem 0;
    padding: 0 0.25rem;
    min-height: 38px;
}

.search-action-left {
    display: flex;
    align-items: center;
}

.search-info-right {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--text-secondary, #a0a0a0);
}

.search-info-right strong {
    color: #ffffff;
}

.mode-toggle-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: #252530;
    border: 1px solid #3d3d4e;
    color: #9ca3af;
    padding: 0.25rem 0.5rem;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s ease;
    z-index: 2;
}

.mode-toggle-btn.is-tmdb {
    background: #2563eb;
    border-color: #3b82f6;
    color: #ffffff;
}

.filter-collapse {
    background: var(--bg-surface);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.filter-toggle-btn {
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    color: var(--text-primary);
    list-style: none;
    background: rgba(255, 255, 255, 0.02);
}

.filter-toggle-btn:hover { background: rgba(255, 255, 255, 0.07);}
.filter-toggle-btn::-webkit-details-marker { display: none;}

.toggle-icon { font-size: 0.8rem;transition: transform 0.2s ease;}
.filter-collapse[open] .toggle-icon { transform: rotate(180deg);}

.filter-dashboard-control-bar {
    padding: 1.25rem;
    width: 100%;
}

.filter-dashboard-form {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.filter-control-group {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

.filter-control-group.collection-group {
    max-width: 220px;
    flex: 1 1 180px;
}

.filter-control-label {
    font-size: 0.7rem;
    font-weight: 7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary, #a1a1aa);
    margin-bottom: 0.25rem;
    white-space: nowrap;
}

.filter-select-input {
    width: 100%;
    padding: 0.45rem 0.5rem;
    background: var(--bg-card);
    color: white;
    border: 1px solid #333;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: bold;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s ease;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.filter-select-input:focus {
	border-color: var(--accent);
}

.filter-select-input option {
	background: var(--bg-card);
	color: white;
}

.filter-select-input.filter-active {
    border-color: #6366f1 !important;
    background-color: rgba(99, 102, 241, 0.12) !important;
    color: #ffffff !important;
    font-weight: 600;
}

.filter-control-group:has(.filter-active) .filter-control-label {
    color: #818cf8 !important;
    font-weight: 600;
}

.filter-reset-group {
    justify-content: flex-end;
    align-self: flex-end;
}

.btn-filter-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.65rem;
    background: var(--bg-card);
    border: 1px solid #333;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-primary, #fff);
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
    transition: all 0.2s ease;
    line-height: normal;
}

.btn-filter-reset:hover {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

/* --- Search Suggestions & Empty States --- */
.empty-state {
    grid-column: 1 / -1;
    width: 100%;
    max-width: 650px;
    margin: 2rem auto;
    padding: 2.5rem 2rem;
    background-color: #161b22;
    border: 1px solid #21262d;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.empty-state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background-color: #21262d;
    border-radius: 50%;
    color: #8b949e;
    margin-bottom: 1.25rem;
}

.empty-state-title {
    font-size: 1.35rem;
    font-weight: 600;
    color: #f0f6fc;
    margin: 0 0 0.5rem 0;
}

.empty-state-text {
    color: #8b949e;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0 auto 1.75rem auto;
    max-width: 480px;
}

.empty-state-text strong {
    color: #c9d1d9;
}

.empty-state-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.empty-state-actions a,
.empty-state-actions button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.did-you-mean-box {
    margin-bottom: 1.5rem;
    background: #21262d;
    padding: 0.85rem 1.2rem;
    border-radius: 8px;
    border: 1px solid #30363d;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.did-you-mean-label {
    color: #8b949e;
    font-size: 0.9rem;
}

.did-you-mean-links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.suggestion-chip {
    color: #58a6ff;
    background-color: rgba(56, 139, 253, 0.1);
    border: 1px solid rgba(56, 139, 253, 0.3);
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.suggestion-chip:hover {
    background-color: rgba(56, 139, 253, 0.25);
    border-color: #58a6ff;
    color: #ffffff;
}


/* =========================================================================
   5. CATALOG VIEWS (Grid & Multi-column List)
   ========================================================================= */

/* --- Grid View --- */
.movie-grid { 
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.2rem;
    width: 100%;
}

.movie-card { 
    background: var(--bg-card);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    position: relative;
    box-sizing: border-box;
    height: auto;
    overflow: hidden;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.movie-card:hover { 
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.movie-card img { 
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 0;
    margin: 0;
    padding: 0;
    display: block;
}

.poster-frame { 
    width: 100%;
    aspect-ratio: 2/3;
    background: var(--bg-card);
    object-fit: cover;
}

.movie-info { 
    padding: 0.65rem 0.5rem !important;
    box-sizing: border-box;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    background: var(--bg-card);
    text-align: center;
}

.movie-title { 
    font-size: 0.92rem;
    font-weight: bold;
    color: var(--text-primary);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    min-height: 2.6em;
    text-align: center;
    width: 100%;
}

.movie-info .movie-format {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin: 0.3rem 0;
    width: 100%;
}

.movie-footer {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
}

.movie-footer span:not(:last-child)::after {
    content: "•";
    margin-left: 0.35rem;
    color: rgba(255, 255, 255, 0.25);
}

.movie-runtime {
    font-size: 0.8rem;
    opacity: 0.7;
}

.movie-rating {
    color: #ffc107;
    font-weight: bold;
}

.status-ribbon {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 4px;
    z-index: 10;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.movie-card:hover .status-ribbon {
    opacity: 1;
    transform: translateY(0);
}

/* --- Multi-Column List View --- */
.media-list-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
    width: 100%;
}

.media-list-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-surface);
    padding: 0 0.6rem 0 0;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s, border-color 0.2s;
    min-width: 0;
    min-height: 80px;
    overflow: hidden;
}

.media-list-row:hover {
    background: var(--bg-card);
    border-color: rgba(255, 255, 255, 0.2);
}

.list-thumb {
    width: 54px;
    height: 81px;
    flex-shrink: 0;
    border-radius: 4px;
}

.list-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.list-main-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.list-main-info .movie-format {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    width: auto;
}

.list-title {
    font-weight: 600;
    font-size: 0.95rem;
    min-width: 0;
    width: 100%;
}

.list-title .title-text {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.list-meta-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
    flex-shrink: 0;
}

.list-year {
    color: #888;
    font-size: 0.85rem;
}

.list-rating {
    font-size: 0.85rem;
    color: #ffc107;
    font-weight: bold;
}

.list-main-info .badge.fav,
.list-main-info .badge.seen {
    height: 20px;
    min-width: 24px;
    padding: 0 6px;
    border-radius: 4px;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

.list-main-info .badge.fav {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.list-main-info .badge.seen {
    background: rgba(2, 136, 209, 0.2);
    color: #38bdf8;
    border: 1px solid rgba(2, 136, 209, 0.4);
}

.view-toggle-group {
    display: flex;
    gap: 2px;
    background: rgba(255,255,255,0.05);
    padding: 2px;
    border-radius: 6px;
}

.btn-toggle {
    padding: 0.35rem 0.65rem;
    font-size: 0.85rem;
    color: #888;
    text-decoration: none;
    border-radius: 4px;
}

.btn-toggle.active {
    background: var(--accent);
    color: white;
}


/* =========================================================================
   6. PROFILE & DETAIL PAGE LAYOUT (view.php)
   ========================================================================= */
.detail-layout-wrapper { 
    display: flex;
    gap: 3rem;
    margin-top: 1rem;
    align-items: flex-start;
    width: 100%;
}

.detail-sidebar { 
    width: 300px;
    flex-shrink: 0;
}

.detail-content-pane { 
    flex: 1;
    background: var(--bg-surface);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    min-width: 0;
    width: 100%;
}

.detail-poster { 
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
    object-fit: cover;
}

.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.detail-title-bar { 
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.5rem;
    width: 100%;
}

.detail-meta-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.detail-meta-line .meta-item {
    white-space: nowrap;
}

.detail-meta-line .meta-bullet {
    color: var(--text-secondary);
    opacity: 0.6;
}

.movie-genres {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.section-header { 
    margin: 1.5rem 0 0.5rem 0;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    border-bottom: 1px solid #333;
    padding-bottom: 4px;
    font-weight: bold;
}

.grid-layout { 
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.5rem;
    font-size: 0.95rem;
    line-height: 1.4;
    width: 100%;
}

.notes-box { 
    background: rgba(255, 179, 0, 0.05);
    border-left: 4px solid #ffb300;
    padding: 1rem;
    border-radius: 4px;
    line-height: 1.5;
    margin-top: 0.5rem;
    width: 100%;
}

.format-sidebar-card { 
    width: 100%;
    margin: 0.5rem 0;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #2d3748;
    padding: 0.5rem 0.6rem;
    border-radius: 8px;
    box-sizing: border-box;
}

.format-card-title { 
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: bold;
    color: var(--text-secondary);
    margin: 0 0 0.4rem 0;
    border-bottom: 1px solid #222;
    padding-bottom: 0.3rem;
}

.admin-actions-card {
    background: var(--bg-surface);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.6rem;
    margin-top: 0.2rem;
}

.admin-title {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-secondary);
    letter-spacing: 0.8px;
    margin-bottom: 0.4rem;
}

.admin-buttons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.admin-buttons-grid .btn {
    box-sizing: border-box;
    margin: 0;
    width: 100%;
}

.admin-buttons-grid .btn:last-child:nth-child(odd) {
    grid-column: span 2;
}

.more-actions-dropdown {
    width: 100%;
}

.more-actions-dropdown summary {
    display: none;
}

.more-actions-dropdown summary::-webkit-details-marker {
    display: none;
}

.more-actions-dropdown[open] summary .arrow {
    transform: rotate(180deg);
}

.more-actions-dropdown .arrow {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.more-actions-dropdown .dropdown-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.view-section-title {
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
    color: #0e63be !important;
    font-weight: bold;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #222;
    padding-bottom: 0.4rem;
    width: 100%;
}

.cinematic-person-card {
    background: rgba(255, 255, 255, 0.02);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    border: 1px solid #222;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.15rem;
    box-sizing: border-box;
}

.cinematic-person-link {
    color: var(--text-primary) !important;
    font-weight: bold;
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-block;
    transition: color 0.2s ease;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cinematic-person-link:hover {
    color: var(--accent) !important;
}

.cinematic-person-text {
    color: var(--text-primary);
    font-weight: bold;
    font-size: 0.9rem;
    display: inline-block;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.character-role {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-style: italic;
    line-height: 1.3;
}

.poster-fallback-canvas {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 2 / 3;
    background: linear-gradient(135deg, #131722 0%, #1e2640 100%);
    border-bottom: 1px solid #2d3748;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    padding: 1.5rem;
    box-sizing: border-box;
    text-align: center;
    user-select: none;
}

.poster-fallback-icon {
    font-size: 2.5rem;
    opacity: 0.6;
    color: var(--accent);
}

.poster-fallback-text {
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.6;
    line-height: 1.4;
}


/* =========================================================================
   7. ADMINISTRATION PANEL & TABS
   ========================================================================= */
.admin-settings-panel {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 95%;
    max-width: 850px;
    max-height: 85vh;
    overflow-y: auto;
    z-index: 1000;
    background: var(--bg-card, #121212);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    padding: 2rem;
}

.admin-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999;
}

.tabs-navigation {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}

.tab-trigger { 
    background: transparent;
    color: var(--text-secondary, #a0a0a0);
    border: 1px solid transparent;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-trigger:hover { 
    color: var(--text-primary, #ffffff);
    background: rgba(255, 255, 255, 0.05);
}

.tab-trigger.active-tab { 
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.tab-pane { 
    display: none !important;
    width: 100%;
}

.tab-pane.active-pane {
    display: block !important;
    animation: fadeInTab 0.25s ease-out;
}

#usersTab {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

#usersTab.active-pane {
    display: flex !important;
    flex-direction: column;
    gap: 1.5rem;
}

.tab-pane .edit-form { 
    width: 100%;
    margin: 0 auto;
    background: transparent;
    border: none;
    padding: 0;
}

.user-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.user-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    gap: 1rem;
}

.user-row .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    height: auto;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-actions .role-select {
    min-width: 130px;
    padding: 0.25rem 0.5rem;
    margin-bottom: 0;
}

.button-group {
    display: flex;
    gap: 0.5rem;
}


/* =========================================================================
   8. TMDB IMPORT & COMPARISON TOOLS
   ========================================================================= */
.tmdb-banner {
    background: rgba(1, 180, 228, 0.1);
    border: 1px solid #01b4e4;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.tmdb-banner-title {
    color: #01b4e4;
    font-weight: bold;
}

.tmdb-banner-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-surface);
    border-radius: 12px;
    margin-bottom: 2rem;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.results-table th, 
.results-table td {
    padding: 1rem;
    text-align: left;
}

.results-table th {
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
}

.results-table tr {
    border-bottom: 1px solid #26262b;
}

.results-table tr.known {
    background-color: var(--success-bg);
}

.tmdb-inline-link {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    margin-left: 0.5rem;
    padding: 0.15rem 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #01b4e4 !important;
    background: rgba(1, 180, 228, 0.15);
    border: 1px solid rgba(1, 180, 228, 0.4);
    border-radius: 4px;
    text-decoration: none;
    vertical-align: middle;
    transition: all 0.2s ease;
}

.tmdb-inline-link:hover {
    background: #01b4e4;
    color: #0d253f !important;
    border-color: #01b4e4;
}

.compare-container-wrapper { 
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    display: block;
}

.compare-grid { 
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 1.5rem;
    width: 100%;
}

.col-box { 
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #333;
    min-width: 0;
}

.col-header { 
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 1rem;
    border-bottom: 2px solid #444;
    padding-bottom: 0.5rem;
}

.field-title { 
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: bold;
    margin-top: 1.2rem;
    margin-bottom: 0.2rem;
}

.col-box > div:not(.col-header):not(.field-title) { 
    font-size: 1.05rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.col-box .plot-preview { 
    font-size: 0.95rem !important;
    line-height: 1.5;
    color: var(--text-secondary);
}

.changed-field { 
    background: rgba(245, 197, 24, 0.1);
    border-left: 4px solid #f5c518;
    padding: 6px 10px;
    border-radius: 0 6px 6px 0;
    margin-bottom: 0.5rem;
}


/* =========================================================================
   9. MODALS & OVERLAYS
   ========================================================================= */

/* --- Import Modal --- */
.import-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.import-modal-content {
    background: #18181b;
    border: 1px solid #27272a;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    padding: 1.5rem;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    color: #f4f4f5;
}

.import-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: #a1a1aa;
    font-size: 1.5rem;
    cursor: pointer;
}

.import-modal-body {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
}

.import-modal-poster-wrapper {
    width: 100px;
    height: 150px;
    flex-shrink: 0;
}

.import-modal-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    background: #27272a;
}

.import-modal-fallback {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.5rem;
}

.import-modal-details {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.import-modal-title {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary, #fff);
}

.import-modal-meta {
    font-size: 0.8rem;
    color: #a1a1aa;
    margin: 0;
}

.import-modal-tagline {
    font-size: 0.8rem;
    font-style: italic;
    color: #d4d4d8;
    margin: 0.15rem 0;
}

.import-modal-plot {
    font-size: 0.8rem;
    color: #a1a1aa;
    line-height: 1.35;
    margin-top: 0.15rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Import Batch Summary & Preview --- */
.import-batch-summary {
    width: 100%;
}

.import-batch-scroll {
    max-height: 200px;
    overflow-y: auto;
    background: #18181b;
    border: 1px solid #27272a;
    border-radius: 6px;
    padding: 0.75rem;
}

.import-batch-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.85rem;
}

.import-batch-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
}

.import-batch-list li strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.import-batch-list + .import-batch-list {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid #27272a;
}

.import-batch-list.success-list li {
    color: #4ade80;
}

.import-batch-list.warning-list li {
    color: #fbbf24;
}

.import-item-main {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    flex: 1;
}

.import-item-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.import-item-year {
    font-weight: normal;
    opacity: 0.8;
    white-space: nowrap;
    flex-shrink: 0;
}

.collection-preview-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.collection-preview-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    padding: 0.25rem 0;
    border-bottom: 1px dashed #27272a;
}

.collection-preview-item:last-child {
    border-bottom: none;
}

.collection-preview-item.item-exists {
    opacity: 0.65;
}

.collection-preview-item.item-exists .import-item-title {
    color: #a1a1aa;
}

.import-loader-spinner {
    width: 42px;
    height: 42px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: #3b82f6;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1.25rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Trailer Modal --- */
.trailer-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.trailer-modal.show {
    display: flex;
}

.trailer-modal-content {
    position: relative;
    width: 90%;
    max-width: 900px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.trailer-close {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    z-index: 10;
}

.iframe-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;/* 16:9 ratio */
    height: 0;
}

.iframe-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}


/* =========================================================================
   10. ANIMATIONS
   ========================================================================= */
@keyframes fadeInTab {
    from { opacity: 0;transform: translateY(4px);}
    to { opacity: 1;transform: translateY(0);}
}

@keyframes slideFadeIn {
    from { opacity: 0;transform: translateY(-4px);}
    to { opacity: 1;transform: translateY(0);}
}


/* =========================================================================
   11. RESPONSIVE MEDIA QUERIES
   ========================================================================= */

/* Desktop Display Enhancements (min-width: 769px) */
@media (min-width: 769px) {
    .filter-toggle-btn {
        display: none !important;
    }

    .filter-collapse {
        border: none;
        background: transparent;
        box-shadow: none;
    }

    .filter-dashboard-control-bar {
        padding: 0;
    }
    
    .search-bar { 
        padding: 0.85rem 1rem;
    }
    
    .admin-settings-panel {
        min-height: 600px;
    }
}

/* Tablets & Phones (max-width: 768px) */
@media (max-width: 768px) {
    body { 
        padding: 0.5rem;
    }

    .header-bar { 
        padding: 0.75rem 1rem;
        margin-bottom: 1rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .header-brand {
        font-size: 1.1rem;
    }

    .user-profile { 
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .user-profile .user-info { 
        display: none;
    }

    .movie-grid { 
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 0.75rem;
    }

    .media-list-container {
        grid-template-columns: 1fr;
    }

    .detail-layout-wrapper { 
        flex-direction: column;
        gap: 1rem;
        margin-top: 0;
    }

    .detail-sidebar { 
        width: 100%;
    }

    .detail-content-pane { 
        padding: 0.5rem;
    }

    .detail-title-bar { 
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .compare-grid { 
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .admin-settings-panel { 
        padding: 1rem;
        width: 100%;
        box-sizing: border-box;
    }

    .filter-dashboard-control-bar {
        padding: 0.85rem;
    }

    .filter-dashboard-form {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .filter-control-group { 
        width: 100%;
        grid-column: span 1;
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }
	
    .filter-control-group.collection-group,
    .filter-reset-group {
        grid-column: span 2;
    }
	
    .filter-control-label {
        font-size: 0.7rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
	
    .filter-select-input {
        width: 100%;
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
    }

    .filter-collapse { 
        background: var(--bg-surface);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 10px;
    }
	
    .filter-toggle-btn { 
        display: flex;
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
	
    .filter-reset-group { 
        width: 100%;
        margin-top: 0.25rem;
    }

    .filter-reset-group .btn { 
        width: 100%;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .search-bar { 
        display: flex;
        flex-wrap: wrap;
        gap: 0.75rem;
        width: 100%;
    }

    .search-bar .search-input-wrapper { 
        width: 100%;
        flex: 1 0 100%;
        position: relative;
    }

    .search-bar .search-input-wrapper #searchInput { 
        width: 100%;
        box-sizing: border-box;
        padding-left: 2.6rem;
        padding-right: 2.2rem;
        height: 42px;
        font-size: 0.95rem;
    }

    .search-bar .search-submit-btn { 
        position: absolute;
        left: 0.5rem;
        top: 50%;
        transform: translateY(-50%);
        z-index: 2;
    }

    .search-results-bar { 
        flex-direction: column-reverse;
        align-items: flex-end;
        gap: 0.5rem;
    }

    .search-action-left,
    .btn-tmdb-search { 
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .form-actions { 
        flex-direction: column;
        align-items: stretch;
    }

    .form-actions button, 
    .form-actions a { 
        width: 100%;
    }

    .tabs-navigation { 
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .tab-trigger { 
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
        flex: 1;
        text-align: center;
    }

    .sidebar-actions .btn { 
        padding: 0.5rem 0.6rem;
        font-size: 0.85rem;
    }

    .more-actions-dropdown summary { 
        display: flex;
        justify-content: space-between;
        align-items: center;
        cursor: pointer;
        list-style: none;
    }

    .more-actions-dropdown summary::-webkit-details-marker { 
        display: none;
    }

    .more-actions-dropdown .dropdown-content { 
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px dashed rgba(255, 255, 255, 0.1);
    }

    .user-row { 
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .user-actions,
    .role-select,
    .button-group { 
        width: 100%;
    }

    .results-table thead { 
        display: none;
    }

    .results-table tr { 
        background: var(--bg-surface);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 10px;
        margin-bottom: 0.75rem;
        padding: 0.85rem 1rem;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .results-table td:nth-child(1) { 
        font-size: 1rem;
        padding: 0;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.4rem 0.6rem;
    }

    .results-table td:nth-child(1) strong,
    .results-table td:nth-child(1) a:not(.badge) {
        font-size: 1.05rem;
    }

    .results-table td:nth-child(2) { 
        padding: 0;
        margin: 0;
        display: flex;
        align-items: center;
    }

    .results-table td:nth-child(2) .badge {
        font-size: 0.7rem !important;
        padding: 0.15rem 0.4rem !important;
    }

    .results-table td:nth-child(3) { 
        padding-top: 0.6rem;
        margin-top: 0.2rem;
        border-top: 1px dashed rgba(255, 255, 255, 0.1);
    }

    .results-table td:nth-child(3) .btn,
    .results-table td:nth-child(3) .badge { 
        display: flex;
        width: 100%;
        justify-content: center;
        align-items: center;
        text-align: center;
        box-sizing: border-box;
        padding: 0.45rem 0.75rem !important;
        font-size: 0.85rem !important;
        font-weight: 600;
        border-radius: 6px;
    }

    .import-modal-content {
        width: 95%;
        max-width: 100%;
        padding: 1rem;
        box-sizing: border-box;
    }

    .collection-preview-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem 0;
    }

    .import-item-main {
        display: flex;
        align-items: center;
        gap: 0.35rem;
        min-width: 0;
        flex: 1;
    }

    .import-item-title {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .empty-state { 
        padding: 1.5rem 1rem;
        margin-top: 0.5rem;
    }

    footer { 
        margin-top: 2rem;
    }
}

/* Small Screens (max-width: 600px) */
@media (max-width: 600px) {
    .tmdb-attribution { 
        flex-direction: column;
        gap: 0.35rem;
    }
}

/* Extra Small Mobile Devices (max-width: 480px) */
@media (max-width: 480px) {
    .search-input-wrapper #searchInput { 
        padding-right: 50px;
    }

    .clear-search-btn { 
        right: 45px;
    }

    .mode-toggle-btn .mode-label { 
        display: none;
    }

    .mode-toggle-btn { 
        padding: 0.25rem 0.4rem;
    }

    .filter-dashboard-form {
        grid-template-columns: 1fr;
    }
}