/* ================================================================
   Downflow — Premium Media Dashboard
   Complete Design System & Styling
   ================================================================ */

/* ── Design Tokens ──────────────────────────────────────────── */
:root {
    /* Core Backgrounds */
    --bg-main: #06080D;
    --bg-panel: rgba(12, 17, 30, 0.75);
    --bg-card: rgba(20, 28, 48, 0.5);
    --bg-card-hover: rgba(28, 38, 64, 0.6);
    --bg-elevated: rgba(30, 40, 68, 0.4);

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.09);
    --border-glow: rgba(255, 255, 255, 0.16);
    --border-accent: rgba(6, 182, 212, 0.3);

    /* Typography */
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-tertiary: #64748B;
    --text-bright: #FFFFFF;

    /* Aurora Gradient Palette */
    --accent-cyan: #06B6D4;
    --accent-violet: #8B5CF6;
    --accent-magenta: #EC4899;
    --accent-teal: #14B8A6;

    /* Gradients */
    --gradient-aurora: linear-gradient(135deg, #06B6D4 0%, #8B5CF6 50%, #EC4899 100%);
    --gradient-aurora-soft: linear-gradient(135deg, rgba(6, 182, 212, 0.15) 0%, rgba(139, 92, 246, 0.15) 50%, rgba(236, 72, 153, 0.15) 100%);
    --gradient-aurora-vibrant: linear-gradient(135deg, #0EA5E9 0%, #A855F7 40%, #F43F5E 100%);
    --gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);

    /* Status */
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #06B6D4;

    /* Typography */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Elevation */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
    --shadow-glow-cyan: 0 0 20px rgba(6, 182, 212, 0.15);
    --shadow-glow-violet: 0 0 20px rgba(139, 92, 246, 0.15);
    --shadow-glow-magenta: 0 0 20px rgba(236, 72, 153, 0.15);

    /* Blur */
    --blur-sm: 8px;
    --blur-md: 16px;
    --blur-lg: 24px;

    /* Spacing */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-pill: 50px;

    /* Transitions */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 0.15s;
    --duration-normal: 0.25s;
    --duration-slow: 0.4s;
}

/* ── Global Reset ───────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    line-height: 1.5;
    font-size: 14px;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text-bright);
    font-weight: 700;
    line-height: 1.3;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ── Animated Mesh Background ───────────────────────────────── */
.bg-mesh {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.bg-mesh::before,
.bg-mesh::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.4;
    will-change: transform;
}

.bg-mesh::before {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.3) 0%, transparent 70%);
    top: -10%;
    left: -5%;
    animation: mesh-drift-1 25s ease-in-out infinite;
}

.bg-mesh::after {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.25) 0%, transparent 70%);
    bottom: -10%;
    right: -5%;
    animation: mesh-drift-2 30s ease-in-out infinite;
}

.bg-mesh-accent {
    position: fixed;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.2;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.3) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: mesh-drift-3 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes mesh-drift-1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(80px, 60px) scale(1.1); }
    66% { transform: translate(-40px, 100px) scale(0.95); }
}

@keyframes mesh-drift-2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-60px, -80px) scale(1.05); }
    66% { transform: translate(50px, -40px) scale(1.1); }
}

@keyframes mesh-drift-3 {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-40%, -60%) scale(1.15); }
}

/* ── App Container Layout ───────────────────────────────────── */
#app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    position: relative;
    z-index: 1;
}

/* ── Header ─────────────────────────────────────────────────── */
#app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
    padding: 0 28px;
    background: rgba(8, 12, 24, 0.8);
    backdrop-filter: blur(var(--blur-md));
    -webkit-backdrop-filter: blur(var(--blur-md));
    border-bottom: 1px solid var(--border-subtle);
    z-index: 10;
    position: relative;
}

/* Animated gradient line under header */
#app-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--gradient-aurora);
    opacity: 0.5;
    animation: header-glow 4s ease-in-out infinite;
}

