/* ==========================================================================
   auth.css — Acceso al panel de gestión de GECOTEL.

   Adaptación del sistema de acceso de la tienda (`tienda/src/public/session/css/auth.css`)
   a la identidad del panel: navy #0d1727 y dorado #c78300, los mismos tokens de
   `assets/css/admin-ui.css`, de modo que el login anticipe el panel al que se entra.

   Se usa en:
     - /index.php                    (inicio de sesión)
     - /session/autenticacion.php    (verificación en dos pasos)
   ========================================================================== */
:root {
  --ink:        #0d1727;
  --ink-2:      #18253a;
  --paper:      #f6f5f1;
  --surface:    #ffffff;
  --text:       #111b2b;
  --text-soft:  #728097;
  --label:      #3a4051;
  --gold:       #c78300;
  --gold-hi:    #a96f00;
  --gold-ink:   #ffffff;
  --gold-soft:  #f0b73f;
  --gold-acc:   #c78300;
  --gold-acc-2: #9c6600;
  --line:       #e7e5df;
  --red:        #e5484d;
  --display: 'Manrope', system-ui, -apple-system, sans-serif;
  --ui:      'Inter', system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(.4, 0, .2, 1);
}
* { box-sizing: border-box; }
/* `hidden` debe ganar a los display de .notice y .caps, que nacen ocultos. */
[hidden] { display: none !important; }
body { margin: 0; font-family: var(--ui); color: var(--text); background: var(--ink); }

/* ---------------------------------------------------------- Estructura -- */
.post { min-height: 100vh; display: grid; grid-template-columns: 1fr; background: var(--ink); }

.post__frank {
  position: relative; overflow: hidden;
  background: radial-gradient(130% 110% at 100% 0%, var(--ink-2) 0%, var(--ink) 55%);
  color: #eef0f3;
  padding: 34px 30px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 26px;
}
.post__frank > * { position: relative; z-index: 1; }

.post__mark { display: inline-block; }
.post__mark img { height: 42px; width: auto; display: block; filter: brightness(0) invert(1); }

.post__lead { max-width: 42ch; }
.post__eyebrow {
  display: inline-flex; align-items: center; gap: .55rem; margin: 0 0 1rem;
  font-family: var(--display); font-weight: 800; font-size: 11.5px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--gold-soft);
}
.post__eyebrow .live { width: 7px; height: 7px; border-radius: 50%; background: var(--gold-soft); animation: livePulse 2s var(--ease) infinite; }
.post__lead h2 {
  font-family: var(--display); font-weight: 800; font-size: clamp(1.75rem, 2.6vw, 2.5rem);
  line-height: 1.14; letter-spacing: -.02em; margin: 0 0 .8rem; color: #fff;
}
.post__lead h2 .hl { color: var(--gold-soft); }
.post__lead p { color: #aeb5c1; font-size: 1rem; line-height: 1.6; max-width: 36ch; margin: 0; }

.post__copy { font-family: var(--ui); font-size: 11px; letter-spacing: .04em; color: rgba(238, 240, 243, .4); }

/* ---------- Cuerpo del formulario ---------- */
.post__body { position: relative; background: var(--paper); color: var(--text); padding: 46px 24px 40px; }
.post__back {
  position: absolute; top: 20px; right: 22px;
  font-family: var(--display); font-weight: 700; font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-soft); text-decoration: none; display: inline-flex; align-items: center; gap: .5rem;
  transition: color .18s var(--ease);
}
.post__back i { transition: transform .18s var(--ease); }
.post__back:hover { color: var(--gold-acc); }
.post__back:hover i { transform: translateX(-3px); }

.post__inner { width: 100%; max-width: 424px; margin: 0 auto; }

.kicker { font-family: var(--display); font-weight: 800; font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-acc); margin: 0 0 .55rem; }
.post__title { font-family: var(--display); font-weight: 800; font-size: 2rem; line-height: 1.12; letter-spacing: -.01em; color: var(--text); margin: 0 0 .5rem; }
.post__sub { color: var(--text-soft); margin: 0 0 1.9rem; font-size: .95rem; line-height: 1.5; }

