/* =========================================================
   Camping Derby · Portal WiFi (MikroTik Hotspot)
   Sin dependencias externas: todo se sirve desde el router.
   ========================================================= */

:root {
  --green-900: #0f3a2e;
  --green-800: #154a3b;
  --green-700: #1d5c49;
  --green-500: #2f7d63;
  --sea:       #7cc4b0;
  --sea-soft:  #bfe5da;
  --sun:       #f39a2e;
  --sun-dark:  #e07f10;
  --cream:     #fbf6ec;
  --ink:       #12302a;
  --muted:     #5b7069;
  --danger:    #d9483b;
  --radius:    24px;
  --font: "Avenir Next", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html, body { min-height: 100%; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--green-900);
  background-image:
    radial-gradient(circle at 50% -10%, rgba(243,154,46,.55) 0, rgba(243,154,46,0) 38%),
    linear-gradient(180deg, var(--green-800) 0%, var(--green-900) 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Olas animadas de fondo ---------- */
.waves {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 34vh;
  min-height: 180px;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.waves svg {
  position: absolute;
  bottom: 0;
  width: 200%;
  height: 100%;
}
.waves .w1 { animation: drift 14s linear infinite; opacity: .35; }
.waves .w2 { animation: drift 9s linear infinite reverse; opacity: .55; bottom: -14px; }
.waves .w3 { animation: drift 20s linear infinite; opacity: 1; bottom: -30px; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- Barra superior ---------- */
.topbar {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 460px;
  display: flex;
  justify-content: flex-end;
  padding: 14px 16px 0;
}
.lang {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  padding: 4px;
  border-radius: 999px;
}
.lang button {
  font: 600 12px/1 var(--font);
  letter-spacing: .5px;
  color: rgba(255,255,255,.75);
  background: transparent;
  border: 0;
  border-radius: 999px;
  padding: 7px 10px;
  cursor: pointer;
}
.lang button.on { background: var(--cream); color: var(--green-800); }

/* ---------- Contenedor y tarjeta ---------- */
.wrap {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 460px;
  padding: 8px 16px 40px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.logo {
  display: block;
  width: 140px;
  height: 140px;
  margin: 6px auto -48px;
  position: relative;
  z-index: 3;
  filter: drop-shadow(0 10px 22px rgba(0,0,0,.35));
  animation: pop .7s cubic-bezier(.2,1.4,.4,1) both;
}
.logo img {
  width: 100%; height: 100%;
  object-fit: contain;
  background: #fff;
  border-radius: 50%;
  padding: 2px;
  box-shadow: 0 0 0 4px rgba(255,255,255,.18);
}

.card {
  background: var(--cream);
  border-radius: var(--radius);
  padding: 64px 26px 26px;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.06);
  text-align: center;
  animation: rise .6s ease-out both .1s;
}

.eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--sun-dark);
  margin-bottom: 8px;
}
h1 {
  font-size: 28px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -.5px;
  color: var(--green-800);
}
.sub {
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- Chips de ventajas ---------- */
.perks {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 22px;
}
.perk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--green-700);
  background: #fff;
  border: 1px solid #e6e0d2;
  border-radius: 999px;
  padding: 7px 12px;
}
.perk svg { width: 16px; height: 16px; flex: none; }

/* ---------- Botones ---------- */
.btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  border: 0;
  border-radius: 16px;
  font: 700 17px/1.2 var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, opacity .2s;
  -webkit-appearance: none;
  appearance: none;
}
.btn svg { width: 22px; height: 22px; flex: none; }
.btn:active { transform: scale(.98); }

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--sun) 0%, var(--sun-dark) 100%);
  box-shadow: 0 12px 24px -8px rgba(224,127,16,.7), inset 0 1px 0 rgba(255,255,255,.35);
  overflow: hidden;
}
.btn-primary::after {           /* brillo que recorre el botón */
  content: "";
  position: absolute;
  top: 0; left: -60%;
  width: 40%; height: 100%;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.45), rgba(255,255,255,0));
  transform: skewX(-20deg);
  animation: shine 3.2s ease-in-out infinite 1.2s;
}
.btn-primary.disabled { opacity: .55; box-shadow: none; }
.btn-primary.disabled::after { display: none; }
.btn-primary.loading { pointer-events: none; }
.btn-primary.loading .label { opacity: 0; }
.btn-primary.loading .spinner { display: block; }

.btn-ghost {
  color: var(--green-700);
  background: transparent;
  border: 2px solid #d9d2c1;
  min-height: 50px;
  font-size: 15px;
  margin-top: 10px;
}
.btn-dark {
  color: #fff;
  background: var(--green-700);
  box-shadow: 0 12px 24px -10px rgba(15,58,46,.8);
}

