/* ========================================================
   PlexDL — Dark Gray Theme
   ======================================================== */

:root {
    --base:     #1e1e1e;
    --mantle:   #171717;
    --crust:    #121212;
    --surface0: #2a2a2a;
    --surface1: #3a3a3a;
    --surface2: #4a4a4a;
    --overlay0: #6a6a6a;
    --overlay1: #8a8a8a;
    --overlay2: #9a9a9a;
    --text:     #cdd6f4;
    --subtext0: #a6adc8;
    --subtext1: #bac2de;
    --lavender: #b4befe;
    --blue:     #89b4fa;
    --sapphire: #74c7ec;
    --sky:      #89dceb;
    --teal:     #94e2d5;
    --green:    #a6e3a1;
    --yellow:   #f9e2af;
    --peach:    #fab387;
    --maroon:   #eba0ac;
    --red:      #f38ba8;
    --mauve:    #cba6f7;
    --pink:     #f5c2e7;
    --flamingo: #f2cdcd;
    --rosewater:#f5e0dc;

    /* Semantic */
    --accent:   var(--mauve);
    --card-bg:  rgba(30, 30, 30, 0.6);
    --card-border: rgba(60, 60, 60, 0.5);
    --glow-sm:  0 2px 8px rgba(0,0,0,0.3);
    --glow-md:  0 4px 16px rgba(0,0,0,0.35);
    --glow-accent: 0 0 20px rgba(203, 166, 247, 0.08);
}

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

/* ---- Body ---- */
body {
    background: var(--crust);
    color: var(--text);
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--sapphire);
    text-decoration: none;
    transition: color 0.15s;
}
a:hover { color: var(--sky); }

::selection {
    background: rgba(203, 166, 247, 0.25);
    color: var(--text);
}

/* ---- Navbar ---- */
.navbar {
    background: var(--mantle);
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    height: 52px;
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.nav-brand {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--mauve);
    text-decoration: none;
    flex-shrink: 0;
}
.nav-brand:hover { color: var(--pink); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    color: var(--overlay1);
    text-decoration: none;
    transition: all 0.15s;
    font-size: 0.85rem;
    font-weight: 500;
}
.nav-link .icon { font-size: 0.9rem; }
.nav-link:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text);
}
.nav-link.active {
    background: rgba(203, 166, 247, 0.1);
    color: var(--mauve);
}

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

.username {
    color: var(--overlay1);
    font-size: 0.8rem;
}

/* ---- Container ---- */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem;
    flex: 1;
    width: 100%;
}

/* ---- Footer ---- */
.footer {
    background: var(--mantle);
    border-top: 1px solid var(--card-border);
    text-align: center;
    padding: 0.6rem;
    color: var(--overlay0);
    font-size: 0.75rem;
}

