/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colors - Professional Design System */
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-secondary: #64748b;
    --color-success: #10b981;
    --color-danger: #ef4444;
    --color-warning: #f59e0b;
    
    /* Neutral Colors */
    --color-white: #ffffff;
    --color-gray-50: #f8fafc;
    --color-gray-100: #f1f5f9;
    --color-gray-200: #e2e8f0;
    --color-gray-300: #cbd5e1;
    --color-gray-400: #94a3b8;
    --color-gray-500: #64748b;
    --color-gray-600: #475569;
    --color-gray-700: #334155;
    --color-gray-800: #1e293b;
    --color-gray-900: #0f172a;

    /* Red Colors */
    --color-red-500: #ef4444;
    --color-red-600: #dc2626;

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-12: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    
    /* Shadows */
    --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);
}

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Prevent any scrolling on html/body */
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--color-gray-900);
    background-color: var(--color-white);
    height: 100dvh; /* Dynamic viewport height - better for mobile */
    position: relative; /* For absolute positioning of layers */
    overflow: hidden; /* Fixed background - no scroll */
}

/* Header - Fixed layer on top */
.header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: var(--color-white);
    border-bottom: 1px solid var(--color-gray-200);
    padding: 1rem 0;
    height: 80px; /* Fixed height for predictable layout */
    box-sizing: border-box;
    z-index: 10; /* Above main content */
}

.header-content {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--space-4);
    position: relative; /* For absolute positioning of center nav */
}

.header-left {
    display: flex;
    align-items: center;
    flex: 1;
}

.header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-4);
    z-index: 2; /* Above center nav */
}

/* Navigation Menu */
.main-navigation {
    display: flex;
    align-items: center;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: var(--space-5);
    align-items: center;
}

.nav-link {
    color: var(--color-gray-600);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--color-primary);
}

/* Header Top Row - Desktop layout */
.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Mode tabs in main header */
.header-left .mode-tabs {
    display: flex;
    gap: var(--space-2);
}

.header-left .mode-tab {
    padding: var(--space-2) var(--space-4);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    background: var(--color-white);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
}

.header-left .mode-tab:hover {
    background: var(--color-gray-50);
}

.header-left .mode-tab.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--color-gray-200);
}

.user-name {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-gray-700);
}

/* Main Content - Static background layer */
.main {
    position: absolute;
    top: 80px; /* Below header */
    bottom: 70px; /* Above footer */
    left: 0;
    right: 0;
    background: var(--color-white); /* Static background */
    overflow: hidden; /* No scroll on main container */
}



/* Sections */
.section {
    display: none;
}

.section.active {
    display: block;
}

/* Language Tabs */
.language-tabs {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}

.lang-tab {
    background: var(--color-white);
    border: 1px solid var(--color-gray-200);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-tab.active {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

.lang-tab:hover:not(.active) {
    border-color: var(--color-gray-300);
    color: var(--color-gray-800);
}

/* Voice Selection */
.voice-selection {
    margin-bottom: var(--space-6);
}

.voice-group {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    justify-content: flex-start;
}

.voice-group.hidden {
    display: none;
}

.voice-btn {
    background: var(--color-white);
    border: 1px solid var(--color-gray-200);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.voice-btn.active {
    background: var(--color-success);
    color: var(--color-white);
    border-color: var(--color-success);
}

.voice-btn:hover:not(.active) {
    border-color: var(--color-gray-300);
    color: var(--color-gray-800);
}

/* Voice Preview Overlay */
.voice-preview-overlay {
    position: absolute;
    top: 50%;
    left: 8px;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

/* Chỉ hiện overlay khi voice được chọn (active) */
.voice-btn.active .voice-preview-overlay {
    opacity: 1;
    pointer-events: all;
}

/* Add padding to active voice button text to make room for play button */
.voice-btn.active {
    padding-left: 40px;
    text-align: left;
}

.play-icon {
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(3px);
}

/* Triangle play icon using CSS */
.play-icon::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 6px solid var(--color-success);
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    margin-left: 1px; /* Offset to center visually */
    transition: all 0.2s ease;
}

/* Pause icon (two bars) */
.play-icon.pause::before {
    content: '';
    width: 2px;
    height: 8px;
    background: var(--color-success);
    border: none;
    margin-left: -2.5px; /* Center the first bar */
    box-shadow: 3px 0 0 var(--color-success); /* Second bar */
}

.play-icon:hover {
    transform: scale(1.15);
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.8);
}

.play-icon:hover::before {
    border-left-color: var(--color-success);
}

/* Playing state */
.voice-preview-overlay.playing .play-icon {
    background: rgba(255, 255, 255, 0.9);
}

/* Loading state */
.voice-preview-overlay.loading .play-icon {
    animation: spin 1s linear infinite;
}

.voice-preview-overlay.loading .play-icon::before {
    content: '⏳';
    border: none;
    width: auto;
    height: auto;
    background: none;
    box-shadow: none;
    font-size: 14px;
    margin-left: 0;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Main Workspace Container - Fill all space */




/* Main Content Row - Fill entire main area */
.main-content-row {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: 300px 1fr 450px;
    gap: 1rem;
    padding: 1rem;
    overflow: hidden; /* No scroll on grid container */
}

/* Footer Audio Player - Fixed layer at bottom */
.audio-player-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-white);
    border-top: 1px solid var(--color-gray-200);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    height: 70px; /* Fixed height for predictable layout */
    z-index: 10; /* Above main content */
}

.audio-player-container {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--space-4);
    max-width: 800px;
    margin: 0 auto;
}

