@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500&display=swap');

/* ========== CSS CUSTOM PROPERTIES ========== */
:root {
  /* Dark Theme (default) — Professional Studio */
  --bg-primary: #0c0e14;
  --bg-secondary: #141620;
  --bg-tertiary: #1c1f2e;
  --bg-card: rgba(22, 25, 40, 0.65);
  --bg-card-hover: rgba(28, 31, 50, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-hover: rgba(255, 255, 255, 0.065);
  --bg-input: rgba(255, 255, 255, 0.045);
  --bg-input-focus: rgba(255, 255, 255, 0.075);

  --text-primary: #e8e9f0;
  --text-secondary: #9496ad;
  --text-tertiary: #626480;
  --text-muted: #42445a;

  --border-color: rgba(255, 255, 255, 0.055);
  --border-hover: rgba(255, 255, 255, 0.11);
  --border-active: rgba(110, 86, 207, 0.45);

  --accent-primary: #6e56cf;
  --accent-secondary: #e5a63e;
  --accent-gradient: linear-gradient(135deg, #6e56cf 0%, #9b72f0 50%, #c084fc 100%);
  --accent-gradient-hover: linear-gradient(135deg, #8570e0 0%, #ad8af5 50%, #d4a5fd 100%);
  --accent-glow: rgba(110, 86, 207, 0.25);
  --accent-glow-strong: rgba(110, 86, 207, 0.45);

  --success: #34d399;
  --warning: #fbbf24;
  --error: #f87171;
  --info: #60a5fa;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.45);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 0 28px rgba(110, 86, 207, 0.12);

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --radius-full: 9999px;

  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --z-dropdown: 100;
  --z-modal: 200;
  --z-toast: 300;
}

/* Light Theme */
[data-theme="light"] {
  --bg-primary: #f6f6fa;
  --bg-secondary: #eeeef6;
  --bg-tertiary: #e4e5f0;
  --bg-card: rgba(255, 255, 255, 0.75);
  --bg-card-hover: rgba(255, 255, 255, 0.92);
  --bg-glass: rgba(255, 255, 255, 0.55);
  --bg-glass-hover: rgba(255, 255, 255, 0.75);
  --bg-input: rgba(0, 0, 0, 0.035);
  --bg-input-focus: rgba(0, 0, 0, 0.06);

  --text-primary: #1c1f2e;
  --text-secondary: #484b66;
  --text-tertiary: #696c8a;
  --text-muted: #9a9cb8;

  --border-color: rgba(0, 0, 0, 0.07);
  --border-hover: rgba(0, 0, 0, 0.14);
  --border-active: rgba(110, 86, 207, 0.45);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 28px rgba(110, 86, 207, 0.08);
}

/* ========== RESET & BASE ========== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color var(--transition-slow), color var(--transition-slow);
}

/* Animated background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse 70% 50% at 15% 35%, rgba(110, 86, 207, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 85% 55%, rgba(155, 114, 240, 0.04) 0%, transparent 70%),
    radial-gradient(ellipse 35% 35% at 50% 15%, rgba(192, 132, 252, 0.03) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* ========== HEADER ========== */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all var(--transition-base);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: var(--shadow-glow);
  transition: transform var(--transition-spring);
}

.logo-icon:hover {
  transform: rotate(-5deg) scale(1.05);
}

.logo-text {
  font-size: 20px;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.logo-badge {
  font-size: 10px;
  font-weight: 600;
  background: var(--accent-gradient);
  color: white;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* API Key Input */
.api-key-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.api-key-input {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 36px 8px 12px;
  width: 280px;
  outline: none;
  transition: all var(--transition-base);
}

.api-key-input:focus {
  background: var(--bg-input-focus);
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.api-key-input::placeholder {
  color: var(--text-muted);
}

.api-key-toggle {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
  transition: color var(--transition-fast);
}

.api-key-toggle:hover {
  color: var(--text-primary);
}

.api-key-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.api-key-status.connected {
  background: var(--success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

/* Theme Toggle */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--transition-base);
}

.theme-toggle:hover {
  background: var(--bg-input-focus);
  border-color: var(--border-hover);
  color: var(--text-primary);
  transform: rotate(15deg);
}

/* ========== MAIN LAYOUT ========== */
.main {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  align-items: stretch;
  min-height: calc(100vh - 64px);
}

.content-left {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ========== GLASS CARD ========== */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  pointer-events: none;
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .icon {
  font-size: 16px;
}

.card-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-input);
  color: var(--text-tertiary);
  border: 1px solid var(--border-color);
}

/* ========== TEXT EDITOR ========== */

.editor-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}

.editor-tab {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
}

.editor-tab:hover {
  color: var(--text-secondary);
  background: var(--bg-glass);
}

.editor-tab.active {
  color: var(--text-primary);
  background: var(--bg-input);
  border-color: var(--border-color);
}

.editor-textarea {
  width: 100%;
  min-height: 280px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  padding: 20px;
  resize: vertical;
  outline: none;
  transition: all var(--transition-base);
}

.editor-textarea:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-input-focus);
}

.editor-textarea::placeholder {
  color: var(--text-muted);
}

.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 0 4px;
}

