/* ==========================================================
   Charcoal Grill — Login / OTP / Register shared styles
   Matches the main website (wine + gold theme)
   ========================================================== */
:root {
  --gold: #F5A623;
  --gold-light: #FFCA6A;
  --gold-rgb: 245, 166, 35;
  --ember: #D81B4A;
  --ember-rgb: 216, 27, 74;
  --dark: #1a020c;
  --dark3: #2e0818;
  --cream: #ffffff;
  --text: #f0bfcc;
  --muted: rgba(240, 191, 204, 0.62);
  --line: rgba(245, 166, 35, 0.2);
  --danger: #ff8fa3;
  --ok: #7be0a5;
}

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

body {
  min-height: 100vh;
  min-height: 100svh;
  font-family: 'Josefin Sans', sans-serif;
  font-weight: 300;
  color: var(--text);
  background: var(--dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 16px calc(28px + env(safe-area-inset-bottom));
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--gold); color: var(--dark); }

/* ---------- Background ---------- */
.bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 50% at 15% 85%, rgba(var(--ember-rgb), .30), transparent 60%),
    radial-gradient(ellipse 60% 45% at 90% 8%, rgba(var(--gold-rgb), .14), transparent 55%),
    linear-gradient(160deg, #2a0514 0%, var(--dark) 55%, #12010a 100%);
}
.bg::before {
  content: ''; position: absolute; inset: 18px;
  border: 1px solid rgba(var(--gold-rgb), .08);
}
.bg::after {
  content: ''; position: absolute; inset: 0; opacity: .4;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' 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.05'/%3E%3C/svg%3E");
}
.embers { position: absolute; inset: 0; overflow: hidden; }
.embers i {
  position: absolute; bottom: -10px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 8px 2px rgba(var(--gold-rgb), .6);
  opacity: 0; animation: rise linear infinite;
}
@keyframes rise {
  0% { transform: translate(0, 0); opacity: 0; }
  10% { opacity: .85; }
  100% { transform: translate(var(--dx, 20px), -105vh); opacity: 0; }
}

/* ---------- Layout ---------- */
.auth { position: relative; z-index: 1; width: 100%; max-width: 420px; animation: up .8s cubic-bezier(.16,1,.3,1) both; }
@keyframes up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

.top-link {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px;
  font-size: .7rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--muted); text-decoration: none; transition: color .3s;
}
.top-link:hover { color: var(--gold); }

.brand { display: flex; flex-direction: column; align-items: center; margin-bottom: 22px; text-decoration: none; }
.brand img {
  width: 78px; height: 78px; border-radius: 50%; object-fit: cover;
  border: 1.5px solid var(--gold); background: var(--dark3);
  box-shadow: 0 0 0 6px rgba(var(--gold-rgb), .07), 0 12px 30px rgba(0,0,0,.45);
}
.brand span {
  font-family: 'Cormorant Garamond', serif; font-size: 1.65rem; font-weight: 600;
  color: var(--cream); margin-top: 10px; letter-spacing: .06em;
}
.brand span em { color: var(--gold); font-style: normal; }

/* ---------- Card ---------- */
.card {
  position: relative;
  background: rgba(46, 8, 24, .74);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  padding: 30px 28px 26px;
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
}
.card::before {
  content: ''; position: absolute; top: -1px; left: -1px; right: -1px; height: 2px;
  background: linear-gradient(90deg, var(--ember), var(--gold), var(--ember));
  background-size: 200% 100%; animation: shimmer 4s linear infinite;
}
@keyframes shimmer { to { background-position: 200% 0; } }

.steps { display: flex; gap: 6px; justify-content: center; margin-bottom: 20px; }
.steps i { width: 26px; height: 3px; background: rgba(255,255,255,.12); }
.steps i.on { background: var(--gold); }

.eyebrow { font-size: .66rem; letter-spacing: .35em; text-transform: uppercase; color: var(--gold); text-align: center; margin-bottom: 8px; }
h1 { font-family: 'Cormorant Garamond', serif; font-weight: 400; font-size: 2.15rem; color: var(--cream); text-align: center; line-height: 1.1; }
.sub { text-align: center; font-size: .92rem; color: var(--muted); line-height: 1.7; margin: 10px 0 24px; }
.sub strong { color: var(--gold); font-weight: 600; letter-spacing: .05em; white-space: nowrap; }

/* ---------- Fields ---------- */
.field { margin-bottom: 18px; }
.label { display: block; font-size: .66rem; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); margin-bottom: 8px; }
.input {
  width: 100%; height: 52px; min-width: 0;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(var(--gold-rgb), .25); border-radius: 0;
  color: var(--cream); font: 400 16px 'Josefin Sans', sans-serif; /* 16px = no iOS zoom */
  padding: 0 16px; outline: none;
  transition: border-color .25s, background .25s, box-shadow .25s;
}
.input:focus { border-color: var(--gold); background: rgba(var(--gold-rgb), .06); box-shadow: 0 0 0 3px rgba(var(--gold-rgb), .14); }
.input::placeholder { color: rgba(240,191,204,.35); }
.input.invalid { border-color: var(--danger); }
.input[type="date"] { color-scheme: dark; appearance: none; -webkit-appearance: none; }
.input.big { font-size: 18px; letter-spacing: .12em; }