.audio-player-footer audio {
    width: 100%;
    max-width: 600px;
    height: 40px;
}

/* Text Input Area - Content layer that adapts to content */
.text-input-area {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--color-white);
    overflow: hidden; /* Container doesn't scroll */
}

/* Workspace Container - ElevenLabs-style Layout */
.workspace-container {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

/* Scrollable Content Area - Contains workspaces and add button */
.workspace-content-area {
    flex: 1; /* Take available space above fixed controls */
    overflow-y: auto; /* Scroll when content exceeds available space */
    overflow-x: hidden;
    padding-right: var(--space-1); /* Space for scrollbar */
    margin-bottom: var(--space-1); /* Gap before fixed controls */
}

/* Workspace List - Container for workspace items */
.workspace-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-bottom: var(--space-2); /* Gap before add button */
}

/* Individual Workspace Item */
.workspace-item {
    background: var(--color-white);
    border: none;
    border-radius: 0;
    padding: 0;
    position: relative;
    transition: all 0.2s ease;
}

.workspace-item:hover {
    border-color: transparent;
    box-shadow: none;
}

/* Workspace Header */
.workspace-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-1);
    flex-wrap: wrap;
}

/* Workspace Text Input - Auto-expanding like ElevenLabs */
.workspace-text-input {
    width: 100%;
    min-height: 40px; /* Simple single line height */
    height: auto; /* Auto height based on content */
    padding: var(--space-2);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    line-height: 1.5;
    resize: none; /* No manual resize */
    transition: border-color 0.2s ease;
    background: var(--color-white);
    overflow: hidden; /* Hide overflow - JS will handle height */
    box-sizing: border-box;
}

.workspace-text-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

/* When content is too long, enable scroll */
.workspace-text-input.scrollable {
    overflow-y: auto;
    /* max-height set dynamically by JavaScript */
}

/* Voice Selector Button */
.voice-selector-btn {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-gray-700);
    cursor: pointer;
    transition: all 0.2s ease;
}

.voice-selector-btn:hover {
    background: var(--color-gray-100);
    border-color: var(--color-primary);
}

.voice-selector-btn .dropdown-arrow {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.voice-selector-btn.active .dropdown-arrow {
    transform: rotate(180deg);
}

/* Language & Voice Selector Wrappers */
.language-selector-wrapper,
.voice-selector-wrapper {
    position: relative;
    display: inline-block;
}

/* Language Selector Button */
.language-selector-btn {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    color: var(--color-gray-700);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
}

.language-selector-btn:hover {
    background: var(--color-gray-100);
    border-color: var(--color-primary);
}

.language-selector-btn .dropdown-arrow {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.language-selector-btn.active .dropdown-arrow {
    transform: rotate(180deg);
}

.language-flag {
    font-size: 14px;
}

/* Voice Selector Button - Updated */
.voice-selector-btn {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    background: var(--color-gray-50);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    color: var(--color-gray-700);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
}

.voice-icon {
    font-size: 14px;
}

/* Dropdown Containers */
.language-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--color-white);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 2px;
    min-width: 200px; /* Make dropdown wider */
    width: max-content; /* Adjust to content width */
}
.voice-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--color-white);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 2px;
    min-width: 250px; /* Make dropdown wider for comfortable layout */
    width: max-content; /* Adjust to content width */
}

