/* SubSense - Blue Theme Styles */

/* ===== CSS Variables ===== */
:root {
    --color-dark-blue-bg: #0C1226;
    --color-medium-blue-bg: #1A223F;
    --color-light-blue-bg: #2A3555;
    --color-accent-blue: #4A90E2;
    --color-text-primary: #E8EDF5;
    --color-text-secondary: #9CA8C8;
    --color-text-muted: #64748b;
    
    --color-border: rgba(74, 144, 226, 0.2);
    --color-border-strong: rgba(74, 144, 226, 0.4);
    --color-shadow: rgba(0, 0, 0, 0.4);
    
    --color-success: #4CAF50;
    --color-success-bg: rgba(76, 175, 80, 0.15);
    --color-warning: #F39C12;
    --color-warning-bg: rgba(243, 156, 18, 0.15);
    --color-error: #F44336;
    --color-error-bg: rgba(244, 67, 54, 0.15);
    --color-info: #4A90E2;
    --color-info-bg: rgba(74, 144, 226, 0.15);
    --color-purple: #9B59B6;
    --color-purple-bg: rgba(155, 89, 182, 0.15);
    
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Base Reset ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== Scrollbar Styling ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(26, 34, 63, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--color-accent-blue) 0%, rgba(74, 144, 226, 0.6) 100%);
    border-radius: 4px;
    transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #5B9FE8 0%, var(--color-accent-blue) 100%);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-accent-blue) rgba(26, 34, 63, 0.5);
}

/* ===== Body & Container ===== */
body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(180deg, var(--color-dark-blue-bg) 0%, #0A0F1C 100%);
    min-height: 100vh;
    color: var(--color-text-primary);
    line-height: 1.6;
    padding: 40px 24px;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(74, 144, 226, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(74, 144, 226, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.container.glass {
    background: rgba(12, 18, 38, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 40px;
    border: 1px solid rgba(74, 144, 226, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.6s ease-out;
}

.container.wide {
    max-width: 1000px;
}

/* ===== Animations ===== */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(74, 144, 226, 0.3); }
    50% { box-shadow: 0 0 20px rgba(74, 144, 226, 0.5); }
}

@keyframes dropdownOpen {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin { 
    0% { transform: rotate(0deg); } 
    100% { transform: rotate(360deg); } 
}

@keyframes breathe {
    0%, 100% { 
        box-shadow: 0 0 8px rgba(74, 144, 226, 0.4), 0 4px 12px rgba(74, 144, 226, 0.2); 
    }
    50% { 
        box-shadow: 0 0 20px rgba(74, 144, 226, 0.6), 0 6px 20px rgba(74, 144, 226, 0.4); 
    }
}

/* ===== Header ===== */
.header {
    text-align: center;
    margin-bottom: 32px;
    animation: slideUp 0.6s ease-out;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo-img {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    box-shadow: 0 0 20px rgba(74, 144, 226, 0.2);
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-text-primary) 0%, var(--color-accent-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.version {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.2), rgba(74, 144, 226, 0.1));
    border: 1px solid var(--color-border-strong);
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-accent-blue);
    animation: glow 3s ease-in-out infinite;
    transition: var(--transition);
}

.version:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.25);
}

.header-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 12px;
    margin-bottom: 16px;
    gap: 12px;
}

.tagline {
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    max-width: 480px;
    margin: 0 auto 8px auto;
    line-height: 1.6;
}

/* ===== Navigation ===== */
.nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 24px auto 0 auto;
    width: fit-content;
    background: rgba(12, 18, 38, 0.5);
    padding: 6px;
    border-radius: 50px;
    border: 1px solid var(--color-border);
}

/* Three-column navigation layout for stats pages */
.nav-links.three-col {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    min-width: 380px;
}

.nav-links.three-col a:first-child {
    justify-self: end;
}

.nav-links.three-col a:nth-child(2) {
    justify-self: center;
}

.nav-links.three-col a:last-child {
    justify-self: start;
}

