:root {
    --bg-app: #0A0A0B;
    --bg-sidebar: #121214;
    --bg-panel: #18181B;
    --bg-hover: #27272A;

    --primary: #A855F7;
    --primary-hover: #C084FC;

    --text-main: #FAFAFA;
    --text-muted: #A1A1AA;
    --text-dark: #52525B;

    --border: #27272A;
    --border-focus: #3F3F46;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);

    --radius-sm: 6px;
    --radius: 12px;
    --radius-lg: 16px;

    --font-sans: 'Inter', system-ui, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.glass {
    background: rgba(18, 18, 20, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 320px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    z-index: 10;
}

.brand {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--primary);
}

.brand h1 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

/* Upload Zone */
.upload-zone {
    margin: 1.5rem;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-panel);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(168, 85, 247, 0.05);
}

.upload-icon {
    color: var(--text-muted);
    margin-bottom: 1rem;
    transition: color 0.2s;
}

.upload-zone:hover .upload-icon {
    color: var(--primary);
}

.upload-text {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.upload-text span {
    color: var(--primary);
}

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

/* Controls Panel */
.controls-panel {
    flex: 1;
    padding: 0 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    transition: opacity 0.3s;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.control-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.control-header label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
}

.value-badge {
    font-size: 0.6875rem;
    background: var(--bg-hover);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

/* Forms & Inputs */
.premium-select {
    appearance: none;
    background: var(--bg-panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A1A1AA' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 0.75rem center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.625rem 2rem 0.625rem 0.75rem;
    color: var(--text-main);
    font-size: 0.875rem;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: border-color 0.2s;
}

.premium-select:focus {
    outline: none;
    border-color: var(--primary);
}

.premium-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
}

.premium-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.1);
    transition: transform 0.1s;
}

.premium-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 36px;
    height: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch label {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: .3s;
    border-radius: 34px;
}

.toggle-switch label:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

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

.toggle-switch input:checked+label:before {
    transform: translateX(16px);
}

/* Buttons */
.btn {
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    padding: 0.625rem 1rem;
    cursor: pointer;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

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

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

.block {
    width: 100%;
}

.mt-4 {
    margin-top: auto;
}

/* Workspace */
.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.workspace-header {
    height: 76px;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    z-index: 10;
}

.track-meta h2 {
    font-size: 1rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}

.track-meta p {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    margin-top: 0.125rem;
}

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

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    transition: all 0.2s;
}

.icon-btn:hover {
    color: var(--text-main);
    background: var(--bg-hover);
}

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

.play-btn {
    background: var(--primary);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}

.play-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

.play-btn:disabled {
    background: var(--border);
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.5;
}

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

/* Visualizer Container */
.visualizer-container {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.waveform-box {
    width: 100%;
    max-width: 1200px;
    border-radius: var(--radius-lg);
    padding: 1rem;
    position: relative;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

#waveform {
    width: 100%;
    height: 128px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

#spectrogram {
    width: 100%;
    height: 256px;
    overflow: hidden;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

#timeline {
    margin-bottom: 0.5rem;
}

/* Overlay Messages */
.overlay-msg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-panel);
    border-radius: var(--radius-lg);
    z-index: 5;
    color: var(--text-muted);
}

.overlay-msg.hidden {
    display: none !important;
}

/* Custom Wavesurfer specific styling overrides */
::part(spectrogram) {
    border-radius: var(--radius-sm);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(168, 85, 247, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 1rem;
}

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