/* ========================================
   Text-to-Speech Page - Monochrome Edition
   Clean black and white design with subtle animations
   ======================================== */

/* TTS Page Background */
.dashboard-content:has(.tts-container) {
  min-height: calc(100vh - 64px);
  position: relative;
  overflow-x: hidden;
  max-width: 100%;
}

/* Container Layout */
.tts-container {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 2rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  align-items: start;
  box-sizing: border-box;
}

/* Main Content */
.tts-main {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ========================================
   Voice Selection - Hero Card
   ======================================== */

.tts-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tts-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tts-hint {
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.25rem;
}

/* Voice Selection Button */
.voice-select-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 1.25rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px -5px hsl(0 0% 0% / 0.08);
  position: relative;
  overflow: hidden;
}

.dark .voice-select-btn {
  box-shadow: 0 4px 20px -5px hsl(0 0% 0% / 0.2);
}

.voice-select-btn:hover {
  transform: translateY(-2px);
  border-color: hsl(var(--foreground) / 0.3);
}

.voice-btn-content {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.selected-voice-avatar {
  width: 52px;
  height: 52px;
  border-radius: 1rem;
  object-fit: cover;
  background: hsl(var(--secondary));
  border: 3px solid hsl(var(--background));
  box-shadow: 0 4px 12px hsl(0 0% 0% / 0.1);
}

.selected-voice-name {
  font-weight: 600;
  font-size: 1.1rem;
  color: hsl(var(--foreground));
}

.voice-btn-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.125rem;
}

.selected-voice-meta {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  font-weight: 400;
}

/* Voice Loading Indicator */
.voice-loading-indicator {
  display: flex;
  align-items: center;
}

.voice-loading-indicator .spinner-small {
  animation: spin 1s linear infinite;
}

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

/* ========================================
   Text Input - Clean Style
   ======================================== */

.text-input-wrapper {
  position: relative;
}

.text-input {
  width: 100%;
  padding: 1.25rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 1.25rem;
  color: hsl(var(--foreground));
  font-size: 1rem;
  line-height: 1.7;
  resize: vertical;
  min-height: 220px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px -4px hsl(0 0% 0% / 0.05);
}

.text-input:focus {
  outline: none;
  border-color: hsl(var(--foreground) / 0.4);
  box-shadow: 0 4px 16px -4px hsl(0 0% 0% / 0.1);
}

.text-input::placeholder {
  color: hsl(var(--muted-foreground));
}

.character-count {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--background) / 0.9);
  padding: 0.25rem 0.5rem;
  border-radius: 0.5rem;
  transition: color 0.2s ease;
}

.character-count.at-limit {
  color: hsl(25 95% 53%);
  font-weight: 600;
}

.char-limit-warning {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  margin-top: 0.75rem;
  background: linear-gradient(135deg, hsl(25 95% 53% / 0.1), hsl(45 93% 47% / 0.1));
  border: 1px solid hsl(25 95% 53% / 0.3);
  border-radius: 0.75rem;
  color: hsl(25 95% 53%);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.char-limit-warning:hover {
  background: linear-gradient(135deg, hsl(25 95% 53% / 0.15), hsl(45 93% 47% / 0.15));
  border-color: hsl(25 95% 53% / 0.5);
}

.char-limit-warning svg {
  flex-shrink: 0;
}

/* ========================================
   Preset Buttons - Clean Pills
   ======================================== */

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.preset-btn {
  padding: 0.625rem 1.25rem;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: 2rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
}

.preset-btn:hover {
  background: hsl(var(--secondary));
  border-color: hsl(var(--foreground) / 0.2);
  color: hsl(var(--foreground));
  transform: translateY(-2px);
}

/* ========================================
   Audio Player
   ======================================== */

.audio-player-section {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 1.25rem;
  padding: 1.5rem;
  box-shadow: 0 8px 32px -8px hsl(0 0% 0% / 0.08);
}

#waveform {
  margin-bottom: 1rem;
  border-radius: 0.75rem;
  overflow: hidden;
}

.audio-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.audio-controls-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.play-pause-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: hsl(var(--foreground));
  color: hsl(var(--background));
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 15px hsl(0 0% 0% / 0.15);
}

.play-pause-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px hsl(0 0% 0% / 0.2);
}

