/* ============================================================
   Kaieder · KE components
   Pieces shared by every /app/*.html page.
   ============================================================ */

/* ------------------------------------------------------------
   Phone frame & status bar (decorative — evokes iOS context)
   ------------------------------------------------------------ */
.ke-screen {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin-inline: auto;
  min-height: 100dvh;
  padding-top: 54px;          /* status bar */
  padding-bottom: 92px;       /* bottom nav safe area */
  background: var(--ke-paper);
  overflow: hidden;
}

/* PWA / instalada en home screen: ocultar la status bar mock (el OS ya pinta la real)
   y respetar la safe area del notch / barra inferior. */
@media (display-mode: standalone) {
  .ke-statusbar { display: none; }
  .ke-screen {
    padding-top: env(safe-area-inset-top, 0px);
  }
  .ke-bottomnav {
    padding-bottom: calc(env(safe-area-inset-bottom, 18px) + 18px);
  }
}
.ke-screen--login { padding-bottom: 0; }

.ke-statusbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 54px;
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 0 28px 8px;
  font-family: var(--ke-mono);
  font-size: 15px;
  color: var(--ke-ink);
  pointer-events: none;
  z-index: 5;
}
.ke-statusbar--dark { color: var(--ke-paper); }
.ke-statusbar__time { font-weight: 500; }
.ke-statusbar__right { display: inline-flex; gap: 6px; align-items: center; }
.ke-statusbar__bars { display: inline-flex; gap: 2px; align-items: flex-end; }
.ke-statusbar__bars i { width: 3px; background: currentColor; border-radius: 1px; display: block; }
.ke-statusbar__bars i:nth-child(1) { height: 4px; }
.ke-statusbar__bars i:nth-child(2) { height: 6px; }
.ke-statusbar__bars i:nth-child(3) { height: 8px; }
.ke-statusbar__bars i:nth-child(4) { height: 10px; }
.ke-statusbar__battery {
  width: 24px; height: 11px;
  border: 1px solid currentColor;
  border-radius: 3px;
  position: relative;
  padding: 1px;
}
.ke-statusbar__battery::after {
  content: ""; position: absolute; top: 3px; right: -3px;
  width: 2px; height: 5px; border-radius: 1px; background: currentColor;
}
.ke-statusbar__battery i {
  display: block; width: 80%; height: 100%; background: currentColor; border-radius: 1px;
}

/* ------------------------------------------------------------
   Eyebrow
   ------------------------------------------------------------ */
.ke-eyebrow {
  font-family: var(--ke-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ke-ink-3);
  font-weight: 500;
}

/* ------------------------------------------------------------
   Top nav (in-screen)
   ------------------------------------------------------------ */
.ke-topnav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px 8px;
  min-height: 48px;
}
.ke-topnav__center { flex: 1; text-align: center; }
.ke-icon-btn {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ke-ink);
  border: 0;
  cursor: pointer;
}
.ke-icon-btn:hover { background: var(--ke-paper-2); }
.ke-icon-btn svg { width: 22px; height: 22px; }

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */
.ke-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 10px;
  height: 48px;
  padding: 0 18px;
  border-radius: 14px;
  border: 0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ke-paper);
  background: var(--ke-ink);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 80ms ease-out, opacity 80ms ease-out, background 160ms ease-out;
  -webkit-tap-highlight-color: transparent;
}
.ke-btn:active { transform: scale(0.97); opacity: 0.9; }
.ke-btn--sm  { height: 36px; font-size: 13px; padding: 0 14px; }
.ke-btn--lg  { height: 56px; font-size: 16px; padding: 0 22px; }
.ke-btn--full { width: 100%; }

.ke-btn--primary { background: var(--ke-ink);   color: var(--ke-paper); }
.ke-btn--red     { background: var(--ke-red);   color: #fff; }
.ke-btn--red:hover { background: var(--ke-red-2); }
.ke-btn--lime    { background: var(--ke-lime);  color: var(--ke-lime-ink); }
.ke-btn--ghost   { background: var(--ke-paper-2); color: var(--ke-ink); }
.ke-btn--ghost:hover { background: var(--ke-line); }
.ke-btn--outline {
  background: transparent; color: var(--ke-ink);
  border: 1.5px solid var(--ke-line-2);
}
.ke-btn--outline:hover { background: var(--ke-paper-2); }

.ke-btn svg { width: 16px; height: 16px; }

.ke-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ke-ink-2);
  font-size: 13.5px;
  text-decoration: none;
  border-bottom: 1px solid var(--ke-line-2);
  padding-bottom: 1px;
  cursor: pointer;
}
.ke-link:hover { color: var(--ke-ink); border-color: var(--ke-ink); }