/* ---- Cards ---- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    margin-bottom: 1.25rem;
    overflow: hidden;
    box-shadow: var(--glow-sm);
    backdrop-filter: blur(4px);
}

.card-header {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid rgba(60, 60, 60, 0.35);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.card-header h2, .card-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--subtext1);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.card-body { padding: 1.25rem; }
.card-body.p-0 { padding: 0; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1;
    position: relative;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary {
    background: linear-gradient(135deg, var(--blue), var(--sapphire));
    color: var(--crust);
    box-shadow: 0 2px 8px rgba(137, 180, 250, 0.2);
}
.btn-primary:hover {
    box-shadow: 0 4px 14px rgba(137, 180, 250, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, var(--green), var(--teal));
    color: var(--crust);
    box-shadow: 0 2px 8px rgba(166, 227, 161, 0.2);
}
.btn-success:hover {
    box-shadow: 0 4px 14px rgba(166, 227, 161, 0.3);
}

.btn-danger {
    background: rgba(243, 139, 168, 0.15);
    color: var(--red);
    border: 1px solid rgba(243, 139, 168, 0.2);
}
.btn-danger:hover {
    background: rgba(243, 139, 168, 0.25);
}

.btn-secondary {
    background: var(--surface0);
    color: var(--subtext1);
}
.btn-secondary:hover {
    background: var(--surface1);
    color: var(--text);
}

.btn-ghost {
    background: transparent;
    color: var(--overlay1);
    border: 1px solid rgba(255,255,255,0.08);
}
.btn-ghost:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text);
}

.btn-teal {
    background: linear-gradient(135deg, var(--teal), var(--green));
    color: var(--crust);
    box-shadow: 0 2px 8px rgba(148, 226, 213, 0.2);
}
.btn-teal:hover {
    box-shadow: 0 4px 14px rgba(148, 226, 213, 0.3);
}

.btn-mauve {
    background: linear-gradient(135deg, var(--mauve), var(--pink));
    color: var(--crust);
    box-shadow: 0 2px 8px rgba(203, 166, 247, 0.2);
}
.btn-mauve:hover {
    box-shadow: 0 4px 14px rgba(203, 166, 247, 0.3);
}

.btn-peach {
    background: linear-gradient(135deg, var(--peach), var(--yellow));
    color: var(--crust);
    box-shadow: 0 2px 8px rgba(250, 179, 135, 0.2);
}
.btn-peach:hover {
    box-shadow: 0 4px 14px rgba(250, 179, 135, 0.3);
}

.btn-sm { padding: 0.28rem 0.6rem; font-size: 0.78rem; border-radius: 6px; }
.btn-lg { padding: 0.6rem 1.4rem; font-size: 0.95rem; }
.btn-full { width: 100%; justify-content: center; }

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

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--overlay1);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-control {
    width: 100%;
    background: rgba(42, 42, 42, 0.5);
    border: 1px solid rgba(60, 60, 60, 0.5);
    border-radius: 8px;
    color: var(--text);
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus {
    outline: none;
    border-color: var(--mauve);
    box-shadow: 0 0 0 3px rgba(203, 166, 247, 0.1);
}
.form-control::placeholder { color: var(--overlay0); }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    align-items: end;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}

.input-row {
    display: flex;
    gap: 0.5rem;
}
.input-row .form-control { flex: 1; }

.form-group label.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    color: var(--text);
    user-select: none;
    font-size: 0.85rem;
    text-transform: none;
    letter-spacing: normal;
    margin-bottom: 0;
}

.checkbox-label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    padding: 0;
    width: 36px;
    height: 20px;
    background: rgba(74, 74, 74, 0.4);
    border-radius: 20px;
    border: none;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    top: 2px;
    background: var(--overlay0);
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}

.checkbox-label input[type="checkbox"]:checked {
    background: rgba(148, 226, 213, 0.35);
}

.checkbox-label input[type="checkbox"]:checked::before {
    transform: translateX(16px);
    background: var(--teal);
}

.form-check-group {
    display: flex;
    align-items: center;
    padding-bottom: 0.45rem;
}

/* ---- Alerts ---- */
.alert {
    padding: 0.7rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    border-left: 3px solid;
}

.alert-error {
    background: rgba(243, 139, 168, 0.08);
    border-color: var(--red);
    color: var(--maroon);
}

.alert-success {
    background: rgba(166, 227, 161, 0.08);
    border-color: var(--green);
    color: var(--green);
}

.alert-warning {
    background: rgba(249, 226, 175, 0.08);
    border-color: var(--yellow);
    color: var(--yellow);
}

.alert-info {
    background: rgba(116, 199, 236, 0.08);
    border-color: var(--sapphire);
    color: var(--sapphire);
}

/* ---- Page header ---- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    gap: 0.2rem;
    letter-spacing: 0.02em;
}

.badge-blue    { background: rgba(137, 180, 250, 0.12); color: var(--blue); }
.badge-green   { background: rgba(166, 227, 161, 0.12); color: var(--green); }
.badge-yellow  { background: rgba(249, 226, 175, 0.12); color: var(--peach); }
.badge-gray    { background: rgba(74, 74, 74, 0.25); color: var(--overlay1); }
.badge-warning { background: rgba(249, 226, 175, 0.12); color: var(--peach); }
.badge-mauve   { background: rgba(203, 166, 247, 0.12); color: var(--mauve); }
.badge-teal    { background: rgba(148, 226, 213, 0.12); color: var(--teal); }

/* ---- Login ---- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--crust);
    background-image: radial-gradient(ellipse at 50% 0%, rgba(203,166,247,0.06) 0%, transparent 60%);
}

.login-container {
    width: 100%;
    max-width: 380px;
    padding: 1.5rem;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--mauve);
    letter-spacing: -1px;
}

.login-logo .text-muted {
    margin-top: 0.25rem;
    font-size: 0.85rem;
}

/* ---- Search ---- */
.search-card, .search-card .card-body { padding: 0; }
.search-card form { padding: 1rem; }