.language-dropdown.hidden,
.voice-dropdown.hidden {
    display: none;
}

/* Dropdown Items */
.dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2);
    min-height: 40px; /* Ensure consistent height */
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid var(--color-gray-100);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: var(--color-gray-50);
}

/* Removed active state styling - selection shown in button text */

/* Voice Preview Button - Google style */
.voice-preview-btn {
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0; /* Prevent shrinking */
}

.voice-preview-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.3);
}

/* Play icon - black triangle */
.voice-preview-btn::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 8px solid #333;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    margin-left: 2px;
}

/* Pause icon - two black bars centered */
.voice-preview-btn.playing::before {
    display: none;
}

.voice-preview-btn.playing::after {
    content: '';
    width: 2px;
    height: 8px;
    background: #333;
    border-radius: 1px;
    box-shadow: 4px 0 0 #333;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    margin-left: -1px; /* Fine-tune centering for the two bars */
}

/* Voice name styling */
.voice-name {
    flex: 1;
    text-align: left;
    padding-right: var(--space-2);
}

/* History Item Buttons - Google style */
.btn-icon {
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-size: 0; /* Hide emoji text */
    text-indent: -9999px; /* Hide emoji text */
    margin-left: 4px;
}

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

/* Play button - triangle */
.play-btn::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 8px solid #333;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    margin-left: 2px;
}

/* Pause button - two bars */
.play-btn.playing::before {
    display: none;
}

.play-btn.playing::after {
    content: '';
    width: 2px;
    height: 8px;
    background: #333;
    border-radius: 1px;
    box-shadow: 4px 0 0 #333;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    margin-left: -1px;
}

/* Download button - arrow down */
.download-btn::before {
    content: '';
    width: 2px;
    height: 8px;
    background: #333;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.download-btn::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 6px solid #333;
    position: absolute;
    left: 50%;
    top: 60%;
    transform: translate(-50%, -50%);
}

/* Delete button - trash can */
.delete-btn::before {
    content: '';
    width: 8px;
    height: 10px;
    border: 1px solid #333;
    border-top: none;
    border-radius: 0 0 2px 2px;
    position: absolute;
    left: 50%;
    top: 55%;
    transform: translate(-50%, -50%);
}

.delete-btn::after {
    content: '';
    width: 10px;
    height: 2px;
    background: #333;
    border-radius: 1px;
    position: absolute;
    left: 50%;
    top: 35%;
    transform: translate(-50%, -50%);
    box-shadow: 0 -2px 0 #333;
}

/* Voice selection in column 1 restored */

/* Remove Workspace Button - Updated positioning */
.remove-workspace-btn {
    background: var(--color-red-500);
    color: var(--color-white);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: auto;
}

.remove-workspace-btn:hover {
    background: var(--color-red-600);
    transform: scale(1.1);
}

/* Workspace Audio Results - REMOVED: Using only footer player */

/* Just Generated History Items - Green "Vừa xong" styling */
.history-item.just-generated {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-left: 3px solid var(--color-success);
    animation: justGenerated 0.5s ease-out;
}

.history-item.just-generated .history-item-title {
    color: var(--color-success);
    font-weight: 600;
}

.history-item.just-generated .history-item-duration {
    color: var(--color-success);
    font-weight: 500;
}

