/* ============================================
   VARIABLES — Paleta de colores y tipografía
   Consistente con el landing page
   ============================================ */
:root {
  --navy: #1A3A5C;
  --blue: #2E9BDA;
  --gold: #E8A020;
  --white: #FFFFFF;
  --gray-lt: #F4F6F8;
  --gray: #8A9BB0;
  --error: #EF4444;
  --success: #22C55E;
  --font: 'Inter', sans-serif;
  --max-width: 480px;
}

/* ============================================
   RESET — Normaliza márgenes y box-sizing
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ============================================
   BODY — Fondo blanco, texto navy, centrado
   ============================================ */
body {
  font-family: var(--font);
  font-size: 16px;
  color: var(--navy);
  background:
    radial-gradient(ellipse at top right, rgba(46, 155, 218, 0.15), transparent 50%),
    radial-gradient(ellipse at bottom left, rgba(232, 160, 32, 0.1), transparent 50%),
    var(--white);
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

/* ============================================
   CONTENEDOR — Limita el ancho a 480px
   Se comporta como app móvil en escritorio
   ============================================ */
.app-container {
  width: 100%;
  max-width: var(--max-width);
  min-height: 100vh;
  padding: 24px 20px;
  position: relative;
}

/* ============================================
   PANTALLAS — Solo una visible a la vez
   Cada pantalla es un div con clase .screen
   La clase .active controla cuál se muestra
   ============================================ */
.screen {
  display: none;
  width: 100%;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* ============================================
   BOTÓN PRINCIPAL — Fondo navy, texto blanco
   Forma pill (bordes redondeados)
   ============================================ */
.btn-primary {
  background-color: var(--navy);
  color: var(--white);
  border: none;
  border-radius: 100px;
  padding: 14px 32px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: opacity 0.2s;
}

.btn-primary:hover {
  opacity: 0.9;
}

/* ============================================
   BOTÓN SECUNDARIO — Borde navy, fondo transparente
   Forma pill (bordes redondeados)
   ============================================ */
.btn-secondary {
  background-color: transparent;
  color: var(--navy);
  border: 2px solid var(--navy);
  border-radius: 100px;
  padding: 12px 32px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: opacity 0.2s;
}

.btn-secondary:hover {
  opacity: 0.8;
}

/* ============================================
   CAMPOS DE TEXTO — Fondo gris claro, borde azul al enfocar
   ============================================ */
.input-field {
  width: 100%;
  padding: 14px 16px;
  font-family: var(--font);
  font-size: 16px;
  color: var(--navy);
  background-color: var(--gray-lt);
  border: 1px solid transparent;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}

.input-field:focus {
  border-color: var(--blue);
}

.input-field::placeholder {
  color: var(--gray);
}

/* ============================================
   MENSAJES DE ERROR — Texto rojo, oculto por defecto
   Agregar clase .visible para mostrarlo
   ============================================ */
.error-message {
  color: var(--error);
  font-size: 14px;
  font-weight: 500;
  margin-top: 8px;
  display: none;
}

.error-message.visible {
  display: block;
}

/* ============================================
   NOMBRE DE MARCA — Placeholder para logo futuro
   ============================================ */
/* Logo de la marca — al lado del nombre, centrados juntos */
.brand-logo {
  width: 120px;
  height: auto;
  vertical-align: middle;
  margin-right: -20px;
}

.brand-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  text-align: center;
}

/* ============================================
   ESTILOS POR PANTALLA
   Se llenarán conforme se construya cada pantalla
   ============================================ */

/* --- Login --- */

/* Contenedor de marca — centrado con espacio generoso arriba */
.login-brand {
  margin-top: 80px;
  margin-bottom: 48px;
  text-align: center;
  margin-left: -55px;
}

/* Formulario — campos apilados con espacio entre ellos */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* --- Home --- */

/* Barra superior — atrás, nombre, selector mic en una línea */
.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  margin-left: -120px;
  margin-right: -120px;
  margin-bottom: 32px;
}

/* Botón ← genérico — se reutiliza en otras pantallas */
.btn-back {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--navy);
  cursor: pointer;
  padding: 4px 8px;
  font-family: var(--font);
}

