/* style.css - Diseño móvil de alta gama para el Seguidor de Contracciones */

:root {
  /* Tokens de diseño: Paleta de colores orgánicos y cálidos (Modo Día) */
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  --color-bg-app: #FAF7F2;          /* Crema orgánico suave */
  --color-bg-card: #FFFFFF;         /* Blanco puro */
  --color-primary: #E07A5F;         /* Terracota / Melocotón cálido */
  --color-primary-hover: #C56247;
  --color-primary-light: #FFF4EE;   /* Melocotón translúcido */
  --color-secondary: #81B29A;       /* Verde salvia calmante */
  --color-secondary-light: #EBF4F0;
  --color-accent: #F2CC8F;          /* Ámbar suave */
  --color-accent-light: #FDF7EC;
  
  --color-text-main: #3D405B;       /* Azul pizarra profundo (alto contraste suave) */
  --color-text-muted: #757994;      /* Azul pizarra atenuado */
  
  --color-border: #E8E3D9;          /* Borde sutil */
  --color-grid-line: #EBEBEB;       /* Líneas de gráficos */
  --color-axis: #C7C7CC;
  
  --color-danger: #C94C4C;          /* Rojo terracota para peligro/borrar */
  --color-danger-light: #FCEAEA;
  
  /* Sombras y efectos */
  --shadow-sm: 0 2px 8px rgba(61, 64, 91, 0.05);
  --shadow-md: 0 8px 24px rgba(61, 64, 91, 0.08);
  --shadow-lg: 0 16px 40px rgba(61, 64, 91, 0.12);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 9999px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modo Noche de Parto (Labor Dark Mode): Sin luz azul, tonos rojos/ámbar para proteger la oxitocina */
body.night-mode {
  --color-bg-app: #0F0E0D;          /* Negro carbón ultra oscuro */
  --color-bg-card: #1C1917;         /* Marrón/negro cálido */
  --color-primary: #D95D39;         /* Ámbar/rojo ardiente de bajo estímulo */
  --color-primary-hover: #BF4D2D;
  --color-primary-light: rgba(217, 93, 57, 0.08);
  --color-secondary: #C4914F;       /* Ocre apagado */
  --color-secondary-light: rgba(196, 145, 79, 0.08);
  --color-accent: #A6733C;
  --color-accent-light: rgba(166, 115, 60, 0.08);
  
  --color-text-main: #E2D6CD;       /* Crema bronceado (baja luminosidad) */
  --color-text-muted: #8E8075;      /* Bronce apagado */
  
  --color-border: #2D2722;
  --color-grid-line: #26211D;
  --color-axis: #443B34;
  
  --color-danger: #B53F3F;
  --color-danger-light: rgba(181, 63, 63, 0.1);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.7);
}

/* Reset Básico y Accesibilidad */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
  font-family: var(--font-family);
  background-color: #1A1A1A; /* Fondo de pantalla de escritorio */
  color: var(--color-text-main);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Contenedor tipo simulador móvil (Desktop) / Full Screen (Mobile) */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100dvh; /* Dynamic viewport height para móviles */
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background-color: var(--color-bg-app);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

/* Encabezado */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background-color: rgba(250, 247, 242, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px stroke var(--color-border);
  z-index: 10;
  position: sticky;
  top: 0;
  transition: var(--transition);
}
body.night-mode .app-header {
  background-color: rgba(15, 14, 13, 0.85);
  border-bottom: 1px solid var(--color-border);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-icon {
  font-size: 20px;
}
.logo-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text-main);
  letter-spacing: -0.5px;
}

/* Botones de Iconos */
.icon-button {
  background: none;
  border: none;
  color: var(--color-text-main);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  min-width: 44px;
  min-height: 44px;
}
.icon-button:hover, .icon-button:focus-visible {
  background-color: var(--color-primary-light);
  outline: none;
}
.icon-button svg {
  width: 24px;
  height: 24px;
}

/* Contenido Principal (Scrollable) */
.app-main {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  padding-bottom: 100px; /* Espacio extra para que el scroll no tape la nav bar inferior */
  -webkit-overflow-scrolling: touch;
}

/* Paneles de Pestañas (SPA) */
.tab-pane {
  display: none;
  opacity: 0;
  animation: fadeIn 0.4s ease forwards;
}
.tab-pane.active {
  display: block;
  opacity: 1;
}

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