@keyframes justGenerated {
    0% {
        transform: translateX(-10px);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Add Workspace Section - Inside scrollable area */
.add-workspace-section {
    padding: var(--space-2) 0;
}

.add-workspace-btn {
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: transparent;
    border: none;
    border-radius: var(--radius-xl);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-gray-500);
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0 auto;
}

.add-workspace-btn:hover {
    color: var(--color-primary);
    background: var(--color-gray-100);
    border-radius: var(--radius-xl);
}

.add-workspace-btn .add-icon {
    font-size: var(--font-size-lg);
    font-weight: bold;
}

/* Fixed Controls Area - Outside scrollable area */
.fixed-controls-area {
    flex-shrink: 0; /* Never shrink */
    background: var(--color-white);
    border-top: none;
    padding: var(--space-2);
    border-radius: 0;
    box-shadow: none;
}







.workspace-cell {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    height: 100%; /* Fill workspace-row height */
}

/* Audio Player Cell - ensure audio info is visible */
.audio-player-cell {
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Align to top */
}

.audio-player-cell .result {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

/* Voice Settings Area - Left column with scrollable voice selection */
.voice-settings-area {
    grid-column: 1; /* Left column */
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    border-right: 1px solid var(--color-gray-200);
    padding-right: var(--space-4);
    height: 100%; /* Fill all available space */
    overflow: hidden; /* No scroll on container */
    background: var(--color-white);
    min-height: 0; /* Allow shrinking */
}

/* Language tabs in left column - horizontal layout */
.voice-settings-area .language-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.voice-settings-area .lang-tab {
    padding: var(--space-2) var(--space-4);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    background: var(--color-white);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    flex: 0 0 auto;
    min-width: 0;
}

.voice-settings-area .lang-tab:hover {
    background: var(--color-gray-50);
}

.voice-settings-area .lang-tab.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* Voice selection in left column - scrollable when content overflows */
.voice-settings-area .voice-selection {
    flex: 1;
    overflow-y: auto; /* Allow scrolling when voice list is long */
    overflow-x: hidden; /* No horizontal scroll */
    min-height: 0; /* Allow shrinking */
}

/* Shared History Area - Content layer */
.shared-history-area {
    position: relative;
    border-left: 1px solid var(--color-gray-200);
    padding-left: var(--space-4);
    height: 100%;
    background: var(--color-white);
    overflow: hidden; /* Container doesn't scroll */
}

.shared-history-area .audio-history {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--space-4);
    right: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Container doesn't scroll */
}



/* History List - Adaptive content layer with scroll */
.history-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    flex: 1; /* Take available space after header */
    max-height: calc(100dvh - 200px); /* Never exceed viewport minus header/footer/controls */
    overflow-y: auto; /* Scroll when content exceeds max-height */
    padding-right: var(--space-2);
}

/* History scrollbar styling */
.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: var(--color-gray-100);
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--color-gray-300);
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: var(--color-gray-400);
}

.remove-workspace-btn {
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: var(--color-red-500);
    color: var(--color-white);
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
    flex-shrink: 0;
}

.remove-workspace-btn:hover {
    background: var(--color-red-600);
    transform: scale(1.1);
}

.remove-workspace-btn:active {
    transform: scale(0.95);
}

/* Legacy workspace grid - kept for compatibility */
.workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space-5);
}

.workspace-col {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-width: 0; /* Allow shrinking */
    overflow: hidden; /* Prevent overflow */
}

.col-header {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-gray-700);
    padding-bottom: var(--space-2);
    display: flex;
    justify-content: flex-start; /* Align left */
    align-items: center;
    min-width: 0; /* Allow shrinking */
}



.col-header span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1;
}

/* Scrollbar styling for workspace content area */
.workspace-content-area::-webkit-scrollbar {
    width: 6px;
}

.workspace-content-area::-webkit-scrollbar-track {
    background: var(--color-gray-100);
    border-radius: 3px;
}

.workspace-content-area::-webkit-scrollbar-thumb {
    background: var(--color-gray-300);
    border-radius: 3px;
}

.workspace-content-area::-webkit-scrollbar-thumb:hover {
    background: var(--color-gray-400);
}

/* Text Input - DEPRECATED - Use .workspace-text-input instead */
.text-input {
    width: 100%;
    min-height: 120px;
    height: auto; /* Auto height based on content */
    padding: var(--space-3);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    line-height: 1.5;
    resize: none;
    transition: border-color 0.2s ease;
    background: var(--color-white);
    overflow: hidden; /* No scroll initially - let it expand */
    box-sizing: border-box;
}

.text-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

/* Text input scrollbar styling */
.text-input::-webkit-scrollbar {
    width: 6px;
}

.text-input::-webkit-scrollbar-track {
    background: var(--color-gray-100);
    border-radius: 3px;
}

.text-input::-webkit-scrollbar-thumb {
    background: var(--color-gray-300);
    border-radius: 3px;
}

.text-input::-webkit-scrollbar-thumb:hover {
    background: var(--color-gray-400);
}

