/* ================================================================
   Amoblarthe — Auth (login) styles
   Glass-morphism + animated background, fast & robust.
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --auth-brand: #8b5a2b;
  --auth-brand-light: #b07a4a;
  --auth-brand-dark: #5a3a1a;
  --auth-accent: #2f8b85;
  --auth-accent-light: #6dbab4;
  --auth-cream: #f7f1e6;
  --auth-text: #2a1f15;
  --auth-text-soft: rgba(42, 31, 21, 0.65);
  --auth-glass-bg: rgba(255, 255, 255, 0.55);
  --auth-glass-border: rgba(255, 255, 255, 0.7);
  --auth-glass-shadow: 0 30px 80px -20px rgba(90, 58, 26, 0.35),
                       0 8px 32px -8px rgba(90, 58, 26, 0.18);
  --auth-input-bg: rgba(255, 255, 255, 0.55);
  --auth-input-border: rgba(139, 90, 43, 0.18);
  --auth-input-focus: rgba(139, 90, 43, 0.7);
  --auth-danger: #c44545;
}

/* Hide global header/footer only on the login page */
body.auth-body .topbar,
body.auth-body .site-topbar,
body.auth-body .foot,
body.auth-body .site-foot { display: none !important; }
body.auth-body { background: var(--auth-cream); margin: 0; overflow: hidden; }
body.auth-body main { max-width: none; padding: 0; margin: 0; }

.auth-page {
  min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--auth-text);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

/* ================================================================
   BACKGROUND — discreet, with life: 3 blobs + grid + few particles
   ================================================================ */
.auth-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 90% 70% at 0% 0%, #f3e7d4 0%, transparent 60%),
    radial-gradient(ellipse 80% 60% at 100% 100%, #e8d8c1 0%, transparent 55%),
    linear-gradient(135deg, #faf5eb 0%, #f0e4d0 100%);
  overflow: hidden;
}

/* Subtle grid pattern */
.auth-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(139, 90, 43, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 90, 43, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, #000 30%, transparent 80%);
  pointer-events: none;
}

/* Blobs */
.auth-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  will-change: transform;
  pointer-events: none;
}
.auth-blob.b1 {
  width: 560px; height: 560px;
  background: radial-gradient(circle, var(--auth-brand-light), transparent 70%);
  top: -160px; left: -120px;
  opacity: 0.45;
  animation: drift-1 28s ease-in-out infinite;
}
.auth-blob.b2 {
  width: 520px; height: 520px;
  background: radial-gradient(circle, var(--auth-accent-light), transparent 70%);
  bottom: -140px; right: -100px;
  opacity: 0.4;
  animation: drift-2 32s ease-in-out infinite;
}
.auth-blob.b3 {
  width: 360px; height: 360px;
  background: radial-gradient(circle, #d8a878, transparent 70%);
  top: 35%; left: 32%;
  opacity: 0.25;
  animation: drift-3 36s ease-in-out infinite;
}
@keyframes drift-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(50px, 60px) scale(1.06); }
}
@keyframes drift-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-60px, -40px) scale(1.08); }
}
@keyframes drift-3 {
  0%, 100% { transform: translate(0, 0); }
  50%      { transform: translate(30px, -25px); }
}

/* Floating particles - just 6, very subtle */
.auth-particles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.auth-particles span {
  position: absolute;
  display: block;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--auth-brand);
  opacity: 0;
  animation: rise 22s linear infinite;
}
.auth-particles span:nth-child(1) { left: 12%; animation-delay: 0s;  width: 5px; height: 5px; }
.auth-particles span:nth-child(2) { left: 28%; animation-delay: 5s;  background: var(--auth-accent); }
.auth-particles span:nth-child(3) { left: 45%; animation-delay: 9s;  width: 6px; height: 6px; background: var(--auth-brand-light); }
.auth-particles span:nth-child(4) { left: 62%; animation-delay: 3s; }
.auth-particles span:nth-child(5) { left: 78%; animation-delay: 14s; background: var(--auth-accent-light); }
.auth-particles span:nth-child(6) { left: 90%; animation-delay: 7s; width: 5px; height: 5px; }
@keyframes rise {
  0%   { transform: translateY(110vh) translateX(0); opacity: 0; }
  10%  { opacity: 0.4; }
  90%  { opacity: 0.3; }
  100% { transform: translateY(-10vh) translateX(20px); opacity: 0; }
}

/* ================================================================
   LAYOUT
   ================================================================ */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  padding: 32px 24px;
}
@media (min-width: 1024px) {
  .auth-shell {
    grid-template-columns: 1.05fr 1fr;
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 56px;
    gap: 64px;
  }
}

/* ================================================================
   HERO (left, desktop only) — single-pass entry, fast
   ================================================================ */
.auth-hero { display: none; }
@media (min-width: 1024px) {
  .auth-hero {
    display: block;
    opacity: 0;
    transform: translateX(-20px);
    animation: hero-in 0.55s 0.05s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }
}
.auth-hero h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 20px;
  background: linear-gradient(135deg, var(--auth-brand-dark) 0%, var(--auth-brand) 50%, var(--auth-accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.auth-hero p {
  font-size: 1.05rem;
  color: var(--auth-text-soft);
  max-width: 460px;
  line-height: 1.65;
  margin: 0;
}
@keyframes hero-in {
  to { opacity: 1; transform: translateX(0); }
}

/* ================================================================
   GLASS CARD
   ================================================================ */
.auth-card-wrap { display: flex; justify-content: center; width: 100%; }
.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--auth-glass-bg);
  border: 1px solid var(--auth-glass-border);
  border-radius: 24px;
  padding: 44px 40px;
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow: var(--auth-glass-shadow);
  position: relative;
  opacity: 0;
  transform: translateY(16px);
  animation: card-in 0.45s 0.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.auth-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(255,255,255,0.1) 40%, rgba(176,122,74,0.3));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}
