/**
 * Northwest Gaming V2 Theme - Matrix Terminal
 * Version: 2.0
 * Last Updated: January 2026
 */

/* ============================================
   CSS CUSTOM PROPERTIES (Variables)
   ============================================ */
:root {
    /* Background Colors */
    --bg-primary: #0a0f0a;
    --bg-secondary: #0f1610;
    --bg-tertiary: #141c14;
    --bg-elevated: #1a241a;

    /* Border Colors */
    --border-color: #243024;
    --border-light: #2d402d;

    /* Accent Colors - Green (Primary) */
    --accent-green: #00d26a;
    --accent-green-dim: #00a854;
    --accent-green-dark: #006633;
    --accent-mint: #00ffa3;

    /* Text Colors */
    --text-primary: #e0efe0;
    --text-secondary: #8faf8f;
    --text-muted: #4a6a4a;

    /* Status Colors */
    --warning: #ffa726;
    --danger: #ff4757;
    --info: #29b6f6;
    --seeding: #00bcd4;

    /* Layout */
    --sidebar-width: 240px;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --transition: 0.2s ease;

    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

/* Grid Pattern Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(0, 210, 106, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 210, 106, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

a {
    color: var(--accent-green);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent-mint);
}

img {
    max-width: 100%;
    height: auto;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 28px; }
h2 { font-size: 24px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }
h5 { font-size: 14px; }
h6 { font-size: 12px; }

.page-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 24px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title svg {
    color: var(--accent-green);
}

.mono {
    font-family: var(--font-mono);
}

/* ============================================
   LAYOUT
   ============================================ */
.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 20px 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Logo */
.logo {
    padding: 0 20px 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.logo a {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-green), var(--accent-green-dim));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-primary);
}

.logo-icon svg {
    width: 20px;
    height: 20px;
}

.logo-text {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-green);
}

.logo-text span {
    color: var(--text-secondary);
    font-weight: 400;
}

/* Navigation */
.nav-section {
    padding: 0 12px;
    margin-bottom: 24px;
}

.nav-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 10px;
    padding-left: 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin-bottom: 2px;
    border-radius: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: all var(--transition);
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(0, 210, 106, 0.1);
    color: var(--accent-green);
}

.nav-item svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.5;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--warning);
    color: var(--bg-primary);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 30px;
    min-height: 100vh;
    flex: 1;
    max-width: 100%;
    overflow-x: hidden;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.page-header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

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

/* ============================================
   CARDS & SECTIONS
   ============================================ */
.card, .section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title svg {
    color: var(--accent-green);
    width: 20px;
    height: 20px;
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    text-align: center;
    transition: all var(--transition);
}

.stat-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    background: rgba(0, 210, 106, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    color: var(--accent-green);
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-green);
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid transparent;
    text-decoration: none;
    font-family: var(--font-primary);
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-green), var(--accent-mint));
    color: var(--bg-primary);
    border: none;
    font-weight: 600;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 210, 106, 0.3);
    color: var(--bg-primary);
}