.nav-links a {
    padding: 8px 20px;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 50px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.nav-links a:hover {
    color: var(--color-text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-links a.active {
    color: white;
    background: var(--color-accent-blue);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

/* ===== Cards & Containers ===== */
.card {
    background: linear-gradient(135deg, rgba(26, 34, 63, 0.85) 0%, rgba(26, 34, 63, 0.6) 100%);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: 32px;
    margin-bottom: 16px;
    animation: slideUp 0.6s ease-out 0.2s both;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: relative;
    transition: var(--transition);
    z-index: 1;
    overflow: visible;
}

.card:first-of-type {
    z-index: 100;
}

.card:has(.multiselect-container.active) {
    z-index: 200;
}

/* Card Headers with SVG Icons */
.card h2, .card-title {
    color: var(--color-text-primary);
    margin-bottom: 24px;
    font-size: 1.3rem;
    font-weight: 600;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-icon {
    width: 24px;
    height: 24px;
    fill: var(--color-accent-blue);
    filter: drop-shadow(0 0 8px rgba(74, 144, 226, 0.4));
}

.card:hover {
    border-color: var(--color-border-strong);
    transform: translateY(-2px);
    box-shadow: 0 25px 50px var(--color-shadow);
}

/* Card Section Headers */
.card h4 {
    color: var(--color-text-secondary);
    margin-bottom: 12px;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* ===== Form Elements & Hints ===== */
.form-group {
    margin-bottom: 24px;
    position: relative;
}

.form-group:has(.multiselect-container) {
    z-index: 200;
}

.form-group:has(.select-container) {
    z-index: 100;
}

label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 10px;
}

.label-hint {
    font-weight: 400;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.hint-text {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    opacity: 0.8;
}

/* Sources Description */
.sources-description {
    color: var(--color-text-secondary);
    font-size: 1.05rem;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* ===== Provider Section (Wyzie) ===== */
.provider-section {
    background: rgba(26, 34, 63, 0.6);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid rgba(74, 144, 226, 0.15);
}

/* ===== Install Buttons ===== */
.install-container {
    margin-top: 28px;
    position: relative;
    z-index: 50;
    text-align: center;
}

.install-button-wrapper {
    display: inline-flex;
    background: linear-gradient(45deg, var(--color-medium-blue-bg), var(--color-light-blue-bg));
    border-radius: 50px;
    box-shadow: 0 5px 15px var(--color-shadow);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--color-border);
}

.install-button-wrapper::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: 0.5s;
}

.install-button-wrapper:hover::before {
    left: 100%;
}

.install-btn {
    flex: 1;
    padding: 16px 45px;
    background: transparent;
    color: var(--color-text-primary);
    border: none;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    white-space: nowrap;
    position: relative;
    z-index: 1;
    border-radius: 50px 0 0 50px;
}

.install-btn:hover:not(:disabled) {
    background: rgba(74, 144, 226, 0.2);
}

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

/* Success state when clicked - changes to accent blue */
.install-btn.success {
    background: var(--color-accent-blue);
    pointer-events: none;
}

/* Loading spinner for install button */
.install-btn .spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.install-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    transition: transform 0.3s ease;
}

.dropdown-toggle-btn {
    padding: 0 20px;
    background: rgba(0, 0, 0, 0.2);
    border: none;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: var(--color-text-primary);
    position: relative;
    z-index: 1;
    border-radius: 0 50px 50px 0;
}

.dropdown-toggle-btn:hover:not(:disabled) {
    background: rgba(74, 144, 226, 0.3);
}

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

.dropdown-toggle-btn svg { 
    width: 35px; 
    height: 35px; 
    fill: currentColor;
    transition: transform 0.3s ease;
}

.dropdown-toggle-btn.active svg { 
    transform: rotate(180deg); 
}

.install-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    left: auto;
    min-width: 220px;
    margin-top: 12px;
    background: var(--color-dark-blue-bg);
    border: 1px solid var(--color-border-strong);
    border-radius: 12px;
    overflow: hidden;
    z-index: 1000;
    box-shadow: 0 10px 25px var(--color-shadow);
}

.install-dropdown-menu.show {
    display: block;
    animation: dropdownOpen 0.2s ease-out;
}

.install-dropdown-item {
    padding: 14px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.15s ease;
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border);
}

.install-dropdown-item:last-child { border-bottom: none; }

.install-dropdown-item:hover {
    background: rgba(74, 144, 226, 0.1);
}

.install-dropdown-item svg { width: 18px; height: 18px; fill: var(--color-accent-blue); }

/* Install Button */
@media (max-width: 520px) {
    .install-btn {
        padding: 14px 20px;
        font-size: 1rem;
    }
    
    .dropdown-toggle-btn {
        padding: 0 12px;
    }
    
    .dropdown-toggle-btn svg {
        width: 28px;
        height: 28px;
    }
    
    .install-dropdown-menu {
        min-width: 180px;
        right: 0;
        left: auto;
    }
}

@media (max-width: 380px) {
    .install-btn {
        padding: 12px 16px;
        font-size: 0.9rem;
        gap: 6px;
    }
    
    .install-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .dropdown-toggle-btn {
        padding: 0 10px;
    }
    
    .dropdown-toggle-btn svg {
        width: 24px;
        height: 24px;
    }
}

/* ===== Unified Badge System ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.2;
    white-space: nowrap;
    transition: var(--transition);
    cursor: default;
    border: 1px solid transparent;
}

.badge:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    filter: brightness(1.1); 
}

.badge-success { background: var(--color-success-bg); color: #66BB6A; border-color: rgba(76, 175, 80, 0.3); }
.badge-warning { background: var(--color-warning-bg); color: #F39C12; border-color: rgba(243, 156, 18, 0.3); }
.badge-error { background: var(--color-error-bg); color: #EF5350; border-color: rgba(244, 67, 54, 0.3); }
.badge-info { background: var(--color-info-bg); color: #4A90E2; border-color: rgba(74, 144, 226, 0.3); }
.badge-series { background: var(--color-purple-bg); color: #C084D6; border-color: rgba(155, 89, 182, 0.3); }

/* Language Tag - with Hover */
.language-tag {
    display: inline-flex;
    padding: 4px 10px;
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.2), rgba(74, 144, 226, 0.1));
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-accent-blue);
    margin: 2px;
    transition: var(--transition);
    cursor: default;
}

