:root {
  color-scheme: dark;
  /* Modern Color Palette */
  --bg-primary: #0a0e1a;
  --bg-secondary: #12172a;
  --bg-tertiary: #1a2136;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  
  /* Accent Colors */
  --accent-primary: #00e5cc;
  --accent-secondary: #5aa9ff;
  --accent-purple: #a78bfa;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  
  /* Text Colors */
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  
  /* Spacing */
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-primary);
}

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  transition: grid-template-columns 0.3s ease;
}

.layout.sidebar-collapsed {
  grid-template-columns: 70px 1fr;
}

/* Modern Sidebar with Icons */
.sidebar {
  background: linear-gradient(180deg, rgba(18, 23, 42, 0.8) 0%, rgba(10, 14, 26, 0.8) 100%);
  backdrop-filter: blur(20px);
  padding: var(--space-xl) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  border-right: 1px solid var(--border);
  position: relative;
  transition: all 0.3s ease;
  width: 280px;
  z-index: 100;
}

.sidebar.collapsed {
  width: 70px;
  padding: var(--space-xl) var(--space-sm);
}

.sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg, transparent, var(--accent-primary), transparent);
  opacity: 0.3;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
  position: absolute;
  top: var(--space-lg);
  right: -12px;
  width: 24px;
  height: 24px;
  background: var(--accent-primary);
  border: 2px solid var(--bg-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.3s ease;
  padding: 0;
  color: var(--bg-primary);
  font-size: 0.7rem;
  box-shadow: 0 4px 12px rgba(0, 229, 204, 0.3);
}

.sidebar-toggle:hover {
  background: var(--accent-secondary);
  transform: scale(1.1);
}

.sidebar.collapsed .toggle-icon {
  transform: rotate(180deg);
}

.toggle-icon {
  transition: transform 0.3s ease;
  display: block;
}

/* Logo States */
.sidebar .logo {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  padding: var(--space-sm) 0;
  letter-spacing: -0.5px;
  transition: opacity 0.3s ease;
  white-space: nowrap;
}

.sidebar .logo-mini {
  display: none;
  font-size: 2rem;
  text-align: center;
  transition: opacity 0.3s ease;
}

.sidebar.collapsed .logo {
  display: none;
}

.sidebar.collapsed .logo-mini {
  display: block;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.sidebar nav a {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid transparent;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  white-space: nowrap;
}

.sidebar nav a .nav-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.sidebar.collapsed nav a .nav-text {
  display: none;
}

.sidebar.collapsed nav a {
  justify-content: center;
  padding: var(--space-sm);
}

.sidebar nav a::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 229, 204, 0.1), transparent);
  transition: left 0.5s ease;
}

.sidebar nav a:hover::before {
  left: 100%;
}

.sidebar nav a:hover {
  background: var(--surface-hover);
  border-color: var(--accent-primary);
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0, 229, 204, 0.15);
}

.sidebar nav a.active {
  background: linear-gradient(135deg, rgba(0, 229, 204, 0.15), rgba(90, 169, 255, 0.1));
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  font-weight: 600;
  box-shadow: 0 0 20px rgba(0, 229, 204, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.main-content {
  padding: var(--space-xl) 48px;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  max-width: 1440px;
  margin: 0;
  width: 100%;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

/* Assets Toggle Bar */
.assets-toggle-bar {
  margin-bottom: var(--space-lg);
}

.assets-toggle-btn {
  font-size: 0.95rem;
  font-weight: 600;
}

/* Upload Section */
.upload-section {
  margin-bottom: var(--space-lg);
}

.upload-section-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 var(--space-md);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.upload-zone-wrapper {
  margin-bottom: var(--space-md);
}

.upload-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

/* Compact Dropzone */
.compact-dropzone {
  min-height: 80px !important;
  padding: var(--space-md) !important;
  background: var(--surface) !important;
  border: 2px dashed var(--border) !important;
  border-radius: var(--radius-md) !important;
  transition: all 0.3s ease !important;
}

.compact-dropzone:hover {
  border-color: var(--accent-primary) !important;
  background: var(--surface-hover) !important;
}

.compact-dropzone .dz-message {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: 0 !important;
}

.compact-dropzone .dz-icon {
  font-size: 1.5rem;
}

.compact-dropzone .dz-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Section Divider */
.section-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: var(--space-xl) 0;
  position: relative;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border);
}

.section-divider span {
  padding: 0 var(--space-md);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.selected-section {
  margin-top: var(--space-lg);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  align-items: stretch;
}

/* Media Placeholders */
.media-placeholder {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.media-placeholder:hover {
  border-color: var(--accent-primary);
}

.placeholder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

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

.placeholder-content {
  flex: 1;
  display: flex;
  /* Place child (.selected-media) at the very top */
  align-items: flex-start;
  justify-content: flex-start;
  position: relative;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  transition: all 0.3s ease;
  height: 250px;
  overflow: hidden;
}
#audio-placeholder audio , #video-placeholder video{margin-top:50px}
.placeholder-content video,
.placeholder-content audio {
  width: 300px;
  border-radius: var(--radius-sm);
  background: #000;
  margin: 0 auto;
}

.placeholder-content img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: var(--space-sm);
  opacity: 0.5;
}

.empty-state p {
  margin: var(--space-xs) 0;
  font-size: 0.95rem;
  font-weight: 500;
}

.empty-state small {
  font-size: 0.8rem;
  opacity: 0.7;
}

/* Selected Media Display */
.selected-media {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  position: relative;
  /* Ensure the block hugs the top of the placeholder */
  margin: 0;
  height: auto;
}


.selected-media-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm);
  background: var(--surface-hover);
  border-radius: var(--radius-sm);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
}

