/* ─── Variables ─────────────────────────────────────── */
:root {
  --bg-deep:    #040b18;
  --bg-mid:     #071224;
  --card-bg:    rgba(10, 22, 45, 0.85);
  --border-glow: rgba(0, 212, 255, 0.25);
  --accent:     #00d4ff;
  --accent-dim: #007a99;
  --purple:     #7c3aed;
  --purple-dim: #4c1d95;
  --text-main:  #e8f4fd;
  --text-muted: #6b8caa;
  --input-bg:   rgba(255,255,255,0.05);
  --input-border: rgba(0,212,255,0.2);
  --error:      #ff4d6d;
  --success:    #00e5a0;
  --radius:     14px;
  --transition: 0.25s ease;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-deep);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--text-main);
}

/* ─── Neural canvas background ───────────────────────── */
#neural-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ─── Glow orbs ──────────────────────────────────────── */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.18;
  z-index: 0;
  animation: orbFloat 12s ease-in-out infinite alternate;
}
.orb-1 { width: 480px; height: 480px; background: #0066ff; top: -100px; left: -120px; animation-delay: 0s; }
.orb-2 { width: 380px; height: 380px; background: #7c3aed; bottom: -80px; right: -80px; animation-delay: 3s; }
.orb-3 { width: 260px; height: 260px; background: #00d4ff; top: 50%; left: 50%; transform: translate(-50%,-50%); animation-delay: 6s; }

@keyframes orbFloat {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, -30px) scale(1.08); }
}

/* ─── Page wrapper ───────────────────────────────────── */
.page-wrapper {
  position: relative;
  z-index: 10;
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

/* ─── Split layout (desktop) ────────────────────────── */
.auth-shell {
  display: flex;
  width: 100%;
  max-width: 980px;
  min-height: 580px;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0,0,0,0.6), 0 0 0 1px var(--border-glow);
  backdrop-filter: blur(2px);
}

/* ─── Left panel (branding) ────────────────────────── */
.panel-brand {
  flex: 1.1;
  background: linear-gradient(145deg, #071a36 0%, #0a0e2a 60%, #12054a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2.5rem;
  position: relative;
  overflow: hidden;
}

.panel-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 40%, rgba(0,212,255,0.08) 0%, transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(124,58,237,0.12) 0%, transparent 50%);
}

/* Brain SVG illustration */
.brain-illustration {
  width: 190px;
  height: 190px;
  margin-bottom: 2rem;
  position: relative;
  z-index: 2;
  animation: brainPulse 4s ease-in-out infinite;
  filter: drop-shadow(0 0 24px rgba(0,212,255,0.4));
}

@keyframes brainPulse {
  0%, 100% { transform: scale(1);   filter: drop-shadow(0 0 20px rgba(0,212,255,0.35)); }
  50%       { transform: scale(1.04); filter: drop-shadow(0 0 38px rgba(0,212,255,0.6)); }
}

.brand-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #ffffff 30%, #00d4ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  z-index: 2;
  margin-bottom: 0.6rem;
}

.brand-tagline {
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  position: relative;
  z-index: 2;
  text-align: center;
  line-height: 1.5;
  max-width: 220px;
}

.brand-divider {
  width: 48px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  margin: 1.4rem auto;
  position: relative;
  z-index: 2;
  border-radius: 2px;
}

.brand-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  position: relative;
  z-index: 2;
  margin-top: 0.5rem;
}

.brand-pill {
  font-size: 0.7rem;
  padding: 0.3rem 0.75rem;
  border-radius: 100px;
  border: 1px solid rgba(0,212,255,0.25);
  color: rgba(0,212,255,0.8);
  background: rgba(0,212,255,0.06);
  letter-spacing: 0.06em;
}

/* ─── Right panel (form) ────────────────────────────── */
.panel-form {
  flex: 1;
  background: var(--card-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 2.8rem;
  border-left: 1px solid var(--border-glow);
}

/* ─── Language toggle ───────────────────────────────── */
.lang-toggle {
  display: flex;
  align-self: flex-end;
  gap: 0.25rem;
  margin-bottom: 2rem;
}

.lang-btn {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.1);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: var(--transition);
}