.language-tag:hover {
    background: rgba(74, 144, 226, 0.3);
    border-color: var(--color-accent-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(74, 144, 226, 0.2);
}

/* Episode Badge */
.episode-badge {
    display: inline-block;
    padding: 4px 8px;
    background: rgba(155, 89, 182, 0.1);
    border: 1px solid rgba(155, 89, 182, 0.3);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #C084D6;
    font-family: 'Monaco', 'Consolas', monospace;
    transition: var(--transition);
}
.episode-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(155, 89, 182, 0.2);
    border-color: rgba(155, 89, 182, 0.6);
}

/* Provider Badge */
.provider-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-accent-blue);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Combo Badge Styles */
.combo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--color-medium-blue-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    transition: var(--transition);
    position: relative;
    cursor: default;
}

.combo-item:hover {
    background: var(--color-light-blue-bg);
    border-color: var(--color-border-strong);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Truncated combo with tooltip on hover */
.combo-item.truncated-combo {
    cursor: help;
}

.combo-item.truncated-combo::after {
    content: attr(title);
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translateX(-50%);
    background: var(--color-dark-blue-bg);
    color: var(--color-text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    max-width: 320px;
    white-space: normal;
    word-wrap: break-word;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--color-border);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
    margin-bottom: 8px;
}

.combo-item.truncated-combo:hover::after {
    opacity: 1;
    visibility: visible;
}

.combo-langs {
    color: var(--color-text-primary);
    font-weight: 500;
}

.combo-count {
    color: var(--color-accent-blue);
    font-weight: 600;
    font-size: 0.9rem;
    background: rgba(74, 144, 226, 0.15);
    padding: 4px 10px;
    border-radius: 12px;
    transition: var(--transition);
}

/* ===== Toggle Container ===== */
.toggle-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    padding: 16px 24px;
    background: linear-gradient(135deg, rgba(26, 34, 63, 0.9) 0%, rgba(26, 34, 63, 0.7) 100%);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    backdrop-filter: blur(8px);
}

.toggle-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toggle-switch {
    position: relative;
    width: 46px;
    height: 24px;
    flex-shrink: 0;
    display: block;
    margin-bottom: 0;
    font-size: inherit;
    font-weight: inherit;
}

.toggle-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* The slider track */
.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-medium-blue-bg);
    border: 1px solid var(--color-border);
    border-radius: 24px;
    cursor: pointer;
    transition: 0.3s ease;
}

/* The slider knob */
.toggle-slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: var(--color-text-secondary);
    border-radius: 50%;
    transition: 0.3s ease;
}

/* Checked state */
.toggle-switch input:checked + .toggle-slider {
    background: rgba(74, 144, 226, 0.4);
    border-color: var(--color-accent-blue);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
    background: var(--color-accent-blue);
}