/* Nombre del terapeuta en el header */
.home-therapist-name {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 16px;
  font-weight: 600;
  color: var(--navy);
}

/* Selector de micrófono — dropdown pequeño */
.mic-selector {
  font-family: var(--font);
  font-size: 13px;
  color: var(--navy);
  background-color: var(--gray-lt);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 10px;
  max-width: 160px;
  cursor: pointer;
  outline: none;
}

/* Panel de Home — contenedor para mic o grabando */
.home-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

/* Contenedor del botón micrófono — centrado */
.mic-button-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 40px;
}

/* Botón micrófono — circular grande con borde navy */
.btn-mic {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid var(--navy);
  background-color: var(--white);
  color: var(--navy);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, color 0.2s;
}

.btn-mic:hover {
  background-color: var(--navy);
  color: var(--white);
}

/* Texto debajo del botón micrófono */
.mic-hint {
  font-size: 14px;
  color: var(--gray);
  margin-top: 12px;
}

/* Barra RMS — contenedor compacto para que el movimiento sea visible */
.rms-bar-container {
  width: 120px;
  height: 6px;
  background-color: var(--gray-lt);
  border-radius: 3px;
  overflow: hidden;
}

/* Barra RMS — nivel de audio verde, ancho controlado por JS */
.rms-bar {
  width: 0%;
  height: 100%;
  background-color: var(--success);
  border-radius: 3px;
  transition: width 0.1s ease;
}

/* Enlace para subir archivo */
.link-upload {
  font-size: 14px;
  color: var(--blue);
  text-decoration: none;
  cursor: pointer;
}

.link-upload:hover {
  text-decoration: underline;
}

/* Selector de enfoque — ancho completo */
.enfoque-selector {
  cursor: pointer;
  width: 80%;
}

/* --- Grabando --- */

/* Indicador de estado: punto rojo + texto "GRABANDO" */
.recording-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 40px;
}

/* Punto rojo que parpadea durante grabación */
.recording-dot {
  color: var(--error);
  font-size: 14px;
  animation: blink 1s infinite;
}

/* Animación de parpadeo del punto rojo */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Punto gris cuando está pausado — sin parpadeo */
.recording-dot.paused {
  color: var(--gray);
  animation: none;
}

/* Texto "GRABANDO" / "PAUSADO" / "DETENIDO" */
#recording-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: 1px;
}

/* Timer MM:SS — grande y centrado */
.recording-timer {
  font-size: 56px;
  font-weight: 700;
  color: var(--navy);
  text-align: center;
  font-variant-numeric: tabular-nums;
  margin: 16px 0;
}

/* Advertencia de cierre accidental */
.recording-warning {
  font-size: 13px;
  color: var(--gray);
  text-align: center;
}

/* Advertencia 90 minutos — naranja, oculta por defecto */
.recording-warning-90min {
  font-size: 13px;
  color: #F59E0B;
  font-weight: 500;
  text-align: center;
  display: none;
}

/* Botones de control (pausa/detener) en línea */
.recording-controls {
  display: flex;
  gap: 12px;
  width: 100%;
}

/* Botones de control — mitad de ancho cada uno */
.btn-control {
  flex: 1;
  padding: 12px 16px;
}

/* Botón detener — borde rojo para distinguirlo */
.btn-stop-recording {
  border-color: var(--error);
  color: var(--error);
}

/* Reproductor de audio — después de detener grabación */
#audio-preview-container {
  width: 100%;
  margin-top: 12px;
}

#audio-preview {
  width: 100%;
  border-radius: 8px;
}

/* Disclaimers de audio — al fondo del panel */
#audio-disclaimers {
  margin-top: auto;
  padding-top: 16px;
}

.audio-disclaimer {
  font-size: 13px;
  color: var(--gray);
  margin: 4px 0 0 0;
  line-height: 1.5;
  text-align: center;
}

.btn-stop-recording:hover {
  background-color: var(--error);
  color: var(--white);
}