.spinner {
  display: none;
  position: absolute;
  width: 24px; height: 24px;
  border: 3px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.label { display: inline-flex; align-items: center; gap: 10px; }

/* ---------- Pestañas Invitados / Clientes ---------- */
.tabs {
  position: relative;
  display: flex;
  background: #ece5d5;
  border-radius: 16px;
  padding: 5px;
  margin: 20px 0 4px;
}
.tab {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 0;
  background: transparent;
  border-radius: 12px;
  font: 700 15px/1 var(--font);
  color: var(--muted);
  cursor: pointer;
  transition: color .25s;
}
.tab svg { width: 18px; height: 18px; }
.tab.on { color: var(--green-800); }
.tab.on svg { color: var(--sun-dark); }
.tab-pill {
  position: absolute;
  top: 5px; bottom: 5px; left: 5px;
  width: calc(50% - 5px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px -4px rgba(15,58,46,.25);
  transition: transform .3s cubic-bezier(.3,1.3,.5,1);
}
.tabs.right .tab-pill { transform: translateX(100%); }

.pane { display: none; }
.pane.on { display: block; animation: rise .35s ease-out both; }
.pane > .sub:first-child { margin-top: 14px; }
.tabs + .pane .perks, .pane .perks { margin-top: 16px; }

/* ---------- Formulario de clientes ---------- */
.login-form { margin-top: 18px; }
.field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 2px solid #e6e0d2;
  border-radius: 16px;
  padding: 0 8px 0 16px;
  margin-bottom: 10px;
  transition: border-color .2s, box-shadow .2s;
}
.field:focus-within { border-color: var(--green-500); box-shadow: 0 0 0 4px rgba(47,125,99,.15); }
.field > svg { width: 20px; height: 20px; flex: none; color: var(--muted); }
.field:focus-within > svg { color: var(--green-500); }
.field input {
  flex: 1;
  min-width: 0;
  height: 54px;
  border: 0;
  outline: 0;
  background: transparent;
  font: 600 16px var(--font);       /* 16px evita el zoom automático en iOS */
  color: var(--ink);
}
.field input::placeholder { color: #9aa9a3; font-weight: 500; }
.field.shake { border-color: var(--danger); animation: shake .45s; }
.eye {
  flex: none;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 10px;
  background: transparent;
  color: #9aa9a3;
  cursor: pointer;
}
.eye svg { width: 20px; height: 20px; }
.eye.on { color: var(--green-500); background: #e6f4ef; }
.login-form .btn { margin-top: 6px; }

/* ---------- Condiciones ---------- */
.terms {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  margin: 16px 2px 0;
  cursor: pointer;
}
.terms input {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 22px; height: 22px;
  margin-top: 1px;
  border: 2px solid #c9c1ae;
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
  transition: all .15s;
}
.terms input:checked {
  background: var(--green-500) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center/14px no-repeat;
  border-color: var(--green-500);
}
.terms a { color: var(--green-700); font-weight: 700; text-decoration: underline; }
.shake { animation: shake .45s; }
.shake input { border-color: var(--danger); }

.legal {
  display: none;
  text-align: left;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
  background: #fff;
  border: 1px solid #e6e0d2;
  border-radius: 14px;
  padding: 14px 16px;
  margin-top: 12px;
}
.legal.open { display: block; animation: rise .3s ease-out both; }
.legal p + p { margin-top: 8px; }

/* ---------- Avisos ---------- */
.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  text-align: left;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 600;
  border-radius: 14px;
  padding: 12px 14px;
  margin: 0 0 18px;
}
.alert svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.alert-error { color: #9b2a20; background: #fde7e4; border: 1px solid #f6c3bc; }
.alert-info  { color: var(--green-700); background: #e6f4ef; border: 1px solid var(--sea-soft); }

/* ---------- Pie ---------- */
.foot {
  margin-top: 18px;
  text-align: center;
  font-size: 12.5px;
  color: rgba(255,255,255,.75);
}
.foot a { color: #fff; font-weight: 700; text-decoration: none; }
.foot .dot { opacity: .5; margin: 0 6px; }

/* ---------- Éxito (alogin) ---------- */
.check {
  display: block;
  width: 92px; height: 92px;
  margin: 0 auto 18px;
}
.check circle { fill: #e6f4ef; stroke: var(--green-500); stroke-width: 3; stroke-dasharray: 280; stroke-dashoffset: 280; animation: draw .7s ease-out forwards .2s; }
.check path   { fill: none; stroke: var(--green-500); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .4s ease-out forwards .8s; }
.countdown { margin-top: 14px; font-size: 13px; color: var(--muted); }
.countdown b { color: var(--green-700); }
.countdown a { color: var(--green-700); font-weight: 700; }

/* ---------- Estado (status) ---------- */
.ring {
  position: relative;
  width: 196px; height: 196px;
  margin: 4px auto 20px;
}
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { fill: none; stroke: #ebe4d4; stroke-width: 14; }
.ring .bar   { fill: none; stroke: url(#grad); stroke-width: 14; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.ring .center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ring .time { font-size: 34px; font-weight: 800; letter-spacing: -1px; color: var(--green-800); font-variant-numeric: tabular-nums; }
.ring .cap  { font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin-top: 2px; }

.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--green-500);
  background: #e6f4ef;
  border-radius: 999px;
  padding: 6px 12px;
  margin-bottom: 12px;
}
.live i {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green-500);
  box-shadow: 0 0 0 0 rgba(47,125,99,.6);
  animation: pulse 1.8s infinite;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0 18px;
  text-align: left;
}
.stat {
  background: #fff;
  border: 1px solid #e6e0d2;
  border-radius: 16px;
  padding: 12px 14px;
}
.stat small {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}
.stat strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--green-800);
  word-break: break-all;
  font-variant-numeric: tabular-nums;
}

/* ---------- Animaciones ---------- */
@keyframes rise  { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes pop   { from { opacity: 0; transform: scale(.6) rotate(-12deg); } to { opacity: 1; transform: none; } }
@keyframes spin  { to { transform: rotate(360deg); } }
@keyframes draw  { to { stroke-dashoffset: 0; } }
@keyframes shine { 0% { left: -60%; } 40%, 100% { left: 130%; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(47,125,99,.6); } 70% { box-shadow: 0 0 0 10px rgba(47,125,99,0); } 100% { box-shadow: 0 0 0 0 rgba(47,125,99,0); } }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(3px); } 30%, 50%, 70% { transform: translateX(-6px); } 40%, 60% { transform: translateX(6px); } }

@media (max-height: 640px) {
  .logo { width: 110px; height: 110px; margin-bottom: -40px; }
  .card { padding-top: 52px; }
  h1 { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .check circle, .check path { stroke-dashoffset: 0; }
}
