/* =====================================================================
   WOKA — Portal del cliente (móvil primero)
   Clases de layout usadas por src/Views/layouts/portal.php:
   .portal .portal-header .portal-logo .portal-main .portal-tabbar
   ===================================================================== */

body.portal {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--woka-cream);
  color: var(--text);
  font-size: 16px;
}
/* Burbujas decorativas de fondo */
body.portal::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 105% -2%, rgba(169, 192, 198, .75) 0 150px, transparent 151px),
    radial-gradient(circle at 88% 22%, rgba(223, 215, 150, .8) 0 22px, transparent 23px),
    radial-gradient(circle at -8% 58%, rgba(223, 215, 150, .75) 0 110px, transparent 111px),
    radial-gradient(circle at 12% 40%, rgba(218, 194, 179, .8) 0 14px, transparent 15px),
    radial-gradient(circle at 94% 78%, rgba(164, 46, 30, .14) 0 60px, transparent 61px),
    radial-gradient(circle at 80% 90%, rgba(169, 192, 198, .6) 0 18px, transparent 19px);
}

/* ---------------------------------------------------------------- estructura */
.portal-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  height: 64px; padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  background: rgba(235, 232, 216, .86);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.portal-logo { height: 34px; width: auto; }
.portal-main {
  position: relative; /* sobre las burbujas del fondo, sin crear contexto de apilamiento */
  width: 100%; max-width: 520px; margin: 0 auto;
  padding: 8px 16px calc(112px + env(safe-area-inset-bottom));
}
body.portal-public .portal-main { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.portal-main > .alert { border-radius: 16px; margin-bottom: 14px; font-weight: 500; }

.portal-tabbar {
  position: fixed; z-index: 40; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -6px 28px rgba(60, 40, 30, .12);
}
.portal-tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 58px; border-radius: 16px;
  color: var(--text-muted); font-size: .74rem; font-weight: 500; text-decoration: none;
  transition: background .15s, color .15s;
}
.portal-tabbar a .icon { width: 24px; height: 24px; }
.portal-tabbar a:hover { background: var(--surface-3); text-decoration: none; }
.portal-tabbar a.is-active { color: var(--woka-red); background: var(--woka-red-soft); font-weight: 600; }
.portal .toasts { left: 16px; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom)); margin: 0 auto; max-width: 488px; }
body.portal-public .toasts { bottom: calc(16px + env(safe-area-inset-bottom)); }

/* ---------------------------------------------------------------- piezas */
.pt-card {
  background: var(--surface);
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 2px 6px rgba(60, 40, 30, .05), 0 10px 26px rgba(60, 40, 30, .07);
  margin-bottom: 16px;
}
.pt-card h2 { font-size: 1.1rem; margin: 0 0 12px; }
.pt-page-head { padding: 8px 4px 12px; }
.pt-page-head h1 { font-size: 1.6rem; margin: 0 0 4px; }
.pt-page-head p { margin: 0; color: var(--text-muted); }

.pt-hero { text-align: center; padding: 16px 8px 18px; }
.pt-hero-logo { width: 72px; height: 72px; display: block; margin: 0 auto 10px; animation: pt-float 4s ease-in-out infinite; }
.pt-hero h1 { font-size: 1.7rem; margin: 0 0 6px; color: var(--woka-red); }
.pt-hero p { margin: 0 auto; max-width: 360px; color: var(--text-muted); }