.media-file-name {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

.media-file-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Upload Grid Layout - Stacked Full Width */
.upload-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  width: 100%;
}

/* Media Import Card - Full width */
.media-import-card {
  width: 100%;
}

/* Result Card - Full width below */
#result-card {
  width: 100%;
  min-height: 600px;
  display: flex;
  flex-direction: column;
}

#result-card #generate-button {
  width: 100%;
  margin-bottom: var(--space-lg);
}

#result-card .video-preview {
  flex: 1;
  min-height: 400px;
}

/* Legacy card-grid for backward compatibility */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: var(--space-lg);
}

.card {
  background: linear-gradient(135deg, var(--surface) 0%, rgba(255, 255, 255, 0.01) 100%);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: visible;
}

/* For cards that need overflow hidden (like video previews) */
.card.overflow-hidden {
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 8px 32px rgba(0, 229, 204, 0.08), 0 0 0 1px rgba(0, 229, 204, 0.1);
  transform: translateY(-2px);
}

.card:hover::before {
  opacity: 1;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-sm);
}

.upload-zone {
  border: 2px dashed rgba(90, 169, 255, 0.3);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  background: rgba(90, 169, 255, 0.02);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.upload-zone.dragover {
  border-color: rgba(90, 169, 255, 0.8);
  background: rgba(90, 169, 255, 0.15);
}

.upload-zone input[type="file"] {
  display: none;
}

.upload-zone button {
  margin-top: 16px;
  padding: 10px 18px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(90deg, #367cff 0%, #5aa9ff 100%);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

/* YouTube Download Section */
.youtube-section {
  margin-top: var(--space-lg);
}

.youtube-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.input-group {
  display: flex;
  gap: var(--space-sm);
  align-items: stretch;
}

.youtube-input {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.youtube-input:focus {
  outline: none;
  border-color: var(--accent-secondary);
  box-shadow: 0 0 0 3px rgba(90, 169, 255, 0.1);
}

.youtube-download-btn {
  padding: var(--space-sm) var(--space-lg);
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.youtube-download-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(90, 169, 255, 0.3);
}

.youtube-download-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.youtube-progress {
  padding: var(--space-lg);
  border: 1px solid var(--accent-secondary);
  border-radius: var(--radius-md);
  background: rgba(90, 169, 255, 0.05);
  margin-top: var(--space-md);
}

.progress-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  text-align: center;
}

.progress-spinner {
  font-size: 2rem;
  animation: spin 2s linear infinite;
}

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

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

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

.youtube-info {
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.video-preview {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

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

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

.video-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.video-play-btn, .video-use-btn {
  padding: var(--space-sm) var(--space-md);
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.video-play-btn {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.video-play-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
}

.video-use-btn {
  background: linear-gradient(135deg, var(--success), #059669);
  color: white;
}

.video-use-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--surface), var(--surface-hover));
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.badge .nav-icon-only {
  display: none;
}

.sidebar.collapsed .badge .nav-text {
  display: none;
}

.sidebar.collapsed .badge .nav-icon-only {
  display: block;
  text-align: center;
}

.job-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.job-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

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

.status {
  font-weight: 600;
  font-size: 0.85rem;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

.status.succeeded {
  color: var(--success);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status.failed {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.status.processing {
  color: var(--warning);
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.video-preview {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  background: black;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
}

.video-preview video {
  width: 100%;
  display: block;
}

/* Captions page video container - fixed height like editor */
#captions-workspace .video-preview-container {
  height: 600px;
  max-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-radius: 0;
  margin-bottom: 24px;
}

#captions-video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.button-primary {
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  border: none;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  color: var(--bg-primary);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  align-self: flex-end;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 229, 204, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.button-primary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.button-primary:hover::before {
  width: 300px;
  height: 300px;
}

.button-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 229, 204, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

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

.button-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.button-secondary {
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.button-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  box-shadow: 0 4px 12px rgba(0, 229, 204, 0.1);
}

.button-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(1);
}

.button-secondary.destructive {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--error);
  color: var(--error);
}

.button-secondary.destructive:hover {
  background: rgba(239, 68, 68, 0.2);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

/* ===== Cost Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease;
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 2rem;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  min-height: 200px;
}

.cost-details {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cost-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
}

.cost-row.cost-total {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  margin-top: 8px;
  font-weight: 600;
}

.cost-label {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.cost-value {
  color: var(--text-primary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}

.cost-total .cost-value {
  color: #60a5fa;
  font-size: 1.25rem;
}

.cost-note {
  margin-top: 16px;
  padding: 12px;
  background: rgba(255, 193, 7, 0.1);
  border-left: 3px solid #ffc107;
  border-radius: 4px;
}

.cost-note p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

#cost-error {
  padding: 16px;
  background: rgba(239, 68, 68, 0.1);
  border-left: 3px solid #ef4444;
  border-radius: 4px;
}

#cost-error-message {
  margin: 0;
  color: #fca5a5;
  font-size: 0.9rem;
  line-height: 1.5;
}

.modal-footer {
  padding: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.modal-footer button {
  min-width: 120px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

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

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

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

/* ===== Login Overlay ===== */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  display: none;
  z-index: 9999;
}

.login-overlay.show {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: min(420px, 90vw);
  padding: 36px;
  border-radius: 24px;
  background: rgba(14, 18, 32, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.login-card h2 {
  margin: 0;
  font-size: 1.6rem;
}

.login-subtitle {
  margin: 0;
  opacity: 0.7;
}

.login-card label {
  font-size: 0.9rem;
  font-weight: 600;
}

.login-card input {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(10, 14, 26, 0.8);
  color: #e6ecff;
}

.login-card input:focus {
  outline: none;
  border-color: rgba(90, 169, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(90, 169, 255, 0.2);
}

.login-card button {
  width: 100%;
  margin-top: 12px;
}

.login-error {
  color: #ff6b6b;
  min-height: 20px;
}

.alert {
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(255, 102, 102, 0.12);
  border: 1px solid rgba(255, 102, 102, 0.3);
  color: #ffb3b3;
  font-size: 0.9rem;
}

/* Tab Navigation Styles */
.tab-navigation {
  display: flex;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tab-button {
  flex: 1;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
}

.tab-button:hover {
  color: rgba(255, 255, 255, 0.8);
  background: rgba(90, 169, 255, 0.05);
}

.tab-button.active {
  color: #5aa9ff;
  border-bottom-color: #5aa9ff;
  background: rgba(90, 169, 255, 0.08);
}

/* Tab Content Styles */
.tab-content {
  display: none;
}

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

/* TTS Form Styles */
.tts-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: visible !important;
  position: relative;
  z-index: 10;
}

.tts-form label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e6ecff;
  margin-bottom: 8px;
}

.tts-form textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #e6ecff;
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  min-height: 100px;
  transition: all 0.2s;
}

.tts-form textarea:focus {
  outline: none;
  border-color: rgba(90, 169, 255, 0.4);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(90, 169, 255, 0.1);
}

.tts-form textarea::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.tts-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tts-controls .status {
  font-size: 0.85rem;
}

#tts-audio-preview {
  margin-top: 16px;
  padding: 16px;
  background: rgba(90, 169, 255, 0.08);
  border: 1px solid rgba(90, 169, 255, 0.2);
  border-radius: 12px;
  display: none;
}

#tts-audio-preview.active {
  display: block;
}

#tts-audio-preview audio {
  width: 100%;
  margin-top: 8px;
}

/* Voice Settings Styles */
.voice-settings-container {
  margin: 16px 0;
}

.voice-settings-toggle {
  width: 100%;
  padding: 12px 16px;
  background: rgba(90, 169, 255, 0.1);
  border: 1px solid rgba(90, 169, 255, 0.3);
  border-radius: 12px;
  color: #5aa9ff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.voice-settings-toggle:hover {
  background: rgba(90, 169, 255, 0.15);
  border-color: rgba(90, 169, 255, 0.4);
}

.voice-settings-panel {
  margin-top: 16px;
  padding: 20px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.setting-group label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #e6ecff;
}

.setting-hint {
  font-size: 0.8rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
}

.setting-group input[type="range"] {
  width: 100%;
  height: 8px;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.15) 100%);
  border-radius: 4px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.setting-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #5aa9ff 0%, #3b82f6 100%);
  border: 3px solid #ffffff;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 0 rgba(90, 169, 255, 0.5);
}

.setting-group input[type="range"]::-webkit-slider-thumb:hover {
  background: linear-gradient(135deg, #7bb9ff 0%, #5aa9ff 100%);
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 12px rgba(90, 169, 255, 0.8);
  border-color: #7bb9ff;
}

.setting-group input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #5aa9ff 0%, #3b82f6 100%);
  border: 3px solid #ffffff;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 0 rgba(90, 169, 255, 0.5);
}

.setting-group input[type="range"]::-moz-range-thumb:hover {
  background: linear-gradient(135deg, #7bb9ff 0%, #5aa9ff 100%);
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 12px rgba(90, 169, 255, 0.8);
  border-color: #7bb9ff;
}

.checkbox-label {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #5aa9ff;
}

.checkbox-label span:first-of-type {
  font-weight: 600;
  color: #e6ecff;
}

#stability-value,
#similarity-value,
#style-value,
#speed-value {
  font-weight: 700;
  color: #5aa9ff;
}

/* Media Browser Styles */
.media-browser {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.browser-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.asset-count {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
}

.assets-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.asset-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: all 0.2s;
}

.asset-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(90, 169, 255, 0.3);
}

.asset-item.selected {
  background: rgba(90, 169, 255, 0.1);
  border-color: #5aa9ff;
}

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

.asset-name {
  font-weight: 500;
  color: #e6ecff;
  font-size: 0.9rem;
}

.asset-details {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
}

.asset-preview {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  background: rgba(90, 169, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5aa9ff;
  font-size: 0.8rem;
  font-weight: bold;
}

.video-preview .placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 1.1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Spinner */
.spinner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: var(--space-md);
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(96, 165, 250, 0.2);
  border-top-color: #60a5fa;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.spinner-container p {
  color: var(--text-secondary);
  font-size: 1rem;
  margin: 0;
}

/* Error Container */
.error-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: var(--space-sm);
  padding: var(--space-lg);
  text-align: center;
}

