/* CSS Variables */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #e0e7ff;
    --secondary-color: #64748b;
    --secondary-hover: #475569;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: all 0.2s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #8b5cf6 100%);
    color: white;
    padding: 2rem 1.5rem;
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo-icon {
    width: 36px;
    height: 36px;
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.tagline {
    font-size: 1rem;
    opacity: 0.9;
    max-width: 400px;
    margin: 0 auto;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Card */
.card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.card h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.card h2 svg {
    width: 22px;
    height: 22px;
    color: var(--primary-color);
}

/* Upload Section */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 2.5rem 1.5rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    background: var(--background-color);
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
}

.upload-text {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
}

.upload-subtext {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.upload-formats {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--background-color);
    border-radius: var(--radius-md);
    margin-top: 1rem;
}

.file-details {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-details svg {
    width: 20px;
    height: 20px;
    color: var(--primary-color);
}

.file-duration {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

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

.btn-primary {
    background: var(--primary-color);
    color: white;
}

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

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

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

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-large {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    width: 100%;
    margin-top: 1rem;
}

.btn-icon {
    padding: 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: var(--transition);
}

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

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

/* Media Player */
.player-section .media-container {
    margin-bottom: 1rem;
}

.player-section video {
    width: 100%;
    border-radius: var(--radius-md);
    background: #000;
    max-height: 400px;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--background-color);
    border-radius: var(--radius-md);
}

.progress-container {
    flex: 1;
}

.progress-bar {
    position: relative;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    overflow: visible;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    width: 0%;
    transition: width 0.1s ease;
}

.progress-markers {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.progress-marker {
    position: absolute;
    top: -4px;
    width: 4px;
    height: 16px;
    background: var(--warning-color);
    border-radius: 2px;
    transform: translateX(-50%);
    cursor: pointer;
    pointer-events: auto;
    transition: var(--transition);
}

.progress-marker:hover {
    background: var(--danger-color);
    transform: translateX(-50%) scale(1.2);
}

.progress-marker.impact { background: #ef4444; }
.progress-marker.whoosh { background: #3b82f6; }
.progress-marker.ambient { background: #10b981; }
.progress-marker.vocal { background: #f59e0b; }
.progress-marker.music { background: #8b5cf6; }
.progress-marker.foley { background: #ec4899; }

.time-display {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

/* Range Input Styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

/* Analysis Section */
.analysis-options {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.option-group input[type="range"] {
    width: 100%;
}

.option-group input[type="number"] {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    width: 120px;
}

.category-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: var(--background-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.toggle:has(input:checked) {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.toggle input {
    accent-color: var(--primary-color);
}

.analysis-progress {
    margin-top: 1rem;
    text-align: center;
}

.progress-bar-horizontal {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill-horizontal {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #8b5cf6);
    width: 0%;
    transition: width 0.3s ease;
}

#analysisStatus {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

.results-header h2 {
    margin-bottom: 0;
}

.results-actions {
    display: flex;
    gap: 0.5rem;
}

.results-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--background-color);
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.results-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--background-color);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    flex: 1;
    min-width: 200px;
}

.search-box svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.search-box input {
    border: none;
    background: transparent;
    font-size: 0.9375rem;
    width: 100%;
    outline: none;
}

.results-filters select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    background: var(--surface-color);
    cursor: pointer;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 500px;
    overflow-y: auto;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--background-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.result-item:hover {
    background: var(--primary-light);
}

.result-time {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-color);
    min-width: 70px;
}

.result-info {
    flex: 1;
}

.result-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.result-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.result-category {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.result-category.impact { background: #fef2f2; color: #dc2626; }
.result-category.whoosh { background: #eff6ff; color: #2563eb; }
.result-category.ambient { background: #ecfdf5; color: #059669; }
.result-category.vocal { background: #fffbeb; color: #d97706; }
.result-category.music { background: #f5f3ff; color: #7c3aed; }
.result-category.foley { background: #fdf2f8; color: #db2777; }

.result-confidence {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.confidence-bar {
    width: 50px;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: var(--success-color);
    border-radius: 3px;
}

.result-play-btn {
    padding: 0.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.result-play-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.1);
}

.result-play-btn svg {
    width: 16px;
    height: 16px;
}

/* Library Section */
.library-description {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 1.5rem;
}

.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.library-card {
    background: var(--background-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    transition: var(--transition);
    border: 1px solid transparent;
}

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

.library-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
}

.library-icon svg {
    width: 22px;
    height: 22px;
    color: var(--primary-color);
}

.library-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
}

.library-card p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.library-examples {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.library-examples li {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: var(--surface-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 1.5rem;
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.powered-by {
    font-size: 0.9375rem;
    margin-bottom: 0.5rem;
}

.powered-by a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.powered-by a:hover {
    color: white;
    text-decoration: underline;
}

.copyright {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 1.5rem 1rem;
    }

    .logo h1 {
        font-size: 1.5rem;
    }

    .main-content {
        padding: 1rem;
    }

    .card {
        padding: 1.25rem;
    }

    .player-controls {
        flex-wrap: wrap;
    }

    .progress-container {
        order: 3;
        width: 100%;
    }

    .volume-control {
        order: 2;
    }

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

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

    .results-filters {
        flex-direction: column;
    }

    .search-box {
        width: 100%;
    }

    .results-filters select {
        width: 100%;
    }

    .result-item {
        flex-wrap: wrap;
    }

    .result-info {
        width: 100%;
        order: 3;
    }

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

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.25rem;
    }

    .tagline {
        font-size: 0.875rem;
    }

    .upload-area {
        padding: 1.5rem 1rem;
    }

    .category-toggles {
        gap: 0.375rem;
    }

    .toggle {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    .results-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-value {
        font-size: 1.25rem;
    }
}

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

.analyzing {
    animation: pulse 1.5s ease-in-out infinite;
}

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

.result-item {
    animation: slideIn 0.3s ease forwards;
}

/* Scrollbar Styling */
.results-list::-webkit-scrollbar {
    width: 6px;
}

.results-list::-webkit-scrollbar-track {
    background: var(--background-color);
    border-radius: 3px;
}

.results-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.results-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Tooltip */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.375rem 0.75rem;
    background: var(--text-primary);
    color: white;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 100;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}
