/* Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary-color: #4F46E5;
    --primary-hover: #4338CA;
    --secondary-color: #6B7280;
    --success-color: #10B981;
    --error-color: #EF4444;
    --warning-color: #F59E0B;
    --background: #F9FAFB;
    --surface: #FFFFFF;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
.app-header {
    margin-bottom: 2rem;
}

.app-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.app-header p {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

/* Upload Section */
.upload-section {
    background: var(--surface);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 0.75rem;
    padding: 3rem;
    text-align: center;
    background: var(--background);
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 2rem;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary-color);
    background: #EEF2FF;
}

.upload-zone.has-file {
    border-color: var(--success-color);
    background: #D1FAE5;
}

.upload-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    color: var(--secondary-color);
}

.upload-zone h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.upload-zone p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.supported-formats {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.file-info {
    display: none;
    margin-top: 1rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.file-info.active {
    display: block;
}

.file-info h4 {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.file-info p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Language Selector */
.language-selector {
    margin-bottom: 2rem;
}

.language-selector label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.language-selector select {
    width: 100%;
    max-width: 400px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.language-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-primary:disabled[title]:hover {
    opacity: 0.8;
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--background);
    border-color: var(--primary-color);
}

.btn-large {
    width: 100%;
    max-width: 400px;
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* Status Tracker */
.status-section {
    background: var(--surface);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.status-section h3 {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
    font-weight: 600;
}

.status-tracker {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    position: relative;
}

.status-tracker::before {
    content: '';
    position: absolute;
    top: 24px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border-color);
    z-index: 0;
}

.status-step {
    position: relative;
    z-index: 1;
    flex: 1;
    text-align: center;
}

.step-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--border-color);
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: var(--secondary-color);
}

.status-step.active .step-icon {
    border-color: var(--primary-color);
    background: #EEF2FF;
    color: var(--primary-color);
}

.status-step.completed .step-icon {
    border-color: var(--success-color);
    background: #D1FAE5;
    color: var(--success-color);
}

.status-step h4 {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
    font-weight: 500;
}

.status-step p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

#compression-percentage {
    font-weight: 600;
    color: var(--primary-color);
    margin-left: 0.5rem;
}

/* Progress Bar */
.progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
    width: 0%;
}

/* Results Section */
.results-section {
    background: var(--surface);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-header h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    font-weight: 600;
}

.results-actions {
    display: flex;
    gap: 0.75rem;
}

