/* ============================================================
   STOCKITT — Login (versión Comprobante) · standalone
   Tokens de marca incrustados + estilos del comprobante.
   ============================================================ */

:root {
  /* Marca */
  --brand-navy:    #2A3865;
  --ui-header:     #0193FF;
  --ui-primary:    #327EEC;
  --ui-primary-700:#1643A8;
  --success:       #7EC83F;
  --success-700:   #5FA52B;
  --warning:       #FAB122;
  --info:          #29B6F6;
  --danger:        #E61D43;

  /* Neutros */
  --fg1:           #2C3138;
  --fg2:           #495058;
  --fg3:           #8A9199;
  --fg-on-dark-2:  #B9C4D0;
  --bg-app:        #F4F6F9;
  --border:        #E3E7EC;
  --border-strong: #D2D8DF;
  --link:          #327EEC;

  /* Tipografía */
  --font-ui:    "Source Sans 3", "Source Sans Pro", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-brand: "Quicksand", "Source Sans 3", sans-serif;
  --font-num:   "Source Sans 3", system-ui, sans-serif;

  --text-eyebrow: 700 13px/1.2  var(--font-ui);
  --text-body:    400 15px/1.55 var(--font-ui);
  --text-body-sm: 400 13px/1.5  var(--font-ui);
  --text-button:  600 15px/1    var(--font-ui);

  /* Radios */
  --radius-sm: 3px;
  --radius:    4px;

  /* Motion */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --dur-fast: 120ms;
  --dur: 200ms;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: var(--text-body);
  color: var(--fg1);
  background: var(--bg-app);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1 { margin: 0; }
p  { margin: 0; }
a  { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Marca / wordmark ---------- */
.wordmark {
  font-family: var(--font-brand);
  font-weight: 700;
  letter-spacing: -.5px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.wordmark img { height: 1.5em; width: auto; display: block; border-radius: 50%; }

/* ============================================================
   LAYOUT — escena (izq) + formulario (der)
   ============================================================ */
.login {
  height: 100%;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background: linear-gradient(155deg, #dfeefd 0%, #eaf1fc 55%, #ddeefb 100%);
}
.scene {
  position: relative;
  overflow: hidden;
  padding: 38px 50px;
  display: flex;
  flex-direction: column;
}
.scene .wordmark { font-size: 28px; color: var(--brand-navy); }
.headline { margin-top: 18px; max-width: 430px; position: relative; z-index: 4; }
.headline h1 {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: clamp(25px, 2.7vw, 35px);
  line-height: 1.1;
  color: var(--brand-navy);
}
.headline h1 em { font-style: normal; color: var(--ui-header); }
.headline h1 { transition: opacity .4s var(--ease), transform .4s var(--ease); }
.headline h1.is-swapping { opacity: 0; transform: translateY(8px); }
.headline p { color: var(--fg2); font-size: 16px; margin-top: 10px; }

.stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0;
  min-height: 0;
}

/* ---------- Flotantes (cajitas + bolsa) ---------- */
.float { animation: floaty var(--fdur, 6s) var(--ease) infinite; animation-delay: var(--fdelay, 0s); }
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(var(--rot, 0deg)); }
  50%      { transform: translateY(-16px) rotate(calc(var(--rot, 0deg) + 2deg)); }
}
.box {
  position: absolute;
  width: var(--bs, 40px); height: calc(var(--bs, 40px) * .84);
  border-radius: 6px;
  background: linear-gradient(160deg, #f0c489, #d99f56);
  box-shadow: 0 8px 16px rgba(25,57,91,.18), inset 0 -7px 12px rgba(120,72,20,.25);
  z-index: 2;
}
.box::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 7px; transform: translateX(-50%); background: rgba(193,140,72,.55); }
.box::after  { content: ""; position: absolute; left: 6px; right: 6px; top: 42%; height: 2px; background: rgba(120,72,20,.4); }
.bag {
  position: absolute;
  font-size: var(--bs, 54px);
  color: #e75780;
  filter: drop-shadow(0 8px 14px rgba(25,57,91,.22));
  z-index: 2;
  line-height: 1;
}

/* ============================================================
   COMPROBANTE
   ============================================================ */
.receipt {
  position: relative;
  z-index: 3;
  width: 344px;
  background: #fff;
  border-radius: 6px 6px 0 0;
  box-shadow: 0 26px 60px rgba(25,57,91,.22);
  padding: 22px 26px 18px;
  color: var(--fg1);
}
.receipt__head { text-align: center; border-bottom: 1px dashed var(--border-strong); padding-bottom: 12px; }
.receipt__head strong { font-family: var(--font-brand); font-size: 23px; color: var(--brand-navy); display: block; }
.receipt__head span { display: block; font-size: 12.5px; color: var(--fg3); }
.receipt__head .r-meta { margin-top: 5px; font-size: 11px; letter-spacing: .4px; }
.receipt__items { padding: 12px 0 2px; }
.r-item {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: nowrap;
  font-size: 14px; padding: 5px 0; color: var(--fg2);
}
.r-item span { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.r-item b { font-family: var(--font-num); color: var(--fg1); font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.r-total {
  display: flex; justify-content: space-between; align-items: baseline;
  border-top: 1px dashed var(--border-strong); margin-top: 6px; padding-top: 10px; padding-bottom: 2px;
}
.r-total span { font: var(--text-eyebrow); text-transform: uppercase; letter-spacing: 1px; color: var(--fg2); }
.r-amount { font-family: var(--font-num); font-weight: 700; font-size: 27px; line-height: 1.05; color: var(--success-700); font-variant-numeric: tabular-nums; }
.r-pay { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--fg3); margin-top: 16px; }
.r-pay span { white-space: nowrap; }
.receipt .r-pay { transition: opacity .4s var(--ease), transform .4s var(--ease); }
.receipt.is-printing .r-pay { opacity: 0; transform: translateY(6px); }
.r-barcode {
  height: 34px; margin: 14px 0 2px;
  background: repeating-linear-gradient(90deg, #2c3138 0 2px, #fff 2px 4px, #2c3138 4px 5px, #fff 5px 9px);
}
.r-stamp {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-14deg) scale(1);
  border: 3px solid var(--success);
  color: var(--success-700);
  font-weight: 800; letter-spacing: 3px; font-size: 26px;
  padding: 8px 20px; border-radius: 8px;
  background: rgba(255,255,255,.4);
  opacity: .9; pointer-events: none;
}
.receipt__zig {
  position: absolute; left: 0; right: 0; bottom: -11px; height: 12px;
  background:
    linear-gradient(135deg, #fff 50%, transparent 50%) 0 0 / 13px 12px repeat-x,
    linear-gradient(225deg, #fff 50%, transparent 50%) 6.5px 0 / 13px 12px repeat-x;
  filter: drop-shadow(0 6px 6px rgba(25,57,91,.10));
}
/* estados de animación (JS) */
.receipt.is-printing .r-item { opacity: 0; transform: translateY(8px); }
.receipt .r-item { transition: opacity .4s var(--ease), transform .4s var(--ease); }
.receipt .r-stamp { transition: opacity .3s var(--ease), transform .35s cubic-bezier(.34,1.5,.6,1); }
.receipt.is-printing .r-stamp { opacity: 0; transform: translate(-50%, -50%) rotate(-14deg) scale(1.9); }

/* ============================================================
   PANEL FORMULARIO
   ============================================================ */
.panel {
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 28px 44px 64px;
  box-shadow: -20px 0 50px rgba(25,57,91,.08);
}
.auth { width: 100%; max-width: 360px; text-align: center; }
.auth .auth-form, .auth .footer-links { text-align: left; }

.client-logo {
  width: 120px; height: 120px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--bg-app);
  border: 2px dashed var(--border-strong);
  display: grid; place-items: center;
  color: var(--fg3); font-size: 34px;
  overflow: hidden;
}
.client-logo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.client-logo.has-logo { border-style: solid; border-color: var(--border); background: #fff; }

.panel h1 { font-weight: 700; font-size: 24px; color: var(--fg1); line-height: 1.4em; }
.lede { color: var(--fg3); font-size: 14px; margin: 7px 0 20px; }
.auth__eyebrow {
  font: var(--text-eyebrow);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  display: inline-block;
  padding-bottom: 8px;
  border-bottom: 3px solid var(--success);
  margin-bottom: 17px;
  color: var(--fg1);
}

.field { margin-bottom: 14px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .fa-solid:first-child {
  position: absolute;
  left: 16px;
  font-size: 14px;
  color: var(--fg3);
  pointer-events: none;
  transition: color var(--dur) var(--ease);
}
.input-wrap input {
  width: 100%;
  font: var(--text-body);
  font-size: 15px;
  color: var(--fg1);
  padding: 14px 44px 14px 42px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-app);
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.input-wrap input::placeholder { color: var(--fg3); }
.input-wrap input:focus {
  background: #fff;
  border-color: var(--ui-primary);
  box-shadow: 0 0 0 4px rgba(50,126,236,.16);
}
.input-wrap input:focus + .pw-toggle,
.input-wrap input:focus ~ .fa-solid,
.input-wrap input:focus + .pw-toggle + .fa-solid { color: var(--ui-primary); }
.pw-toggle {
  position: absolute;
  right: 8px;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 0; background: transparent;
  color: var(--fg3);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--dur) var(--ease);
}
.pw-toggle:hover { color: var(--fg1); }

.form-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin: 4px 0 22px;
  font: var(--text-body-sm);
}
.form-meta a { color: var(--ui-primary); }

.btn-entrar {
  width: 100%;
  font: var(--text-button);
  font-size: 16px;
  color: #fff;
  background: var(--success);
  border: 0;
  border-radius: var(--radius);
  padding: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 6px 16px rgba(126,200,63,.32);
  transition: background var(--dur) var(--ease), transform var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease);
}
.btn-entrar:hover { background: var(--success-700); }
.btn-entrar:active { transform: translateY(1px); box-shadow: 0 3px 10px rgba(126,200,63,.3); }
.btn-entrar.is-done { background: var(--success-700); }

.footer-links {
  display: flex;
  gap: 18px;
  align-items: center;
  font: var(--text-body-sm);
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.footer-links a, .footer-links span { color: var(--fg3); }

/* ============================================================
   RESPONSIVE (móvil): franja superior + formulario debajo
   ============================================================ */
@media (max-width: 860px) {
  body { overflow: auto; }
  .login {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
    height: auto;
  }
  .scene {
    min-height: 0;
    overflow: visible;
    padding: 22px 24px 16px;
    gap: 6px;
    align-items: flex-start;
    justify-content: flex-start;
  }
  .scene .wordmark { font-size: 23px; }
  .stage, .headline h1, .headline p { display: none; }
  .headline { margin-top: 4px; }
  .panel { padding: 28px 24px 48px; box-shadow: none; }
}

/* Accesibilidad: respeta reduce-motion */
@media (prefers-reduced-motion: reduce) {
  .float { animation: none !important; }
  .receipt.is-printing .r-item { opacity: 1; transform: none; }
  .receipt.is-printing .r-pay { opacity: 1; transform: none; }
  .receipt.is-printing .r-stamp { opacity: .9; transform: translate(-50%, -50%) rotate(-14deg); }
}

/* Mensajes de error de autenticación */
.auth-error {
  display: flex;
  align-items: center;
  gap: 9px;
  background: #FDECEF;
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 18px;
  font: var(--text-body-sm);
}
.auth-error i { font-size: 15px; flex: none; }
.field-error {
  display: block;
  color: var(--danger);
  font: var(--text-body-sm);
  margin-top: 6px;
}

/* Inicio de sesión con llave de acceso (passkey) */
.passkey-login{ margin-top:14px; text-align:center; }
.passkey-login a{ color:inherit; opacity:.85; font-size:.92rem; text-decoration:none; display:inline-flex; align-items:center; gap:.45em; }
.passkey-login a:hover{ opacity:1; text-decoration:underline; }
