/* ============================================================
   AudioTrimPro — Professional Design System
   ============================================================ */

:root {
    /* Color Palette — Global Premium Dark */
    --bg-base: #09090b;
    --bg-elevated: #18181b;
    --bg-surface: #121214;
    --bg-surface-hover: #1f1f22;
    --bg-input: #18181b;
    --bg-gray: #27272a;

    --primary: #d4af37; /* Premium Gold */
    --primary-hover: #c5a028;
    --primary-glow: rgba(212, 175, 55, 0.2);
    --primary-dim: rgba(212, 175, 55, 0.08);

    --accent: #fcd34d;

    --text-primary: #f8fafc; /* Pure White/Light Grey */
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;

    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    --border: #27272a;
    --border-focus: rgba(212, 175, 55, 0.5);

    /* Feature Card Highlights (Disabled for clean look) */
    --feat-yellow: transparent;
    --feat-green: transparent;
    --feat-blue: transparent;
    --feat-pink: transparent;

    /* Typography */
    --font: 'Inter', system-ui, -apple-system, sans-serif;

    /* Spacing & Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 0.2s var(--ease);
}


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

body {
    font-family: var(--font);
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Layout ────────────────────────────────────────────────── */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    width: 100%;
}

/* ── Header ────────────────────────────────────────────────── */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px; /* Reduced from 24px to remove extra whitespace */
    background: transparent;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    flex-shrink: 0;
    z-index: 101;
}

.logo i {
    font-size: 1.75rem;
    color: var(--success); /* Playful color for logo */
}

.logo h1 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    white-space: nowrap;
}

.logo h1 span {
    color: var(--primary);
    font-weight: 400;
}

.top-nav {
    display: flex;
    gap: 32px; /* Fixed desktop spacing */
    align-items: center;
}

.nav-link {
    text-decoration: none;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 1.05rem;
    transition: color var(--transition);
}

.nav-link:hover {
    color: var(--primary);
}

.nav-link.active {
    color: var(--text-primary);
    font-weight: 700;
}

/* ── Dropdown Nav ────────────────────────────────────────────── */
.dropdown {
    position: relative;
    display: inline-block;
}

/* Invisible bridge to prevent hover loss between button and menu */
.dropdown::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 12px;
}

.dropdown-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1.05rem;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--bg-surface);
    min-width: 220px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    z-index: 200;
    padding: 8px 0;
    margin-top: 8px;
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--bg-surface);
}

.dropdown:hover .dropdown-menu {
    display: block;
    animation: fadeIn 0.2s var(--ease);
}

.dropdown-item {
    color: var(--text-secondary);
    padding: 10px 20px;
    text-decoration: none;
    display: block;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all var(--transition);
}

.dropdown-item:hover {
    background-color: var(--bg-surface-hover);
    color: var(--primary);
}

.dropdown-item.active {
    color: var(--primary);
    background-color: var(--primary-dim);
    font-weight: 600;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    z-index: 101;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
    
    .top-nav {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 80px;
        left: 20px;
        right: 20px;
        background: rgba(24, 24, 27, 0.98);
        backdrop-filter: blur(10px);
        padding: 24px;
        border-radius: var(--radius-lg);
        box-shadow: 0 20px 40px rgba(0,0,0,0.5);
        z-index: 100;
        gap: 20px;
        border: 1px solid var(--border);
        max-height: 85vh;
        overflow-y: auto;
    }

    .top-nav.open {
        display: flex;
    }

    .dropdown {
        width: 100%;
    }
    
    .dropdown-menu {
        position: static;
        display: block;
        box-shadow: none;
        border: none;
        background: transparent;
        padding: 0;
        margin-top: 10px;
        width: 100%;
        max-height: none;
        overflow-y: visible;
    }
    
    .dropdown-item {
        padding: 12px 16px;
    }
}

/* ── Utility ───────────────────────────────────────────────── */
.hidden { display: none !important; }
.ml-auto { margin-left: auto; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-family: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1.4;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--primary);
    color: #09090b;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.2);
}
.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 16px rgba(212, 175, 55, 0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}
.btn-secondary:hover { background: var(--border); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-dim);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 6px 12px;
}
.btn-ghost:hover {
    background: var(--primary-dim);
    color: var(--primary);
}

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-full { width: 100%; }

