/* ============================================================
   Óptica Iborra · Reserva de citas (rediseño)
   Paleta basada en la identidad del proyecto:
   sand #d0c7b9 · ink #242828 · green #82ce34 · red #e00909
   ============================================================ */

:root {
  --ink: #242828;
  --ink-2: #3b4141;
  --sand: #d0c7b9;
  --sand-soft: #e9e3d9;
  --cream: #f7f4ee;
  --green: #82ce34;
  --green-dark: #6fb32b;
  --red: #e00909;
  --white: #ffffff;
  --muted: #7b817f;
  --line: #e6e1d8;
  --radius: 28px;
  --shadow: 0 30px 70px -30px rgba(36, 40, 40, .45);
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--sand);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  position: relative;
}

/* Fondo decorativo */
.bg-decor {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(60vw 60vw at 12% 8%, rgba(255, 255, 255, .55), transparent 60%),
    radial-gradient(50vw 50vw at 92% 92%, rgba(130, 206, 52, .16), transparent 60%),
    radial-gradient(40vw 40vw at 85% 6%, rgba(36, 40, 40, .06), transparent 65%),
    linear-gradient(160deg, #dcd4c6 0%, #d0c7b9 55%, #c6bcab 100%);
}

/* ----------------------------- Shell ----------------------------- */
.shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1080px;
  display: grid;
  grid-template-columns: 42% 58%;
  height: calc(100vh - 80px);
  min-height: 560px;
  max-height: 880px;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* ----------------------------- Brand ----------------------------- */
.brand {
  position: relative;
  background: linear-gradient(155deg, #2b3030 0%, #242828 55%, #1c1f1f 100%);
  color: var(--white);
  padding: 46px 40px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 36px;
  overflow: hidden;
}

.brand::after {
  content: "";
  position: absolute;
  width: 260px; height: 260px;
  left: -120px; bottom: -120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(208, 199, 185, .22), transparent 70%);
}

.brand-top, .brand-foot { position: relative; z-index: 1; }

.logo-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  border-radius: 18px;
  padding: 14px 20px;
  margin-bottom: 28px;
  box-shadow: 0 12px 26px -14px rgba(0, 0, 0, .6);
}
.logo-box img { width: 190px; height: auto; display: block; }

.brand h1 {
  font-size: 1.95rem;
  line-height: 1.2;
  font-weight: 600;
  margin: 0 0 12px;
  letter-spacing: -.5px;
}
.brand .lead {
  color: rgba(255, 255, 255, .72);
  font-size: .95rem;
  line-height: 1.6;
  margin: 0 0 26px;
  font-weight: 300;
}

.features { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.features li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .9rem;
  color: rgba(255, 255, 255, .9);
  font-weight: 400;
}
.feature-ic {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(130, 206, 52, .16);
  color: var(--green);
}
.feature-ic svg { width: 18px; height: 18px; }

.brand-foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, .12);
}
.brand-foot .back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
  text-decoration: none;
  font-weight: 500;
  font-size: .92rem;
  transition: gap .2s ease, color .2s ease;
}
.brand-foot .back img { width: 18px; height: 18px; }
.brand-foot .back:hover { gap: 15px; color: var(--green); }
.brand-foot .mailto {
  color: rgba(255, 255, 255, .6);
  text-decoration: none;
  font-size: .85rem;
}
.brand-foot .mailto:hover { color: var(--green); }

/* ----------------------------- Panel ----------------------------- */
.panel {
  padding: 46px 46px 40px;
  background: var(--white);
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.panel::-webkit-scrollbar { width: 10px; }
.panel::-webkit-scrollbar-track { background: transparent; }
.panel::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 3px solid var(--white); }
.panel::-webkit-scrollbar-thumb:hover { background: var(--sand); }

.panel-head { margin-bottom: 30px; }
.eyebrow {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--green-dark);
  background: rgba(130, 206, 52, .14);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.panel-head h2 { font-size: 1.75rem; margin: 0 0 6px; letter-spacing: -.5px; font-weight: 600; }
.panel-head p { margin: 0; color: var(--muted); font-size: .92rem; font-weight: 300; }

/* Pasos */
.step { margin-bottom: 26px; }
.step-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.step-head .num {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--white);
  font-size: .8rem;
  font-weight: 600;
  display: grid; place-items: center;
  margin-top: 2px;
}
.step-head h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.step-head p { margin: 2px 0 0; font-size: .82rem; color: var(--muted); font-weight: 300; }

/* Campos */
.field,
.field-wrap input {
  width: 100%;
  font-family: inherit;
  font-size: .95rem;
  color: var(--ink);
  background: var(--cream);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.field:focus,
.field-wrap input:focus {
  outline: none;
  border-color: var(--green);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(130, 206, 52, .15);
}
.field-wrap label {
  display: block;
  font-size: .8rem;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 7px;
}
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.field-wrap.full { grid-column: 1 / -1; }

/* Horas */
.slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 10px;
}
.slot { position: relative; cursor: pointer; }
.slot input { position: absolute; opacity: 0; pointer-events: none; }
.slot span {
  display: block;
  text-align: center;
  padding: 12px 6px;
  font-size: .9rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--cream);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  transition: all .16s ease;
  user-select: none;
}
.slot:hover span { border-color: var(--green); background: rgba(130, 206, 52, .08); }
.slot input:checked + span {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
  box-shadow: 0 10px 20px -12px rgba(36, 40, 40, .8);
}
.slot input:focus-visible + span { box-shadow: 0 0 0 4px rgba(130, 206, 52, .25); }