/* Active Users Badge */
.active-sessions-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    background: rgba(74, 144, 226, 0.15);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-accent-blue);
    transition: var(--transition);
}

.active-sessions-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(74, 144, 226, 0.2);
    border-color: var(--color-accent-blue);
}

/* Last Updated */
.last-updated {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

/* Responsive Toggle */
@media (max-width: 600px) {
    .toggle-container {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 16px;
    }
    
    .toggle-group {
        justify-content: flex-start;
        width: 100%;
    }
    
    .active-sessions-badge {
        justify-content: center;
        width: 100%;
    }
    
    .last-updated {
        justify-content: center;
    }
}

/* ===== Charts & Stats ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* Explicit Grid for Overview */
.stats-grid.grid-6 {
    grid-template-columns: repeat(6, 1fr);
}

@media (max-width: 1024px) {
    .stats-grid.grid-6 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .stats-grid.grid-6 {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-card {
    background: linear-gradient(135deg, rgba(26, 34, 63, 0.9) 0%, rgba(26, 34, 63, 0.7) 100%);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 24px 20px;
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    border-color: var(--color-accent-blue);
    transform: translateY(-4px);
    box-shadow: 0 15px 40px rgba(74, 144, 226, 0.15), 0 0 20px rgba(74, 144, 226, 0.05);
}

.stat-card .value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-accent-blue);
    margin-bottom: 8px;
    text-shadow: 0 0 20px rgba(74, 144, 226, 0.3);
}

.stat-card .label {
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Chart Containers */
.chart-container {
    background: linear-gradient(135deg, rgba(26, 34, 63, 0.9) 0%, rgba(26, 34, 63, 0.7) 100%);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

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

.chart-limit-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(12, 18, 38, 0.5);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.limit-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    background: rgba(74, 144, 226, 0.1);
    color: var(--color-accent-blue);
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: var(--transition);
}

.limit-btn:hover:not(:disabled) {
    background: var(--color-accent-blue);
    color: white;
}
.limit-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.limit-value {
    min-width: 24px;
    text-align: center;
    font-weight: 600;
    color: var(--color-text-primary);
}

/* Sessions Period Selector */
.sessions-period-selector {
    display: flex;
    align-items: center;
}

.period-select {
    padding: 8px 32px 8px 14px;
    background: rgba(12, 18, 38, 0.5);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%239CA8C8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.period-select:hover {
    border-color: var(--color-accent-blue);
    background-color: rgba(42, 53, 85, 0.5);
}

.period-select:focus {
    outline: none;
    border-color: var(--color-accent-blue);
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.period-select option {
    background: var(--color-dark-blue-bg);
    color: var(--color-text-primary);
    padding: 8px;
}

.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 800px) {
    .charts-row { grid-template-columns: 1fr; }
}

/* ===== Data Tables ===== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    background: rgba(26, 34, 63, 0.4);
}

.data-table th {
    padding: 16px;
    text-align: left;
    color: var(--color-accent-blue);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(74, 144, 226, 0.1);
    border-bottom: 1px solid var(--color-border);
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-primary);
    font-size: 0.95rem;
}

.data-table tr:hover { background: rgba(74, 144, 226, 0.05); }

/* ===== Multiselect Dropdown ===== */
.multiselect-container {
    position: relative;
    width: 100%;
    z-index: 100;
}

.multiselect-container.active {
    z-index: 300;
}

.multiselect-input-wrapper {
    min-height: 52px;
    padding: 6px 8px;
    background: rgba(74, 144, 226, 0.1);
    border: 1px solid var(--color-border-strong);
    border-radius: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    cursor: text;
    transition: var(--transition);
}

.multiselect-input-wrapper:hover {
    background: rgba(74, 144, 226, 0.15);
    border-color: var(--color-accent-blue);
}

.multiselect-container.active .multiselect-input-wrapper {
    background: rgba(26, 34, 63, 0.8);
    border-color: var(--color-accent-blue);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

.multi-select-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: linear-gradient(135deg, var(--color-accent-blue), #3578C0);
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    animation: slideUp 0.15s ease-out;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    user-select: none;
    transition: var(--transition);
}
.multi-select-chip:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.multi-select-chip .remove-chip {
    background: rgba(0, 0, 0, 0.2);
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.multiselect-input-wrapper input {
    flex: 1;
    min-width: 120px;
    background: transparent;
    border: none;
    color: var(--color-text-primary);
    font-size: 0.95rem;
    padding: 6px;
    outline: none;
}

.multiselect-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-dark-blue-bg);
    border: 1px solid var(--color-border-strong);
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 10px 25px var(--color-shadow);
    z-index: 1000;
    margin-top: 4px;
}

.multiselect-container.active .multiselect-dropdown {
    display: block;
    animation: dropdownOpen 0.2s ease-out;
}

.dropdown-status {
    padding: 8px 16px;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    border-bottom: 1px solid var(--color-border);
}

.options-list {
    max-height: 240px;
    overflow-y: auto;
}

.option-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.option-item:hover, .option-item.highlighted {
    background: rgba(74, 144, 226, 0.2);
    padding-left: 20px;
}

.option-item.selected {
    background: rgba(74, 144, 226, 0.1);
    color: var(--color-text-secondary);
    cursor: pointer;
}

.option-item.selected:hover, .option-item.selected.highlighted {
    background: rgba(74, 144, 226, 0.25);
    padding-left: 20px;
    opacity: 1;
}

.option-item .check-mark { opacity: 0; color: var(--color-accent-blue); }
.option-item.selected .check-mark { opacity: 1; }

/* Flash animation for chip removal (when deselecting via dropdown) */
@keyframes chipFlash {
    0% { 
        background: linear-gradient(135deg, rgba(74, 144, 226, 0.3), rgba(74, 144, 226, 0.2));
        transform: scale(1);
    }
    50% { 
        background: rgba(244, 67, 54, 0.3);
        transform: scale(1.05);
    }
    100% { 
        background: rgba(244, 67, 54, 0.15);
        transform: scale(0.95);
        opacity: 0;
    }
}

.multi-select-chip.flash-remove {
    animation: chipFlash 0.3s ease-out forwards;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.footer a {
    color: var(--color-accent-blue);
    text-decoration: none;
    transition: var(--transition);
}

.footer a:hover { color: white; }

.github-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text-secondary);
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 50px;
    transition: var(--transition);
}

.github-link:hover {
    color: var(--color-accent-blue);
    background: rgba(74, 144, 226, 0.1);
}

.github-link svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    transition: transform 0.4s ease;
}
.github-link:hover svg {
    transform: rotate(360deg);
}

/* Code Snippets */
code {
    font-family: 'Monaco', 'Consolas', monospace;
    background: rgba(74, 144, 226, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
    color: var(--color-text-primary);
    transition: var(--transition);
}

code:hover {
    background: rgba(74, 144, 226, 0.25);
    color: var(--color-accent-blue);
}

/* IMDB Cell */
.imdb-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.imdb-cell code {
    min-width: 85px;
    display: inline-block;
}

/* Source Items in Config */
.sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.source-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(74, 144, 226, 0.05);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    transition: var(--transition);
}

.source-item:hover {
    background: rgba(74, 144, 226, 0.15);
    border-color: var(--color-accent-blue);
    transform: translateY(-2px);
}

.source-logo {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.source-name {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Cache Bar */
.cache-bar-container {
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.cache-bar-track {
    flex: 1;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.cache-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-accent-blue), #6BA5E7);
    border-radius: 10px;
    transition: width 1s ease-out;
}

.cache-bar-label {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
}

/* Modern Select (For Stats Page) */
.lang-selector-container {
    position: relative;
}

.modern-select {
    width: 100%;
    padding: 14px 44px 14px 18px;
    background: linear-gradient(135deg, rgba(26, 34, 63, 0.9) 0%, rgba(26, 34, 63, 0.7) 100%);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    color: var(--color-text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 500;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.modern-select:hover {
    border-color: var(--color-accent-blue);
    background: linear-gradient(135deg, rgba(42, 53, 85, 0.9) 0%, rgba(42, 53, 85, 0.7) 100%);
}

.modern-select:focus {
    outline: none;
    border-color: var(--color-accent-blue);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2), inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.modern-select option {
    background-color: var(--color-dark-blue-bg);
    color: var(--color-text-primary);
    padding: 14px;
}

.modern-select option:checked,
.modern-select option:hover {
    background-color: var(--color-light-blue-bg);
}

/* Custom Dropdown (Rounded dropdown list) */
.custom-select-wrapper {
    position: relative;
    flex: 1;
}

.custom-select-trigger {
    width: 100%;
    padding: 14px 44px 14px 18px;
    background: linear-gradient(135deg, rgba(26, 34, 63, 0.9) 0%, rgba(26, 34, 63, 0.7) 100%);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    color: var(--color-text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.custom-select-trigger:hover {
    border-color: var(--color-accent-blue);
    background: linear-gradient(135deg, rgba(42, 53, 85, 0.9) 0%, rgba(42, 53, 85, 0.7) 100%);
}

.custom-select-trigger.active {
    border-color: var(--color-accent-blue);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2), inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.custom-select-arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-secondary);
    pointer-events: none;
    transition: transform 0.3s ease, color 0.2s ease;
}

.custom-select-trigger.active + .custom-select-arrow,
.custom-select-wrapper.active .custom-select-arrow {
    transform: translateY(-50%) rotate(180deg);
    color: var(--color-accent-blue);
}

.custom-select-options {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--color-dark-blue-bg);
    border: 1px solid var(--color-border-strong);
    border-radius: 12px;
    overflow: hidden;
    z-index: 500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.custom-select-options.show {
    display: block;
}

.custom-select-option {
    padding: 8px 18px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    color: var(--color-text-primary);
}

.custom-select-option:hover {
    background-color: var(--color-light-blue-bg);
}

.custom-select-option.selected {
    background-color: rgba(74, 144, 226, 0.2);
    color: var(--color-accent-blue);
    font-weight: 600;
}

.custom-select-option:first-child {
    border-radius: 11px 11px 0 0;
}

.custom-select-option:last-child {
    border-radius: 0 0 11px 11px;
}

.custom-select-option:only-child {
    border-radius: 11px;
}

.select-arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-secondary);
    pointer-events: none;
    transition: color 0.2s ease;
}

.modern-select:focus + .select-arrow {
    color: var(--color-accent-blue);
}

.lang-rate-badge {
    background: rgba(74, 144, 226, 0.15);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    transition: var(--transition);
}
.lang-rate-badge:hover {
    background: rgba(74, 144, 226, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.lang-rate-badge span {
    font-weight: 700;
    color: var(--color-accent-blue);
    font-size: 1.1rem;
}

/* Toast Notification (Fixed Position) */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, var(--color-success), #388E3C);
    color: white;
    padding: 14px 28px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2000;
    box-shadow: 0 5px 20px rgba(76, 175, 80, 0.4);
}

.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.error { background: linear-gradient(135deg, var(--color-error), #C62828); }

/* Search Elements */
.search-container {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.search-input {
    flex: 1; 
    min-width: 200px;
    padding: 14px 20px; 
    font-size: 1.1rem;
    font-family: 'Monaco', 'Consolas', monospace;
    background: rgba(42, 53, 85, 0.6);
    border: 2px solid var(--color-border);
    border-radius: 12px;
    color: var(--color-text-primary);
    transition: var(--transition);
    text-transform: lowercase;
}
.search-input:focus {
    outline: none;
    border-color: var(--color-accent-blue);
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.15);
    background: rgba(42, 53, 85, 0.8);
}
.search-input::placeholder { 
    color: var(--color-text-secondary); 
    opacity: 0.7; 
}
.search-btn {
    padding: 14px 28px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--color-accent-blue) 0%, #3578C0 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}
.search-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #5A9FE8 0%, #4A90E2 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(74, 144, 226, 0.4);
}
.search-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.search-btn svg { width: 18px; height: 18px; flex-shrink: 0; fill: currentColor; }

/* Responsive Search */
@media (max-width: 520px) {
    .search-container {
        flex-direction: column;
    }
    .search-btn {
        width: 100%;
    }
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}
.page-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text-primary);
    cursor: pointer;
    transition: var(--transition);
}
.page-btn:hover:not(:disabled) {
    border-color: var(--color-accent-blue);
    color: var(--color-accent-blue);
}
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* View Button */
.view-btn {
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-accent-blue);
    background: rgba(74, 144, 226, 0.1);
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}
.view-btn:hover {
    background: var(--color-accent-blue);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(74, 144, 226, 0.3);
}

/* ===== Test Subtitle Search Styles ===== */
.test-search-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.test-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.test-input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 0;
}

.test-input-imdb { flex: 3; min-width: 140px; }
.test-input-season { flex: 0 0 auto; width: 85px; }
.test-input-episode { flex: 0 0 auto; width: 85px; }
.test-input-btn { flex: 0 0 auto; min-width: 100px; }

.test-input {
    padding: 12px 14px;
    background: rgba(74, 144, 226, 0.1);
    border: 1px solid var(--color-border-strong);
    border-radius: 10px;
    color: var(--color-text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
}

.test-input:hover {
    background: rgba(74, 144, 226, 0.15);
    border-color: var(--color-accent-blue);
}

.test-input:focus {
    outline: none;
    border-color: var(--color-accent-blue);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
    background: rgba(26, 34, 63, 0.8);
}

.test-input::placeholder {
    color: var(--color-text-muted);
}

/* Number input spinners */
.test-input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.test-input[type="number"]::-webkit-inner-spin-button,
.test-input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Custom number input wrapper for Season/Episode */
.test-input-group.test-input-season,
.test-input-group.test-input-episode {
    position: relative;
}

.test-input-group.test-input-season .test-input,
.test-input-group.test-input-episode .test-input {
    text-align: center;
    padding-right: 12px;
}

.test-search-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--color-accent-blue), #3578C0);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    width: 100%;
}

