:root {
    /* Light Theme */
    --bg-color: #f4f4f4;
    --text-color: #212529;
    --primary-color: #007bff;
    --danger-color: #dc3545;
    --secondary-text-color: #6c757d;
    --card-bg-color: #ffffff;
    --shadow-color: rgba(0,0,0,0.05);
    --button-secondary-bg: #6c757d;
}

[data-theme="dark"] {
    /* Dark Theme */
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --primary-color: #0d6efd;
    --danger-color: #d9534f;
    --secondary-text-color: #adb5bd;
    --card-bg-color: #1e1e1e;
    --shadow-color: rgba(255,255,255,0.05);
    --button-secondary-bg: #5c636a;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 700px;
    margin: 2rem auto;
    padding: 1rem;
    text-align: center;
    position: relative;
}

.header-menu {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.icon-btn {
    background: transparent;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--secondary-text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.icon-btn:hover {
    background-color: rgba(0,0,0,0.05);
}

.glass {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .glass {
    background: rgba(30, 30, 30, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.menu {
    display: none;
    position: absolute;
    right: 0;
    top: 3rem;
    min-width: 180px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    padding: 0.5rem;
    z-index: 100;
    overflow: hidden;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.menu.open {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.menu-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--secondary-text-color);
    padding: 0.5rem 1rem 0.25rem 1rem;
    letter-spacing: 0.5px;
}

.menu-separator {
    height: 1px;
    background: rgba(0,0,0,0.05);
    margin: 0.5rem 1rem;
}

[data-theme="dark"] .menu-separator {
    background: rgba(255,255,255,0.05);
}

.theme-option, .lang-option {
    background: transparent;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-color);
    text-align: left;
    font-size: 0.95rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-option:hover, .lang-option:hover {
    background-color: rgba(0,0,0,0.05);
    padding-left: 1.25rem;
}

.theme-option.active, .lang-option.active {
    color: var(--primary-color);
    font-weight: 600;
    background-color: rgba(0, 123, 255, 0.1);
}


h1 {
    margin-bottom: 0.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

p {
    margin-bottom: 2rem;
    font-size: 1rem;
    color: var(--secondary-text-color);
}

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

.main-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 72px;
    height: 72px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 16px rgba(0, 123, 255, 0.3);
}

.main-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 20px rgba(0, 123, 255, 0.4);
}

.main-btn.recording {
    background-color: var(--danger-color);
    box-shadow: 0 0 20px rgba(220, 53, 69, 0.5);
    animation: pulse 1.5s infinite;
}

.secondary-btn {
    background-color: var(--card-bg-color);
    color: var(--text-color);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 50%;
    width: 56px;
    height: 56px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px var(--shadow-color);
}

[data-theme="dark"] .secondary-btn {
    border: 1px solid rgba(255,255,255,0.1);
}

.secondary-btn:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.progress-container {
    max-width: 400px;
    margin: 0 auto 2rem auto;
    background: var(--card-bg-color);
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px var(--shadow-color);
}

#progressStatus {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.progress-bar {
    height: 8px;
    background: rgba(0,0,0,0.05);
    border-radius: 4px;
    overflow: hidden;
}

[data-theme="dark"] .progress-bar {
    background: rgba(255,255,255,0.05);
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.3s ease;
}


@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(220, 53, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

#clearAllBtn {
    background: var(--button-secondary-bg);
    color: white;
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s ease;
}


#clearAllBtn:hover {
    opacity: 0.9;
}

.footer-controls {
    margin-top: 1.5rem;
}

.transcription-section {
    background-color: var(--card-bg-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow-color);
    margin-top: 1.5rem;
    padding: 1rem;
}

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

.section-header h2 {
    margin: 0;
    color: var(--text-color);
}

#toggleTranscriptionSection {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--secondary-text-color);
    transition: transform 0.2s ease;
}

.section-content.minimized {
    display: none;
}

.actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.copy-btn {
    background: transparent;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
}

.copy-btn:hover {
    opacity: 0.8;
}


#status {
    min-height: 24px;
    font-style: italic;
    color: var(--secondary-text-color);
}

#transcriptionsList {
    list-style: none;
    text-align: left;
    margin-top: 1rem;
}

#transcriptionsList li {
    background: var(--card-bg-color);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 4px var(--shadow-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    transition: background-color 0.3s;
}

#transcriptionsList li .text {
    flex-grow: 1;
    word-break: break-word;
}

#transcriptionsList li .timestamp {
    font-size: 0.8rem;
    color: var(--secondary-text-color);
    margin-top: 0.5rem;
}

.delete-btn {
    background: transparent;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
}