.slots-msg {
  margin: 10px 0 0;
  font-size: .84rem;
  color: var(--muted);
}
.slots-msg.warn { color: var(--red); font-weight: 500; }

/* Tipos de cita */
.types {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.type { position: relative; cursor: pointer; }
.type input { position: absolute; opacity: 0; pointer-events: none; }
.type-ic {
  display: grid;
  place-items: center;
  width: 100%;
  padding: 16px 0 10px;
  color: var(--ink-2);
  transition: color .16s ease;
}
.type-ic svg { width: 26px; height: 26px; }
.type-t {
  display: block;
  text-align: center;
  font-size: .78rem;
  font-weight: 500;
  padding: 0 0 14px;
  border-radius: 14px;
}
.type {
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--cream);
  transition: all .16s ease;
}
.type:hover { border-color: var(--green); background: rgba(130, 206, 52, .08); }
.type:has(input:checked) {
  border-color: var(--ink);
  background: var(--white);
  box-shadow: 0 12px 24px -16px rgba(36, 40, 40, .8);
}
.type:has(input:checked) .type-ic { color: var(--green-dark); }
.type:has(input:focus-visible) { box-shadow: 0 0 0 4px rgba(130, 206, 52, .25); }

/* CTA */
.cta {
  width: 100%;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--white);
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  border: none;
  border-radius: 14px;
  padding: 16px 20px;
  cursor: pointer;
  box-shadow: 0 16px 30px -16px rgba(111, 179, 43, .9);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.cta svg { width: 20px; height: 20px; transition: transform .15s ease; }
.cta:hover { transform: translateY(-2px); box-shadow: 0 20px 36px -16px rgba(111, 179, 43, 1); }
.cta:hover svg { transform: translateX(4px); }
.cta:active { transform: translateY(0); }

.fine {
  margin: 14px 0 0;
  text-align: center;
  font-size: .8rem;
  color: var(--muted);
  font-weight: 300;
}

/* ----------------------------- Modal ----------------------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(20, 22, 22, .55);
  backdrop-filter: blur(6px);
}
.overlay[data-open="1"] { display: flex; animation: fade .2s ease; }
.overlay.closing { display: flex; animation: fadeOut .2s ease forwards; }

.modal {
  width: 100%;
  max-width: 380px;
  background: var(--white);
  border-radius: 22px;
  padding: 46px 30px 30px;
  text-align: center;
  position: relative;
  box-shadow: 0 30px 60px -25px rgba(0, 0, 0, .5);
  animation: pop .28s cubic-bezier(.2, .9, .3, 1.2);
}
.modal-ic {
  position: absolute;
  top: -34px; left: 50%;
  transform: translateX(-50%);
  width: 68px; height: 68px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--white);
  background: var(--green);
  box-shadow: 0 12px 24px -10px rgba(0, 0, 0, .4);
}
.modal.fail .modal-ic { background: var(--red); }
.modal-ic svg { width: 34px; height: 34px; }
.modal h3 { margin: 6px 0 8px; font-size: 1.25rem; font-weight: 600; }
.modal p { margin: 0 0 22px; font-size: .9rem; color: var(--muted); line-height: 1.6; font-weight: 300; }
.modal-btn {
  width: 100%;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  color: var(--white);
  background: var(--ink);
  border: none;
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: background .18s ease;
}
.modal.fail .modal-btn { background: var(--red); }
.modal-btn:hover { background: var(--green-dark); }
.modal.fail .modal-btn:hover { background: #b80808; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }

/* ----------------------------- Responsive ----------------------------- */
/* Pantallas de poca altura: compactamos el panel fijo para que no se corte */
@media (min-width: 901px) and (max-height: 720px) {
  .brand { padding: 28px 32px; gap: 18px; }
  .logo-box { padding: 10px 16px; margin-bottom: 18px; }
  .logo-box img { width: 150px; }
  .brand h1 { font-size: 1.5rem; }
  .brand .lead { margin-bottom: 16px; font-size: .86rem; }
  .features { gap: 9px; }
  .features li { font-size: .84rem; }
  .brand-foot { padding-top: 16px; }
  .panel { padding: 30px 36px; }
  .step { margin-bottom: 20px; }
}

@media (max-width: 900px) {
  body { height: auto; min-height: 100vh; overflow: auto; padding: 22px 14px; align-items: flex-start; }
  .shell { grid-template-columns: 1fr; height: auto; min-height: 0; max-height: none; }
  .brand { height: auto; overflow: visible; padding: 34px 28px; gap: 26px; }
  .panel { height: auto; overflow: visible; padding: 32px 26px; }
  .brand h1 { font-size: 1.6rem; }
  .features { grid-template-columns: 1fr; }
  .logo-box img { width: 160px; }
  .panel { padding: 32px 26px; }
}

@media (max-width: 480px) {
  .panel-head h2 { font-size: 1.45rem; }
  .grid { grid-template-columns: 1fr; }
  .types { grid-template-columns: 1fr; }
  .type { display: grid; grid-template-columns: 44px 1fr; align-items: center; }
  .type-ic { padding: 14px 0 14px 8px; }
  .type-t { text-align: left; padding: 14px 12px 14px 0; }
}