@keyframes header-glow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* Logo */
.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.logo-icon {
    font-size: 24px;
    background: var(--gradient-aurora);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: logo-shimmer 3s ease-in-out infinite;
    position: relative;
}

@keyframes logo-shimmer {
    0%, 100% { filter: drop-shadow(0 0 4px rgba(6, 182, 212, 0.4)); }
    50% { filter: drop-shadow(0 0 12px rgba(139, 92, 246, 0.6)); }
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 2px;
    background: var(--gradient-aurora);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Search Bar */
.search-bar-area {
    flex: 0 1 520px;
}

#global-search-form {
    display: flex;
    gap: 10px;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
}

.search-icon-embed {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 13px;
    transition: color var(--duration-normal) ease;
    pointer-events: none;
}

#search-input {
    width: 100%;
    height: 42px;
    padding: 0 16px 0 44px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-pill);
    color: var(--text-bright);
    font-family: var(--font-body);
    font-size: 13px;
    transition: all var(--duration-normal) var(--ease-out-expo);
}

#search-input::placeholder {
    color: var(--text-tertiary);
    transition: color var(--duration-normal) ease;
}

#search-input:focus {
    border-color: var(--accent-cyan);
    outline: none;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.12), var(--shadow-glow-cyan);
    background: rgba(255, 255, 255, 0.06);
}

#search-input:focus ~ .search-icon-embed,
#search-input:focus + .search-icon-embed {
    color: var(--accent-cyan);
}

.search-input-wrapper:focus-within .search-icon-embed {
    color: var(--accent-cyan);
}

/* Primary Button */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 22px;
    height: 42px;
    background: var(--gradient-aurora);
    border: none;
    border-radius: var(--radius-pill);
    color: var(--text-bright);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out-expo);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
    opacity: 0;
    transition: opacity var(--duration-normal) ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.25), 0 2px 8px rgba(139, 92, 246, 0.2);
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

/* User Status Badge */
.user-status-area {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.badge-premium {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: var(--radius-pill);
    color: var(--warning);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.crown-icon {
    font-size: 11px;
    animation: crown-pulse 2s ease-in-out infinite;
}

@keyframes crown-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ── Workspace Layout ───────────────────────────────────────── */
#app-workspace {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ── Sidebar ────────────────────────────────────────────────── */
#app-sidebar {
    width: 260px;
    background: rgba(8, 12, 24, 0.7);
    backdrop-filter: blur(var(--blur-md));
    -webkit-backdrop-filter: blur(var(--blur-md));
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px 14px;
    position: relative;
}

/* Subtle gradient accent on sidebar right edge */
#app-sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: -1px;
    bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, var(--accent-cyan), transparent 30%, transparent 70%, var(--accent-violet));
    opacity: 0.3;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out-expo);
    width: 100%;
    position: relative;
    overflow: hidden;
}

.nav-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
    transition: all var(--duration-normal) ease;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.nav-item:hover i {
    color: var(--accent-cyan);
}

.nav-item.active {
    background: rgba(6, 182, 212, 0.08);
    color: var(--accent-cyan);
    position: relative;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--gradient-aurora);
    border-radius: 0 3px 3px 0;
}

.nav-item.active i {
    color: var(--accent-cyan);
    filter: drop-shadow(0 0 6px rgba(6, 182, 212, 0.5));
}

.badge-downloads-count {
    margin-left: auto;
    background: var(--gradient-aurora);
    color: var(--text-bright);
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    border-radius: var(--radius-pill);
    min-width: 20px;
    text-align: center;
}

/* Sidebar Footer Status Box */
.sidebar-footer-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 16px;
    position: relative;
    overflow: hidden;
}

.sidebar-footer-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--gradient-aurora);
    opacity: 0.2;
}

.footer-box-title {
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-box-title::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    animation: status-pulse 2s ease-in-out infinite;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

@keyframes status-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.85); }
}

