/* ============================================================
   AI4Colegios · Libro de Pago · DEMO FUNNEL LAYER
   Funnel chrome (bottom bar) + peek-then-gate modal + panel styles.
   Consumes the admin's tokens (tokens.css). Mobile-first: clean at
   360-430px, tap targets >=44px, the fixed bar never covers critical UI,
   the modal scrolls. Honors [data-theme] light/dark on the funnel root.
   ============================================================ */

/* The funnel mounts its own themed root so it can read the admin tokens
   even though it lives outside .rz-root. It mirrors the admin direction +
   theme onto #demo-funnel-root via demo-funnel.js. */
#demo-funnel-root {
  font-family: var(--font-ui, system-ui, sans-serif);
  color: var(--text, #14202B);
}
#demo-funnel-root *, #demo-funnel-root *::before, #demo-funnel-root *::after { box-sizing: border-box; }

/* ---------------------------------------------------------------
   BOTTOM FUNNEL BAR · persistent, fixed, safe-area aware
---------------------------------------------------------------- */
.df-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2147483000;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--surface, #fff);
  border-top: 1px solid var(--line, #E4EAF0);
  box-shadow: 0 -6px 24px -14px rgba(20,32,43,.30);
  flex-wrap: wrap;
}
.df-bar__spacer { flex: 1 1 auto; min-width: 0; }