/* ---------- Campos ---------- */
.field { margin-bottom: 1.15rem; }
.field .kicker { color: var(--label); margin-bottom: .5rem; font-size: .8rem; letter-spacing: .03em; }
.field__control { position: relative; }
.field input {
  width: 100%; height: 48px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 11px;
  padding: 0 14px; color: var(--text); font-family: var(--ui); font-size: .95rem;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.field input::placeholder { color: #9aa1ae; }
.field input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(199, 131, 0, .18); }
.field--invalid input { border-color: var(--red); }
.field--invalid input:focus { box-shadow: 0 0 0 3px rgba(229, 72, 77, .18); }

.field__control--pass input { padding-right: 50px; }
.field__eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border: none; border-radius: 9px;
  background: #f1efe9; color: var(--text-soft); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color .18s var(--ease), background .18s var(--ease);
}
.field__eye:hover { color: var(--gold-acc-2); background: #ece9e2; }

.field__error { display: none; margin: .5rem 0 0; font-size: .82rem; color: var(--red); line-height: 1.4; }
.field__error::before { content: '\f06a'; font-family: 'Font Awesome 6 Free'; font-weight: 900; margin-right: .45rem; font-size: .78rem; }
.field--invalid .field__error { display: block; }

/* ---------- Botón ---------- */
.submit {
  position: relative; overflow: hidden; isolation: isolate;
  width: 100%; height: 52px; margin-top: .4rem; border: none; border-radius: 12px; cursor: pointer;
  background: var(--gold); color: var(--gold-ink);
  font-family: var(--display); font-weight: 800; font-size: 1rem; letter-spacing: .01em;
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  box-shadow: 0 14px 30px -12px rgba(199, 131, 0, .8);
  transition: background .18s var(--ease), transform .12s var(--ease), box-shadow .18s var(--ease);
}
.submit::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .35) 50%, transparent 65%); transform: translateX(-130%); transition: transform .7s var(--ease); }
.submit:hover { background: var(--gold-hi); transform: translateY(-2px); box-shadow: 0 18px 34px -12px rgba(199, 131, 0, .9); }
.submit:hover::before { transform: translateX(130%); }
.submit:active { transform: translateY(0); }
.submit:disabled { cursor: default; transform: none; }
.submit__arrow { display: inline-flex; transition: transform .25s var(--ease); }
.submit:hover .submit__arrow { transform: translateX(5px); }
.submit__spin { display: none; }
.submit.is-loading .submit__label, .submit.is-loading .submit__arrow { visibility: hidden; }
.submit.is-loading .submit__spin { display: inline-flex; position: absolute; }
.submit.is-loading::before { display: none; }

.post__alt { margin-top: 1.7rem; text-align: center; font-size: .9rem; color: var(--text-soft); }
.post__alt a { color: var(--gold-acc-2); font-weight: 700; text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .18s var(--ease); }
.post__alt a:hover { border-bottom-color: var(--gold-acc-2); }

