*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cream:     #c4af93;
  --tan:       #83664b;
  --brown:     #5c4134;
  --dark:      #301e14;
  --white:     #ffffff;
  --off-white: #faf7f4;
  --input-bg:  #f3ede6;
  --muted:     #9e8878;
  --dur:       700ms;
  --ease:      cubic-bezier(0.76, 0, 0.24, 1);
  --ease-out:  cubic-bezier(0.22, 1, 0.36, 1);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', sans-serif;
}

body { background: var(--dark); }

/* ═══════════════════════════════════════════════
   ANIMAÇÕES DE ENTRADA
═══════════════════════════════════════════════ */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0);    }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes panelSlideIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0);    }
}

@keyframes vpSlideIn {
  from { opacity: 0; transform: translateX(-40px); }
  to   { opacity: 1; transform: translateX(0);     }
}

@keyframes accentGrow {
  from { transform: scaleX(0); transform-origin: left; }
  to   { transform: scaleX(1); transform-origin: left; }
}

/* Sem animação para quem prefere movimento reduzido */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── WRAPPER ── */
.auth-wrapper {
  position: relative;
  width: 100vw;
  height: calc(100vh - 70px); /* altura aproximada do header */
  overflow: hidden;
  display: flex;
}

/* ── PANELS ── */
.panel {
  position: absolute;
  top: 0; bottom: 0;
  width: 50%;
  transition: transform var(--dur) var(--ease);
  will-change: transform;
}

/* ══ VISUAL PANEL (esquerda) ══ */
.visual-panel {
  left: 0;
  z-index: 3;
  background:
    url("https://images.unsplash.com/photo-1503951914875-452162b0f3f1?w=900&q=80&auto=format&fit=crop") center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* Animação de entrada do painel visual */
  animation: vpSlideIn 0.75s var(--ease-out) 0.05s both;
}

.vp-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    160deg,
    rgba(48, 30, 20, 0.88) 0%,
    rgba(92, 65, 52, 0.75) 50%,
    rgba(48, 30, 20, 0.92) 100%
  );
  z-index: 1;
}

.vp-noise {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  background-size: 200px;
  opacity: 0.5;
  z-index: 2;
  pointer-events: none;
}

.auth-wrapper.to-register .visual-panel { transform: translateX(100%); }

/* ══ FORM PANEL (direita) ══ */
.form-panel {
  right: 0;
  z-index: 2;
  background: var(--off-white);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Animação de entrada do painel de formulário */
  animation: panelSlideIn 0.75s var(--ease-out) 0.05s both;
}

.auth-wrapper.to-register .form-panel { transform: translateX(-100%); }

/* Accent line com animação */
.accent-line {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--dark), var(--brown), var(--tan), var(--cream));
  z-index: 10;
  animation: accentGrow 0.9s var(--ease-out) 0.5s both;
}

/* ── BRAND ── */
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: clamp(28px, 4vh, 48px);
  z-index: 3;
  animation: fadeSlideUp 0.65s var(--ease-out) 0.35s both;
}

.brand-icon {
  width: clamp(44px, 4vw, 56px);
  height: clamp(44px, 4vw, 56px);
  background: rgba(196, 175, 147, 0.12);
  border: 1px solid rgba(196, 175, 147, 0.3);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.brand-icon svg { width: 28px; height: 28px; }
.brand-icon img { width: 100%; height: 100%; object-fit: contain; border-radius: 14px; }

.brand-name {
  font-family: 'Playfair Display', serif;
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 900;
  color: var(--white);
  line-height: 1.15;
  letter-spacing: 0.5px;
}

/* ── VP CONTENT ── */
.vp-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(32px, 5vw, 64px) clamp(28px, 4vw, 56px);
  text-align: center;
  z-index: 3;
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}

.vp-content.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
}

.vp-tagline {
  font-family: 'Playfair Display', serif;
  font-size: clamp(24px, 2.8vw, 38px);
  font-weight: 700;
  color: var(--white);
  line-height: 1.3;
  margin-bottom: clamp(24px, 3.5vh, 44px);
  max-width: 280px;
  animation: fadeSlideUp 0.65s var(--ease-out) 0.55s both;
}