/* ------------------------------------------------------------
   Slot chips (4 estados)
   ------------------------------------------------------------ */
.ke-slot {
  font-family: var(--ke-mono);
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  height: 56px;
  padding: 10px 16px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 500;
  position: relative;
  border: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: transform 80ms ease-out;
  -webkit-tap-highlight-color: transparent;
}
.ke-slot__time { font-size: 18px; font-weight: 600; }
.ke-slot__dur  { font-size: 12px; opacity: 0.7; font-weight: 500; }
.ke-slot__state {
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  font-weight: 600;
}
.ke-slot__left  { display: flex; align-items: baseline; gap: 8px; }
.ke-slot[data-state="free"]    { background: var(--ke-lime);    color: var(--ke-lime-ink); }
.ke-slot[data-state="busy"]    { background: var(--ke-stone-2); color: #4B4A42; opacity: 0.7; cursor: not-allowed; }
.ke-slot[data-state="busy"] .ke-slot__time { text-decoration: line-through; text-decoration-color: rgba(0,0,0,0.3); }
.ke-slot[data-state="mine"]    { background: var(--ke-navy);    color: var(--ke-paper); }
.ke-slot[data-state="selected"]{ background: var(--ke-ink);     color: var(--ke-paper); }
.ke-slot:not([data-state="busy"]):active { transform: scale(0.985); }

/* ------------------------------------------------------------
   Date pill strip
   ------------------------------------------------------------ */
.ke-datestrip {
  display: flex; gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 20px 12px;
  margin: 0 -20px;
  scroll-snap-type: x mandatory;
}
.ke-datestrip::-webkit-scrollbar { display: none; }
.ke-datepill {
  flex: 0 0 52px;
  height: 64px;
  border-radius: 16px;
  background: var(--ke-paper);
  border: 1.5px solid var(--ke-line-2);
  color: var(--ke-ink-2);
  font-family: var(--ke-mono);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  cursor: pointer;
  scroll-snap-align: start;
  transition: background 120ms ease-out, color 120ms ease-out, border-color 120ms ease-out;
}
.ke-datepill__dow  { font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.75; }
.ke-datepill__day  { font-family: var(--ke-display); font-size: 22px; font-weight: 600; line-height: 1; }
.ke-datepill[aria-pressed="true"] {
  background: var(--ke-ink); color: var(--ke-paper); border-color: var(--ke-ink);
}

/* ------------------------------------------------------------
   Bottom sheet (sticky confirmation)
   ------------------------------------------------------------ */
.ke-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--ke-paper);
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  box-shadow: var(--sh-sheet);
  padding: 14px 20px 28px;
  z-index: 50;
  transform: translateY(100%);
  transition: transform 220ms cubic-bezier(.2,.7,.2,1);
  max-width: 480px;
  margin-inline: auto;
}
.ke-sheet[data-open="true"] { transform: translateY(0); }
.ke-sheet__handle {
  width: 40px; height: 4px;
  background: var(--ke-line-2);
  border-radius: 4px;
  margin: 0 auto 14px;
}
.ke-sheet__row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.ke-sheet__price { font-family: var(--ke-mono); font-size: 22px; font-weight: 600; }
.ke-sheet__sub { color: var(--ke-ink-3); font-size: 12.5px; margin-bottom: 14px; line-height: 1.45; }

@media (prefers-reduced-motion: reduce) {
  .ke-sheet { transition: none; }
}

/* ------------------------------------------------------------
   BottomNav (mobile, 4 items)
   ------------------------------------------------------------ */