.input-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-1);
}

.char-count {
    font-size: var(--font-size-xs);
    color: var(--color-gray-500);
    font-weight: 500;
}

.estimated-duration {
    font-size: var(--font-size-xs);
    color: var(--color-gray-400);
    font-style: italic;
}

/* Generate Section with Spinner */
.generate-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Loading Spinner */
.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-spinner.hidden {
    display: none;
}

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

/* Buttons */
.btn {
    padding: var(--space-2) var(--space-4);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-white);
}

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

.btn-primary:disabled {
    background: var(--color-gray-400);
    cursor: not-allowed;
}





.btn-secondary {
    background: var(--color-gray-100);
    color: var(--color-gray-700);
    border: 1px solid var(--color-gray-200);
}

.btn-secondary:hover {
    background: var(--color-gray-200);
}

/* Audio Player - Keep original simple styling */
.result {
    margin-top: var(--space-3);
}

.result audio {
    width: 100%;
    margin-bottom: 8px;
    /* Use browser default - only show thumb always */
}

/* Force show thumb/slider button always */
.result audio::-webkit-media-controls-timeline::-webkit-slider-thumb {
    -webkit-appearance: none !important;
    appearance: none !important;
    background: #007bff !important;
    border: 2px solid white !important;
    border-radius: 50% !important;
    width: 12px !important;
    height: 12px !important;
    cursor: pointer !important;
    opacity: 1 !important; /* Always visible - no hover needed */
    box-shadow: 0 1px 3px rgba(0,0,0,0.2) !important;
}

/* Firefox thumb always visible */
.result audio::-moz-range-thumb {
    background: #007bff !important;
    border: 2px solid white !important;
    border-radius: 50% !important;
    width: 12px !important;
    height: 12px !important;
    cursor: pointer !important;
    opacity: 1 !important; /* Always visible - no hover needed */
    box-shadow: 0 1px 3px rgba(0,0,0,0.2) !important;
}

.audio-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-2);
    padding: var(--space-2);
    background: var(--color-gray-50);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    color: var(--color-gray-600);
    flex-shrink: 0; /* Prevent shrinking */
    min-height: 32px; /* Ensure minimum height */
}

.duration-display {
    font-weight: 500;
    color: var(--color-gray-800);
}

.file-size {
    font-size: var(--font-size-xs);
}



.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) 0;
    flex-shrink: 0;
}

.history-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-gray-700);
}



/* History List - Duplicate removed, using the natural one above */

/* History Item */
.history-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--color-white);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.history-item:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.item-content {
    flex: 1;
    min-width: 0;
}

.item-text {
    font-size: var(--font-size-sm);
    color: var(--color-gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: var(--space-1);
}

.item-meta {
    display: flex;
    gap: var(--space-2);
    font-size: var(--font-size-xs);
    color: var(--color-gray-500);
}

.item-controls {
    display: flex;
    gap: var(--space-1);
}

.btn-icon {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: background-color 0.2s ease;
}

.btn-icon:hover {
    background: var(--color-gray-100);
}

.btn-icon.delete-btn:hover {
    background: var(--color-red-50);
    color: var(--color-red-600);
}

/* Empty State - Fill container completely */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%; /* Fill full container height */
    text-align: center;
    color: var(--color-gray-500);
    padding: var(--space-8);
}

.empty-icon {
    font-size: 2rem;
    margin-bottom: var(--space-2);
}

.empty-text {
    font-size: var(--font-size-base);
    font-weight: 500;
    margin-bottom: var(--space-1);
}

.empty-hint {
    font-size: var(--font-size-sm);
}

/* Clear History Button */
.clear-history-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--color-gray-500);
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.clear-history-btn:hover {
    background: var(--color-red-50);
    color: var(--color-red-600);
}

/* Add Workspace - Column 4 in grid */
.add-workspace {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: var(--space-2);
}

.add-btn {
    width: 48px;
    height: 48px;
    border: 2px dashed var(--color-gray-300);
    background: transparent;
    border-radius: 50%;
    font-size: var(--font-size-xl);
    color: var(--color-gray-400);
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* Coming Soon */
.coming-soon {
    text-align: center;
    padding: var(--space-12);
    color: var(--color-gray-500);
}

.coming-soon h2 {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--space-4);
}