.btn-vp {
  background: transparent;
  color: var(--cream);
  border: 1.5px solid var(--cream);
  padding: clamp(11px, 1.2vw, 14px) clamp(30px, 3vw, 44px);
  border-radius: 50px;
  font-family: 'Inter', sans-serif;
  font-size: clamp(13px, 1vw, 15px);
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.5px;
  text-decoration: none;
  display: inline-block;
  transition: background 0.22s, color 0.22s, transform 0.14s, box-shadow 0.22s;
  animation: fadeSlideUp 0.65s var(--ease-out) 0.7s both;
}

.btn-vp:hover {
  background: var(--cream);
  color: var(--dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(196, 175, 147, 0.3);
}

.btn-vp:active { transform: scale(0.97); }

/* ── FORM VIEWS ── */
.form-view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 4vh, 48px) clamp(20px, 4vw, 48px);
  overflow-y: auto;
  transition: opacity 0.32s var(--ease), transform 0.32s var(--ease);
}

.form-view.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px);
}

.form-inner {
  width: 100%;
  max-width: 420px;
}

/* ── ANIMAÇÕES STAGGERED DOS CAMPOS ── */
.form-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(22px, 2.2vw, 30px);
  font-weight: 900;
  color: var(--dark);
  margin-bottom: 6px;
  animation: fadeSlideUp 0.55s var(--ease-out) 0.2s both;
}

.form-sub {
  font-size: clamp(13px, 1vw, 14px);
  color: var(--muted);
  margin-bottom: clamp(18px, 2.5vh, 28px);
  line-height: 1.55;
  animation: fadeSlideUp 0.55s var(--ease-out) 0.3s both;
}

.social-row {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  animation: fadeSlideUp 0.55s var(--ease-out) 0.38s both;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.4px;
  animation: fadeSlideUp 0.55s var(--ease-out) 0.44s both;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e0d5cb;
}

/* Stagger por campo */
.field { margin-bottom: clamp(10px, 1.4vh, 14px); }

.field:nth-child(1)  { animation: fadeSlideUp 0.5s var(--ease-out) 0.48s both; }
.field:nth-child(2)  { animation: fadeSlideUp 0.5s var(--ease-out) 0.54s both; }
.field:nth-child(3)  { animation: fadeSlideUp 0.5s var(--ease-out) 0.60s both; }
.field:nth-child(4)  { animation: fadeSlideUp 0.5s var(--ease-out) 0.66s both; }
.field:nth-child(5)  { animation: fadeSlideUp 0.5s var(--ease-out) 0.72s both; }

.field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--brown);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  height: clamp(42px, 5vh, 48px);
  background: var(--input-bg);
  border: 1.5px solid transparent;
  border-radius: 10px;
  padding: 0 16px;
  font-family: 'Inter', sans-serif;
  font-size: clamp(13px, 1vw, 14px);
  color: var(--dark);
  outline: none;
  transition: border-color 0.22s, background 0.22s, box-shadow 0.22s, transform 0.15s;
}

.field input:focus {
  border-color: var(--tan);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(131, 102, 75, 0.12);
  transform: translateY(-1px);
}

.field input::placeholder { color: #c0b0a0; font-size: 13px; }

/* Input com botão olho */
.input-wrap { position: relative; }
.input-wrap input { padding-right: 44px; }

.toggle-pass {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  padding: 4px;
  transition: color 0.2s;
}

.toggle-pass:hover { color: var(--tan); }
.toggle-pass svg { width: 16px; height: 16px; }

/* ── FORM ROW ── */
.form-row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: clamp(14px, 2vh, 20px);
  margin-top: 4px;
  animation: fadeSlideUp 0.5s var(--ease-out) 0.74s both;
}

/* ── CHECKBOX ── */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--tan);
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-label.terms {
  margin-bottom: clamp(14px, 2vh, 20px);
  margin-top: 4px;
  font-size: 12.5px;
  line-height: 1.5;
  align-items: flex-start;
  animation: fadeSlideUp 0.5s var(--ease-out) 0.74s both;
}

.checkbox-label a {
  color: var(--tan);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── FORGOT ── */
.link-forgot {
  font-size: 12.5px;
  color: var(--tan);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}
.link-forgot:hover { color: var(--brown); }

/* ── PASSWORD STRENGTH ── */
.password-strength {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  margin-top: -4px;
}

.strength-bar {
  flex: 1;
  height: 4px;
  background: #e0d5cb;
  border-radius: 2px;
  overflow: hidden;
}

.strength-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: var(--tan);
  transition: width 0.4s var(--ease-out), background 0.4s;
}