.char-count {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  transition: color var(--transition-base);
}

.char-count.warning {
  color: var(--warning);
}

.char-count.danger {
  color: var(--error);
}

/* Directorial Prompt */
.director-prompt {
  margin-top: 16px;
}

.director-prompt label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.director-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 12px 16px;
  outline: none;
  transition: all var(--transition-base);
}

.director-input:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-input-focus);
}

.director-input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

/* Multi-speaker editor */
.multi-speaker-container {
  display: none;
}

.multi-speaker-container.active {
  display: block;
}

.speaker-block {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
  padding: 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.speaker-block:hover {
  border-color: var(--border-hover);
  background: var(--bg-glass-hover);
}

.speaker-select {
  min-width: 140px;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: all var(--transition-base);
}

.speaker-select:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.speaker-text {
  flex: 1;
  min-height: 60px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  padding: 10px 14px;
  resize: vertical;
  outline: none;
  transition: all var(--transition-base);
}

.speaker-text:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.speaker-remove {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--error);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.speaker-remove:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  transform: scale(1.05);
}

.add-speaker-btn {
  width: 100%;
  padding: 12px;
  background: var(--bg-glass);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.add-speaker-btn:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-hover);
  color: var(--text-secondary);
}

/* ========== VOICE & CONTROLS PANEL ========== */

.controls-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.control-select,
.control-input {
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: all var(--transition-base);
  width: 100%;
}

.control-select:focus,
.control-input:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-input-focus);
}

.control-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Voice preview info */
.voice-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding: 8px 12px;
  background: var(--bg-glass);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
}

.voice-info-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Generate Button */
.generate-btn {
  width: 100%;
  padding: 14px 24px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-glow);
  position: relative;
  overflow: hidden;
  margin-top: 8px;
}

.generate-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transition: left 0.6s ease;
}

.generate-btn:hover::before {
  left: 100%;
}

.generate-btn:hover {
  background: var(--accent-gradient-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg), 0 0 40px var(--accent-glow);
}

.generate-btn:active {
  transform: translateY(0);
}

.generate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.generate-btn:disabled::before {
  display: none;
}

.generate-btn .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

.generate-btn.loading .spinner {
  display: block;
}

.generate-btn.loading .btn-text {
  display: none;
}

.generate-btn.loading .btn-icon {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========== VOICE EFFECTS PANEL (inside Editor) ========== */
.effects-panel {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.effects-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.effects-panel-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.effects-clear-btn {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--error);
  cursor: pointer;
  transition: all var(--transition-base);
  display: none;
}

.effects-clear-btn.visible {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.effects-clear-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
}

.effects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.effect-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.effect-chip::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity var(--transition-base);
  border-radius: inherit;
  z-index: 0;
}

.effect-chip:hover {
  border-color: var(--border-hover);
  background: var(--bg-glass-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.12);
}

.effect-chip.active {
  border-color: var(--accent-primary);
  color: white;
  box-shadow: 0 0 16px var(--accent-glow), 0 2px 8px rgba(139, 92, 246, 0.25);
}

.effect-chip.active::before {
  opacity: 1;
}

.effect-emoji {
  font-size: 14px;
  position: relative;
  z-index: 1;
  line-height: 1;
}

.effect-label {
  position: relative;
  z-index: 1;
}

.effect-chip.active .effect-emoji {
  animation: effectPulse 2s ease-in-out infinite;
}

@keyframes effectPulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.12);
  }
}

/* ========== AUDIO PLAYER & VISUALIZER ========== */

.player-container {
  display: none;
}

.player-container.active {
  display: block;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.visualizer-wrapper {
  position: relative;
  width: 100%;
  height: 160px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 20px;
}

.visualizer-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.visualizer-overlay {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
}

.vis-mode-btn {
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.vis-mode-btn.active,
.vis-mode-btn:hover {
  color: white;
  background: rgba(139, 92, 246, 0.4);
  border-color: rgba(139, 92, 246, 0.5);
}

/* Player Controls */
.player-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.player-main-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.player-secondary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.player-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--transition-base);
}

