/* ===== Auth pages: centered card design =====
   Surface/text vars are auth-specific (deeper darks than the dashboard).
   Gold/accent vars come from variables.css so the brand color stays in sync.
*/

html, body { height: 100%; }

body.auth-body {
  --auth-bg-0: #0a0d14;
  --auth-bg-1: #0f131c;
  --auth-bg-2: #151a26;
  --auth-bg-3: #1c2230;
  --auth-line: rgba(255, 255, 255, 0.06);
  --auth-line-strong: rgba(255, 255, 255, 0.1);
  --auth-text-1: #f4f5f7;
  --auth-text-2: #a8aebd;
  --auth-text-3: #6b7388;

  margin: 0;
  background: var(--auth-bg-0);
  color: var(--auth-text-1);
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  min-height: 100vh;
}

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

/* ----- Page wrapper ----- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 24px 40px;
  position: relative;
  overflow: hidden;
}

/* Subtle ambient gold glow */
.auth-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(var(--accent-rgb), 0.08), transparent 70%),
    radial-gradient(ellipse 80% 60% at 50% 100%, rgba(var(--accent-rgb), 0.04), transparent 70%);
  pointer-events: none;
}

/* Subtle grid */
.auth-page::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

/* ----- Card ----- */
.auth-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 520px;
  background: var(--auth-bg-1);
  border: 1px solid var(--auth-line-strong);
  border-radius: 20px;
  padding: 44px 48px 36px;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.02);
  animation: authFadeUp 0.5s ease backwards;
}

.auth-card.wide { max-width: 560px; }

/* Brand at top */
.auth-brand-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}

.auth-brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent-bright) 0%, var(--accent) 50%, var(--gold-deep) 100%);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--on-accent);
  font-size: 17px;
  letter-spacing: -0.02em;
  box-shadow:
    0 8px 24px rgba(var(--accent-rgb), 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.auth-brand-name {
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--auth-text-1);
}

/* Form header */
.auth-form-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-form-header h1 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 6px;
  color: var(--auth-text-1);
}

.auth-form-header .subtitle {
  font-size: 14px;
  color: var(--auth-text-2);
  margin: 0;
}

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

.auth-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.auth-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0;
}

.auth-form label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--auth-text-2);
  margin: 0;
}

.auth-form label .opt {
  color: var(--auth-text-3);
  font-weight: 400;
  margin-left: 4px;
}

.auth-form input,
.auth-form select {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  background: var(--auth-bg-2);
  border: 1px solid var(--auth-line-strong);
  border-radius: 10px;
  color: var(--auth-text-1);
  font-family: 'Geist', -apple-system, sans-serif;
  font-size: 14.5px;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}

.auth-form input::placeholder {
  color: var(--auth-text-3);
}

.auth-form input:hover,
.auth-form select:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

.auth-form input:focus,
.auth-form select:focus {
  border-color: var(--accent);
  background: var(--auth-bg-3);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.08);
}

.auth-form select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-right: 46px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7388' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

/* Password / icon input */
.password-field { position: relative; }
.password-field input { padding-right: 46px; }

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--auth-text-3);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  transition: color 0.2s;
}

.password-toggle:hover { color: var(--accent); }
.password-toggle svg { width: 17px; height: 17px; display: block; }

/* Phone prefix */
.input-with-prefix { position: relative; }

.input-with-prefix input {
  padding-left: 52px;
}

.input-prefix {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--auth-text-3);
  pointer-events: none;
  border-right: 1px solid var(--auth-line);
  padding-right: 10px;
  height: 22px;
  display: flex;
  align-items: center;
}

/* Password strength */
.strength-meter {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.strength-bar {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--auth-bg-3);
  transition: background 0.3s;
}

.strength-bar.active-1 { background: #ef4d5e; }
.strength-bar.active-2 { background: #f59e0b; }
.strength-bar.active-3 { background: #34c77b; }

.strength-text {
  font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--auth-text-3);
  text-transform: uppercase;
  margin-top: 6px;
}

/* Meta row (remember me + forgot) */
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
}

.checkbox-row input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.checkbox-box {
  width: 17px;
  height: 17px;
  border: 1px solid var(--auth-line-strong);
  border-radius: 5px;
  background: var(--auth-bg-2);
  display: grid;
  place-items: center;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.checkbox-box svg {
  width: 11px;
  height: 11px;
  color: var(--on-accent);
  opacity: 0;
  transition: opacity 0.2s;
}

.checkbox-row input:checked + .checkbox-box {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox-row input:checked + .checkbox-box svg {
  opacity: 1;
}

.checkbox-label {
  font-size: 13px;
  color: var(--auth-text-2);
  margin: 0;
  cursor: pointer;
}

.auth-link {
  font-size: 13px;
  color: var(--accent-bright);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.auth-link:hover { color: var(--accent); }

/* Submit button */
.btn-auth {
  margin-top: 8px;
  width: 100%;
  height: 50px;
  background: linear-gradient(180deg, var(--accent-bright) 0%, var(--accent) 100%);
  border: 1px solid var(--accent);
  border-radius: 10px;
  color: var(--on-accent);
  font-family: 'Geist', -apple-system, sans-serif;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow:
    0 8px 24px rgba(var(--accent-rgb), 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-auth:hover {
  transform: translateY(-1px);
  box-shadow:
    0 12px 32px rgba(var(--accent-rgb), 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn-auth:active { transform: translateY(0); }
.btn-auth:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Error / success banners */
.auth-error,
.auth-success {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 4px;
  display: none;
  border: 1px solid transparent;
}

.auth-error {
  background: rgba(239, 77, 94, 0.1);
  border-color: rgba(239, 77, 94, 0.25);
  color: #ef4d5e;
}

.auth-success {
  background: rgba(52, 199, 123, 0.1);
  border-color: rgba(52, 199, 123, 0.25);
  color: #34c77b;
}

.auth-error a,
.auth-success a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.auth-error a:hover,
.auth-success a:hover {
  text-decoration: none;
}

/* Footer link */
.auth-footer {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--auth-line);
  text-align: center;
  font-size: 13.5px;
  color: var(--auth-text-2);
}

.auth-footer a {
  color: var(--accent-bright);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.auth-footer a:hover { color: var(--accent); }

/* Animations */
@keyframes authFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 540px) {
  .auth-card {
    padding: 32px 24px 28px;
    border-radius: 16px;
  }
  .auth-form .form-row {
    grid-template-columns: 1fr;
  }
}