.error-icon {
  font-size: 3rem;
}

.error-message {
  color: #fca5a5;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.error-hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

.audio-preview audio {
  width: 100%;
  margin-top: 8px;
}

/* Modern Stat Cards (for dashboard metrics) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: linear-gradient(135deg, var(--surface), rgba(0, 229, 204, 0.03));
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-primary);
  box-shadow: 0 12px 24px rgba(0, 229, 204, 0.15);
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-md);
}

.stat-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(0, 229, 204, 0.2), rgba(90, 169, 255, 0.1));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.stat-change {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.stat-change.positive {
  color: var(--success);
  background: rgba(16, 185, 129, 0.1);
}

.stat-change.negative {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

/* Improved Placeholder */
.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  padding: var(--space-xl);
  background: linear-gradient(135deg, rgba(0, 229, 204, 0.03), transparent);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  font-size: 0.95rem;
  text-align: center;
  transition: all 0.3s ease;
}

.placeholder:hover {
  border-color: var(--accent-primary);
  background: linear-gradient(135deg, rgba(0, 229, 204, 0.06), transparent);
}

.placeholder::before {
  content: '🎬';
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.5;
  display: block;
}

/* Tool Sidebar for Generate Page */
.tool-sidebar {
  position: fixed;
  left: 280px;
  top: 0;
  width: 480px;
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  transition: transform 0.3s ease, left 0.3s ease;
  z-index: 40;
  overflow-y: auto;
  box-shadow: 4px 0 12px rgba(0, 0, 0, 0.3);
  visibility: hidden;
}