/* --- ESTILOS DE LA PESTAÑA: TIMER --- */

/* Banner del estado del parto */
.labor-stage-banner {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  transition: var(--transition);
  border: 1px solid rgba(224, 122, 95, 0.15);
}
.labor-stage-banner.latent {
  background-color: var(--color-primary-light);
  border-left: 5px solid var(--color-primary);
}
.labor-stage-banner.active-labor {
  background-color: var(--color-secondary-light);
  border-left: 5px solid var(--color-secondary);
}
.labor-stage-banner.transition {
  background-color: var(--color-accent-light);
  border-left: 5px solid var(--color-accent);
}

.banner-badge {
  display: inline-block;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}
.banner-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}
.banner-desc {
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}
.text-link-btn {
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
  text-decoration: underline;
}
.text-link-btn:hover {
  color: var(--color-primary-hover);
}

/* Carrusel de Afirmaciones */
.affirmation-card {
  background-color: var(--color-bg-card);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  position: relative;
  text-align: center;
  transition: var(--transition);
}
.quote-mark {
  position: absolute;
  top: -8px;
  left: 16px;
  font-size: 40px;
  font-family: Georgia, serif;
  color: var(--color-primary-light);
  line-height: 1;
}
body.night-mode .quote-mark {
  color: rgba(217, 93, 57, 0.15);
}
.affirmation-text {
  font-size: 15px;
  font-style: italic;
  line-height: 1.5;
  color: var(--color-text-main);
  margin-bottom: 8px;
  padding: 0 10px;
}
.next-affirmation-btn {
  background: none;
  border: none;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
}
.next-affirmation-btn:hover {
  background-color: var(--color-primary-light);
}

/* Contenedor central del temporizador */
.timer-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 32px 0;
  position: relative;
}

/* Contador en tiempo real */
.live-interval-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 16px;
  animation: fadeIn 0.3s ease;
}
.live-interval-label {
  font-size: 12px;
  color: var(--color-text-muted);
}
.live-interval-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-secondary);
}

/* Gran botón circular del temporizador */
.timer-button {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  border: 12px solid var(--color-bg-card);
  background-color: var(--color-primary);
  color: #FFFFFF;
  font-family: var(--font-family);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg), 0 0 0 8px rgba(224, 122, 95, 0.15);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  outline: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.timer-button:active {
  transform: scale(0.95);
  box-shadow: var(--shadow-md), 0 0 0 4px rgba(224, 122, 95, 0.1);
}

/* Estado de Temporizador Activo (Pulsando) */
.timer-button.active {
  background-color: var(--color-danger);
  border-color: var(--color-bg-card);
  box-shadow: 0 0 0 12px rgba(201, 76, 76, 0.2), 0 0 30px rgba(201, 76, 76, 0.4);
  animation: pulseTimer 2s infinite;
}

@keyframes pulseTimer {
  0% { transform: scale(1); box-shadow: 0 0 0 0px rgba(201, 76, 76, 0.3), 0 0 15px rgba(201, 76, 76, 0.2); }
  50% { transform: scale(1.02); box-shadow: 0 0 0 15px rgba(201, 76, 76, 0), 0 0 25px rgba(201, 76, 76, 0.4); }
  100% { transform: scale(1); box-shadow: 0 0 0 0px rgba(201, 76, 76, 0), 0 0 15px rgba(201, 76, 76, 0.2); }
}

.timer-btn-label {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.timer-btn-time {
  font-size: 32px;
  font-weight: 700;
  margin-top: 4px;
}
.timer-sub-text {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.8;
  margin-top: 2px;
}

.timer-instruction {
  margin-top: 20px;
  font-size: 13.5px;
  color: var(--color-text-muted);
  text-align: center;
}

/* Guía de Respiración Integrada */
.breathing-widget {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-top: 20px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--transition);
}
.breathing-widget button.secondary-button {
  width: 100%;
  border: none;
  background: none;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-main);
  cursor: pointer;
}
.btn-toggle-icon {
  font-size: 10px;
  transition: var(--transition);
}
.breathing-widget button[aria-expanded="true"] .btn-toggle-icon {
  transform: rotate(180deg);
}

.breathing-visualizer-container {
  padding: 10px 20px 20px 20px;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; max-height: 0; }
  to { opacity: 1; max-height: 300px; }
}

