/* ============================
   Auth / Login Page Styles
   ============================ */

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

/* ── Default (fallback) token ── */
:root {
  --auth-primary:  #0e7490;
  --auth-dark:     #155e75;
  --auth-light:    #06b6d4;
  --auth-glow:     rgba(14, 116, 144, 0.28);
  --auth-bg-from:  #f0f9ff;
  --auth-bg-to:    #ecfeff;

  --card:          #ffffff;
  --text:          #0f172a;
  --text-muted:    #64748b;
  --border:        #e2e8f0;
  --error:         #dc2626;
  --radius:        16px;
}

/* ── Per-dashboard accent colours ──────────────────────────────────────── */
body.auth-reception   { --auth-primary:#0e7490; --auth-dark:#155e75; --auth-light:#06b6d4; --auth-glow:rgba(14,116,144,.28); --auth-bg-from:#f0f9ff; --auth-bg-to:#ecfeff; }
body.auth-doctor      { --auth-primary:#1d4ed8; --auth-dark:#1e3a8a; --auth-light:#3b82f6; --auth-glow:rgba(29,78,216,.26);  --auth-bg-from:#eff6ff; --auth-bg-to:#dbeafe; }
body.auth-spec        { --auth-primary:#7c3aed; --auth-dark:#5b21b6; --auth-light:#a78bfa; --auth-glow:rgba(124,58,237,.26); --auth-bg-from:#f5f3ff; --auth-bg-to:#ede9fe; }
body.auth-adjustments { --auth-primary:#d97706; --auth-dark:#92400e; --auth-light:#fbbf24; --auth-glow:rgba(217,119,6,.26);  --auth-bg-from:#fffbeb; --auth-bg-to:#fef3c7; }
body.auth-operations  { --auth-primary:#dc2626; --auth-dark:#991b1b; --auth-light:#f87171; --auth-glow:rgba(220,38,38,.24);  --auth-bg-from:#fff1f2; --auth-bg-to:#ffe4e6; }
body.auth-technical   { --auth-primary:#15803d; --auth-dark:#14532d; --auth-light:#4ade80; --auth-glow:rgba(21,128,61,.26);  --auth-bg-from:#f0fdf4; --auth-bg-to:#dcfce7; }
body.auth-admin       { --auth-primary:#334155; --auth-dark:#1e293b; --auth-light:#64748b; --auth-glow:rgba(51,65,85,.22);   --auth-bg-from:#f8fafc; --auth-bg-to:#f1f5f9; }

/* ── Base ── */
body {
  font-family: 'Tajawal', sans-serif;
  background: linear-gradient(135deg, var(--auth-bg-from) 0%, var(--auth-bg-to) 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  direction: rtl;
  transition: background 0.3s;
}

/* ── Decorative blobs ── */
.auth-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
  background-image:
    radial-gradient(circle at 20% 20%, var(--auth-light) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, var(--auth-primary) 0%, transparent 60%);
  filter: blur(60px);
}

/* ── Card ── */
.auth-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  padding: 16px;
}

.auth-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 4px 32px var(--auth-glow);
  padding: 40px 36px;
  border: 1px solid var(--border);
}

/* ── Brand ── */
.auth-brand {
  text-align: center;
  margin-bottom: 32px;
}

.auth-brand .logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  background: linear-gradient(135deg, var(--auth-primary), var(--auth-light));
  border-radius: 20px;
  font-size: 32px;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px var(--auth-glow);
}

.auth-brand h1 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--auth-dark);
  margin-bottom: 4px;
  line-height: 1.3;
}

.auth-brand p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ── Fields ── */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.95rem;
  color: var(--text);
  background: #f8fafc;
  transition: border-color 0.2s, box-shadow 0.2s;
  direction: ltr;
  text-align: right;
}

.form-group input:focus {
  outline: none;
  border-color: var(--auth-light);
  box-shadow: 0 0 0 3px var(--auth-glow);
  background: #fff;
}

.form-group input.is-invalid {
  border-color: var(--error);
}

.form-group input.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.10);
}

.field-error {
  font-size: 0.8rem;
  color: var(--error);
  margin-top: 6px;
}

.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid #fca5a5;
  border-radius: 10px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.6;
  animation: authAlertShake 0.35s ease;
}

.auth-alert--success {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
  animation: none;
}

.auth-alert__icon {
  flex-shrink: 0;
  line-height: 1.6;
}

@keyframes authAlertShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.password-field {
  position: relative;
}

.password-field input {
  padding-left: 46px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  left: 8px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--auth-primary);
  background: rgba(15, 23, 42, 0.05);
  outline: none;
}

.password-toggle svg {
  width: 20px;
  height: 20px;
}

.password-toggle .password-toggle__hide,
.password-toggle[aria-pressed="true"] .password-toggle__show {
  display: none;
}

.password-toggle[aria-pressed="true"] .password-toggle__hide {
  display: block;
}

/* ── Submit ── */
.btn-login {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--auth-primary), var(--auth-dark));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: 'Tajawal', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 16px var(--auth-glow);
  margin-top: 4px;
}

.btn-login:hover {
  opacity: 0.91;
  transform: translateY(-1px);
  box-shadow: 0 6px 22px var(--auth-glow);
}

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

.btn-login:disabled,
.btn-login[aria-busy="true"] {
  opacity: 0.7;
  cursor: wait;
  transform: none;
  pointer-events: none;
}

.btn-login:disabled:hover,
.btn-login[aria-busy="true"]:hover {
  opacity: 0.7;
  transform: none;
  box-shadow: 0 4px 16px var(--auth-glow);
}

/* ── Footer ── */
.auth-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 24px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.auth-footer .back-link {
  color: var(--auth-primary);
  text-decoration: none;
  font-weight: 600;
  transition: opacity 0.15s;
}

.auth-footer .back-link:hover { opacity: 0.75; }

/* ── Unified home login ── */
body.auth-home {
  --auth-primary: #1e40af;
  --auth-dark: #1e3a8a;
  --auth-light: #3b82f6;
  --auth-glow: rgba(30, 64, 175, 0.22);
  --auth-bg-from: #f8fafc;
  --auth-bg-to: #eff6ff;
}

.auth-card--home { max-width: 480px; margin: 0 auto; }

.auth-brand--home { margin-bottom: 24px; }

.auth-home-tagline {
  margin-top: 14px;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.auth-footer--home { margin-top: 18px; }

.org-brand-mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.org-brand-mark__logo {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #e2e8f0;
  padding: 8px;
}

.org-brand-mark--lg .org-brand-mark__logo {
  width: 140px;
  height: 140px;
}

.org-brand-mark--sm .org-brand-mark__logo {
  width: 48px;
  height: 48px;
  border-width: 2px;
  padding: 4px;
}

.org-brand-mark__placeholder {
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--auth-primary), var(--auth-light));
  color: #fff;
}

.org-brand-mark__line {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.org-brand-mark__name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--auth-dark);
  margin-top: 4px;
}
