/* =============================================================================
   Magnus Pay — tela de login
   Tokens, medidas e tipografia extraídos do site em produção
   (magnuspay.com.br/login) para manter o resultado idêntico.
   ============================================================================= */

/* ---------------------------------- fonte --------------------------------- */
/* Montserrat Variable — exatamente o arquivo servido pelo site.
   Se o arquivo local não carregar (ex.: abrindo via file://, onde o navegador
   bloqueia fontes por CORS), a stack cai para a Montserrat do Google Fonts
   declarada no <head>. */
@font-face {
  font-family: "Montserrat Local";
  src: url("assets/fonts/Montserrat-Variable.ttf") format("truetype-variations"),
       url("assets/fonts/Montserrat-Variable.ttf") format("truetype");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------- tokens --------------------------------- */
:root {
  /* cores */
  --background: #000000;
  --foreground: #fafafa;
  --card: #0a0a0a;
  --muted-foreground: #a0a0a0;

  /* superfícies translúcidas dos campos */
  --surface-1: rgba(250, 250, 250, 0.045);
  --surface-2: rgba(250, 250, 250, 0.055);
  --surface-3: rgba(250, 250, 250, 0.06);
  --surface-border: rgba(250, 250, 250, 0.08);
  --surface-border-strong: rgba(250, 250, 250, 0.2);

  /* layout */
  --panel-width: 54%;
  --panel-radius: 32px;
  --panel-pad-x: 48px;
  --panel-pad-y: 80px;
  --content-width: 460px;
  --showcase-width: 620px;

  /* formas e movimento */
  --radius: 12px;
  --radius-toast: 18px;
  --t-fast: 150ms ease;
  --t-slide: 500ms;

  /* curvas de animação */
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-shake: cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

/* xl (1280px) */
@media (min-width: 1280px) {
  :root {
    --panel-width: 55%;
    --panel-pad-x: 80px;
  }
}

/* --------------------------------- base ----------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  color-scheme: dark;
  font-family: "Montserrat Local", "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, Arial,
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
p,
ul,
figure {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

button {
  font: inherit;
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

/* animação de entrada dos blocos do formulário */
@keyframes fade-slide-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

[data-anim="fade"] {
  opacity: 0;
  animation: fade-slide-in 0.4s ease-out forwards;
}

/* -------------------------------- estrutura -------------------------------- */
.shell {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  overflow: hidden;
  background: var(--background);
}

/* ============================ painel de destaque =========================== */
.showcase {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
  background: var(--background);
  padding-left: var(--panel-width);
}

.showcase__grid,
.showcase__shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.showcase__grid {
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 72px 72px;
}

.showcase__shade {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.015) 0%, rgba(0, 0, 0, 0.72) 76%, #000 100%);
}

.showcase__stage {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  align-items: center;
  justify-content: center;
  padding: 32px 40px 0;
}

/* esconder ilustração e textos do showcase, manter só o card de refs */
.showcase__art,
.showcase__title,
.showcase__subtitle {
  display: none;
}

.showcase__copy {
  position: relative;
  padding: 0 40px 40px;
  text-align: center;
}

.showcase__title {
  margin-inline: auto;
  max-width: 36rem;
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.25; /* leading-tight */
  color: #ffffff;
  text-wrap: balance;
}

.showcase__subtitle {
  margin: 12px auto 0;
  max-width: 36rem;
  font-size: 0.875rem;
  line-height: 1.625;
  color: rgba(255, 255, 255, 0.58);
}

/* referências */
.refs {
  max-width: var(--showcase-width);
  margin: 8px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.refs__title,
.refs__subtitle {
  margin-bottom: 0;
}

.refs__cards {
  display: flex;
  flex-direction: row;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  margin-bottom: 12px;
}

.refs__card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 8px;
  display: flex;
  flex-direction: row;
  gap: 8px;
  justify-content: center;
  align-items: stretch;
  flex: 1 1 calc(33.333% - 12px);
  min-width: 0;
  max-width: 380px;
}

.refs__thumb {
  width: 50%;
  height: 140px;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
  object-fit: cover;
  object-position: top;
}

.refs__thumb:hover {
  opacity: 0.85;
  transform: scale(1.02);
}

.refs__title {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  margin-top: 0;
  margin-bottom: 2px;
}

.refs__subtitle {
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 0;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.modal.is-open {
  opacity: 1;
  visibility: visible;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
}

.modal__content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal__img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  object-fit: contain;
}

.modal__close {
  position: absolute;
  top: -40px;
  right: 0;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.modal__close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.modal__close svg {
  width: 16px;
  height: 16px;
}

.slides {
  display: flex;
  gap: 8px;
  max-width: var(--showcase-width);
  margin: 36px auto 0;
}

.slide {
  flex: 1 1 0;
  height: 6px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  cursor: pointer;
  transition: background 250ms var(--ease-soft), transform 250ms var(--ease-soft);
}

.slide:hover {
  background: rgba(255, 255, 255, 0.2);
}

.slide:active {
  transform: scaleY(1.8);
}

.slide:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 3px;
}

.slide > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: #ffffff;
  transition: width var(--t-slide) ease;
}