.ke-bottomnav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: rgba(247, 245, 240, 0.92);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--ke-line);
  padding: 10px 14px 28px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  z-index: 40;
  max-width: 480px;
  margin-inline: auto;
}
.ke-bottomnav--3 { grid-template-columns: repeat(3, 1fr); }
.ke-bottomnav__item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--ke-ink-3);
  text-decoration: none;
  font-family: var(--ke-ui);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ke-bottomnav__icon {
  width: 44px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: transparent;
  transition: background 160ms ease-out;
}
.ke-bottomnav__icon svg { width: 20px; height: 20px; }
.ke-bottomnav__label {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.ke-bottomnav__item[aria-current="page"] { color: var(--ke-ink); }
.ke-bottomnav__item[aria-current="page"] .ke-bottomnav__icon { background: var(--ke-paper-2); }
.ke-bottomnav__item[aria-current="page"] .ke-bottomnav__label { font-weight: 600; }
/* Reservar tile when active: ink filled */
.ke-bottomnav__item[data-route="book"][aria-current="page"] .ke-bottomnav__icon {
  background: var(--ke-ink);
  color: var(--ke-paper);
}

/* ------------------------------------------------------------
   Crest (variantes paper / navy / white)
   ------------------------------------------------------------ */
.ke-crest { display: block; }
.ke-crest[data-variant="paper"] { color: var(--ke-navy); }
.ke-crest[data-variant="navy"]  { color: var(--ke-navy); }
.ke-crest[data-variant="white"] { color: var(--ke-paper); }

/* ------------------------------------------------------------
   Form fields
   ------------------------------------------------------------ */
.ke-field {
  position: relative;
  width: 100%;
}
.ke-field input {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  background: var(--ke-paper);
  border: 1.5px solid var(--ke-line-2);
  border-radius: 14px;
  font-family: var(--ke-mono);
  font-size: 18px;
  color: var(--ke-ink);
  transition: border-color 120ms ease-out, box-shadow 120ms ease-out;
}
.ke-field input::placeholder { color: var(--ke-ink-4); font-family: var(--ke-mono); }
.ke-field input:focus {
  outline: none;
  border-color: var(--ke-navy);
  box-shadow: 0 0 0 4px rgba(14, 42, 71, 0.10);
}
.ke-field__icon {
  position: absolute;
  right: 16px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px;
  color: var(--ke-ink-3);
  pointer-events: none;
}
.ke-field--has-icon input { padding-right: 50px; }
.ke-label {
  display: block;
  font-family: var(--ke-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ke-ink-3);
  margin-bottom: 8px;
}

.ke-check {
  display: inline-flex; align-items: center; gap: 10px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--ke-ink-2);
  -webkit-tap-highlight-color: transparent;
}
.ke-check input { position: absolute; opacity: 0; pointer-events: none; }
.ke-check__box {
  width: 20px; height: 20px;
  border: 1.5px solid var(--ke-line-2);
  border-radius: 6px;
  background: var(--ke-paper);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 120ms ease-out, border-color 120ms ease-out;
}
.ke-check__box svg { width: 14px; height: 14px; color: var(--ke-paper); opacity: 0; }
.ke-check input:checked + .ke-check__box {
  background: var(--ke-ink);
  border-color: var(--ke-ink);
}
.ke-check input:checked + .ke-check__box svg { opacity: 1; }

/* ------------------------------------------------------------
   Tabs (toggle 2 items)
   ------------------------------------------------------------ */
.ke-tabs {
  display: inline-flex;
  background: var(--ke-paper-2);
  border-radius: var(--r-pill);
  padding: 4px;
  gap: 2px;
}
.ke-tab {
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--r-pill);
  color: var(--ke-ink-3);
  cursor: pointer;
  transition: background 120ms ease-out, color 120ms ease-out;
  -webkit-tap-highlight-color: transparent;
}
.ke-tab[aria-selected="true"] {
  background: var(--ke-ink);
  color: var(--ke-paper);
  font-weight: 600;
}

/* ------------------------------------------------------------
   Toggle switch
   ------------------------------------------------------------ */
.ke-switch {
  display: inline-flex;
  position: relative;
  width: 44px; height: 26px;
  cursor: pointer;
  flex-shrink: 0;
}
.ke-switch input { position: absolute; opacity: 0; pointer-events: none; }
.ke-switch__track {
  width: 100%; height: 100%;
  background: var(--ke-line);
  border-radius: var(--r-pill);
  transition: background 160ms ease-out;
}
.ke-switch__thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--ke-paper);
  box-shadow: var(--sh-1);
  transition: transform 160ms ease-out;
}
.ke-switch input:checked ~ .ke-switch__track { background: var(--ke-lime); }
.ke-switch input:checked ~ .ke-switch__thumb { transform: translateX(18px); }

