:root {
  --bg: #fafaf7;
  --surface: #ffffff;
  --alt: #f1f3ef;
  --text: #1d2521;
  --muted: #6b746f;
  --line: #e2e5df;
  --accent: #2f5d50;
  --accent-hover: #244a3f;
  --accent-soft: #e4ece8;
  --busy: #d9dcd6;
  --error: #b3412f;
  --radius: 10px;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.15; }
h1 { font-size: clamp(2.4rem, 6vw, 4rem); letter-spacing: -0.02em; max-width: 14ch; }
h2 { font-size: clamp(1.8rem, 4vw, 2.4rem); margin-bottom: 12px; }
h3 { font-size: 1.2rem; margin-bottom: 8px; }

.muted { color: var(--muted); font-size: 0.9rem; }

/* Buttons */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 14px 28px;
  font: 500 0.95rem var(--sans);
  cursor: pointer;
  text-align: center;
  transition: background 0.2s, transform 0.1s;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: scale(0.98); }
.btn:disabled { background: var(--busy); color: var(--muted); cursor: not-allowed; }
.btn--small { padding: 9px 18px; font-size: 0.875rem; }
.btn--full { width: 100%; }

/* Header */
.header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: rgba(250, 250, 247, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header__inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.logo { font-family: var(--serif); font-size: 1.25rem; font-weight: 500; }
.nav { display: flex; align-items: center; gap: 28px; font-size: 0.925rem; }
.nav a:not(.btn):hover { color: var(--accent); }

/* Hero */
.hero {
  min-height: min(88vh, 760px);
  display: flex;
  align-items: center;
  padding: 96px 0;
  color: #fff;
  background:
    linear-gradient(90deg, rgba(18, 32, 27, 0.82) 0%, rgba(18, 32, 27, 0.6) 45%, rgba(18, 32, 27, 0.1) 80%),
    url("img/consultorio.webp") center 60% / cover no-repeat #2b3a34;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  font-weight: 600;
  color: #cfe3da;
  margin-bottom: 20px;
}
.hero h1 { text-shadow: 0 2px 24px rgba(0, 0, 0, 0.25); }
.hero__text { font-size: 1.15rem; color: rgba(255, 255, 255, 0.88); max-width: 46ch; margin: 24px 0 40px; }
.hero__actions { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.hero__hours { color: rgba(255, 255, 255, 0.85); font-size: 0.9rem; }
.hero .btn { background: #fff; color: var(--accent); }
.hero .btn:hover { background: var(--accent-soft); }

/* Sections */
.section { padding: 96px 0; }
.section--alt { background: var(--alt); }
.section__lead { color: var(--muted); margin-bottom: 40px; }

.services {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 0;
}
.service { background: var(--surface); padding: 32px 28px; }
.service p { color: var(--muted); font-size: 0.95rem; }
.section__lead { max-width: 62ch; }

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tags li {
  font-size: 0.8rem;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 4px 11px;
}

/* Booking */
.booking {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
  align-items: start;
}
.booking__picker, .booking__form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}
.step + .step { margin-top: 32px; }
.step__label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 14px;
}

.days {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.day {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 10px 4px;
  text-align: center;
  cursor: pointer;
  font-family: var(--sans);
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}
.day:hover:not(:disabled) { border-color: var(--accent); }
.day__name { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.day__num { display: block; font-size: 1.25rem; font-weight: 500; }
.day__month { display: block; font-size: 0.72rem; color: var(--muted); }
.day__free { display: block; font-size: 0.68rem; color: var(--accent); margin-top: 2px; }
.day:disabled { opacity: 0.45; cursor: not-allowed; }
.day:disabled .day__free { color: var(--muted); }
.day.is-selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.day.is-selected .day__name,
.day.is-selected .day__month,
.day.is-selected .day__free { color: rgba(255, 255, 255, 0.85); }

.capacity {
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 18px 20px;
}
.capacity__count { font-family: var(--serif); font-size: 1.35rem; color: var(--accent); }
.capacity__bar { display: grid; gap: 6px; margin-top: 12px; }
.capacity__bar:empty { display: none; }
.capacity__bar span { height: 8px; border-radius: 999px; background: var(--accent); }
.capacity__bar span.is-taken { background: var(--busy); }
#taken-wrap { margin-top: 24px; }
.taken { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.taken li {
  background: var(--alt);
  color: var(--muted);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}
.optional { font-style: normal; font-weight: 400; color: var(--muted); }

.summary {
  background: var(--alt);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 20px;
}
.summary.is-ready { background: var(--accent-soft); color: var(--accent); font-weight: 500; }

.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 6px; }
.field input, .field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  font: 400 1rem var(--sans);
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form__error { color: var(--error); font-size: 0.875rem; min-height: 1.3em; margin-bottom: 8px; }

.form__note { color: var(--muted); font-size: 0.82rem; text-align: center; margin-top: 10px; }

.btn--ghost { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1px var(--line); }
.btn--ghost:hover { background: var(--accent-soft); }
.btn--danger { background: var(--error); }
.btn--danger:hover { background: #963524; }

/* Panel de la fisioterapeuta */
.admin .nav { gap: 16px; }
.admin__title { font-size: clamp(1.6rem, 3vw, 2rem); }
.admin__head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.field--inline { margin-bottom: 0; }
.demo-banner {
  background: #fdf3df;
  color: #7a5a14;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
  margin-bottom: 24px;
}
.login {
  max-width: 400px;
  margin: 24px auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px 28px;
}
.login .muted { margin: 6px 0 24px; }

.day-panel {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.day-panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.day-panel__head h2 { font-size: 1.4rem; margin: 0; }
.day-panel__head h2::first-letter { text-transform: uppercase; }
.pill { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 4px 12px; font-size: 0.85rem; font-weight: 500; }
.pill--full { background: var(--alt); color: var(--muted); }

.rows { list-style: none; }
.rows__empty { padding: 16px 0; }
.row { padding: 16px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: none; }
.row__line { display: grid; grid-template-columns: 110px 1fr auto; gap: 16px; align-items: center; }
.row__time { white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }
.row__info { display: flex; flex-direction: column; min-width: 0; }
.row__info .muted { overflow-wrap: anywhere; }
.row__actions { display: flex; gap: 8px; }
.row__form { display: grid; grid-template-columns: 140px repeat(3, 1fr); gap: 0 12px; min-width: 0; }
.row__form .field { margin-bottom: 8px; }
.row__hint, .row__error, .row__buttons { grid-column: 1 / -1; }
.row__hint { font-size: 0.82rem; }
.row__error:empty { display: none; }
.row__buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.add-btn { margin-top: 16px; }
.row--recien { background: var(--accent-soft); margin: 0 -12px; padding-inline: 12px; border-radius: 8px; }
.row__actions { flex-wrap: wrap; justify-content: flex-end; }

.capacity-edit { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0 16px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.capacity-edit__label { font-size: 0.9rem; font-weight: 500; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.stepper__btn {
  width: 38px; height: 36px;
  border: none; background: var(--surface); color: var(--accent);
  font: 500 1.2rem var(--sans); cursor: pointer;
}
.stepper__btn:hover:not(:disabled) { background: var(--accent-soft); }
.stepper__btn:disabled { color: var(--busy); cursor: not-allowed; }
.stepper__value { min-width: 36px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.link-btn { background: none; border: none; color: var(--muted); font: 400 0.85rem var(--sans); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn:hover { color: var(--accent); }


/* Footer */
.footer { border-top: 1px solid var(--line); padding: 40px 0; }
.footer__inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer__info { text-align: right; font-size: 0.92rem; }
.footer__admin { text-decoration: underline; text-underline-offset: 3px; }
.footer__admin:hover { color: var(--accent); }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(29, 37, 33, 0.4);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 50;
}
.modal[hidden] { display: none; }
.modal__box {
  background: var(--surface);
  border-radius: 14px;
  padding: 36px 32px 28px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  animation: pop 0.2s ease-out;
}
.modal__box p { color: var(--muted); margin: 8px 0 24px; }
.modal__actions { display: grid; gap: 8px; }
.modal__check {
  width: 52px; height: 52px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 1.5rem;
}
@keyframes pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }

/* Responsive */
@media (max-width: 860px) {
  .booking { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .container { padding: 0 16px; }
  .nav a:not(.btn) { display: none; }
  .hero {
    min-height: auto;
    padding: 80px 0 72px;
    background:
      linear-gradient(180deg, rgba(18, 32, 27, 0.78) 0%, rgba(18, 32, 27, 0.62) 100%),
      url("img/consultorio.webp") 30% center / cover no-repeat #2b3a34;
  }
  .section { padding: 64px 0; }
  .booking__picker, .booking__form { padding: 20px; }
  .days { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .day__num { font-size: 1.05rem; }
  .day__free { font-size: 0.62rem; }
  .footer__info { text-align: left; }
  .row__line { grid-template-columns: 1fr; gap: 8px; }
  .row__form { grid-template-columns: 1fr; }
  .admin #user-email { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .modal__box { animation: none; }
}