/* Formularios grandes y cómodos para el pulgar */
.pt-form { display: flex; flex-direction: column; gap: 16px; }
.pt-form .field > label, .pt-form .field > .label { font-size: .92rem; color: var(--text); font-weight: 600; }
.pt-form input[type=text], .pt-form input[type=tel], .pt-form input[type=password],
.pt-form input[type=email], .pt-form input[type=date], .pt-form select {
  min-height: 54px; font-size: 1.05rem; border-radius: 14px; padding: 12px 16px;
}
.pt-form .input-group > select { width: auto; flex: none; padding-right: 30px; background-position: right 10px center; }
.pt-form .input-group > input { flex: 1; min-width: 0; }
.pt-form .btn-lg { min-height: 56px; }
.pt-form .error-text { font-size: .85rem; font-weight: 500; }
.pt-pass { position: relative; }
.pt-pass input { padding-right: 56px !important; }
.pt-pass-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; border: 0; border-radius: 12px; background: transparent;
  color: var(--text-muted); cursor: pointer; display: grid; place-items: center;
}
.pt-pass-toggle:hover { background: var(--surface-3); }
.pt-check { display: flex; gap: 12px; align-items: flex-start; min-height: 44px; cursor: pointer; font-size: .95rem; line-height: 1.4; }
.pt-check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--woka-red); }
.pt-form .field > label.pt-check { font-weight: 400; font-size: .95rem; }
.pt-check input[aria-invalid=true] { outline: 2px solid var(--danger); outline-offset: 2px; }
.pt-switch { min-height: 48px; font-size: .95rem; }
.pt-help { display: flex; gap: 8px; align-items: flex-start; margin: 0; font-size: .86rem; color: var(--text-muted); }
.pt-help .icon-sm { margin-top: 2px; color: var(--woka-blue-deep); }
.pt-cta { text-align: center; }
.pt-cta p { margin: 0 0 12px; }
.pt-note { text-align: center; color: var(--text-muted); font-size: .92rem; margin: 8px 0 16px; }
.pt-legal { text-align: center; font-size: .82rem; margin: 8px 0 0; }
.pt-legal a { color: var(--text-muted); text-decoration: underline; }
.pt-readonly { margin: 0; padding: 14px 16px; border-radius: 14px; background: var(--surface-3); display: flex; gap: 8px; align-items: center; font-weight: 500; }
.pt-logout { margin: 4px 0 12px; }
.pt-logout .btn { color: var(--danger); }

/* ---------------------------------------------------------------- inicio */
.pt-greeting { padding: 12px 4px 4px; }
.pt-greeting h1 { font-size: 1.75rem; margin: 0 0 2px; }
.pt-greeting p { margin: 0; color: var(--text-muted); font-size: 1.02rem; }