.audio-time {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.download-btn {
  padding: 0.75rem;
  background: hsl(var(--secondary));
  border-radius: 0.75rem;
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: all 0.25s ease;
}

.download-btn:hover {
  background: hsl(var(--foreground) / 0.1);
  transform: translateY(-2px);
}

/* ========================================
   Generate Section
   ======================================== */

.generate-section {
  display: flex;
  gap: 1rem;
  width: 100%;
  box-sizing: border-box;
}

.mobile-settings-btn {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: 1rem;
  color: hsl(var(--foreground));
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.mobile-settings-btn:hover {
  background: hsl(var(--secondary));
}

.generate-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.125rem 2rem;
  background: hsl(var(--foreground));
  border: none;
  border-radius: 1rem;
  color: hsl(var(--background));
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 25px -5px hsl(0 0% 0% / 0.15);
}

.generate-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 35px -5px hsl(0 0% 0% / 0.2);
}

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

.generate-btn .btn-loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.generate-btn .btn-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ========================================
   Settings Sidebar - Clean Panel
   ======================================== */

.tts-sidebar {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 1.5rem;
  padding: 1.75rem;
  height: fit-content;
  box-shadow: 0 8px 32px -8px hsl(0 0% 0% / 0.08);
}

.dark .tts-sidebar {
  box-shadow: 0 8px 32px -8px hsl(0 0% 0% / 0.2);
}

.sidebar-mobile-header {
  display: none;
}

.settings-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.setting-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  letter-spacing: 0.02em;
}

.setting-value {
  font-weight: 500;
  color: hsl(var(--muted-foreground));
}

.setting-hint {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.setting-info {
  color: hsl(var(--muted-foreground));
  cursor: help;
  margin-left: 0.25rem;
  opacity: 0.7;
}

/* Model Toggle - Pill Switch */
.model-toggle {
  display: flex;
  background: hsl(var(--secondary));
  border-radius: 0.75rem;
  padding: 0.25rem;
}

.model-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  border-radius: 0.5rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.model-btn.active {
  background: hsl(var(--foreground));
  color: hsl(var(--background));
  box-shadow: 0 4px 12px hsl(0 0% 0% / 0.15);
}

.model-btn:hover:not(.active) {
  color: hsl(var(--foreground));
}

.model-new-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.4rem;
  margin-left: 0.35rem;
  background: hsl(var(--foreground));
  color: hsl(var(--background));
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-radius: 0.25rem;
  line-height: 1;
}

.model-btn.active .model-new-badge {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

/* Audio Format Toggle - Similar to Model Toggle */
.format-toggle {
  display: flex;
  background: hsl(var(--secondary));
  border-radius: 0.75rem;
  padding: 0.25rem;
}

.format-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  border-radius: 0.5rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.format-btn.active {
  background: hsl(var(--foreground));
  color: hsl(var(--background));
  box-shadow: 0 4px 12px hsl(0 0% 0% / 0.15);
}

.format-btn:hover:not(.active) {
  color: hsl(var(--foreground));
}

/* Custom Sliders - Monochrome */
.setting-slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: hsl(var(--secondary));
  appearance: none;
  cursor: pointer;
}

.setting-slider::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: hsl(var(--foreground));
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px hsl(0 0% 0% / 0.15);
  border: 3px solid hsl(var(--background));
}

.setting-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 12px hsl(0 0% 0% / 0.2);
}

.setting-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 3px solid hsl(var(--background));
  border-radius: 50%;
  background: hsl(var(--foreground));
  cursor: pointer;
  box-shadow: 0 2px 8px hsl(0 0% 0% / 0.15);
}

/* Select Dropdown */
.setting-select {
  width: 100%;
  padding: 0.875rem 2.5rem 0.875rem 1rem;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: 0.875rem;
  color: hsl(var(--foreground));
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  appearance: none;
  -webkit-appearance: none;
  -moz-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='%23888' 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 0.875rem center;
  background-size: 16px;
}

.setting-select:hover {
  border-color: hsl(var(--foreground) / 0.3);
  background-color: hsl(var(--secondary) / 0.5);
}

.setting-select:focus {
  outline: none;
  border-color: hsl(var(--foreground) / 0.5);
  box-shadow: 0 0 0 3px hsl(var(--foreground) / 0.1);
}