.slide.is-active > span {
  width: 100%;
}

/* =========================== painel do formulário ========================== */
.panel {
  position: absolute;
  inset-block: 0;
  left: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--panel-width);
  overflow-y: auto;
  padding: var(--panel-pad-y) var(--panel-pad-x);
  border-right: 1px solid rgba(26, 26, 30, 0.7);
  border-radius: 0 var(--panel-radius) var(--panel-radius) 0;
  background: var(--card);
}

/* marca */
.brand {
  position: absolute;
  top: 36px;
  left: 40px;
  display: flex;
  align-items: center;
  width: fit-content;
}

.brand img {
  height: 56px;
  width: auto;
  max-width: min(280px, 58vw);
  object-fit: contain;
}

.panel__content {
  width: 100%;
  max-width: var(--content-width);
}

/* --------------------------------- heading -------------------------------- */
.heading__title {
  font-size: 1.5rem;      /* text-2xl */
  line-height: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em; /* tracking-tight */
}

.heading__subtitle {
  margin-top: 4px;
  font-size: 0.875rem;    /* text-sm */
  line-height: 1.25rem;
  color: var(--muted-foreground);
}

/* ---------------------------------- form ---------------------------------- */
.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 28px;
}

.field__label {
  display: block;
  font-size: 0.75rem;   /* text-xs */
  line-height: 1rem;
  font-weight: 500;
  letter-spacing: 0.05em; /* tracking-wider */
  text-transform: uppercase;
  color: var(--muted-foreground);
  transition: color 240ms var(--ease-soft);
}

/* o rótulo acende quando o campo recebe o foco */
.field:focus-within .field__label {
  color: var(--foreground);
}

/* campo */
.control {
  display: flex;
  align-items: center;
  position: relative;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  background: var(--surface-1);
  transition: background 200ms var(--ease-soft), border-color 200ms var(--ease-soft),
    box-shadow 260ms var(--ease-soft), transform 260ms var(--ease-soft);
}

.control:hover {
  background: var(--surface-2);
  border-color: rgba(250, 250, 250, 0.12);
}

.control:focus-within {
  border-color: var(--surface-border-strong);
  background: var(--surface-3);
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(250, 250, 250, 0.1), 0 14px 30px -22px rgba(255, 255, 255, 0.7);
}

.control__input {
  width: 100%;
  padding: 12px 16px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  font-family: inherit;
  font-size: 0.875rem;  /* text-sm */
  line-height: 1.25rem;
  color: var(--foreground);
  outline: none;
}

.control__input::placeholder {
  color: rgba(160, 160, 160, 0.4);
}


/* botão principal */
.actions {
  padding-top: 4px;
}

.btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  overflow: hidden;
  padding: 12px 24px;
  border: 0;
  border-radius: var(--radius);
  background: var(--foreground);
  font-size: 0.875rem;  /* text-sm */
  line-height: 1.25rem;
  font-weight: 600;
  color: var(--background);
  cursor: pointer;
  transition: background 200ms var(--ease-soft), opacity var(--t-fast),
    transform 200ms var(--ease-soft), box-shadow 280ms var(--ease-soft);
}

.btn:hover:not(:disabled) {
  background: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 12px 28px -14px rgba(255, 255, 255, 0.6);
}

.btn:active:not(:disabled) {
  transform: translateY(0) scale(0.985);
  box-shadow: 0 4px 14px -10px rgba(255, 255, 255, 0.5);
}

.btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 3px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn.is-loading svg {
  animation: spin 0.8s linear infinite;
}

/* o texto e o ícone ficam acima da onda do clique */
.btn__label,
.btn svg {
  position: relative;
  z-index: 1;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ------------------------------ notificação ------------------------------- */
.toast-area {
  position: fixed;
  bottom: 28px;
  left: 0;
  z-index: 80;
  display: flex;
  justify-content: center;
  width: var(--panel-width);
  padding: 0 var(--panel-pad-x);
  pointer-events: none;
}

.toast {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: var(--content-width);
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-toast);
  background: #0b0b0b;
  overflow: hidden;
  pointer-events: none;

  /* Entrada idêntica à do magnuspay.com.br: o card sobe 24px, encolhido
     para 0.985 da escala, e assenta devagar. */
  opacity: 0;
  transform: translateY(24px) scale(0.985);
  transition: opacity 320ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.toast.is-open {
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast__icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: #ffffff;
}

.toast__icon svg {
  width: 18px;
  height: 18px;
}

.toast__body {
  flex: 1 1 auto;
  min-width: 0;
}

.toast__title {
  font-size: 0.8125rem;  /* 13px */
  line-height: 1.25rem;
  font-weight: 600;
  color: #ffffff;
}

.toast__message {
  margin-top: 2px;
  font-size: 0.75rem;
  line-height: 1.625;
  color: rgba(255, 255, 255, 0.5);
}

.toast__close {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}

.toast__close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
}

.toast__close svg {
  width: 14px;
  height: 14px;
}

.toast__close[hidden] {
  display: none;
}

/* ------------------------------- animações -------------------------------- */
.heading[data-anim="fade"] {
  animation-delay: 0.05s;
}

.form .field:nth-of-type(1) {
  animation-delay: 0.1s;
}

.form .field:nth-of-type(2) {
  animation-delay: 0.15s;
}

.form .actions {
  animation-delay: 0.2s;
}



/* ================================== efeitos ================================ */

@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

@keyframes panel-in {
  from { opacity: 0; transform: translateX(-28px); }
  to   { opacity: 1; transform: none; }
}

@keyframes art-in {
  from { opacity: 0; transform: translateY(26px) scale(0.94); }
  to   { opacity: 0.9; transform: none; }
}

@keyframes brand-in {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: none; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes ripple-wave {
  from { opacity: 0.55; transform: translate(-50%, -50%) scale(0); }
  to   { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

@keyframes field-shake {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-7px); }
  36% { transform: translateX(6px); }
  54% { transform: translateX(-4px); }
  72% { transform: translateX(3px); }
  88% { transform: translateX(-1px); }
}

@keyframes icon-pop {
  from { opacity: 0; transform: scale(0.4) rotate(-30deg); }
  to   { opacity: 1; transform: none; }
}

/* ------------------------------ entrada da tela ---------------------------- */
.panel {
  animation: panel-in 0.65s var(--ease-soft) both;
}

.brand {
  animation: brand-in 0.5s var(--ease-soft) 0.15s both;
}

.showcase__art {
  display: none;
  animation: art-in 0.9s var(--ease-soft) 0.1s both;
}

.showcase__title {
  display: none;
  animation: rise-in 0.6s var(--ease-soft) 0.28s both;
}

.showcase__subtitle {
  display: none;
  animation: rise-in 0.6s var(--ease-soft) 0.36s both;
}

.refs {
  animation: rise-in 0.55s var(--ease-soft) 0.44s both;
}

.slides {
  animation: rise-in 0.55s var(--ease-soft) 0.66s both;
}

/* --------------------- brilho que segue o cursor no painel ----------------- */
.showcase__glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    420px circle at var(--glow-x, 50%) var(--glow-y, 35%),
    rgba(255, 255, 255, 0.07),
    transparent 65%
  );
  transition: opacity 500ms var(--ease-soft);
}