.player-btn:hover {
  background: var(--bg-input-focus);
  color: var(--text-primary);
  border-color: var(--border-hover);
  transform: scale(1.05);
}

.player-btn.play-btn {
  width: 48px;
  height: 48px;
  background: var(--accent-gradient);
  border: none;
  color: white;
  font-size: 20px;
  box-shadow: var(--shadow-glow);
}

.player-btn.play-btn:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-lg), 0 0 30px var(--accent-glow);
}

/* Progress Bar */
.progress-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 0.1s linear;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  background: white;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.progress-bar:hover .progress-fill::after {
  opacity: 1;
}

.progress-time {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  min-width: 45px;
  text-align: center;
}

/* Speed Controls */
.speed-control {
  display: flex;
  align-items: center;
  gap: 4px;
}

.speed-btn {
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.speed-btn.active,
.speed-btn:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

/* Download btn */
.download-btn {
  padding: 10px 20px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-base);

}

.download-btn:hover {
  background: var(--bg-input-focus);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

/* ========== SIDEBAR PANELS ========== */
.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-section>.card:last-child {
  flex: 1;
}

/* History Panel */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
}

.history-item:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-hover);
  transform: translateX(4px);
}

.history-play-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-gradient);
  border: none;
  color: white;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-base);
}

.history-play-btn:hover {
  transform: scale(1.1);
}

.history-info {
  flex: 1;
  min-width: 0;
}

.history-text {
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  gap: 8px;
}

.history-delete {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all var(--transition-fast);
  opacity: 0;
}

.history-item:hover .history-delete {
  opacity: 1;
}

.history-delete:hover {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

.history-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.history-empty .icon {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.5;
}

/* ========== PROJECT PANEL ========== */
.project-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.project-btn {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition-base);
}

.project-btn:hover {
  background: var(--bg-input-focus);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.project-btn.primary {
  background: var(--accent-gradient);
  border: none;
  color: white;
}

.project-btn.primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.project-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.project-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
}

.project-item:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-hover);
}

.project-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.project-info {
  flex: 1;
  min-width: 0;
}

.project-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.project-delete {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all var(--transition-fast);
  opacity: 0;
}

.project-item:hover .project-delete {
  opacity: 1;
}

.project-delete:hover {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

/* ========== TOAST NOTIFICATIONS ========== */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  max-width: 420px;
  animation: toastIn 0.4s var(--transition-spring);
  font-size: 13px;
  color: var(--text-primary);
}

.toast.success {
  border-left: 3px solid var(--success);
}

.toast.error {
  border-left: 3px solid var(--error);
}

.toast.warning {
  border-left: 3px solid var(--warning);
}

.toast.info {
  border-left: 3px solid var(--info);
}

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  margin-left: auto;
  padding: 4px;
  transition: color var(--transition-fast);
}

.toast-close:hover {
  color: var(--text-primary);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.toast.removing {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
  }
}

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 480px;
  width: 90%;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.3s var(--transition-spring);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.modal-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  margin-bottom: 20px;
  transition: all var(--transition-base);
}

.modal-input:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.modal-btns {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.modal-btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
}

.modal-btn.cancel {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.modal-btn.cancel:hover {
  background: var(--bg-input-focus);
  color: var(--text-primary);
}

.modal-btn.confirm {
  background: var(--accent-gradient);
  border: none;
  color: white;
}

.modal-btn.confirm:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* ========== LANGUAGE TAGS ========== */
.lang-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
  .main {
    grid-template-columns: 1fr;
  }

  .api-key-input {
    width: 200px;
  }
}

@media (max-width: 640px) {
  .header {
    padding: 0 16px;
    height: 56px;
    flex-wrap: wrap;
    height: auto;
    padding: 12px 16px;
    gap: 12px;
  }

  .header-center {
    order: 3;
    width: 100%;
  }

  .api-key-input {
    width: 100%;
  }

  .main {
    padding: 16px;
    gap: 16px;
  }

  .card {
    padding: 16px;
  }

  .player-controls {
    gap: 12px;
  }

  .player-main-row {
    flex-wrap: wrap;
    gap: 12px;
  }

  .player-secondary-row {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

  .speed-control {
    width: 100%;
    justify-content: center;
  }

  .effects-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 6px;
  }

  .effect-chip {
    padding: 8px 10px;
    font-size: 11px;
  }

  .logo-badge {
    display: none;
  }
}

/* ========== UTILITY ANIMATIONS ========== */
.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.shimmer {
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-input-focus) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* Loading overlay for generator */
.generating-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  border-radius: var(--radius-lg);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.generating-overlay.active {
  display: flex;
}

.generating-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(139, 92, 246, 0.2);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}