.layout.sidebar-collapsed .tool-sidebar {
  left: 70px;
}

.tool-sidebar.open {
  transform: translateX(0);
  visibility: visible;
}

.tool-panel {
  display: none;
  padding: var(--space-lg);
}

.tool-panel.active {
  display: block;
}

.tool-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.tool-panel-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--accent-primary);
  font-weight: 700;
}

.close-panel {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.close-panel:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.tool-panel-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.search-input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: all 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 229, 204, 0.1);
}

.asset-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  height: calc(100vh - 200px);
  overflow: hidden;
}

.asset-section {
  display: flex;
  flex-direction: column;
  min-height: 200px;
  flex: 1;
  overflow: hidden;
}

.asset-section-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: var(--space-xs);
}

.sidebar-asset-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.sidebar-asset-item:hover {
  background: var(--surface-hover);
}

.sidebar-asset-item .asset-icon {
  font-size: 1.2rem;
  opacity: 0.7;
}

.sidebar-asset-item .asset-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-asset-item .asset-name {
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-asset-item .asset-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  gap: var(--space-xs);
  align-items: center;
}

.sidebar-asset-item .asset-duration {
  color: var(--accent-primary);
  font-weight: 600;
}

.sidebar-asset-item .asset-delete {
  opacity: 0;
  padding: 4px 8px;
  background: var(--error);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s;
  position: absolute;
  right: var(--space-sm);
}

