/* ============================================================
   VozLab - Dark Theme CSS
   ============================================================ */

*,*::before,*::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background: #0a0a0a;
  color: #f5f5f5;
  font: 15px/1.6 'Inter', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   HEADER / TOP BAR
   ============================================================ */

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: #111;
  border-bottom: 1px solid #222;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
}

.brand-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand-logo {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #22c55e;
}

.brand-tagline {
  font-size: 12px;
  color: #666;
  font-weight: 400;
  letter-spacing: 0;
}

@media (max-width: 480px) {
  .brand-tagline { display: none; }
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.auth-btns {
  display: flex;
  gap: 8px;
}

.user-area {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-name {
  font-size: 13px;
  color: #999;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn-ghost {
  box-sizing: border-box; border: none; background: none; font: inherit; text-decoration: none;
  cursor: pointer;
  padding: 8px 16px;
  border: 1px solid #333;
  border-radius: 6px;
  font-size: 13px;
  color: #ccc;
  background: transparent;
  transition: border-color .2s, color .2s, background .2s;
  white-space: nowrap;
}

.btn-ghost:hover {
  border-color: #555;
  color: #f5f5f5;
  background: #1a1a1a;
}

.btn-primary {
  display: inline-block;
  box-sizing: border-box;
  cursor: pointer;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: #22c55e;
  transition: background .2s;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}

.btn-primary:hover {
  background: #16a34a;
}

.btn-full {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  text-align: center;
  padding: 12px 16px;
  font-size: 15px;
}

/* ============================================================
   CREDITS BADGE
   ============================================================ */

.credits-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 20px;
  background: #0f2e1a;
  border: 1px solid #22c55e;
  color: #22c55e;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: background .2s;
}

.credits-badge:hover {
  background: #163d22;
}

.credits-icon {
  font-size: 10px;
}

.credits-label {
  font-size: 11px;
  color: #4ade80;
  font-weight: 400;
}

.credits-badge.low {
  background: #2e0f0f;
  border-color: #ef4444;
  color: #ef4444;
  animation: pulse 2s ease-in-out infinite;
}

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

/* ============================================================
   MAIN PAGE LAYOUT
   ============================================================ */

.page-main {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* ============================================================
   HERO
   ============================================================ */

.hero {
  text-align: center;
  padding: 56px 20px 40px;
}

.hero-title {
  font-size: clamp(26px, 5vw, 42px);
  font-weight: 800;
  margin: 0 0 16px;
  letter-spacing: -0.5px;
  line-height: 1.2;
  color: #f5f5f5;
}

.hero-sub {
  font-size: 16px;
  color: #888;
  margin: 0;
  max-width: 560px;
  margin-inline: auto;
  line-height: 1.6;
}

/* ============================================================
   TTS SECTION
   ============================================================ */

.tts-section {
  margin-bottom: 48px;
}

.tts-panel {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* TEXTAREA */

.tts-input-wrap {
  position: relative;
}

.tts-textarea {
  width: 100%;
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  color: #f5f5f5;
  font: 15px/1.6 'Inter', system-ui, sans-serif;
  padding: 14px 16px 36px;
  resize: vertical;
  min-height: 180px;
  outline: none;
  transition: border-color .2s;
}

.tts-textarea:focus {
  border-color: #22c55e;
}

.tts-textarea::placeholder {
  color: #444;
}

.char-counter {
  position: absolute;
  bottom: 10px;
  right: 14px;
  font-size: 12px;
  color: #555;
  pointer-events: none;
  transition: color .2s;
}

.char-counter.warn {
  color: #f97316;
}

.char-counter.danger {
  color: #ef4444;
  font-weight: 600;
}

/* CONTROLS */

.tts-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .tts-controls {
    grid-template-columns: 1fr;
  }
}

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

.ctrl-label {
  font-size: 12px;
  color: #888;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.ctrl-select {
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  color: #f5f5f5;
  font: inherit;
  padding: 9px 32px 9px 12px;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  transition: border-color .2s;
}

.ctrl-select:focus {
  border-color: #22c55e;
}

.ctrl-range {
  width: 100%;
  accent-color: #22c55e;
  cursor: pointer;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #555;
  margin-top: -4px;
}

/* GENERATE BUTTON */

.btn-generate {
  box-sizing: border-box; border: none; background: none; font: inherit; text-decoration: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 15px;
  background: #22c55e;
  border-radius: 8px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.3px;
  transition: background .2s, transform .1s;
}

.btn-generate:hover:not(:disabled) {
  background: #16a34a;
}

.btn-generate:active:not(:disabled) {
  transform: scale(0.99);
}

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

/* SPINNER */

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

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

/* ALERT */

.alert-warn {
  padding: 12px 16px;
  background: #1a1200;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  color: #fbbf24;
  font-size: 13px;
}

.alert-warn a {
  color: #22c55e;
  font-weight: 600;
}

/* AUDIO RESULT */

.audio-result {
  background: #1a1a1a;
  border: 1px solid #22c55e44;
  border-radius: 10px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.audio-meta {
  font-size: 13px;
  color: #ccc;
  font-weight: 500;
}

.audio-player {
  width: 100%;
  height: 48px;
  border-radius: 8px;
  outline: none;
  filter: invert(1);
}

audio::-webkit-media-controls-panel {
  background: #fff;
}

.audio-actions {
  display: flex;
  gap: 10px;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: #22c55e;
  border: none;
  border-radius: 6px;
  color: #000;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: background .2s;
}

.btn-download:hover {
  background: #16a34a;
}

.btn-download::before {
  content: '↓';
  font-size: 14px;
}

/* ============================================================
   SECTION HEADERS
   ============================================================ */

.section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
}

.section-header.centered {
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  color: #f0f0f0;
}

.section-meta {
  font-size: 12px;
  color: #555;
}

.section-sub {
  font-size: 14px;
  color: #888;
  margin: 4px 0 0;
}

/* ============================================================
   HISTORY
   ============================================================ */

.history-section {
  margin-bottom: 48px;
}

.history-empty {
  text-align: center;
  padding: 32px 20px;
  color: #444;
  font-size: 14px;
  background: #111;
  border: 1px solid #1e1e1e;
  border-radius: 8px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 14px 16px;
  transition: border-color .2s;
}

.history-item:hover {
  border-color: #3a3a3a;
}

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

.history-preview {
  font-size: 14px;
  color: #ccc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.history-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.history-tag {
  font-size: 11px;
  color: #555;
  background: #111;
  border: 1px solid #222;
  border-radius: 4px;
  padding: 2px 6px;
}

.history-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.history-btn {
  box-sizing: border-box; border: none; background: none; font: inherit; text-decoration: none;
  cursor: pointer;
  padding: 6px 12px;
  border: 1px solid #2a2a2a;
  border-radius: 5px;
  font-size: 12px;
  color: #888;
  background: transparent;
  transition: border-color .2s, color .2s;
  white-space: nowrap;
}

.history-btn:hover {
  border-color: #444;
  color: #ccc;
}

.history-btn.danger:hover {
  border-color: #ef4444;
  color: #ef4444;
}

@media (max-width: 600px) {
  .history-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .history-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ============================================================
   PRICING / PACKS
   ============================================================ */

.pricing-section {
  margin-bottom: 60px;
}

.packs-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 900px) {
  .packs-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .packs-grid {
    grid-template-columns: 1fr;
  }
}

.pack-card {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  transition: border-color .2s, transform .2s;
}

.pack-card:hover {
  border-color: #3a3a3a;
  transform: translateY(-2px);
}

.pack-card.pack-popular {
  border-color: #22c55e;
  background: #0d2318;
}

.pack-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: #22c55e;
  color: #0a0a0a;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 10px;
  white-space: nowrap;
}

.pack-name {
  font-size: 16px;
  font-weight: 700;
  color: #f0f0f0;
  margin-top: 8px;
}

.pack-price {
  font-size: 28px;
  font-weight: 800;
  color: #22c55e;
  line-height: 1;
}

.pack-chars {
  font-size: 13px;
  color: #888;
}

.pack-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.pack-features li {
  font-size: 13px;
  color: #777;
  padding-left: 16px;
  position: relative;
}

.pack-features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #22c55e;
  font-size: 11px;
}