/* Viewport-based responsive adjustments */
@media (max-height: 600px) {
    /* For shorter screens (like 13" laptops) */
    .workspace-text-input {
        min-height: 40px; /* Single line height */
    }

    .header {
        padding: clamp(0.25rem, 1vh, 0.5rem) 0;
        min-height: 50px;
    }

    .audio-player-footer {
        min-height: 40px;
        padding: clamp(0.25rem, 0.5vh, 0.5rem) 0;
    }
}

@media (min-height: 900px) {
    /* For taller screens (like 21" monitors) */
    .workspace-text-input {
        min-height: 40px; /* Single line height even on large screens */
    }

    .header {
        padding: clamp(0.75rem, 3vh, 1.5rem) 0;
    }

    .audio-player-footer {
        padding: clamp(0.75rem, 2vh, 1rem) 0;
    }
}

@media (max-height: 480px) {
    /* For very short screens */
    .main-content-row {
        grid-template-columns: 200px 1fr 250px;
        gap: 0.5rem;
        padding: 0.5rem;
    }
}

/* Mobile responsive design - Ultra Minimal Spacing */
@media (max-width: 768px) {
    /* 1. Ẩn cột 1 (Voice Settings) hoàn toàn */
    .voice-settings-area {
        display: none !important;
    }

    /* 2. Layout 1 cột dọc - ULTRA MINIMAL */
    .main-content-row {
        display: flex !important;
        flex-direction: column !important;
        gap: 1px !important;
        padding: 1px !important;
        margin: 0 !important;
    }

    /* 3. Text input area - sát viền */
    .text-input-area {
        width: 100% !important;
        order: 1;
        margin: 0 !important;
        padding: 1px !important;
    }

    /* 4. Workspace list - minimal gaps */
    .workspace-list {
        gap: 1px !important;
        margin-bottom: 1px !important;
    }

    /* 5. Workspace items - sát nhau */
    .workspace-item {
        margin-bottom: 1px !important;
        padding: 2px !important;
    }

    /* 6. Workspace header - compact */
    .workspace-header {
        gap: 2px !important;
        margin-bottom: 1px !important;
        padding: 1px !important;
    }

    /* 7. Fixed controls - minimal */
    .fixed-controls-area {
        padding: 2px !important;
        margin-top: 1px !important;
    }

    /* 8. Input controls - sát nhau */
    .input-controls {
        gap: 2px !important;
        padding: 1px !important;
    }

    /* 9. History area - sát viền */
    .shared-history-area {
        width: 100% !important;
        order: 2;
        border-left: none !important;
        border-top: 1px solid var(--color-gray-200) !important;
        padding: 1px !important;
        margin: 0 !important;
    }

    /* 10. History list - minimal gaps */
    .history-list {
        gap: 1px !important;
        padding: 1px !important;
        margin: 0 !important;
    }

    /* 11. History items - sát nhau */
    .history-item {
        gap: 2px !important;
        padding: 3px !important;
        margin-bottom: 1px !important;
    }

    /* 12. History header - minimal */
    .history-header {
        padding: 2px 0 !important;
        margin-bottom: 1px !important;
    }

    /* 13. Header ultra compact with navigation */
    .header {
        height: 50px !important; /* Fixed height thay vì auto */
        padding: 1px 2px !important;
        overflow: visible !important; /* Allow dropdown to show */
        z-index: 9998 !important; /* High z-index for mobile */
    }

    .header-content {
        padding: 1px !important;
        margin: 0 !important;
        flex-direction: column !important; /* Stack vertically on mobile */
        gap: 1px !important; /* Minimal gap */
        height: 100% !important;
        justify-content: center !important;
    }

    /* Header top row - mode tabs and user info */
    .header-top-row {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
        height: 24px !important; /* Fixed height for top row */
    }

    .header-left {
        flex: none !important;
    }

    .header-left .mode-tabs {
        gap: 1px !important;
    }

    .mode-tab {
        font-size: 10px !important;
        padding: 1px 4px !important;
        height: 22px !important;
    }

    .header-right {
        gap: 3px !important;
        flex: none !important;
    }

    /* Navigation - ultra compact below mode tabs */
    .header-center {
        position: static !important; /* Override absolute positioning */
        transform: none !important; /* Remove transform */
        left: auto !important; /* Reset left */
        width: 100% !important;
        justify-content: flex-start !important;
        margin-top: 1px !important;
        flex: none !important;
        height: 20px !important; /* Fixed height for navigation */
    }

    .nav-list {
        gap: 8px !important; /* Smaller gap */
        flex-wrap: nowrap !important; /* Single line */
        margin: 0 !important;
        padding: 0 !important;
    }

    .nav-link {
        font-size: 12px !important;
        padding: 0 !important;
        white-space: nowrap !important;
        line-height: 1 !important;
    }

    /* User avatar smaller */
    #user-avatar-voice,
    #user-initials-voice {
        width: 24px !important;
        height: 24px !important;
    }

    /* Usage display - mobile styling */
    .usage-display {
        font-size: 10px !important;
        margin-right: 3px !important; /* Smaller margin on mobile */
    }

    /* Auth button - same size as mode tabs */
    #auth-button-voice {
        font-size: 10px !important;
        padding: 1px 4px !important;
        height: 22px !important;
        border-radius: 3px !important;
        min-width: auto !important;
        white-space: nowrap !important;
    }

    /* User dropdown - ensure it works on mobile */
    .user-dropdown {
        position: fixed !important; /* Use fixed instead of absolute */
        z-index: 9999 !important; /* Very high z-index */
        right: 2px !important; /* Small margin from edge */
        top: 50px !important; /* Below header */
        min-width: 200px !important;
        max-width: calc(100vw - 10px) !important; /* Don't exceed screen */
    }

    /* User info hover - ensure dropdown works on mobile */
    #user-info-voice:hover .user-dropdown,
    #user-info-voice:focus .user-dropdown,
    #user-info-voice:active .user-dropdown,
    #user-info-voice:focus-within .user-dropdown {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
        display: block !important;
    }

    /* User avatar - ensure clickable area and touch support */
    #user-avatar-voice,
    #user-initials-voice {
        cursor: pointer !important;
        pointer-events: auto !important;
        touch-action: manipulation !important;
    }

    /* Mobile touch support for dropdown */
    #user-info-voice {
        position: relative !important;
    }

    /* Show dropdown on touch devices */
    @media (hover: none) and (pointer: coarse) {
        #user-info-voice:active .user-dropdown,
        #user-info-voice:focus .user-dropdown {
            opacity: 1 !important;
            visibility: visible !important;
            transform: translateY(0) !important;
            display: block !important;
        }
    }

    /* 14. Footer ultra compact */
    .audio-player-footer {
        height: 40px !important;
        padding: 1px 2px !important;
    }

    /* 15. Main area điều chỉnh - giữ nguyên 50px */
    .main {
        top: 50px !important; /* Giữ nguyên vì header fixed 50px */
        bottom: 40px !important;
        padding: 0 !important;
        z-index: 1 !important; /* Lower than header and dropdown */
    }

    /* 16. Workspace container - no gaps */
    .workspace-container {
        padding: 0 !important;
        margin: 0 !important;
    }

    .workspace-content-area {
        padding: 1px !important;
        margin-bottom: 1px !important;
    }

    /* 17. Add workspace section - minimal */
    .add-workspace-section {
        margin-top: 1px !important;
        padding: 1px !important;
    }

    /* 18. Dropdowns - compact */
    .language-selector-wrapper,
    .voice-selector-wrapper {
        margin: 0 !important;
    }

    .language-selector-btn,
    .voice-selector-btn {
        padding: 2px 5px !important;
        gap: 2px !important;
    }

    /* 19. Textarea - minimal padding */
    .workspace-text-input {
        padding: 3px !important;
        margin: 1px 0 !important;
    }

    /* 20. Empty state - compact */
    .empty-state {
        padding: 5px !important;
    }

    .empty-icon {
        margin-bottom: 2px !important;
    }

    .empty-text {
        margin-bottom: 1px !important;
    }

    /* 21. Buttons - minimal */
    .generate-btn {
        padding: 5px 10px !important;
        margin: 1px !important;
    }

    .add-workspace-btn {
        padding: 3px 8px !important;
        margin: 1px !important;
    }

    /* 22. Character count - compact */
    .char-count,
    .estimated-duration {
        margin: 0 !important;
        padding: 0 !important;
    }

    /* 23. Remove workspace button */
    .remove-workspace-btn {
        padding: 1px 3px !important;
        margin: 0 !important;
    }

    /* 24. Audio player - full width mobile */
    .audio-player-container {
        padding: 0 2px !important;
        height: 100%;
    }

    .audio-player-footer audio {
        width: 100% !important;
        max-width: 100% !important;
        height: 36px !important;
    }

    /* 25. Mode tabs - compact */
    .mode-tab {
        font-size: 11px !important;
        padding: 2px 6px !important;
    }

    /* 26. User info - hide username */
    .user-name {
        display: none !important;
    }



    /* 28. User avatar - smaller */
    #user-avatar-voice,
    #user-initials-voice {
        width: 32px !important;
        height: 32px !important;
    }
}