.setting-select option {
  padding: 0.75rem 1rem;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

/* ========================================
   Custom Language Selector
   ======================================== */

/* Language Select Button */
.language-select-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: 0.875rem;
  color: hsl(var(--foreground));
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  margin-top: 15px;
  transition: all 0.25s ease;
}

.language-select-btn:hover {
  border-color: hsl(var(--foreground) / 0.3);
  background-color: hsl(var(--secondary) / 0.5);
}

.language-select-btn:focus {
  outline: none;
  border-color: hsl(var(--foreground) / 0.5);
  box-shadow: 0 0 0 3px hsl(var(--foreground) / 0.1);
}

.language-selected-name {
  flex: 1;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lang-flag {
  font-size: 1.1rem;
  line-height: 1;
}

.language-chevron {
  color: hsl(var(--muted-foreground));
  transition: transform 0.2s ease;
}

.language-select-btn:hover .language-chevron {
  color: hsl(var(--foreground));
}

/* Language Modal */
.language-modal {
  width: 90vw;
  max-width: 480px;
  max-height: 70vh;
  background: hsl(var(--background));
  border-radius: 1.25rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 60px -12px hsl(0 0% 0% / 0.25);
}

/* Language Search */
.language-search {
  position: relative;
  padding: 0 0 1rem;
}

.language-search svg {
  position: absolute;
  left: 1rem;
  top: calc(50% - 0.5rem);
  transform: translateY(-50%);
  color: hsl(var(--muted-foreground));
}

.language-search-input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 3rem;
  background: hsl(var(--secondary));
  border: 1px solid transparent;
  border-radius: 0.875rem;
  color: hsl(var(--foreground));
  font-size: 0.9rem;
  transition: all 0.25s ease;
}

.language-search-input:focus {
  outline: none;
  border-color: hsl(var(--foreground) / 0.3);
  background: hsl(var(--background));
}

.language-search-input::placeholder {
  color: hsl(var(--muted-foreground));
}

/* Language Grid */
.language-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  max-height: 45vh;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.language-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.75rem;
  color: hsl(var(--foreground));
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.language-option:hover {
  background: hsl(var(--secondary));
  border-color: hsl(var(--border));
}

.language-option.selected {
  background: hsl(var(--foreground) / 0.08);
  border-color: hsl(var(--foreground) / 0.2);
}

.language-flag {
  font-size: 1.25rem;
  line-height: 1;
}

.language-name {
  flex: 1;
}

.language-check {
  color: hsl(var(--foreground));
}

.language-empty {
  padding: 2rem;
  text-align: center;
  color: hsl(var(--muted-foreground));
}

/* Editable Value Input */
.editable-value {
  width: 42px;
  text-align: right;
  background: transparent;
  border: none;
  color: hsl(var(--foreground));
  font-size: inherit;
  font-weight: 600;
}

.editable-value:focus {
  outline: none;
}

/* Advanced Toggle */
.advanced-toggle {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
}

.advanced-toggle input {
  display: none;
}

.toggle-slider {
  position: relative;
  width: 48px;
  height: 26px;
  background: hsl(var(--secondary));
  border-radius: 13px;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 4px hsl(0 0% 0% / 0.1);
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: hsl(var(--background));
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px hsl(0 0% 0% / 0.15);
}

.advanced-toggle input:checked + .toggle-slider {
  background: hsl(var(--foreground));
}

.advanced-toggle input:checked + .toggle-slider::after {
  transform: translateX(22px);
}

/* Advanced Settings Container */
.advanced-settings {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-top: 0.5rem;
}

/* Reset Button */
.reset-section {
  margin-top: auto;
  padding-top: 1.25rem;
  border-top: 1px solid hsl(var(--border));
}

.reset-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0;
  background: none;
  border: none;
  color: hsl(var(--muted-foreground));
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
}

.reset-btn:hover {
  color: hsl(var(--foreground));
}

.reset-btn:hover svg {
  transform: rotate(-180deg);
}

.reset-btn svg {
  transition: transform 0.4s ease;
}

/* Sidebar Overlay (Mobile) - Modal backdrop */
.tts-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  /* background: hsl(0 0% 0% / 0.5); */
  z-index: 45;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tts-sidebar-overlay.active {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
}