.showcase.is-hovering .showcase__glow {
  opacity: 1;
}

/* ------------------------------ onda do clique ----------------------------- */
.btn__ripple {
  position: absolute;
  top: 0;
  left: 0;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0) 70%);
  transform: translate(-50%, -50%) scale(0);
  animation: ripple-wave 700ms var(--ease-soft) forwards;
}

/* ------------------------------ estados do botão --------------------------- */
.btn.is-loading .btn__label {
  animation: fade-in 220ms ease both;
}

.btn.is-success svg {
  animation: icon-pop 420ms var(--ease-spring) both;
}

/* ------------------------------ erro no campo ------------------------------ */
/* aviso inline: abre espaço deslizando e só então aparece */
.field__message {
  display: flex;
  align-items: center;
  gap: 6px;
  max-height: 0;
  margin-top: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-7px);
  font-size: 0.75rem;
  line-height: 1.35;
  color: #f87171;
  transition: max-height 380ms var(--ease-soft), margin-top 380ms var(--ease-soft),
    opacity 260ms var(--ease-soft), transform 380ms var(--ease-soft);
}

.field__message-icon {
  display: flex;
  flex-shrink: 0;
}

.field__message-icon svg {
  width: 13px;
  height: 13px;
}

.field.is-invalid .field__message {
  max-height: 64px;
  margin-top: 7px;
  opacity: 1;
  transform: none;
}

/* o ícone entra com um "pop" junto com o aviso */
.field.is-invalid .field__message-icon svg {
  animation: icon-pop 420ms var(--ease-spring) 80ms both;
}

.field.is-invalid .control {
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.05);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.12);
}

.field.is-invalid .field__label {
  color: #f87171;
}

.control.is-shaking {
  animation: field-shake 460ms var(--ease-shake) both;
}

/* ------------------------------- responsivo ------------------------------- */

/* md+: título maior, igual ao original */
@media (min-width: 768px) {
  .heading__title {
    font-size: 1.875rem;  /* md:text-3xl */
    line-height: 2.25rem;
  }
}

/* lg+: aparece o painel de destaque */
@media (min-width: 1024px) {
  .showcase {
    display: flex;
  }
}

/* xl: respiro maior no stage e na marca */
@media (min-width: 1280px) {
  .showcase__stage {
    padding: 32px 64px 0;
  }

  .showcase__copy {
    padding: 0 64px 48px;
  }

  .showcase__title {
    display: none;
    font-size: 2.25rem;   /* xl:text-4xl */
    line-height: 2.5rem;
  }

  .brand {
    left: 56px;
  }
}

/* abaixo de lg: só o formulário, ocupando a tela inteira */
@media (max-width: 1023px) {
  .panel {
    position: relative;
    inset: auto;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 120px 24px 48px;
    border-right: 0;
    border-radius: 0;
  }

  .brand {
    left: 24px;
    top: 28px;
  }

  .toast-area {
    width: 100%;
    padding: 0 24px;
  }
}

/* Movimento reduzido.

   Antes aqui havia um `* { animation-duration: 1ms !important }` que
   desligava TUDO — inclusive o giro do botão de carregar e o efeito de
   entrada do aviso, que são feedback de interface e não decoração. Muitos
   ambientes (Chromium headless, vários Windows) reportam `reduce` por padrão,
   então o efeito de ficar "correto" era a página inteira parecer sem vida.

   Agora só sai o que é decorativo e repetitivo. */
@media (prefers-reduced-motion: reduce) {
  .showcase__glow {
    display: none;
  }

  .btn__ripple,
  .control.is-shaking {
    animation: none !important;
  }
}
