/* =========================================================
   FRIZZY Auth — aligned to app design system
   Plus Jakarta Sans · 8px scale · soft elevation
   ========================================================= */

:root {
  --bg: #f4eee6;
  --bg-deep: #ebe2d6;
  --surface: #faf6f1;
  --surface-elevated: #fffcf8;
  --ink: #1c1917;
  --ink-soft: #57534e;
  --muted: #78716c;
  --brand: #b56a35;
  --brand-hot: #c97a42;
  --brand-ring: rgba(181, 106, 53, 0.22);
  --line: rgba(28, 25, 23, 0.08);
  --line-strong: rgba(28, 25, 23, 0.12);
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.04), 0 1px 3px rgba(28, 25, 23, 0.06);
  --shadow-md: 0 2px 4px rgba(28, 25, 23, 0.04), 0 8px 24px rgba(28, 25, 23, 0.08);
  --shadow-lg: 0 4px 8px rgba(28, 25, 23, 0.04), 0 16px 40px rgba(28, 25, 23, 0.1);
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-full: 999px;
  --touch: 52px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* legacy aliases */
  --cream: var(--bg);
  --cream-deep: var(--bg-deep);
  --copper: var(--brand);
  --copper-hot: var(--brand-hot);
  --copper-dim: #8f4f24;
  --white: var(--surface-elevated);
  --radius: var(--r-lg);
  --font-display: var(--font);
  --font-body: var(--font);
}

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

.auth-icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.auth-icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.14em;
}

.auth-icon-dot {
  fill: currentColor;
  stroke: none;
}

html {
  height: auto;
  min-height: 0;
  overflow-x: hidden;
}

html,
body.auth-page {
  margin: 0;
  padding: 0;
  min-height: 0;
  height: auto;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: none;
}

.auth-page {
  background:
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(181, 106, 53, 0.1), transparent 55%),
    linear-gradient(180deg, #f7f1e9 0%, var(--bg) 40%, var(--bg-deep) 100%);
}

/* Login: layout natural (como antes) — logo grande, sem “vácuo” centralizado */
.auth-shell {
  min-height: 0;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: max(28px, env(safe-area-inset-top, 0px) + 16px) var(--space-5) max(28px, env(safe-area-inset-bottom, 0px) + 16px);
  max-width: 440px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  gap: 0;
}

.auth-brand {
  text-align: center;
  margin-bottom: var(--space-6);
  flex: 0 0 auto;
  animation: none;
}

.auth-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-2);
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: var(--space-1) 0 0;
}

.auth-logo {
  width: min(58vw, 188px);
  max-width: 188px;
  height: auto;
  aspect-ratio: 480 / 498;
  display: block;
  background: transparent;
  border: 0;
  border-radius: 0;
  filter:
    drop-shadow(0 14px 24px rgba(28, 25, 23, 0.12))
    drop-shadow(0 2px 4px rgba(28, 25, 23, 0.06));
  object-fit: contain;
  -webkit-user-drag: none;
  user-select: none;
}

.auth-tagline {
  margin: var(--space-2) 0 0;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

@media (min-width: 480px) {
  .auth-logo {
    width: 210px;
    max-width: 210px;
  }
}

.auth-card {
  width: 100%;
  flex: 0 0 auto;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  padding: var(--space-6) var(--space-5) var(--space-5);
  animation: auth-rise 0.7s 0.05s ease both;
}

.auth-card h1 {
  margin: 0 0 var(--space-1);
  font-family: var(--font);
  font-weight: 700;
  font-size: 1.375rem;
  letter-spacing: -0.02em;
  line-height: 1.25;
  text-align: center;
  text-transform: none;
  color: var(--ink);
}

.auth-card .auth-sub {
  margin: 0 0 var(--space-5);
  text-align: center;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink-soft);
  line-height: 1.6;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-1);
  background: var(--bg-deep);
  border-radius: var(--r-md);
  padding: var(--space-1);
  margin-bottom: var(--space-5);
}

.auth-tab {
  border: 0;
  background: transparent;
  min-height: 44px;
  border-radius: 10px;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.auth-tab.is-active {
  background: var(--surface-elevated);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.auth-tab:hover:not(.is-active) {
  color: var(--ink-soft);
}

.auth-panel { display: none; }
.auth-panel.is-active {
  display: block;
  animation: auth-fade 0.22s ease;
}

.auth-field { margin-bottom: var(--space-4); }

.auth-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--ink-soft);
  margin-bottom: var(--space-2);
}

