/* ========================================
   Free TTS Page Styles
   ======================================== */

/* Page Layout */
.free-tts-page {
  padding-top: 8rem;
  padding-bottom: 4rem;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.free-tts-page .bg-decorations {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.free-tts-page .bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
}

.free-tts-page .bg-blob-1 {
  top: 10%;
  left: -5%;
  width: 400px;
  height: 400px;
  background: linear-gradient(135deg, hsl(270, 70%, 80%) 0%, hsl(280, 60%, 85%) 100%);
}

.free-tts-page .bg-blob-2 {
  bottom: 10%;
  right: -5%;
  width: 500px;
  height: 500px;
  background: linear-gradient(135deg, hsl(200, 70%, 85%) 0%, hsl(220, 60%, 90%) 100%);
}

.dark .free-tts-page .bg-blob-1 {
  background: linear-gradient(135deg, hsl(270, 50%, 20%) 0%, hsl(280, 40%, 15%) 100%);
}

.dark .free-tts-page .bg-blob-2 {
  background: linear-gradient(135deg, hsl(200, 50%, 15%) 0%, hsl(220, 40%, 10%) 100%);
}

/* Header */
.free-tts-header {
  text-align: center;
  margin-bottom: 2rem;
}

.free-tts-header .badge {
  margin-bottom: 1rem;
}

.free-tts-header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, hsl(var(--foreground)) 0%, hsl(var(--muted-foreground)) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.free-tts-header p {
  color: hsl(var(--muted-foreground));
  font-size: 1.125rem;
  max-width: 500px;
  margin: 0 auto;
}

/* Logged-in Banner */
.logged-in-banner {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  padding: 1rem 1.5rem;
  border-radius: 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  animation: slideDown 0.3s ease-out;
}

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

.logged-in-banner.hidden {
  display: none;
}

.logged-in-banner-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logged-in-banner-content svg {
  flex-shrink: 0;
}

.logged-in-banner-content p {
  font-size: 0.9375rem;
  line-height: 1.4;
}

.logged-in-banner-content strong {
  font-weight: 600;
}

.logged-in-banner-actions {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
}

.logged-in-banner .btn-dashboard {
  background: hsl(var(--primary-foreground));
  color: hsl(var(--primary));
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.logged-in-banner .btn-dashboard:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.logged-in-banner .btn-dismiss {
  color: hsl(var(--primary-foreground));
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

.logged-in-banner .btn-dismiss:hover {
  background: rgba(255,255,255,0.3);
}

/* Usage Stats */
.usage-stats {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.usage-stat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 2rem;
  font-size: 0.875rem;
}

.usage-stat svg {
  color: hsl(var(--muted-foreground));
}

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

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

/* Main TTS Card */
.free-tts-card {
  max-width: 700px;
  margin: 0 auto;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 1.5rem;
  padding: 2rem;
  box-shadow: var(--shadow-xl);
  position: relative;
  z-index: 1;
}

.dark .free-tts-card {
  background: hsl(var(--card) / 0.8);
  backdrop-filter: blur(12px);
}

/* Form Groups */
.tts-form-group {
  margin-bottom: 1.5rem;
}

.tts-form-group:last-child {
  margin-bottom: 0;
}

.tts-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-bottom: 0.5rem;
}

/* Voice Selection Button */
.voice-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: hsl(var(--secondary));
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.voice-select-trigger:hover {
  border-color: hsl(var(--ring));
  background: hsl(var(--secondary) / 0.8);
}

.voice-select-trigger .voice-avatar {
  width: 40px;
  height: 40px;
  border-radius: 0.5rem;
  object-fit: cover;
  border: 2px solid hsl(var(--border));
}

.voice-select-trigger .voice-info {
  flex: 1;
  text-align: left;
}

.voice-select-trigger .voice-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: hsl(var(--foreground));
}

.voice-select-trigger .voice-accent {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}

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

/* Text Input */
.text-input-wrapper {
  position: relative;
}

.tts-textarea {
  width: 100%;
  min-height: 150px;
  padding: 1rem;
  padding-bottom: 2.5rem;
  background: hsl(var(--secondary));
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.6;
  color: hsl(var(--foreground));
  resize: vertical;
  transition: border-color 0.2s ease;
}

.tts-textarea:focus {
  outline: none;
  border-color: hsl(var(--ring));
}

.tts-textarea::placeholder {
  color: hsl(var(--muted-foreground));
}

.char-counter {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--secondary));
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

