/**
 * Premium auth — login / register / forgot
 * Mobile: centered floating card (same feel as desktop)
 */

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

:root {
  --auth-gold-1: #ffe566;
  --auth-gold-2: #f9d423;
  --auth-gold-3: #d4a017;
  --auth-card-bg: linear-gradient(165deg, #2e2e2e 0%, #181818 52%, #0c0c0c 100%);
  --auth-border: rgba(249, 212, 35, 0.3);
  --auth-muted: rgba(255, 255, 255, 0.58);
  --auth-card-w: 360px;
}

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

html {
  height: 100%;
  height: -webkit-fill-available;
}

html, body {
  margin: 0;
  padding: 0;
}

body.auth-page {
  min-height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 600;
  color: #fff;
  background:
    radial-gradient(ellipse 90% 55% at 50% -12%, rgba(249, 212, 35, 0.15), transparent 55%),
    radial-gradient(circle at 85% 95%, rgba(26, 111, 255, 0.1), transparent 42%),
    radial-gradient(circle at center, #1a1a1a 0%, #050505 100%);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Full viewport stage — always center the card */
.auth-wrap {
  flex: 1 0 auto;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(20px, env(safe-area-inset-top, 0px))
    max(18px, env(safe-area-inset-right, 0px))
    max(20px, env(safe-area-inset-bottom, 0px))
    max(18px, env(safe-area-inset-left, 0px));
}

.auth-card {
  width: min(var(--auth-card-w), 100%);
  max-width: 100%;
  margin: 0 auto;
  padding: 22px 22px 18px;
  border-radius: 16px;
  background: var(--auth-card-bg);
  border: 1px solid var(--auth-border);
  color: #fff;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 18px 44px rgba(0, 0, 0, 0.55),
    0 0 60px rgba(249, 212, 35, 0.07);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--auth-gold-2), transparent);
  pointer-events: none;
}

.auth-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin: 0 0 16px;
  padding: 2px 0 0;
}

.auth-logo {
  display: block;
  width: min(180px, 58%);
  max-width: 200px;
  height: auto;
  max-height: 72px;
  margin: 0 auto;
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 14px rgba(249, 212, 35, 0.2));
}

.auth-title {
  margin: 10px 0 0;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  line-height: 1.25;
}

.auth-sub {
  margin: 6px 0 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--auth-muted);
  line-height: 1.4;
  max-width: 280px;
}

.auth-form-item {
  margin-bottom: 11px;
}

