/* ==========================================================================
   Duy Trịnh Studio - Modern Ultra-Clean Design System
   Designed for Ease of Use, Visual Excellence & Fluid Responsiveness
   ========================================================================== */

:root {
  --bg-base: #090d16;
  --bg-surface: #0f172a;
  --bg-surface-elevated: #1e293b;
  --bg-surface-hover: #27354f;
  --bg-input: #0b1120;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --border-accent: rgba(99, 102, 241, 0.4);

  --text-primary: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;

  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.4);

  --accent-cyan: #06b6d4;
  --accent-purple: #a855f7;
  --accent-orange: #f97316;
  --accent-green: #10b981;
  --accent-red: #ef4444;

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 9999px;

  --font-main: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 24px var(--primary-glow);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-base);
  background-image: 
    radial-gradient(ellipse at 15% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 100%, rgba(6, 182, 212, 0.1) 0%, transparent 45%),
    radial-gradient(ellipse at 50% 50%, rgba(15, 23, 42, 0.5) 0%, transparent 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 3rem;
}

/* ── Top Header & Tab Navigation ────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 1.6rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(6, 182, 212, 0.25));
  border: 1px solid rgba(99, 102, 241, 0.4);
  padding: 6px 8px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.2);
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Nav Tabs */
.nav-tabs {
  display: flex;
  align-items: center;
  background: rgba(11, 17, 32, 0.7);
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  gap: 4px;
}

.nav-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.45rem 1.1rem;
  font-family: var(--font-main);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.nav-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab-btn.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

.tab-badge {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  color: #a5b4fc;
}

.header-status-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
}

.status-pill.offline {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* ── Tab Panes ──────────────────────────────────────────────── */
.main-content {
  position: relative;
}

.tab-pane {
  display: none;
  animation: tabFadeIn 0.25s ease-out;
}

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

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Generic Glass Cards & Elements ─────────────────────────── */
.glass-card {
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

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

.card-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-badge {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(6, 182, 212, 0.2));
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-offline_pro {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
}

.badge-live {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.badge-accent {
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.35);
  color: #22d3ee;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
}

.badge-subtle {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-main);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--border-strong);
}

.btn-accent {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.3);
}

.btn-accent:hover {
  background: linear-gradient(135deg, #0891b2, #0e7490);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.45);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-xs {
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  border-radius: var(--radius-xs);
}

.btn-block {
  width: 100%;
}

/* ==========================================================================
   TAB 1: STUDIO TẠO GIỌNG STYLES
   ========================================================================== */
.studio-layout {
  max-width: 980px;
  margin: 0 auto;
}

/* 1. Voice Feature Card */
.voice-card-feature {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.8));
  border: 1px solid rgba(99, 102, 241, 0.25);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

.voice-card-feature::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #6366f1, #06b6d4, transparent);
}

.voice-card-top {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.voice-avatar-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.voice-avatar-icon {
  width: 58px;
  height: 58px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
  border: 1px solid rgba(99, 102, 241, 0.35);
  font-size: 1.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.25);
}

.voice-region-tag {
  font-size: 0.68rem;
  font-weight: 700;
  color: #cbd5e1;
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.voice-info-col {
  flex: 1;
  min-width: 0;
}

.voice-meta-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.voice-step-pill {
  font-family: var(--font-heading);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #818cf8;
}

.voice-display-name {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 4px;
}

.voice-display-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.voice-actions-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.btn-change-voice {
  padding: 0.65rem 1.25rem;
  font-size: 0.92rem;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.voice-quick-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-wrap: wrap;
}

.quick-pill-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-subtle);
}

.quick-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.16);
}

.quick-pill.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary);
  color: #c7d2fe;
}

.quick-pill.highlight-pill {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fde68a;
}

.quick-pill.highlight-pill:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fff;
}

.quick-pill.highlight-pill.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.35), rgba(217, 119, 6, 0.4));
  border-color: #f59e0b;
  color: #fff;
}

.voice-quick-shortcuts {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
}

.quick-shortcut-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fbbf24;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.voice-direct-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.voice-direct-chip:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.5);
  transform: translateY(-1px);
  color: #ffffff;
}

.voice-direct-chip.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(168, 85, 247, 0.35));
  border-color: #818cf8;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

