/* Brand tokens — Dr. Fallas Mora */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --marino-prof: #0B1B36;
  --marino-medio: #1D3762;
  --marino-soft: #2A4B7C;
  --periwinkle: #B8C5E0;
  --periwinkle-soft: #DDE4F0;
  --periwinkle-ghost: #EEF1F8;
  --crema: #EFE9DC;
  --crema-warm: #F5F1E7;
  --crema-deep: #E5DDCB;
  --ink: #14161C;
  --ink-soft: #4A4E58;
  --ink-mute: #8A8F99;
  --line: #DDD6C7;
  --line-soft: #ECE6D7;
  --line-cms: #E5DFD1;
  --ok: #2F7A5A;
  --ok-bg: #E5F0EA;
  --warn: #B58A2D;
  --warn-bg: #F7EFDA;
  --danger: #A8342A;
  --danger-bg: #F5E1DE;
  --serif: 'Instrument Serif', 'Cormorant Garamond', 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
}

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

body {
  font-family: var(--sans);
  background: var(--crema);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar hide */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; }

/* Typography helpers */
.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -0.015em; }
.mono { font-family: var(--mono); }

/* Transitions */
button { transition: background 0.15s, color 0.15s, border-color 0.15s; }

/* ─── MOBILE APP ─── */
#mobile-app-root {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  background: var(--crema);
  overflow-x: hidden;
}

/* Contenedor interno de ancho máximo para pantallas grandes */
.pub-inner {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
  box-sizing: border-box;
}

/* Mobile topbar */
.mobile-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  width: 100%;
  z-index: 50;
  height: 64px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 20px 10px;
  pointer-events: none;
  box-sizing: border-box;
  /* Transición suave al cambiar de transparente a sólido */
  transition: background 0.25s ease, border-bottom 0.25s ease, backdrop-filter 0.25s ease;
}
.mobile-topbar > * { pointer-events: auto; }

/* Topbar inner wrapper centrado */
.mobile-topbar-inner {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
}

.topbar-logo {
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: -0.01em;
  line-height: 1;
}

.topbar-back-btn {
  background: rgba(11,27,54,0.06);
  border: none;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
}

.topbar-back-btn.dark {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.topbar-menu-btn {
  width: 38px; height: 38px;
  border-radius: 999px;
  background: rgba(11,27,54,0.06);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.topbar-menu-btn.dark {
  background: rgba(255,255,255,0.15);
}

/* Nav desktop links (ocultos en móvil, visibles en desktop) */
.topbar-nav-links {
  display: none;
}

/* Eyebrow */
.eyebrow {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* Sticky booking footer */
.sticky-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  width: 100%;
  background: rgba(239,233,220,0.94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 14px 20px 20px;
  display: flex;
  gap: 12px;
  align-items: center;
  z-index: 40;
  box-sizing: border-box;
}

/* Sticky footer inner centrado */
.sticky-footer-inner {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Grid de servicios — 1 col mobile, 2 col tablet+ */
.services-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

/* Grid de horarios — 3 col mobile, 4 col tablet, 5 col desktop */
.time-slots-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

/* Tarjetas de contacto */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

/* ── TABLET (≥ 640px) ── */
@media (min-width: 640px) {
  .pub-inner {
    max-width: 800px;
    padding-left: 40px;
    padding-right: 40px;
  }

  .mobile-topbar {
    padding: 0 40px 10px;
    height: 70px;
  }

  .topbar-logo {
    font-size: 22px;
  }

  .topbar-nav-links {
    display: flex;
    gap: 28px;
    align-items: center;
  }

  .topbar-nav-link {
    font-family: var(--sans);
    font-size: 13px;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.75;
    letter-spacing: 0.02em;
    transition: opacity 0.15s;
    padding: 0;
  }
  .topbar-nav-link:hover { opacity: 1; }

  .sticky-footer {
    padding: 16px 40px 24px;
  }

  .sticky-footer-inner {
    max-width: 800px;
  }

  .time-slots-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .contact-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0 40px;
  }
}

/* ── DESKTOP (≥ 1024px) ── */
@media (min-width: 1024px) {
  .pub-inner {
    max-width: 1100px;
    padding-left: 64px;
    padding-right: 64px;
  }

  .mobile-topbar {
    padding: 0 64px 12px;
    height: 76px;
  }

  .topbar-nav-links {
    gap: 36px;
  }

  .topbar-nav-link {
    font-size: 14px;
  }

  .sticky-footer {
    padding: 18px 64px 24px;
  }

  .sticky-footer-inner {
    max-width: 1100px;
  }

  .services-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .time-slots-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .contact-grid {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0 48px;
  }

  /* Hero 2-col layout */
  .hero-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    align-items: center;
  }

  /* About 2-col layout */
  .about-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    align-items: start;
  }

  /* Agendar — formulario más cómodo */
  .agendar-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
  }
}

