/* ── Login page ─────────────────────────────────────────────── */

body.login-page {
  background: #0c0b14;
  color: #e8e6f0;
  min-height: 100dvh;
  height: auto;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Ambient background glow */
.login-backdrop {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 110% 65% at 50% -5%, rgba(74,63,168,0.22) 0%, transparent 65%),
    radial-gradient(ellipse 60% 40% at 80% 90%, rgba(201,123,90,0.07) 0%, transparent 55%);
  pointer-events: none;
  z-index: 0;
}

.login-outer {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  padding: 32px 16px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* ── Card ───────────────────────────────────────────────────── */
.login-card {
  width: 100%;
  background: rgba(18,16,28,0.82);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 28px;
  padding: 36px 28px 32px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04) inset,
    0 32px 64px rgba(0,0,0,0.5),
    0 0 80px rgba(74,63,168,0.08);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ── Brand ──────────────────────────────────────────────────── */
.login-brand {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.login-title-latin {
  display: block;
  font-size: 38px;
  font-weight: 200;
  letter-spacing: 0.18em;
  color: #f0eeff;
  line-height: 1;
}

.login-title-arabic {
  display: block;
  font-size: 15px;
  letter-spacing: 0.08em;
  color: rgba(160,154,224,0.55);
  font-weight: 300;
  line-height: 1;
  direction: rtl;
}

.login-tagline {
  font-size: 12px;
  color: rgba(255,255,255,0.28);
  letter-spacing: 0.07em;
  margin-top: 2px;
}

.login-welcome {
  font-size: 14px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.03em;
  font-style: italic;
}

/* ── Divider ────────────────────────────────────────────────── */
.login-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08) 30%, rgba(255,255,255,0.08) 70%, transparent);
  margin: -4px 0;
}

/* ── Role selector ──────────────────────────────────────────── */
.login-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.role-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, transform 0.1s;
  text-align: left;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.role-btn:hover {
  border-color: rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05);
}
.role-btn:active { transform: scale(0.985); }

/* Role avatars */
.role-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  flex-shrink: 0;
  transition: box-shadow 0.2s;
}
.role-avatar--chris {
  background: rgba(74,63,168,0.25);
  color: #a09ae0;
  border: 1px solid rgba(74,63,168,0.3);
}
.role-avatar--sumiya {
  background: rgba(201,123,90,0.2);
  color: #e8a07a;
  border: 1px solid rgba(201,123,90,0.25);
}
.role-avatar--monitor {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.4);
  border: 1px solid rgba(255,255,255,0.1);
}

.role-info { flex: 1; }
.role-name {
  display: block;
  font-size: 15px;
  font-weight: 400;
  color: rgba(255,255,255,0.65);
  transition: color 0.15s;
}

/* Check indicator */
.role-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.15);
  flex-shrink: 0;
  transition: all 0.18s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.role-check::after {
  content: "";
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
  transition: background 0.15s;
}