#strengthLabel {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  min-width: 80px;
  text-align: right;
}

/* ── BTN PRIMARY ── */
.btn-primary {
  width: 100%;
  height: clamp(44px, 5.5vh, 52px);
  background: linear-gradient(135deg, var(--brown) 0%, var(--dark) 100%);
  color: var(--cream);
  border: none;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: clamp(14px, 1.1vw, 15px);
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.4px;
  margin-top: 4px;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.14s, box-shadow 0.22s, filter 0.22s;
  box-shadow: 0 6px 24px rgba(48, 30, 20, 0.28);
  animation: fadeSlideUp 0.5s var(--ease-out) 0.82s both;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(48, 30, 20, 0.38);
  filter: brightness(1.1);
}

.btn-primary:active { transform: scale(0.98); }

/* Garante que link dentro do botão herde o estilo */
.btn-primary a {
  color: inherit;
  text-decoration: none;
  font: inherit;
  display: contents;
}

/* ── SWITCH HINT ── */
.switch-hint {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: clamp(12px, 2vh, 18px);
  animation: fadeSlideUp 0.5s var(--ease-out) 0.9s both;
}

.switch-hint button {
  background: none;
  border: none;
  color: var(--tan);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(131, 102, 75, 0.4);
  transition: color 0.2s;
}

.switch-hint button:hover { color: var(--brown); }

.switch-link {
  color: var(--tan);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(131, 102, 75, 0.4);
  transition: color 0.2s;
}
.switch-link:hover { color: var(--brown); }

/* ── SOCIAL BUTTONS ── */
.btn-social {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 44px;
  border-radius: 10px;
  border: 1.5px solid #e0d5cb;
  background: var(--white);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--dark);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.12s, box-shadow 0.2s;
}

.btn-social svg { width: 18px; height: 18px; flex-shrink: 0; }

.btn-social:hover {
  border-color: var(--tan);
  background: #fdf9f6;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(131, 102, 75, 0.12);
}

.btn-social:active { transform: scale(0.97); }
.btn-social.twitter { color: #0f0f0f; }
.btn-social.twitter svg { color: #0f0f0f; }

/* ── MOBILE LOADING SCREEN ── */
.mobile-loading {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  background: var(--dark);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.mobile-loading.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.ml-bg {
  position: absolute;
  inset: 0;
  background:
    url("https://images.unsplash.com/photo-1503951914875-452162b0f3f1?w=900&q=80&auto=format&fit=crop") center/cover no-repeat;
  opacity: 0.18;
}

.ml-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.ml-logo {
  width: 100px;
  height: 100px;
  border-radius: 28px;
  background: rgba(196,175,147,0.1);
  border: 1px solid rgba(196,175,147,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: ml-pulse 1.6s ease-in-out infinite;
}

.ml-logo img { width: 80%; height: 80%; object-fit: contain; }

.ml-name {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-weight: 900;
  color: var(--cream);
  letter-spacing: 1px;
}

.ml-spinner {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.ml-spinner span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cream);
  animation: ml-bounce 1.2s ease-in-out infinite;
}

.ml-spinner span:nth-child(2) { animation-delay: 0.2s; }
.ml-spinner span:nth-child(3) { animation-delay: 0.4s; }

@keyframes ml-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(196,175,147,0.3); }
  50%       { box-shadow: 0 0 0 14px rgba(196,175,147,0); }
}

@keyframes ml-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1; }
}

/* ── TRANSIÇÃO DE SAÍDA DE PÁGINA ── */
body.page-exit {
  animation: fadeOut 0.4s var(--ease) forwards;
}

@keyframes fadeOut {
  to { opacity: 0; }
}