.status-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    padding: 4px 0;
}

.status-metric + .status-metric {
    margin-top: 4px;
}

.status-metric .label {
    color: var(--text-tertiary);
}

.status-metric .value {
    font-weight: 500;
    color: var(--text-secondary);
}

.text-success {
    color: var(--success) !important;
}

.select-text {
    user-select: text;
}

/* ── Content Panel ──────────────────────────────────────────── */
#app-content-panel {
    flex: 1;
    padding: 28px 32px;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

/* Tab Views */
.tab-view {
    display: none;
}

.tab-view.active-view {
    display: block;
    animation: view-enter 0.4s var(--ease-out-expo);
}

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

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 14px;
}

.section-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, var(--border-default), transparent);
}

.section-header h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.3px;
    position: relative;
}

/* ── Badge Bar (Categories) ─────────────────────────────────── */
.badge-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.badge-item {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out-expo);
    white-space: nowrap;
}

.badge-item:hover {
    background: rgba(6, 182, 212, 0.08);
    border-color: rgba(6, 182, 212, 0.3);
    color: var(--accent-cyan);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.1);
}

/* ── Video Grid ─────────────────────────────────────────────── */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.video-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--duration-slow) var(--ease-out-expo);
    display: flex;
    flex-direction: column;
    position: relative;
    transform-style: preserve-3d;
    perspective: 800px;
}

.video-card:hover {
    transform: translateY(-6px);
    border-color: rgba(6, 182, 212, 0.3);
    box-shadow:
        0 12px 28px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(6, 182, 212, 0.08),
        0 0 40px rgba(139, 92, 246, 0.05);
    background: var(--bg-card-hover);
}

/* Staggered entrance for cards */
.video-card.card-animate {
    opacity: 0;
    transform: translateY(20px);
    animation: card-stagger-in 0.5s var(--ease-out-expo) forwards;
}

@keyframes card-stagger-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Thumbnail */
.video-thumb-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.video-thumb-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--ease-out-expo);
}

.video-card:hover .video-thumb-container img {
    transform: scale(1.08);
}

/* Gradient overlay on thumbnail */
.video-thumb-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to top, rgba(6, 8, 13, 0.8) 0%, transparent 100%);
    pointer-events: none;
    z-index: 1;
}

.duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-bright);
    z-index: 2;
    letter-spacing: 0.3px;
}

.quality-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--gradient-aurora);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 9px;
    font-weight: 800;
    color: var(--text-bright);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    z-index: 2;
}

/* Card Body */
.video-card-body {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: space-between;
    gap: 10px;
}

.video-card-title {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 36px;
    transition: color var(--duration-normal) ease;
}

.video-card:hover .video-card-title {
    color: var(--text-bright);
}

.video-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-tertiary);
}

.video-card-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.video-card-meta i {
    font-size: 10px;
    color: var(--text-tertiary);
}

/* ── Search Layout ──────────────────────────────────────────── */
.search-layout {
    display: flex;
    gap: 28px;
}

.search-sidebar {
    width: 250px;
    flex-shrink: 0;
}

.search-sidebar-section h3 {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
}

.badge-vertical-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.badge-vertical-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out-expo);
}

.badge-vertical-item:hover {
    background: rgba(6, 182, 212, 0.06);
    border-color: rgba(6, 182, 212, 0.25);
    color: var(--text-primary);
    transform: translateX(3px);
}

.badge-vertical-item .count {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    color: var(--text-tertiary);
    font-weight: 500;
}

.search-results-area {
    flex: 1;
    min-width: 0;
}

.search-meta-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
    padding-bottom: 14px;
    position: relative;
}

.search-meta-bar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, var(--border-default), transparent);
}

.search-meta-bar h2 {
    font-size: 20px;
}

.results-count {
    font-size: 13px;
    color: var(--text-tertiary);
    font-weight: 500;
}

