/* Taqat SSO — Arabic-first, RTL.
   Ported to the Bright Gaza / Taqat Work auth design system.
     --blue-300 #007bd1   primary brand (buttons, links, accent, focus)
     --black-300 #191919  primary text
     --gray-60  #87888c   muted/secondary text, placeholders
     --gray-80  #696a70   form labels
     --light-gray #d9d9d9 borders
   Light mode only. Split-screen auth layout (form left, brand panel right ≥ lg).
*/

:root {
  --white: #ffffff;
  --black-300: #191919;
  --black-50: #e8e8e8;

  --blue-300: #007bd1;   /* primary */
  --blue-400: #006fbc;   /* primary hover */
  --blue-600: #005c9d;
  --blue-50: #e6ebf4;

  --gray-60: #87888c;    /* muted text, placeholders */
  --gray-80: #696a70;    /* form labels */
  --light-gray: #d9d9d9; /* borders, dividers */
  --light-gray-2: #f7f7f7;

  --yellow-300: #ffb400;
  --yellow-400: #cc9000;
  --green: #47b64f;
  --green-2: #edf8ed;
  --red-700: #f5001f;

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

  /* Brand gradient (decorative — auth panel) */
  --brand-navy: #00378e;
  --brand-navy-deep: #00245a;
  --brand-green: #0bbb82;
  --brand-gold: #d4af37;

  --font-ar: "Tajawal", "Segoe UI", "Tahoma", "Noto Sans Arabic", sans-serif;
  --font-en: "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(--white);
  color: var(--black-300);
  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(--blue-300);
  text-decoration: none;
  transition: color .15s ease, opacity .15s ease;
}
a:hover { color: var(--blue-400); text-decoration: underline; }

/* ---- Default (centered) layout — landing / consent / error ---- */

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

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

/* ---- Auth layout — full-bleed image background, floating form card ---- */

.auth-layout {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;   /* centered until the brand text appears (>= lg) */
  padding: 40px;
  background: var(--brand-navy-deep);  /* fallback while images load */
}

/* Floating form card on top of the image */
.auth-form-card {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 460px;
  margin-block: auto;          /* vertical centering with no clipping when tall */
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-radius: 28px;
  box-shadow: 0 24px 60px rgba(10, 15, 26, .28);
  padding: 26px 34px;
}

.auth-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.auth-brandmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--black-300);
  font-weight: 700;
  font-size: 18px;
}
.auth-brandmark:hover { color: var(--black-300); text-decoration: none; }
.auth-brandmark img { height: 28px; width: auto; }
.auth-top-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--gray-80);
  font-size: 14px;
  font-weight: 600;
}
.auth-top-link:hover { color: var(--gray-80); opacity: .7; text-decoration: none; }

.auth-pane {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 0;
}
.auth-form-wrap {
  width: 100%;
  max-width: 380px;
}

.auth-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  font-size: 13px;
  color: var(--gray-60);
}
.auth-foot-links { display: inline-flex; align-items: center; gap: 18px; }
.auth-foot a { color: var(--gray-80); }

/* Page content inside the form card: borderless, left-aligned,
   in-form logo hidden (logo now lives in the top bar), tagline -> title */
.auth-form-card .card {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  max-width: none;
}
.auth-form-card .brand-stack {
  display: block;
  text-align: start;
  margin-bottom: 28px;
  gap: 0;
}
.auth-form-card .brand-stack img { display: none; }
.auth-form-card .brand-stack .tagline {
  color: var(--black-300);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: normal;
}

/* Crossfading background slideshow (layout_3 → layout_2 → layout_1) */
.auth-slideshow { position: absolute; inset: 0; z-index: 0; }
.auth-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  animation: authSlideFade 18s infinite;
}
.auth-slide:nth-child(1) { background-image: url("/static/img/layout_3.jpg"); animation-delay: 0s; }
.auth-slide:nth-child(2) { background-image: url("/static/img/layout_2.jpg"); animation-delay: 6s; }
.auth-slide:nth-child(3) { background-image: url("/static/img/layout_1.jpg"); animation-delay: 12s; }

@keyframes authSlideFade {
  0%   { opacity: 0; }
  5%   { opacity: 1; }
  30%  { opacity: 1; }
  38%  { opacity: 0; }
  100% { opacity: 0; }
}

/* Brand-color overlay (with opacity) above the photos, below the content */
.auth-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(150deg,
    rgba(0, 55, 142, .55) 0%,
    rgba(0, 36, 90, .58) 50%,
    rgba(11, 187, 130, .35) 100%);
}