.test-search-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

.test-search-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.test-search-btn.loading {
    background: linear-gradient(135deg, #3578C0, var(--color-accent-blue));
    pointer-events: none;
}

/* Loading Spinner */
.loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.test-search-btn .btn-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Number Input Wrapper with Controls */
.number-input-wrapper {
    position: relative;
    display: flex;
    align-items: stretch;
    width: 100%;
}

.number-input-wrapper .test-input {
    width: 100%;
    padding: 10px 32px 10px 10px;
    text-align: center;
    font-weight: 600;
}

.number-controls {
    position: absolute;
    right: 3px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.number-btn {
    width: 22px;
    height: 16px;
    padding: 0;
    border: none;
    background: rgba(74, 144, 226, 0.25);
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

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

.number-btn:active {
    transform: scale(0.9);
}

.number-btn svg {
    width: 16px;
    height: 16px;
    fill: var(--color-text-primary);
    pointer-events: none;
}

/* Results Container */
.test-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
}

.test-results-header h4 {
    margin: 0;
    color: var(--color-text-primary);
    font-size: 1rem;
}

.test-results-badge {
    padding: 6px 14px;
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.2), rgba(74, 144, 226, 0.1));
    border: 1px solid var(--color-border-strong);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-accent-blue);
}

.test-results-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Language Accordion */
.test-lang-accordion {
    background: rgba(26, 34, 63, 0.6);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    overflow: hidden;
    transition: var(--transition);
}