.phone-group { display: flex; }
.phone-group .cc {
  display: flex; align-items: center; gap: 7px; padding: 0 14px; white-space: nowrap;
  border: 1px solid rgba(var(--gold-rgb), .25); border-right: 0;
  background: rgba(255,255,255,.03); color: var(--cream); font-size: 15px;
  transition: border-color .25s;
}
.phone-group:focus-within .cc { border-color: var(--gold); }

.hint { font-size: .8rem; margin-top: 8px; min-height: 1.15em; color: var(--muted); }
.hint.err { color: var(--danger); }
.hint.ok { color: var(--ok); }

.verified {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: .8rem; color: var(--ok); margin: -10px 0 22px;
}

/* ---------- Buttons ---------- */
.btn {
  position: relative; width: 100%; height: 54px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--gold); color: var(--dark); border: 1px solid var(--gold); border-radius: 0;
  font: 600 .78rem 'Josefin Sans', sans-serif; letter-spacing: .2em; text-transform: uppercase;
  cursor: pointer; transition: background .25s, transform .15s, opacity .25s;
}
.btn:hover:not(:disabled) { background: var(--gold-light); border-color: var(--gold-light); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn .lbl { display: inline-flex; align-items: center; gap: 10px; transition: opacity .2s; }
.btn.loading { opacity: 1 !important; }
.btn.loading .lbl { opacity: 0; }
.btn.loading::after {
  content: ''; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid rgba(26,2,12,.25); border-top-color: var(--dark);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-ghost { background: transparent; color: var(--gold); border-color: rgba(var(--gold-rgb), .4); height: 48px; margin-top: 10px; }
.btn-ghost:hover:not(:disabled) { background: rgba(var(--gold-rgb), .1); border-color: var(--gold); }
.btn-ghost.loading::after { border-color: rgba(var(--gold-rgb), .25); border-top-color: var(--gold); }

/* ---------- OTP boxes ---------- */
.otp { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 20px; }
.otp input {
  width: 100%; min-width: 0; height: 58px; text-align: center;
  font: 600 22px 'Josefin Sans', sans-serif; color: var(--cream);
  background: rgba(255,255,255,.05); border: 1px solid rgba(var(--gold-rgb), .25); border-radius: 0;
  outline: none; caret-color: var(--gold);
  transition: border-color .2s, background .2s, transform .15s, box-shadow .2s;
}
.otp input:focus { border-color: var(--gold); background: rgba(var(--gold-rgb), .07); box-shadow: 0 0 0 3px rgba(var(--gold-rgb), .14); transform: translateY(-2px); }
.otp input.filled { border-color: rgba(var(--gold-rgb), .6); background: rgba(var(--gold-rgb), .09); }
.otp.shake { animation: shake .45s; }
.otp.shake input { border-color: var(--danger); }
@keyframes shake { 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }

.timer { text-align: center; font-size: .84rem; color: var(--muted); margin-top: 16px; }
.timer strong { color: var(--gold); font-weight: 600; }
.change { display: block; text-align: center; margin-top: 16px; font-size: .8rem; color: var(--muted); }
.change a { color: var(--gold); text-decoration: none; border-bottom: 1px solid rgba(var(--gold-rgb), .4); }

/* ---------- Alerts ---------- */
.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; margin-bottom: 18px; font-size: .86rem; line-height: 1.5;
  border: 1px solid rgba(255,143,163,.35); background: rgba(var(--ember-rgb), .12); color: var(--danger);
}
.alert.ok { border-color: rgba(123,224,165,.35); background: rgba(123,224,165,.08); color: var(--ok); }
.alert[hidden] { display: none; }

/* ---------- Perks + footer ---------- */
.perks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 24px; padding-top: 20px; border-top: 1px solid rgba(var(--gold-rgb), .12); }
.perk { text-align: center; font-size: .64rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); line-height: 1.5; }
.perk i { display: block; font-size: 1.05rem; color: var(--gold); margin-bottom: 7px; }

.foot { text-align: center; font-size: .75rem; color: rgba(240,191,204,.45); margin-top: 18px; line-height: 1.7; padding: 0 8px; }
.foot a { color: var(--gold); text-decoration: none; }
.foot a:hover { text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 400px) {
  .card { padding: 26px 18px 22px; }
  h1 { font-size: 1.9rem; }
  .otp { gap: 6px; }
  .otp input { height: 52px; font-size: 20px; }
  .brand img { width: 66px; height: 66px; }
  .bg::before { inset: 10px; }
}
@media (max-height: 680px) { body { justify-content: flex-start; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .embers { display: none; }
}
