/* CSS Variables */
:root {
    --color-bg: #0a0f1a;
    --color-surface: #141b2d;
    --color-surface-elevated: #1c2541;
    --color-border: #2d3a5c;
    --color-text-primary: #f0f4fc;
    --color-text-secondary: #8892a8;
    --color-text-muted: #5c6478;
    --color-accent: #4a9eff;
    --color-accent-glow: rgba(74, 158, 255, 0.3);
    --color-success: #34d399;
    --color-warning: #fbbf24;
    --color-error: #f87171;
    
    --font-english: 'Source Serif 4', Georgia, serif;
    --font-chinese: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-ui: system-ui, -apple-system, sans-serif;
    
    --font-size-english: 2rem;
    --font-size-chinese: 2.2rem;
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    --shadow-glow: 0 0 40px var(--color-accent-glow);
    --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.4);
    
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body { font-family: var(--font-ui); background: var(--color-bg); color: var(--color-text-primary); line-height: 1.6; }

.container { display: flex; flex-direction: column; height: 100vh; padding: 24px; gap: 20px; }

.header { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; background: var(--color-surface); border-radius: var(--radius-lg); border: 1px solid var(--color-border); }
.title { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; color: var(--color-text-primary); }

.status-indicator { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--color-surface-elevated); border-radius: var(--radius-md); font-size: 0.9rem; color: var(--color-text-secondary); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--color-text-muted); transition: background var(--transition-normal), box-shadow var(--transition-normal); }
.status-indicator.listening .status-dot { background: var(--color-success); box-shadow: 0 0 12px var(--color-success); animation: pulse 1.5s ease-in-out infinite; }
.status-indicator.error .status-dot { background: var(--color-error); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.controls { display: flex; gap: 12px; }

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px; font-size: 1rem; font-weight: 500; border: none; border-radius: var(--radius-md); cursor: pointer; transition: all var(--transition-fast); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--color-accent); color: white; }
.btn-primary:hover:not(:disabled) { background: #3d8be6; box-shadow: var(--shadow-glow); }
.btn-secondary { background: var(--color-surface-elevated); color: var(--color-text-primary); border: 1px solid var(--color-border); }
.btn-secondary:hover:not(:disabled) { background: var(--color-border); }
.btn-icon { padding: 12px; background: var(--color-surface-elevated); border: 1px solid var(--color-border); color: var(--color-text-secondary); }
.btn-icon:hover { background: var(--color-border); color: var(--color-text-primary); }
.btn-direction { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--color-surface-elevated); border: 1px solid var(--color-border); color: var(--color-text-primary); font-weight: 500; }
.btn-direction:hover { background: var(--color-border); }
.btn-direction .direction-label { font-size: 0.95rem; }
.btn-direction .icon-swap { width: 18px; height: 18px; color: var(--color-accent); }
.direction-toggle { display: flex; align-items: center; }
.icon { width: 20px; height: 20px; }

.content { flex: 1; display: flex; gap: 20px; min-height: 0; }

.panel { flex: 1; display: flex; flex-direction: column; background: var(--color-surface); border-radius: var(--radius-lg); border: 1px solid var(--color-border); overflow: hidden; }
.panel-header { padding: 16px 24px; border-bottom: 1px solid var(--color-border); background: var(--color-surface-elevated); }
.lang-label { font-size: 0.95rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-secondary); }
.panel-body { flex: 1; padding: 32px; overflow-y: auto; display: flex; flex-direction: column; justify-content: flex-end; }
.panel-left .panel-body { font-family: var(--font-left); font-size: var(--font-size-left); line-height: 1.5; }
.panel-right .panel-body { font-family: var(--font-right); font-size: var(--font-size-right); line-height: 1.6; font-weight: 400; }