.test-lang-accordion:hover {
    border-color: var(--color-border-strong);
}

.test-lang-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.test-lang-header:hover {
    background: rgba(74, 144, 226, 0.1);
}

.test-lang-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.test-lang-chevron {
    width: 20px;
    height: 20px;
    fill: var(--color-text-secondary);
    transition: transform 0.3s ease;
}

.test-lang-accordion.expanded .test-lang-chevron {
    transform: rotate(90deg);
}

.test-lang-name {
    font-weight: 600;
    color: var(--color-text-primary);
    font-size: 1rem;
}

.test-lang-count {
    padding: 4px 12px;
    background: var(--color-accent-blue);
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
}

.test-lang-sources {
    display: none;
    padding: 0 18px 14px 50px;
    animation: slideDown 0.2s ease-out;
}

.test-lang-accordion.expanded .test-lang-sources {
    display: block;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.test-source-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(74, 144, 226, 0.1);
}

.test-source-item:last-child {
    border-bottom: none;
}

.test-source-name {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    padding-left: 8px;
    border-left: 2px solid rgba(74, 144, 226, 0.3);
}

.test-source-name::before {
    content: none;
}

.test-source-item:last-child .test-source-name::before {
    content: none;
}

.test-source-count {
    padding: 3px 10px;
    background: rgba(74, 144, 226, 0.15);
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-accent-blue);
}