.btn-play {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 1.25rem;
    padding: 0;
    flex-shrink: 0;
}
.btn-play:hover {
    background: var(--primary-hover);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.btn-icon-sm {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-surface-hover);
    color: var(--text-secondary);
    font-size: 1rem;
    padding: 0;
    flex-shrink: 0;
}
.btn-icon-sm:hover { background: var(--border); color: var(--text-primary); }

.btn-upload {
    padding: 12px 32px;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
}

.btn-export {
    padding: 12px 24px;
    font-size: 0.95rem;
    margin-top: 16px;
    border-radius: var(--radius-sm);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    transition: all var(--transition);
    padding: 8px;
    border-radius: var(--radius-sm);
}
.icon-btn:hover {
    color: var(--primary);
    background: var(--primary-dim);
}

/* ── Memorable Sonic Ripple Background ────────────────────────── */
.color-header-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 600px;
    background: radial-gradient(circle at 50% 0%, #18181b 0%, #09090b 70%);
    overflow: hidden;
    z-index: -10;
    mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
    pointer-events: none;
}

.sonic-ring {
    position: absolute;
    top: -50px;
    left: 50%;
    border-radius: 50%;
    border: 2px solid rgba(212, 175, 55, 0.15); /* Premium gold color */
    box-shadow: 0 0 60px rgba(212, 175, 55, 0.05), inset 0 0 60px rgba(212, 175, 55, 0.05);
    animation: ripple 12s linear infinite;
    pointer-events: none;
}

.sonic-ring:nth-child(1) { width: 200px; height: 200px; margin-top: -100px; margin-left: -100px; animation-delay: 0s; }
.sonic-ring:nth-child(2) { width: 200px; height: 200px; margin-top: -100px; margin-left: -100px; animation-delay: 3s; }
.sonic-ring:nth-child(3) { width: 200px; height: 200px; margin-top: -100px; margin-left: -100px; animation-delay: 6s; }
.sonic-ring:nth-child(4) { width: 200px; height: 200px; margin-top: -100px; margin-left: -100px; animation-delay: 9s; }

@keyframes ripple {
    0% { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(8); opacity: 0; }
}

/* ── Hero Section ────────────────────────────────────────────── */
.hero-section {
    text-align: center;
    padding: 10px 20px 20px; /* Reduced vertical padding */
    margin-bottom: 20px;
}

.hero-badge {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px; /* Reduced */
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem); /* Scaled down slightly */
    font-weight: 900;
    background: linear-gradient(-45deg, #d4af37, #fcd34d, #c5a028, #fef08a);
    background-size: 300% 300%;
    animation: textShimmer 6s ease infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    letter-spacing: -0.04em; /* Tighter letter spacing for a premium look */
    margin-bottom: 8px; /* Reduced */
    line-height: 1.1;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    padding-bottom: 4px;
}

@keyframes textShimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.hero-subtitle {
    font-size: clamp(0.95rem, 2.5vw, 1.15rem);
    color: var(--text-secondary);
    margin-bottom: 24px; /* Reduced */
    font-weight: 400;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

/* ── Upload Section (Glassmorphism Dropzone) ─────────────── */
.upload-card {
    display: flex;
    justify-content: center;
    border-radius: var(--radius-xl);
    padding: 20px;
    background: linear-gradient(145deg, #18181b, #121214);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    max-width: 600px;
    margin: 0 auto;
}

.upload-dropzone {
    border-radius: var(--radius-lg);
    padding: 40px 24px;
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    transition: all var(--transition);
    border: 2px dashed var(--border);
    background: rgba(0, 0, 0, 0.2);
}

.upload-dropzone.drag-active {
    background: var(--primary-dim);
    border-color: var(--primary);
    transform: scale(1.02);
}

.upload-icon-wrap {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--primary-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.upload-icon {
    font-size: 1.25rem;
}

.upload-dropzone h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.upload-dropzone p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    max-width: 400px;
}

.upload-hint {
    color: var(--text-tertiary) !important;
    font-size: 0.8rem !important;
}

.hidden-input { display: none; }

/* ── Workspace ─────────────────────────────────────────────── */
.workspace {
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: fadeIn 0.35s var(--ease);
}

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

/* File Info Bar */
.file-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    gap: 12px;
}

.file-details {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.file-details i {
    color: var(--primary);
    font-size: 1.1rem;
    flex-shrink: 0;
}

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

.badge {
    background: var(--primary-dim);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    flex-shrink: 0;
}

/* ── Waveform Card ─────────────────────────────────────────── */
.waveform-card {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
}

.waveform-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}

.waveform-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.waveform-label i {
    color: var(--primary);
    font-size: 1rem;
}

.zoom-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.zoom-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.zoom-control input[type="range"] {
    width: 100px;
}

.waveform-body {
    position: relative;
    padding: 0;
    overflow: hidden;
}

#waveform {
    width: 100%;
    height: 240px;
}