/* ── Pagination ─────────────────────────────────────────────── */
.pagination-bar {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 32px;
}

.page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    transition: all var(--duration-normal) var(--ease-out-expo);
}

.page-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-glow);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.page-btn.active {
    background: var(--gradient-aurora);
    color: var(--text-bright);
    border: none;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.2);
    font-weight: 700;
}

.page-btn.btn-text {
    width: auto;
    padding: 0 16px;
    font-family: var(--font-heading);
    font-weight: 600;
}

/* ── Downloads Dashboard ────────────────────────────────────── */
.downloads-dashboard {
    background: var(--bg-panel);
    backdrop-filter: blur(var(--blur-md));
    -webkit-backdrop-filter: blur(var(--blur-md));
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.downloads-table-header {
    display: grid;
    grid-template-columns: 2fr 100px 120px 1.5fr 100px;
    padding: 14px 24px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.downloads-list {
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.download-row {
    display: grid;
    grid-template-columns: 2fr 100px 120px 1.5fr 100px;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13px;
    transition: all var(--duration-normal) ease;
    position: relative;
}

.download-row::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: transparent;
    transition: background var(--duration-normal) ease;
}

.download-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.download-row:hover::before {
    background: var(--gradient-aurora);
}

.download-row:last-child {
    border-bottom: none;
}

.col-title {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 20px;
}

.col-res span {
    padding: 4px 10px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-violet);
}

.col-speed {
    color: var(--text-tertiary);
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 12px;
}

.col-progress {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 20px;
}

/* Progress Bar */
.progress-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-aurora);
    border-radius: 3px;
    transition: width 0.5s var(--ease-out-expo);
    position: relative;
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.3);
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
    animation: progress-shimmer 2s infinite;
}

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

.progress-fill.status-completed {
    background: var(--success);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

.progress-fill.status-completed::after {
    display: none;
}

.progress-fill.status-failed {
    background: var(--danger);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

.progress-fill.status-failed::after {
    display: none;
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-tertiary);
}

.progress-status-text {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Pulsing dot for active downloads */
.status-txt-downloading::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--accent-cyan);
    border-radius: 50%;
    display: inline-block;
    animation: status-pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 6px var(--accent-cyan);
}

.status-txt-downloading { color: var(--accent-cyan); }
.status-txt-completed { color: var(--success); }
.status-txt-failed { color: var(--danger); }
.status-txt-cancelled { color: var(--text-tertiary); }

.col-action button {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    width: 32px;
    height: 32px;
    cursor: pointer;
    transition: all var(--duration-normal) ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.col-action button:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.4);
    color: var(--danger);
}

/* ── Skeleton Loading ───────────────────────────────────────── */
.skeleton-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.skeleton-thumb {
    width: 100%;
    padding-top: 56.25%;
    background: linear-gradient(110deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0.06) 40%, rgba(255,255,255,0.02) 60%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.8s ease-in-out infinite;
}

.skeleton-body {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.skeleton-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(110deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.08) 40%, rgba(255,255,255,0.03) 60%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.8s ease-in-out infinite;
}

.skeleton-line.short {
    width: 60%;
}

.skeleton-line.xs {
    width: 40%;
    height: 10px;
}

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