.sidebar-asset-item:hover .asset-delete {
  opacity: 1;
}

.sidebar-asset-item .asset-delete:hover {
  background: #dc2626;
  transform: scale(1.05);
}

.sidebar-asset-item .asset-preview {
  opacity: 0;
  padding: 4px 8px;
  background: rgba(59, 130, 246, 0.2);
  border: none;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #60a5fa;
  position: absolute;
  right: 50px;
}

.sidebar-asset-item:hover .asset-preview {
  opacity: 1;
}

.sidebar-asset-item .asset-preview:hover {
  background: rgba(59, 130, 246, 0.3);
  transform: scale(1.05);
}

.sidebar-asset-item .asset-preview.playing {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

.asset-section-header {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: var(--space-md) var(--space-xs) var(--space-xs);
  margin-top: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.asset-section-header:first-child {
  margin-top: 0;
}

/* Voice Selector Styling */
.voice-selector-container {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.voice-search-wrapper {
  flex: 1;
  max-width: 280px;
  position: relative;
  z-index: 100;
}

#voice-search {
  width: 100%;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #e6ecff;
  font-size: 0.9rem;
  min-height: 36px;
  box-sizing: border-box;
}

#voice-search:focus {
  outline: none;
  border-color: #5aa9ff;
  box-shadow: 0 0 0 2px rgba(90, 169, 255, 0.2);
}

#voice-search::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.voice-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  max-height: 240px;
  overflow-y: auto;
  z-index: 9999;
  display: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 229, 204, 0.1);
}

.voice-dropdown.show {
  display: block;
}

.voice-option {
  padding: 10px 12px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: all 0.2s ease;
  background: transparent;
  border-bottom: 1px solid var(--border);
}

.voice-option:hover {
  background: var(--surface-hover);
  color: var(--accent-primary);
}

.voice-option.selected {
  background: rgba(0, 229, 204, 0.1);
  color: var(--accent-primary);
  font-weight: 600;
}