/* Brand text + mark overlaid on the open area (end side), shown on lg */
.auth-brand-content {
  position: absolute;
  z-index: 2;
  inset-block: 0;
  inset-inline-start: 50%;
  inset-inline-end: 0;
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  padding: 64px;
  color: var(--white);
}
.auth-brand-content .brand-tagline {
  font-size: 15px;
  opacity: .92;
}
.auth-brand-content .brand-heading {
  margin: 0;
  font-size: 64px;
  font-weight: 700;
  line-height: 1.05;
  color: var(--white);
}
.auth-brand-content .brand-quote {
  margin: 0;
  max-width: 460px;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.7;
  color: var(--white);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .6s ease, transform .6s ease;
}
.auth-brand-content .brand-quote.is-in {
  opacity: .92;
  transform: translateY(0);
}
.brand-mark {
  position: absolute;
  z-index: 2;
  bottom: 36px;
  inset-inline-end: 44px;
  display: none;
}
.brand-mark img { height: 26px; width: auto; opacity: .92; }

@media (min-width: 992px) {
  .auth-layout { justify-content: flex-start; }
  .auth-brand-content { display: flex; }
  .brand-mark { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-slide { animation: none; }
  .auth-slide:nth-child(1) { opacity: 1; }
}

/* ---- Auth card / brand header ---- */

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

.card .brand-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 36px;
}
.card .brand-stack img { height: 45px; }
.card .brand-stack .tagline {
  color: var(--gray-60);
  font-size: 14px;
}

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

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

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

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

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

input::placeholder { color: var(--gray-60); }

/* 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(--blue-300);
  box-shadow: 0 0 0 3px rgba(0, 123, 209, .15);
}

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

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

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

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

.btn-block { width: 100%; }

.btn-outline {
  background: var(--white);
  border-color: var(--light-gray);
  color: var(--black-300);
}
.btn-outline:hover { background: var(--light-gray-2); color: var(--black-300); border-color: var(--gray-60); }

.btn-amber {
  background: var(--yellow-300);
  color: var(--black-300);
}
.btn-amber:hover { background: var(--yellow-400); color: var(--black-300); }

.btn-google {
  background: var(--white);
  color: var(--black-300);
  border: 1.5px solid var(--light-gray);
}
.btn-google:hover { background: var(--light-gray-2); color: var(--black-300); }
.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: #fdecec;
  color: #a30015;
  border-color: rgba(245, 0, 31, .25);
}
.alert-success {
  background: var(--green-2);
  color: #226b29;
  border-color: rgba(71, 182, 79, .35);
}
.alert-info {
  background: var(--blue-50);
  color: var(--blue-600);
  border-color: rgba(0, 123, 209, .25);
}

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

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

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

.text-center { text-align: center; }
.text-muted { color: var(--gray-60); }
.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(--light-gray-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  border: 1px solid var(--light-gray);
}

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

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

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

/* ---- Sessions page + platform launcher ---- */

.sessions-card {
  max-width: 620px;
  text-align: start;
}
.sessions-card .brand-stack { margin-bottom: 20px; }

.sessions-section { margin-top: 28px; }
.sessions-section h2 { font-size: 18px; margin-bottom: 4px; }

/* Platform grid */
.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.platform-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 12px;
  background: var(--white);
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-lg);
  color: var(--black-300);
  text-align: center;
  transition: box-shadow .15s ease, border-color .15s ease, transform .05s ease;
}
.platform-tile:hover {
  text-decoration: none;
  color: var(--black-300);
  border-color: var(--blue-300);
  box-shadow: var(--shadow-md);
}
.platform-tile:active { transform: translateY(1px); }
.platform-tile:focus-visible {
  outline: none;
  border-color: var(--blue-300);
  box-shadow: 0 0 0 3px rgba(0, 123, 209, .15);
}
.platform-logo,
.platform-monogram {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: contain;
}
.platform-monogram {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 24px;
}
.platform-name { font-size: 14px; font-weight: 600; }

/* Active sessions list */
.session-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}
.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--light-gray);
  border-radius: var(--radius);
  background: var(--white);
}
.session-device { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.session-meta { font-size: 13px; color: var(--gray-60); margin-top: 4px; }
.session-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--green-2);
  color: #226b29;
  font-size: 12px;
  font-weight: 600;
}
.session-revoke { min-height: 38px; padding: 8px 16px; font-size: 14px; flex-shrink: 0; }
.session-error { font-size: 13px; color: var(--red-700); margin-top: 6px; }

.sessions-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

@media (max-width: 540px) {
  .card { padding: 24px 20px; }
  h1 { font-size: 22px; }
  main.content { padding: 16px 12px; }
  .auth-layout { padding: 16px; }
  .auth-form-card { max-width: 100%; }
  .auth-form-card .brand-stack .tagline { font-size: 26px; }
  .platform-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
}