#waveform ::part(cursor) {
    width: 2px !important;
    background-color: transparent !important;
}

#waveform-timeline {
    width: 100%;
    margin-bottom: 4px;
}

/* ── Custom Playhead Overlay ───────────────────────────────── */
#custom-playhead {
    position: absolute;
    top: 0;
    /* Offset by half width to keep the visual line perfectly centered at the exact time */
    left: -12px;
    width: 24px;
    height: 100%;
    pointer-events: auto;
    z-index: 20;
    cursor: ew-resize;
}

#custom-playhead:hover .ph-line {
    background: #a855f7;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.8);
    width: 4px;
}

#custom-playhead:hover .ph-triangle {
    border-top-color: #a855f7;
}

.ph-triangle {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 10px solid #ffffff;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.6));
}

.ph-line {
    position: absolute;
    top: 10px; /* start just below triangle tip */
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: calc(100% - 10px - 30px); /* leaves room for minimap at bottom */
    background: #000;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.2);
}

.ph-time-label {
    position: absolute;
    top: -2px;
    left: 12px; /* offset so it doesn't cover the line */
    font-family: 'Inter', monospace;
    font-size: 11px;
    font-weight: 600;
    color: #f59e0b;
    background: rgba(0, 0, 0, 0.55);
    padding: 1px 5px;
    border-radius: 4px;
    white-space: nowrap;
    letter-spacing: 0.02em;
    backdrop-filter: blur(4px);
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(12, 17, 29, 0.85);
    backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.loading-overlay p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 12px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--bg-surface-hover);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ── Controls Grid ─────────────────────────────────────────── */
.controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.control-panel {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-header i {
    color: var(--primary);
    font-size: 1.1rem;
}

.panel-header h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Playback ──────────────────────────────────────────────── */
.playback-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.playback-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-display {
    font-family: 'Inter', monospace;
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    font-variant-numeric: tabular-nums;
}

#current-time {
    color: var(--primary);
    font-weight: 600;
}

.time-sep {
    color: var(--text-tertiary);
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-tertiary);
    font-size: 1rem;
}

/* ── Regions ───────────────────────────────────────────────── */
.regions-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
    min-height: 48px;
}

.regions-list::-webkit-scrollbar { width: 4px; }
.regions-list::-webkit-scrollbar-track { background: transparent; }
.regions-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.empty-state {
    color: var(--text-tertiary);
    font-size: 0.8rem;
    text-align: center;
    padding: 12px 8px;
}

.empty-state strong {
    color: var(--text-secondary);
}

.region-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-input);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    gap: 8px;
}

.region-item:hover {
    border-color: var(--border-focus);
}

.region-item.active {
    border-color: var(--primary);
    background: var(--primary-dim);
}

.region-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.region-item-times {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Inter', monospace;
    font-size: 0.8rem;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.region-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.region-item-duration {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    margin-left: 18px;
}

.region-item-actions {
    flex-shrink: 0;
}

.btn-delete-region {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    font-size: 1rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all var(--transition);
}
.btn-delete-region:hover {
    color: var(--danger);
    background: rgba(248, 113, 113, 0.1);
}

.region-actions {
    display: flex;
    gap: 8px;
}

/* ── Export Form ────────────────────────────────────────────── */
.export-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.export-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

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

.input-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

input[type="text"],
.custom-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    width: 100%;
    transition: all var(--transition);
    outline: none;
}

