/* ============================================
   noviosgift.cl — auth (login / registro)
   ============================================ */

:root {
  --paper: #F8F4EC;
  --bone:  #F4EFE6;
  --cream: #ECE4D2;
  --ink:   #2A2620;
  --ink-soft: #4A433B;
  --ink-mute: #8B8275;
  --line:  #D9CFBC;
  --hairline: rgba(42, 38, 32, 0.10);
  --terracotta: #B86A4A;
  --terracotta-soft: #D9947A;
  --sage: #8A9279;
  --serif: "Fraunces", Georgia, serif;
  --sans:  "Inter", system-ui, sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

.it { font-style: italic; }

/* ── Body ──────────────────────────────────── */
.authbody {
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  position: relative;
}

/* Decorative grain texture overlay */
.authbody::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ── Back link ─────────────────────────────── */
.auth-back {
  position: fixed;
  top: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-mute);
  text-decoration: none;
  z-index: 10;
  transition: color 0.15s;
}
.auth-back:hover { color: var(--ink); }
.auth-back-arrow {
  font-size: 16px;
  line-height: 1;
}

/* ── Main card ─────────────────────────────── */
.auth-main {
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
}

.auth-card {
  background: var(--bone);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  padding: 40px 36px 36px;
  position: relative;
  box-shadow: 0 4px 40px rgba(42, 38, 32, 0.06), 0 1px 4px rgba(42, 38, 32, 0.04);
}

@media (max-width: 480px) {
  .auth-card { padding: 32px 24px 28px; border-radius: 16px; }
}

/* Corner ornaments */
.auth-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  opacity: 0.25;
}
.auth-corner::before,
.auth-corner::after {
  content: "";
  position: absolute;
  background: var(--terracotta);
}
.auth-corner::before { width: 1px; height: 100%; }
.auth-corner::after  { width: 100%; height: 1px; }
.auth-corner.tl { top: 12px; left: 12px; }
.auth-corner.tl::before { top: 0; left: 0; }
.auth-corner.tl::after  { top: 0; left: 0; }
.auth-corner.tr { top: 12px; right: 12px; }
.auth-corner.tr::before { top: 0; right: 0; }
.auth-corner.tr::after  { top: 0; right: 0; }
.auth-corner.bl { bottom: 12px; left: 12px; }
.auth-corner.bl::before { bottom: 0; left: 0; }
.auth-corner.bl::after  { bottom: 0; left: 0; }
.auth-corner.br { bottom: 12px; right: 12px; }
.auth-corner.br::before { bottom: 0; right: 0; }
.auth-corner.br::after  { bottom: 0; right: 0; }

/* ── Header ────────────────────────────────── */
.auth-eyebrow {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--terracotta);
  margin-bottom: 12px;
}

.auth-title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(24px, 5vw, 32px);
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: 10px;
}

.auth-sub {
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-mute);
  margin-bottom: 28px;
}

/* ── Preserved data notice ─────────────────── */
.auth-preserve {
  display: none;
  align-items: center;
  gap: 10px;
  background: rgba(184, 106, 74, 0.08);
  border: 1px solid rgba(184, 106, 74, 0.20);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 24px;
  font-size: 12px;
  color: var(--terracotta);
}
.auth-preserve.show { display: flex; }
.auth-preserve-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--terracotta);
  flex-shrink: 0;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Google button ─────────────────────────── */
.auth-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 20px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  margin-bottom: 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-google:hover {
  border-color: var(--ink-mute);
  box-shadow: 0 2px 8px rgba(42, 38, 32, 0.08);
}
.auth-google:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Tabs ──────────────────────────────────── */
.auth-tabs {
  display: flex;
  gap: 0;
  background: var(--cream);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 9px 12px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-mute);
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.auth-tab.active {
  background: var(--bone);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(42, 38, 32, 0.08);
}

/* ── Form ──────────────────────────────────── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form.hidden { display: none; }

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.auth-field label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.auth-field input {
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 9px;
  padding: 12px 14px;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

.auth-field input:focus {
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px rgba(184, 106, 74, 0.10);
}

.auth-field input::placeholder {
  color: var(--ink-mute);
  opacity: 0.6;
}

/* ── Error ─────────────────────────────────── */
.auth-error {
  display: none;
  font-size: 12px;
  color: #c0392b;
  padding: 10px 14px;
  background: rgba(192, 57, 43, 0.07);
  border-radius: 7px;
  border: 1px solid rgba(192, 57, 43, 0.15);
}
.auth-error.show { display: block; }

/* ── CTA ───────────────────────────────────── */
.auth-cta {
  margin-top: 6px;
  display: block;
  width: 100%;
  padding: 15px 20px;
  background: var(--terracotta);
  color: #fff;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}

.auth-cta:hover {
  background: #a05840;
  box-shadow: 0 4px 16px rgba(184, 106, 74, 0.30);
}

.auth-cta:active { transform: scale(0.98); }

.auth-cta:disabled {
  background: var(--ink-mute);
  cursor: not-allowed;
  box-shadow: none;
}

.auth-cta-loading::after {
  content: "…";
  animation: dots 1.2s steps(3, end) infinite;
}
@keyframes dots {
  0%   { content: "…"; }
  33%  { content: "…."; }
  66%  { content: "……"; }
  100% { content: "…"; }
}

/* ── Divider ───────────────────────────────── */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--hairline);
}

/* ── Legal ─────────────────────────────────── */
.auth-legal {
  margin-top: 16px;
  font-size: 11px;
  color: var(--ink-mute);
  text-align: center;
  line-height: 1.5;
}
.auth-legal a {
  color: var(--terracotta);
  text-decoration: none;
}
.auth-legal a:hover { text-decoration: underline; }

/* ── Success state ─────────────────────────── */
.auth-success {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 0;
  gap: 12px;
}
.auth-success.show { display: flex; }
.auth-success-mark {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 4px;
}
.auth-success-title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: 22px;
  color: var(--ink);
}
.auth-success-sub {
  font-size: 13px;
  color: var(--ink-mute);
  line-height: 1.6;
  max-width: 280px;
}
.auth-success-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 12px 28px;
  background: var(--terracotta);
  color: #fff;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.auth-success-btn:hover { background: #a05840; }

/* ── Footer wordmark ───────────────────────── */
.auth-wordmark {
  margin-top: 28px;
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-mute);
  opacity: 0.6;
}