@keyframes card-in {
  to { opacity: 1; transform: translateY(0); }
}

/* Logo + brand */
.auth-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  opacity: 0;
  animation: rise-in 0.4s 0.2s ease-out forwards;
}
.auth-logo-mark {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--auth-brand) 0%, var(--auth-brand-dark) 60%, var(--auth-accent) 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px -4px rgba(139, 90, 43, 0.5),
              inset 0 1px 0 rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
}
.auth-logo-mark svg { width: 26px; height: 26px; color: #fff; }
.auth-logo-text { display: flex; flex-direction: column; line-height: 1; }
.auth-logo-text .name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--auth-text);
  letter-spacing: -0.01em;
}
.auth-logo-text .tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--auth-text-soft);
  font-weight: 500;
  margin-top: 4px;
}

.auth-card h2 {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  opacity: 0;
  animation: rise-in 0.4s 0.26s ease-out forwards;
}
.auth-sub {
  color: var(--auth-text-soft);
  margin: 0 0 32px;
  font-size: 0.92rem;
  opacity: 0;
  animation: rise-in 0.4s 0.3s ease-out forwards;
}

/* ================================================================
   FORM
   ================================================================ */
.auth-form { display: flex; flex-direction: column; gap: 18px; }
.auth-field {
  position: relative;
  opacity: 0;
  animation: rise-in 0.4s ease-out forwards;
}
.auth-field:nth-of-type(1) { animation-delay: 0.34s; }
.auth-field:nth-of-type(2) { animation-delay: 0.4s; }
.auth-field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--auth-text);
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}
.auth-input-wrap { position: relative; display: flex; align-items: center; }
.auth-input-icon {
  position: absolute;
  left: 16px;
  width: 18px; height: 18px;
  color: var(--auth-text-soft);
  pointer-events: none;
  transition: color 0.2s;
}
.auth-input {
  width: 100%;
  height: 52px;
  padding: 0 16px 0 46px;
  background: var(--auth-input-bg);
  border: 1.5px solid var(--auth-input-border);
  border-radius: 14px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--auth-text);
  outline: none;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.auth-input::placeholder { color: rgba(42, 31, 21, 0.4); }
.auth-input:hover { border-color: rgba(139, 90, 43, 0.35); }
.auth-input:focus {
  border-color: var(--auth-input-focus);
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 0 0 4px rgba(139, 90, 43, 0.12);
}
.auth-input-wrap:focus-within .auth-input-icon { color: var(--auth-brand); }

/* Password toggle */
.auth-toggle-pw {
  position: absolute;
  right: 14px;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 6px;
  color: var(--auth-text-soft);
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
  display: flex;
  align-items: center;
}
.auth-toggle-pw:hover { color: var(--auth-brand); background: rgba(139,90,43,0.08); }
.auth-toggle-pw svg { width: 18px; height: 18px; }
.auth-toggle-pw .eye-off { display: none; }
.auth-toggle-pw[data-visible='true'] .eye-off { display: block; }
.auth-toggle-pw[data-visible='true'] .eye-on { display: none; }

/* Submit button */
.auth-submit {
  position: relative;
  width: 100%;
  height: 54px;
  margin-top: 10px;
  border: 0;
  border-radius: 14px;
  font: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--auth-brand) 0%, var(--auth-brand-dark) 100%);
  box-shadow: 0 10px 24px -8px rgba(139, 90, 43, 0.5),
              inset 0 1px 0 rgba(255, 255, 255, 0.25);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  opacity: 0;
  animation: rise-in 0.4s 0.46s ease-out forwards;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.auth-submit::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,0.3) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
  pointer-events: none;
}
.auth-submit:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -8px rgba(139, 90, 43, 0.6); }
.auth-submit:hover::after { transform: translateX(100%); }
.auth-submit:active { transform: translateY(0); }
.auth-submit svg { width: 18px; height: 18px; transition: transform 0.2s; }
.auth-submit:hover svg.arrow { transform: translateX(3px); }
.auth-submit[aria-busy='true'] { pointer-events: none; opacity: 0.7; }
.auth-submit[aria-busy='true'] .auth-spinner { display: inline-block; }
.auth-submit[aria-busy='true'] .auth-submit-text,
.auth-submit[aria-busy='true'] svg.arrow { display: none; }
.auth-spinner {
  display: none;
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Error / flash */
.auth-flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: rgba(196, 69, 69, 0.1);
  border: 1px solid rgba(196, 69, 69, 0.25);
  color: var(--auth-danger);
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 500;
  animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97), fade-in 0.3s;
}
.auth-flash svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Footer */
.auth-foot {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid rgba(139, 90, 43, 0.12);
  text-align: center;
  font-size: 0.85rem;
  color: var(--auth-text-soft);
  opacity: 0;
  animation: fade-in 0.4s 0.55s ease-out forwards;
}
.auth-foot a { color: var(--auth-brand); font-weight: 600; text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }

/* ================================================================
   Keyframes
   ================================================================ */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in { to { opacity: 1; } }
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

/* Mobile */
@media (max-width: 480px) {
  .auth-card { padding: 32px 24px; border-radius: 22px; }
  .auth-card h2 { font-size: 1.5rem; }
  .auth-shell { padding: 16px; }
}

/* Reduce motion: disable everything decorative, keep functionality */
@media (prefers-reduced-motion: reduce) {
  .auth-blob, .auth-particles span { animation: none; }
  .auth-card, .auth-hero, .auth-logo, .auth-card h2, .auth-sub,
  .auth-field, .auth-submit, .auth-foot { animation: none; opacity: 1; transform: none; }
}