.breathing-status-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-secondary);
  margin-bottom: 16px;
  height: 24px;
}
.breathing-circle-outer {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background-color: var(--color-secondary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.breathing-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: var(--color-secondary);
  opacity: 0.7;
}

/* Animación del círculo de respiración controlado por JS añadiendo clase */
.breathing-circle.inhale {
  animation: inhaleCycle 4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.breathing-circle.exhale {
  animation: exhaleCycle 4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes inhaleCycle {
  from { width: 30px; height: 30px; opacity: 0.5; }
  to { width: 90px; height: 90px; opacity: 0.9; }
}
@keyframes exhaleCycle {
  from { width: 90px; height: 90px; opacity: 0.9; }
  to { width: 30px; height: 30px; opacity: 0.5; }
}

.breathing-instruction {
  font-size: 11.5px;
  color: var(--color-text-muted);
  text-align: center;
  line-height: 1.4;
}



.coping-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.coping-btn {
  background-color: var(--color-bg-app);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: 10px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.coping-btn:hover {
  background-color: var(--color-border);
}
.coping-btn.selected {
  border-color: var(--color-primary);
  background-color: var(--color-primary-light);
}

/* Colores específicos de los botones de coping cuando están seleccionados */
.coping-btn.calm.selected { border-color: var(--color-secondary); background-color: var(--color-secondary-light); }
.coping-btn.focused.selected { border-color: #5887B1; background-color: rgba(88, 135, 177, 0.08); }
.coping-btn.intense.selected { border-color: var(--color-primary); background-color: var(--color-primary-light); }
.coping-btn.overwhelming.selected { border-color: var(--color-danger); background-color: var(--color-danger-light); }

.coping-icon {
  font-size: 22px;
}
.coping-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-main);
}

.coping-note-input {
  margin-bottom: 16px;
}
.coping-note-input input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 14px;
  background-color: var(--color-bg-app);
  color: var(--color-text-main);
}
.coping-note-input input:focus {
  border-color: var(--color-primary);
  outline: none;
}

.coping-actions {
  display: flex;
  gap: 12px;
}
.coping-actions button {
  flex: 1;
}

/* --- ESTILOS DE LA PESTAÑA: HISTORIAL --- */

.pane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.pane-header h2 {
  font-size: 20px;
  font-weight: 700;
}

.compact-btn {
  padding: 8px 14px;
  font-size: 13px;
  min-height: auto;
}

.history-list-wrapper {
  max-height: 48vh;
  overflow-y: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background-color: var(--color-bg-card);
  margin-bottom: 20px;
}

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

/* Items del Historial */
.history-item {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  position: relative;
  transition: var(--transition);
}
.history-item:last-child {
  border-bottom: none;
}

.history-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.history-time-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 500;
}
.history-coping-indicator {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
}
/* Colores de coping en el historial */
.coping-badge-calm { background-color: var(--color-secondary-light); color: var(--color-secondary); }
.coping-badge-focused { background-color: rgba(88, 135, 177, 0.08); color: #5887B1; }
.coping-badge-intense { background-color: var(--color-primary-light); color: var(--color-primary); }
.coping-badge-overwhelming { background-color: var(--color-danger-light); color: var(--color-danger); }

.history-item-middle {
  display: flex;
  gap: 20px;
  margin-bottom: 6px;
}
.history-metric {
  display: flex;
  flex-direction: column;
}
.metric-lbl {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.metric-val {
  font-size: 14.5px;
  font-weight: 700;
}
.metric-val.dur { color: var(--color-primary); }
.metric-val.int { color: var(--color-secondary); }

.history-item-bottom {
  font-size: 12px;
  color: var(--color-text-muted);
  font-style: italic;
  margin-top: 4px;
}

.history-actions {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 4px;
}
.history-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  transition: var(--transition);
  font-size: 12px;
}
.history-action-btn:hover {
  background-color: var(--color-bg-app);
}
.history-action-btn.del:hover {
  color: var(--color-danger);
  background-color: var(--color-danger-light);
}

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 14px;
}

/* Control y gestión de datos */
.data-management-details {
  border: 1px solid var(--color-border);
  background-color: var(--color-bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
}
.data-management-summary {
  padding: 12px 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  outline: none;
}
.data-management-content {
  padding: 16px;
  border-top: 1px solid var(--color-border);
}
.data-mgmt-info {
  font-size: 12px;
  color: var(--color-text-muted);
  line-height: 1.4;
  margin-bottom: 12px;
}
.data-actions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

/* --- ESTILOS DE LA PESTAÑA: ANÁLISIS --- */

.stats-summary-card {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 16px;
  margin-bottom: 16px;
}
.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.stat-label {
  font-size: 11px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.stat-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
}
.stat-box:first-child .stat-value { color: var(--color-secondary); }
.stat-box:last-child .stat-value { color: var(--color-primary); }

.stat-unit {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.diagnostico-detalles {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.diagnostico-titulo {
  font-size: 14px;
  font-weight: 700;
}
.diagnostico-desc {
  font-size: 13px;
  line-height: 1.45;
  color: var(--color-text-muted);
}
.coping-summary {
  font-size: 12px;
  margin-top: 4px;
}

/* Gráficos */
.chart-card {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.chart-title {
  font-size: 14px;
  font-weight: 700;
}
.chart-subtitle {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}
.chart-svg-container {
  height: 180px;
  position: relative;
  width: 100%;
}

.empty-chart-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  text-align: center;
  padding: 20px;
}
.empty-chart-state svg {
  color: var(--color-border);
  margin-bottom: 8px;
}
.empty-chart-state p {
  font-size: 12.5px;
  line-height: 1.4;
}

/* Interactividad de puntos del gráfico */
.chart-interactive-zone {
  cursor: pointer;
}
.chart-point-group:focus {
  outline: none;
}

/* --- ESTILOS DE LA PESTAÑA: GUÍA --- */

.guide-nav {
  display: flex;
  gap: 4px;
  background-color: var(--color-border);
  padding: 4px;
  border-radius: var(--radius-pill);
  margin-bottom: 20px;
  overflow-x: auto;
}
.guide-nav-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 8px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-family);
  color: var(--color-text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.guide-nav-btn.active {
  background-color: var(--color-bg-card);
  color: var(--color-text-main);
  box-shadow: var(--shadow-sm);
}
.guide-nav-btn.warning-tab {
  color: var(--color-danger);
}
.guide-nav-btn.warning-tab.active {
  background-color: var(--color-danger-light);
  color: var(--color-danger);
}

.guide-sub-pane {
  display: none;
  animation: fadeIn 0.3s ease;
}
.guide-sub-pane.active {
  display: block;
}

/* Fases de parto */
.phase-card {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.phase-card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.phase-card-title::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 16px;
  border-radius: 4px;
}
.phase-card.latent .phase-card-title::before { background-color: var(--color-primary); }
.phase-card.active-labor .phase-card-title::before { background-color: var(--color-secondary); }
.phase-card.transition .phase-card-title::before { background-color: var(--color-accent); }

.phase-card-text {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.advice-section {
  border-top: 1px solid var(--color-border);
  padding-top: 10px;
  margin-top: 10px;
}
.advice-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-text-main);
  margin-bottom: 4px;
}
.advice-text {
  font-size: 13px;
  line-height: 1.4;
  color: var(--color-text-muted);
}

/* Posiciones de parto */
.positions-intro {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}
.position-item {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}
.position-icon-box {
  background-color: var(--color-primary-light);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.position-details h4 {
  font-size: 14.5px;
  font-weight: 700;
  margin-bottom: 4px;
}
.position-details p {
  font-size: 13px;
  line-height: 1.4;
  color: var(--color-text-muted);
}

/* Alarmas médicas */
.warning-alert-box {
  background-color: var(--color-danger-light);
  border: 1px solid rgba(201, 76, 76, 0.2);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  color: var(--color-danger);
}
.warning-alert-box h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}
.warning-alert-box p {
  font-size: 12.5px;
  line-height: 1.4;
}

.warning-item {
  background-color: var(--color-bg-card);
  border: 1px dashed var(--color-danger);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}
.warning-item-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-danger);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.warning-item-desc {
  font-size: 13px;
  line-height: 1.4;
  color: var(--color-text-muted);
}

/* Plan de Parto Form */
.plan-intro {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}
.plan-parto-form {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-main);
}
.form-group select, .form-group input[type="text"], .form-group input[type="number"], .form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 14.5px;
  background-color: var(--color-bg-app);
  color: var(--color-text-main);
}
.form-group select:focus, .form-group input:focus, .form-group textarea:focus {
  border-color: var(--color-primary);
  outline: none;
}
.input-explanation {
  font-size: 11px;
  color: var(--color-text-muted);
  line-height: 1.35;
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.form-actions button {
  width: 100%;
}

/* --- BOTONES GENERALES --- */
.primary-button {
  background-color: var(--color-primary);
  color: #FFFFFF;
  border: none;
  padding: 14px 20px;
  border-radius: var(--radius-pill);
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  text-decoration: none;
}
.primary-button:hover, .primary-button:focus-visible {
  background-color: var(--color-primary-hover);
}

.secondary-button {
  background-color: var(--color-bg-card);
  color: var(--color-text-main);
  border: 1px solid var(--color-border);
  padding: 14px 20px;
  border-radius: var(--radius-pill);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  text-decoration: none;
}
.secondary-button:hover, .secondary-button:focus-visible {
  background-color: var(--color-bg-app);
  border-color: var(--color-text-muted);
}

.danger-button {
  background-color: var(--color-danger);
  color: #FFFFFF;
  border: none;
  padding: 14px 20px;
  border-radius: var(--radius-pill);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
}
.danger-button:hover {
  background-color: #B23C3C;
}
.danger-button.text-btn {
  background: none;
  color: var(--color-danger);
  border: 1px solid transparent;
}
.danger-button.text-btn:hover {
  background-color: var(--color-danger-light);
}

.file-label {
  cursor: pointer;
  position: relative;
}

/* --- BARRA DE NAVEGACIÓN INFERIOR (Pulsadores) --- */
.app-nav {
  position: absolute; /* Puesto al fondo del simulador */
  bottom: 0;
  left: 0;
  right: 0;
  height: 68px;
  background-color: rgba(250, 247, 242, 0.9);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom); /* Compatible con notch de iPhone */
  z-index: 10;
  transition: var(--transition);
}
body.night-mode .app-nav {
  background-color: rgba(15, 14, 13, 0.9);
  border-top: 1px solid var(--color-border);
}

.nav-item {
  flex: 1;
  background: none;
  border: none;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: var(--transition);
  font-family: var(--font-family);
  -webkit-tap-highlight-color: transparent;
}
.nav-item:focus {
  outline: none;
}
.nav-icon {
  font-size: 20px;
  transition: var(--transition);
}
.nav-label {
  font-size: 11px;
  font-weight: 500;
}
.nav-item.active {
  color: var(--color-primary);
}
.nav-item.active .nav-icon {
  transform: scale(1.15);
}

/* --- ESTILOS DE DIÁLOGOS (<dialog>) --- */
dialog {
  border: none;
  border-radius: var(--radius-lg);
  background-color: var(--color-bg-card);
  color: var(--color-text-main);
  box-shadow: var(--shadow-lg);
  padding: 0;
  width: 90%;
  max-width: 400px;
  margin: auto;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: var(--transition);
  overflow: hidden;
}

dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
body.night-mode dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.75);
}

.dialog-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.dialog-content h3 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.dialog-subtitle {
  font-size: 12.5px;
  color: var(--color-text-muted);
  line-height: 1.4;
  margin-top: -8px;
}

.dialog-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}
.dialog-actions button {
  flex: 1;
}

.info-block {
  margin-bottom: 12px;
}
.info-block h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}
.info-block p, .info-block ul {
  font-size: 13px;
  line-height: 1.45;
  color: var(--color-text-muted);
}
.info-block ul {
  padding-left: 20px;
  margin-top: 6px;
}

/* Responsividad para escritorio: simulador con aspecto de teléfono */
@media (min-width: 768px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #2D2A26; /* Color de fondo exterior oscuro y cálido */
    background-image: radial-gradient(rgba(224, 122, 95, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
  }
  
  .app-container {
    height: 850px;
    border-radius: 40px;
    border: 8px solid #3d3d3d;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
  }
  
  .app-header {
    border-top-left-radius: 32px;
    border-top-right-radius: 32px;
  }
  .app-nav {
    border-bottom-left-radius: 32px;
    border-bottom-right-radius: 32px;
  }
}

/* Respetar preferencias de reducción de movimiento */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-delay: -1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    background-attachment: initial !important;
    scroll-behavior: auto !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }
  .timer-button.active, .breathing-circle.inhale, .breathing-circle.exhale {
    animation: none !important;
  }
}
