:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #64748b;
    --accent-color: #10b981;
    --accent-hover: #059669;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-color: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --recording-bg: #fef2f2;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.subtitle {
    font-size: 1.1rem;
    color: #64748b;
}

.upload-container {
    background: white;
    border: 2px dashed var(--border-color);
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.upload-container.drag-over {
    border-color: var(--primary-color);
    background: #f0f9ff;
}

.upload-content {
    max-width: 300px;
    margin: 0 auto;
}

#uploadIcon, #summaryUploadIcon {
    width: 48px;
    height: 48px;
    margin-bottom: 0.75rem;
    opacity: 0.7;
}

.upload-button {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin: 1rem 0;
}

.upload-button:hover {
    background-color: var(--primary-hover);
}

.file-types {
    color: #64748b;
    font-size: 0.9rem;
}

.file-info {
    text-align: center;
    margin: 1rem auto;
    max-width: 400px;
    padding: 1rem;
    background-color: var(--surface-color);
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.process-button {
    display: block;
    width: 200px;
    margin: 1rem auto;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background-color: var(--primary-color);
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
    position: sticky;
    bottom: 1rem;
    z-index: 10;
}

.process-button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.3);
}

.process-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

.loading-container {
    text-align: center;
    margin: 2rem 0;
}

.loading-spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.result-container {
    margin-top: 2rem;
}

.result-section {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.result-section h2 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.content-box {
    background: var(--background-color);
    border-radius: 0.5rem;
    padding: 1rem;
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
}

.new-file-button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 1rem;
    margin-top: 1rem;
    width: 100%;
}

.new-file-button:hover {
    background-color: var(--text-color);
}

footer {
    text-align: center;
    margin-top: 3rem;
    color: #64748b;
}

.hidden {
    display: none;
}

/* Tabs */
.tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1rem;
}

