/* style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem 0;
}

.header-content h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, #f0f0f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.header-content p {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 1rem;
}

.anycoder-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.anycoder-badge:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.main-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    flex: 1;
}

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

.input-section {
    position: relative;
}

#textInput {
    width: 100%;
    min-height: 120px;
    padding: 1.25rem;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    font-size: 1.1rem;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s ease;
    background: #fafafa;
}

#textInput:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: white;
}

.input-info {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

#charCount {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.voice-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.voice-label {
    font-weight: 600;
    color: #374151;
    font-size: 0.95rem;
}

#voiceSelect {
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

#voiceSelect:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.device-section {
    display: flex;
    justify-content: center;
}

.device-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-weight: 500;
    color: #374151;
    font-size: 0.95rem;
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 28px;
    background: #e5e7eb;
    border-radius: 14px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.toggle-switch:hover {
    background: #d1d5db;
}

#deviceToggle:checked + .toggle-switch {
    background: #10b981;
}

.toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#deviceToggle:checked + .toggle-switch .toggle-knob {
    transform: translateX(20px);
}

.generate-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1.25rem 2rem;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 56px;
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px -10px rgba(102, 126, 234, 0.4);
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.status {
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-weight: 500;
    text-align: center;
    margin: 1rem 0;
    transition: all 0.3s ease;
}

.status.hidden {
    display: none;
}

.status.loading {
    background: #fef3c7;
    color: #d97706;
    border: 1px solid #f59e0b;
}

.status.success {
    background: #d1fae5;
    color: #059669;
    border: 1px solid #10b981;
}

.status.error {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #ef4444;
}

.status.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #3b82f6;
}

.audio-section {
    margin-top: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 20px;
    border: 2px solid #e2e8f0;
}

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

.play-btn, .download-btn, .regenerate-btn {
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.25rem;
    color: #374151;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.play-btn:hover, .download-btn:hover:not(:disabled), .regenerate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    color: #1f2937;
}

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

.regenerate-btn {
    width: auto;
    padding: 0 1.5rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    background: #f8fafc;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .main-content {
        padding: 2rem 1.5rem;
        margin: 1rem;
    }
    
    .header-content h1 {
        font-size: 2.5rem;
    }
    
    .voice-section {
        align-items: center;
    }
    
    .audio-controls {
        flex-wrap: wrap;
    }
    
    .play-btn, .download-btn, .regenerate-btn {
        width: 48px;
        height: 48px;
        font-size: 1rem;
    }
    
    .regenerate-btn {
        width: 100%;
        padding: 1rem;
        margin-top: 1rem;
    }
}

@media (max-width: 480px) {
    .input-section {
        margin-bottom: 1rem;
    }
    
    #textInput {
        min-height: 100px;
        padding: 1rem;
    }
    
    .device-section {
        margin: 1rem 0;
    }
    
    .voice-section {
        margin: 1rem 0;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1e1b4b 0%, #2a1d5e 100%);
    }
    
    .main-content {
        background: rgba(30, 27, 75, 0.95);
        color: #f1f5f9;
    }
    
    #textInput {
        background: #2a273f;
        border-color: #4b46ea;
        color: #f1f5f9;
    }
    
    #textInput:focus {
        background: #312e5b;
        border-color: #667eea;
    }
    
    #voiceSelect {
        background: #2a273f;
        border-color: #4b46ea;
        color: #f1f5f9;
    }
    
    .input-info #charCount {
        color: #94a3b8;
    }
    
    .voice-label {
        color: #f1f5f9;
    }
}