/* ========================================
   Voice Modal
   ======================================== */

.voice-modal {
  width: 95vw;
  max-width: 1100px;
  max-height: 90vh;
  background: hsl(var(--background));
  border-radius: 1.5rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 60px -12px hsl(0 0% 0% / 0.25);
}

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

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: hsl(var(--foreground));
}

.modal-close {
  padding: 0.5rem;
  border-radius: 0.5rem;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: all 0.25s ease;
}

.modal-close:hover {
  background: hsl(var(--secondary));
  color: hsl(var(--foreground));
}

.modal-content {
  flex: 1;
  padding: 1.5rem 2rem;
  /* overflow-y: auto; */
}

/* Voice Search */
.voice-search {
  position: relative;
  margin-bottom: 1.25rem;
}

.voice-search svg {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: hsl(var(--muted-foreground));
}

.voice-search-input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 3rem;
  background: hsl(var(--secondary));
  border: 1px solid transparent;
  border-radius: 0.875rem;
  color: hsl(var(--foreground));
  font-size: 0.9rem;
  transition: all 0.25s ease;
}

.voice-search-input:focus {
  outline: none;
  border-color: hsl(var(--foreground) / 0.3);
  background: hsl(var(--background));
}

/* Voice Filters */
.voice-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  align-items: center;
}

.filter-select {
  flex: 1;
  min-width: 140px;
  padding: 0.625rem 1rem;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  color: hsl(var(--foreground));
  font-size: 0.85rem;
  cursor: pointer;
}

/* Free Voices Filter */
.free-voices-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: hsl(var(--secondary));
  border-radius: 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  transition: all 0.2s ease;
  white-space: nowrap;
}

.free-voices-filter:hover {
  background: hsl(var(--foreground) / 0.1);
}

.free-voices-filter input {
  display: none;
}

.filter-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid hsl(var(--muted-foreground));
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  background: transparent;
}

.free-voices-filter input:checked + .filter-checkbox {
  background: hsl(var(--foreground));
  border-color: hsl(var(--foreground));
}

.free-voices-filter input:checked + .filter-checkbox::after {
  content: '';
  width: 5px;
  height: 9px;
  border: solid hsl(var(--background));
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

/* Voice Grid */
.voice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 0.5rem;
  padding-top: 30px;
}

.voice-loading {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem;
  color: hsl(var(--muted-foreground));
}

/* Voice Card - Clean Dashboard Style */
.voice-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 1rem;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
  position: relative;
  min-height: 180px;
}

.voice-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px -8px hsl(0 0% 0% / 0.12);
  border-color: hsl(var(--foreground) / 0.2);
}

.voice-card.selected {
  border-color: hsl(var(--foreground));
  box-shadow: 0 0 0 2px hsl(var(--foreground) / 0.15);
}

.voice-avatar {
  width: 64px;
  height: 64px;
  border-radius: 0.875rem;
  object-fit: cover;
  background: hsl(var(--secondary));
  border: 2px solid hsl(var(--background));
  box-shadow: 0 4px 12px hsl(0 0% 0% / 0.1);
  transition: all 0.25s ease;
}

.voice-card:hover .voice-avatar {
  transform: scale(1.05);
}

.voice-info {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.voice-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: hsl(var(--foreground));
  margin-bottom: 0;
}

/* Tags - Subtle Style */
.voice-tags {
  display: flex;
  gap: 0.375rem;
  justify-content: center;
  flex-wrap: wrap;
}

.voice-tag {
  padding: 0.2rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.65rem;
  font-weight: 500;
  background: hsl(var(--secondary));
  color: hsl(var(--muted-foreground));
}

.voice-tag-accent,
.voice-tag-gender {
  background: hsl(var(--secondary));
  color: hsl(var(--muted-foreground));
}

/* Voice Description */
.voice-description {
  font-size: 0.72rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.voice-premium-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  color: hsl(45, 100%, 50%);
  z-index: 2;
  filter: drop-shadow(0 1px 2px hsl(0 0% 0% / 0.2));
}

.voice-premium-badge svg {
  display: block;
}

/* Play Button - Monochrome */
.voice-preview-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: hsl(var(--foreground));
  color: hsl(var(--background));
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
  margin-top: 0.375rem;
  box-shadow: 0 4px 12px hsl(0 0% 0% / 0.15);
}