/* ═══════════════════════════════════════════════
   TABLET  768px – 1024px
═══════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .visual-panel { width: 38%; }
  .form-panel   { width: 62%; }

  .form-view {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 40px;
    overflow-y: auto;
  }

  .form-inner {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
  }

  .social-row { flex-wrap: wrap; gap: 8px; }
  .btn-social {
    flex: 1 1 calc(33% - 8px);
    min-width: 80px;
    font-size: 12px;
    height: 40px;
  }

  .field input { height: 44px; }
  .form-title { font-size: clamp(18px, 2.5vw, 26px); }
}

/* ═══════════════════════════════════════════════
   MOBILE  < 768px
═══════════════════════════════════════════════ */
@media (max-width: 767px) {
  html, body {
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
  }

  .auth-wrapper {
    flex-direction: column;
    height: auto;
    min-height: 100svh; /* svh: suporte a barra do navegador mobile */
    overflow: visible;
    animation: none; /* desativa animação do wrapper no mobile */
  }

  /* Painéis viram blocos normais */
  .panel {
    position: relative;
    width: 100%;
    top: auto; bottom: auto;
    left: auto; right: auto;
    transition: none;
    transform: none !important;
    animation: none !important; /* animação de painel desligada no mobile */
  }

  /* Painel visual oculto no mobile — a loading screen substitui */
  .visual-panel { display: none; }

  /* Form panel ocupa a tela toda */
  .form-panel {
    width: 100%;
    height: auto;
    min-height: 100svh;
    order: 1;
    overflow: visible;
    align-items: flex-start;
    justify-content: flex-start;
    position: relative;
    right: auto;
    transform: none !important;
  }

  .auth-wrapper.to-register .form-panel { transform: none !important; }

  /* Form-view vira bloco normal */
  .form-view {
    position: relative;
    inset: auto;
    width: 100%;
    height: auto;
    padding: 32px 20px 48px;
    align-items: flex-start;
    justify-content: flex-start;
    overflow: visible;
  }

  .form-view.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
  }

  .form-inner { max-width: 100%; }

  /* CORRIGIDO: título e subtítulo VISÍVEIS no mobile,
     pois o painel visual está oculto */
  .form-title {
    display: block;
    font-size: 26px;
    margin-bottom: 6px;
    animation: fadeSlideUp 0.5s var(--ease-out) 0.1s both;
  }

  .form-sub {
    display: block;
    font-size: 14px;
    margin-bottom: 24px;
    animation: fadeSlideUp 0.5s var(--ease-out) 0.18s both;
  }

  /* Loading screen visível no mobile */
  .mobile-loading { display: flex; }

  /* Stagger reduzido no mobile para campos */
  .field:nth-child(1) { animation: fadeSlideUp 0.45s var(--ease-out) 0.28s both; }
  .field:nth-child(2) { animation: fadeSlideUp 0.45s var(--ease-out) 0.34s both; }
  .field:nth-child(3) { animation: fadeSlideUp 0.45s var(--ease-out) 0.40s both; }
  .field:nth-child(4) { animation: fadeSlideUp 0.45s var(--ease-out) 0.46s both; }
  .field:nth-child(5) { animation: fadeSlideUp 0.45s var(--ease-out) 0.52s both; }

  .social-row   { animation: fadeSlideUp 0.45s var(--ease-out) 0.26s both; }
  .divider      { animation: fadeSlideUp 0.45s var(--ease-out) 0.30s both; }
  .btn-primary  { animation: fadeSlideUp 0.45s var(--ease-out) 0.60s both; }
  .switch-hint  { animation: fadeSlideUp 0.45s var(--ease-out) 0.66s both; }
  .form-row-between { animation: fadeSlideUp 0.45s var(--ease-out) 0.56s both; }
  .checkbox-label.terms { animation: fadeSlideUp 0.45s var(--ease-out) 0.56s both; }

  .social-row { gap: 8px; }
  .btn-social { font-size: 12px; height: 40px; gap: 5px; }
  .btn-social svg { width: 16px; height: 16px; }
}

/* ═══════════════════════════════════════════════
   MOBILE XS  < 480px
═══════════════════════════════════════════════ */
@media (max-width: 480px) {
  .form-view { padding: 24px 16px 40px; }
  .form-title { font-size: 22px; }
  .form-sub { font-size: 13px; }
  .field input { height: 44px; }
  .btn-primary { height: 48px; font-size: 15px; }
  .social-row { flex-direction: column; gap: 8px; }
  .btn-social { height: 44px; font-size: 13px; }
  .form-inner { max-width: 100%; }
}

/* ═══════════════════════════════════════════════
   MOBILE PEQUENO  < 360px
═══════════════════════════════════════════════ */
@media (max-width: 360px) {
  .form-view { padding: 20px 14px 36px; }
  .form-title { font-size: 20px; }
  .field input { height: 42px; font-size: 13px; padding: 0 12px; }
  .btn-primary { height: 44px; font-size: 14px; }
  .btn-social { height: 40px; font-size: 12px; }
  .social-row { gap: 6px; }
}