/* User Authentication Styles */
.header-right {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Usage Display */
.usage-display {
    font-size: 14px;
    color: #666666;
    font-weight: 500;
    white-space: nowrap;
    margin-right: 16px;
}

#auth-container-voice {
    display: flex;
    align-items: center;
    gap: 12px;
}

#user-info-voice {
    display: none;
    align-items: center;
    gap: 12px;
    position: relative;
}

#user-avatar-voice {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid var(--color-gray-300);
    transition: border-color 0.2s ease;
}

#user-avatar-voice:hover {
    border-color: var(--color-primary);
}

#user-initials-voice {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-primary);
    color: var(--color-white);
    font-weight: 600;
    cursor: pointer;
    border: 2px solid var(--color-gray-300);
    transition: background-color 0.2s ease;
}

#user-initials-voice:hover {
    background-color: var(--color-primary-hover);
}

#user-name-voice {
    font-weight: 500;
    display: none !important; /* Always hidden */
}

/* User Dropdown Menu */
.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 200px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

#user-info-voice:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-header {
    padding: var(--space-3);
    border-bottom: 1px solid var(--color-gray-200);
}

.user-dropdown-header span {
    font-size: var(--font-size-xs);
    color: var(--color-gray-600);
}

.user-dropdown-body {
    padding: var(--space-2);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--color-gray-700);
    font-size: var(--font-size-sm);
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.dropdown-item:hover {
    background-color: var(--color-gray-100);
    color: var(--color-gray-900);
}