/* No Results State */
.test-no-results {
    text-align: center;
    padding: 32px 20px;
    color: var(--color-text-secondary);
}

.test-no-results svg {
    width: 48px;
    height: 48px;
    fill: var(--color-text-muted);
    margin-bottom: 12px;
    opacity: 0.5;
}

.test-no-results p {
    margin: 0;
    font-size: 0.95rem;
}

/* Responsive */
@media (max-width: 600px) {
    .test-search-row {
        flex-direction: column;
    }
    
    .test-input-group {
        width: 100%;
        max-width: none;
    }
    
    .test-input-imdb,
    .test-input-season,
    .test-input-episode,
    .test-input-btn {
        flex: none;
        max-width: none;
    }
    
    .test-input-season,
    .test-input-episode {
        width: calc(50% - 6px);
        display: inline-flex;
    }
    
    .test-results-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
}

/* ===== Expandable Section Styles ===== */
.expandable-section {
    margin-top: 24px;
    border-top: 1px solid var(--color-border);
    padding-top: 20px;
}

.expandable-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.12) 0%, rgba(34, 211, 238, 0.08) 100%);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--color-text-primary);
}

.expandable-header:hover {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.2) 0%, rgba(34, 211, 238, 0.15) 100%);
    border-color: rgba(56, 189, 248, 0.5);
}

