/* ==========================================================================
   Iunix — tela de login "Glassy" (vidro sobre seda azul em movimento).
   Só vale quando o <body> tem a classe .lg (login.php liga via $authGlass em includes/auth_head.php);
   as outras telas de autenticação seguem com o visual de style.css.

   Peças:
     - canvas .lg-canvas        fitas de seda azul-escuras animadas (assets/js/login_glass.js)
     - .lg-wrap                 invólucro do cartão: inclina em 3D seguindo o mouse
       .auth-form-card          vidro fosco com cantos chanfrados (clip-path)
       .lg-edge                 borda de 1px com um feixe de luz percorrendo o contorno
       .lg-tile                 facetas de vidro nos cantos chanfrados
       .lg-ring                 "lente" circular da transição (entrada + estado de carregando)
       .lg-sheen                reflexo que acompanha o cursor
   Entrada: cartão forma -> lente gira e some -> campos sobem em sequência -> botão por último.
   ========================================================================== */

@property --lg-ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

body.lg { background: #131b1f; }

body.lg .auth-shell {
  --lg-ease: cubic-bezier(.16, 1, .3, 1);
  --lg-green: #00b050;
  --lg-mint: #43db8d;
  --auth-accent: var(--lg-green);
  --auth-accent-2: var(--lg-mint);
  --auth-border: rgba(255, 255, 255, .13);
  background: #131b1f;
}
/* vinheta no lugar da grade antiga */
body.lg .auth-shell::before {
  background: radial-gradient(ellipse at 50% 48%, transparent 38%, rgba(0, 0, 0, .6) 100%);
  mask-image: none; -webkit-mask-image: none; background-size: auto;
}
body.lg .auth-brand::after, body.lg .auth-form-panel::before { display: none; }
.lg-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; display: block; }

/* ----------------------------------------------------------------- cartão */
body.lg .lg-wrap {
  position: relative; width: 100%; max-width: 410px;
  transform: perspective(1100px) rotateX(var(--lg-rx, 0deg)) rotateY(var(--lg-ry, 0deg));
  transition: transform .5s var(--lg-ease);
}
body.lg .lg-halo {
  position: absolute; inset: -34px; z-index: -1; pointer-events: none; filter: blur(34px);
  background: radial-gradient(62% 62% at 50% 50%, rgba(0, 176, 80, .30), rgba(0, 107, 56, .12) 55%, transparent 75%);
}
body.lg .auth-form-card {
  max-width: none; width: 100%; border: none; border-radius: 0; box-shadow: none; overflow: hidden; animation: none;
  padding: 2.3rem 2.15rem 1.9rem;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, .10) 0%, rgba(255, 255, 255, .035) 38%, rgba(0, 176, 80, .07) 100%),
    rgba(20, 28, 32, .52);
  backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%);
  clip-path: polygon(20px 0, calc(100% - 20px) 0, 100% 20px, 100% calc(100% - 20px), calc(100% - 20px) 100%, 20px 100%, 0 calc(100% - 20px), 0 20px);
}
body.lg .auth-form-card::before { display: none; }

/* borda de 1px (anel entre dois polígonos) com feixe de luz girando */
body.lg .lg-edge {
  position: absolute; inset: 0; pointer-events: none; z-index: 4;
  clip-path: polygon(
    20px 0, calc(100% - 20px) 0, 100% 20px, 100% calc(100% - 20px), calc(100% - 20px) 100%, 20px 100%, 0 calc(100% - 20px), 0 20px, 20px 0,
    20.4px 1px, 1px 20.4px, 1px calc(100% - 20.4px), 20.4px calc(100% - 1px), calc(100% - 20.4px) calc(100% - 1px),
    calc(100% - 1px) calc(100% - 20.4px), calc(100% - 1px) 20.4px, calc(100% - 20.4px) 1px, 20.4px 1px);
  background:
    conic-gradient(from var(--lg-ang), transparent 0deg, transparent 236deg, rgba(67, 219, 141, .35) 270deg, #8ceab8 318deg, #fff 340deg, transparent 360deg),
    linear-gradient(135deg, rgba(255, 255, 255, .38), rgba(255, 255, 255, .08) 45%, rgba(255, 255, 255, .22));
}

/* facetas de vidro nos cantos chanfrados */
body.lg .lg-tile {
  position: absolute; width: 54px; height: 54px; pointer-events: none; z-index: 1;
  background: linear-gradient(135deg, rgba(255, 255, 255, .24), rgba(255, 255, 255, .02) 70%);
}
body.lg .lg-tile-tl { top: 0; left: 0; clip-path: polygon(0 0, 100% 0, 0 100%); }
body.lg .lg-tile-br { right: 0; bottom: 0; clip-path: polygon(100% 0, 100% 100%, 0 100%); transform: rotate(0deg); background: linear-gradient(315deg, rgba(255, 255, 255, .24), rgba(255, 255, 255, .02) 70%); }

/* reflexo que segue o cursor */
body.lg .lg-sheen {
  position: absolute; inset: 0; pointer-events: none; z-index: 0; opacity: 0; transition: opacity .4s ease;
  background: radial-gradient(260px circle at var(--lg-mx, 50%) var(--lg-my, 0%), rgba(67, 219, 141, .17), transparent 65%);
}
body.lg .lg-wrap:hover .lg-sheen { opacity: 1; }

/* lente circular */
body.lg .lg-ring {
  position: absolute; left: 50%; top: 50%; width: 176px; height: 176px; margin: -88px 0 0 -88px;
  border-radius: 50%; pointer-events: none; z-index: 3; opacity: 0;
  background: radial-gradient(circle, rgba(0, 176, 80, .38), rgba(0, 176, 80, .10) 52%, transparent 70%);
}
body.lg .lg-ring b {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0deg, transparent 90deg, #43db8d 330deg, #fff 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
}
body.lg .lg-ring i { position: absolute; inset: 15%; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .32); }