.btn-secondary {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.btn-danger {
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
}

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

.btn-warning {
    background: rgba(255, 167, 38, 0.1);
    border: 1px solid var(--warning);
    color: var(--warning);
}

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

.btn-accent {
    background: rgba(0, 255, 163, 0.1);
    border: 1px solid var(--accent-mint);
    color: var(--accent-mint);
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-sm svg {
    width: 14px;
    height: 14px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

/* Action Buttons (Outline) */
.action-btn {
    padding: 8px 16px;
    background: transparent;
    border: 2px solid;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.action-btn.success {
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.action-btn.success:hover {
    background: var(--accent-green);
    color: var(--bg-primary);
}

.action-btn.pause {
    border-color: var(--warning);
    color: var(--warning);
}

.action-btn.pause:hover {
    background: var(--warning);
    color: var(--bg-primary);
}

.action-btn.delete {
    border-color: var(--danger);
    color: var(--danger);
}

.action-btn.delete:hover {
    background: var(--danger);
    color: var(--bg-primary);
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success, .badge-completed {
    background: rgba(0, 210, 106, 0.15);
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
}

.badge-warning, .badge-pending, .badge-paused {
    background: rgba(255, 167, 38, 0.15);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.badge-danger, .badge-failed, .badge-error {
    background: rgba(255, 71, 87, 0.15);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.badge-info, .badge-processing {
    background: rgba(41, 182, 246, 0.15);
    color: var(--info);
    border: 1px solid var(--info);
}

.badge-downloading {
    background: rgba(0, 255, 163, 0.15);
    color: var(--accent-mint);
    border: 1px solid var(--accent-mint);
}

.badge-seeding {
    background: rgba(0, 188, 212, 0.15);
    color: var(--seeding);
    border: 1px solid var(--seeding);
}

.badge-muted {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* Quality Badge */
.quality-badge {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
    border-radius: 4px;
}

/* File Extension Badge */
.file-ext {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent-green);
    background: rgba(0, 210, 106, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

/* ============================================
   PROGRESS BARS
   ============================================ */
.progress-bar {
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-mint));
    border-radius: 4px;
    transition: width 0.3s ease;
    position: relative;
}

/* Shimmer Animation */
.progress-fill.animated::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Large Progress Bar */
.progress-lg {
    height: 28px;
    border: 2px solid var(--border-color);
    border-radius: 14px;
}

.progress-lg .progress-fill {
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-text {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--bg-primary);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-primary);
    transition: all var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(0, 210, 106, 0.1);
}

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

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%238faf8f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
    cursor: pointer;
}

/* Checkbox */
.form-checkbox {
    width: 18px;
    height: 18px;
    appearance: none;
    background: var(--bg-secondary);
    border: 2px solid var(--border-light);
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.form-checkbox:checked {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.form-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--bg-primary);
    font-size: 12px;
    font-weight: bold;
}

/* Toggle Switch */
.toggle {
    position: relative;
    width: 48px;
    height: 26px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 26px;
    transition: all 0.3s ease;
}

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

.toggle input:checked + .toggle-slider {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(22px);
    background: var(--bg-primary);
}

/* Search Box */
.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 10px 16px 10px 44px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(0, 210, 106, 0.1);
}

.search-box svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 12px 16px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

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

.table tr:hover td {
    background: var(--bg-tertiary);
}

.table-sortable th {
    cursor: pointer;
    user-select: none;
}

.table-sortable th:hover {
    color: var(--accent-green);
}

/* CSS Grid Table */
.grid-table-header {
    display: grid;
    padding: 12px 16px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.grid-table-row {
    display: grid;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    transition: all var(--transition);
}

.grid-table-row:hover {
    background: var(--bg-tertiary);
}

/* ============================================
   TABS
   ============================================ */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.tab {
    padding: 10px 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.tab:hover {
    border-color: var(--border-light);
    color: var(--text-primary);
}

.tab.active {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: var(--bg-primary);
}

.tab .count {
    font-family: var(--font-mono);
    font-size: 11px;
    opacity: 0.8;
    margin-left: 6px;
}

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

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

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(-20px);
    transition: transform 0.2s ease;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.modal-close:hover {
    background: var(--danger);
    color: white;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   MEDIA CARDS / GRID
   ============================================ */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 24px;
}

.media-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    transition: all 0.3s ease;
}

.media-card:hover {
    border-color: var(--accent-green);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 210, 106, 0.1);
}

.media-poster {
    position: relative;
    aspect-ratio: 2/3;
    background: var(--bg-tertiary);
    overflow: hidden;
}

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

.media-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 40%, rgba(0,0,0,0.9));
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 16px;
}

.media-card:hover .media-overlay {
    opacity: 1;
}

.media-info {
    padding: 14px;
}

.media-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.media-meta svg {
    width: 14px;
    height: 14px;
}

/* ============================================
   FILE LIST
   ============================================ */
.file-list {
    display: flex;
    flex-direction: column;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: all var(--transition);
}

.file-item:hover {
    background: var(--bg-tertiary);
}

.file-icon {
    width: 40px;
    height: 40px;
    background: rgba(0, 210, 106, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-green);
    flex-shrink: 0;
}

.file-icon svg {
    width: 20px;
    height: 20px;
}

.file-details {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.file-size {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-secondary);
}

.file-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity var(--transition);
}

.file-item:hover .file-actions {
    opacity: 1;
}

/* ============================================
   ALERTS & NOTIFICATIONS
   ============================================ */
.alert {
    padding: 14px 18px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.alert-success {
    background: rgba(0, 210, 106, 0.1);
    border: 1px solid var(--accent-green);
    color: var(--accent-green);
}

.alert-warning {
    background: rgba(255, 167, 38, 0.1);
    border: 1px solid var(--warning);
    color: var(--warning);
}

.alert-danger {
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.alert-info {
    background: rgba(41, 182, 246, 0.1);
    border: 1px solid var(--info);
    color: var(--info);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--accent-green); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.d-flex { display: flex; }
.d-grid { display: grid; }
.d-none { display: none; }

.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

/* Grid Helpers */
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.animate-pulse { animation: pulse 2s infinite; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-fadeIn { animation: fadeIn 0.3s ease; }
.animate-slideUp { animation: slideUp 0.3s ease; }

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

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-green-dark);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 15px;
        padding-top: 70px; /* Space for hamburger menu */
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-title {
        font-size: 1.25rem;
        word-break: break-word;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 8px;
    }

    .modal {
        margin: 20px;
        max-height: calc(100vh - 40px);
    }

    /* Prevent horizontal overflow */
    .card,
    .stat-card,
    .file-item {
        max-width: 100%;
        overflow: hidden;
    }

    /* Button wrapping */
    .d-flex.flex-wrap,
    .btn-group {
        flex-wrap: wrap;
    }

    .btn {
        flex-shrink: 0;
    }

    /* Text overflow handling */
    .mono,
    .file-name,
    .media-title {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }

    /* Table responsiveness */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* App container */
    .app-container {
        max-width: 100vw;
        overflow-x: hidden;
    }

    /* Toolbar mobile fixes */
    .toolbar {
        gap: 8px;
    }

    .search-box {
        min-width: 100% !important;
        width: 100%;
        order: -1;
    }

    .filter-select {
        min-width: 0 !important;
        flex: 1;
        font-size: 12px;
        padding: 10px 8px;
    }

    .view-toggle {
        margin-left: auto;
    }

    /* Genre/filter tabs */
    .genre-tabs,
    .filter-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
        gap: 6px;
    }

    .genre-tab,
    .filter-tab {
        flex-shrink: 0;
        padding: 6px 12px;
        font-size: 11px;
    }

    /* Stat pills */
    .page-stats {
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

    .stat-pill {
        padding: 6px 10px;
        font-size: 11px;
    }

    .stat-pill-value {
        font-size: 12px;
    }

    /* Buttons */
    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .btn svg {
        width: 14px;
        height: 14px;
    }

    /* Page header mobile */
    .page-header {
        gap: 12px;
    }

    .page-header-left {
        width: 100%;
    }

    .page-header-left svg {
        width: 22px;
        height: 22px;
    }

    /* Hide button text on very small screens, keep icons */
    .page-stats .btn {
        padding: 8px 10px;
    }
}

/* Mobile menu toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 200;
    width: 44px;
    height: 44px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
}

@media (max-width: 768px) {
    .sidebar-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 99;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }
}

/* ============================================
   LOADING STATES
   ============================================ */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-elevated) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* ============================================
   VERSION BADGE
   ============================================ */
.version-badge {
    font-family: var(--font-mono);
    font-size: 10px;
    padding: 4px 8px;
    background: rgba(0, 210, 106, 0.1);
    border: 1px solid var(--accent-green-dark);
    border-radius: 4px;
    color: var(--accent-green);
}

/* ============================================
   SITE FOOTER
   ============================================ */
.site-footer {
    margin-left: var(--sidebar-width);
    padding: 20px 30px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
    position: relative;
    z-index: 1;
}

@media (max-width: 768px) {
    .site-footer {
        margin-left: 0;
        padding: 15px 20px;
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* ============================================
   USER MENU
   ============================================ */
.user-menu {
    margin-top: auto;
    padding: 16px 12px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-green), var(--accent-mint));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: var(--bg-primary);
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
}

/* ============================================
   TORRENT / DOWNLOAD SPECIFIC
   ============================================ */
.torrent-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.torrent-item:hover {
    border-color: var(--border-light);
}

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

.torrent-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}

.torrent-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 16px;
}