.pt-member {
  position: relative; overflow: hidden; display: block;
  margin: 16px 0; padding: 20px 20px 16px; border-radius: 26px;
  color: #fff; text-decoration: none !important;
  background: linear-gradient(140deg, #C0412C 0%, var(--woka-red) 42%, #7C2116 100%);
  box-shadow: 0 16px 34px rgba(164, 46, 30, .32);
  transition: transform .12s;
}
.pt-member:active { transform: scale(.99); }
.pt-member::before, .pt-member::after { content: ''; position: absolute; border-radius: 50%; pointer-events: none; }
.pt-member::before { width: 190px; height: 190px; right: -70px; top: -90px; background: var(--woka-yellow); opacity: .22; }
.pt-member::after { width: 110px; height: 110px; left: -36px; bottom: -58px; background: var(--woka-blue); opacity: .32; }
.pt-member > span { position: relative; z-index: 1; }
.pt-member-head { display: flex; flex-direction: column; }
.pt-member-label { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; opacity: .85; }
.pt-member-name { font-size: 1.08rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-member-body { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 18px; }
.pt-member-pts { display: block; min-width: 0; }
.pt-member-num { font-size: 2.9rem; font-weight: 700; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.pt-member-unit { font-weight: 500; margin-left: 6px; font-size: 1.05rem; }
.pt-member-val { display: block; font-size: .88rem; opacity: .9; margin-top: 6px; }
.pt-member-qr { flex: none; background: #fff; border-radius: 14px; padding: 6px; line-height: 0; box-shadow: 0 4px 12px rgba(0, 0, 0, .15); }
.pt-member-qr:empty { display: none; }
.pt-member-foot {
  display: flex; align-items: center; gap: 6px; margin-top: 16px; padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, .38); font-size: .86rem; font-weight: 500;
}
.pt-member-foot .icon-sm:last-child { margin-left: auto; }

.pt-minis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.pt-mini { display: flex; flex-direction: column; gap: 2px; padding: 16px; margin: 0; min-width: 0; }
.pt-mini-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 6px; }
.pt-mini-icon.is-green { background: var(--ok-soft); color: var(--ok); }
.pt-mini-icon.is-yellow { background: var(--woka-yellow-soft); color: #6B6320; }
.pt-mini-label { font-size: .82rem; color: var(--text-muted); font-weight: 500; }
.pt-mini-value { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; overflow-wrap: anywhere; }
.pt-mini-hint { font-size: .78rem; color: var(--text-muted); line-height: 1.3; }
.pt-mini.is-highlight { background: var(--woka-yellow-soft); box-shadow: 0 0 0 2px var(--woka-yellow) inset, 0 10px 26px rgba(60, 40, 30, .07); }

.pt-reward {
  display: flex; gap: 14px; align-items: center;
  margin-bottom: 16px; padding: 18px; border-radius: 22px;
  background: var(--woka-yellow); color: #3B3615;
  box-shadow: 0 10px 26px rgba(107, 99, 32, .2);
}
.pt-reward h2 { font-size: 1.12rem; margin: 0 0 4px; color: #2F2B10; }
.pt-reward p { margin: 0; font-size: .92rem; }
.pt-reward-icon { width: 58px; height: 58px; border-radius: 50%; flex: none; display: grid; place-items: center; background: #fff; color: var(--woka-red); animation: pt-wiggle 2.6s ease-in-out infinite; }

.pt-visitas-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pt-visitas-head h2 { margin: 0; }
.pt-visitas-count { color: var(--text-muted); font-size: .95rem; }
.pt-visitas-count strong { color: var(--woka-red); font-size: 1.3rem; }
.pt-bubbles {
  display: grid; grid-template-columns: repeat(var(--n, 7), minmax(0, 44px));
  justify-content: center; gap: 8px; margin: 16px 0 12px;
}
.pt-bubble {
  position: relative; width: 100%; aspect-ratio: 1; border-radius: 50%;
  border: 3px solid var(--woka-beige); background: #fff;
  display: grid; place-items: center; color: #6B6320;
}
.pt-bubble.is-full {
  border-color: var(--woka-red);
  background: radial-gradient(circle at 35% 30%, #D45A43 0%, var(--woka-red) 58%, #7C2116 100%);
  box-shadow: 0 4px 10px rgba(164, 46, 30, .28);
  animation: pt-pop .45s cubic-bezier(.3, 1.6, .5, 1) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}
.pt-bubble.is-full::after {
  content: ''; position: absolute; width: 26%; height: 26%; left: 22%; top: 18%;
  border-radius: 50%; background: rgba(255, 255, 255, .55);
}
.pt-bubble.is-goal { border-color: #CFC67A; background: var(--woka-yellow-soft); }
.pt-bubble.is-goal.is-full { background: var(--woka-yellow); border-color: #B9B060; color: #3B3615; }
.pt-bubble.is-goal.is-full::after { display: none; }
.pt-bubble .icon-sm { width: 55%; height: 55%; }
.pt-visitas-msg { text-align: center; font-size: 1rem; margin: 0 0 4px; }
.pt-visitas-msg strong { color: var(--woka-red); }
.pt-visitas-total { text-align: center; font-size: .82rem; color: var(--text-muted); margin: 0; }

.pt-steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.pt-steps li { display: flex; gap: 12px; align-items: flex-start; }
.pt-steps p { margin: 2px 0 0; color: var(--text-muted); font-size: .92rem; }
.pt-step-num {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--woka-blue); color: #1F3A40; font-weight: 700;
}
.pt-como-nota { margin: 14px 0 0; font-size: .78rem; color: var(--text-soft); }

/* ---------------------------------------------------------------- mi QR */
body.pt-qr-mode { background: #FFFFFF; }
body.pt-qr-mode::before { opacity: .35; }
body.pt-qr-mode .portal-header { background: rgba(255, 255, 255, .9); }
.pt-qr-page { text-align: center; padding-top: 4px; }
.pt-qr-page h1 { font-size: 1.6rem; margin: 4px 0 6px; }
.pt-qr-lead { color: var(--text-muted); margin: 0 auto 8px; max-width: 380px; }
.pt-qr-lead strong { color: var(--woka-red); }
.pt-qr-card {
  display: inline-grid; place-items: center; min-width: 200px; min-height: 200px;
  margin: 12px auto 4px; padding: 18px; border-radius: 28px;
  background: #fff; border: 4px solid var(--woka-red);
  box-shadow: 0 18px 40px rgba(60, 40, 30, .16);
  cursor: zoom-in; font: inherit;
}
.pt-qr-card svg { width: min(72vw, 300px); height: auto; display: block; }
.pt-qr-loading { color: var(--text-soft); }
.pt-qr-error { max-width: 220px; color: var(--danger); font-size: .9rem; }
.pt-qr-code { margin: 10px 0 4px; }
.pt-qr-code code { font-family: var(--mono); font-size: 1.05rem; letter-spacing: .08em; padding: 6px 14px; border-radius: var(--r-pill); background: var(--surface-3); }
.pt-qr-tel { margin: 6px 0 0; color: var(--text-muted); font-size: .92rem; }
.pt-qr-tel strong { color: var(--text); }
.pt-qr-tip {
  display: flex; gap: 10px; align-items: center; text-align: left;
  margin: 18px 0 14px; padding: 12px 16px; border-radius: 16px;
  background: var(--woka-yellow-soft); color: #4A4418; font-size: .9rem;
}
.pt-qr-tip .icon { color: #8C8230; flex: none; }
.pt-qr-full {
  position: fixed; inset: 0; z-index: 300;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 24px; background: #FFFFFF;
}
.pt-qr-full-inner { line-height: 0; cursor: zoom-out; }
.pt-qr-full-inner svg { max-width: 100%; height: auto; }
.pt-qr-full-code { margin: 0; font-family: var(--mono); font-size: 1.2rem; letter-spacing: .1em; color: var(--text); }
body.pt-qr-full-open { overflow: hidden; }
body.pt-qr-full-open .portal-tabbar { display: none; }

/* ---------------------------------------------------------------- historial */
.pt-orders { list-style: none; padding: 0; margin: 0; }
.pt-order { padding: 16px 18px; }
.pt-order.is-cancelada { opacity: .72; }
.pt-order-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.pt-order-when { display: flex; flex-direction: column; min-width: 0; }
.pt-order-when strong { font-size: .98rem; }
.pt-order-when > span { font-size: .8rem; color: var(--text-muted); }
.pt-order-when .mono { font-size: .76rem; }
.pt-order-total { text-align: right; flex: none; display: flex; flex-direction: column; }
.pt-order-total strong { font-size: 1.12rem; font-variant-numeric: tabular-nums; }
.pt-order.is-cancelada .pt-order-total strong { text-decoration: line-through; }
.pt-order-total span { font-size: .72rem; color: var(--text-soft); }
.pt-order-items {
  list-style: none; margin: 12px 0 0; padding: 12px 0 0;
  border-top: 1px dashed var(--border-strong);
  display: flex; flex-direction: column; gap: 8px;
}
.pt-order-items li { display: flex; gap: 8px; align-items: baseline; font-size: .94rem; }
.pt-order-items li small { display: block; color: var(--text-muted); font-size: .8rem; }
.pt-order-items li.is-cancelado { color: var(--text-soft); text-decoration: line-through; }
.pt-order-items .badge { margin-left: auto; }
.pt-qty { font-weight: 700; color: var(--woka-red); min-width: 26px; }
.pt-order-recarga { display: flex; gap: 6px; align-items: center; margin: 12px 0 0; padding-top: 12px; border-top: 1px dashed var(--border-strong); font-size: .94rem; }
.pt-order-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.pt-pager { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 4px 0 16px; }
.pt-pager > :last-child { justify-self: end; }
.pt-pager-info { font-size: .85rem; color: var(--text-muted); }
.pt-empty { text-align: center; padding: 36px 20px; }
.pt-empty .icon-lg { color: var(--woka-blue-deep); width: 44px; height: 44px; }
.pt-empty h2 { margin: 10px 0 6px; }
.pt-empty p { color: var(--text-muted); }

/* ---------------------------------------------------------------- aviso de privacidad */
.pt-legal-text h2 { font-size: 1rem; margin: 18px 0 6px; color: var(--woka-red); }
.pt-legal-text h2:first-child { margin-top: 0; }
.pt-legal-text p, .pt-legal-text li { font-size: .94rem; line-height: 1.55; }
.pt-legal-text ul { padding-left: 20px; margin: 0 0 1em; }

/* ---------------------------------------------------------------- animaciones */
@keyframes pt-pop { from { transform: scale(.3); opacity: 0; } }
@keyframes pt-float { 50% { transform: translateY(-6px); } }
@keyframes pt-wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-10deg); } 90% { transform: rotate(8deg); } 95% { transform: rotate(-4deg); } }
@media (prefers-reduced-motion: reduce) {
  .pt-hero-logo, .pt-reward-icon, .pt-bubble.is-full { animation: none; }
}

/* ---------------------------------------------------------------- pantallas medianas */
@media (min-width: 600px) {
  .portal-main { padding-top: 16px; }
  .pt-card { padding: 24px; }
}
@media (max-width: 360px) {
  .pt-member-num { font-size: 2.4rem; }
  .pt-minis { gap: 8px; }
  .pt-mini { padding: 14px; }
  .pt-bubbles { gap: 5px; }
}