/* 2. Text Input Card */
.text-card-feature {
  padding: 1.35rem;
}

.text-editor-wrapper {
  position: relative;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.text-editor-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.tts-textarea {
  width: 100%;
  height: 140px;
  min-height: 100px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.98rem;
  line-height: 1.6;
  padding: 1rem;
  resize: vertical;
}

.tts-textarea::placeholder {
  color: var(--text-subtle);
}

.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid var(--border-subtle);
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.editor-counts {
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-hint kbd {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.quick-samples-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}

.sample-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.sample-chip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  color: #cbd5e1;
  font-family: var(--font-main);
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s ease;
}

.sample-chip:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.35);
  color: #ffffff;
  transform: translateY(-1px);
}

/* 3. Config Compact Card */
.config-compact-card {
  padding: 1.25rem;
}

.config-compact-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 768px) {
  .config-compact-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.config-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.config-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.config-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.slider-val {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: #a5b4fc;
}

.slider-input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--primary);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
  transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.quick-speed-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-speed {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 3px 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-speed:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.btn-speed.active {
  background: rgba(99, 102, 241, 0.25);
  border-color: var(--primary);
  color: #ffffff;
  font-weight: 700;
}

.toggle-group {
  justify-content: center;
}

/* Checkbox Toggle */
.toggle-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  margin-top: 4px;
}

.toggle-checkbox input {
  display: none;
}

.checkmark {
  width: 20px;
  height: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.toggle-checkbox input:checked + .checkmark {
  background: var(--primary);
  border-color: var(--primary);
}

.toggle-checkbox input:checked + .checkmark::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.checkbox-label {
  font-size: 0.82rem;
  color: var(--text-primary);
}

/* Audio Effects Chips */
.effects-section {
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.effects-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.effects-chips-grid {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.effect-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s ease;
}

.effect-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-strong);
}

.effect-chip.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(6, 182, 212, 0.25));
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
}

.eff-icon {
  font-size: 1rem;
}

.eff-name {
  font-size: 0.8rem;
  font-weight: 600;
}

/* CTA Row */
.synthesize-cta-row {
  margin: 1.5rem 0;
}

.btn-synthesize-large {
  width: 100%;
  padding: 1rem 1.5rem;
  font-size: 1.08rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #06b6d4 100%);
  position: relative;
  overflow: hidden;
}

.btn-synthesize-large:hover {
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.6);
  transform: translateY(-2px);
}

/* 4. Player Card Pro */
.player-card-pro {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1.25rem 1.5rem;
}

.player-top-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.player-track-col {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.track-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 450px;
}

.audio-specs-mini {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-subtle);
  flex-shrink: 0;
}

.mini-waveform-box {
  height: 60px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  margin-bottom: 1rem;
}

#visualizerCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.visualizer-idle-bars {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.visualizer-idle-bars span {
  width: 4px;
  height: 14px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

.visualizer-idle-bars span:nth-child(even) {
  height: 24px;
}

.visualizer-idle-bars span:nth-child(3n) {
  height: 36px;
}

.generating-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 17, 32, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #c7d2fe;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(99, 102, 241, 0.25);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.playback-bar {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-play-round {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  border: none;
  color: #ffffff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.btn-play-round:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.seek-track {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.time-display {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.playback-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ==========================================================================
   TAB 2: TELEMETRY & BENCHMARK DASHBOARD
   ========================================================================== */
.telemetry-dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .telemetry-dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.metric-box {
  background: rgba(11, 17, 32, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
}

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.metric-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}

.metric-val {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 0.3s ease, background 0.3s ease;
}