.search-row {
    display: flex;
    gap: 0.75rem;
}

.search-input {
    flex: 1;
    font-size: 1rem;
    padding: 0.6rem 1rem;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    padding: 0 0.25rem;
}

.quality-filter-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--subtext1);
    font-size: 0.82rem;
    user-select: none;
}
.quality-filter-label input { display: none; }
.quality-filter-slider {
    width: 32px;
    height: 18px;
    background: rgba(74, 74, 74, 0.4);
    border-radius: 18px;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}
.quality-filter-slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    left: 2px;
    top: 2px;
    background: var(--overlay0);
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}
.quality-filter-label input:checked + .quality-filter-slider {
    background: rgba(148, 226, 213, 0.35);
}
.quality-filter-label input:checked + .quality-filter-slider::before {
    transform: translateX(14px);
    background: var(--teal);
}
.result-row.quality-hidden { display: none; }

.notify-btn.notify-active { color: var(--yellow); }

.results-table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    box-shadow: var(--glow-sm);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
}

.results-table thead {
    background: rgba(18, 18, 18, 0.6);
}

.results-table th {
    padding: 0.6rem 0.85rem;
    text-align: left;
    font-weight: 600;
    color: var(--overlay1);
    font-size: 0.73rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--card-border);
    white-space: nowrap;
}

.results-table td {
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid rgba(60,60,60,0.25);
    vertical-align: middle;
}

.results-table tr:last-child td { border-bottom: none; }

.results-table tbody tr {
    transition: background 0.1s;
}
.results-table tbody tr:hover {
    background: rgba(255,255,255,0.03);
}

.result-name { max-width: 400px; }
.result-name span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-size { white-space: nowrap; color: var(--overlay1); }

.seeds-count.high-seeds { color: var(--green); font-weight: 600; }
.seeds-count.low-seeds { color: var(--yellow); }
.seeds-count.no-seeds { color: var(--surface2); }

.result-row.no-seeds { opacity: 0.45; }

.plex-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    background: rgba(250, 179, 46, 0.15);
    color: var(--yellow);
    font-size: 0.72rem;
    font-weight: 500;
    white-space: nowrap;
    vertical-align: middle;
}

/* ---- Dashboard / Torrents ---- */
.torrent-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--glow-sm);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.torrent-card:hover {
    border-color: var(--surface1);
    box-shadow: var(--glow-md);
}

.torrent-card.torrent-done {
    border-left: 3px solid var(--green);
    background: linear-gradient(90deg, rgba(166,227,161,0.03) 0%, var(--card-bg) 30%);
}

.torrent-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.65rem;
    flex-wrap: wrap;
}

.torrent-name {
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
    font-size: 0.92rem;
}

.torrent-name > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.torrent-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.progress-bar-container {
    background: rgba(42, 42, 42, 0.6);
    border-radius: 6px;
    height: 5px;
    overflow: hidden;
    margin-bottom: 0.6rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--sapphire), var(--mauve));
    border-radius: 6px;
    transition: width 0.4s ease;
    min-width: 2px;
    box-shadow: 0 0 8px rgba(116, 199, 236, 0.2);
}

.torrent-done .progress-bar {
    background: var(--green);
    box-shadow: 0 0 8px rgba(166, 227, 161, 0.15);
}

.torrent-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.78rem;
    color: var(--overlay1);
}

.state-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.55rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.state-downloading { background: rgba(116, 199, 236, 0.12); color: var(--sapphire); }
.state-seeding     { background: rgba(166, 227, 161, 0.12); color: var(--green); }
.state-paused      { background: rgba(74, 74, 74, 0.25); color: var(--overlay1); }
.state-error       { background: rgba(243, 139, 168, 0.12); color: var(--red); }
.state-stalled     { background: rgba(250, 179, 135, 0.12); color: var(--peach); }
.state-other       { background: rgba(74, 74, 74, 0.15); color: var(--overlay0); }

