* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --accent: #f97316;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f1f5f9;
  --field-bg: #f8fafc;
}

body {
  font-family: 'Segoe UI', 'Heebo', Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  max-width: 900px;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
}

/* Brand panel */
.auth-brand {
  background-image:
    linear-gradient(150deg, rgba(37, 99, 235, 0.55) 0%, rgba(29, 78, 216, 0.62) 100%),
    url('/static/files/images-general/login.jpg');
  background-size: cover;
  background-position: center;
  color: #fff;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
}
.auth-brand .logo {
  width: 64px;
  height: 64px;
  background: #fff;
  padding: 8px;
  border-radius: 14px;
  margin-bottom: 28px;
  display: block;
}
.auth-brand .logo svg { width: 100%; height: 100%; display: block; }
.auth-brand h2 {
  font-size: 1.7rem;
  line-height: 1.4;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}
.auth-brand p {
  font-size: 1rem;
  opacity: 0.9;
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

/* Form panel */
.auth-form {
  padding: 44px 40px;
  display: flex;
  flex-direction: column;
}
.auth-form h1 {
  font-size: 1.6rem;
  margin-bottom: 6px;
}
.auth-form .subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

/* SSO */
.sso-buttons { display: flex; flex-direction: column; gap: 10px; }
.sso-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--brand);
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-size: 0.97rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.sso-button:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.sso-button img { width: 20px; height: 20px; background: #fff; border-radius: 4px; padding: 2px; }
.sso-button.facebook { display: none !important; }

.notice {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.82rem;
  line-height: 1.5;
  margin: 16px 0;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  margin: 4px 0 18px;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}
input[type="email"], input[type="password"], input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--field-bg);
  font-size: 0.95rem;
  margin-bottom: 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  background: #fff;
}

/* RTL: email/password typed LTR but aligned to the start (right); text fields full RTL */
[dir="rtl"] input[type="email"],
[dir="rtl"] input[type="password"] {
  text-align: right;
  direction: ltr;
}
[dir="rtl"] input[type="text"] { text-align: right; }

/* Field hint (password requirements etc.) */
.field-hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin: -8px 0 16px;
}

/* Inline JS validation errors */
.field-error {
  color: #721c24;
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  padding: 8px;
  border-radius: 6px;
  margin: -8px 0 12px;
  font-size: 0.8rem;
}

/* Flash messages */
.auth-message {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
  margin-bottom: 16px;
  text-align: center;
}
.auth-message.success {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}
.auth-message.error {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ffcdd2;
}

/* Captcha wrapper */
.captcha-container {
  display: flex;
  justify-content: center;
  margin: 4px 0 18px;
}

/* Terms / secondary fine print */
.auth-fineprint {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 14px;
  text-align: center;
}
.auth-fineprint a { color: var(--brand); text-decoration: none; }
.auth-fineprint a:hover { text-decoration: underline; }

/* ── Single-column variant (profile completion, verification, etc.) ── */
.auth-card.single { grid-template-columns: 1fr; max-width: 560px; }

/* Slim brand strip used at the top of single-column cards */
.auth-topbar {
  background: linear-gradient(120deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  padding: 22px 32px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.auth-topbar .logo {
  width: 46px;
  height: 46px;
  background: #fff;
  padding: 6px;
  border-radius: 11px;
  flex-shrink: 0;
}
.auth-topbar .logo svg { width: 100%; height: 100%; display: block; }
.auth-topbar h1 { font-size: 1.4rem; margin: 0; }

/* Body padding for single-column content */
.auth-body { padding: 32px 36px 36px; }

/* Info banner (verification notice) */
.auth-banner {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 24px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.auth-banner svg { width: 22px; height: 22px; color: var(--accent); flex-shrink: 0; margin-top: 2px; }
.auth-banner h3 { font-size: 0.95rem; margin: 0 0 4px; color: var(--ink); }
.auth-banner p { font-size: 0.85rem; color: var(--muted); margin: 0; line-height: 1.5; }

/* Select */
select.form-select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--field-bg);
  font-size: 0.95rem;
  color: var(--ink);
  margin-bottom: 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
select.form-select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  background: #fff;
}

/* Chip-style multi-buttons (grade / gender) */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 20px;
}
.chip {
  background: #fff;
  border: 1px solid var(--line);
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--ink);
  user-select: none;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.chip:hover { border-color: var(--brand); background: var(--field-bg); }
.chip.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Field block label (reuses bold label look) */
.field-block { margin-bottom: 8px; }
.field-block > label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}

/* Checkbox row */
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 24px;
}
.checkbox-row input[type="checkbox"] { margin-top: 3px; flex-shrink: 0; }
.checkbox-row label { font-weight: 400; font-size: 0.88rem; color: var(--muted); margin: 0; }

/* Centered submit for utility forms */
.btn-center { display: flex; justify-content: center; }

/* Secondary text link (sign out / different account) */
.text-link {
  display: inline-block;
  margin-top: 18px;
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
}
.text-link:hover { color: var(--brand); }

.password-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.password-row label { margin-bottom: 0; }
.forgot-password-link {
  font-size: 0.82rem;
  color: var(--brand);
  text-decoration: none;
}
.forgot-password-link:hover { text-decoration: underline; }

button[type="submit"] {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 4px;
}
button[type="submit"]:hover { background: var(--brand-dark); }

.signinup-bottom-section {
  text-align: center;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.signinup-bottom-button {
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
}
.signinup-bottom-button:hover { color: var(--brand); }

/* Mobile */
@media (max-width: 720px) {
  body { padding: 0; background: #fff; }
  .auth-card {
    grid-template-columns: 1fr;
    max-width: 420px;
    box-shadow: none;
    border-radius: 0;
    min-height: 100vh;
  }
  .auth-brand {
    padding: 32px 28px 28px;
    text-align: center;
    align-items: center;
    justify-content: center;
    min-height: 160px;
  }
  .auth-brand img.logo, .auth-brand .logo { margin-bottom: 16px; }
  .auth-brand h2 { font-size: 1.35rem; }
  .auth-brand p { display: none; }
  .auth-form { padding: 28px 24px 40px; }
}