.voice-preview-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px hsl(0 0% 0% / 0.2);
}

.voice-preview-btn.playing {
  background: hsl(var(--foreground));
}

/* Modal Footer */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding: 1.25rem 2rem;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--secondary) / 0.5);
}

.btn-secondary {
  padding: 0.75rem 1.5rem;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  color: hsl(var(--foreground));
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-secondary:hover {
  background: hsl(var(--secondary));
}

.btn-primary {
  padding: 0.75rem 1.5rem;
  background: hsl(var(--foreground));
  border: none;
  border-radius: 0.75rem;
  color: hsl(var(--background));
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 15px hsl(0 0% 0% / 0.15);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px hsl(0 0% 0% / 0.2);
}

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

/* Header Link */
.header-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: hsl(var(--secondary));
  border-radius: 0.75rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.25s ease;
}

.header-link:hover {
  color: hsl(var(--foreground));
  background: hsl(var(--foreground) / 0.08);
}

/* Spinner Animation */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid hsl(var(--border));
  border-top-color: hsl(var(--foreground));
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Generate button spinner - SVG only, no border spinner */
.generate-btn .spinner {
  width: 18px;
  height: 18px;
  border: none;
  background: none;
  animation: spin 1s linear infinite;
}

.generate-btn .spinner circle {
  stroke: currentColor;
  stroke-dasharray: 32;
  stroke-dashoffset: 32;
  animation: none;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 1024px) {
  .tts-container {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Settings as full-page overlay below header */
  .tts-sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: calc(100% - 64px);
    max-height: calc(100% - 64px);
    border-radius: 0;
    z-index: 50;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .tts-sidebar.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .sidebar-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid hsl(var(--border));
  }

  .sidebar-mobile-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: hsl(var(--foreground));
  }

  .close-sidebar-btn {
    padding: 0.5rem;
    border-radius: 0.5rem;
    color: hsl(var(--muted-foreground))  ;
    cursor: pointer;
    transition: all 0.25s ease;
  }

  .close-sidebar-btn:hover {
    background: hsl(var(--secondary));
    color: hsl(var(--foreground));
  }

  /* Show mobile settings button */
  .mobile-settings-btn {
    display: flex;
  }

  /* Settings button above generate button */
  .generate-section {
    display: flex;
    flex-direction: column-reverse;
    gap: 0.75rem;
    width: 100%;
  }

  .generate-btn,
  .mobile-settings-btn {
    width: 100%;
    justify-content: center;
  }

  /* Modal backdrop - dark only, no blur */

  /* Fix mobile overflow issues */
  .dashboard-content {
    padding: 1rem;
    overflow-x: hidden;
  }

  .tts-main {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .tts-section {
    width: 100%;
    box-sizing: border-box;
  }
}

@media (max-width: 640px) {
  .preset-buttons {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.75rem;
    margin: 0 -1.5rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .preset-buttons::-webkit-scrollbar {
    display: none;
  }

  .preset-btn {
    flex-shrink: 0;
  }

  .voice-grid {
    grid-template-columns: 1fr 1fr;
  }

  .voice-filters {
    flex-direction: column;
  }

  .voice-card {
    padding: 1rem;
  }

  .voice-avatar {
    width: 56px;
    height: 56px;
  }

  .generate-btn {
    padding: 1rem 1.5rem;
  }
}

/* ========================================
   Premium Upgrade Dialog
   ======================================== */

.premium-upgrade-modal {
  background: hsl(var(--background));
  border-radius: 1.25rem;
  padding: 2rem;
  max-width: 380px;
  width: 90vw;
  text-align: center;
  box-shadow: 0 25px 60px -12px hsl(0 0% 0% / 0.25);
}

.premium-upgrade-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 1.25rem;
  background: linear-gradient(135deg, hsl(45, 100%, 50%) 0%, hsl(35, 100%, 55%) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 8px 24px hsl(45 100% 50% / 0.3);
}

.premium-upgrade-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  margin-bottom: 0.5rem;
}