.btn-pack {
  box-sizing: border-box; border: none; background: none; font: inherit; text-decoration: none;
  cursor: pointer;
  display: block;
  width: 100%;
  text-align: center;
  padding: 11px;
  background: transparent;
  border: 1px solid #333;
  border-radius: 6px;
  color: #ccc;
  font-size: 14px;
  font-weight: 600;
  transition: background .2s, border-color .2s, color .2s;
  margin-top: auto;
}

.btn-pack:hover {
  background: #22c55e;
  border-color: #22c55e;
  color: #fff;
}

.pack-popular .btn-pack {
  background: #22c55e;
  border-color: #22c55e;
  color: #fff;
}

.pack-popular .btn-pack:hover {
  background: #16a34a;
  border-color: #16a34a;
}

/* ============================================================
   FOOTER
   ============================================================ */

/* USP ROW */
.usp-row {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin: -8px auto 20px;
  max-width: 600px;
  flex-wrap: wrap;
}
.usp-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #999;
}
.usp-icon { font-size: 18px; }
.usp-text { white-space: nowrap; }
@media (max-width: 500px) {
  .usp-row { gap: 12px; }
  .usp-item { font-size: 12px; }
}

/* REFERRAL BANNER */
.referral-banner {
  background: linear-gradient(135deg, #0d2318, #111);
  border: 1px solid #22c55e33;
  border-radius: 10px;
  margin: 0 auto 20px;
  max-width: 720px;
  overflow: hidden;
}
.referral-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
}
.referral-icon { font-size: 28px; flex-shrink: 0; }
.referral-text { flex: 1; }
.referral-text strong { display: block; color: #4ade80; font-size: 14px; margin-bottom: 2px; }
.referral-text span { font-size: 12px; color: #888; }
.referral-copy-btn {
  box-sizing: border-box;
  border: 1px solid #22c55e;
  background: transparent;
  color: #22c55e;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .2s;
}
.referral-copy-btn:hover { background: #22c55e; color: #000; }
@media (max-width: 600px) {
  .referral-inner { flex-wrap: wrap; }
  .referral-copy-btn { width: 100%; text-align: center; }
}

/* REFERRAL PANEL */
.referral-panel {
  max-width: 720px;
  margin: 0 auto 32px;
  padding: 0 16px;
}
.referral-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.ref-stat {
  background: #1a1a1a;
  border: 1px solid #222;
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}
.ref-stat-val { font-size: 22px; font-weight: 700; color: #22c55e; }
.ref-stat-label { font-size: 11px; color: #888; margin-top: 2px; }
.referral-link-box {
  background: #1a1a1a;
  border: 1px solid #222;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}
.referral-history { }
.ref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #1a1a1a;
  border: 1px solid #222;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 13px;
}
.ref-row-user { color: #ccc; }
.ref-row-credits { color: #22c55e; font-weight: 600; }
.ref-row-date { color: #666; font-size: 11px; }

/* WHATSAPP FLOAT */
.wa-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 90;
  width: 56px;
  height: 56px;
  background: #25d366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(37,211,102,.4);
  transition: transform .2s, box-shadow .2s;
  text-decoration: none;
}
.wa-float:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(37,211,102,.6);
}
@media (max-width: 600px) {
  .wa-float { bottom: 16px; right: 16px; width: 50px; height: 50px; }
}

.site-footer {
  background: #111;
  border-top: 1px solid #1e1e1e;
  padding: 28px 24px;
  margin-top: auto;
}

.footer-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.footer-brand {
  font-size: 16px;
  font-weight: 800;
  color: #22c55e;
}

.footer-nav {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-nav a {
  font-size: 13px;
  color: #555;
  text-decoration: none;
  transition: color .2s;
}

.footer-nav a:hover {
  color: #ccc;
}

.footer-copy {
  font-size: 12px;
  color: #444;
  margin: 0;
}

/* ============================================================
   MODALS
   ============================================================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
}

.modal-panel {
  position: relative;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  width: min(92vw, 420px);
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1;
  animation: slideUp .2s ease;
}

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

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-head strong {
  font-size: 17px;
  color: #f0f0f0;
}

.modal-close {
  box-sizing: border-box; border: none; background: none; font: inherit; text-decoration: none;
  cursor: pointer;
  font-size: 22px;
  color: #555;
  line-height: 1;
  transition: color .2s;
}

.modal-close:hover {
  color: #f5f5f5;
}

.modal-body {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* AUTH TABS */

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #111;
  border-radius: 8px;
  padding: 4px;
  gap: 4px;
}

.auth-tab {
  box-sizing: border-box;
  border: none;
  background: none;
  cursor: pointer;
  text-align: center;
  padding: 9px;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  transition: color .2s, background .2s;
}

.auth-tab.active {
  background: #1a1a1a;
  color: #f0f0f0;
}

/* AUTH FORM */

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field > span {
  font-size: 12px;
  color: #777;
  font-weight: 500;
}

.form-field input {
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  color: #f5f5f5;
  font: inherit;
  padding: 10px 12px;
  outline: none;
  transition: border-color .2s;
  width: 100%;
}

.form-field input:focus {
  border-color: #22c55e;
}

.form-field input::placeholder {
  color: #3a3a3a;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #555;
  font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #2a2a2a;
}
.google-signin-wrap {
  display: flex;
  justify-content: center;
  min-height: 44px;
}

.form-error {
  font-size: 13px;
  color: #ef4444;
  background: #1a0a0a;
  border: 1px solid #3a1212;
  border-radius: 6px;
  padding: 10px 12px;
}

.turnstile-wrap {
  gap: 8px;
}

.turnstile-box {
  min-height: 65px;
  display: flex;
  align-items: center;
}

.turnstile-status {
  font-size: 12px;
  color: #555;
}

.auth-hint {
  font-size: 13px;
  color: #555;
  text-align: center;
  padding: 10px;
  background: #0d2318;
  border: 1px solid #1a3a24;
  border-radius: 6px;
  line-height: 1.5;
}

.auth-hint strong {
  color: #22c55e;
}

/* ============================================================
   TOAST NOTIFICATION
   ============================================================ */

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e3a2e;
  border: 1px solid #22c55e;
  border-radius: 8px;
  color: #4ade80;
  font-size: 14px;
  font-weight: 500;
  padding: 13px 22px;
  z-index: 300;
  white-space: nowrap;
  max-width: 90vw;
  text-align: center;
  animation: toastIn .3s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.toast.error {
  background: #2e1e1e;
  border-color: #ef4444;
  color: #f87171;
}

@keyframes toastIn {
  from { transform: translateX(-50%) translateY(12px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #111;
}

::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #444;
}

/* ============================================================
   UTILITIES
   ============================================================ */

.text-green { color: #22c55e; }
.text-muted  { color: #666; }
