/* =========================================================================
   login.php — identidad visual propia, fuera del sistema `ledger-page`.
   Portado de Bermat (assets/css/login.css v1.0) con la paleta calida de
   Cronos: los mismos NOMBRES de token que reportes.css v9.0, otros hex.
   No depende de reportes.css ni de estilos.css a proposito: esta pagina
   se ve antes de que exista sesion y no debe arrastrar el CSS del panel.
   ========================================================================= */
:root {
  --brand:        #B78B45;
  --brand-strong: #8a6b3a;
  --brand-soft:   #F2DEA2;
  --paper:        #fbf8f2;
  --paper-raised: #FFFFFF;
  --ink:          #281300;
  --ink-soft:     #4a3418;
  --ink-faint:    #8a7355;
  --line:         rgba(40, 19, 0, 0.14);
  --line-strong:  rgba(40, 19, 0, 0.30);
  --danger:       #842029;
  --danger-soft:  #f8d7da;
  --focus-ring:   rgba(183, 139, 69, 0.35);
  --shadow-card:  0 24px 60px -20px rgba(58, 40, 15, 0.38);

  /* Tinte del panel de fotos. A proposito FUERA de los bloques de tema:
     .brandside siempre es una foto oscura con texto blanco encima, en
     claro y en oscuro. Si usara --brand/--brand-strong, en modo oscuro
     esos tokens se invierten a crema (correcto para el formulario, no
     para este panel) y el degradado borra la foto. */
  --photo-tint:        #8a6b3a;
  --photo-tint-deep:   #4a3418;
  --photo-tint-light:  #C79A4E;
}
/* Modo oscuro calido (marron tostado), no el gris azulado de Bermat:
   el oro de marca necesita fondo calido para no verse mostaza. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1E1913; --paper-raised: #2A231A;
    --brand: #D6AC6A; --brand-strong: #F2DEA2; --brand-soft: #3A2F20;
    --ink: #F5EFE0; --ink-soft: #C9BCA4; --ink-faint: #9A8C74;
    --line: rgba(245,239,224,.10); --line-strong: rgba(245,239,224,.22);
    --danger: #F0899A; --danger-soft: rgba(240,137,154,.14);
    --focus-ring: rgba(214,172,106,.4);
    --shadow-card: 0 24px 60px -20px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  --paper: #1E1913; --paper-raised: #2A231A;
  --brand: #D6AC6A; --brand-strong: #F2DEA2; --brand-soft: #3A2F20;
  --ink: #F5EFE0; --ink-soft: #C9BCA4; --ink-faint: #9A8C74;
  --line: rgba(245,239,224,.10); --line-strong: rgba(245,239,224,.22);
  --danger: #F0899A; --danger-soft: rgba(240,137,154,.14);
  --focus-ring: rgba(214,172,106,.4);
  --shadow-card: 0 24px 60px -20px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; min-height: 100%;
  background: var(--paper); color: var(--ink);
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body { display: grid; place-items: center; padding: 2rem 1rem; }

.stage {
  position: relative;
  width: 100%; max-width: 1240px;
  display: grid; grid-template-columns: 1.35fr 1fr;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  min-height: 700px;
}

.theme-toggle {
  position: absolute; top: .8rem; right: .8rem; z-index: 6;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--paper-raised); color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.theme-toggle:hover { background: var(--paper); color: var(--ink); }
.theme-toggle svg { display: none; }
.theme-toggle.mode-light .icon-moon { display: block; }
.theme-toggle.mode-dark .icon-sun { display: block; }

/* ---------- Panel de marca (izquierda) ---------- */
.brandside {
  position: relative;
  padding: 3rem 2.75rem;
  display: flex; flex-direction: column; justify-content: space-between;
  background: var(--photo-tint-deep);
  color: #fff;
  overflow: hidden;
}
/* Fotos reales de vigilancia: en reposo se ven desaturadas, al pasar el
   mouse revelan su color. El cruce entre las 6 es lento a proposito. */