.df-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 8px 15px;
  font-family: var(--font-ui, system-ui, sans-serif);
  font-size: 14px; font-weight: 700; line-height: 1.2;
  border-radius: var(--radius-ctrl, 9px);
  border: 1px solid var(--line-strong, #D2DBE3);
  background: var(--surface-2, #EFF3F8); color: var(--text, #14202B);
  cursor: pointer; white-space: nowrap;
}
.df-btn:hover { background: var(--surface-3, #E5ECF3); }
.df-btn--primary {
  background: var(--accent, #0C6E86); color: var(--on-accent, #fff);
  border-color: var(--accent, #0C6E86);
}
.df-btn--primary:hover { background: var(--accent-dark, #0A5568); border-color: var(--accent-dark, #0A5568); }
.df-btn--ghost { background: transparent; border-color: transparent; color: var(--text-soft, #45525E); }
.df-btn--ghost:hover { background: var(--surface-2, #EFF3F8); }
.df-btn__ico { font-size: 13px; line-height: 1; }

/* language toggle in the bar */
.df-lang { display: inline-flex; border: 1px solid var(--line-strong, #D2DBE3); border-radius: var(--radius-pill, 999px); overflow: hidden; }
.df-lang button {
  min-height: 32px; padding: 4px 11px; font-size: 12px; font-weight: 700;
  background: var(--surface, #fff); color: var(--text-muted, #65737F); border: none; cursor: pointer;
}
.df-lang button.on { background: var(--accent, #0C6E86); color: var(--on-accent, #fff); }

/* ---------------------------------------------------------------
   WELCOME BANNER · per-school personalization (?c=slug)
   A slim, dismissible one-liner pinned just above the funnel bar.
   Sits at the bottom (clear of the admin header) and never causes
   horizontal overflow at 360-430px.
---------------------------------------------------------------- */
.df-welcome {
  position: fixed; left: 0; right: 0; bottom: 64px; z-index: 2147482900;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--surface, #fff);
  border-top: 1px solid var(--line, #E4EAF0);
  border-bottom: 1px solid var(--line, #E4EAF0);
  box-shadow: 0 -2px 10px -8px rgba(20,32,43,.30);
}
.df-welcome__txt {
  flex: 1 1 auto; min-width: 0;
  font-size: 12.5px; line-height: 1.4; font-weight: 600;
  color: var(--text, #14202B);
  border-left: 3px solid var(--accent, #0C6E86); padding-left: 9px;
  overflow-wrap: anywhere;
}
.df-welcome__x {
  flex: none; width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; border-radius: var(--radius-ctrl, 9px);
  color: var(--text-muted, #65737F); font-size: 20px; line-height: 1; cursor: pointer;
}
.df-welcome__x:hover { background: var(--surface-2, #EFF3F8); color: var(--text, #14202B); }
@media (max-width: 430px) {
  .df-welcome { bottom: 60px; padding: 7px 10px; }
  .df-welcome__txt { font-size: 12px; }
}

/* ---------------------------------------------------------------
   GATE MODAL
---------------------------------------------------------------- */
.df-backdrop {
  position: fixed; inset: 0; z-index: 2147483200;
  background: rgba(9,16,22,.55); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 12px; overflow-y: auto;
}
.df-modal {
  width: 100%; max-width: 480px; margin: auto;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #E4EAF0);
  border-radius: var(--radius-card, 12px);
  box-shadow: var(--shadow-pop, 0 18px 44px -12px rgba(20,32,43,.28));
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom, 0px));
  position: relative;
}
.df-modal__x {
  position: absolute; top: 10px; right: 10px;
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; border-radius: var(--radius-ctrl, 9px);
  color: var(--text-muted, #65737F); font-size: 22px; line-height: 1; cursor: pointer;
}
.df-modal__x:hover { background: var(--surface-2, #EFF3F8); color: var(--text, #14202B); }
.df-modal h2 {
  font-family: var(--font-display, system-ui, sans-serif); font-weight: var(--fw-display, 700);
  font-size: 20px; line-height: 1.25; color: var(--text, #14202B); margin: 2px 34px 6px 0;
}
.df-modal .df-sub { font-size: 13.5px; line-height: 1.5; color: var(--text-muted, #65737F); margin: 0 0 16px; }

.df-field { margin: 0 0 13px; }
.df-field > label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted, #65737F); margin: 0 0 5px; }
.df-input, .df-select, .df-textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  font-family: var(--font-ui, system-ui, sans-serif); font-size: 14.5px; color: var(--text, #14202B);
  background: var(--surface, #fff); border: 1px solid var(--line-strong, #D2DBE3);
  border-radius: var(--radius-input, 8px);
}
.df-textarea { min-height: 74px; resize: vertical; line-height: 1.45; }
.df-input:focus, .df-select:focus, .df-textarea:focus { outline: 2px solid var(--focus, #0C6E86); outline-offset: 1px; border-color: var(--focus, #0C6E86); }
.df-hint { font-size: 12px; color: var(--text-muted, #65737F); margin: 5px 0 0; line-height: 1.4; }
.df-stub { font-size: 12px; font-weight: 700; color: var(--st-mora1, #92600E); margin: 5px 0 0; }

/* school autocomplete */
.df-ac { position: relative; }
.df-ac__list {
  position: absolute; left: 0; right: 0; top: calc(100% + 3px); z-index: 5;
  background: var(--surface, #fff); border: 1px solid var(--line-strong, #D2DBE3);
  border-radius: var(--radius-input, 8px); box-shadow: var(--shadow-raise, 0 2px 6px rgba(20,32,43,.08));
  max-height: 190px; overflow-y: auto; margin: 0; padding: 4px; list-style: none;
}
.df-ac__opt { padding: 9px 10px; font-size: 14px; border-radius: 6px; cursor: pointer; color: var(--text, #14202B); }
.df-ac__opt:hover, .df-ac__opt[aria-selected="true"] { background: var(--accent-soft, #DDF0F4); }

/* two-up row (nit/city) */
.df-row2 { display: grid; grid-template-columns: 1fr; gap: 0; }
@media (min-width: 420px) { .df-row2 { grid-template-columns: 1fr 1fr; gap: 12px; } }

/* consent */
.df-consent { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 14px; }
.df-consent input[type="checkbox"] { width: 22px; height: 22px; margin-top: 1px; flex: none; accent-color: var(--accent, #0C6E86); cursor: pointer; }
.df-consent label { font-size: 12.5px; line-height: 1.5; color: var(--text-soft, #45525E); }
.df-consent a { color: var(--accent, #0C6E86); font-weight: 700; }
.df-todo { display: block; font-size: 11px; color: var(--st-mora1, #92600E); font-weight: 700; margin-bottom: 3px; }

.df-actions { display: flex; flex-direction: column; gap: 9px; margin-top: 6px; }
.df-actions .df-btn { width: 100%; }

.df-error { font-size: 13px; font-weight: 700; color: var(--st-mora2, #B23425); background: var(--st-mora2-bg, #FBE2DF); border-radius: var(--radius-input, 8px); padding: 9px 11px; margin: 0 0 12px; }

/* the OTP reveal / code block, hidden until code sent */
.df-hidden { display: none !important; }

/* escape hatch */
.df-escape { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line, #E4EAF0); }
.df-escape p { font-size: 13px; line-height: 1.5; color: var(--text-soft, #45525E); margin: 0 0 10px; }
.df-escape__row { display: flex; gap: 8px; flex-wrap: wrap; }
.df-escape__row .df-input { flex: 1 1 160px; min-width: 0; }
.df-escape__row .df-btn { flex: 0 0 auto; }
.df-escape__done { font-size: 13px; line-height: 1.55; color: var(--st-good, #0C6E4B); font-weight: 600; }
.df-escape__done a { color: var(--accent, #0C6E86); font-weight: 700; }

/* section divider label */
.df-sec { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted, #65737F); margin: 18px 0 10px; padding-top: 14px; border-top: 1px solid var(--line, #E4EAF0); }

/* ---------------------------------------------------------------
   HARD-MODE · blur the app, block interaction until verify/escape
---------------------------------------------------------------- */
.df-app-blur { filter: blur(6px); pointer-events: none; user-select: none; }

/* ---------------------------------------------------------------
   PANEL PAGE (panel.html) · reuses tokens + funnel primitives
---------------------------------------------------------------- */
.df-panel-wrap {
  min-height: 100vh; background: var(--page, #F4F7FA);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px calc(48px + env(safe-area-inset-bottom, 0px));
}
.df-panel {
  width: 100%; max-width: 560px;
  background: var(--surface, #fff); border: 1px solid var(--line, #E4EAF0);
  border-radius: var(--radius-card, 12px); box-shadow: var(--shadow-card, 0 1px 2px rgba(20,32,43,.06));
  padding: 30px 26px calc(30px + env(safe-area-inset-bottom, 0px));
}
.df-panel__crest { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--accent, #0C6E86); margin: 0 0 10px; }
.df-panel__ok { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--st-good, #0C6E4B); background: var(--st-good-bg, #DBF3E8); padding: 6px 12px; border-radius: var(--radius-pill, 999px); margin: 0 0 14px; }
.df-panel h1 { font-family: var(--font-display, system-ui, sans-serif); font-weight: var(--fw-display, 700); font-size: 24px; line-height: 1.25; color: var(--text, #14202B); margin: 0 0 8px; }
.df-panel__lead { font-size: 14.5px; line-height: 1.55; color: var(--text-muted, #65737F); margin: 0 0 22px; }
.df-panel .df-btn--primary { width: 100%; min-height: 50px; font-size: 15.5px; }

.df-steps { margin: 24px 0 0; padding: 0; list-style: none; }
.df-steps__note { font-size: 12.5px; color: var(--st-mora1, #92600E); font-weight: 600; margin: 0 0 12px; }
.df-step {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; margin: 0 0 9px;
  border: 1px solid var(--line, #E4EAF0); border-radius: var(--radius-ctrl, 9px);
  background: var(--surface-2, #EFF3F8); color: var(--text, #14202B);
  text-decoration: none; font-size: 14.5px; font-weight: 600; min-height: 52px;
}
.df-step:hover { background: var(--surface-3, #E5ECF3); border-color: var(--line-strong, #D2DBE3); }
.df-step__n { flex: none; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--accent-soft, #DDF0F4); color: var(--accent, #0C6E86); font-size: 12px; font-weight: 700; }
.df-step__txt { flex: 1 1 auto; min-width: 0; }
.df-step__soon { flex: none; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted, #65737F); background: var(--surface-3, #E5ECF3); padding: 3px 8px; border-radius: var(--radius-pill, 999px); }

.df-panel__lang { display: flex; justify-content: flex-end; margin-bottom: 14px; }

/* small screens: give the bar buttons room to wrap without covering content */
@media (max-width: 380px) {
  .df-btn { font-size: 13px; padding: 8px 12px; }
  .df-bar { gap: 6px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)); }
}

/* D (Reviewer M1 / left-rail): a touch more breathing room for the collapsed
   icon rail on phones, so the icons are not cramped at 390px. Additive override
   of the admin app.css mobile rule (.leftnav width:54px). */
@media (max-width: 430px) {
  .leftnav, .leftnav.collapsed { width: 62px !important; }
  .leftnav .nav-item { justify-content: center; }
}