/* ── Modal Styling ──────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: overlay-in 0.3s ease;
}

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

.modal-card {
    background: rgba(12, 17, 30, 0.95);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 1000px;
    height: 85vh;
    padding: 32px;
    position: relative;
    box-shadow: var(--shadow-lg), var(--shadow-glow-violet);
    animation: modal-enter 0.35s var(--ease-spring);
}

@keyframes modal-enter {
    from { opacity: 0; transform: scale(0.92) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close-btn {
    position: absolute;
    top: 18px;
    right: 18px;
    font-size: 28px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--duration-normal) ease;
}

.modal-close-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.modal-layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 32px;
    height: 100%;
    overflow: hidden;
}

.modal-main-info {
    overflow-y: auto;
    padding-right: 12px;
}

.modal-main-info h2 {
    font-size: 22px;
    line-height: 1.3;
}

.modal-video-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 13px;
    color: var(--text-tertiary);
}

.likes-dislikes-bar {
    display: flex;
    gap: 16px;
}

.stat-like, .stat-dislike {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
}

.stat-like { color: var(--success); }
.stat-dislike { color: var(--danger); }

.metadata-section h3 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 10px;
    letter-spacing: 0.8px;
}

.video-description-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px;
    white-space: pre-line;
}

/* Modal Action Panel */
.modal-action-panel {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding-left: 16px;
    border-left: 1px solid var(--border-subtle);
}

.panel-section h3 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: 0.8px;
}

.download-options-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.download-option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: all var(--duration-normal) var(--ease-out-expo);
}

.download-option-row:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(6, 182, 212, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dl-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.dl-res-tag {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-primary);
}

.dl-codec-tag {
    font-size: 11px;
    color: var(--text-tertiary);
}

.btn-download-action {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--gradient-aurora);
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-bright);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out-expo);
}

.btn-download-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.2);
}

/* ── Related Videos List ────────────────────────────────────── */
.vertical-video-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mini-video-card {
    display: flex;
    gap: 12px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 8px;
    transition: all var(--duration-normal) var(--ease-out-expo);
}

.mini-video-card:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(6, 182, 212, 0.25);
    transform: translateX(2px);
}

.mini-thumb {
    width: 90px;
    height: 50px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
}

.mini-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mini-details {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    min-width: 0;
}

.mini-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-meta {
    font-size: 10px;
    color: var(--text-tertiary);
}

/* ── Loading & Empty States ─────────────────────────────────── */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 48px;
    color: var(--text-tertiary);
    font-size: 14px;
    width: 100%;
}

.loading-spinner i {
    color: var(--accent-cyan);
    font-size: 18px;
}

.no-data, .no-data-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    padding: 48px 20px;
    font-size: 14px;
    width: 100%;
    text-align: center;
    gap: 8px;
}

/* ── Utility Classes ────────────────────────────────────────── */
.mt-4 { margin-top: 24px; }
.mt-3 { margin-top: 16px; }
.mt-2 { margin-top: 8px; }

/* ── Toast Notification ─────────────────────────────────────── */
.toast-message {
    position: fixed;
    bottom: 28px;
    right: 28px;
    padding: 14px 22px;
    background: rgba(12, 17, 30, 0.95);
    backdrop-filter: blur(var(--blur-md));
    -webkit-backdrop-filter: blur(var(--blur-md));
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-lg), var(--shadow-glow-cyan);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toast-slide-in 0.5s var(--ease-spring);
    max-width: 420px;
    position: relative;
    overflow: hidden;
}

/* Toast left accent bar */
.toast-message::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--gradient-aurora);
}

/* Toast auto-dismiss progress bar */
.toast-message::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: var(--gradient-aurora);
    animation: toast-progress 4s linear forwards;
}

@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toast-progress {
    from { width: 100%; }
    to { width: 0%; }
}

/* ── Video Player Container ─────────────────────────────────── */
.video-player-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid var(--border-default);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), var(--shadow-glow-violet);
}

.video-player-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    outline: none;
}

