:root {
    --bg-base: #09090b;
    --bg-surface: #18181b;
    --bg-surface-hover: #27272a;
    --border: #3f3f46;
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;

    --primary: #8b5cf6;
    /* Violet */
    --primary-hover: #7c3aed;
    --accent: #3b82f6;
    /* Blue */
    --accent-glow: rgba(59, 130, 246, 0.5);

    --success: #10b981;
    --danger: #ef4444;

    --font-sans: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-base);
    color: var(--text-primary);
    overflow-x: hidden;
}

.text-gradient {
    background: linear-gradient(135deg, var(--accent), var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 48px;
}

.brand-icon {
    font-size: 24px;
    color: var(--primary);
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar nav a:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
}

.sidebar nav a.active {
    background-color: rgba(139, 92, 246, 0.1);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

.sidebar-footer {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    border-top: 1px solid var(--border);
    padding-top: 24px;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 40px 60px;
    display: flex;
    flex-direction: column;
}

.top-header {
    margin-bottom: 40px;
}

.top-header h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
}

.top-header p {
    color: var(--text-secondary);
    font-size: 16px;
}

.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Utilities */
.hidden {
    display: none !important;
}

.mt-4 {
    margin-top: 16px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 14px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--accent-glow);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-surface-hover);
    border-color: var(--text-secondary);
}

/* Upload Section */
.upload-card {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.drop-zone {
    width: 100%;
    height: 100%;
    border: 2px dashed var(--border);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: all 0.3s ease;
    padding: 60px 20px;
}

.drop-zone.dragover {
    border-color: var(--primary);
    background-color: rgba(139, 92, 246, 0.05);
}

.upload-icon-wrapper {
    width: 80px;
    height: 80px;
    background: var(--bg-base);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    font-size: 32px;
    color: var(--primary);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}

.drop-zone h3 {
    font-size: 24px;
    margin-bottom: 8px;
}

.drop-zone p {
    color: var(--text-secondary);
}

/* Model Selection */
.model-selection {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.model-selection label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
}

.model-select {
    padding: 10px 16px;
    border-radius: 8px;
    background-color: var(--bg-base);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    width: 100%;
    max-width: 300px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.model-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

/* Loader */
.processing-card {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.loader-container {
    text-align: center;
}

.ai-loader {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 6px;
    height: 60px;
    margin-bottom: 24px;
}

.ai-loader .bar {
    width: 6px;
    background: var(--primary);
    border-radius: 4px;
    animation: bounce 1s infinite alternate;
}

.ai-loader .bar:nth-child(1) {
    height: 20%;
    animation-delay: 0.1s;
    background: var(--accent);
}

.ai-loader .bar:nth-child(2) {
    height: 60%;
    animation-delay: 0.2s;
    background: var(--primary);
}

.ai-loader .bar:nth-child(3) {
    height: 100%;
    animation-delay: 0.3s;
    background: var(--accent);
}

.ai-loader .bar:nth-child(4) {
    height: 40%;
    animation-delay: 0.4s;
    background: var(--primary);
}

@keyframes bounce {
    to {
        transform: scaleY(0.2);
    }
}

/* Results Section */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.action-box {
    justify-content: center;
}

.stat-icon {
    width: 48px;
    height: 48px;
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
}

/* Timeline / Chords Views */
.timeline-card {
    padding: 0;
    overflow: hidden;
}

.card-header {
    background: var(--bg-surface);
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
}

.view-toggles {
    display: flex;
    background: var(--bg-base);
    border-radius: 8px;
    padding: 4px;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
}

.toggle-btn.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.view-container {
    position: relative;
    height: 500px;
    background: var(--bg-base);
}

.view-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.view-panel.active {
    opacity: 1;
    pointer-events: auto;
}

/* Timeline Styles */
.timeline-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.timeline-item {
    display: flex;
    background: var(--bg-surface);
    border: 1px solid rgb(63, 63, 70, 0.5);
    border-radius: 12px;
    padding: 16px;
    gap: 24px;
    align-items: flex-start;
    transition: transform 0.2s;
}

.timeline-item:hover {
    border-color: var(--border);
}

.time-badge {
    background: var(--bg-base);
    padding: 6px 12px;
    border-radius: 20px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.item-content {
    flex: 1;
}

.chord-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.chord-badge {
    background: rgba(139, 92, 246, 0.15);
    color: #c4b5fd;
    padding: 4px 10px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 14px;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.lyric-text {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Grid Styles for Chords Only */
.chord-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.grid-chord-item {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
}

.grid-chord-item .time {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
}

.grid-chord-item .chord {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
}

/* Active Audio Highlight Styles */
.chord-badge.active-highlight {
    background: var(--primary);
    color: #fff;
    transform: scale(1.1);
    box-shadow: 0 0 12px var(--primary);
    transition: all 0.2s ease;
}

.grid-chord-item.active-highlight {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    transition: all 0.2s ease;
}


/* Custom Scrollbar inside panels */
.view-panel::-webkit-scrollbar {
    width: 8px;
}

.view-panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.view-panel::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.view-panel::-webkit-scrollbar-thumb:hover {
    background: #52525b;
}