/* CSS Variables */
:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #ec4899;
    --bg-dark: #0f0f23;
    --bg-card: #1a1a2e;
    --bg-card-hover: #252542;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6b6b7b;
    --border: #2a2a3e;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.2s ease;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--primary);
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn:hover:not(:disabled) {
    background: var(--bg-card-hover);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-icon {
    padding: 0.625rem;
    border-radius: var(--radius-sm);
}

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

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

.btn-secondary {
    background: var(--bg-card-hover);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--primary);
}

.btn-play {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    padding: 0;
}

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

.btn-record {
    background: var(--bg-card-hover);
    border: 2px solid var(--danger);
    color: var(--danger);
}

.btn-record:hover:not(:disabled) {
    background: var(--danger);
    color: white;
}

.btn-record.recording {
    background: var(--danger);
    color: white;
    animation: pulse 1.5s infinite;
}

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

.btn-stop-record:hover {
    background: #dc2626;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    gap: 1.5rem;
}

/* Canvas Container */
.canvas-container {
    position: relative;
    flex: 1;
    min-height: 300px;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

#visualizerCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Drop Zone */
.drop-zone {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: rgba(15, 15, 35, 0.9);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    z-index: 10;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.drop-zone svg {
    width: 64px;
    height: 64px;
    color: var(--text-secondary);
}

.drop-zone p {
    font-size: 1.125rem;
    color: var(--text-primary);
}

.drop-zone .supported-formats {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.drop-zone.hidden {
    display: none;
}

/* Controls Panel */
.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.control-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

/* Audio Controls */
.audio-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.audio-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.track-name {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
}

.time-display {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.progress-container {
    width: 100%;
}

.progress-bar {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-card-hover);
    border-radius: 3px;
    cursor: pointer;
}

.progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.progress-bar::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.progress-bar::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--primary);
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

.playback-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

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

.volume-slider {
    width: 100px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-card-hover);
    border-radius: 2px;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
}

.volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

/* Settings Grid */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-item label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.select-input {
    padding: 0.5rem 0.75rem;
    background: var(--bg-card-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

.select-input:hover {
    border-color: var(--primary);
}

.select-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.color-input {
    width: 100%;
    height: 36px;
    padding: 2px;
    background: var(--bg-card-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.color-input::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-input::-webkit-color-swatch {
    border-radius: 4px;
    border: none;
}

.range-input {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-card-hover);
    border-radius: 2px;
    cursor: pointer;
}

.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
}

.range-input::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--primary);
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

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

.recording-status {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.recording-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-sm);
}

.recording-indicator.hidden {
    display: none;
}

.recording-dot {
    width: 10px;
    height: 10px;
    background: var(--danger);
    border-radius: 50%;
    animation: blink 1s infinite;
}

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

#recordingTime {
    font-size: 0.875rem;
    color: var(--danger);
    font-weight: 500;
}

/* Footer */
.footer {
    padding: 1rem 1.5rem;
    text-align: center;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
}

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

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

.footer a:hover {
    color: var(--secondary);
    text-decoration: underline;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Fullscreen Mode */
.app-container.fullscreen .header,
.app-container.fullscreen .controls-panel,
.app-container.fullscreen .footer {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.app-container.fullscreen:hover .header,
.app-container.fullscreen:hover .footer {
    opacity: 1;
    pointer-events: auto;
}

.app-container.fullscreen .main-content {
    padding: 0;
}

.app-container.fullscreen .canvas-container {
    border-radius: 0;
    min-height: 100vh;
}

.app-container.fullscreen .controls-panel {
    position: fixed;
    bottom: 60px;
    left: 1.5rem;
    right: 1.5rem;
    z-index: 100;
    max-height: 50vh;
    overflow-y: auto;
}

.app-container.fullscreen:hover .controls-panel {
    opacity: 1;
    pointer-events: auto;
}

.app-container.fullscreen .footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
}

/* Responsive Design */
@media (min-width: 768px) {
    .main-content {
        flex-direction: row;
    }

    .canvas-container {
        flex: 2;
        min-height: 400px;
    }

    .controls-panel {
        flex: 1;
        max-width: 360px;
        overflow-y: auto;
        max-height: calc(100vh - 180px);
    }

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

@media (min-width: 1024px) {
    .header {
        padding: 1rem 2rem;
    }

    .main-content {
        padding: 2rem;
    }

    .canvas-container {
        min-height: 500px;
    }

    .controls-panel {
        max-width: 400px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0.75rem 1rem;
    }

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

    .main-content {
        padding: 1rem;
    }

    .control-section {
        padding: 1rem;
    }

    .playback-controls {
        gap: 0.5rem;
    }

    .btn-play {
        width: 48px;
        height: 48px;
    }

    .volume-control {
        width: 100%;
        margin-left: 0;
        margin-top: 0.5rem;
        justify-content: center;
    }

    .volume-slider {
        flex: 1;
        max-width: 150px;
    }

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

    .drop-zone svg {
        width: 48px;
        height: 48px;
    }

    .drop-zone p {
        font-size: 1rem;
    }
}

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

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

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

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

/* Focus States */
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Animation for bars */
@keyframes barBounce {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.1); }
}
