/* 
 * MiniMax Audio - Modern Dark Theme Design
 * Inspired by https://www.minimaxi.com/audio
 */

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

:root {
  /* MiniMax Dark Theme Colors */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a25;
  --bg-card: #16161f;
  --bg-hover: #1e1e2a;
  
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #6a6a7a;
  
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  
  --border: #2a2a3a;
  --border-light: #3a3a4a;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.3);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  min-height: 100vh;
  color: var(--text-primary);
  line-height: 1.6;
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ========== Header ========== */
.app-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 24px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-icon {
  font-size: 2.5rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-section h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.badge {
  padding: 6px 14px;
  background: var(--accent-gradient);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  color: white;
  box-shadow: var(--shadow-glow);
}

/* ========== Main Content ========== */
.app-main {
  padding: 40px 0;
}

/* Section Headers */
.section-header {
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-header p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ========== Model Cards ========== */
.model-section {
  margin-bottom: 40px;
}

.model-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.model-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.model-card:hover {
  border-color: var(--accent-primary);
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.model-card.active {
  border-color: var(--accent-primary);
  background: var(--bg-hover);
  box-shadow: var(--shadow-glow);
}

.model-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.model-info h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.model-info p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.model-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.model-badge.recommended {
  background: var(--success-bg);
  color: var(--success);
}

.model-badge.premium {
  background: var(--warning-bg);
  color: var(--warning);
}

/* ========== Toggle Switch ========== */
.generate-mode-toggle {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all var(--transition-base);
  user-select: none;
}

.generate-mode-toggle:hover {
  border-color: var(--accent-primary);
  background: var(--bg-hover);
}

.generate-mode-toggle:active {
  transform: scale(0.98);
}

.toggle-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.toggle-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

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

.toggle-switch-label {
  display: block;
  cursor: pointer;
  margin-left: 16px;
  flex-shrink: 0;
}

.toggle-switch-label input[type="checkbox"] {
  display: none;
}

.toggle-switch {
  display: block;
  width: 52px;
  height: 30px;
  background: var(--bg-tertiary);
  border-radius: 15px;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid var(--border);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  background: var(--text-secondary);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-switch-label input[type="checkbox"]:checked + .toggle-switch {
  background: var(--accent-gradient);
  border-color: var(--accent-primary);
}

.toggle-switch-label input[type="checkbox"]:checked + .toggle-switch::after {
  transform: translateX(22px);
  background: white;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

/* ========== Voice Section ========== */
.voice-section {
  margin-bottom: 40px;
}

.voice-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.voice-tab {
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.voice-tab:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
  background: var(--bg-hover);
}

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

.voice-select {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-base);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23a0a0b0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 48px;
}

.voice-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.voice-preview {
  margin-top: 12px;
}

.preview-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.preview-btn:hover:not(:disabled) {
  border-color: var(--accent-primary);
  background: var(--bg-hover);
}

.preview-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.preview-btn.playing {
  border-color: var(--success);
  background: var(--success-bg);
  color: var(--success);
}

/* ========== Text Input ========== */
.text-section {
  margin-bottom: 40px;
}

.text-section .section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.char-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

#text-input {
  width: 100%;
  min-height: 180px;
  padding: 18px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-primary);
  resize: vertical;
  transition: all var(--transition-base);
}

#text-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

#text-input::placeholder {
  color: var(--text-muted);
}

/* ========== Emotion Tags ========== */
.emotion-tags-section {
  margin-top: 20px;
  padding: 20px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.emotion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.emotion-header label {
  font-weight: 600;
  color: var(--text-primary);
}

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

.emotion-tags-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.emotion-tag {
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.emotion-tag:hover {
  border-color: var(--accent-primary);
  background: var(--bg-hover);
  transform: translateY(-2px);
}

.emotion-tags-help {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.help-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.emotion-tags-help code {
  background: var(--bg-hover);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--accent-primary);
}

/* ========== Settings Panel ========== */
.settings-panel {
  margin-bottom: 40px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.settings-header {
  padding: 16px 20px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
}

.settings-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  padding: 24px 20px;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setting-item label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.setting-item select {
  padding: 12px 14px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-base);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a0a0b0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

.setting-item select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.setting-item input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.setting-item input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-gradient);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-fast);
}

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

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

/* ========== Generate Button ========== */
.generate-btn {
  width: 100%;
  padding: 20px 32px;
  background: var(--accent-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 1.1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 32px;
}

.generate-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 0 60px rgba(99, 102, 241, 0.4);
}

.generate-btn:active:not(:disabled) {
  transform: translateY(-1px);
}

.generate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ========== Results ========== */
.result-section {
  background: var(--bg-card);
  border: 2px solid var(--success);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 32px;
  animation: fadeIn 0.3s ease-out;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.result-header h3 {
  color: var(--success);
  font-size: 1.15rem;
  font-weight: 600;
}

.model-tag {
  padding: 6px 14px;
  background: var(--bg-tertiary);
  color: var(--accent-primary);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.audio-wrapper {
  margin-bottom: 20px;
}

#audio-player {
  width: 100%;
  border-radius: var(--radius-md);
  accent-color: var(--accent-primary);
}

.action-buttons {
  display: flex;
  gap: 12px;
}

.action-btn {
  flex: 1;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.action-btn.primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--shadow-glow);
}

.action-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 50px rgba(99, 102, 241, 0.4);
}

.action-btn.secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 2px solid var(--border);
}