input[type="text"]:focus,
.custom-select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ── Toggle Switch ─────────────────────────────────────────── */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.toggle-switch input { display: none; }

.toggle-track {
    position: relative;
    width: 40px;
    height: 22px;
    background: var(--border);
    border-radius: 11px;
    transition: background var(--transition);
    flex-shrink: 0;
}

.toggle-thumb {
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    transition: transform var(--transition);
}

.toggle-switch input:checked + .toggle-track {
    background: var(--primary);
}

.toggle-switch input:checked + .toggle-track .toggle-thumb {
    transform: translateX(18px);
}

.toggle-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ── Progress ──────────────────────────────────────────────── */
.progress-container {
    background: var(--bg-input);
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-top: 12px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 8px;
    color: var(--primary);
    font-weight: 500;
}

.progress-bar-bg {
    width: 100%;
    height: 6px;
    background: var(--bg-surface-hover);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    width: 0%;
    transition: width 0.3s var(--ease);
    border-radius: 3px;
}

/* ── Range Inputs ──────────────────────────────────────────── */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
    height: 20px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 14px;
    width: 14px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    margin-top: -5px;
    box-shadow: 0 0 4px rgba(0,0,0,0.2);
}

input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: var(--bg-surface-hover);
    border-radius: 2px;
}

/* ── Waveform Region Handles ───────────────────────────────── */
#waveform ::part(region) {
    border-left: 2px solid var(--primary);
    border-right: 2px solid var(--primary);
}

#waveform ::part(handle-left),
#waveform ::part(handle-right) {
    width: 28px !important;
    background: var(--primary) !important; 
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1), inset 0 0 0 2px rgba(255,255,255,0.4);
    cursor: ew-resize !important;
}

#waveform ::part(handle-left):hover,
#waveform ::part(handle-right):hover {
    background: var(--primary-hover) !important;
}

/* ── Features Grid (Landing Content) ───────────────────────── */
.landing-content {
    margin-top: 64px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
}

.content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 48px;
    max-width: 1200px;
    margin: 0 auto;
}

.intro-article {
    background: var(--bg-surface);
    padding: 40px 32px;
    border-radius: var(--radius-xl);
    box-shadow: 0 10px 30px rgba(0,0,0,0.03);
    border: 1px solid rgba(255,255,255,0.8);
    transition: transform var(--transition), box-shadow var(--transition);
}

.intro-article:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(79, 70, 229, 0.08);
}

.intro-article h2 {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 24px;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.intro-article p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 20px;
}

.intro-article p:last-child {
    margin-bottom: 0;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.feature-card {
    background: var(--bg-surface);
    padding: 40px 32px;
    border-radius: var(--radius-xl);
    box-shadow: 0 10px 30px rgba(0,0,0,0.03);
    border: 1px solid rgba(255,255,255,0.8);
    transition: transform var(--transition), box-shadow var(--transition);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(79, 70, 229, 0.08);
}

.feature-icon {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 24px;
}

.feature-title-wrap {
    margin-bottom: 16px;
}

.feature-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    background: transparent !important;
    padding: 0;
    margin: 0;
}

.feature-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Highlight Colors */
.bg-yellow { background: var(--feat-yellow); }
.bg-green { background: var(--feat-green); }
.bg-blue { background: var(--feat-blue); }
.bg-pink { background: var(--feat-pink); }

.faq-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 24px;
    text-align: center;
    color: var(--text-primary);
}

.faq-item {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    overflow: hidden;
}

.faq-item summary {
    padding: 16px 20px;
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-primary);
    transition: background var(--transition);
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.2rem;
    color: var(--primary);
    transition: transform var(--transition);
}

.faq-item[open] summary {
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface-hover);
}

.faq-item[open] summary::after {
    transform: rotate(45deg);
}

.faq-content {
    padding: 20px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.app-footer {
    text-align: center;
    padding: 32px 0 16px 0;
    margin-top: 48px;
    border-top: 1px solid var(--border);
    color: var(--text-tertiary);
    font-size: 0.85rem;
}

/* ── Cookie Banner ─────────────────────────────────────────── */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    gap: 24px;
    z-index: 9999;
    max-width: 90%;
    width: max-content;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.cookie-banner.hidden {
    display: none;
}

.cookie-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cookie-icon {
    font-size: 1.5rem;
}

.cookie-content p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-primary);
}