.user-badge {
    background: rgba(203, 166, 247, 0.12);
    color: var(--mauve);
    font-size: 0.72rem;
    padding: 0.12rem 0.45rem;
    border-radius: 5px;
    font-weight: 600;
    flex-shrink: 0;
}

/* ---- File selection ---- */
.torrent-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.torrent-meta {
    display: flex;
    gap: 1rem;
    color: var(--overlay1);
    font-size: 0.85rem;
}

.files-header { flex-wrap: wrap; gap: 0.5rem; }

.select-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.file-list {
    max-height: 500px;
    overflow-y: auto;
}

.file-item { border-bottom: 1px solid rgba(60,60,60,0.25); }
.file-item:last-child { border-bottom: none; }

.file-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem;
    cursor: pointer;
    transition: background 0.1s;
    border-radius: 4px;
}
.file-label:hover { background: rgba(255,255,255,0.03); }

.file-icon { font-size: 1rem; flex-shrink: 0; }

.file-path {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.875rem;
}

.file-size {
    flex-shrink: 0;
    font-size: 0.8rem;
    min-width: 70px;
    text-align: right;
    color: var(--overlay1);
}

.file-skipped { opacity: 0.4; }

input[type="checkbox"] {
    accent-color: var(--teal);
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

/* ---- Process page ---- */
.media-type-badge { display: flex; align-items: center; }

.media-type-buttons {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.video-file-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(60,60,60,0.25);
    gap: 1rem;
    flex-wrap: wrap;
}
.video-file-row:last-child { border-bottom: none; }

.video-file-row .file-path {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.85rem;
    color: var(--overlay1);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.video-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.finalize-card {
    border-color: rgba(166, 227, 161, 0.25);
    background: linear-gradient(135deg, rgba(166,227,161,0.03), var(--card-bg));
}

/* ---- Subtitles ---- */
.current-file {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.label {
    font-weight: 600;
    color: var(--overlay1);
    flex-shrink: 0;
    font-size: 0.85rem;
}

.subtitle-results { display: flex; flex-direction: column; gap: 0.5rem; }

.subtitle-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    transition: border-color 0.15s;
}
.subtitle-card:hover { border-color: var(--surface1); }

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

.subtitle-title {
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 0.2rem;
}

.subtitle-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.78rem;
    flex-wrap: wrap;
    color: var(--overlay1);
}

.subtitle-filename {
    font-size: 0.72rem;
    font-family: monospace;
    margin-top: 0.2rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--overlay0);
}

.subtitle-actions { flex-shrink: 0; }

/* ---- Admin ---- */
.config-grid { display: grid; gap: 0.5rem; }

.config-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(60,60,60,0.2);
}
.config-item:last-child { border-bottom: none; }

.config-label {
    color: var(--overlay1);
    font-size: 0.82rem;
    min-width: 120px;
    flex-shrink: 0;
    font-weight: 500;
}

.config-value {
    color: var(--subtext1);
    font-size: 0.85rem;
}

.speed-label {
    min-width: 80px;
    font-weight: 500;
    color: var(--subtext1);
}
.speed-limit-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ---- Indexers ---- */
.indexer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.5rem;
}
.indexer-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    background: rgba(42, 42, 42, 0.3);
    border: 1px solid rgba(60, 60, 60, 0.3);
    transition: all 0.15s;
}
.indexer-item:hover {
    background: rgba(42, 42, 42, 0.5);
    border-color: rgba(60, 60, 60, 0.5);
}
.indexer-item.busy {
    opacity: 0.4;
    pointer-events: none;
}
.indexer-toggle {
    position: relative;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}
.indexer-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}
.indexer-slider {
    position: absolute;
    inset: 0;
    background: rgba(74, 74, 74, 0.4);
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s;
}
.indexer-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    bottom: 2px;
    background: var(--overlay0);
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}
.indexer-toggle input:checked + .indexer-slider {
    background: rgba(148, 226, 213, 0.35);
}
.indexer-toggle input:checked + .indexer-slider::before {
    transform: translateX(16px);
    background: var(--teal);
}
.indexer-name {
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--subtext1);
}