/* Selected: Christopher */
.role-btn[data-role="chris"].active {
  border-color: rgba(74,63,168,0.55);
  background: rgba(74,63,168,0.1);
}
.role-btn[data-role="chris"].active .role-name   { color: #c8c4f4; }
.role-btn[data-role="chris"].active .role-check  { border-color: #a09ae0; background: rgba(74,63,168,0.3); }
.role-btn[data-role="chris"].active .role-check::after { background: #a09ae0; }
.role-btn[data-role="chris"].active .role-avatar--chris {
  box-shadow: 0 0 14px rgba(74,63,168,0.45);
}

/* Selected: Soumiya */
.role-btn[data-role="sumiya"].active {
  border-color: rgba(201,123,90,0.5);
  background: rgba(201,123,90,0.08);
}
.role-btn[data-role="sumiya"].active .role-name  { color: #f0c4a8; }
.role-btn[data-role="sumiya"].active .role-check { border-color: #e8a07a; background: rgba(201,123,90,0.25); }
.role-btn[data-role="sumiya"].active .role-check::after { background: #e8a07a; }
.role-btn[data-role="sumiya"].active .role-avatar--sumiya {
  box-shadow: 0 0 14px rgba(201,123,90,0.35);
}

/* Selected: Monitor */
.role-btn[data-role="monitor"].active {
  border-color: rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.05);
}
.role-btn[data-role="monitor"].active .role-name  { color: rgba(255,255,255,0.75); }
.role-btn[data-role="monitor"].active .role-check { border-color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.12); }
.role-btn[data-role="monitor"].active .role-check::after { background: rgba(255,255,255,0.6); }

/* Nudge animation for missing role selection */
@keyframes nudge {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-5px); }
  60%      { transform: translateX(5px); }
  80%      { transform: translateX(-3px); }
}
.login-section.nudge { animation: nudge 0.4s ease; }

/* ── Locale selector ────────────────────────────────────────── */
.locale-row {
  display: flex;
  gap: 6px;
  justify-content: center;
}
.locale-btn {
  flex: 1;
  padding: 9px 4px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.07);
  background: transparent;
  color: rgba(255,255,255,0.35);
  font-size: 12px;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.locale-btn:hover {
  border-color: rgba(255,255,255,0.16);
  color: rgba(255,255,255,0.6);
}
.locale-btn.active {
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.07);
  color: #e8e6f0;
  font-weight: 500;
}

/* ── Passcode ───────────────────────────────────────────────── */
.passcode-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.passcode-label {
  font-size: 11px;
  letter-spacing: 0.07em;
  color: rgba(255,255,255,0.3);
  text-transform: lowercase;
}
.passcode-input {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  color: #f0eeff;
  font-size: 18px;
  letter-spacing: 0.12em;
  padding: 14px 16px;
  transition: border-color 0.18s, background 0.18s;
  -webkit-appearance: none;
  appearance: none;
}
.passcode-input::placeholder {
  color: rgba(255,255,255,0.2);
  letter-spacing: 0.04em;
  font-size: 14px;
}
.passcode-input:focus {
  outline: none;
  border-color: rgba(74,63,168,0.55);
  background: rgba(74,63,168,0.07);
}

/* ── Login button ───────────────────────────────────────────── */
.login-btn {
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #4a3fa8 0%, #6b5fd4 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: opacity 0.18s, transform 0.1s, background 0.25s;
  box-shadow: 0 4px 20px rgba(74,63,168,0.4);
  -webkit-tap-highlight-color: transparent;
}
.login-btn:hover { opacity: 0.92; }
.login-btn:active:not(:disabled) { transform: scale(0.985); }
.login-btn:disabled { opacity: 0.35; cursor: default; }
.login-btn.loading { opacity: 0.6; }

/* Role-tinted button */
.login-btn[data-role="sumiya"] {
  background: linear-gradient(135deg, #b06040 0%, #d4855a 100%);
  box-shadow: 0 4px 20px rgba(180,96,64,0.4);
}
.login-btn[data-role="monitor"] {
  background: linear-gradient(135deg, #2a2840 0%, #3c3860 100%);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.login-error {
  font-size: 13px;
  color: #e87a7a;
  text-align: center;
  padding: 2px 0;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Footer (outside card) ──────────────────────────────────── */
.login-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.api-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: rgba(255,255,255,0.3);
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  flex-shrink: 0;
  transition: background 0.4s, box-shadow 0.4s;
}
.status-dot.online {
  background: #5ecb8a;
  box-shadow: 0 0 7px rgba(94,203,138,0.6);
}
.status-dot.offline  { background: #e87a7a; }
.status-dot.connecting {
  background: rgba(255,200,100,0.7);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; }
  50%     { opacity: 0.4; }
}

.monitoring-note {
  font-size: 10px;
  color: rgba(255,255,255,0.18);
  letter-spacing: 0.05em;
  text-align: center;
  max-width: 260px;
  line-height: 1.5;
}

/* ── Mobile tweaks ──────────────────────────────────────────── */
@media (max-width: 400px) {
  .login-card { padding: 30px 20px 28px; border-radius: 22px; }
  .login-title-latin { font-size: 32px; }
}

/* ── RTL support ────────────────────────────────────────────── */
html[dir="rtl"] .role-btn { flex-direction: row-reverse; text-align: right; }
html[dir="rtl"] .locale-row { flex-direction: row-reverse; }
html[dir="rtl"] .login-card { direction: rtl; }
