/* ==================== CSS Reset & Base Styles ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

/* ==================== Container & Layout ==================== */
.container {
    max-width: 900px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #3b82f6 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

header p {
    opacity: 0.9;
    font-size: 1rem;
}

main {
    padding: 40px 30px;
}

footer {
    background: var(--bg-color);
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
}

/* ==================== Upload Section ==================== */
.upload-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 60px 30px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    background: var(--bg-color);
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.upload-icon {
    width: 64px;
    height: 64px;
    color: var(--primary-color);
    margin: 0 auto 20px;
}

.drop-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.or-text {
    color: var(--text-secondary);
    margin: 16px 0;
    font-size: 0.875rem;
}

.file-label {
    display: inline-block;
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.file-label:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.file-info {
    margin-top: 16px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Selected File Display */
.selected-file {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.file-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-name {
    font-weight: 600;
    color: var(--text-primary);
}

.file-size {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ==================== Buttons ==================== */
.btn-primary,
.btn-secondary,
.btn-remove {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-primary {
    width: 100%;
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
}

.btn-remove {
    background: transparent;
    color: var(--error-color);
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-remove:hover {
    background: #fee;
}

/* ==================== Language Selector ==================== */
.language-selector {
    margin-top: 20px;
}

.language-selector label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.label-icon {
    width: 20px;
    height: 20px;
    color: var(--primary-color);
}

.language-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    background: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%232563eb'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 40px;
}

.language-select:hover {
    border-color: var(--primary-color);
    background-color: var(--bg-color);
}

.language-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.language-hint {
    margin-top: 8px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Mobile responsive for language selector */
@media (max-width: 480px) {
    .language-selector label {
        font-size: 0.875rem;
    }
    
    .language-select {
        font-size: 0.9375rem;
    }
}

/* ==================== Progress Section ==================== */
.progress-section {
    text-align: center;
    padding: 60px 30px;
}

.progress-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.progress-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.progress-subtext {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ==================== Results Section ==================== */
.results-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.results-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.results-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.transcription-container {
    position: relative;
}

.transcription-output {
    width: 100%;
    min-height: 300px;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: 'Courier New', monospace;
    font-size: 0.9375rem;
    line-height: 1.8;
    resize: vertical;
    background: var(--bg-color);
    color: var(--text-primary);
}

.transcription-output:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.word-count {
    margin-top: 8px;
    text-align: right;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Summary Section */
.summary-container {
    margin-top: 24px;
    padding: 24px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: var(--radius);
}

.summary-container h3 {
    color: #15803d;
    margin-bottom: 12px;
    font-size: 1.125rem;
}

.summary-output {
    color: #166534;
    line-height: 1.8;
    white-space: pre-wrap;
}

/* ==================== Error Section ==================== */
.error-section {
    text-align: center;
    padding: 40px 30px;
}

.error-message {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    margin-bottom: 20px;
    text-align: left;
}

.error-icon {
    font-size: 2rem;
}

.error-message h3 {
    color: var(--error-color);
    margin-bottom: 4px;
}

.error-message p {
    color: #991b1b;
    font-size: 0.9375rem;
}

/* ==================== Responsive Design ==================== */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header {
        padding: 30px 20px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    main {
        padding: 30px 20px;
    }

    .drop-zone {
        padding: 40px 20px;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .results-actions {
        width: 100%;
    }

    .btn-secondary {
        flex: 1;
        min-width: 0;
    }

    .selected-file {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    .results-actions {
        flex-direction: column;
    }

    .btn-secondary {
        width: 100%;
    }
}