/* ---- Indexer collapsible (search page) ---- */
.indexer-section { margin-bottom: 1rem; }
.indexer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    background: var(--surface0);
    border: 1px solid rgba(60, 60, 60, 0.3);
    user-select: none;
    transition: background 0.15s;
}
.indexer-header:hover { background: rgba(42, 42, 42, 0.5); }
.indexer-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--subtext1);
}
.indexer-header-left i { transition: transform 0.2s; }
.indexer-header-left i.open { transform: rotate(90deg); }
.indexer-header-right { display: flex; align-items: center; gap: 0.5rem; }
.indexer-count {
    font-size: 0.8rem;
    color: var(--overlay1);
}
.indexer-body {
    display: none;
    padding: 0.75rem 0 0;
}
.indexer-body.open { display: block; }

/* ---- Loading ---- */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem;
    color: var(--overlay0);
}

.spinner {
    width: 22px;
    height: 22px;
    border: 2.5px solid rgba(60,60,60,0.4);
    border-top-color: var(--mauve);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Empty state ---- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    gap: 0.75rem;
    color: var(--overlay0);
}

.empty-icon {
    font-size: 3rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.15rem;
    color: var(--subtext1);
    font-weight: 600;
}

/* ---- Utility ---- */
.text-muted { color: var(--overlay1); }
.font-mono  { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 0.85em; }
.mt-2       { margin-top: 0.5rem; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--surface2); }

/* ---- Remux overlay ---- */
.remux-overlay {
    position: absolute;
    inset: 0;
    background: rgba(30, 30, 30, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    z-index: 5;
}

.remux-overlay-text {
    color: var(--mauve);
    font-weight: 700;
    font-size: 1.1rem;
    animation: pulse-text 1.5s ease-in-out infinite;
}

@keyframes pulse-text {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* ---- Modal ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal-content {
    background: var(--base);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--glow-md);
}

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

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

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

/* ---- Processing queue (subtitles page) ---- */
.queue-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.queue-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.15s;
}

.queue-item:hover { border-color: var(--surface1); }

.queue-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    cursor: pointer;
    gap: 1rem;
}

.queue-item-header:hover { background: rgba(255,255,255,0.02); }

.queue-item-name {
    font-weight: 600;
    color: var(--text);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.queue-item-badge {
    flex-shrink: 0;
}

.queue-item-body {
    padding: 0 1rem 1rem;
    display: none;
}

.queue-item.expanded .queue-item-body { display: block; }

.queue-file-section {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(60,60,60,0.25);
}

.queue-file-section:last-child { border-bottom: none; }

.queue-file-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--blue);
    margin-bottom: 0.5rem;
    cursor: pointer;
}

.queue-file-title:hover { color: var(--sapphire); }

/* ---- Inline player ---- */
.inline-player {
    margin-top: 0.75rem;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}

.inline-player video {
    width: 100%;
    max-height: 50vh;
    display: block;
}

.inline-subtitle-overlay {
    position: relative;
    margin-top: -60px;
    text-align: center;
    pointer-events: none;
    z-index: 10;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.inline-subtitle-text {
    display: inline-block;
    background: rgba(0,0,0,0.75);
    color: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 1.1rem;
    line-height: 1.5;
    max-width: 90%;
    white-space: pre-line;
}

.timing-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.offset-display {
    font-family: monospace;
    font-size: 1rem;
    background: var(--surface1);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    min-width: 70px;
    text-align: center;
}

.existing-subs-info {
    background: rgba(116, 199, 236, 0.08);
    border-left: 3px solid var(--sapphire);
    padding: 0.5rem 0.75rem;
    border-radius: 0 6px 6px 0;
    font-size: 0.85rem;
    color: var(--sapphire);
    margin-bottom: 0.75rem;
}

.finalize-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(60,60,60,0.25);
}

.destination-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.destination-row .form-control { flex: 1; min-width: 250px; }

.media-type-chips {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .container { padding: 1rem; }
    .navbar { padding: 0 0.75rem; height: 48px; }
    .nav-links { gap: 0; }
    .nav-link { padding: 0.35rem 0.45rem; font-size: 0.78rem; }
    .nav-brand { font-size: 1.05rem; }
    .results-table th, .results-table td { padding: 0.45rem 0.5rem; font-size: 0.82rem; }
    .form-row { grid-template-columns: 1fr; }
    .torrent-header { flex-direction: column; }
    .page-header h1 { font-size: 1.2rem; }
    .modal-content { width: 95%; }
}