.char-counter.warning {
  color: hsl(38, 92%, 50%);
}

.char-counter.error {
  color: hsl(var(--destructive));
}

/* Speed Control */
.speed-control {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.speed-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: hsl(var(--border));
  border-radius: 3px;
  cursor: pointer;
}

.speed-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: hsl(var(--primary));
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.speed-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.speed-value {
  min-width: 50px;
  text-align: center;
  font-weight: 600;
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  background: hsl(var(--secondary));
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

/* Generate Button */
.generate-section {
  margin-top: 1.5rem;
}

.generate-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-size: 1rem;
  font-weight: 600;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.generate-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px hsl(var(--primary) / 0.3);
}

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

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

.generate-btn .spinner {
  animation: spin 1s linear infinite;
}

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

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

/* Cooldown Timer */
.cooldown-display {
  text-align: center;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.cooldown-display .cooldown-time {
  font-weight: 600;
  color: hsl(var(--foreground));
}

/* Queue Status */
.queue-status {
  text-align: center;
  padding: 1rem;
  background: hsl(var(--secondary));
  border-radius: 0.75rem;
  margin-top: 1.5rem;
}

.queue-status p {
  font-size: 0.9375rem;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.5rem;
}

.queue-status .queue-position {
  font-size: 1.5rem;
  font-weight: 700;
  color: hsl(var(--foreground));
}

/* Audio Player */
.audio-player-section {
  margin-top: 2rem;
  padding: 1.5rem;
  background: hsl(var(--secondary));
  border-radius: 1rem;
  display: none;
}

.audio-player-section.visible {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

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

.waveform-container {
  min-height: 80px;
  border-radius: 0.5rem;
  overflow: hidden;
  margin-bottom: 1rem;
}

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

.audio-controls-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.play-pause-btn {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.play-pause-btn:hover {
  transform: scale(1.05);
}

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

.download-btn {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: hsl(var(--primary));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--primary-foreground));
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.download-btn:hover {
  background: hsl(var(--primary-foreground));
  color: hsl(var(--primary));
}

/* Voice Selection Modal */
.voice-modal-overlay {
  position: fixed;
  inset: 0;
  background: hsl(0 0% 0% / 0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.voice-modal-overlay.active {
  display: flex;
}

.voice-modal {
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  background: hsl(var(--card));
  border-radius: 1.5rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@media (max-width: 640px) {
  .voice-modal {
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
  }
}

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

.voice-modal-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

.voice-modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--muted-foreground));
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

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

.voice-modal-search {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid hsl(var(--border));
}

.voice-search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: hsl(var(--secondary));
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  color: hsl(var(--foreground));
  transition: border-color 0.2s ease;
}

.voice-search-input:focus {
  outline: none;
  border-color: hsl(var(--ring));
}

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

.voice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.voice-card {
  padding: 1rem;
  background: hsl(var(--secondary));
  border: 2px solid transparent;
  border-radius: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.voice-card:hover {
  border-color: hsl(var(--border));
  transform: translateY(-2px);
}

.voice-card.selected {
  border-color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.1);
}

.voice-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.voice-card .avatar {
  width: 48px;
  height: 48px;
  border-radius: 0.75rem;
  object-fit: cover;
  border: 2px solid hsl(var(--border));
}

.voice-card .voice-meta {
  flex: 1;
  min-width: 0;
}

.voice-card .voice-meta h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-bottom: 0.125rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.voice-card .voice-meta span {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}

.voice-card .preview-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 50%;
  color: hsl(var(--muted-foreground));
  transition: all 0.2s ease;
}

.voice-card .preview-btn:hover {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
}

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

/* Tags */
.voice-tags {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.voice-tag {
  font-size: 0.6875rem;
  padding: 0.25rem 0.5rem;
  background: hsl(var(--card));
  border-radius: 1rem;
  color: hsl(var(--muted-foreground));
  text-transform: capitalize;
}

/* Nudge Popup Overlay */
.nudge-overlay {
  position: fixed;
  inset: 0;
  background: hsl(0 0% 0% / 0.6);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.nudge-overlay.active {
  display: flex;
}

.nudge-popup {
  width: 100%;
  max-width: 420px;
  background: hsl(var(--card));
  border-radius: 1.5rem;
  padding: 2rem;
  text-align: center;
  animation: popIn 0.3s ease-out;
  position: relative;
  overflow: hidden;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.nudge-popup::before {
  display: none;
}

.nudge-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--muted-foreground));
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  z-index: 1;
}

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

.nudge-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(var(--primary));
  border-radius: 1rem;
  color: hsl(var(--primary-foreground));
  position: relative;
}