.action-btn.secondary:hover {
  border-color: var(--accent-primary);
  background: var(--bg-hover);
}

/* Multi Results */
.multi-result-section {
  margin-bottom: 32px;
  animation: fadeIn 0.3s ease-out;
}

.multi-result-section h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
}

#multi-results-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.version-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition-base);
}

.version-card:hover {
  border-color: var(--accent-primary);
}

.version-card.success {
  border-color: var(--success);
}

.version-card.error {
  border-color: var(--error);
  background: var(--error-bg);
}

.version-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.version-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.version-name strong {
  font-size: 1rem;
  color: var(--text-primary);
}

.version-badge {
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
}

.version-badge.turbo {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
}

.version-badge.hd {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-secondary);
}

.version-status {
  font-size: 0.85rem;
  font-weight: 600;
}

.version-status.success {
  color: var(--success);
}

.version-status.error {
  color: var(--error);
}

.version-card audio {
  width: 100%;
  margin-bottom: 16px;
  border-radius: var(--radius-md);
  accent-color: var(--accent-primary);
}

.version-actions {
  display: flex;
  gap: 8px;
}

.version-actions .action-btn {
  flex: 0 0 auto;
  padding: 10px 16px;
  font-size: 0.875rem;
}

/* Error Section */
.error-section {
  background: var(--error-bg);
  border: 2px solid var(--error);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 32px;
  animation: slideIn 0.3s ease-out;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.error-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.error-section p {
  font-size: 0.95rem;
  color: var(--error);
  margin: 0;
}

/* ========== Footer ========== */
.app-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 32px 20px;
  text-align: center;
}

.app-footer p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.footer-note {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ========== Notification ========== */
.notification {
  position: fixed;
  top: 100px;
  right: 24px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 400px;
}

.notification.show {
  transform: translateX(0);
}

.notification-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.notification-message {
  font-size: 0.95rem;
  color: var(--text-primary);
}

.notification-error {
  border-color: var(--error);
  background: var(--error-bg);
}

.notification-warning {
  border-color: var(--warning);
  background: var(--warning-bg);
}

.notification-info {
  border-color: var(--accent-primary);
}

.notification-success {
  border-color: var(--success);
  background: var(--success-bg);
}

/* ========== Animations ========== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
  
  .logo-section {
    flex-direction: column;
  }
  
  .model-cards {
    grid-template-columns: 1fr;
  }
  
  .settings-grid {
    grid-template-columns: 1fr;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .emotion-tags-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  }
}

/* Focus Visible */
*:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}