.photo-layer {
  position: absolute; inset: 0; z-index: 0;
  background-size: cover; background-position: center top;
  opacity: 0;
  /* Menos desaturada y mas luminosa que el .92/.68 de Bermat: sus fotos
     son de estudio, estas son de exterior y quedaban muy apagadas. */
  filter: grayscale(.78) brightness(.82) contrast(1.05);
  animation: photoFade 33s ease-in-out infinite;
  transition: filter 1.1s ease;
}
.photo-layer:nth-of-type(1) { animation-delay: 0s; }
.photo-layer:nth-of-type(2) { animation-delay: -5.5s; }
.photo-layer:nth-of-type(3) { animation-delay: -11s; }
.photo-layer:nth-of-type(4) { animation-delay: -16.5s; }
.photo-layer:nth-of-type(5) { animation-delay: -22s; }
.photo-layer:nth-of-type(6) { animation-delay: -27.5s; }
@keyframes photoFade {
  0%, 100% { opacity: 0; }
  6%       { opacity: 1; }
  11%      { opacity: 1; }
  17%      { opacity: 0; }
}
.brandside:hover .photo-layer { filter: grayscale(0) brightness(1) contrast(1); }

/* Oro de Cronos en movimiento continuo — se atenua al revelar la foto. */
.brandside::before {
  content: ''; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(120deg,
    var(--photo-tint) 0%, var(--photo-tint-deep) 30%, var(--photo-tint-light) 50%,
    var(--photo-tint-deep) 70%, var(--photo-tint) 100%);
  background-size: 250% 250%;
  mix-blend-mode: multiply;
  /* .48 en vez del .78 de Bermat: el oro de Cronos tiene mas luminancia
     que su periwinkle, y con el tinte alto el multiply se come la foto. */
  opacity: .48;
  animation: colorShift 11s ease-in-out infinite;
  transition: opacity .8s ease;
}
.brandside:hover::before { opacity: .4; }
@keyframes colorShift {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
.brandside::after {
  content: ''; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(to top, rgba(30,20,8,.72) 0%, rgba(30,20,8,.2) 45%, transparent 75%);
}
@media (prefers-reduced-motion: reduce) {
  .brandside::before { animation: none; background-position: 30% 50%; }
  .photo-layer { animation: none; opacity: 0; transition: filter .3s ease; }
  .photo-layer:nth-of-type(1) { opacity: 1; }
}

.brand-mark {
  display: flex; align-items: center; justify-content: space-between;
  gap: .65rem; position: relative; z-index: 2;
}
/* brightness(0) invert(1) = misma receta que Bermat: aplana el logo a
   negro puro y lo invierte a blanco, sin importar sus colores originales.
   Solo aca — en .mobile-brand el fondo es claro y el logo va a color. */
.brand-mark img {
  height: 34px; width: auto;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.35)) brightness(0) invert(1);
}
.brand-mark span {
  font-weight: 500; font-size: .72rem; letter-spacing: .14em;
  text-transform: uppercase; color: rgba(255,255,255,.75);
}

.brand-headline { position: relative; z-index: 2; }
.brand-headline h1 {
  margin: 0 0 .9rem;
  font-size: clamp(1.8rem, 2.8vw, 2.4rem);
  line-height: 1.14; text-wrap: balance; letter-spacing: -.01em;
}
.brand-headline h1 b { font-weight: 900; }
.brand-headline p {
  margin: 0; max-width: 34ch;
  font-size: .95rem; line-height: 1.6; color: rgba(255,255,255,.82);
}

.brand-features {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; gap: .65rem;
  margin-top: 1.5rem;
  list-style: none; padding: 0;
}
.brand-features li {
  display: flex; align-items: center; gap: .6rem;
  font-size: .88rem; color: rgba(255,255,255,.92);
}
/* Valor fijo, no --brand-soft: en modo oscuro ese token es marron oscuro
   y estos iconos van sobre el panel de foto, que siempre es oscuro. */
.brand-features svg { flex-shrink: 0; color: #F2DEA2; }

.brand-foot {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: .5rem;
  font-size: .72rem; color: rgba(255,255,255,.7);
}
.brand-foot .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #8FE3A8; box-shadow: 0 0 0 3px rgba(143,227,168,.25);
  flex-shrink: 0;
}

