/* CSS Variables for theming */
:root {
    /* Light theme colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
    --accent-secondary: #6366f1;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --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);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
}

/* Dark theme colors */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --border-hover: #475569;
    --accent-primary: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-secondary: #6366f1;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

.app-container { min-height: 100vh; display: flex; flex-direction: column; }
.header { background-color: var(--bg-secondary); border-bottom: 1px solid var(--border-color); padding: 1rem 0; position: sticky; top: 0; z-index: 100; backdrop-filter: blur(10px); }
.header-content { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 1.5rem; font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: 0.5rem; }
.logo i { color: var(--accent-primary); }
.theme-toggle { background: none; border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 0.5rem; color: var(--text-secondary); cursor: pointer; transition: all 0.2s ease; }
.theme-toggle:hover { background-color: var(--bg-tertiary); color: var(--text-primary); }
.main-content { flex: 1; max-width: 800px; margin: 0 auto; padding: 2rem 1.5rem; width: 100%; }
.input-section { margin-bottom: 2rem; }
.input-container { background-color: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.input-tabs { display: flex; background-color: var(--bg-tertiary); border-bottom: 1px solid var(--border-color); }
.tab-btn { flex: 1; padding: 1rem 1.5rem; background: none; border: none; color: var(--text-secondary); font-weight: 500; cursor: pointer; transition: all 0.2s ease; position: relative; }
.tab-btn.active { color: var(--accent-primary); background-color: var(--bg-secondary); }
.tab-btn.active::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background-color: var(--accent-primary); }
.tab-btn:hover:not(.active) { background-color: var(--bg-secondary); color: var(--text-primary); }
.tab-content { display: none; padding: 2rem; }
.tab-content.active { display: block; }
.text-input-container { display: flex; flex-direction: column; gap: 1.5rem; }
.sample-text-section { background-color: var(--bg-tertiary); border-radius: var(--radius-md); padding: 1.5rem; }
.sample-text-section h4 { margin-bottom: 1rem; color: var(--text-primary); font-weight: 600; font-size: 1rem; }
.sample-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.75rem; }
.sample-btn { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1rem; background-color: var(--bg-primary); border: 1px solid var(--border-color); border-radius: var(--radius-md); color: var(--text-primary); font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: all 0.2s ease; }
.sample-btn:hover { background-color: var(--accent-primary); color: white; border-color: var(--accent-primary); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.sample-btn i { font-size: 1rem; }
.text-input-wrapper { display: flex; flex-direction: column; gap: 0.5rem; }
.input-header { display: flex; justify-content: space-between; align-items: center; }
.input-header label { font-weight: 600; color: var(--text-primary); font-size: 0.875rem; }
.text-stats { display: flex; gap: 1rem; font-size: 0.75rem; color: var(--text-secondary); }
.text-stats span { font-weight: 500; }
#text-input { width: 100%; min-height: 200px; padding: 1rem; border: 1px solid var(--border-color); border-radius: var(--radius-md); background-color: var(--bg-primary); color: var(--text-primary); font-family: inherit; font-size: 1rem; line-height: 1.6; resize: vertical; transition: border-color 0.2s ease; }
#text-input:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1); }
.text-validation { min-height: 1.5rem; font-size: 0.875rem; display: flex; align-items: center; gap: 0.5rem; }
.text-validation.error { color: var(--error); }
.file-upload-container { display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 200px; }
.drop-area { width: 100%; max-width: 500px; border: 2px dashed var(--border-color); border-radius: var(--radius-lg); padding: 3rem 2rem; text-align: center; cursor: pointer; transition: all 0.2s ease; background-color: var(--bg-primary); }
.drop-area:hover, .drop-area.dragover { border-color: var(--accent-primary); background-color: var(--bg-secondary); }
.drop-content { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.drop-content i { font-size: 3rem; color: var(--text-muted); }
.drop-content h3 { font-size: 1.25rem; font-weight: 600; color: var(--text-primary); }
.drop-content p { color: var(--text-secondary); font-size: 0.875rem; }
#file-input { display: none; }
.file-types { display: flex; gap: 0.5rem; margin-top: 1rem; justify-content: center; }
.file-type { padding: 0.25rem 0.75rem; background-color: var(--accent-primary); color: white; border-radius: var(--radius-sm); font-size: 0.75rem; font-weight: 500; }
.upload-progress { background-color: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 1.5rem; margin-top: 1rem; }
.progress-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.progress-bar-upload { width: 100%; height: 8px; background-color: var(--border-color); border-radius: 4px; overflow: hidden; }
.progress-fill-upload { height: 100%; background-color: var(--accent-primary); width: 0%; transition: width 0.3s ease; }
.file-validation { margin-top: 1rem; padding: 1rem; border-radius: var(--radius-md); font-size: 0.875rem; display: none; }
.file-validation.error { background-color: rgb(239 68 68 / 0.1); border: 1px solid var(--error); color: var(--error); display: flex; align-items: center; gap: 0.5rem; }
.btn { padding: 0.75rem 1.5rem; border: none; border-radius: var(--radius-md); font-weight: 500; font-size: 0.875rem; cursor: pointer; transition: all 0.2s ease; display: flex; align-items: center; gap: 0.5rem; text-decoration: none; }
.btn-primary { background-color: var(--accent-primary); color: white; }
.btn-primary:hover { background-color: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background-color: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-secondary:hover { background-color: var(--border-color); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.text-actions { display: flex; gap: 1rem; justify-content: flex-end; }
.voice-controls { background-color: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 2rem; margin-bottom: 2rem; box-shadow: var(--shadow-sm); }
.voice-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border-color); }
.voice-header h3 { font-size: 1.25rem; font-weight: 600; color: var(--text-primary); margin: 0; }
.controls-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem 2rem; }
.control-group { display: flex; flex-direction: column; gap: 0.5rem; }
.control-group.voice-selection { grid-column: 1 / -1; }
.control-group label { font-weight: 500; color: var(--text-primary); font-size: 0.875rem; }
.select-control { width: 100%; padding: 0.75rem; border: 1px solid var(--border-color); border-radius: var(--radius-md); background-color: var(--bg-primary); color: var(--text-primary); font-size: 0.875rem; cursor: pointer; }
.slider-container { display: flex; align-items: center; gap: 1rem; }
.slider { flex: 1; height: 6px; border-radius: 3px; background: var(--border-color); outline: none; -webkit-appearance: none; appearance: none; cursor: pointer; }
.slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-primary); cursor: pointer; box-shadow: var(--shadow-sm); transition: all 0.2s ease; }
.slider-value { min-width: 50px; text-align: right; font-weight: 500; color: var(--text-secondary); font-size: 0.875rem; }
.text-display { background-color: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.text-header { padding: 1.5rem 2rem; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; background-color: var(--bg-tertiary); }
.text-header h3 { font-size: 1.125rem; font-weight: 600; color: var(--text-primary); }
.text-container { max-height: 50vh; overflow-y: auto; padding: 2rem; line-height: 1.8; font-size: 1.1rem; }
.text-container .sentence { padding: 0.2rem 0.4rem; border-radius: var(--radius-sm); transition: background-color 0.3s ease; cursor: pointer; }
.text-container .sentence.highlight { background-color: var(--accent-primary); color: white; }
.player-controls { position: fixed; bottom: 0; left: 0; right: 0; background-color: var(--bg-secondary); border-top: 1px solid var(--border-color); padding: 1rem 0; box-shadow: var(--shadow-lg); z-index: 100; display: flex; }
.player-content { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; display: flex; align-items: center; gap: 2rem; width: 100%; }
.playback-controls { display: flex; align-items: center; gap: 0.5rem; }
.control-btn { width: 48px; height: 48px; border: none; border-radius: 50%; background-color: var(--bg-tertiary); color: var(--text-primary); cursor: pointer; transition: all 0.2s ease; display: flex; align-items: center; justify-content: center; }
.control-btn:hover { background-color: var(--border-color); }
.control-btn.play-btn { background-color: var(--accent-primary); color: white; width: 56px; height: 56px; }
.control-btn.play-btn:hover { background-color: var(--accent-hover); }
.progress-container { flex: 1; display: flex; flex-direction: column; gap: 0.5rem; }
.progress-bar { width: 100%; height: 8px; background-color: var(--border-color); border-radius: 4px; cursor: pointer; position: relative; }
.progress-fill { height: 100%; background-color: var(--accent-primary); width: 0%; transition: width 0.1s linear; }
.progress-handle { position: absolute; left: 0%; top: 50%; transform: translate(-50%, -50%); width: 16px; height: 16px; background-color: var(--accent-primary); border: 3px solid white; border-radius: 50%; box-shadow: var(--shadow-sm); opacity: 0; transition: opacity 0.2s ease; }
.progress-bar:hover .progress-handle { opacity: 1; }
.time-display, .progress-info { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-secondary); font-weight: 500; }
.reading-speed { background-color: var(--accent-primary); color: white; padding: 0.25rem 0.5rem; border-radius: var(--radius-sm); font-weight: 500; }
.player-actions { display: flex; gap: 1rem; }
.action-group { display: flex; gap: 0.5rem; }
.action-btn { width: 40px; height: 40px; border: none; border-radius: var(--radius-md); background-color: var(--bg-tertiary); color: var(--text-secondary); cursor: pointer; transition: all 0.2s ease; display: flex; align-items: center; justify-content: center; }
.action-btn:hover { background-color: var(--border-color); color: var(--text-primary); }
.action-btn.active { background-color: var(--accent-primary); color: white; }
.action-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.loading-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,0.7); z-index: 2000; display: flex; align-items: center; justify-content: center; transition: opacity 0.3s; }
[data-theme="dark"] .loading-overlay { background: rgba(15, 23, 42, 0.7); }
.spinner { width: 48px; height: 48px; border: 5px solid var(--border-color); border-top: 5px solid var(--accent-primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.notification { position: fixed; top: 20px; right: 20px; padding: 1rem 1.5rem; border-radius: var(--radius-md); color: white; font-weight: 500; z-index: 1000; transition: opacity 0.3s, transform 0.3s; }
.notification.hide { opacity: 0; transform: translateY(-20px); }
.notification-success { background-color: var(--success); }
.notification-error { background-color: var(--error); }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-tertiary); }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 4px; }
@media (max-width: 768px) { .player-content { flex-wrap: wrap; gap: 1rem; } .playback-controls { order: 2; width: 100%; justify-content: center; } .progress-container { order: 1; width: 100%; } .player-actions { order: 3; width: 100%; justify-content: center; } .controls-grid { grid-template-columns: 1fr; } }