/* --- Header genérico de pantallas — botón ← arriba a la izquierda --- */
.screen-header {
  display: flex;
  align-items: center;
  margin-left: -120px;
  margin-bottom: 8px;
}

/* --- Datos de sesión --- */

/* Info del audio — nombre de archivo o duración de grabación */
.data-audio-info {
  font-size: 13px;
  color: var(--blue);
  font-weight: 500;
  margin-top: 8px;
}

/* Título de la pantalla */
.data-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  margin-top: 16px;
  margin-bottom: 24px;
}

/* Formulario — campos apilados */
.data-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Textarea — altura mínima, redimensionable solo vertical */
.data-textarea {
  resize: vertical;
  min-height: 100px;
  font-family: var(--font);
}

/* --- Confirmar --- */

/* Sub-estado dentro de screen-confirm — solo uno visible a la vez */
.confirm-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* El header con botón ← debe alinearse a la izquierda (no centrarse) */
.confirm-state .screen-header {
  width: 100%;
  align-self: flex-start;
}

/* Título de confirmación */
.confirm-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  text-align: center;
  margin-top: 16px;
  margin-bottom: 24px;
}

/* Resumen de datos antes de enviar */
.confirm-summary {
  width: 100%;
  background-color: var(--gray-lt);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
}

/* Cada línea del resumen */
.confirm-detail {
  font-size: 14px;
  color: var(--navy);
  margin-bottom: 8px;
}

.confirm-detail:last-child {
  margin-bottom: 0;
}

/* Etiqueta en negrita */
.confirm-label {
  font-weight: 600;
}

/* Barra de progreso — contenedor */
.progress-bar-container {
  width: 100%;
  height: 8px;
  background-color: var(--gray-lt);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

/* Barra de progreso — relleno azul */
.progress-bar {
  width: 0%;
  height: 100%;
  background-color: var(--blue);
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Porcentaje debajo de la barra */
.progress-percent {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  text-align: center;
  margin-bottom: 8px;
}

/* Texto de ayuda (hint) */
.confirm-hint {
  font-size: 14px;
  color: var(--gray);
  text-align: center;
  margin-bottom: 24px;
}

/* Ícono de éxito — check verde grande */
.confirm-success-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background-color: var(--success);
  color: var(--white);
  font-size: 40px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 40px;
}

/* Texto de error en confirmación */
.confirm-error-text {
  font-size: 16px;
  font-weight: 500;
  color: var(--error);
  text-align: center;
  margin-top: 40px;
  margin-bottom: 24px;
}

/* Botones de error — apilados con espacio */
.confirm-error-buttons {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ============================================
   USER SETTINGS — Botón flotante + menú + modal
   Estilos para el sistema de configuración
   ============================================ */

/* Botón de engranaje — fijo abajo a la derecha de la ventana */
.settings-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background-color: var(--navy);
  color: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: opacity 0.2s;
  z-index: 100;
}

.settings-btn:hover {
  opacity: 0.9;
}

/* Menú desplegable — encima del botón */
.settings-menu {
  position: fixed;
  bottom: 80px;
  right: 24px;
  background-color: var(--white);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  z-index: 101;
}

/* Opción del menú */
.settings-menu-item {
  display: block;
  width: 100%;
  padding: 12px 20px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  color: var(--navy);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}

.settings-menu-item:hover {
  background-color: var(--gray-lt);
}

a.settings-menu-item {
  text-decoration: none;
  color: var(--navy);
}

/* Overlay oscuro detrás del modal */
.settings-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 200;
}

/* Modal de cambio de contraseña */
.settings-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 360px;
  background-color: var(--white);
  border-radius: 12px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  z-index: 201;
}

/* Título del modal */
.settings-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  text-align: center;
  margin-bottom: 4px;
}

/* Mensaje de éxito dentro del modal */
.settings-success-message {
  color: var(--success);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  display: none;
}

.settings-success-message.visible {
  display: block;
}

/* Botón cancelar — texto simple */
.settings-cancel-btn {
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  color: var(--gray);
  cursor: pointer;
  padding: 8px;
  text-align: center;
}

.settings-cancel-btn:hover {
  color: var(--navy);
}