.dialogue-segment-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dialogue-segment-voice {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dialogue-segment-voice select {
  flex: 1;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
}

.dialogue-segment-text {
  flex: 1;
}

.dialogue-segment-text textarea {
  width: 100%;
  min-height: 60px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  resize: vertical;
  font-family: inherit;
}

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

.dialogue-segment-remove {
  padding: 6px 8px;
  background: rgba(255, 107, 107, 0.1);
  color: #ff6b6b;
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.dialogue-segment-remove:hover {
  background: rgba(255, 107, 107, 0.2);
}

.dialogue-controls {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.dialogue-output-controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.dialogue-output-controls label {
  font-size: 14px;
  color: #b8c5d1;
  margin-bottom: 4px;
}

.dialogue-output-controls input {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #fff;
  min-width: 150px;
}

.dialogue-status {
  margin-top: 16px;
  text-align: center;
}

.dialogue-empty {
  text-align: center;
  padding: 40px;
  color: #b8c5d1;
  font-style: italic;
}

/* Responsive dialogue layout */
@media (max-width: 768px) {
  .dialogue-segment {
    flex-direction: column;
  }
  
  .dialogue-segment-number {
    align-self: flex-start;
  }
  
  .dialogue-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .dialogue-output-controls {
    justify-content: center;
  }
}

.voice-random {
  background: rgba(245, 158, 11, 0.08);
  color: var(--warning);
  font-weight: 600;
  border-bottom: 1px solid rgba(245, 158, 11, 0.2);
}

.voice-random:hover {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.voice-loading {
  padding: 12px;
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
  text-align: center;
}

.voice-category {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#play-voice-preview {
  padding: 8px 12px;
  font-size: 0.8rem;
  min-height: 36px;
  white-space: nowrap;
  margin-top: 0;
}

#play-voice-preview:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Scrollbar styling for voice dropdown */
.voice-dropdown::-webkit-scrollbar {
  width: 6px;
}

.voice-dropdown::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

.voice-dropdown::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.voice-dropdown::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* Multi-Voice Dialogue Styles */
.dialogue-form {
  padding: 20px;
}

.dialogue-header {
  text-align: center;
  margin-bottom: 24px;
}

.dialogue-header h3 {
  margin: 0 0 8px 0;
  color: #fff;
  font-size: 18px;
}

.dialogue-header p {
  margin: 0;
  color: #b8c5d1;
  font-size: 14px;
}

.dialogue-segments {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
  min-height: 120px;
}

.dialogue-segment {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  align-items: flex-start;
}

.dialogue-segment-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(90, 169, 255, 0.2);
  color: #5aa9ff;
  border-radius: 50%;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 4px;
}

.dialogue-segment-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dialogue-segment-voice {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dialogue-segment-voice select {
  flex: 1;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
}

.dialogue-segment-text textarea {
  width: 100%;
  min-height: 60px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  resize: vertical;
  font-family: inherit;
}

.dialogue-segment-remove {
  padding: 6px 8px;
  background: rgba(255, 107, 107, 0.1);
  color: #ff6b6b;
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.dialogue-segment-remove:hover {
  background: rgba(255, 107, 107, 0.2);
}

.dialogue-controls {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.dialogue-output-controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.dialogue-output-controls label {
  font-size: 14px;
  color: #b8c5d1;
  margin-bottom: 4px;
}

.dialogue-output-controls input {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #fff;
  min-width: 150px;
}

.dialogue-empty {
  text-align: center;
  padding: 40px;
  color: #b8c5d1;
  font-style: italic;
}

/* Quick Import Section */
.dialogue-quick-import {
  background: rgba(90, 169, 255, 0.05);
  border: 1px solid rgba(90, 169, 255, 0.2);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}

.dialogue-quick-import h4 {
  margin: 0 0 8px 0;
  color: #5aa9ff;
  font-size: 16px;
}

.dialogue-quick-import p {
  margin: 0 0 16px 0;
  color: #b8c5d1;
  font-size: 14px;
}

.import-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.voice-mappings {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.voice-mapping {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 200px;
}

.voice-mapping label {
  font-weight: 600;
  color: #fff;
  min-width: 60px;
}

.voice-mapping-select {
  flex: 1;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
}

#dialogue-import-text {
  width: 100%;
  min-height: 150px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  font-family: 'Courier New', monospace;
  resize: vertical;
  line-height: 1.4;
}

#dialogue-import-text::placeholder {
  color: rgba(255, 255, 255, 0.4);
  font-style: italic;
}

.import-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-start;
}

/* Sync API Settings */
.sync-settings-card {
  width: 100%;
  margin-bottom: var(--space-lg);
}

.sync-settings-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
}

.sync-settings-toggle:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
}

.sync-settings-panel {
  margin-top: var(--space-md);
  padding: var(--space-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.sync-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.sync-setting-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.sync-setting-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.sync-setting-group select,
.sync-setting-group input[type="text"],
.sync-setting-group input[type="number"] {
  padding: var(--space-sm);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.sync-setting-group select:focus,
.sync-setting-group input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 229, 204, 0.1);
}

.sync-setting-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 2px;
}