/* ------------------------------------------------------------
   Generic listrow (used in Reservar selector, Settings, etc.)
   ------------------------------------------------------------ */
.ke-listrow {
  display: flex; align-items: center;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--ke-line);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}
.ke-listrow:last-child { border-bottom: 0; }
.ke-listrow__icon {
  width: 44px; height: 44px;
  flex-shrink: 0;
  background: var(--ke-paper-2);
  border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ke-ink);
}
.ke-listrow__icon svg { width: 24px; height: 24px; }
.ke-listrow__body { flex: 1; min-width: 0; }
.ke-listrow__title {
  font-family: var(--ke-display);
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ke-ink);
  line-height: 1.15;
}
.ke-listrow__sub {
  font-family: var(--ke-mono);
  font-size: 11px;
  color: var(--ke-ink-3);
  letter-spacing: 0;
  margin-top: 4px;
}
.ke-listrow__right {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--ke-ink-3);
}
.ke-listrow__right svg { width: 18px; height: 18px; }

/* ------------------------------------------------------------
   Sport card with today availability timeline (Reservar list)
   ------------------------------------------------------------ */
.ke-sport-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--ke-line);
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}
.ke-sport-card:last-child { border-bottom: 0; }
.ke-sport-card__main {
  display: flex; align-items: center; gap: 14px;
}
.ke-sport-card__icon {
  width: 44px; height: 44px; flex-shrink: 0;
  background: var(--ke-paper-2);
  border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ke-ink);
}
.ke-sport-card__icon svg { width: 24px; height: 24px; }
.ke-sport-card__body { flex: 1; min-width: 0; }
.ke-sport-card__title {
  font-family: var(--ke-display);
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ke-ink);
  line-height: 1.15;
}
.ke-sport-card__sub {
  display: block;
  font-family: var(--ke-mono);
  font-size: 11px;
  color: var(--ke-ink-3);
  margin-top: 4px;
  letter-spacing: 0;
}
.ke-sport-card__right {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--ke-ink-3);
}
.ke-sport-card__right svg { width: 18px; height: 18px; }

/* timeline */
.ke-sport-card__times {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  padding-left: 58px;     /* alinea con el body después del icon (44+14) */
  padding-right: 4px;
}
.ke-sport-card__times::-webkit-scrollbar { display: none; }

.ke-mini-slot {
  font-family: var(--ke-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.01em;
  padding: 7px 10px;
  border-radius: 8px;
  white-space: nowrap;
  scroll-snap-align: start;
  flex-shrink: 0;
  line-height: 1;
}
.ke-mini-slot[data-state="free"]  { background: var(--ke-lime);    color: var(--ke-lime-ink); }
.ke-mini-slot[data-state="busy"]  {
  background: var(--ke-stone-2); color: #4B4A42;
  opacity: 0.65;
  text-decoration: line-through;
  text-decoration-color: rgba(0,0,0,0.3);
}
.ke-mini-slot[data-state="mine"]  { background: var(--ke-navy);    color: var(--ke-paper); }
.ke-mini-slot[data-state="info"]  { background: var(--ke-paper-2);  color: var(--ke-ink-2); }

/* Status dot (lima cuando free) */
.ke-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ke-stone);
  flex-shrink: 0;
}
.ke-dot[data-state="free"] {
  background: var(--ke-lime);
  box-shadow: 0 0 0 4px rgba(201, 242, 92, 0.25);
}
.ke-dot[data-state="busy"]  { background: var(--ke-stone); }

/* ------------------------------------------------------------
   Aviso pill (banner navy compacto en Home socio)
   ------------------------------------------------------------ */
.ke-notice {
  display: flex; align-items: center; gap: 10px;
  background: var(--ke-navy);
  color: var(--ke-paper);
  border-radius: 14px;
  padding: 12px 14px;
  text-decoration: none;
  font-size: 13px;
  line-height: 1.35;
}
.ke-notice svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.ke-notice strong { font-weight: 600; }
.ke-notice em { font-style: normal; opacity: 0.78; font-family: var(--ke-mono); font-size: 11px; }
