/* =============================================
   FARMACIAS DE TURNO — Leandrouno
   Tema claro/oscuro + diseño moderno
============================================= */

:root {
  --bg: #0b0f1a;
  --bg-radial: radial-gradient(circle at 50% -10%, #131b2e 0%, #0b0f1a 55%);
  --surface: #131a2a;
  --surface-2: #1a2236;
  --surface-3: #212b42;
  --border: #2a3450;
  --border-soft: #1e273c;
  --accent: #c9992f;
  --accent-bright: #e6b84f;
  --accent-dim: #7a5f22;
  --accent-ink: #17130a;
  --text: #eef1f8;
  --text-muted: #8b93ac;
  --text-faint: #545f7d;
  --success: #35d68e;
  --danger: #ef5757;
  --warning: #f0b429;
  --grid-opacity: 0.035;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-lift: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
  --font-display: 'Bebas Neue', sans-serif;
  --font-mono: 'Space Grotesk', 'Inter', monospace;
  --font-body: 'Inter', system-ui, sans-serif;
}

:root[data-theme="claro"] {
  --bg: #f3f4f8;
  --bg-radial: radial-gradient(circle at 50% -10%, #ffffff 0%, #f3f4f8 60%);
  --surface: #ffffff;
  --surface-2: #f6f7fb;
  --surface-3: #ebedf4;
  --border: #dde1eb;
  --border-soft: #e6e9f1;
  --accent: #b3801f;
  --accent-bright: #c9992f;
  --accent-dim: #8a6a24;
  --accent-ink: #ffffff;
  --text: #171b2b;
  --text-muted: #5c657e;
  --text-faint: #9098ac;
  --success: #17a874;
  --danger: #dd3f3f;
  --warning: #c9862a;
  --grid-opacity: 0.05;
  --shadow-lift: 0 16px 40px -22px rgba(30, 35, 60, 0.25);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: var(--bg-radial), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 40px;
  transition: background 0.3s ease, color 0.3s ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(201, 153, 47, var(--grid-opacity)) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201, 153, 47, var(--grid-opacity)) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse at 50% 0%, black, transparent 70%);
  z-index: 0;
}

.contenedor-app {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 18px 0;
}

/* ---------- ENCABEZADO ---------- */
.encabezado-app {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 12px;
}

.marca { display: flex; align-items: center; gap: 14px; }

.marca-icono {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--accent-ink);
  background: linear-gradient(145deg, var(--accent-bright), var(--accent-dim));
  box-shadow: 0 8px 20px -6px rgba(201, 153, 47, 0.45);
  flex-shrink: 0;
}

.marca-texto h1 {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 2.5px;
  margin: 0;
  line-height: 1;
  color: var(--text);
}

.marca-texto p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.4px;
}

.boton-icono-encabezado {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.boton-icono-encabezado:hover { color: var(--accent-bright); border-color: var(--accent-dim); }

/* ---------- CONTROLES (vista + buscador) ---------- */
.controles-farmacias {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-lift);
  margin-bottom: 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.selector-vista {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
  max-width: 340px;
  margin: 0 auto;
  width: 100%;
}

.boton-vista {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.3px;
  padding: 10px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s ease;
}
.boton-vista:hover { color: var(--text); }
.boton-vista.activo {
  background: linear-gradient(145deg, var(--accent-bright), var(--accent-dim));
  color: var(--accent-ink);
}

.buscador-farmacias { position: relative; max-width: 500px; margin: 0 auto; width: 100%; }

.buscador-farmacias i {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  font-size: 13px;
}

.buscador-farmacias input {
  width: 100%;
  padding: 11px 14px 11px 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13.5px;
}
.buscador-farmacias input:focus { outline: none; border-color: var(--accent-dim); }

/* ---------- GRUPOS POR BARRIO ---------- */
.titulo-barrio {
  font-family: var(--font-display);
  font-size: 21px;
  letter-spacing: 1.2px;
  margin: 28px 0 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 8px;
}

.titulo-barrio .contador-barrio {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
  color: var(--accent-bright);
  background: rgba(201, 153, 47, 0.12);
  border: 1px solid rgba(201, 153, 47, 0.3);
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0;
}

.grilla-farmacias {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
}

/* ---------- TARJETA DE FARMACIA ---------- */
.tarjeta-farmacia {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.tarjeta-farmacia:hover { transform: translateY(-3px); border-color: var(--accent-dim); }

.tarjeta-farmacia.es-turno { border-color: rgba(239, 87, 87, 0.4); }

.cuerpo-tarjeta { padding: 16px 16px 10px; flex: 1; }

.nombre-farmacia {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.etiqueta-turno {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #2a0a0a;
  background: var(--danger);
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
  text-transform: uppercase;
}

.dato-farmacia {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 7px;
  line-height: 1.4;
}

.dato-farmacia i { color: var(--accent-bright); width: 14px; margin-top: 2px; flex-shrink: 0; }
.dato-farmacia a { color: var(--text-muted); text-decoration: none; }
.dato-farmacia a:hover { color: var(--accent-bright); }
.dato-farmacia.sin-dato { color: var(--text-faint); font-style: italic; }

.pie-tarjeta { padding: 12px 16px 16px; }

.pie-tarjeta a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border-soft);
  transition: all 0.2s ease;
}
.pie-tarjeta a:hover { background: var(--success); color: #08130e; border-color: var(--success); }

.estado-vacio-farmacias {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 50px 10px;
  color: var(--text-faint);
}
.estado-vacio-farmacias.visible { display: flex; }
.estado-vacio-farmacias i { font-size: 30px; opacity: 0.5; }

/* ---------- MODAL DE CONFIGURACIÓN ---------- */
.modal-fondo {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 12, 0.6);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}
.modal-fondo.abierto { display: flex; }

.modal-caja {
  width: 100%;
  max-width: 380px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: 20px;
}

.modal-cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.modal-cabecera h3 {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 1px;
  margin: 0;
  color: var(--text);
}

.fila-configuracion { margin-bottom: 16px; }
.fila-configuracion:last-child { margin-bottom: 0; }
.fila-configuracion label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.segmentado {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 3px;
  gap: 3px;
}
.boton-segmento {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12.5px;
  padding: 9px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.boton-segmento.activo {
  background: linear-gradient(145deg, var(--accent-bright), var(--accent-dim));
  color: var(--accent-ink);
}

.ayuda-configuracion {
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 8px;
  line-height: 1.4;
}

.boton-icono {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.boton-icono:hover { color: var(--accent-bright); }

/* ---------- PIE ---------- */
footer.pie-app {
  margin-top: 40px;
  padding: 22px 10px 10px;
  text-align: center;
  border-top: 1px solid var(--border-soft);
}
footer.pie-app .marca-pie {
  font-family: var(--font-display);
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: none;
}
footer.pie-app .marca-pie:hover { color: var(--accent-bright); }

.social-pie { display: flex; justify-content: center; gap: 10px; margin-top: 12px; }
.boton-social {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.2s ease;
  text-decoration: none;
}
.boton-social:hover { color: var(--accent-ink); background: var(--accent-bright); border-color: var(--accent-bright); }

/* ---------- MÓVIL ---------- */
@media (max-width: 480px) {
  .contenedor-app { padding: 22px 12px 0; }
  .marca-texto h1 { font-size: 24px; }
  .titulo-barrio { font-size: 18px; text-align: center; justify-content: center; }
  .grilla-farmacias { grid-template-columns: 1fr; }
}