.progress-cpu {
  background: linear-gradient(90deg, #10b981, #06b6d4);
}

.progress-ram {
  background: linear-gradient(90deg, #3b82f6, #a855f7);
}

.metric-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.truncate-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.sparkline-container {
  display: flex;
  align-items: flex-end;
  height: 24px;
  gap: 3px;
  margin-top: 8px;
}

.sparkline-bar {
  flex: 1;
  background-color: #10b981;
  border-radius: 1px;
  transition: height 0.3s ease;
}

.specs-mini-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.spec-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
}

.spec-k {
  color: var(--text-muted);
}

.spec-v {
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* Benchmark Controls */
.benchmark-controls-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.b-control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.b-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.val-pill {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #38bdf8;
}

.b-input-with-chips {
  display: flex;
  align-items: center;
  gap: 10px;
}

.custom-input-sm {
  width: 70px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: #ffffff;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
}

.b-quick-chips {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
}

.b-chip {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.b-chip:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
}

.b-chip.active {
  background: rgba(6, 182, 212, 0.2);
  border-color: #06b6d4;
  color: #22d3ee;
}

.custom-select-sm {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: #ffffff;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.88rem;
  outline: none;
}

.custom-select-sm optgroup {
  background: #0f172a;
  color: #94a3b8;
  font-weight: 700;
}

.custom-select-sm option {
  background: #1e293b;
  color: #f8fafc;
}

.toggle-xs .checkbox-label {
  font-size: 0.8rem;
}

/* Benchmark Results */
.benchmark-result-box {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

.benchmark-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 1rem;
}

.b-stat {
  background: rgba(0, 0, 0, 0.3);
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  text-align: center;
}

.b-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.b-val {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 800;
}

.benchmark-items-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.b-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.b-item-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.b-item-voice {
  font-weight: 600;
  color: #e2e8f0;
}

.b-item-stat {
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}

.text-success { color: #34d399 !important; }
.text-danger { color: #f87171 !important; }

/* ==========================================================================
   TAB 3: LỊCH SỬ BẢN THU (AUDIO LIBRARY)
   ========================================================================== */
.history-full-card {
  max-width: 980px;
  margin: 0 auto;
}

.recent-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-hint {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-subtle);
  font-size: 0.9rem;
}

.history-item-mini {
  background: rgba(11, 17, 32, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s ease;
}

.history-item-mini:hover {
  border-color: rgba(99, 102, 241, 0.35);
  background: rgba(15, 23, 42, 0.8);
}

.hist-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
}

.hist-time {
  font-family: var(--font-mono);
  color: var(--text-subtle);
}

.hist-text {
  font-size: 0.92rem;
  color: #f1f5f9;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hist-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.hist-voice {
  font-size: 0.8rem;
  font-weight: 600;
  color: #a5b4fc;
}

.hist-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   VOICE SELECTION MODAL (MODAL 23 GIỌNG ĐỌC)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}

.modal-dialog {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 960px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: scaleUp 0.25s ease;
  overflow: hidden;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.95);
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
}

.modal-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-close-modal {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-close-modal:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.modal-search-row {
  padding: 1rem 1.5rem;
  background: rgba(11, 17, 32, 0.5);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  font-size: 0.95rem;
  color: var(--text-subtle);
}

.custom-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: #ffffff;
  padding: 0.65rem 1rem 0.65rem 2.5rem;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.custom-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.modal-filter-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.m-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s ease;
}

.m-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.m-chip.active {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.m-chip.highlight-chip {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fde68a;
}

.m-chip.highlight-chip:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fff;
}

.m-chip.highlight-chip.active {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: #f59e0b;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.modal-voices-grid {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  flex: 1;
}

/* Individual Voice Item in Modal Grid */
.voice-grid-item {
  background: rgba(18, 26, 44, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.voice-grid-item:hover {
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(24, 34, 58, 0.9);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.voice-grid-item.active {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.15);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.3);
}

.v-item-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.v-item-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

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

.v-item-name {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.v-item-region {
  font-size: 0.7rem;
  color: #94a3b8;
}

.v-item-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.v-item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-preview-voice {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-preview-voice:hover {
  background: rgba(99, 102, 241, 0.2);
  color: #ffffff;
  border-color: var(--primary);
}

.btn-select-voice {
  background: var(--primary);
  border: none;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-select-voice:hover {
  background: #4f46e5;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.95);
}

.modal-count-info {
  font-size: 0.8rem;
  color: var(--text-subtle);
}

/* ==========================================================================
   RESPONSIVE DESIGN BREAKPOINTS
   ========================================================================== */
@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .nav-tabs {
    width: 100%;
    justify-content: space-between;
  }

  .nav-tab-btn {
    flex: 1;
    justify-content: center;
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
  }

  .voice-card-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .voice-actions-col {
    width: 100%;
    flex-direction: row;
  }

  .voice-actions-col .btn {
    flex: 1;
  }

  .playback-bar {
    flex-wrap: wrap;
  }

  .seek-track {
    width: 100%;
    order: 3;
  }
}
