@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Instrument+Serif:ital@0;1&display=swap');

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

:root {
  --bg-deep: #0c0606;
  --bg-mid: #1a0a0a;
  --bg-panel: rgba(14, 8, 8, 0.88);
  --bg-card: rgba(22, 14, 14, 0.96);
  --red: #8b0000;
  --red-bright: #c41e3a;
  --gold: #d4af37;
  --gold-dim: #a68b2d;
  --gold-glow: rgba(212, 175, 55, 0.22);
  --text: #f5f0eb;
  --text-muted: #a89f96;
  --border: rgba(212, 175, 55, 0.16);
  --border-strong: rgba(212, 175, 55, 0.32);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  --input-bg: rgba(255, 255, 255, 0.04);
  --error: #f87171;
  --success: #4ade80;
}

html { scroll-behavior: smooth; }

body.auth-page {
  margin: 0;
  min-height: 100vh;
  font-family: 'DM Sans', 'Segoe UI', sans-serif;
  color: var(--text);
  background:
    radial-gradient(ellipse 70% 55% at 15% 20%, rgba(139, 0, 0, 0.45), transparent 55%),
    radial-gradient(ellipse 50% 40% at 90% 10%, rgba(212, 175, 55, 0.12), transparent 50%),
    radial-gradient(ellipse 60% 50% at 50% 100%, rgba(36, 8, 8, 0.9), transparent),
    linear-gradient(160deg, var(--bg-deep) 0%, var(--bg-mid) 50%, #240808 100%);
  line-height: 1.5;
}

.auth-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  max-width: 1280px;
  margin: 0 auto;
}

/* —— Brand panel —— */
.auth-brand {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 56px;
  border-right: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.auth-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, transparent 40%, rgba(212, 175, 55, 0.04) 100%),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 48px,
      rgba(212, 175, 55, 0.03) 48px,
      rgba(212, 175, 55, 0.03) 49px
    );
  pointer-events: none;
}

.auth-brand-inner {
  position: relative;
  z-index: 1;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--text);
}

.auth-logo-mark {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--gold), #7a5f00);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  color: #1a0808;
  letter-spacing: -0.03em;
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.25);
}

.auth-logo-text strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.auth-logo-text span {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.auth-hero {
  margin-top: 72px;
  max-width: 420px;
}

.auth-hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(212, 175, 55, 0.08);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 24px;
}

.auth-hero-tag::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}

.auth-hero h1 {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: clamp(2.25rem, 4vw, 3.25rem);
  font-weight: 400;
  line-height: 1.15;
  margin: 0 0 20px;
  letter-spacing: -0.02em;
}

.auth-hero h1 em {
  font-style: italic;
  color: var(--gold);
}

.auth-hero p {
  margin: 0;
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.auth-features {
  list-style: none;
  margin: 36px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-features li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-features li svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--gold-dim);
}

.auth-brand-footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.auth-socials {
  display: flex;
  gap: 10px;
}

.auth-socials a {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.auth-socials a:hover {
  color: var(--gold);
  border-color: var(--border-strong);
  background: rgba(212, 175, 55, 0.08);
}

.auth-socials svg {
  width: 18px;
  height: 18px;
}

.auth-brand-footer small {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* —— Form panel —— */
.auth-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 40px 36px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.auth-card-header {
  margin-bottom: 32px;
}

.auth-card-header h2 {
  margin: 0 0 8px;
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.auth-card-header p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.auth-field label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.auth-field input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.auth-field input::placeholder {
  color: rgba(168, 159, 150, 0.55);
}

.auth-field input:hover {
  border-color: var(--border-strong);
}

.auth-field input:focus {
  outline: none;
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px var(--gold-glow);
  background: rgba(255, 255, 255, 0.06);
}

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.auth-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--gold);
  cursor: pointer;
}

.auth-forgot {
  font-size: 0.85rem;
  color: var(--gold);
  text-decoration: none;
  font-weight: 500;
}

.auth-forgot:hover {
  text-decoration: underline;
}

.auth-submit {
  margin-top: 4px;
  width: 100%;
  padding: 15px 24px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--gold) 0%, #b8942e 100%);
  color: #1a0808;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 4px 20px rgba(212, 175, 55, 0.3);
}

.auth-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(212, 175, 55, 0.38);
}

.auth-submit:active:not(:disabled) {
  transform: translateY(0);
}

.auth-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.auth-switch {
  margin: 24px 0 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-switch a {
  color: var(--gold);
  font-weight: 600;
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* —— Modal —— */
.auth-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 3000;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 2, 2, 0.75);
  backdrop-filter: blur(6px);
}

.auth-modal.show {
  display: flex;
}

.auth-modal-card {
  width: 100%;
  max-width: 400px;
  padding: 36px 32px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  text-align: center;
  animation: authModalIn 0.28s ease-out;
}

@keyframes authModalIn {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-modal-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
}

.auth-modal-icon.error {
  background: rgba(248, 113, 113, 0.12);
  color: var(--error);
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.auth-modal-icon.success {
  background: rgba(74, 222, 128, 0.12);
  color: var(--success);
  border: 1px solid rgba(74, 222, 128, 0.25);
}

.auth-modal-icon.pending {
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold);
  border: 1px solid rgba(212, 175, 55, 0.28);
  font-size: 1.35rem;
}

.auth-notice {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.45;
}

.auth-notice-warn {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: #fecaca;
}

.auth-switch-muted {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.auth-switch-muted a {
  color: var(--gold);
}

.auth-modal-title {
  margin: 0 0 10px;
  font-size: 1.25rem;
  font-weight: 600;
}

.auth-modal-message {
  margin: 0 0 28px;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.auth-modal-btn {
  min-width: 140px;
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--gold) 0%, #b8942e 100%);
  color: #1a0808;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.auth-modal-btn:hover {
  opacity: 0.92;
}

/* —— Responsive —— */
@media (max-width: 900px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 32px 28px;
  }

  .auth-hero {
    margin-top: 32px;
  }

  .auth-features {
    display: none;
  }

  .auth-form-panel {
    padding: 32px 20px 48px;
  }

  .auth-card {
    padding: 32px 24px;
  }
}

@media (max-width: 480px) {
  .auth-brand {
    padding: 24px 20px;
  }

  .auth-hero h1 {
    font-size: 2rem;
  }
}