/* ---------- Ventajas del panel ---------- */
.perks { list-style: none; margin: 1.9rem 0 0; padding: 0; display: grid; gap: .95rem; }
.perks li { display: flex; align-items: center; gap: .8rem; color: #eef0f3; font-size: .97rem; font-weight: 500; text-shadow: 0 1px 8px rgba(0,0,0,.3); }
.perks__ic {
  width: 38px; height: 38px; flex: none; border-radius: 11px;
  background: rgba(240, 183, 63, .18); color: var(--gold-soft);
  border: 1px solid rgba(240, 183, 63, .28);
  display: inline-flex; align-items: center; justify-content: center; font-size: .92rem;
}

/* ---------- Verificación en dos pasos ---------- */
.codebox {
  text-align: center; letter-spacing: .55em; font-family: var(--display);
  font-weight: 700; font-size: 1.5rem; padding-left: .55em;
}
.codebox::placeholder { letter-spacing: .35em; font-weight: 500; }

.sentto {
  display: flex; align-items: center; gap: 10px; margin-bottom: 20px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfaf8;
  font-size: .9rem; line-height: 1.45;
}
.sentto i { flex: none; color: var(--gold-acc); }
.sentto b { color: var(--text); overflow-wrap: anywhere; }

.resend { margin-top: 18px; font-size: .9rem; color: var(--text-soft); text-align: center; line-height: 1.6; }
.resend a { color: var(--gold-acc); font-weight: 700; text-decoration: none; }
.resend a:hover { text-decoration: underline; }
/* Mientras corre la cuenta atrás el enlace queda inerte, no solo apagado. */
.resend a.is-waiting { color: var(--text-soft); font-weight: 500; pointer-events: none; text-decoration: none; }
.resend__timer { font-variant-numeric: tabular-nums; font-weight: 700; }

/* ---------- Avisos del formulario ----------
   Sustituyen al modal para los errores del servidor: no tapan el formulario ni
   obligan a un clic para volver a escribir. */
.notice {
  margin: 0 0 1.2rem; padding: 12px 14px; border-radius: 11px;
  font-size: .87rem; line-height: 1.45; display: flex; gap: .6rem; align-items: flex-start;
  animation: noticeIn .22s var(--ease) both;
}
.notice::before { font-family: 'Font Awesome 6 Free'; font-weight: 900; flex: none; }
.notice--error { border: 1px solid #f3c7c8; background: #fdf1f1; color: #a3282c; }
.notice--error::before { content: '\f06a'; }
.notice--info { border: 1px solid #f0dcb4; background: #fdf8ee; color: #8a6100; }
.notice--info::before { content: '\f05a'; }
.notice--ok { border: 1px solid #bfe3cd; background: #f1faf4; color: #1f7a45; }
.notice--ok::before { content: '\f058'; }
@keyframes noticeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }

/* ---------- Aviso de Bloq Mayús ---------- */
.caps {
  display: flex; align-items: center; gap: .45rem; margin: .5rem 0 0;
  font-size: .8rem; color: #8a6100;
}
.caps::before { content: '\f0e7'; font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: .75rem; }

/* ---------- Casillas del código de verificación ----------
   Seis casillas en lugar de un campo único: el avance es automático, borrar
   retrocede y al pegar se reparten los dígitos. */
.otp { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: clamp(5px, 1.8vw, 9px); }
.otp input {
  width: 100%; min-width: 0; height: clamp(48px, 13vw, 58px); padding: 0; text-align: center;
  font-family: var(--display); font-weight: 700; font-size: clamp(1.05rem, 4.8vw, 1.4rem);
  color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 11px;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
  -moz-appearance: textfield;
}
.otp input::-webkit-outer-spin-button, .otp input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.otp input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(199, 131, 0, .18); }
.otp input:not(:placeholder-shown) { border-color: var(--gold); background: #fffdf7; }
.otp input:disabled { background: #f1efe9; color: #9aa1ae; }
.otp--invalid input { border-color: var(--red); }
.otp--invalid { animation: shake .3s var(--ease); }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ---------- Vigencia del código ---------- */
.expiry {
  display: flex; align-items: center; justify-content: center; gap: .45rem;
  margin: .9rem 0 0; font-size: .84rem; color: var(--text-soft);
}
.expiry i { color: var(--gold-acc); }
.expiry b, .expiry__time { font-variant-numeric: tabular-nums; color: var(--text); }
.expiry--expirado { color: var(--red); }
.expiry--expirado i, .expiry--expirado b { color: var(--red); }

/* ---------- Pasos del acceso ----------
   Sitúa al usuario: credenciales primero, código después. */
.steps { list-style: none; display: flex; align-items: center; gap: .5rem; margin: 0 0 1.6rem; padding: 0; }
.steps li { display: flex; align-items: center; gap: .5rem; font-size: .78rem; color: var(--text-soft); font-weight: 600; white-space: nowrap; }
.steps li:not(.steps__sep)::before {
  content: counter(paso); counter-increment: paso;
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: #eceae4; color: var(--text-soft); font-size: .72rem; font-weight: 800;
}
.steps { counter-reset: paso; }
.steps li.is-done::before { content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900; background: var(--gold); color: #fff; font-size: .62rem; }
.steps li.is-current::before { background: var(--gold); color: #fff; }
.steps li.is-current { color: var(--text); }
.steps__sep { flex: 1; height: 1px; background: var(--line); }

/* ---------- Foco por teclado ---------- */
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--gold-acc); outline-offset: 2px; border-radius: 11px; }
.post__frank a:focus-visible { outline-color: var(--gold-soft); }

/* ---------------------------------------------------------- Escritorio -- */
@media (min-width: 860px) {
  .post { grid-template-columns: 42% 58%; }
  .post__frank { padding: clamp(2.6rem, 3.6vw, 3.6rem); }
  .post__body { display: flex; align-items: center; justify-content: center; padding: clamp(2.5rem, 5vw, 4rem); }
  /* Holgura para que el contenido no alcance al enlace de volver, que va posicionado. */
  .post__inner { margin-block: 14px; }
  .post__mark img { height: 46px; }
}

/* ---------------------------------------------------------- Animación --- */
.post__inner { animation: riseIn .55s var(--ease) .1s both; }
.post__lead, .post__mark { animation: riseIn .6s var(--ease) both; }
.post__mark { animation-delay: .04s; }
.post__lead { animation-delay: .12s; }
@keyframes riseIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(240, 183, 63, .55); } 70% { box-shadow: 0 0 0 7px rgba(240, 183, 63, 0); } 100% { box-shadow: 0 0 0 0 rgba(240, 183, 63, 0); } }

@media (prefers-reduced-motion: reduce) {
  .post__inner, .post__lead, .post__mark { animation: none; }
  .post__eyebrow .live { animation: none; }
  .post__back i, .submit__arrow, .submit::before { transition: none; }
}

/* ---------- Variante con imagen de fondo ---------- */
.post__frank--photo {
  background-image:
    linear-gradient(178deg, rgba(13,23,39,.70) 0%, rgba(13,23,39,.78) 42%, rgba(8,14,24,.96) 100%),
    linear-gradient(90deg, rgba(10,17,29,.55) 0%, rgba(10,17,29,0) 55%),
    var(--bg);
  background-size: cover, cover, cover;
  background-position: center, center, center 34%;
  background-repeat: no-repeat;
}
.post__frank--photo .post__lead h2 { text-shadow: 0 2px 18px rgba(0,0,0,.35); }
.post__frank--photo .post__lead > p { color: #d7dae1; text-shadow: 0 1px 10px rgba(0,0,0,.35); }
.post__frank--photo .post__copy { color: rgba(238,240,243,.6); }

/* ---------- Móvil: formulario sobre la foto ---------- */
@media (max-width: 859.98px) {
  .post {
    position: relative; display: block; min-height: 100vh;
    background-image:
      linear-gradient(180deg, rgba(10,17,29,.62) 0%, rgba(10,17,29,.74) 46%, rgba(7,12,20,.92) 100%),
      var(--bg);
    background-size: cover, cover; background-position: center, center 32%; background-repeat: no-repeat;
  }
  .post__frank, .post__frank--photo { position: static; background: none; padding: 0; overflow: visible; }
  .post__frank .post__lead { display: none; }
  .post__mark { position: absolute; top: 22px; left: 22px; z-index: 3; }
  .post__mark img { height: 36px; }
  .post__frank .post__copy { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; z-index: 3; color: rgba(238,240,243,.6); }

  .post__body {
    position: relative; z-index: 2; background: transparent;
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 88px 20px 62px;
  }
  .post__back { position: absolute; top: 25px; right: 22px; color: rgba(238,240,243,.9); z-index: 3; }
  .post__back:hover { color: var(--gold-soft); }

  .post__inner {
    background: rgba(255, 255, 255, .82);
    -webkit-backdrop-filter: blur(16px) saturate(1.15);
            backdrop-filter: blur(16px) saturate(1.15);
    border: 1px solid rgba(255, 255, 255, .55);
    border-radius: 20px; padding: 30px 24px;
    box-shadow: 0 34px 70px -26px rgba(0, 0, 0, .6); max-width: 420px;
    animation: riseIn .5s var(--ease) .05s both;
  }
  .post__inner .field input { background: rgba(255, 255, 255, .92); }
  .post__inner .field input:focus { background: #fff; }
  .sentto { background: rgba(255, 255, 255, .55); }
}
