/* ========================================
   VOICE STUDIO - PROFESSIONAL RESPONSIVE DESIGN
   Looks neat in both horizontal and vertical
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
    /* Professional Color Palette */
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --primary-light: #4895ef;
    --secondary: #f72585;
    --accent: #4cc9f0;
    
    /* Voice Card Colors - Professional Gradients */
    --male-gradient: linear-gradient(135deg, #4361ee, #3a0ca3);
    --female-gradient: linear-gradient(135deg, #f72585, #b5179e);
    --cartoon-gradient: linear-gradient(135deg, #4cc9f0, #4895ef);
    
    /* Neutral Colors */
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #0f1a2b;
    --text-primary: #ffffff;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    /* Spacing - Balanced for both orientations */
    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1rem;
    --space-lg: 1.25rem;
    --space-xl: 1.5rem;
    --space-xxl: 2rem;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-md: 0 6px 10px rgba(0,0,0,0.15);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.2);
    
    /* Transitions */
    --transition: all 0.2s ease;
}

body {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--space-md);
    color: var(--text-primary);
}

/* Loading Screen */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s;
}

.loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(67, 97, 238, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: var(--space-sm);
}

.loading-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

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

/* ========================================
   MAIN CONTAINER - PERFECTLY BALANCED
   ======================================== */
.voice-lab {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    max-width: 900px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin: 0 auto;
}

/* Header - Clean and Professional */
.app-header {
    margin-bottom: var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, var(--primary-light));
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.version-badge {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Input Area - Clean */
.input-container {
    position: relative;
    margin-bottom: var(--space-lg);
}

textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    font-size: 0.95rem;
    color: var(--text-primary);
    resize: none;
    min-height: 100px;
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
}

textarea::placeholder {
    color: var(--text-muted);
}

.char-counter {
    position: absolute;
    bottom: var(--space-xs);
    right: var(--space-sm);
    font-size: 0.7rem;
    color: var(--text-muted);
    background: rgba(0,0,0,0.4);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
}

/* ========================================
   VOICE CARDS - PERFECTLY SPACED
   ======================================== */
.voice-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.voice-card {
    border-radius: var(--radius-lg);
    padding: var(--space-lg) var(--space-sm);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    box-shadow: var(--shadow-sm);
}

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

.voice-card.active {
    border-color: white;
    box-shadow: 0 0 0 2px white;
}

/* Card Gradients */
.voice-card.male {
    background: var(--male-gradient);
}

.voice-card.female {
    background: var(--female-gradient);
}

.voice-card.cartoon {
    background: var(--cartoon-gradient);
}

/* Icons - Perfect Size */
.voice-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto var(--space-sm);
}

.male-icon, .female-icon, .cartoon-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.male-icon::before {
    content: '🎧';
    font-size: 2rem;
}

.female-icon::before {
    content: '🎤';
    font-size: 2rem;
}

.cartoon-icon::before {
    content: '🎭';
    font-size: 2rem;
}

.voice-card h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: white;
}

.voice-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    color: white;
    display: inline-block;
}

/* ========================================
   PLAY AREA - BALANCED
   ======================================== */
.play-area {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.speak-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: var(--radius-lg);
    padding: var(--space-md) var(--space-lg);
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    flex: 2;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.speak-btn:active {
    transform: translateY(0);
}

.speak-btn .flash-icon {
    font-size: 1.2rem;
}

.pitch-indicator {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--space-md) var(--space-lg);
    flex: 1;
    text-align: center;
    font-size: 1rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.pitch-indicator::before {
    content: '🎚️';
    font-size: 1.1rem;
}

.pitch-indicator span {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    color: white;
}

/* ========================================
   STATUS AREA - CLEAN
   ======================================== */
.status-area {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: var(--space-sm) var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: pulse 2s infinite;
}

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

.status-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    flex: 1;
}