/* ── Keyframe Animations ────────────────────────────────────── */
@keyframes fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes zoom-in {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slide-in-up {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Touch & Scroll UX ──────────────────────────────────────── */
button, a, .badge-item, .video-card, .nav-item, .page-btn, .badge-vertical-item {
    touch-action: manipulation;
}

#app-content-panel,
.modal-main-info,
.modal-action-panel,
.downloads-list {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* ── Reduced Motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .bg-mesh::before,
    .bg-mesh::after,
    .bg-mesh-accent {
        animation: none !important;
    }
}

/* ================================================================
   Responsive Breakpoints
   ================================================================ */

/* ── Tablet (≤ 900px) ───────────────────────────────────────── */
@media (max-width: 900px) {
    .search-layout {
        flex-direction: column;
        gap: 20px;
    }
    .search-sidebar {
        width: 100%;
    }
}

/* ── Mobile (≤ 768px) ───────────────────────────────────────── */
@media (max-width: 768px) {
    /* Header */
    #app-header {
        height: auto;
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .logo-area {
        flex: 0 0 auto;
    }

    .logo-text {
        font-size: 15px;
    }

    .search-bar-area {
        flex: 1 1 100%;
        order: 3;
    }

    #global-search-form {
        width: 100%;
    }

    .search-btn {
        padding: 0 14px;
        font-size: 12px;
    }

    .user-status-area {
        flex: 0 0 auto;
    }

    .badge-premium {
        display: none;
    }

    /* Workspace → column */
    #app-workspace {
        flex-direction: column;
    }

    /* Sidebar → Fixed bottom tab bar */
    #app-sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: calc(64px + env(safe-area-inset-bottom, 0px));
        border-right: none;
        border-top: 1px solid var(--border-subtle);
        background: rgba(6, 8, 13, 0.95);
        backdrop-filter: blur(var(--blur-lg));
        -webkit-backdrop-filter: blur(var(--blur-lg));
        padding: 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        z-index: 1000;
        display: flex;
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
    }

    /* Gradient top border on mobile nav */
    #app-sidebar::before {
        content: '';
        position: absolute;
        top: -1px;
        left: 0;
        right: 0;
        height: 1px;
        background: var(--gradient-aurora);
        opacity: 0.3;
    }

    #app-sidebar::after {
        display: none;
    }

    .sidebar-nav {
        display: flex;
        flex-direction: row;
        width: 100%;
        height: 64px;
        margin: 0;
        padding: 0;
        justify-content: space-around;
        align-items: center;
        gap: 0;
    }

    .nav-item {
        flex: 1;
        height: 100%;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 4px;
        background: transparent !important;
        border: none !important;
        border-radius: 0;
        padding: 8px 0;
        font-size: 10px;
        color: var(--text-tertiary);
    }

    .nav-item::before {
        display: none !important;
    }

    .nav-item i {
        font-size: 18px;
    }

    .nav-item.active {
        color: var(--accent-cyan);
        background: transparent !important;
    }

    .nav-item.active i {
        filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.6));
    }

    .badge-downloads-count {
        position: absolute;
        top: 6px;
        right: 25%;
        margin: 0;
    }

    .sidebar-footer-box {
        display: none;
    }

    /* Content panel */
    #app-content-panel {
        padding: 16px 16px calc(80px + env(safe-area-inset-bottom, 0px)) 16px;
        width: 100%;
        overflow-x: hidden;
    }

    .section-header h2 {
        font-size: 17px;
    }

    /* Video grid */
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }

    .video-card-body {
        padding: 10px 12px;
    }

    .video-card-title {
        font-size: 12px;
        height: 34px;
        margin-bottom: 4px;
    }

    .video-card-meta {
        font-size: 10px;
    }

    /* Modal: full-screen on mobile */
    .modal-card {
        width: 100% !important;
        max-width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
        padding: 16px;
        padding-top: calc(16px + env(safe-area-inset-top, 0px));
        border: none;
    }

    .modal-close-btn {
        top: calc(12px + env(safe-area-inset-top, 0px));
        right: 16px;
    }

    .modal-layout {
        display: flex;
        flex-direction: column;
        gap: 20px;
        margin-top: 40px;
        height: auto;
        overflow-y: auto;
    }

    .modal-main-info {
        padding-right: 0;
        overflow-y: visible;
    }

    .modal-main-info h2 {
        font-size: 18px;
    }

    .modal-video-stats {
        gap: 10px;
        font-size: 12px;
    }

    .modal-action-panel {
        border-left: none;
        border-top: 1px solid var(--border-subtle);
        padding-left: 0;
        padding-top: 20px;
        overflow-y: visible;
    }

    .download-option-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .download-option-row .dl-actions-wrapper {
        width: 100%;
        justify-content: flex-end;
    }

    /* Downloads: card layout */
    .downloads-table-header {
        display: none;
    }

    .download-row {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        grid-template-columns: none !important;
        gap: 8px;
        padding: 14px;
        background: rgba(255, 255, 255, 0.02);
        border: 1px solid var(--border-subtle);
        border-radius: var(--radius-md);
        margin-bottom: 10px;
    }

    .download-row::before {
        display: none;
    }

    .download-row .col-title {
        font-size: 13px;
        font-weight: 600;
        width: 100%;
        white-space: normal;
        overflow: visible;
        text-overflow: initial;
        padding-right: 0;
    }

    .download-row .col-res {
        width: auto;
    }

    .download-row .col-speed {
        width: auto;
        color: var(--accent-cyan);
        font-size: 12px;
    }

    .download-row .col-progress {
        width: 100%;
        padding-right: 0;
    }

    .download-row .col-action {
        width: 100%;
        display: flex;
        justify-content: flex-end;
        padding-top: 6px;
        border-top: 1px solid rgba(255, 255, 255, 0.04);
    }

    /* Search */
    .search-meta-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .search-meta-bar h2 {
        font-size: 17px;
    }

    /* Pagination */
    .page-btn {
        width: 44px;
        height: 44px;
        font-size: 14px;
    }

    /* Toast */
    .toast-message {
        left: 16px;
        right: 16px;
        bottom: calc(80px + env(safe-area-inset-bottom, 0px));
        max-width: none;
    }
}