.auth-field .input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-field .input-wrap > .auth-icon {
  position: absolute;
  left: 16px;
  color: var(--brand);
  font-size: 1rem;
  pointer-events: none;
}

.auth-field input {
  width: 100%;
  min-height: var(--touch);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--bg);
  padding: 12px 48px 12px 44px;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
  outline: none;
  transition: all 0.2s ease-in-out;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: var(--shadow-sm);
}

.auth-field input:hover {
  border-color: rgba(181, 106, 53, 0.28);
}

.auth-field input:focus {
  border-color: var(--brand);
  background: var(--surface-elevated);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.auth-field .toggle-pass {
  position: absolute;
  right: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  min-width: 40px;
  min-height: 40px;
  cursor: pointer;
  font-size: 1rem;
  border-radius: var(--r-md);
  transition: all 0.2s ease-in-out;
}

.auth-field .toggle-pass:hover { color: var(--ink); }

.auth-field .toggle-pass .auth-icon {
  width: 18px;
  height: 18px;
}

.auth-actions { margin-top: var(--space-2); }

.btn-auth {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: var(--r-full);
  background: linear-gradient(180deg, var(--brand-hot), var(--brand));
  color: #fffcf8;
  font-family: var(--font);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease-in-out;
}

.btn-auth:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-auth:active { transform: scale(0.985); }
.btn-auth:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.auth-remember {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 var(--space-4);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.auth-remember input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--brand);
  flex-shrink: 0;
}

.auth-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-5);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.auth-links a,
.auth-link-btn {
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  padding: var(--space-1);
  transition: all 0.2s ease-in-out;
}

.auth-links a:hover,
.auth-link-btn:hover {
  color: var(--ink);
  text-decoration: underline;
}

.auth-msg {
  min-height: 22px;
  margin: var(--space-3) 0 0;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.5;
}

.auth-msg.is-error { color: #b91c1c; }
.auth-msg.is-ok { color: #047857; }

.auth-foot {
  flex: 0 0 auto;
  margin-top: var(--space-6);
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  animation: auth-rise 0.75s 0.1s ease both;
  line-height: 1.6;
}

.auth-foot a {
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease-in-out;
}

.auth-foot a:hover { color: var(--ink); text-decoration: underline; }

.auth-social {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.auth-social a {
  width: 44px;
  height: 44px;
  border-radius: var(--r-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(28, 25, 23, 0.05);
  color: var(--ink);
  font-size: 1.15rem;
  transition: all 0.2s ease-in-out;
  border: 1px solid var(--line);
}

.auth-social .auth-icon {
  width: 20px;
  height: 20px;
}

.auth-social a:hover {
  background: var(--brand);
  color: #fffcf8;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.auth-social a[title="WhatsApp"]:hover,
.auth-social a[aria-label="WhatsApp"]:hover {
  background: #25d366;
}

.auth-social a[title="Instagram"]:hover,
.auth-social a[aria-label="Instagram"]:hover {
  background: #e1306c;
}

.auth-social a[title="Como chegar"]:hover,
.auth-social a[aria-label^="Localização"]:hover {
  background: #4285f4;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.4);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  padding: var(--space-4);
}

.auth-overlay.is-open {
  display: flex;
  animation: auth-fade 0.2s ease;
}

.auth-sheet {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: var(--space-6) var(--space-5) var(--space-5);
  box-shadow: var(--shadow-lg);
  animation: auth-sheet 0.28s ease;
  border: 1px solid var(--line);
}

.auth-sheet h2 {
  margin: 0 0 var(--space-2);
  font-family: var(--font);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  text-transform: none;
  color: var(--ink);
}

.auth-sheet p {
  margin: 0 0 var(--space-4);
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.6;
}

.auth-sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.btn-ghost {
  min-height: var(--touch);
  border-radius: var(--r-full);
  border: 1px solid var(--line-strong);
  background: transparent;
  font-weight: 600;
  font-family: var(--font);
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.btn-ghost:hover {
  border-color: var(--brand);
  color: var(--ink);
  background: var(--bg);
}

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

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

@keyframes auth-sheet {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-brand,
  .auth-card,
  .auth-foot,
  .auth-panel.is-active,
  .auth-overlay.is-open,
  .auth-sheet {
    animation: none;
  }
  .btn-auth,
  .auth-tab,
  .auth-field input,
  .auth-social a {
    transition: none;
  }
}

@media (min-width: 480px) {
  .auth-card {
    padding: var(--space-8) var(--space-6) var(--space-6);
  }

  .auth-overlay {
    align-items: center;
  }
}
