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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Common Section Styling */
section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

/* Upload Section */
.upload-section {
    text-align: center;
}

.upload-area {
    border: 3px dashed #667eea;
    border-radius: 12px;
    padding: 50px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(102, 126, 234, 0.05);
}

.upload-area:hover {
    border-color: #5a67d8;
    background: rgba(102, 126, 234, 0.1);
}

.upload-area.dragover {
    border-color: #4c51bf;
    background: rgba(102, 126, 234, 0.15);
}

.upload-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 15px;
}

.upload-content p {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #4a5568;
}

.upload-link {
    color: #667eea;
    text-decoration: underline;
    cursor: pointer;
}

.upload-link:hover {
    color: #5a67d8;
}

/* Audio Section */
.audio-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.audio-info h3 {
    color: #2d3748;
    font-size: 1.3rem;
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.time-display {
    color: #666;
    font-family: monospace;
    font-size: 1rem;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
    transform: translateY(-2px);
}

.btn-record {
    background: #48bb78;
    color: white;
    font-size: 1.1rem;
    padding: 15px 25px;
}

.btn-record:hover {
    background: #38a169;
    transform: translateY(-2px);
}

.btn-danger {
    background: #f56565;
    color: white;
}

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

.btn-small {
    padding: 8px 15px;
    font-size: 0.85rem;
}

/* Waveform Container */
.waveform-container {
    margin-top: 20px;
}

#waveformCanvas {
    width: 100%;
    height: 150px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #f7fafc;
    cursor: crosshair;
}

.selection-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.selection-info {
    color: #666;
    font-style: italic;
    margin-left: auto;
}

/* Recording Section */
.recording-controls {
    text-align: center;
    margin-bottom: 20px;
}

.recording-controls .btn {
    margin: 0 10px;
}

.recording-status {
    text-align: center;
    padding: 20px;
    background: rgba(245, 101, 101, 0.1);
    border-radius: 8px;
    border: 2px solid #f56565;
}

.recording-indicator {
    font-size: 1.2rem;
    font-weight: bold;
    color: #e53e3e;
    margin-bottom: 10px;
    animation: pulse 1.5s infinite;
}

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

.recording-timer {
    font-family: monospace;
    font-size: 1.5rem;
    color: #e53e3e;
}

/* Comparison Section */
.comparison-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.pitch-display {
    text-align: center;
}

.pitch-display h4 {
    margin-bottom: 15px;
    color: #2d3748;
}

.pitch-display canvas {
    width: 100%;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #f7fafc;
}

.comparison-overlay {
    text-align: center;
    margin-bottom: 20px;
}

.comparison-overlay h4 {
    margin-bottom: 15px;
    color: #2d3748;
}

#overlayCanvas {
    width: 100%;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #f7fafc;
}

.comparison-actions {
    text-align: center;
}

.comparison-actions .btn {
    margin: 0 10px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .audio-info {
        flex-direction: column;
        align-items: stretch;
    }
    
    .audio-controls {
        justify-content: center;
    }
    
    .comparison-container {
        grid-template-columns: 1fr;
    }
    
    .selection-controls {
        justify-content: center;
    }
    
    .selection-info {
        margin-left: 0;
        margin-top: 10px;
        text-align: center;
        width: 100%;
    }
}

@media (max-width: 480px) {
    section {
        padding: 20px;
    }
    
    .btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    
    .upload-area {
        padding: 30px 15px;
    }
    
    .upload-icon {
        font-size: 2rem;
    }
}

/* Loading and Animation States */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #667eea;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Success and Error States */
.success-message {
    background: rgba(72, 187, 120, 0.1);
    border: 2px solid #48bb78;
    color: #2f855a;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    text-align: center;
}

.error-message {
    background: rgba(245, 101, 101, 0.1);
    border: 2px solid #f56565;
    color: #c53030;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    text-align: center;
}