.lang-btn.active,
.lang-btn:hover {
  background: rgba(0,212,255,0.12);
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── Form header ───────────────────────────────────── */
.form-header { margin-bottom: 2rem; }

.form-header h2 {
  font-size: 1.55rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 0.4rem;
}

.form-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ─── Form fields ───────────────────────────────────── */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin-bottom: 1.6rem;
}

.field-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.4rem;
  display: block;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  padding: 0 0.85rem 0 1rem;
  border-right: 1px solid var(--input-border);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  gap: 0.35rem;
  user-select: none;
  pointer-events: none;
}

.input-icon {
  position: absolute;
  right: 1rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: color var(--transition);
}

.input-icon:hover { color: var(--accent); }
.input-icon:focus { outline: none; }

input[type="text"],
input[type="tel"],
input[type="password"] {
  width: 100%;
  height: 52px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  padding: 0 3rem 0 1rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

input[type="tel"] { padding-left: 5.5rem; }

input:focus {
  border-color: var(--accent);
  background: rgba(0, 212, 255, 0.04);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

input::placeholder { color: rgba(107, 140, 170, 0.6); }

/* ─── Error state ───────────────────────────────────── */
.field-error {
  font-size: 0.72rem;
  color: var(--error);
  margin-top: 0.3rem;
  display: none;
}
.field-error.visible { display: block; }
input.has-error { border-color: var(--error) !important; box-shadow: 0 0 0 3px rgba(255,77,109,0.12) !important; }

/* ─── Extras row ────────────────────────────────────── */
.extras-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.6rem;
}

.remember-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.remember-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.remember-check span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.forgot-link {
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  opacity: 0.8;
  transition: opacity var(--transition);
}
.forgot-link:hover { opacity: 1; text-decoration: underline; }

/* ─── Submit button ─────────────────────────────────── */
.btn-login {
  width: 100%;
  height: 52px;
  background: linear-gradient(135deg, #0088bb 0%, #00d4ff 50%, #7c3aed 100%);
  background-size: 200% auto;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-position 0.4s ease, transform 0.15s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn-login:hover {
  background-position: right center;
  box-shadow: 0 6px 30px rgba(0, 212, 255, 0.35);
  transform: translateY(-1px);
}

.btn-login:active { transform: translateY(1px); }

.btn-login .btn-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

@keyframes spin { to { transform: rotate(360deg); } }
.btn-login.loading .btn-text  { display: none; }
.btn-login.loading .btn-spinner { display: block; }

/* ─── Divider ────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.4rem 0;
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.07);
}
.divider span {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ─── Register link ─────────────────────────────────── */
.register-row {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.register-row a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  margin-left: 0.3rem;
  transition: opacity var(--transition);
}
.register-row a:hover { opacity: 0.75; text-decoration: underline; }

/* ─── Django messages ───────────────────────────────── */
.msg-box {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.82rem;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.msg-box.error   { background: rgba(255,77,109,0.12); border: 1px solid rgba(255,77,109,0.3); color: #ff7090; }
.msg-box.success { background: rgba(0,229,160,0.1);  border: 1px solid rgba(0,229,160,0.3);  color: var(--success); }

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 700px) {
  .panel-brand { display: none; }

  .auth-shell {
    max-width: 440px;
    min-height: unset;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  }

  .panel-form {
    padding: 2.2rem 1.6rem;
    border-left: none;
  }

  /* Show a compact brand header on mobile */
  .panel-form::before {
    content: '';
    display: block;
    /* brain inline SVG as background-image data URI handled below */
  }

  .mobile-brand {
    display: flex !important;
  }
}

.mobile-brand {
  display: none;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.8rem;
}

.mobile-brand .brand-title {
  font-size: 1.7rem;
  background: linear-gradient(135deg, #ffffff 30%, #00d4ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.mobile-brain {
  width: 72px;
  height: 72px;
  margin-bottom: 0.6rem;
  filter: drop-shadow(0 0 14px rgba(0,212,255,0.5));
  animation: brainPulse 4s ease-in-out infinite;
}
