/* Aura Studio - Professional Music Production Software */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette */
    --primary-color: #6c5ce7;
    --primary-dark: #5b4fcf;
    --secondary-color: #00cec9;
    --accent-color: #fd79a8;
    --success-color: #00b894;
    --warning-color: #fdcb6e;
    --danger-color: #d63031;
    --info-color: #0984e3;
    
    /* UI Colors */
    --dark-bg: #0f0f23;
    --dark-panel: #1a1a2e;
    --dark-surface: #2d2d44;
    --dark-border: #3d3d5c;
    --light-text: #ffffff;
    --medium-text: #b0b0d0;
    --muted-text: #7a7a9c;
    
    /* Timeline Colors */
    --track-1: #6c5ce7;
    --track-2: #00cec9;
    --track-3: #fd79a8;
    --track-4: #00b894;
    --track-5: #fdcb6e;
    
    /* Effects */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--dark-bg);
    color: var(--light-text);
    height: 100vh;
    overflow: hidden;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--dark-bg), var(--dark-panel));
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity var(--transition-slow);
}

.loading-content {
    text-align: center;
    max-width: 400px;
    padding: 2rem;
}

.audio-animation {
    position: relative;
    width: 200px;
    height: 100px;
    margin: 0 auto 2rem;
}

.sound-wave {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100%;
}

.wave-bar {
    width: 6px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 3px;
    animation: wave 1.5s infinite ease-in-out;
}

.wave-bar:nth-child(2) { animation-delay: 0.1s; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; }
.wave-bar:nth-child(4) { animation-delay: 0.3s; }
.wave-bar:nth-child(5) { animation-delay: 0.4s; }
.wave-bar:nth-child(6) { animation-delay: 0.5s; }
.wave-bar:nth-child(7) { animation-delay: 0.6s; }
.wave-bar:nth-child(8) { animation-delay: 0.7s; }

@keyframes wave {
    0%, 100% { height: 20px; }
    50% { height: 80px; }
}

.ai-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    color: var(--secondary-color);
    animation: pulse 2s infinite;
}

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

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--dark-surface);
    border-radius: 3px;
    margin-top: 2rem;
    overflow: hidden;
}

.progress {
    width: 30%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 3px;
    animation: progress 2s infinite;
}

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

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

.hidden {
    display: none !important;
}

/* Navigation */
.app-nav {
    background: var(--dark-panel);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    border-bottom: 1px solid var(--dark-border);
    box-shadow: var(--shadow-sm);
    z-index: 100;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-brand i {
    font-size: 1.8rem;
    color: var(--primary-color);
}

.nav-brand h1 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-subtitle {
    font-size: 0.8rem;
    color: var(--medium-text);
    margin-left: 0.5rem;
}

.nav-controls {
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: var(--border-radius-sm);
    color: var(--medium-text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.transport-controls {
    display: flex;
    gap: 0.5rem;
}

.transport-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    color: var(--medium-text);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.transport-btn:hover {
    background: var(--dark-surface);
    color: white;
}

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

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

.bpm-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--dark-surface);
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius-sm);
}

.bpm-display i {
    color: var(--secondary-color);
}

.bpm-display input {
    width: 50px;
    background: transparent;
    border: none;
    color: white;
    font-family: 'Roboto Mono', monospace;
    font-size: 1rem;
    text-align: center;
}

.bpm-display input:focus {
    outline: none;
}

.master-volume {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100px;
}

.master-volume i {
    color: var(--accent-color);
}

.master-volume input {
    flex: 1;
}

.user-menu {
    position: relative;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--dark-surface);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--medium-text);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.user-avatar:hover {
    background: var(--primary-color);
    color: white;
}

.user-dropdown {
    position: absolute;
    top: 45px;
    right: 0;
    background: var(--dark-panel);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    width: 200px;
    padding: 1rem;
    z-index: 1000;
}

.user-info {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--dark-border);
    margin-bottom: 0.5rem;
}

.user-name {
    display: block;
    font-weight: 600;
}

.user-role {
    display: block;
    font-size: 0.8rem;
    color: var(--medium-text);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem;
    background: none;
    border: none;
    color: var(--medium-text);
    text-align: left;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--dark-surface);
    color: white;
}

/* Main Workspace */
.app-main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Sidebars */
.sidebar {
    width: 280px;
    background: var(--dark-panel);
    border-right: 1px solid var(--dark-border);
    overflow-y: auto;
    padding: 1rem;
}