.dropdown-item i {
    width: 16px;
    text-align: center;
}

/* Voice Selector Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s ease;
}

.modal-overlay.show .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-gray-200);
}

.modal-header h3 {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-gray-900);
}

.modal-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    font-size: var(--font-size-xl);
    color: var(--color-gray-500);
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: var(--color-gray-100);
    color: var(--color-gray-700);
}

.modal-body {
    padding: var(--space-4);
    max-height: 60vh;
    overflow-y: auto;
}

.modal-language-tabs {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}

.modal-lang-tab {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-md);
    background: var(--color-white);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-lang-tab.active {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

.modal-lang-tab:hover:not(.active) {
    border-color: var(--color-gray-300);
    color: var(--color-gray-800);
}

.modal-voice-selection {
    margin-bottom: var(--space-4);
}

.modal-voice-group {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.modal-voice-group.hidden {
    display: none;
}

.modal-voice-btn {
    background: var(--color-white);
    border: 1px solid var(--color-gray-200);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.modal-voice-btn.active {
    background: var(--color-success);
    color: var(--color-white);
    border-color: var(--color-success);
}

.modal-voice-btn:hover:not(.active) {
    border-color: var(--color-gray-300);
    color: var(--color-gray-800);
}

/* Dropdown Menu Styles */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
    color: var(--color-gray-600);
    text-decoration: none;
}

.dropdown-toggle::after {
    content: '▼';
    font-size: 10px;
    color: #666;
    transition: transform 0.2s;
}

.dropdown.open .dropdown-toggle::after {
    transform: rotate(180deg);
}

.dropdown-toggle:hover {
    color: var(--color-primary);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 280px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    margin-top: 4px;
}

.dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.dropdown-item:last-child {
    border-bottom: none;
    border-radius: 0 0 8px 8px;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
}

.app-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.app-info {
    flex: 1;
}

.app-name {
    font-weight: 500;
    font-size: 14px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4);
    border-top: 1px solid var(--color-gray-200);
}

/* Utility Classes */
.hidden {
    display: none !important;
}
