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

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #e0e7ff;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-full: 9999px;
}

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: var(--text-primary);
    line-height: 1.6;
}

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

header {
    text-align: center;
    margin-bottom: 2rem;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header .subtitle {
    font-size: 1.125rem;
    opacity: 0.9;
}

main {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    flex: 1;
}

.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

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

.language-selector label {
    font-weight: 500;
    color: var(--text-secondary);
}

.language-selector select {
    padding: 0.625rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-width: 180px;
}

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

.language-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.mic-button-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.mic-button {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.mic-button:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.mic-button:active {
    transform: scale(0.98);
}

.mic-button.recording {
    background: var(--danger-color);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(239, 68, 68, 0);
    }
}

.mic-icon {
    width: 36px;
    height: 36px;
}

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

.status-text.recording {
    color: var(--danger-color);
}

.transcription-area {
    margin-top: 1.5rem;
}

.transcription-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.transcription-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.transcription-actions {
    display: flex;
    gap: 0.5rem;
}

.action-button {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.action-button:hover {
    background: var(--bg-secondary);
    border-color: var(--text-light);
    color: var(--text-primary);
}

.action-button:active {
    transform: scale(0.98);
}

.action-button svg {
    width: 16px;
    height: 16px;
}

.action-button.copied {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.transcription-output {
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    padding: 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    line-height: 1.75;
}

.transcription-output .placeholder {
    color: var(--text-light);
    font-style: italic;
}

.transcription-output .final-text {
    color: var(--text-primary);
}

.interim-text {
    padding: 0.75rem 1.25rem;
    color: var(--text-light);
    font-style: italic;
    min-height: 2rem;
}

.error-message {
    margin-top: 1rem;
    padding: 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-md);
    color: var(--danger-color);
}

.browser-support {
    margin-top: 1rem;
    padding: 1rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius-md);
    color: var(--warning-color);
    text-align: center;
}

footer {
    text-align: center;
    padding: 1.5rem 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
}

footer a {
    color: white;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}

footer a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: white;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.875rem;
    }

    header .subtitle {
        font-size: 1rem;
    }

    main {
        padding: 1.5rem 1rem;
    }

    .mic-button {
        width: 70px;
        height: 70px;
    }

    .mic-icon {
        width: 30px;
        height: 30px;
    }

    .transcription-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .transcription-actions {
        width: 100%;
    }

    .action-button {
        flex: 1;
        justify-content: center;
    }

    .transcription-output {
        min-height: 150px;
        font-size: 0.9375rem;
    }

    .language-selector {
        flex-direction: column;
        width: 100%;
    }

    .language-selector select {
        width: 100%;
    }
}

/* Scrollbar styling */
.transcription-output::-webkit-scrollbar {
    width: 8px;
}

.transcription-output::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

.transcription-output::-webkit-scrollbar-thumb {
    background: var(--text-light);
    border-radius: var(--radius-sm);
}

.transcription-output::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Focus visible styles for accessibility */
button:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    body {
        background: white;
    }

    .container {
        max-width: none;
    }

    .controls,
    .transcription-actions,
    footer {
        display: none;
    }

    main {
        box-shadow: none;
    }
}
