/* ── Reset y base ──────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-padding-top: 140px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  background: #f0f4f8;
  color: #1a202c;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  margin: 0;
}

/* ── Site navbar (sticky) ──────────────────────────────────────────────────── */
.site-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  z-index: 100;
}

.site-navbar__container {
  max-width: 100%;
  margin: 0;
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 80px;
}

.site-navbar__left {
  flex-shrink: 0;
}

.site-navbar__logo {
  height: 54px;
  width: auto;
}

.site-navbar__center {
  flex: 1;
}

.site-navbar__right {
  flex-shrink: 0;
}

.site-navbar__help {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ff6b4a;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

.site-navbar__help:hover {
  background: #ff5233;
}

/* ── Site header (hero) ────────────────────────────────────────────────────── */
/* Removido - solo navbar */

/* ── Help Modal ────────────────────────────────────────────────────────────── */
.help-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.help-modal.hidden {
  display: none;
}

.help-modal__content {
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  position: relative;
}

.help-modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #a0aec0;
  transition: color 0.15s;
}

.help-modal__close:hover {
  color: #4a5568;
}

.help-modal__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1a202c;
  margin-bottom: 1rem;
  margin-top: 0.5rem;
}

.help-modal__steps {
  list-style: none;
  counter-reset: steps;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.help-modal__steps li {
  counter-increment: steps;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: #4a5568;
  line-height: 1.5;
}

.help-modal__steps li::before {
  content: counter(steps);
  background: #e9d8fd;
  color: #6b46c1;
  font-weight: 700;
  font-size: 0.75rem;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Tarjeta central ───────────────────────────────────────────────────────── */
main {
  margin-top: 100px;
  padding: 2rem 1rem;
}

.card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 680px;
}

.card__header {
  margin-bottom: 2rem;
  text-align: center;
}

.card__header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1a202c;
  letter-spacing: -0.5px;
}

.card__subtitle {
  margin-top: 0.4rem;
  color: #718096;
  font-size: 0.95rem;
}

/* ── Formulario ────────────────────────────────────────────────────────────── */
.form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form__group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.form__label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #4a5568;
}

.form__input,
.form__select {
  padding: 0.65rem 0.9rem;
  border: 1.5px solid #cbd5e0;
  border-radius: 8px;
  font-size: 0.95rem;
  color: #1a202c;
  background: #f7fafc;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

.form__input:focus,
.form__select:focus {
  outline: none;
  border-color: #4299e1;
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.2);
  background: #fff;
}

.form__row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}

.form__arrow {
  font-size: 1.5rem;
  color: #a0aec0;
  padding-bottom: 0.5rem;
  flex-shrink: 0;
}

/* ── Botones ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, transform 0.1s, opacity 0.2s;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: #ff6b4a;
  color: #fff;
  width: 100%;
  margin-top: 0.5rem;
}

.btn--primary:hover:not(:disabled) {
  background: #ff5233;
}

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

.btn--success {
  background: #ff6b4a;
  color: #fff;
  margin-top: 1rem;
  width: 100%;
}

.btn--success:hover {
  background: #ff5233;
}

/* ── Caja de estado / logs ─────────────────────────────────────────────────── */
.status-box {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.6;
  border-left: 4px solid #4299e1;
  background: #ebf8ff;
  color: #2c5282;
}

.status-box.status--error {
  border-left-color: #fc8181;
  background: #fff5f5;
  color: #9b2c2c;
}

.status-box.status--success {
  border-left-color: #68d391;
  background: #f0fff4;
  color: #276749;
}

/* ── Preview ───────────────────────────────────────────────────────────────── */
.preview-section {
  margin-top: 1.75rem;
}

.preview-section__title {
  font-size: 1rem;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 0.75rem;
}

.editor-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.editor-header .preview-section__title {
  margin-bottom: 0;
}

.editor-hint {
  font-size: 0.8rem;
  color: #718096;
}

.preview-content {
  background: #1a202c;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  width: 100%;
  min-height: 280px;
  max-height: 480px;
  resize: vertical;
  border: 1.5px solid #2d3748;
  outline: none;
  box-sizing: border-box;
}

.preview-content:focus {
  border-color: #4a5568;
  box-shadow: 0 0 0 2px rgba(74,85,104,0.25);
}

/* ── TTS ───────────────────────────────────────────────────────────────────── */
.tts-section {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Fila voz + botón demo */
.voice-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.voice-row .form__select {
  flex: 1;
}

.btn--demo {
  background: #2b6cb0;
  color: #fff;
  white-space: nowrap;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
}

.btn--demo:hover:not(:disabled) {
  background: #2c5282;
}

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

.demo-player {
  margin-top: 0.4rem;
}

.demo-player audio {
  width: 100%;
  border-radius: 8px;
}

.btn--tts {
  background: #ff6b4a;
  color: #fff;
  width: 100%;
}

.btn--tts:hover:not(:disabled) {
  background: #ff5233;
}

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

.audio-player {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.audio-player audio {
  width: 100%;
  border-radius: 8px;
}

/* ── Historial ─────────────────────────────────────────────────────────────── */
.history-card {
  margin-top: 1.5rem;
}

.history-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a202c;
  margin-bottom: 1rem;
}

.history-empty {
  color: #a0aec0;
  font-size: 0.9rem;
}

.history-entry {
  border-bottom: 1px solid #e2e8f0;
  padding: 0.75rem 0;
}

.history-entry:last-child {
  border-bottom: none;
}

.history-entry__key {
  font-size: 0.8rem;
  color: #718096;
  font-family: 'SFMono-Regular', 'Consolas', monospace;
  margin-bottom: 0.4rem;
}

.history-entry__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn--history-vtt {
  background: #ff6b4a;
  color: #fff;
  font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.15s;
}

.btn--history-vtt:hover {
  background: #ff5233;
}

.btn--history-mp3 {
  background: #ff6b4a;
  color: #fff;
  font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.15s;
}

.btn--history-mp3:hover {
  background: #ff5233;
}

/* ── Utilidades ────────────────────────────────────────────────────────────── */
.hidden {
  display: none !important;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
  .card {
    padding: 1.75rem 1.25rem;
  }

  .card__header h1 {
    font-size: 1.4rem;
  }

  .form__row {
    flex-direction: column;
  }

  .form__arrow {
    display: none;
  }
}