.auth-input-wrap {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 46px;
  padding: 0 6px 0 12px;
  background: #fff;
  border: 1px solid #ebebeb;
  border-radius: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-input-wrap:focus-within {
  border-color: var(--auth-gold-2);
  box-shadow: 0 0 0 3px rgba(249, 212, 35, 0.2);
}

.auth-prefix {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  flex-shrink: 0;
  color: rgba(0, 0, 0, 0.4);
  font-size: 14px;
  line-height: 1;
}

.auth-input-wrap input,
.auth-input-wrap .ant-input {
  flex: 1;
  width: 100%;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  padding: 11px 8px;
  font-size: 16px;
  font-family: inherit;
  font-weight: 600;
  color: #1a1a1a;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
}

.auth-eye {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #666;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.auth-eye:hover,
.auth-eye:active {
  color: #111;
  background: rgba(0, 0, 0, 0.06);
}

.auth-eye .eye-icon {
  width: 20px;
  height: 20px;
  display: none;
  pointer-events: none;
}

.auth-eye .eye-open { display: block; }
.auth-eye.is-shown .eye-open { display: none; }
.auth-eye.is-shown .eye-closed { display: block; }

.auth-btn {
  width: 100%;
  margin-top: 2px;
  border: none;
  border-radius: 10px;
  padding: 13px 14px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  color: #1a1400;
  background: linear-gradient(180deg, var(--auth-gold-1), var(--auth-gold-2) 48%, var(--auth-gold-3));
  box-shadow: 0 8px 18px rgba(212, 160, 23, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.auth-btn:active { transform: scale(0.985); }

.auth-btn--gold {
  color: #1a1400;
  background: linear-gradient(180deg, var(--auth-gold-1), var(--auth-gold-2) 50%, var(--auth-gold-3));
}

.auth-alert {
  padding: 9px 11px;
  margin-bottom: 11px;
  border-radius: 8px;
  font-size: 12px;
  text-align: center;
  font-weight: 600;
  line-height: 1.35;
}

.auth-alert-error {
  background: rgba(255, 77, 79, 0.14);
  border: 1px solid rgba(255, 120, 117, 0.45);
  color: #ff9c9a;
}

.auth-alert-success {
  background: rgba(82, 196, 26, 0.14);
  border: 1px solid rgba(149, 222, 100, 0.4);
  color: #b7eb8f;
}

.auth-links {
  margin-top: 12px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--auth-muted);
  line-height: 1.7;
}

.auth-links a {
  color: var(--auth-gold-2);
  text-decoration: none;
  font-weight: 700;
}

.auth-footer {
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}

.auth-footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 2px 4px;
  font-size: 10px;
  font-weight: 600;
}

.auth-footer-links a {
  color: rgba(255, 255, 255, 0.45);
  text-decoration: none;
  padding: 4px 6px;
  border-radius: 5px;
}

.auth-footer-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: inline-block;
  flex-shrink: 0;
}

#login-form_username,
.auth-card input[name="username"]:not(#admin-username) {
  text-transform: uppercase !important;
}

.auth-email-hint {
  display: none;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 600;
  color: #ff9c9a;
}

/* ========== MOBILE: floating card, perfect center ========== */
@media (max-width: 767px) {
  :root {
    --auth-card-w: 340px;
  }

  .auth-wrap {
    /* Keep true vertical + horizontal center */
    align-items: center;
    justify-content: center;
    padding:
      max(24px, calc(env(safe-area-inset-top, 0px) + 16px))
      20px
      max(24px, calc(env(safe-area-inset-bottom, 0px) + 16px));
  }

  .auth-card {
    /* Never full-bleed — leave side gap like desktop card */
    width: min(340px, calc(100vw - 40px));
    max-width: calc(100vw - 40px);
    padding: 18px 16px 14px;
    border-radius: 14px;
  }

  .auth-header {
    margin-bottom: 14px;
  }

  .auth-logo {
    width: min(156px, 52%);
    max-width: 52%;
    max-height: 64px;
  }

  .auth-title {
    font-size: 13px;
    margin-top: 8px;
  }

  .auth-sub {
    font-size: 11px;
    margin-top: 5px;
  }

  .auth-form-item {
    margin-bottom: 10px;
  }

  .auth-input-wrap {
    min-height: 44px;
    border-radius: 9px;
  }

  .auth-btn {
    padding: 12px 14px;
    border-radius: 9px;
    font-size: 12px;
  }

  .auth-links {
    margin-top: 10px;
    font-size: 11px;
  }

  .auth-footer {
    margin-top: 10px;
    padding-top: 10px;
  }

  .auth-footer-dot {
    display: none;
  }

  .auth-footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px 0;
  }

  .auth-footer-links a {
    font-size: 9px;
    padding: 4px 6px;
    white-space: nowrap;
  }
}

/* Compact phones / keyboard open: still center, allow gentle scroll */
@media (max-width: 767px) and (max-height: 640px) {
  .auth-wrap {
    align-items: center;
    padding-top: max(12px, env(safe-area-inset-top, 0px));
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }

  .auth-card {
    padding: 14px 14px 12px;
  }

  .auth-logo {
    width: min(140px, 48%);
    max-height: 56px;
  }

  .auth-header {
    margin-bottom: 10px;
  }

  .auth-form-item {
    margin-bottom: 8px;
  }

  .auth-input-wrap {
    min-height: 40px;
  }

  .auth-btn {
    padding: 11px 12px;
  }
}

/* Desktop */
@media (min-width: 768px) {
  :root {
    --auth-card-w: 380px;
  }

  .auth-card {
    width: 380px;
    padding: 24px 26px 20px;
  }

  .auth-logo {
    width: 160px;
    max-height: 64px;
  }
}