.transcription-text {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    font-size: 0.9375rem;
    line-height: 1.8;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.transcription-text::-webkit-scrollbar {
    width: 8px;
}

.transcription-text::-webkit-scrollbar-track {
    background: var(--background);
    border-radius: 4px;
}

.transcription-text::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.transcription-text::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

.results-footer {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Error Section */
.error-section {
    background: #FEF2F2;
    border: 1px solid #FCA5A5;
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
}

.error-message {
    color: var(--error-color);
    margin-bottom: 1.5rem;
}

.error-message svg {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
}

.error-message h3 {
    margin: 1rem 0 0.5rem;
    font-size: 1.25rem;
}

.error-message p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Status Messages */
.status-message {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    display: none;
}

.status-message.active {
    display: block;
}

.status-message.success {
    background: #D1FAE5;
    color: #065F46;
}

.status-message.error {
    background: #FEF2F2;
    color: #991B1B;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        padding: 1.5rem;
    }
    
    .status-tracker {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .status-tracker::before {
        display: none;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .results-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .results-actions .btn {
        width: 100%;
    }
    
    .upload-zone {
        padding: 2rem;
    }
    
    .upload-icon {
        width: 60px;
        height: 60px;
    }
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-step.active .step-icon {
    animation: pulse 2s ease-in-out infinite;
}

/* Loading Spinner */
.spinner {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.tab-button {
    padding: 1rem 2rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: -2px;
}

.tab-button:hover {
    color: var(--primary-color);
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Compression Section Styles */
.compression-upload-section,
.compression-progress-section,
.compression-result-section,
.compression-error-section {
    background: var(--surface);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

/* File Info Items */
.file-info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.file-info-item:last-child {
    border-bottom: none;
}

.file-info-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.file-info-value {
    color: var(--text-primary);
    font-weight: 600;
}

/* Waveform Visualizer */
.waveform-container {
    background: #1a1a2e;
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 1.5rem 0;
}

.waveform-title {
    color: #fff;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.waveform-container canvas {
    width: 100%;
    height: 120px;
    background: #0f0f1a;
    border-radius: 0.25rem;
}

/* Compression Settings Info */
.compression-settings-info {
    background: var(--background);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.compression-settings-info h4 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.setting-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.setting-value {
    font-size: 1rem;
    color: var(--primary-color);
    font-weight: 600;
}

/* Compression Progress */
.compression-progress-section h3 {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
    font-weight: 600;
}

.progress-item {
    margin-bottom: 1.5rem;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
}

.status-text {
    text-align: center;
    color: var(--text-secondary);
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

/* Compression Results */
.compression-result-section h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

.compression-stats {
    background: var(--background);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-item span:first-child {
    color: var(--text-secondary);
}

.stat-item span:last-child {
    font-weight: 600;
    color: var(--text-primary);
}

.audio-player {
    width: 100%;
    margin-bottom: 1.5rem;
    border-radius: 0.5rem;
}

.result-actions {
    display: flex;
    gap: 1rem;
}

.result-actions .btn {
    flex: 1;
}

/* Compression Error */
.compression-error-section {
    text-align: center;
}

.compression-error-section .error-message {
    color: var(--error-color);
    margin-bottom: 1.5rem;
}

.compression-error-section .error-message svg {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
}

.compression-error-section .error-message h3 {
    margin: 1rem 0 0.5rem;
    font-size: 1.25rem;
}

.compression-error-section .error-message p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Focus styles for accessibility */
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .upload-section,
    .status-section,
    .error-section {
        display: none;
    }
    
    .main-content {
        padding: 0;
    }
    
    .results-section {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
}

/* Summary Section */
.summary-section {
    margin-top: 30px;
    padding: 20px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
}

.summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e7eb;
}

.summary-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-header h3 svg {
    color: #6366f1;
}

.summary-actions {
    display: flex;
    gap: 10px;
}

.summary-text {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    max-height: 400px;
    overflow-y: auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #374151;
    width: 100%;
    min-height: 200px;
}

/* Markdown element styling */
.summary-text h1,
.summary-text h2,
.summary-text h3,
.summary-text h4,
.summary-text h5,
.summary-text h6 {
    margin-top: 1.5em;
    margin-bottom: 0.75em;
    color: #1f2937;
    font-weight: 600;
    line-height: 1.3;
}

.summary-text h1 {
    font-size: 1.875rem;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.5rem;
}

.summary-text h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.3rem;
}

.summary-text h3 {
    font-size: 1.25rem;
}

.summary-text h4 {
    font-size: 1.125rem;
}

.summary-text h5 {
    font-size: 1rem;
}

.summary-text h6 {
    font-size: 0.875rem;
    color: #6b7280;
}

.summary-text p {
    margin-bottom: 1em;
}

.summary-text ul,
.summary-text ol {
    margin-left: 1.5em;
    margin-bottom: 1em;
    padding-left: 0.5em;
}

.summary-text ul {
    list-style-type: disc;
}

.summary-text ol {
    list-style-type: decimal;
}

.summary-text li {
    margin-bottom: 0.5em;
}

.summary-text li::marker {
    color: #6b7280;
}

.summary-text code {
    background-color: #f3f4f6;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875em;
    color: #dc2626;
}

.summary-text pre {
    background-color: #1f2937;
    color: #f9fafb;
    padding: 1em;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1em 0;
    font-size: 0.875rem;
}

.summary-text pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
    font-size: inherit;
}

.summary-text blockquote {
    border-left: 4px solid #4f46e5;
    padding-left: 1em;
    margin: 1em 0;
    color: #6b7280;
    font-style: italic;
    background-color: #f9fafb;
    padding: 0.75em 1em;
    border-radius: 0 8px 8px 0;
}

.summary-text strong {
    font-weight: 600;
    color: #1f2937;
}

.summary-text em {
    font-style: italic;
    color: #4b5563;
}

.summary-text a {
    color: #4f46e5;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.summary-text a:hover {
    color: #4338ca;
    border-bottom-color: #4338ca;
}

.summary-text hr {
    border: none;
    border-top: 2px solid #e5e7eb;
    margin: 2em 0;
}

.summary-text table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    font-size: 0.9rem;
}

.summary-text th,
.summary-text td {
    border: 1px solid #e5e7eb;
    padding: 0.75em;
    text-align: left;
}

.summary-text th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #1f2937;
}

.summary-text tr:nth-child(even) {
    background-color: #f9fafb;
}

.summary-text tr:hover {
    background-color: #f3f4f6;
}

.summary-text img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1em 0;
}

.summary-text::-webkit-scrollbar {
    width: 8px;
}

.summary-text::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.summary-text::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.summary-text::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Responsive adjustments for summary section */
@media (max-width: 768px) {
    .summary-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .summary-actions {
        width: 100%;
    }
    
    .summary-actions .btn {
        flex: 1;
    }
}
