/* Reset, typography and shared controls used by both the sign-in page and the console. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: var(--text-md);
  line-height: 1.6;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { line-height: 1.3; font-weight: 800; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.9em; }
bdi { unicode-bidi: isolate; }
[hidden] { display: none !important; }

:focus-visible { outline: none; box-shadow: var(--focus); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: 0 var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: #ffdc4d; border-color: #ffdc4d; }
.btn--danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn--danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--surface-hover); border-color: transparent; }
.btn--icon { width: var(--control-height); padding: 0; position: relative; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: 0.6; cursor: progress; }

/* Form controls */
.input, select, textarea, input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) {
  width: 100%;
  min-height: var(--control-height);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: var(--text-md);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
textarea { min-height: 88px; resize: vertical; line-height: 1.6; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--primary); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }
input[readonly] { background: var(--surface-2); color: var(--text-muted); }
/* Left-to-right values (usernames, emails, phones, links) still line up with their label in Arabic. */
[dir="rtl"] input[dir="ltr"], [dir="rtl"] textarea[dir="ltr"] { text-align: right; }

/* Theme and language switch shared by both pages */
.switch-group { display: inline-flex; align-items: center; gap: var(--space-1); }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Brand lockup: an SVG mark plus a live-text wordmark set in Cairo */
.brand { display: inline-flex; align-items: center; gap: var(--space-3); color: inherit; text-decoration: none; }
.brand__mark { width: 44px; height: 44px; flex: none; }
.brand__text { display: grid; line-height: 1.1; }
.brand__name { font-size: 1.125rem; font-weight: 800; letter-spacing: -0.01em; }
.brand__tagline { white-space: nowrap; font-size: 0.625rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-muted); margin-top: 3px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