.tab-button {
    background: none;
    border: none;
    padding: 0.8rem 1.5rem;
    font-size: 1.1rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-button:hover {
    background: #f1f5f9;
    color: var(--primary-color);
}

.tab-button.active {
    background: var(--surface-color);
    color: var(--primary-color);
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tab-icon {
    font-size: 1.2rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Method Selector */
.method-selector {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.method-button {
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.method-button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.method-button.active {
    background: var(--surface-color);
    color: var(--primary-color);
    border-color: var(--primary-color);
    font-weight: 500;
}

.method-content {
    display: none;
}

.method-content.active {
    display: block;
}

/* Recording Controls */
.record-container {
    background: var(--surface-color);
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    margin-bottom: 2rem;
}

.record-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.record-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.record-button:not(:disabled):hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.record-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#startRecord {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

#startRecord:hover {
    background: var(--danger-hover);
    border-color: var(--danger-hover);
}

#startRecord.recording {
    animation: pulse 2s infinite;
}

.record-preview {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    overflow: visible;
}

.audio-player {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.audio-player audio {
    flex: 1;
}

.preview-title {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.record-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--recording-bg);
    border-radius: 1rem;
    color: var(--danger-color);
    font-weight: 500;
}

.record-dot {
    width: 12px;
    height: 12px;
    background: #dc2626;
    border-radius: 50%;
    animation: pulse 1s infinite;
}

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

.record-time {
    font-family: monospace;
    font-size: 1.1rem;
}

/* Copy Buttons */
.copy-button {
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.copy-button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.support-button {
    position: relative;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.donate-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-color);
    padding: 0.75rem;
    border-radius: 0.75rem;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    min-width: 120px;
}

.donate-logo {
    width: 80px;
    height: auto;
    border-radius: 0.5rem;
}

.donate-button:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.preview-process-button {
    white-space: nowrap;
    min-width: 120px;
}

@media (max-width: 1400px) {
    .support-button {
        position: static;
        margin-bottom: 1.5rem;
        text-align: center;
        background: none;
        padding: 0;
        box-shadow: none;
    }

    .donate-button {
        display: inline-flex;
        flex-direction: row;
        padding: 0.75rem 1.5rem;
    }

    .donate-logo {
        width: 32px;
    }
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    max-width: 100%;
    overflow: visible;
}

.audio-controls audio {
    width: 100%;
    min-width: 0;
}

.audio-controls .preview-process-button {
    flex-shrink: 0;
    white-space: nowrap;
    margin-left: 0.5rem;
}

@media (max-width: 768px) {
    .audio-controls {
        flex-direction: column;
        gap: 1rem;
    }

    .audio-controls audio {
        width: 100%;
    }

    .audio-controls .preview-process-button {
        width: 100%;
        margin-left: 0;
    }

    .record-preview {
        padding: 1rem 0;
    }
}

/* Ensure audio player has consistent height */
audio {
    height: 40px;
}

.summary-button {
    display: block;
    width: 200px;
    margin: 1rem auto;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background-color: var(--accent-color);
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.summary-button:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.3);
}

.summary-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.button-group {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.summary-section {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, max-height 0.3s ease;
}

.summary-section.visible {
    opacity: 1;
    max-height: 1000px; /* Adjust based on expected content height */
}

.summary-error {
    color: var(--danger-color);
    text-align: center;
    padding: 1rem;
    background: #fef2f2;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

/* Language Selector */
.language-selector {
    margin-top: 1rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.select-wrapper {
    position: relative;
    display: inline-block;
}

.language-select {
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.95rem;
    background-color: var(--surface-color);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 1em;
    min-width: 190px;
    max-width: 230px;
}

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

.language-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.language-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
}

.language-flag {
    font-size: 1.2em;
    margin-right: 0.5rem;
}

/* Ensure proper spacing for options in different browsers */
.language-select option {
    padding: 0.5rem;
    font-size: 1rem;
}

/* Top Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 2rem;
    position: relative;
    z-index: 1000;
}

/* UI Language Selector */
.ui-language-selector {
    margin-left: auto;
}

.ui-language-selector .language-select {
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.9rem;
    background-color: var(--surface-color);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 1em;
    min-width: 160px;
}

@media (min-width: 1400px) {
    .container {
        position: relative;
    }
    
    .top-bar {
        position: absolute;
        top: 2rem;
        right: 2rem;
        width: auto;
        margin-bottom: 0;
    }

    .ui-language-selector {
        position: relative;
        right: 0;
    }
}

@media (max-width: 1400px) {
    .support-button {
        position: static;
        margin-bottom: 1.5rem;
        text-align: center;
        background: none;
        padding: 0;
        box-shadow: none;
    }

    .donate-button {
        display: inline-flex;
        flex-direction: row;
        padding: 0.75rem 1.5rem;
    }

    .donate-logo {
        width: 32px;
    }
}

@media (max-width: 768px) {
    .top-bar {
        padding: 0.75rem;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 1.5rem;
    }

    .donate-button {
        flex-direction: column;
        padding: 0.75rem;
        align-items: center;
        justify-content: center;
    }

    .donate-logo {
        width: 60px;
    }

    .language-flags {
        gap: 1rem;
    }

    .flag-button .flag {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .top-bar {
        padding: 0.75rem;
        gap: 1rem;
    }

    .donate-button {
        padding: 0.5rem;
    }

    .donate-logo {
        width: 50px;
    }

    .donate-button span {
        font-size: 0.9rem;
    }

    .language-flags {
        gap: 0.75rem;
    }

    .flag-button .flag {
        font-size: 1.4rem;
    }
}

/* Transcription Language Selector */
.transcription-language-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin: 1rem auto 2rem;
    max-width: 400px;
}

.transcription-language-selector label {
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
}

.language-select {
    padding: 0.5rem 2rem 0.5rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.95rem;
    background-color: var(--surface-color);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1em;
    min-width: 180px;
    max-width: 220px;
}

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

.language-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.language-option {
    padding: 0.5rem;
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    .transcription-language-selector {
        flex-direction: column;
        gap: 0.5rem;
        margin: 1rem auto 1.5rem;
    }

    .language-select {
        width: 100%;
        max-width: none;
    }
}

/* UI Language Selector with Flags */
.language-flags {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.flag-button {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.5;
    filter: grayscale(40%);
}

.flag-button:hover {
    transform: translateY(-2px);
    opacity: 0.8;
    filter: grayscale(20%);
}

.flag-button.active {
    opacity: 1;
    transform: scale(1.1);
    filter: grayscale(0%);
}

.flag-button .flag {
    font-size: 1.75rem;
    line-height: 1;
} 