.expandable-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 600;
}

.expandable-title .section-icon {
    width: 20px;
    height: 20px;
    fill: #38BDF8;
}

.expandable-title .label-hint {
    font-weight: 400;
    color: var(--color-text-secondary);
}

.expandable-arrow {
    width: 24px;
    height: 24px;
    fill: var(--color-text-secondary);
    transition: transform 0.3s ease;
}

.expandable-section.expanded .expandable-arrow {
    transform: rotate(180deg);
}

.expandable-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 4px;
}

.expandable-section.expanded .expandable-content {
    max-height: 500px;
    padding: 16px 4px 4px;
}

/* Optional Source Item */
.optional-source-item {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.06) 0%, rgba(34, 211, 238, 0.04) 100%);
    border-radius: 10px;
    padding: 16px;
    border: 1px solid rgba(56, 189, 248, 0.2);
}

.source-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.source-icon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
}

.source-header .source-name {
    font-weight: 600;
    color: var(--color-text-primary);
    flex: 1;
}

.source-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.optional-source-item .hint-text {
    margin-top: 8px;
    margin-bottom: 0;
}

/* ===== API Key Input Styles ===== */
.api-key-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
}

.api-key-input-wrapper input {
    flex: 1;
    background: rgba(26, 34, 63, 0.8);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.95rem;
    color: var(--color-text-primary);
    font-family: 'Consolas', 'Monaco', monospace;
    transition: var(--transition);
}

.api-key-input-wrapper input:focus {
    outline: none;
    border-color: var(--color-accent-blue);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

.api-key-input-wrapper input::placeholder {
    color: var(--color-text-muted);
    opacity: 0.6;
}

.api-key-toggle {
    width: 44px;
    height: 44px;
    background: rgba(26, 34, 63, 0.8);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--color-text-secondary);
    padding: 10px;
}

.api-key-toggle svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.api-key-toggle:hover {
    background: rgba(42, 53, 85, 0.8);
    border-color: var(--color-border-strong);
    color: var(--color-accent-blue);
}

.api-key-test-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--color-accent-blue), #3A7BD5);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.api-key-test-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

.api-key-test-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.api-key-test-btn.breathing {
    animation: breathe 2s ease-in-out infinite;
}

.api-key-test-btn.breathing:hover {
    animation: none;
}

/* API Status Indicator */
.api-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: var(--transition);
}

.api-status.unconfigured {
    background: rgba(100, 116, 139, 0.15);
    color: var(--color-text-muted);
}

.api-status.pending {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.api-status.pending .status-text {
    font-weight: 500;
}

.api-status.testing {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

.api-status.valid {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.api-status.invalid {
    background: var(--color-error-bg);
    color: var(--color-error);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.api-status.testing .status-dot {
    animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.1); }
}

.status-text {
    flex: 1;
}

/* API Key Info Link */
.api-key-info {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.api-key-info a {
    color: var(--color-accent-blue);
    text-decoration: none;
    transition: var(--transition);
}

.api-key-info a:hover {
    text-decoration: underline;
}

/* API Keys Card Responsive */
@media (max-width: 600px) {
    .api-key-input-wrapper {
        flex-wrap: wrap;
    }
    
    .api-key-input-wrapper input {
        width: 100%;
        flex: 1 1 100%;
    }
    
    .api-key-toggle,
    .api-key-test-btn {
        flex: 1;
    }
}