@keyframes slideUp {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ============================================================
   RESPONSIVE — Tablet
   ============================================================ */
@media (max-width: 900px) {
    .controls-grid {
        grid-template-columns: 1fr 1fr;
    }

    .controls-grid > .control-panel:last-child {
        grid-column: 1 / -1;
    }
}

/* ============================================================
   RESPONSIVE — Mobile
   ============================================================ */
@media (max-width: 640px) {
    .app-container {
        padding: 16px 12px;
    }

    .app-header {
        margin-bottom: 20px;
        padding-bottom: 14px;
    }

    .logo i { font-size: 1.4rem; }
    .logo h1 { font-size: 1.15rem; }

    /* Upload */
    .upload-dropzone {
        margin: 16px;
        padding: 32px 16px;
    }

    .upload-icon-wrap {
        width: 56px;
        height: 56px;
    }

    .upload-icon { font-size: 1.5rem; }
    .upload-dropzone h2 { font-size: 1.05rem; }
    .upload-dropzone p { font-size: 0.82rem; }
    .btn-upload { padding: 10px 24px; font-size: 0.9rem; }

    /* File Info */
    .file-info-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 14px;
    }

    .file-details {
        gap: 8px;
    }

    .file-name { font-size: 0.82rem; }

    /* Waveform */
    .waveform-toolbar {
        padding: 8px 14px;
    }

    .waveform-body {
        padding: 0;
    }



    .zoom-control input[type="range"] {
        width: 80px;
    }

    .zoom-label {
        display: none;
    }

    /* Controls */
    .controls-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .controls-grid > .control-panel:last-child {
        grid-column: auto;
    }

    .control-panel {
        padding: 16px;
        gap: 12px;
    }

    .panel-header h3 { font-size: 0.8rem; }

    /* Playback */
    .playback-controls {
        flex-wrap: wrap;
        gap: 10px;
    }

    .btn-play {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }

    .btn-icon-sm {
        width: 36px;
        height: 36px;
    }

    .time-display {
        font-size: 0.82rem;
        width: 100%;
        justify-content: center;
        margin-left: 0;
    }

    /* Regions */
    .region-actions {
        flex-direction: column;
    }

    .region-item-times { font-size: 0.75rem; }

    /* Export */
    .export-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .btn-export {
        padding: 11px 20px;
        font-size: 0.9rem;
    }

    /* Region Handles — larger for touch */
    #waveform ::part(handle-left),
    #waveform ::part(handle-right) {
        width: 16px !important;
    }
}

/* ============================================================
   RESPONSIVE — Small Phones
   ============================================================ */
@media (max-width: 400px) {
    .app-container { padding: 10px 8px; }

    .logo h1 { font-size: 1rem; }
    .logo i { font-size: 1.2rem; }

    .upload-dropzone {
        margin: 10px;
        padding: 24px 12px;
        gap: 8px;
    }

    .upload-icon-wrap { width: 48px; height: 48px; }
    .upload-dropzone h2 { font-size: 0.95rem; }

    .waveform-toolbar { padding: 6px 10px; }
    .waveform-body { padding: 10px 10px; }
    .waveform-label { font-size: 0.7rem; }


    .control-panel { padding: 12px; }
    .panel-header h3 { font-size: 0.75rem; }

    .btn-play { width: 40px; height: 40px; font-size: 1rem; }
    .btn-icon-sm { width: 32px; height: 32px; font-size: 0.85rem; }

    .time-display { font-size: 0.75rem; }
    .region-item { padding: 6px 8px; }
    .region-item-times { font-size: 0.7rem; }
    .region-dot { width: 8px; height: 8px; }
}

/* ============================================================
   AI Badge
   ============================================================ */
.ai-badge {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 12px 20px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    z-index: 1000;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.ai-badge.ready {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}
.ai-badge.ready .spinner-small {
    display: none;
}
.ai-badge i {
    display: none;
}
.ai-badge.ready i {
    display: block;
}
.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