/* ── Small Phone (≤ 480px) ──────────────────────────────────── */
@media (max-width: 480px) {
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .video-card-body {
        padding: 8px 10px;
    }

    .video-card-title {
        font-size: 11px;
        height: auto;
        -webkit-line-clamp: 1;
    }

    .video-card-meta {
        font-size: 9px;
    }

    .duration-badge {
        font-size: 9px;
        padding: 2px 5px;
    }

    .quality-badge {
        font-size: 8px;
        padding: 2px 5px;
    }

    .section-header h2 {
        font-size: 15px;
    }

    .badge-item {
        padding: 6px 10px;
        font-size: 11px;
    }

    .badge-bar {
        gap: 6px;
    }

    .modal-card {
        padding: 12px;
    }

    .modal-layout {
        margin-top: 28px;
        gap: 16px;
    }

    .modal-main-info h2 {
        font-size: 16px;
    }

    #app-content-panel {
        padding: 12px 12px calc(76px + env(safe-area-inset-bottom, 0px)) 12px;
    }

    #app-header {
        padding: 10px 12px;
        gap: 8px;
    }

    .logo-icon {
        font-size: 20px;
    }

    .logo-text {
        font-size: 14px;
        letter-spacing: 1px;
    }

    #search-input {
        height: 38px;
        font-size: 12px;
        padding-left: 38px;
    }

    .search-icon-embed {
        left: 12px;
        font-size: 12px;
    }

    .search-btn {
        height: 38px;
        padding: 0 12px;
        font-size: 11px;
    }

    .pagination-bar {
        flex-wrap: wrap;
        gap: 6px;
    }

    .page-btn {
        width: 40px;
        height: 40px;
        font-size: 13px;
    }

    .mini-thumb {
        width: 72px;
        height: 40px;
    }

    .mini-title {
        font-size: 11px;
    }

    .mini-meta {
        font-size: 9px;
    }

    .toast-message {
        left: 8px;
        right: 8px;
        font-size: 12px;
        padding: 12px 16px;
    }
}
