/* Taqat SSO — Arabic-first, RTL. Cream / teal / amber / ink.
   Tokens ported from taqat-academy:
     --ink   #0a0f1a   text + dark surfaces
     --cream #f0f6fb   page background
     --teal  #1279be   primary brand (links, buttons, focus)
     --amber #f09600   highlights, CTAs on dark, NEVER text-on-cream (contrast fails AA)
*/

:root {
  --ink: #0a0f1a;
  --cream: #f0f6fb;
  --teal: #1279be;
  --teal-dark: #0e5f93;
  --teal-light: #d6ebf8;
  --amber: #f09600;
  --amber-dark: #c47700;
  --red: #e03a3a;
  --green: #1f9d55;
  --gray-100: #f5f6fa;
  --gray-200: #e6ebef;
  --gray-300: #ccd5db;
  --gray-500: #7a8794;
  --gray-700: #3d4651;

  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(10, 15, 26, .04), 0 1px 3px rgba(10, 15, 26, .06);
  --shadow-md: 0 4px 14px rgba(10, 15, 26, .08), 0 2px 4px rgba(10, 15, 26, .04);

  --font-ar: "Cairo", "Segoe UI", "Tahoma", "Noto Sans Arabic", sans-serif;
  --font-en: "Cairo", "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "SF Mono", "Menlo", "Consolas", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-ar);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body[dir="rtl"] { text-align: right; }

a {
  color: var(--teal);
  text-decoration: none;
  transition: color .15s ease;
}
a:hover { color: var(--teal-dark); text-decoration: underline; }

/* ---- Layout ---- */

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--ink);
  color: var(--cream);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--cream);
  font-weight: 600;
  font-size: 18px;
}

.topbar .brand img {
  height: 36px;
  width: auto;
}

.topbar a.brand:hover { text-decoration: none; }

.topbar .topbar-actions { display: flex; gap: 16px; align-items: center; }
.topbar .topbar-actions a { color: var(--cream); }
.topbar .topbar-actions a:hover { color: var(--amber); }

main.content {
  flex: 1;
  padding: 32px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

footer.foot {
  background: var(--ink);
  color: var(--cream);
  text-align: center;
  padding: 18px;
  font-size: 13px;
  opacity: .9;
}
footer.foot a { color: var(--amber); }

/* ---- Auth card ---- */

.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 32px;
  width: 100%;
  max-width: 480px;
}

.card .brand-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}
.card .brand-stack img { height: 56px; }
.card .brand-stack .tagline {
  color: var(--gray-500);
  font-size: 13px;
  letter-spacing: .02em;
}

h1, h2, h3 { margin: 0 0 12px; line-height: 1.3; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; color: var(--gray-700); }

p { margin: 0 0 12px; }
small { color: var(--gray-500); }

/* ---- Forms ---- */

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"] {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  font-size: 15px;
  font-family: var(--font-en);
  transition: border-color .15s ease, box-shadow .15s ease;
}

/* LTR for email / phone / password fields even when page is RTL */
input[type="email"],
input[type="password"],
input[type="tel"] {
  direction: ltr;
  text-align: left;
  unicode-bidi: plaintext;
}

input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(18, 121, 190, .15);
}

input[inputmode="numeric"] {
  font-size: 22px;
  letter-spacing: .3em;
  text-align: center;
  font-family: var(--font-mono);
  padding: 16px;
}

.field { margin-bottom: 16px; }
.field-hint { font-size: 12px; color: var(--gray-500); margin-top: 4px; }

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  background: var(--teal);
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, transform .05s ease;
  text-decoration: none;
  font-family: inherit;
}
.btn:hover { background: var(--teal-dark); color: white; text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-block { width: 100%; }

.btn-outline {
  background: white;
  border-color: var(--gray-300);
  color: var(--ink);
}
.btn-outline:hover { background: var(--gray-100); color: var(--ink); border-color: var(--gray-500); }

.btn-amber {
  background: var(--amber);
  color: var(--ink);
}
.btn-amber:hover { background: var(--amber-dark); color: white; }

.btn-google {
  background: white;
  color: var(--ink);
  border: 1.5px solid var(--gray-300);
}
.btn-google:hover { background: var(--gray-100); color: var(--ink); }
.btn-google::before {
  content: "";
  width: 18px; height: 18px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'><path fill='%23FFC107' d='M43.6 20.5H42V20H24v8h11.3c-1.6 4.7-6 8-11.3 8-6.6 0-12-5.4-12-12s5.4-12 12-12c3 0 5.8 1.1 7.9 3l5.7-5.7C34.5 5.4 29.5 3.5 24 3.5 12.7 3.5 3.5 12.7 3.5 24S12.7 44.5 24 44.5 44.5 35.3 44.5 24c0-1.2-.1-2.3-.3-3.5z'/><path fill='%23FF3D00' d='M6.3 14.7l6.6 4.8C14.7 16 19 13 24 13c3 0 5.8 1.1 7.9 3l5.7-5.7C34.5 6.9 29.5 5 24 5 16.3 5 9.7 9.3 6.3 14.7z'/><path fill='%234CAF50' d='M24 44.5c5.4 0 10.3-2.1 13.9-5.4l-6.4-5.4C29.5 35.3 27 36 24 36c-5.3 0-9.6-3.3-11.3-8l-6.6 5.1C9.5 39.5 16.2 44.5 24 44.5z'/><path fill='%231976D2' d='M43.6 20.5H42V20H24v8h11.3c-.8 2.2-2.2 4.1-4 5.6l6.4 5.4C39.6 36.3 44.5 30.7 44.5 24c0-1.2-.1-2.3-.3-3.5z'/></svg>") no-repeat center / contain;
  display: inline-block;
}

/* ---- Alerts ---- */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid transparent;
}
.alert-error {
  background: #fdecea;
  color: #8b1a1a;
  border-color: #f5b5b0;
}
.alert-success {
  background: #e8f5ee;
  color: #1f6334;
  border-color: #b6dcc1;
}
.alert-info {
  background: var(--teal-light);
  color: var(--teal-dark);
  border-color: rgba(18, 121, 190, .25);
}

/* ---- Divider ---- */

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--gray-500);
  font-size: 12px;
  margin: 20px 0;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--gray-200);
}
.divider::before { margin-left: 12px; }
.divider::after { margin-right: 12px; }

/* ---- Misc ---- */

.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }

.kbd {
  font-family: var(--font-mono);
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  border: 1px solid var(--gray-200);
}

/* ---- Consent screen ---- */

.consent-scope {
  background: var(--gray-100);
  padding: 10px 14px;
  border-radius: var(--radius);
  margin: 6px 0;
  font-size: 14px;
  border-right: 3px solid var(--teal);
}
body[dir="rtl"] .consent-scope { border-right: 3px solid var(--teal); border-left: 0; }
body[dir="ltr"] .consent-scope { border-left: 3px solid var(--teal); border-right: 0; }

.consent-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}
.consent-actions .btn { flex: 1; }

/* ---- Responsive ---- */

@media (max-width: 540px) {
  .card { padding: 24px 20px; }
  h1 { font-size: 22px; }
  main.content { padding: 16px 12px; }
}