.shortcut-hint {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

kbd {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 0.15rem 0.4rem;
    font-family: monospace;
    font-size: 0.75rem;
    color: white;
}

/* ========================================
   FOOTER - PROFESSIONAL
   ======================================== */
.app-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    padding-top: var(--space-md);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.footer-left {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.footer-badge {
    background: rgba(67, 97, 238, 0.2);
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    color: var(--primary-light);
    font-weight: 500;
    font-size: 0.7rem;
}

.footer-right {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.footer-right span {
    color: var(--text-muted);
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

/* Sound Wave Animation */
.sound-wave {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: 0.25rem;
}

.sound-wave span {
    width: 3px;
    height: 12px;
    background: white;
    border-radius: 1px;
    animation: soundWave 0.8s ease infinite;
}

.sound-wave span:nth-child(2) {
    animation-delay: 0.2s;
    height: 16px;
}

.sound-wave span:nth-child(3) {
    animation-delay: 0.4s;
    height: 10px;
}

@keyframes soundWave {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.5); }
}

/* Flash Animation */
.flash-animation {
    animation: flash 0.3s ease;
}

@keyframes flash {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.3); }
}

/* Shake Animation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

.shake {
    animation: shake 0.3s ease;
}

/* ========================================
   RESPONSIVE DESIGN - PERFECT FOR ALL ORIENTATIONS
   ======================================== */

/* Tablet & Small Desktop */
@media screen and (max-width: 768px) {
    .voice-lab {
        padding: var(--space-lg);
        max-width: 95%;
    }
    
    .voice-row {
        gap: var(--space-sm);
    }
    
    .voice-card {
        padding: var(--space-md) var(--space-xs);
    }
    
    .voice-icon {
        width: 50px;
        height: 50px;
    }
    
    .male-icon::before,
    .female-icon::before,
    .cartoon-icon::before {
        font-size: 1.8rem;
    }
    
    .play-area {
        flex-direction: row;
    }
}

/* Mobile Landscape & Small Devices */
@media screen and (max-width: 640px) {
    body {
        padding: var(--space-xs);
    }
    
    .voice-lab {
        padding: var(--space-md);
        border-radius: var(--radius-lg);
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .voice-row {
        grid-template-columns: 1fr;
        gap: var(--space-xs);
    }
    
    .voice-card {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: var(--space-sm) var(--space-md);
        text-align: left;
    }
    
    .voice-icon {
        width: 40px;
        height: 40px;
        margin: 0;
    }
    
    .male-icon::before,
    .female-icon::before,
    .cartoon-icon::before {
        font-size: 1.5rem;
    }
    
    .voice-card h3 {
        font-size: 1rem;
        margin: 0;
        flex: 1;
        margin-left: var(--space-sm);
    }
    
    .voice-badge {
        margin-left: auto;
    }
    
    .play-area {
        flex-direction: column;
    }
    
    .speak-btn {
        width: 100%;
    }
    
    .pitch-indicator {
        width: 100%;
    }
    
    .status-area {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .shortcut-hint {
        align-self: flex-end;
    }
    
    .app-footer {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-left,
    .footer-right {
        justify-content: center;
    }
}

/* Very Small Mobile */
@media screen and (max-width: 380px) {
    .voice-card {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }
    
    .voice-card h3 {
        width: 100%;
        margin: var(--space-xs) 0;
    }
    
    .voice-badge {
        width: 100%;
    }
}

/* Large Desktop Screens */
@media screen and (min-width: 1200px) {
    .voice-lab {
        max-width: 1000px;
        padding: var(--space-xxl);
    }
    
    .voice-card {
        padding: var(--space-xl) var(--space-md);
    }
    
    .voice-icon {
        width: 70px;
        height: 70px;
    }
    
    .male-icon::before,
    .female-icon::before,
    .cartoon-icon::before {
        font-size: 2.2rem;
    }
}

/* 4K Screens */
@media screen and (min-width: 2000px) {
    .voice-lab {
        max-width: 1200px;
    }
}