/* Velo de "Verificando...": aparece apenas se envia el form (submit
   nativo, sin AJAX). No afirma exito — no sabemos el resultado hasta que
   responda el servidor. Si la clave esta mal, la pagina recarga con el
   error y el velo desaparece solo; si esta bien, ya vamos a dashboard. */
.submit-veil {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  background: linear-gradient(120deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff; font-weight: 700; font-size: 1.02rem;
  clip-path: circle(0% at 50% 50%);
  transition: clip-path .55s cubic-bezier(.65, 0, .35, 1);
  pointer-events: none;
}
.stage.is-submitting .submit-veil { clip-path: circle(75% at 50% 50%); }
.submit-veil .spinner { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .submit-veil { transition: none; }
  .submit-veil .spinner { animation: none; }
}

/* ---------- Panel de formulario (derecha) ---------- */
.formside {
  padding: 3rem 3.1rem;
  display: flex; flex-direction: column; justify-content: center;
  gap: 1.9rem;
}
@media (max-width: 480px) {
  .formside { padding: 2.6rem 1.4rem; }
}
.formside h2 { margin: 0 0 .3rem; font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; }
.formside .lede { margin: 0; color: var(--ink-soft); font-size: .88rem; }

/* Marca solo-movil: cuando .brandside se esconde (media query al final),
   las fotos desaparecen pero el logo debe seguir identificando a Cronos. */
.mobile-brand {
  display: none;
  align-items: center;
  gap: .6rem;
  margin-bottom: .3rem;
}
.mobile-brand img { height: 32px; width: auto; }
.mobile-brand span {
  font-size: .66rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--brand-strong);
}

.field { display: flex; flex-direction: column; gap: .4rem; }
.field label {
  font-size: .68rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--brand-strong);
}
.input-shell { position: relative; display: flex; align-items: center; }
.input-shell .leading { position: absolute; left: .9rem; color: var(--ink-faint); pointer-events: none; }
.field input {
  width: 100%;
  padding: .78rem .9rem .78rem 2.35rem;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--paper); color: var(--ink);
  font-family: inherit; font-size: 1rem;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.field input::placeholder { color: var(--ink-faint); }
.field input:focus {
  outline: none; border-color: var(--brand); background: var(--paper-raised);
  box-shadow: 0 0 0 4px var(--focus-ring);
}
.toggle-visibility {
  position: absolute; right: .35rem;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: none; background: transparent; color: var(--ink-faint);
  cursor: pointer; border-radius: 8px;
}
.toggle-visibility:hover { color: var(--ink-soft); background: var(--paper); }
.toggle-visibility:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

.row-between { display: flex; align-items: center; justify-content: flex-end; font-size: .82rem; }
.row-between a { color: var(--brand-strong); text-decoration: none; font-weight: 500; }
.row-between a:hover { text-decoration: underline; }

.error-banner {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .7rem .85rem; border-radius: 10px;
  background: var(--danger-soft); color: var(--danger);
  font-size: .82rem; line-height: 1.4;
}

button.submit {
  appearance: none; border: none; border-radius: 10px;
  padding: .85rem 1rem;
  font-family: inherit; font-weight: 700; font-size: .92rem; letter-spacing: .01em;
  color: #fff;
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-strong) 100%);
  cursor: pointer;
  transition: filter .15s ease, transform .1s ease;
}
button.submit:hover { filter: brightness(1.06); }
button.submit:active { transform: translateY(1px); }
button.submit:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 2px; }

.back-link { text-align: center; font-size: .8rem; }
.back-link a { color: var(--ink-soft); text-decoration: none; }
.back-link a:hover { color: var(--ink); text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Al final del cascade a proposito: si va antes de la regla base
   .brandside{display:flex}, esa regla posterior le gana aunque la media
   query aplique (misma especificidad, gana el orden). */
@media (max-width: 760px) {
  .stage { grid-template-columns: 1fr; min-height: 0; border-radius: 16px; }
  .brandside { display: none; }
  .mobile-brand { display: flex; }
}