/* Step indicator */
.step-indicator {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
}
.step-bar {
  flex: 1;
  height: 3px;
  border-radius: 2px;
}
.step-bar.active { background: var(--marino-prof); }
.step-bar.inactive { background: var(--line); }

/* Service card (step 1) */
.service-card {
  padding: 16px 18px;
  margin-bottom: 10px;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.15s;
  border: 1px solid var(--line);
  background: #fff;
}
.service-card.selected {
  background: var(--marino-prof);
  border-color: var(--marino-prof);
}

/* Calendar grid */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 14px;
  position: relative;
  border: 1px solid transparent;
}
.cal-day.available {
  background: #fff;
  border-color: var(--line);
  color: var(--marino-prof);
}
.cal-day.selected {
  background: var(--marino-prof);
  color: var(--crema);
  font-weight: 600;
  border-color: var(--marino-prof);
}
.cal-day.past {
  color: var(--line);
  text-decoration: line-through;
  cursor: default;
}
.cal-day.weekend {
  color: var(--ink-mute);
  cursor: default;
}

/* Time slot */
.time-slot {
  padding: 12px 8px;
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--marino-prof);
  transition: all 0.15s;
}
.time-slot.selected {
  background: var(--marino-prof);
  color: var(--crema);
  border-color: var(--marino-prof);
}

/* Form fields */
.field-group {
  margin-bottom: 16px;
}
.field-label {
  display: block;
  font-family: var(--sans);
  font-size: 11px;
  color: var(--marino-medio);
  margin-bottom: 6px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.field-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--marino-prof);
  box-sizing: border-box;
  outline: none;
}
.field-input:focus {
  border-color: var(--marino-prof);
}
.field-textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--marino-prof);
  box-sizing: border-box;
  resize: none;
  outline: none;
}

/* Primary button */
.btn-primary {
  background: var(--marino-prof);
  color: var(--crema);
  border: none;
  padding: 16px 24px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.01em;
}
.btn-primary:hover { background: var(--marino-medio); }

.btn-primary.compact {
  padding: 10px 18px;
  font-size: 13px;
  gap: 6px;
}

.btn-primary.full { width: 100%; justify-content: center; }

/* Ghost button */
.btn-ghost {
  background: transparent;
  color: var(--marino-prof);
  border: 1px solid var(--marino-prof);
  padding: 12px 20px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* State pill */
.state-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.state-pill-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
}

/* ─── CMS LAYOUT ─── */
#cms-root {
  display: flex;
  height: 100dvh;
  background: var(--crema-warm);
  font-family: var(--sans);
}

.cms-sidebar {
  width: 224px;
  background: var(--marino-prof);
  color: var(--crema);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  flex-shrink: 0;
  height: 100dvh;
  position: fixed;
  left: 0; top: 0;
  z-index: 10;
}

.cms-main {
  flex: 1;
  margin-left: 224px;
  overflow-y: auto;
  height: 100dvh;
}

.cms-topbar {
  padding: 20px 32px;
  border-bottom: 1px solid var(--line-cms);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  background: var(--crema-warm);
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.cms-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13px;
  margin-bottom: 2px;
  transition: background 0.12s;
  color: rgba(239,233,220,0.65);
}
.cms-nav-item.active {
  background: rgba(184,197,224,0.14);
  color: var(--crema);
  font-weight: 500;
}
.cms-nav-item:hover:not(.active) {
  background: rgba(184,197,224,0.07);
}

/* CMS Card */
.cms-card {
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--line-cms);
  overflow: hidden;
}

.cms-card-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line-cms);
}

/* Table row hover */
.table-row {
  transition: background 0.12s;
  cursor: pointer;
}
.table-row:hover { background: var(--crema-warm) !important; }

/* Toggle switch */
.toggle {
  width: 34px; height: 20px;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}
.toggle-knob {
  position: absolute;
  top: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.15s;
}
.toggle.on { background: var(--marino-prof); }
.toggle.on .toggle-knob { left: 16px; }
.toggle.off { background: var(--line); }
.toggle.off .toggle-knob { left: 2px; }

/* Desktop media — CMS always visible */
@media (max-width: 1023px) {
  .cms-desktop-only {
    display: none;
  }
  .cms-mobile-warning {
    display: flex !important;
  }
}
@media (min-width: 1024px) {
  .cms-mobile-warning { display: none !important; }
}

/* Sombra suave en pantallas muy anchas (opcional) */
@media (min-width: 1400px) {
  body {
    background: var(--periwinkle-ghost);
  }
  #mobile-app-root {
    box-shadow: 0 0 80px rgba(11,27,54,0.06);
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.2s ease; }

/* Screen transitions */
.screen { min-height: 100dvh; }

/* Availability dot in calendar */
.avail-dot {
  position: absolute;
  bottom: 4px;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--periwinkle);
}