.torrent-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.torrent-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.torrent-stat {
    text-align: center;
}

.torrent-stat-value {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-green);
}

.torrent-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Speed indicators */
.speed-down {
    color: var(--accent-mint);
}

.speed-up {
    color: var(--seeding);
}

/* ============================================
   TRANSCODE SPECIFIC
   ============================================ */
.transcode-job {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.transcode-job.active {
    border-color: var(--accent-green-dark);
    animation: pulse 3s infinite;
}

.job-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.job-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.job-details {
    font-size: 12px;
    color: var(--text-secondary);
}

.job-progress {
    margin-top: 12px;
}

.job-stats {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-top: 8px;
}

.job-stats span {
    font-family: var(--font-mono);
}

/* ============================================
   PLAYER SPECIFIC
   ============================================ */
.video-container {
    position: relative;
    background: #000;
    aspect-ratio: 16/9;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
}

.video-progress {
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    margin-bottom: 16px;
    cursor: pointer;
}

.video-progress-fill {
    height: 100%;
    background: var(--accent-green);
    border-radius: 2px;
    position: relative;
}

.video-progress-fill::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: var(--accent-green);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
}

.video-progress:hover .video-progress-fill::after {
    opacity: 1;
}

.control-buttons {
    display: flex;
    align-items: center;
    gap: 16px;
}

.control-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all var(--transition);
}

.control-btn:hover {
    background: rgba(255,255,255,0.1);
}

.control-btn svg {
    width: 24px;
    height: 24px;
}

/* ============================================
   SPA TRANSITIONS
   ============================================ */
.main-content {
    transition: opacity 0.15s ease-out;
}

.main-content.spa-fade-out {
    opacity: 0;
    pointer-events: none;
}

.main-content.spa-fade-in {
    animation: spa-fade-in 0.15s ease-out;
}

@keyframes spa-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .sidebar,
    .mobile-menu-toggle {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    body::before {
        display: none;
    }
}
