/* CSS Variables */
:root {
    --primary-color: #6c5ce7;
    --secondary-color: #a29bfe;
    --accent-color: #fd79a8;
    --background-dark: #0a0a0f;
    --background-card: #15151f;
    --text-primary: #ffffff;
    --text-secondary: #b2b2c8;
    --border-color: #2a2a3e;
    --success-color: #00b894;
    --warning-color: #fdcb6e;
    --error-color: #d63031;
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --border-radius: 12px;
    --border-radius-lg: 20px;
    --transition: all 0.3s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

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

/* Header Styles */
.header {
    text-align: center;
    padding: 2rem 1rem;
    background: linear-gradient(180deg, rgba(108, 92, 231, 0.1) 0%, transparent 100%);
}

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

.logo-icon {
    font-size: 2.5rem;
    animation: pulse 2s ease-in-out infinite;
}

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

.header h1 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.tagline {
    color: var(--text-secondary);
    font-size: clamp(0.875rem, 2vw, 1rem);
}

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

/* Upload Section */
.upload-section {
    margin-bottom: 2rem;
}

.upload-container {
    background: var(--background-card);
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.upload-container:hover,
.upload-container.drag-over {
    border-color: var(--primary-color);
    background: rgba(108, 92, 231, 0.1);
    transform: translateY(-2px);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.upload-container h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.upload-container p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.upload-btn {
    background: var(--gradient-1);
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    font-size: 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.file-info {
    margin-top: 1rem;
    color: var(--success-color);
    font-weight: 500;
}

/* Visualizer Section */
.visualizer-section {
    display: none;
    position: relative;
    margin-bottom: 2rem;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.visualizer-section.active {
    display: block;
}

#visualizerCanvas {
    width: 100%;
    height: 400px;
    background: var(--background-card);
    display: block;
}

.emotion-indicator {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    padding: 0.75rem 1.25rem;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.emotion-emoji {
    font-size: 1.5rem;
}

.emotion-text {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Controls Section */
.controls-section {
    display: none;
    background: var(--background-card);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.controls-section.active {
    display: block;
}

.playback-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.control-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
    opacity: 0.8;
}

.control-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.play-btn {
    background: var(--gradient-1);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    opacity: 1;
}

.play-btn:hover {
    box-shadow: 0 0 20px rgba(108, 92, 231, 0.5);
}

/* Progress Bar */
.progress-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.time-display {
    font-size: 0.875rem;
    color: var(--text-secondary);
    min-width: 45px;
    text-align: center;
}

.progress-bar {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    cursor: pointer;
}

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

.progress-bar::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px var(--primary-color);
}

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

/* Volume Control */
.volume-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.volume-icon {
    font-size: 1.25rem;
    cursor: pointer;
}

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

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

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

/* Customization Section */
.customization-section {
    display: none;
    background: var(--background-card);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.customization-section.active {
    display: block;
}

.customization-section h3 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

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

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

.option-group select,
.option-group input[type="range"] {
    background: var(--background-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

.option-group select:hover,
.option-group select:focus {
    border-color: var(--primary-color);
    outline: none;
}

.option-group input[type="range"] {
    padding: 0.5rem 0;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: none;
}

.option-group input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
}

.option-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    margin-top: -6px;
    cursor: pointer;
}

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

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

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border-color);
    border-radius: 26px;
    transition: var(--transition);
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}

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

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

/* Emotion Legend */
.emotion-legend {
    display: none;
    background: var(--background-card);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.emotion-legend.active {
    display: block;
}

.emotion-legend h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.legend-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius);
}

.legend-color {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    flex-shrink: 0;
}

.legend-emoji {
    font-size: 1.25rem;
}

.legend-item span:last-child {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

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

.powered-by {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

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

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

.copyright {
    font-size: 0.875rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

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

    .logo-icon {
        font-size: 2rem;
    }

    .upload-container {
        padding: 2rem 1.5rem;
    }

    .upload-icon {
        font-size: 3rem;
    }

    #visualizerCanvas {
        height: 300px;
    }

    .emotion-indicator {
        top: 0.5rem;
        right: 0.5rem;
        padding: 0.5rem 1rem;
    }

    .emotion-emoji {
        font-size: 1.25rem;
    }

    .emotion-text {
        font-size: 0.75rem;
    }

    .playback-controls {
        gap: 0.75rem;
    }

    .play-btn {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .control-btn {
        font-size: 1.25rem;
    }

    .progress-container {
        flex-wrap: wrap;
    }

    .volume-control {
        margin-top: 0.5rem;
    }

    .options-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .legend-items {
        grid-template-columns: 1fr;
    }
}

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

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

    .upload-container h2 {
        font-size: 1.25rem;
    }

    #visualizerCanvas {
        height: 250px;
    }

    .controls-section,
    .customization-section,
    .emotion-legend {
        padding: 1rem;
    }

    .playback-controls {
        gap: 0.5rem;
    }

    .play-btn {
        width: 45px;
        height: 45px;
        font-size: 1.25rem;
    }

    .time-display {
        font-size: 0.75rem;
        min-width: 35px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.visualizer-section.active,
.controls-section.active,
.customization-section.active,
.emotion-legend.active {
    animation: fadeIn 0.5s ease-out;
}

/* Glow Effect */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px var(--primary-color), 0 0 10px var(--primary-color);
    }
    50% {
        box-shadow: 0 0 20px var(--primary-color), 0 0 30px var(--primary-color);
    }
}

.visualizer-section.active {
    animation: fadeIn 0.5s ease-out, glow 3s ease-in-out infinite;
}

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

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

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

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

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

/* Selection */
::selection {
    background: var(--primary-color);
    color: white;
}