/* ----------------------------------------------------------------- conteúdo do cartão */
body.lg .lg-content { position: relative; z-index: 2; transition: filter .35s ease, opacity .35s ease; }
body.lg .auth-form-card h4 { font-size: 1.7rem; letter-spacing: -.02em; }
body.lg .auth-form-badge { background: transparent; border: none; padding: 0; color: #43db8d; letter-spacing: .02em; }
body.lg .auth-form-card .form-label { color: rgba(231, 238, 241, .72); font-size: .8rem; letter-spacing: .02em; }
body.lg .auth-form-card .form-control {
  background: rgba(255, 255, 255, .055); border: 1px solid rgba(255, 255, 255, .13); border-radius: 12px;
  height: 46px; transition: border-color .25s ease, background-color .25s ease, box-shadow .35s var(--lg-ease);
}
body.lg .auth-form-card .form-control:focus {
  background: rgba(255, 255, 255, .09); border-color: #43db8d; box-shadow: 0 0 0 3px rgba(67, 219, 141, .18), 0 0 22px -4px rgba(67, 219, 141, .45);
}
body.lg .auth-form-card .input-icon i:first-child { transition: color .25s ease, translate .4s var(--lg-ease), scale .4s var(--lg-ease); }
body.lg .auth-form-card .input-icon:focus-within i:first-child { color: #43db8d; translate: 2px 0; scale: 1.12; }
/* autofill do Chrome pintava o campo de branco */
body.lg .auth-form-card .form-control:-webkit-autofill,
body.lg .auth-form-card .form-control:-webkit-autofill:focus {
  -webkit-text-fill-color: #fff; caret-color: #fff; transition: background-color 99999s ease 0s;
  -webkit-box-shadow: 0 0 0 1000px rgba(14, 32, 64, .92) inset;
}
body.lg .lg-eye {
  position: absolute; right: .55rem; top: 50%; translate: 0 -50%; width: 34px; height: 34px; border: none; border-radius: 8px;
  background: transparent; color: rgba(231, 238, 241, .55); display: flex; align-items: center; justify-content: center;
  transition: color .2s ease, background-color .2s ease, scale .2s var(--lg-ease); cursor: pointer;
}
body.lg .lg-eye:hover { color: #fff; background: rgba(255, 255, 255, .08); }
body.lg .lg-eye:active { scale: .88; }
body.lg .auth-form-card .input-icon .lg-eye i { position: static; transform: none; color: inherit; }
body.lg .auth-form-card .input-icon.has-eye .form-control { padding-right: 2.9rem; }
body.lg .lg-forgot { display: flex; justify-content: flex-end; margin: -.1rem 0 1rem; }
body.lg .auth-form-card a.small { color: #43db8d; transition: color .2s ease; }
body.lg .auth-form-card a.small:hover { color: #fff; text-decoration: none; }

body.lg .auth-form-card .btn-success {
  position: relative; overflow: hidden; height: 48px; border-radius: 12px; border: none; font-weight: 700; letter-spacing: .01em;
  background: #00b050; color: #fff;
  box-shadow: 0 10px 26px -8px rgba(0, 176, 80, .6), inset 0 1px 0 rgba(255, 255, 255, .3);
  transition: box-shadow .3s ease, translate .3s var(--lg-ease), scale .2s var(--lg-ease), filter .3s ease;
}
body.lg .auth-form-card .btn-success:hover { translate: 0 -2px; background: #00c25a; box-shadow: 0 16px 34px -8px rgba(67, 219, 141, .65), inset 0 1px 0 rgba(255, 255, 255, .45); }
body.lg .auth-form-card .btn-success:active { scale: .97; translate: 0 0; }
body.lg .auth-form-card .btn-success::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; translate: -120% 0;
  background: linear-gradient(105deg, transparent 32%, rgba(255, 255, 255, .5) 50%, transparent 68%);
}
body.lg .auth-form-card .btn-success i { display: inline-block; transition: translate .35s var(--lg-ease); }
body.lg .auth-form-card .btn-success:hover i { translate: 5px 0; }
body.lg .auth-form-card .btn-success:disabled { opacity: 1; filter: none; }

body.lg .auth-form-card .btn-outline-success {
  height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; gap: .1rem;
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .16); color: #e7eef1; font-weight: 600;
  transition: background-color .25s ease, border-color .25s ease, color .25s ease, translate .3s var(--lg-ease);
}
body.lg .auth-form-card .btn-outline-success:hover { background: rgba(67, 219, 141, .12); border-color: rgba(67, 219, 141, .55); color: #fff; translate: 0 -1px; }
body.lg .auth-form-footnote { border-top-color: rgba(255, 255, 255, .1); }

/* ----------------------------------------------------------------- painel de marca */
body.lg .auth-brand .brand-mark-lg { background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .14); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
/* escurece a faixa atrás do texto pra as fitas de seda não atrapalharem a leitura */
body.lg .auth-brand::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(90deg, rgba(2, 6, 13, .72) 0%, rgba(2, 6, 13, .5) 55%, transparent 100%);
}
body.lg .auth-brand-inner { animation: none; }
body.lg .auth-brand ul li i { transition: scale .4s var(--lg-ease), rotate .4s var(--lg-ease); }
body.lg .auth-brand ul li:hover i { scale: 1.18; rotate: -8deg; }
body.lg .auth-brand-stats strong { font-variant-numeric: tabular-nums; }
.lg-w { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: .14em; margin-bottom: -.14em; }
.lg-w > span { display: inline-block; }

/* ----------------------------------------------------------------- movimento */
@media (prefers-reduced-motion: no-preference) {
  @keyframes lg-spin { to { --lg-ang: 360deg; } }
  @keyframes lg-rot { to { rotate: 360deg; } }
  @keyframes lg-card-in { from { opacity: 0; scale: .93; } }
  @keyframes lg-wrap-in { from { translate: 0 30px; } }
  @keyframes lg-ring-intro {
    0% { opacity: 0; scale: .25; rotate: -120deg; }
    28% { opacity: 1; scale: 1; }
    68% { opacity: 1; scale: 1.06; rotate: 140deg; }
    100% { opacity: 0; scale: 1.7; rotate: 220deg; }
  }
  @keyframes lg-tile-tl { from { opacity: 0; translate: -34px -34px; } }
  @keyframes lg-tile-br { from { opacity: 0; translate: 34px 34px; } }
  @keyframes lg-in { from { opacity: 0; translate: 0 18px; filter: blur(8px); } }
  @keyframes lg-slide { from { opacity: 0; translate: -22px 0; filter: blur(6px); } }
  @keyframes lg-word { from { translate: 0 110%; } }
  @keyframes lg-pop { 0% { scale: 0; rotate: -30deg; opacity: 0; } 60% { scale: 1.25; rotate: 6deg; opacity: 1; } 100% { scale: 1; rotate: 0deg; opacity: 1; } }
  @keyframes lg-shimmer { 0%, 62% { translate: -120% 0; } 100% { translate: 120% 0; } }
  @keyframes lg-breathe { 0%, 100% { opacity: .85; scale: 1; } 50% { opacity: 1; scale: 1.05; } }
  @keyframes lg-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -7px; } }
  @keyframes lg-shake { 0%, 100% { translate: 0 0; } 18% { translate: -9px 0; } 36% { translate: 8px 0; } 54% { translate: -6px 0; } 72% { translate: 4px 0; } }
  @keyframes lg-spin-ring { to { rotate: 360deg; } }

  body.lg .lg-edge { animation: lg-spin 7s linear infinite; }
  body.lg .lg-wrap { animation: lg-wrap-in 1.2s var(--lg-ease) backwards; }
  body.lg .auth-form-card { animation: lg-card-in 1s var(--lg-ease) backwards; }
  body.lg .lg-halo { animation: lg-breathe 6s ease-in-out infinite; }
  body.lg .lg-tile-tl { animation: lg-tile-tl 1s var(--lg-ease) .25s backwards; }
  body.lg .lg-tile-br { animation: lg-tile-br 1s var(--lg-ease) .25s backwards; }
  body.lg .lg-ring b { animation: lg-spin-ring 1.1s linear infinite; }
  body.lg .lg-ring { animation: lg-ring-intro 1.5s var(--lg-ease) .35s backwards; }
  body.lg .auth-form-card .btn-success::after { animation: lg-shimmer 4.5s ease-in-out 2.4s infinite; }

  /* itens do cartão: sobem em sequência depois que a lente some */
  body.lg .lg-wrap .lg-in { animation: lg-in .85s var(--lg-ease) backwards; animation-delay: calc(1s + var(--d, 0) * 85ms); }
  /* painel de marca: entra pela esquerda, em cascata */
  body.lg .auth-brand .lg-in { animation: lg-slide .9s var(--lg-ease) backwards; animation-delay: calc(.2s + var(--d, 0) * 90ms); }
  body.lg .auth-brand ul li i { animation: lg-pop .8s var(--lg-ease-back, cubic-bezier(.34, 1.56, .64, 1)) backwards; animation-delay: calc(.2s + var(--d, 0) * 90ms + .35s); }
  .lg-w > span { animation: lg-word .95s var(--lg-ease, cubic-bezier(.16, 1, .3, 1)) backwards; animation-delay: calc(.35s + var(--wi, 0) * 70ms); }
  body.lg .auth-brand .brand-mark-lg { animation-name: lg-slide, lg-float; animation-duration: .9s, 6s; animation-delay: .2s, 1.4s; animation-timing-function: var(--lg-ease), ease-in-out; animation-iteration-count: 1, infinite; animation-fill-mode: backwards, none; }

  /* erro de login: o cartão chacoalha uma vez, depois da entrada */
  body.lg .lg-wrap.lg-shake { animation: lg-shake .6s ease-in-out; }

  /* enviando: conteúdo esmaece e a lente gira no centro */
  body.lg .lg-loading .lg-content { filter: blur(3px); opacity: .3; }
  body.lg .lg-loading .lg-ring { animation: none; opacity: 1; scale: 1; }
  body.lg .lg-loading .lg-edge { animation-duration: 1.6s; }
}

/* ----------------------------------------------------------------- telas menores */
@media (max-width: 991px) {
  body.lg .lg-wrap { max-width: 440px; margin: 0 auto; }
  body.lg .lg-halo { inset: -16px; }
  body.lg .auth-form-card { padding: 1.9rem 1.5rem 1.5rem; }
}
@media (hover: none) {
  body.lg .lg-wrap { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  body.lg .lg-ring { display: none; }
}

/* ----------------------------------------------------------------- identidade iunix (manual de marca) */
body.lg h2, body.lg h4 { font-family: var(--font-display); }
body.lg .auth-brand .brand-eyebrow { color: #43db8d; font-family: var(--font-mono); font-weight: 500; letter-spacing: .14em; }
body.lg .auth-brand .brand-eyebrow::before { background: #00b050; }
body.lg .auth-brand h2 { font-weight: 700; letter-spacing: -.035em; line-height: 1.02; font-size: clamp(2.1rem, 3.6vw, 3.1rem); }
body.lg .auth-brand h2 em { font-style: normal; color: #43db8d; }
body.lg .auth-brand-stats strong { font-family: var(--font-display); }
body.lg .auth-brand-stats span { font-family: var(--font-mono); font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; }
body.lg .auth-logo { display: block; width: clamp(200px, 22vw, 270px); height: auto; margin-bottom: 3rem; }
body.lg .auth-form-badge { font-family: var(--font-mono); font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; }
body.lg .auth-form-card .form-label { font-family: var(--font-mono); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 500; }
/* supergráfico do manual: órbita (círculos + elipse) em verde sobre o grafite */
.lg-orbit { position: absolute; z-index: -1; width: 820px; height: 820px; pointer-events: none; right: -190px; top: 50%; margin-top: -410px; }
.lg-orbit svg { width: 100%; height: 100%; display: block; }
@media (prefers-reduced-motion: no-preference) {
  @keyframes lg-orbit { to { rotate: 360deg; } }
  .lg-orbit svg { animation: lg-orbit 140s linear infinite; }
  .lg-orbit .lg-orbit-b { animation: lg-orbit 90s linear infinite reverse; transform-origin: 50% 50%; }
}
@media (max-width: 991px) {
  body.lg .auth-logo { width: 160px; margin-bottom: 0; }
  .lg-orbit { display: none; }
}