.nudge-popup h3 {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  position: relative;
}

.nudge-popup .description {
  color: hsl(var(--muted-foreground));
  margin-bottom: 1.5rem;
  line-height: 1.5;
  position: relative;
}

.nudge-benefits {
  text-align: left;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: hsl(var(--secondary));
  border-radius: 0.75rem;
  position: relative;
}

.nudge-benefits li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0;
  font-size: 0.9375rem;
  color: hsl(var(--foreground));
}

.nudge-benefits li svg {
  flex-shrink: 0;
  color: hsl(var(--primary));
}

.nudge-popup .btn-signup {
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-weight: 600;
  font-size: 1rem;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 0.75rem;
  position: relative;
}

.nudge-popup .btn-signup:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px hsl(var(--primary) / 0.3);
}

.nudge-popup .btn-continue {
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  cursor: pointer;
  transition: color 0.2s ease;
  position: relative;
}

.nudge-popup .btn-continue:hover {
  color: hsl(var(--foreground));
}

/* Limit Reached Variant */
.nudge-popup.limit-reached .nudge-icon {
  background: hsl(var(--primary));
}

/* Error State */
.error-message {
  padding: 1rem;
  background: hsl(var(--destructive) / 0.1);
  border: 1px solid hsl(var(--destructive) / 0.3);
  border-radius: 0.75rem;
  color: hsl(var(--destructive));
  text-align: center;
  margin-top: 1rem;
  font-size: 0.9375rem;
}

/* CTA Section */
.free-tts-cta {
  margin-top: 4rem;
  text-align: center;
}

.free-tts-cta h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.free-tts-cta p {
  color: hsl(var(--muted-foreground));
  margin-bottom: 1.5rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.free-tts-cta .cta-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Loading skeleton */
.voice-skeleton {
  background: linear-gradient(90deg, hsl(var(--secondary)) 0%, hsl(var(--border)) 50%, hsl(var(--secondary)) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 1rem;
  height: 100px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Responsive */
@media (max-width: 640px) {
  .free-tts-page {
    padding-top: 7rem;
  }

  .free-tts-header h1 {
    font-size: 1.875rem;
  }

  .free-tts-card {
    padding: 1.5rem;
    border-radius: 1rem;
  }

  .usage-stats {
    gap: 0.75rem;
  }

  .usage-stat {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
  }

  .logged-in-banner {
    flex-direction: column;
    text-align: center;
  }

  .logged-in-banner-actions {
    width: 100%;
    justify-content: center;
  }

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

/* Signup Teaser Card */
.voice-card.signup-teaser {
  background: linear-gradient(135deg, hsl(var(--card)) 0%, hsl(var(--secondary)) 100%);
  border: 1px dashed hsl(var(--border));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.voice-card.signup-teaser:hover {
  border-color: hsl(var(--primary));
  transform: translateY(-2px);
}

.voice-card.signup-teaser .avatar-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 0.75rem;
  background: hsl(var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--muted-foreground));
  border: 1px solid hsl(var(--border));
}

.voice-card.signup-teaser .signup-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, hsl(var(--card)) 0%, transparent 100%);
  opacity: 0.6;
  pointer-events: none;
}

.voice-card.signup-teaser .voice-tag {
  background: linear-gradient(135deg, hsl(270, 60%, 55%) 0%, hsl(243, 75%, 55%) 100%);
  color: white;
  border: none;
}

/* Signup Simple Text */
.voice-signup-text {
  grid-column: 1 / -1;
  text-align: center;
  padding: 1.5rem;
  color: hsl(var(--muted-foreground));
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s ease;
  margin-top: 0.5rem;
}

.voice-signup-text:hover {
  color: hsl(var(--primary));
  text-decoration: underline;
}

/* Signup Simple Text */
.voice-signup-text {
  grid-column: 1 / -1;
  text-align: center;
  padding: 1.5rem;
  color: hsl(var(--muted-foreground));
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s ease;
  margin-top: 0.5rem;
}

.voice-signup-text:hover {
  color: hsl(var(--primary));
  text-decoration: underline;
}