.placeholder { color: var(--color-text-muted); font-style: italic; }
.sentence { margin-bottom: 1em; opacity: 0; transform: translateY(10px); animation: fadeIn 0.3s ease forwards; }
.sentence:last-child { color: var(--color-text-primary); }
.sentence:not(:last-child) { color: var(--color-text-secondary); }
@keyframes fadeIn { to { opacity: 1; transform: translateY(0); } }

.divider { width: 2px; background: linear-gradient(to bottom, transparent, var(--color-border) 20%, var(--color-accent) 50%, var(--color-border) 80%, transparent); border-radius: 1px; }

.footer { display: flex; justify-content: space-between; align-items: center; padding: 12px 24px; background: var(--color-surface); border-radius: var(--radius-md); border: 1px solid var(--color-border); font-size: 0.9rem; color: var(--color-text-secondary); }
.glossary-status { display: flex; align-items: center; gap: 8px; }
.sentence-count { display: flex; align-items: center; gap: 8px; }
.sentence-count select { background: var(--color-surface-elevated); color: var(--color-text-primary); border: 1px solid var(--color-border); padding: 4px 8px; border-radius: var(--radius-sm); font-size: 0.9rem; }

.modal { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(4px); align-items: center; justify-content: center; z-index: 1000; }
.modal.active { display: flex; }
.modal-content { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 32px; width: 100%; max-width: 540px; box-shadow: var(--shadow-soft); max-height: 90vh; overflow-y: auto; }
.modal-content h2 { margin-bottom: 8px; font-size: 1.5rem; font-weight: 600; }
.modal-content h3 { margin-bottom: 12px; font-size: 1.1rem; font-weight: 500; color: var(--color-text-secondary); }
.setup-description { color: var(--color-text-secondary); margin-bottom: 24px; line-height: 1.6; }

.settings-section { margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--color-border); }
.settings-section:last-of-type { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.form-row { display: flex; gap: 16px; margin-bottom: 12px; }
.form-row .form-group { flex: 1; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; color: var(--color-text-secondary); font-size: 0.9rem; }
.form-group input[type="text"],
.form-group input[type="password"] { width: 100%; padding: 12px 16px; background: var(--color-surface-elevated); border: 1px solid var(--color-border); border-radius: var(--radius-md); color: var(--color-text-primary); font-size: 1rem; transition: border-color var(--transition-fast); }
.form-group input:focus { outline: none; border-color: var(--color-accent); }
.form-group input::placeholder { color: var(--color-text-muted); }

.form-group select { width: 100%; padding: 10px 12px; background: var(--color-surface-elevated); border: 1px solid var(--color-border); border-radius: var(--radius-md); color: var(--color-text-primary); font-size: 0.95rem; cursor: pointer; }
.form-group select:focus { outline: none; border-color: var(--color-accent); }

.form-group input[type="range"] { width: 100%; height: 6px; background: var(--color-surface-elevated); border-radius: 3px; cursor: pointer; -webkit-appearance: none; }
.form-group input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; background: var(--color-accent); border-radius: 50%; cursor: pointer; }

.font-preview { padding: 16px; background: var(--color-bg); border-radius: var(--radius-md); border: 1px solid var(--color-border); margin-top: 8px; min-height: 60px; display: flex; align-items: center; }

.help-text { display: block; margin-top: 8px; font-size: 0.85rem; color: var(--color-text-muted); }
.help-text a { color: var(--color-accent); text-decoration: none; }
.help-text a:hover { text-decoration: underline; }

.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

.setup-status { margin-top: 16px; padding: 12px 16px; border-radius: var(--radius-md); font-size: 0.9rem; display: none; }
.setup-status.loading { display: block; background: var(--color-surface-elevated); color: var(--color-text-secondary); }
.setup-status.success { display: block; background: rgba(52, 211, 153, 0.1); color: var(--color-success); border: 1px solid rgba(52, 211, 153, 0.3); }
.setup-status.error { display: block; background: rgba(248, 113, 113, 0.1); color: var(--color-error); border: 1px solid rgba(248, 113, 113, 0.3); }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }
