/* ============================================
   TEMAS DE LA APP
   - Fondo: cálido (por defecto), neutro, rosado
   - Modo: claro (por defecto) u oscuro
   - Color: rosa nude (por defecto), rosa intenso, celeste, verde
   ============================================ */

/* ----- Claro + fondo cálido (por defecto) ----- */
:root {
  --fondo: #FBF7F4;
  --tarjeta: #FFFFFF;
  --suave: #F3E9E2;
  --borde: #E8D5C8;
  --texto: #4A3B36;
  --texto-suave: #8A776F;
  --dorado: #B8955A;
  --dorado-claro: #E9D9B8;
  --sombra: 0 4px 18px rgba(74, 59, 54, 0.07);

  --acento: #C97B8E;

  /* colores de los estados de cita */
  --confirmada: #7FA88A;
  --pendiente: #D4B26A;
  --atendida: #D98FA3;
  --cancelada: #B9AFA9;
  --no-asistio: #C47A5E;

  --radio: 18px;
}
:root[data-fondo="neutro"] {
  --fondo: #F5F5F7; --suave: #EBEBEF; --borde: #DCDCE2;
  --texto: #34343A; --texto-suave: #7C7C86;
  --sombra: 0 4px 18px rgba(30, 30, 40, 0.06);
}
:root[data-fondo="rosado"] {
  --fondo: #FCEFF2; --suave: #F8E1E7; --borde: #F0CCD6;
  --texto: #4D3640; --texto-suave: #957883;
  --sombra: 0 4px 18px rgba(120, 60, 80, 0.08);
}

/* ----- Modo oscuro ----- */
:root[data-modo="oscuro"] {
  --fondo: #1F1816; --tarjeta: #2B221F; --suave: #372C28; --borde: #463935;
  --texto: #F3E9E2; --texto-suave: #B3A39B;
  --dorado: #D9B97E; --dorado-claro: #6B5A3C;
  --sombra: 0 4px 18px rgba(0, 0, 0, 0.35);
}
:root[data-modo="oscuro"][data-fondo="neutro"] {
  --fondo: #141417; --tarjeta: #212126; --suave: #2C2C32; --borde: #3A3A42;
  --texto: #EDEDF2; --texto-suave: #A1A1AC;
}
:root[data-modo="oscuro"][data-fondo="rosado"] {
  --fondo: #22161B; --tarjeta: #301F27; --suave: #3D2832; --borde: #4E3540;
  --texto: #F7E6EC; --texto-suave: #BE9FAB;
}

/* ----- Colores de acento ----- */
:root[data-color="rosa-intenso"] { --acento: #D6457A; }
:root[data-color="celeste"]      { --acento: #4F97C7; }
:root[data-color="verde"]        { --acento: #5E9672; }

/* El tono suave se calcula solo a partir del acento */
:root { --acento-suave: color-mix(in srgb, var(--acento) 28%, var(--tarjeta)); }

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Poppins', sans-serif;
  background: var(--fondo);
  color: var(--texto);
  min-height: 100vh;
  padding-bottom: calc(100px + env(safe-area-inset-bottom));
  transition: background .25s, color .25s;
}

button { font-family: inherit; color: inherit; cursor: pointer; border: none; background: none; }
button:disabled { opacity: 0.45; cursor: default; }

/* ===== ENCABEZADO ===== */
.encabezado {
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(18px + env(safe-area-inset-top)) 20px 12px;
  position: sticky; top: 0; z-index: 5;
  background: var(--fondo);
  transition: background .25s;
}
.encabezado-sub { font-size: 13px; color: var(--texto-suave); }
.encabezado-titulo { font-family: 'Playfair Display', serif; font-weight: 600; font-size: 26px; }
.boton-icono {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--tarjeta); box-shadow: var(--sombra); font-size: 20px;
}

main { max-width: 560px; margin: 0 auto; padding: 0 20px; }

/* ===== PANTALLAS ===== */
.pantalla { display: none; flex-direction: column; gap: 14px; animation: aparecer .25s ease; }
.pantalla.activa { display: flex; }
@keyframes aparecer { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ===== TARJETAS ===== */
.tarjeta {
  background: var(--tarjeta); border-radius: var(--radio);
  padding: 16px 18px; box-shadow: var(--sombra);
  display: flex; flex-direction: column; gap: 6px;
}
.tarjeta-dorada { border: 1.5px solid var(--dorado-claro); }
.tarjetas-resumen { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tarjetas-resumen.tres { grid-template-columns: 1fr 1fr 1fr; }
.tarjeta-dato {
  background: var(--tarjeta); border-radius: var(--radio);
  padding: 14px; box-shadow: var(--sombra);
  display: flex; flex-direction: column; gap: 4px;
}
.dato-etiqueta { font-size: 12px; color: var(--texto-suave); }
.dato-valor { font-size: 20px; font-weight: 600; }
.dato-valor.grande { font-size: 28px; }
.dorado { color: var(--dorado); }

.subtitulo { font-family: 'Playfair Display', serif; font-weight: 500; font-size: 19px; margin-top: 6px; }
.texto-vacio { font-size: 14px; color: var(--texto-suave); }
.centrado { text-align: center; align-items: center; }
.emoji-grande { font-size: 38px; }
.fila-titulo { display: flex; justify-content: space-between; align-items: center; }

/* ===== BOTONES ===== */
.boton-principal {
  background: var(--acento); color: #FFFFFF;
  font-size: 17px; font-weight: 600; letter-spacing: .5px;
  border-radius: var(--radio); padding: 18px; width: 100%;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--acento) 35%, transparent);
  transition: transform .1s;
}
.boton-principal:active { transform: scale(.98); }
.boton-secundario {
  background: var(--tarjeta); border: 1.5px solid var(--borde);
  border-radius: var(--radio); padding: 15px; width: 100%;
  font-size: 15px; font-weight: 500;
}
.boton-chico {
  background: var(--acento-suave); color: var(--texto);
  border-radius: 12px; padding: 9px 14px; font-weight: 500; font-size: 14px;
}
.fila-botones { display: flex; gap: 10px; }

/* ===== SELECTOR DÍA / SEMANA / MES ===== */
.selector { display: flex; background: var(--suave); border-radius: 14px; padding: 4px; }
.selector-opcion { flex: 1; padding: 11px; border-radius: 11px; font-size: 14px; color: var(--texto-suave); }
.selector-opcion.activa { background: var(--tarjeta); color: var(--texto); font-weight: 600; box-shadow: var(--sombra); }

.navegador-fechas { display: flex; align-items: center; justify-content: space-between; }
.boton-flecha {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--tarjeta); box-shadow: var(--sombra); font-size: 24px; line-height: 1;
}
.navegador-texto { font-weight: 500; }

/* ===== LEYENDA DE ESTADOS ===== */
.leyenda { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 12px; color: var(--texto-suave); }
.punto { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.punto.confirmada { background: var(--confirmada); }
.punto.pendiente { background: var(--pendiente); }
.punto.atendida { background: var(--atendida); }
.punto.cancelada { background: var(--cancelada); }
.punto.no-asistio { background: var(--no-asistio); }

/* ===== MENÚ DE AJUSTES ===== */
.fila-menu {
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: var(--tarjeta); border-radius: var(--radio);
  padding: 16px; box-shadow: var(--sombra); width: 100%;
}
.fila-icono { font-size: 22px; width: 44px; height: 44px; border-radius: 12px; background: var(--suave); display: grid; place-items: center; }
.fila-texto { flex: 1; display: flex; flex-direction: column; }
.fila-texto small { color: var(--texto-suave); font-size: 12px; }
.fila-flecha { font-size: 22px; color: var(--texto-suave); }

/* ===== MENÚ QUE SE DESPLIEGA ===== */
.fila-flecha { transition: transform .2s; }
.fila-menu[aria-expanded="true"] .fila-flecha { transform: rotate(90deg); }
.desplegable { display: none; margin-top: -6px; }
.desplegable.abierto { display: flex; animation: aparecer .2s ease; }

/* ===== APARIENCIA ===== */
.apariencia { gap: 16px; }
.apariencia-fila { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.apariencia-etiqueta { font-weight: 500; font-size: 15px; }
.apariencia-etiqueta small { display: block; font-weight: 400; font-size: 12px; color: var(--texto-suave); }

/* interruptor (switch) */
.interruptor {
  width: 56px; height: 32px; border-radius: 20px; flex-shrink: 0;
  background: var(--borde); position: relative; transition: background .2s;
}
.interruptor::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 26px; height: 26px; border-radius: 50%; background: #FFFFFF;
  box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: transform .2s;
}
.interruptor[aria-checked="true"] { background: var(--acento); }
.interruptor[aria-checked="true"]::after { transform: translateX(24px); }

/* círculos de color */
.opciones-color { display: flex; gap: 12px; flex-wrap: wrap; }
.opcion-color {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 11px; color: var(--texto-suave); width: 62px;
}
.circulo {
  width: 46px; height: 46px; border-radius: 50%;
  border: 3px solid var(--tarjeta); box-shadow: 0 0 0 2px transparent;
  transition: box-shadow .2s;
}
.opcion-color.activa { color: var(--texto); font-weight: 600; }
.opcion-color.activa .circulo { box-shadow: 0 0 0 2px var(--texto); }

/* muestras de fondo */
.opciones-fondo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.opcion-fondo {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 12px; color: var(--texto-suave);
}
.muestra {
  width: 100%; height: 64px; border-radius: 14px;
  border: 2px solid var(--borde); position: relative; overflow: hidden;
}
.muestra::after {
  content: ''; position: absolute; left: 10px; right: 10px; bottom: 10px; height: 18px;
  border-radius: 6px; background: var(--muestra-tarjeta);
}
.opcion-fondo.activa { color: var(--texto); font-weight: 600; }
.opcion-fondo.activa .muestra { border-color: var(--acento); border-width: 3px; }

/* ===== BARRA INFERIOR ===== */
.barra {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: space-around; align-items: center;
  background: var(--tarjeta);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  border-radius: 24px 24px 0 0;
}
.barra-boton {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; color: var(--texto-suave); min-width: 60px; padding: 6px 0;
}
.barra-icono { font-size: 21px; filter: grayscale(1); opacity: .6; transition: .2s; }
.barra-boton.activo { color: var(--acento); font-weight: 600; }
.barra-boton.activo .barra-icono { filter: none; opacity: 1; }
.barra-mas {
  width: 60px; height: 60px; border-radius: 50%; margin-top: -30px;
  background: var(--acento); color: #FFFFFF; font-size: 32px; font-weight: 300;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--acento) 45%, transparent);
  border: 4px solid var(--fondo);
}

/* ===== VENTANA QUE SUBE DESDE ABAJO ===== */
.fondo-oscuro {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(30, 20, 18, 0.45);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.fondo-oscuro.abierta { opacity: 1; pointer-events: auto; }
.hoja {
  background: var(--fondo); width: 100%; max-width: 560px;
  border-radius: 26px 26px 0 0;
  padding: 12px 22px calc(26px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 16px;
  transform: translateY(100%); transition: transform .3s ease;
}
.fondo-oscuro.abierta .hoja { transform: none; }
.hoja-manija { width: 44px; height: 5px; border-radius: 3px; background: var(--borde); margin: 0 auto 4px; }
.hoja-titulo { font-family: 'Playfair Display', serif; font-weight: 600; font-size: 22px; }