.premium-upgrade-text {
  font-size: 0.9rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.premium-upgrade-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.premium-upgrade-actions .btn-primary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ========================================
   Language Mismatch Dialog
   ======================================== */

.language-mismatch-modal {
  background: hsl(var(--background));
  border-radius: 1.25rem;
  padding: 2rem;
  max-width: 420px;
  width: 90vw;
  text-align: center;
  box-shadow: 0 25px 60px -12px hsl(0 0% 0% / 0.25);
}

.mismatch-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 1.25rem;
  background: hsl(45, 90%, 95%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(35, 100%, 45%);
  box-shadow: 0 8px 24px hsl(35 100% 50% / 0.15);
}

html.dark .mismatch-icon {
  background: hsl(35, 50%, 20%);
  color: hsl(45, 100%, 60%);
}

.mismatch-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  margin-bottom: 0.75rem;
}

.mismatch-text {
  font-size: 0.9rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.6;
  margin-bottom: 1rem;
}

.mismatch-text strong {
  color: hsl(var(--foreground));
}

.mismatch-details {
  background: hsl(var(--secondary));
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1rem;
  text-align: left;
}

.mismatch-detail {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.375rem 0;
  font-size: 0.85rem;
}

.mismatch-detail:not(:last-child) {
  border-bottom: 1px solid hsl(var(--border));
}

.detail-label {
  color: hsl(var(--muted-foreground));
}

.detail-value {
  font-weight: 600;
  color: hsl(var(--foreground));
}

.mismatch-warning {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: hsl(35, 100%, 45%);
  margin-bottom: 1.25rem;
  padding: 0.625rem 1rem;
  background: hsl(45, 90%, 95%);
  border-radius: 0.5rem;
}

html.dark .mismatch-warning {
  background: hsl(35, 50%, 15%);
  color: hsl(45, 100%, 60%);
}

/* Don't show again checkbox */
.dont-show-again {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: hsl(var(--muted-foreground));
}

.dont-show-again input {
  display: none;
}

.dont-show-again .checkbox-custom {
  width: 18px;
  height: 18px;
  border: 2px solid hsl(var(--muted-foreground));
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.dont-show-again input:checked + .checkbox-custom {
  background: hsl(var(--foreground));
  border-color: hsl(var(--foreground));
}

.dont-show-again input:checked + .checkbox-custom::after {
  content: '';
  width: 5px;
  height: 9px;
  border: solid hsl(var(--background));
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

.mismatch-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

@media (max-width: 480px) {
  .mismatch-actions {
    flex-direction: column;
  }
  
  .mismatch-actions button {
    width: 100%;
  }
}

/* ========================================
   Recent History Section
   ======================================== */

.tts-recent-history {
  margin-top: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid hsl(var(--border));
}

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

.recent-history-header h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.view-all-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: hsl(var(--primary));
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.view-all-link:hover {
  opacity: 0.8;
}

.recent-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  cursor: pointer;
  text-decoration: none;
}

.recent-item:hover {
  border-color: hsl(var(--primary) / 0.3);
  background: hsl(var(--secondary) / 0.5);
}

.recent-item-avatar {
  width: 32px;
  height: 32px;
  border-radius: 0.375rem;
  object-fit: cover;
  flex-shrink: 0;
}

.recent-item-info {
  flex: 1;
  min-width: 0;
}

.recent-item-voice {
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-item-text {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.125rem;
}

.recent-item-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  flex-shrink: 0;
}

.recent-item-status {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
}

.recent-item-status.completed {
  background: hsl(142 76% 90%);
  color: hsl(142 76% 36%);
}

.dark .recent-item-status.completed {
  background: hsl(142 76% 20%);
  color: hsl(142 76% 70%);
}

.recent-item-status.generating {
  background: hsl(217 91% 90%);
  color: hsl(217 91% 36%);
}

.dark .recent-item-status.generating {
  background: hsl(217 91% 20%);
  color: hsl(217 91% 70%);
}

.recent-item-status.failed {
  background: hsl(0 84% 90%);
  color: hsl(0 84% 36%);
}

.dark .recent-item-status.failed {
  background: hsl(0 84% 20%);
  color: hsl(0 84% 70%);
}

.recent-item-time {
  font-size: 0.6875rem;
  color: hsl(var(--muted-foreground));
}

.recent-history-empty {
  padding: 1.5rem;
  text-align: center;
  color: hsl(var(--muted-foreground));
  font-size: 0.8125rem;
}