.right-sidebar {
    border-right: none;
    border-left: 1px solid var(--dark-border);
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--medium-text);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-section h3 i {
    color: var(--secondary-color);
}

/* AI Controls */
.ai-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.ai-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: var(--border-radius-sm);
    color: var(--medium-text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.ai-btn i {
    font-size: 1rem;
}

/* AI Chat */
.ai-chat {
    background: var(--dark-surface);
    border-radius: var(--border-radius-md);
    overflow: hidden;
}

.ai-chat-header {
    background: var(--dark-panel);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.ai-chat-messages {
    height: 200px;
    padding: 1rem;
    overflow-y: auto;
}

.ai-message {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.ai-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-content {
    background: var(--dark-panel);
    padding: 0.75rem;
    border-radius: var(--border-radius-md);
    font-size: 0.9rem;
    line-height: 1.4;
}

.ai-chat-input {
    display: flex;
    padding: 0.75rem;
    border-top: 1px solid var(--dark-border);
}

.ai-chat-input input {
    flex: 1;
    background: var(--dark-panel);
    border: 1px solid var(--dark-border);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 0.75rem;
    color: white;
    font-size: 0.9rem;
}

.ai-chat-input input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.ai-chat-input button {
    background: var(--primary-color);
    border: none;
    border-radius: var(--border-radius-sm);
    color: white;
    width: 36px;
    margin-left: 0.5rem;
    cursor: pointer;
}

/* Effects Rack */
.effects-rack {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.effect-slot {
    background: var(--dark-surface);
    border: 2px dashed var(--dark-border);
    border-radius: var(--border-radius-sm);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.effect-slot:hover {
    border-color: var(--primary-color);
    background: var(--dark-panel);
}

.effect-slot i {
    font-size: 1.2rem;
    color: var(--secondary-color);
}

.effect-slot span {
    font-size: 0.8rem;
    color: var(--medium-text);
}

/* Drum Machine */
.drum-pad-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.drum-pad {
    aspect-ratio: 1;
    background: var(--dark-surface);
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 2px solid transparent;
}

.drum-pad:hover {
    background: var(--primary-color);
    transform: scale(1.05);
}

.drum-pad.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    transform: scale(0.95);
}

.drum-pad span {
    font-size: 0.8rem;
    font-weight: 500;
}

/* Timeline Area */
.timeline-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.timeline-header {
    background: var(--dark-panel);
    border-bottom: 1px solid var(--dark-border);
    padding: 0.5rem 1rem;
}

.track-headers {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.track-header {
    width: 150px;
    background: var(--dark-surface);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.track-header:hover {
    background: var(--primary-color);
}

.track-header i {
    color: var(--secondary-color);
}

.track-header.master {
    background: var(--dark-panel);
    border: 1px solid var(--dark-border);
}

.timeline-ruler {
    background: var(--dark-surface);
    border-radius: var(--border-radius-sm);
    padding: 0.25rem 0.5rem;
}

.ruler-markers {
    display: flex;
    justify-content: space-between;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.8rem;
    color: var(--medium-text);
}

/* Timeline Tracks */
.timeline-tracks {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    position: relative;
}

.track {
    display: flex;
    height: 80px;
    margin-bottom: 0.5rem;
    background: var(--dark-panel);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--dark-border);
    position: relative;
}

.track-controls {
    width: 150px;
    padding: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    align-content: center;
    gap: 0.25rem;
    border-right: 1px solid var(--dark-border);
}

.track-controls .track-mute,
.track-controls .track-solo {
    width: 28px;
    height: 28px;
}

.track-controls .track-volume {
    width: 60px;
}

.track-controls .track-input {
    width: 100%;
    font-size: 0.7rem;
    padding: 0.15rem 0.3rem;
}

.track-mute,
.track-solo {
    width: 32px;
    height: 32px;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: var(--border-radius-sm);
    color: var(--medium-text);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.track-mute:hover,
.track-solo:hover {
    background: var(--dark-surface);
    color: white;
}

.track-mute.active {
    background: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
}

.track-solo.active {
    background: var(--warning-color);
    border-color: var(--warning-color);
    color: var(--dark-bg);
}

.track-volume {
    width: 100%;
}

.track-input {
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: var(--border-radius-sm);
    color: var(--medium-text);
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.track-clips {
    flex: 1;
    position: relative;
    overflow-x: auto;
    padding: 0.5rem;
}

.audio-clip {
    position: absolute;
    height: calc(100% - 1rem);
    background: var(--primary-color);
    border-radius: var(--border-radius-sm);
    cursor: move;
    user-select: none;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
}

.audio-clip:hover {
    border-color: white;
    box-shadow: var(--shadow-md);
}

.audio-clip[data-track="1"] { background: var(--track-1); }
.audio-clip[data-track="2"] { background: var(--track-2); }
.audio-clip[data-track="3"] { background: var(--track-3); }
.audio-clip[data-track="4"] { background: var(--track-4); }
.audio-clip[data-track="5"] { background: var(--track-5); }

.clip-content {
    padding: 0.5rem;
    height: 100%;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Playhead */
.playhead {
    position: absolute;
    top: 0;
    left: 150px;
    width: 2px;
    height: 100%;
    background: var(--accent-color);
    pointer-events: none;
    z-index: 10;
}

.playhead::before {
    content: '';
    position: absolute;
    top: 0;
    left: -4px;
    width: 10px;
    height: 10px;
    background: var(--accent-color);
    border-radius: 50%;
}

/* Mixer */
.mixer-channels {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding: 0.5rem 0;
}

.mixer-channel {
    width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.channel-label {
    font-size: 0.8rem;
    color: var(--medium-text);
    text-align: center;
}

.channel-fader {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.vertical-fader {
    writing-mode: vertical-lr;
    direction: rtl;
    height: 120px;
    width: 20px;
    background: var(--dark-surface);
    border-radius: 10px;
    -webkit-appearance: slider-vertical;
}

.channel-meter {
    width: 8px;
    height: 60px;
    background: var(--dark-surface);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.meter-level {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: linear-gradient(to top, var(--success-color), var(--warning-color));
    transition: height 0.1s;
}

.channel-controls {
    display: flex;
    gap: 0.25rem;
}

.channel-mute,
.channel-solo {
    width: 24px;
    height: 24px;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: var(--border-radius-sm);
    color: var(--medium-text);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.channel-mute:hover,
.channel-solo:hover {
    background: var(--dark-surface);
    color: white;
}

.channel-mute.active {
    background: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
}

.channel-solo.active {
    background: var(--warning-color);
    border-color: var(--warning-color);
    color: var(--dark-bg);
}

/* Active Effects */
.active-effects {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.effect-panel {
    background: var(--dark-surface);
    border-radius: var(--border-radius-md);
    padding: 0.75rem;
    border-left: 3px solid var(--secondary-color);
}

.effect-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.effect-header i {
    color: var(--secondary-color);
}

.effect-remove {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--medium-text);
    cursor: pointer;
    font-size: 0.8rem;
}

.effect-remove:hover {
    color: var(--danger-color);
}

.effect-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.eq-band,
.effect-param {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
}

.eq-band span,
.effect-param span {
    color: var(--medium-text);
    min-width: 60px;
}

.eq-slider,
.effect-param input {
    width: 120px;
}

/* Analyzer */
.analyzer-display {
    background: var(--dark-surface);
    border-radius: var(--border-radius-md);
    padding: 1rem;
}

.spectrum-analyzer {
    height: 100px;
    background: var(--dark-bg);
    border-radius: var(--border-radius-sm);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-end;
    gap: 2px;
    padding: 0.5rem;
}

.spectrum-bar {
    flex: 1;
    background: linear-gradient(to top, var(--secondary-color), var(--primary-color));
    border-radius: 2px 2px 0 0;
    min-height: 2px;
}

.analyzer-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.analyzer-reading {
    background: var(--dark-panel);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem;
    font-size: 0.8rem;
}

.analyzer-reading span:first-child {
    color: var(--medium-text);
    margin-right: 0.25rem;
}

/* Footer */
.app-footer {
    background: var(--dark-panel);
    border-top: 1px solid var(--dark-border);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.footer-left,
.footer-center,
.footer-right {
    flex: 1;
}

.recording-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.record-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--danger-color);
    border: none;
    border-radius: var(--border-radius-sm);
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.record-btn:hover {
    background: #c53030;
}

.recording-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.recording-indicator {
    width: 12px;
    height: 12px;
    background: var(--danger-color);
    border-radius: 50%;
    animation: recording 1s infinite;
}

@keyframes recording {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.input-monitor {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.input-meter {
    flex: 1;
    height: 6px;
    background: var(--dark-surface);
    border-radius: 3px;
    overflow: hidden;
}

.input-meter .meter-level {
    background: linear-gradient(90deg, var(--success-color), var(--warning-color));
}

.ai-generation {
    text-align: center;
}

.ai-generation h4 {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.ai-gen-controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.ai-gen-controls select {
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: var(--border-radius-sm);
    color: var(--medium-text);
    padding: 0.5rem;
    font-size: 0.9rem;
    min-width: 120px;
}

.project-stats {
    display: flex;
    justify-content: flex-end;
    gap: 1.5rem;
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--medium-text);
}

.stat i {
    color: var(--secondary-color);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: var(--dark-panel);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--dark-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--medium-text);
    font-size: 1.2rem;
    cursor: pointer;
}

.modal-close:hover {
    color: white;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.ai-gen-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.ai-option {
    background: var(--dark-surface);
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    text-align: center;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
}

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

.ai-option i {
    font-size: 2rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.ai-option h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.ai-option p {
    font-size: 0.9rem;
    color: var(--medium-text);
    margin-bottom: 1rem;
    line-height: 1.4;
}

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

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

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

.btn-danger:hover {
    background: #c53030;
}

/* Notifications */
.notifications-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 3000;
}

.notification {
    background: var(--dark-panel);
    border-radius: var(--border-radius-md);
    padding: 1rem;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary-color);
    animation: slideIn 0.3s ease;
    max-width: 300px;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification i {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-top: 0.1rem;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.notification-message {
    font-size: 0.9rem;
    color: var(--medium-text);
}

/* Range Input Styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-track {
    background: var(--dark-surface);
    height: 6px;
    border-radius: 3px;
}

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

input[type="range"]::-moz-range-track {
    background: var(--dark-surface);
    height: 6px;
    border-radius: 3px;
}

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

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--dark-surface);
    border-radius: 4px;
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Context Menu (generated by utils.js) */
.context-menu {
    position: fixed;
    background: var(--dark-panel);
    border: 1px solid var(--dark-border);
    border-radius: var(--border-radius-md);
    padding: 0.5rem 0;
    min-width: 180px;
    box-shadow: var(--shadow-lg);
    z-index: 5000;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: var(--medium-text);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.context-menu-item:hover {
    background: var(--primary-color);
    color: white;
}

.context-menu-item i {
    width: 16px;
    text-align: center;
    font-size: 0.8rem;
}

.context-menu-divider {
    height: 1px;
    background: var(--dark-border);
    margin: 0.25rem 0;
}

/* Tooltips (generated by utils.js) */
.tooltip {
    position: fixed;
    background: var(--dark-panel);
    border: 1px solid var(--dark-border);
    border-radius: var(--border-radius-sm);
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    color: var(--medium-text);
    box-shadow: var(--shadow-sm);
    z-index: 6000;
    pointer-events: none;
    white-space: nowrap;
}

/* Typing Indicator (AI chat) */
.typing-dots {
    display: flex;
    gap: 4px;
    padding: 0.25rem 0;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--medium-text);
    border-radius: 50%;
    animation: typingBounce 1.2s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* Resize Handles (generated by utils.js) */
.resize-handle {
    position: absolute;
    top: 0;
    width: 4px;
    height: 100%;
    cursor: col-resize;
    z-index: 50;
    transition: background var(--transition-fast);
}

.resize-handle:hover {
    background: var(--primary-color);
}

.resize-right { right: 0; }
.resize-left { left: 0; }

/* Selected Track */
.track.selected {
    border-color: var(--primary-color);
    box-shadow: inset 0 0 0 1px var(--primary-color);
}

/* Clip Fades */
.audio-clip.fade-in {
    mask-image: linear-gradient(to right, transparent, black 30%);
    -webkit-mask-image: linear-gradient(to right, transparent, black 30%);
}

.audio-clip.fade-out {
    mask-image: linear-gradient(to left, transparent, black 30%);
    -webkit-mask-image: linear-gradient(to left, transparent, black 30%);
}

.audio-clip.reversed {
    filter: hue-rotate(180deg);
}

/* Drag & Drop */
.app-container.drag-over {
    outline: 2px dashed var(--primary-color);
    outline-offset: -4px;
}

/* User message in AI chat */
.user-message .user-avatar {
    background: var(--secondary-color);
}

/* Loop button active */
.transport-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Record arm active */
.record-btn.active {
    background: var(--danger-color);
    animation: recording 1s infinite;
}

/* Master track waveform fallback */
.track-waveform {
    flex: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
}

/* Responsive Design */
@media (max-width: 1400px) {
    .sidebar {
        width: 240px;
    }
    
    .track-controls {
        width: 120px;
    }
    
    .playhead {
        left: 120px;
    }
}

@media (max-width: 1200px) {
    .app-footer {
        flex-direction: column;
        height: auto;
        gap: 1rem;
        padding: 1rem;
    }
    
    .footer-left,
    .footer-center,
    .footer-right {
        width: 100%;
    }
    
    .project-stats {
        justify-content: center;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }
    
    .track-controls {
        width: 100px;
    }
    
    .playhead {
        left: 100px;
    }
    
    .ai-gen-options {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-nav {
        flex-direction: column;
        height: auto;
        padding: 1rem;
        gap: 1rem;
    }
    
    .nav-left,
    .nav-right {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .transport-controls { flex-wrap: wrap; justify-content: center; }
    
    .sidebar {
        display: none;
    }
    
    .sidebar.active {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        z-index: 1000;
    }
    
    .track-controls {
        width: 80px;
    }
    
    .playhead {
        left: 80px;
    }
}
/* ==========================================================================
   SOUND LIBRARY
   ========================================================================== */
.library-section .lib-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}
.lib-cat {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #9aa7c2;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    cursor: pointer;
    transition: all .15s;
}
.lib-cat:hover { background: rgba(255, 255, 255, 0.1); color: #e6ecff; }
.lib-cat.active {
    background: linear-gradient(135deg, #6c5ce7, #8b7cff);
    border-color: transparent;
    color: #fff;
}
.lib-search {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #e6ecff;
    padding: 7px 10px;
    font-size: 12px;
    outline: none;
    margin-bottom: 8px;
}
.lib-search:focus { border-color: #6c5ce7; }
.lib-list {
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.lib-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all .12s;
}
.lib-item:hover { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.1); }
.lib-item.playing { border-color: #6c5ce7; background: rgba(108, 92, 231, 0.18); }
.lib-play, .lib-add {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    border: 0;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lib-play { background: rgba(108, 92, 231, 0.25); color: #b9aeff; }
.lib-play:hover { background: #6c5ce7; color: #fff; }
.lib-add { background: rgba(0, 206, 201, 0.18); color: #6ee7de; }
.lib-add:hover { background: #00cec9; color: #06202b; }
.lib-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lib-name {
    color: #e6ecff;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lib-sub { color: #7d8aa6; font-size: 10px; }
.lib-empty { color: #7d8aa6; font-size: 12px; padding: 14px 6px; text-align: center; line-height: 1.5; }
.lib-foot {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.lib-track-label { color: #7d8aa6; font-size: 11px; }
.lib-track {
    flex: 1;
    min-width: 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e6ecff;
    border-radius: 7px;
    padding: 5px 6px;
    font-size: 11px;
    outline: none;
}
.lib-import {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cfe0ff;
    border-radius: 7px;
    padding: 5px 9px;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
}
.lib-import:hover { background: rgba(255, 255, 255, 0.12); }
.audio-clip.library-clip { background: linear-gradient(135deg, #00b894, #00cec9); }

/* ==========================================================================
   MOBILE TAB BAR + PHONE LAYOUT
   ========================================================================== */
.mobile-tabs { display: none; }

@media (max-width: 768px) {
    html, body { overflow-x: hidden; }
    .app-container { min-height: 100dvh; }

    /* Header: compact, sticky, and the transport (Play) is always on screen. */
    .app-nav {
        position: sticky;
        top: 0;
        z-index: 60;
        flex-direction: column;
        height: auto;
        padding: calc(env(safe-area-inset-top, 0px) + 8px) 10px 8px;
        gap: 8px;
        background: #10131f;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }
    .nav-left, .nav-right {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    .nav-subtitle { display: none; }
    .nav-brand { font-size: 15px; }
    .nav-controls { gap: 6px; }
    .nav-controls .nav-btn { padding: 7px 9px; font-size: 12px; }

    .transport-controls {
        display: flex;
        flex-wrap: nowrap;
        justify-content: center;
        gap: 10px;
        order: -1;              /* transport first — Play is the hero control */
        width: 100%;
    }
    .transport-btn { width: 42px; height: 42px; flex: 0 0 auto; }
    .transport-btn.play-btn { width: 54px; height: 54px; font-size: 17px; }

    /* One panel at a time, chosen by the tab bar. */
    .app-main {
        flex-direction: column;
        padding-bottom: 0;
    }
    /* clearance for the fixed tab bar goes on the container, so whichever panel
       is last (main or footer) always clears it */
    .app-container { padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
    .app-footer { flex-direction: column; height: auto; gap: 10px; padding: 12px; }
    .app-footer > div { width: 100%; justify-content: center; }
    .sidebar {
        width: 100% !important;
        max-width: none;
        height: auto;
        border: 0;
        flex-direction: column;
    }
    .timeline-area { min-height: 55vh; }

    .mobile-tabs {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 70;
        height: calc(58px + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: rgba(12, 15, 26, 0.96);
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        align-items: center;
        justify-content: space-around;
    }
    .mtab {
        flex: 1;
        background: none;
        border: 0;
        color: #7d8aa6;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        font-size: 11px;
        padding: 6px 4px;
        cursor: pointer;
    }
    .mtab i { font-size: 17px; }
    .mtab.active { color: #8b7cff; }

    .lib-list { max-height: none; }

    /* Float the shared widgets above the tab bar so they never cover it. */
    #bbai { bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important; }
    #bbws-btn { bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important; }
    #bbacct { bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important; }
    #bbai-p, #bbws-p { bottom: calc(134px + env(safe-area-inset-bottom, 0px)) !important; }
}

/* ==========================================================================
   AI SONG (Suno-style)
   ========================================================================== */
.sg-field { margin-bottom: 8px; }
.sg-field label { display: block; color: #7d8aa6; font-size: 11px; margin-bottom: 4px; }
.sg-input, .sg-area, .sg-sel {
    width: 100%; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1);
    border-radius: 8px; color: #e6ecff; padding: 8px 10px; font-size: 12px; outline: none;
    font-family: inherit;
}
.sg-input:focus, .sg-area:focus { border-color: #6c5ce7; }
.sg-area { min-height: 92px; resize: vertical; line-height: 1.5; }
.sg-genres { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.sg-chip {
    background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08);
    color: #9aa7c2; border-radius: 999px; padding: 3px 9px; font-size: 10.5px; cursor: pointer;
}
.sg-chip:hover { background: #6c5ce7; color: #fff; border-color: transparent; }
.sg-row { display: flex; gap: 6px; }
.sg-row .sg-field { flex: 1; }
.sg-go {
    width: 100%; margin-top: 8px; padding: 11px; border: 0; border-radius: 9px; cursor: pointer;
    background: linear-gradient(135deg, #6c5ce7, #00cec9); color: #fff; font-size: 13px; font-weight: 600;
}
.sg-go:disabled { opacity: .6; cursor: default; }
.sg-progress { display: none; margin-top: 12px; }
.sg-track { height: 6px; background: rgba(255,255,255,.08); border-radius: 99px; overflow: hidden; }
.sg-bar { height: 100%; width: 0; background: linear-gradient(90deg,#6c5ce7,#00cec9); transition: width .6s; }
.sg-note { color: #7d8aa6; font-size: 11px; margin-top: 6px; text-align: center; }
.sg-result { display: none; margin-top: 12px; background: rgba(108,92,231,.10);
    border: 1px solid rgba(108,92,231,.3); border-radius: 10px; padding: 11px; }
.sg-result h4 { margin: 0 0 8px; color: #e6ecff; font-size: 13px; }
.sg-result audio { width: 100%; height: 34px; margin-bottom: 8px; }
.sg-acts { display: flex; gap: 6px; }
.sg-acts a, .sg-acts button {
    flex: 1; text-align: center; text-decoration: none; border: 0; cursor: pointer;
    border-radius: 8px; padding: 8px; font-size: 11.5px; font-weight: 600;
}
.sg-stems { background: #00cec9; color: #06202b; }
.sg-dl { background: rgba(255,255,255,.1); color: #cfe0ff; }
.sg-library { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; }
.sg-song { display: flex; align-items: center; gap: 7px; padding: 6px 8px; border-radius: 8px; background: rgba(255,255,255,.03); }
.sg-song:hover { background: rgba(255,255,255,.07); }
.sg-song-name { flex: 1; min-width: 0; color: #e6ecff; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-song-play, .sg-song-open {
    width: 24px; height: 24px; border-radius: 6px; border: 0; cursor: pointer; font-size: 9px;
    display: flex; align-items: center; justify-content: center;
}
.sg-song-play { background: rgba(108,92,231,.25); color: #b9aeff; }
.sg-song-open { background: rgba(0,206,201,.18); color: #6ee7de; }
.sg-empty { color: #7d8aa6; font-size: 11.5px; text-align: center; padding: 10px; }
.audio-clip.stem-clip { background: linear-gradient(135deg,#6c5ce7,#00cec9); }

.sg-hint{color:#7d8aa6;font-size:11px;margin:0 0 8px;line-height:1.5}

/* ==========================================================================
   BUTTON FIXES
   Both of these are the same bug: they are flex children with a fixed width but
   no shrink guard, so flexbox squashed them below their own icon. The chat send
   button collapsed to 13px (icon invisible, overflowing its parent) and the
   effect-remove buttons to 10x15px.
   ========================================================================== */
.ai-chat-input { gap: 0.5rem; align-items: center; }
.ai-chat-input button,
.ai-chat-input #ai-send {
    flex: 0 0 38px;          /* <- the fix: never shrink */
    width: 38px;
    height: 38px;
    margin-left: 0;          /* the gap handles spacing now */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    line-height: 1;
    padding: 0;
    transition: filter .15s;
}
.ai-chat-input button:hover { filter: brightness(1.15); }
.ai-chat-input input { min-width: 0; }   /* let the input shrink instead of the button */

.effect-remove {
    flex: 0 0 auto;
    min-width: 22px;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    font-size: 11px;
    border-radius: 6px;
    cursor: pointer;
}


/* ==========================================================================
   CHAT BUBBLE FIXES
   .message-content had no flex sizing, so in the 280px sidebar the bubble
   collapsed and the reply wrapped every 2-3 words. It must take the row.
   ========================================================================== */
.ai-chat-messages { height: 260px; }
.ai-message { align-items: flex-start; }
.message-content {
    flex: 1 1 auto;
    min-width: 0;                 /* <- lets it actually shrink/grow in the flex row */
    overflow-wrap: anywhere;
    word-break: break-word;
}
.message-content p { margin: 0 0 .5em; }
.message-content p:last-child { margin-bottom: 0; }
.message-content strong { color: #fff; font-weight: 700; }
.message-content em { color: #cfe0ff; }
.chat-list { margin: .35em 0; padding-left: 1.1em; }
.chat-list li { margin: .18em 0; }
.chat-code {
    background: rgba(255,255,255,.09); padding: 1px 5px; border-radius: 4px;
    font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85em; color: #9ff5ee;
}
.chat-pre {
    background: rgba(0,0,0,.35); padding: 8px 10px; border-radius: 8px; overflow-x: auto;
    font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8em;
    margin: .4em 0; white-space: pre; color: #cfe0ff;
}

/* ==========================================================================
   CHAT BUBBLES — reclaim the sidebar width
   The avatar column ate ~57px of a 280px sidebar (and wasn't even visible),
   leaving replies wrapping every 2-3 words. Drop it and use proper aligned
   bubbles: assistant left, user right.
   ========================================================================== */
.ai-chat-messages .ai-avatar,
.ai-chat-messages .user-avatar { display: none; }

.ai-chat-messages .ai-message {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: .55rem;
}
.ai-chat-messages .message-content {
    max-width: 92%;
    width: auto;
    padding: .55rem .7rem;
    font-size: .84rem;
    line-height: 1.5;
    border-radius: 12px;
}
/* assistant: left */
.ai-chat-messages .ai-message .message-content {
    align-self: flex-start;
    background: var(--dark-panel);
    border-bottom-left-radius: 4px;
}
/* user: right, accented */
.ai-chat-messages .user-message .message-content {
    align-self: flex-end;
    background: #4f7cff;
    color: #fff;
    border-bottom-right-radius: 4px;
    border-bottom-left-radius: 12px;
}
.ai-chat-messages .user-message .message-content strong { color: #fff; }
