/* ==========================================================================
   Ehqaq auth screens — portal-auth design applied on top of the Metronic views.
   Loaded after style.bundle.css and scoped to .ehq-auth (the #kt_app_root div),
   so it only restyles; form markup, fields and scripts are unchanged.
   Themes: creditor (teal) / admin (green) / debtor (bronze).
   ========================================================================== */

.ehq-auth {
  --paper:  #FFFFFF;
  --field:  #EFF3F4;
  --ink:    #0C1F24;
  --ink-2:  #3A5459;
  --ink-3:  #4C6A70;
  --muted:  #7E959B;
  --line:   rgba(12, 31, 36, 0.14);
  --radius: 10px;

  --f-display: 'Readex Pro', 'Segoe UI', Tahoma, sans-serif;
  --f-body:    'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;

  --role: #176E77; --role-dark: #0F5259;
  --role-soft: rgba(33, 145, 156, .10); --role-line: rgba(33, 145, 156, .30);

  /* Metronic primary -> role colour, so btn-primary / link-primary / checks follow the theme */
  --kt-primary: var(--role);
  --kt-primary-active: var(--role-dark);
  --kt-primary-light: var(--role-soft);
  --kt-primary-inverse: #fff;
  --bs-primary: var(--role);
  --kt-input-bg: var(--field);
  --kt-input-color: var(--ink);

  min-height: 100vh; min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  -webkit-font-smoothing: antialiased;
}
.ehq-auth--admin {
  --role: #1C6B4F; --role-dark: #134E38;
  --role-soft: rgba(36, 138, 102, .10); --role-line: rgba(36, 138, 102, .30);
}
.ehq-auth--debtor {
  --role: #8A6D28; --role-dark: #65551E;
  --role-soft: rgba(138, 109, 40, .10); --role-line: rgba(138, 109, 40, .32);
}

body#kt_body { background: #fff; }
.ehq-auth ::selection { background: var(--role); color: #fff; }
.ehq-auth :where(a, button, input, select, textarea):focus-visible { outline: 2px solid var(--role); outline-offset: 3px; }

/* ----------------------------------------------------------- brand --- */

.ehq-brand { display: none; }
.ehq-mini  { display: none; }

@media (min-width: 992px) {
  .ehq-brand {
    display: flex; flex: 0 0 45%; max-width: 45%;
    /* stays in view while long pages (terms, registration) scroll */
    position: sticky; top: 0; align-self: flex-start; height: 100vh; height: 100dvh; overflow: hidden;
    background: var(--role); color: #fff;
  }
  /* Ehqaq circuit mark, cropped at the panel edge */
  .ehq-brand::before {
    content: ""; position: absolute; bottom: -110px; inset-inline-start: -80px;
    width: min(600px, 120%); height: 557px; pointer-events: none; opacity: .18;
    background: url("../images/brand-circuit.png") no-repeat bottom right / contain;
  }
  [dir="ltr"] .ehq-brand::before { background-position: bottom left; transform: scaleX(-1); }
}

.ehq-brand__in {
  position: relative; z-index: 1; width: 100%; min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 48px 48px 120px;
}
.ehq-brand__logo { line-height: 0; display: flex; justify-content: center; width: 100%; }
.ehq-brand__logo img { width: 360px; max-width: 100%; height: auto; filter: brightness(0) invert(1); }

.ehq-brand__col { width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; margin-top: 40px; }

.ehq-brand__client { display: flex; align-items: center; justify-content: center; gap: 16px; text-align: start; }
.ehq-brand__clientlogo {
  flex: none; width: 72px; height: 72px; border-radius: 18px; overflow: hidden;
  background: #fff; box-shadow: 0 8px 20px rgba(0, 0, 0, .22);
}
.ehq-brand__clientlogo img { width: 100%; height: 100%; object-fit: cover; }
.ehq-brand__clientname { font-size: 17px; font-weight: 700; line-height: 1.55; color: #fff; unicode-bidi: isolate; }
.ehq-brand__clientname span {
  display: block; margin-top: 2px; font-size: 12.5px; font-weight: 500; letter-spacing: .06em;
  text-transform: uppercase; color: rgba(255, 255, 255, .84); unicode-bidi: isolate;
}

.ehq-brand__hero {
  margin-top: 40px; padding-top: 24px; border-top: 1px solid rgba(255, 255, 255, .18);
  display: flex; flex-direction: column; align-items: center;
}
.ehq-brand__role {
  margin-bottom: 12px; padding: 4px 14px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px;
  font-size: 13px; font-weight: 600; color: #fff;
}
.ehq-brand__title {
  margin: 0; font-family: var(--f-display); font-size: clamp(36px, 3.4vw, 50px); font-weight: 700;
  line-height: 1.3; color: #fff; text-wrap: balance;
}
.ehq-brand__lead { margin: 12px auto 0; max-width: 32ch; font-size: 15px; line-height: 1.9; color: rgba(255, 255, 255, .92); }

.ehq-brand__foot {
  position: absolute; bottom: 28px; inset-inline: 48px;
  font-size: 12px; line-height: 1.8; color: rgba(255, 255, 255, .82); text-align: center;
}
.ehq-brand__foot p { margin: 0; }
.ehq-brand__foot a { color: #fff; font-weight: 600; unicode-bidi: isolate; }

/* Compact bar that replaces the panel on small screens */
@media (max-width: 991.98px) {
  .ehq-mini {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 12px 20px; background: var(--role); color: #fff;
  }
  .ehq-mini__brand { height: 30px; width: auto; filter: brightness(0) invert(1); }
  .ehq-mini__role { padding: 3px 10px; border: 1px solid rgba(255, 255, 255, .4); border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
  .ehq-mini__client { display: flex; align-items: center; gap: 10px; }
  .ehq-mini__client img { width: 38px; height: 38px; object-fit: cover; border-radius: 10px; }
  .ehq-mini__client span { font-size: 12px; line-height: 1.5; color: rgba(255, 255, 255, .92); max-width: 180px; }
}
@media (max-width: 420px) { .ehq-mini__client span { display: none; } }

/* ------------------------------------------------------ form pane --- */

.ehq-auth > .flex-column-fluid { min-height: 100vh; min-height: 100dvh; }
@media (min-width: 992px) {
  .ehq-auth > .flex-column-fluid > .w-lg-50 { flex: 1 1 55%; width: 55% !important; max-width: 55%; }
}
.ehq-auth > .flex-column-fluid > .flex-column { position: relative; background: var(--paper); }
@media (max-width: 991.98px) {
  .ehq-auth > .flex-column-fluid > .flex-column.p-10 { padding: 20px 20px 48px !important; }
  .ehq-auth .p-10 { padding: 12px !important; }
}

/* Legacy wrappers inside the pane carry Bootstrap row gutters — neutralise them */
.ehq-auth .auth-inner.row { margin: 0; }
.ehq-auth .auth-inner.row > * { padding-inline: 0; }

/* Language switch — portal-auth .auth__top / .lang-switch */
.ehq-auth .ehq-top { position: absolute; top: 24px; inset-inline-end: 24px; z-index: 5; }
.ehq-auth .lang-switch {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink-3); font-size: 13px; font-weight: 600; line-height: 1; text-decoration: none;
  transition: border-color .2s ease, color .2s ease, background .2s ease;
}
.ehq-auth .lang-switch:hover { border-color: var(--role); color: var(--role); background: var(--role-soft); }
.ehq-auth .lang-switch svg { opacity: .7; }
@media (max-width: 991.98px) {
  .ehq-auth .ehq-top { position: static; align-self: flex-start; margin-top: 4px; }
}

/* Typography */
.ehq-auth .flex-column-fluid > .flex-column :is(h1, h2, h3, .card-title) {
  font-family: var(--f-display); color: var(--ink); letter-spacing: 0;
}
.ehq-auth .flex-column-fluid > .flex-column h1,
.ehq-auth .flex-column-fluid > .flex-column .card-title { font-size: 30px; font-weight: 700; line-height: 1.35; }
.ehq-auth .text-dark, .ehq-auth .text-gray-900 { color: var(--ink) !important; }
.ehq-auth .text-gray-500, .ehq-auth .text-muted, .ehq-auth .card-text { color: var(--ink-2) !important; font-size: 14px; line-height: 1.8; }
.ehq-auth .text-gray-700 { color: var(--ink-3) !important; }
.ehq-auth .text-primary { color: var(--role) !important; }

/* Fields */
.ehq-auth .form-label { font-size: 13px; font-weight: 500; line-height: 1.5; color: var(--ink-2); margin-bottom: 8px; }
.ehq-auth .form-control,
.ehq-auth .form-select {
  min-height: 52px; padding: 12px 16px;
  background-color: var(--field) !important;
  border: 1.5px solid transparent; border-radius: var(--radius);
  box-shadow: none;
  color: var(--ink); font-family: inherit; font-size: 15px; font-weight: 400;
  transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.ehq-auth textarea.form-control { min-height: 104px; }
.ehq-auth .form-control::placeholder { color: #93A8AD; }
.ehq-auth .form-control:hover, .ehq-auth .form-select:hover { background-color: #E9F0F1 !important; }
.ehq-auth .form-control:focus, .ehq-auth .form-select:focus {
  background-color: #fff !important; border-color: var(--role); outline: none;
  box-shadow: 0 0 0 3px var(--role-soft);
}
.ehq-auth .form-select { background-position: left 16px center; }
[dir="ltr"] .ehq-auth .form-select { background-position: right 16px center; }

/* Show-password toggle, inside the field at its inline end.
   Login pages: <span.input-group-text> sits in .form-password-toggle next to the input.
   Register / reset pages: Metronic's password-meter span, whose icons carry an inline
   margin-right hack (up to 800px) in Arabic — cancelled here. */
.ehq-auth .form-password-toggle { position: relative; flex-wrap: nowrap; }
.ehq-auth .form-password-toggle > .form-control { border-radius: var(--radius) !important; padding-inline-end: 52px; }
.ehq-auth .form-password-toggle > .input-group-text,
.ehq-auth [data-kt-password-meter-control="visibility"] {
  position: absolute !important; top: 50% !important; right: auto !important; left: auto !important;
  inset-inline-end: 6px !important; transform: translateY(-50%) !important; margin: 0 !important; z-index: 5;
  width: 40px; height: 40px; min-height: 0; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; border-radius: 8px;
  color: var(--muted); cursor: pointer;
}
.ehq-auth [data-kt-password-meter-control="visibility"] i { margin: 0 !important; font-size: 18px !important; color: inherit; }
/* login pages bind the click to the <i>, so let it fill the whole button */
.ehq-auth .form-password-toggle > .input-group-text > i { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: 18px; color: inherit; }
.ehq-auth [data-kt-password-meter] .position-relative > .form-control { padding-inline-end: 52px; }
.ehq-auth .form-password-toggle > .input-group-text:hover,
.ehq-auth [data-kt-password-meter-control="visibility"]:hover { color: var(--role); background: var(--role-soft); }
/* the row that used to hold the login toggle now only carries its script */
.ehq-auth form .mb-1:has(> .d-flex > link[href*="bootstrap-icons"]) { margin: 0 !important; height: 0; overflow: hidden; }

/* Phone field (intl-tel-input) */
.ehq-auth .iti { width: 100%; }
.ehq-auth .iti input.form-control { max-width: 100%; } /* legacy inline width can exceed 100% */
.ehq-auth .iti__selected-flag { border-radius: var(--radius) 0 0 var(--radius); }

.ehq-auth .form-check-input { accent-color: var(--role); }
.ehq-auth .form-check-input:checked { background-color: var(--role); border-color: var(--role); }
.ehq-auth .form-check-label { color: var(--ink-2); font-size: 14px; line-height: 1.8; }

/* Spacing between field groups */
.ehq-auth form .mb-1 { margin-bottom: 20px !important; }

/* "Forgot password" sits on the start side, under the password */
.ehq-auth form .flex-stack:has(> div:empty + a.link-primary) { justify-content: flex-start; margin-bottom: 24px !important; }
.ehq-auth form .flex-stack:has(> div:empty + a.link-primary) > div:empty { display: none; }

/* "No account? Register" line aligns with the form's start edge */
.ehq-auth .text-center:has(> a.link-primary[href*="register"]) { text-align: start !important; font-size: 13px; }

/* Buttons & links */
.ehq-auth .btn.btn-primary {
  min-height: 54px; border: 1px solid var(--role); border-radius: var(--radius);
  background: var(--role) !important; color: #fff; /* !important: admin/debtor buttons carry an inline colour */
  font-family: var(--f-body); font-size: 16px; font-weight: 600;
  transition: filter .2s ease, transform .15s ease;
}
.ehq-auth .btn.btn-primary.btn-sm { min-height: 40px; font-size: 14px; }
.ehq-auth .btn.btn-primary:hover:not(.btn-active),
.ehq-auth .btn.btn-primary:focus:not(.btn-active) { background-color: var(--role) !important; border-color: var(--role) !important; filter: brightness(.92); }
.ehq-auth .btn.btn-primary:active { transform: translateY(1px); }

.ehq-auth .link-primary, .ehq-auth .btn-link { color: var(--role) !important; font-weight: 700; }
.ehq-auth .link-primary:hover, .ehq-auth .btn-link:hover { color: var(--role-dark) !important; }
.ehq-auth form .flex-stack > div:empty + a.link-primary { color: var(--ink-3) !important; font-weight: 400; font-size: 13px; }
.ehq-auth form .flex-stack > div:empty + a.link-primary:hover { color: var(--role) !important; }

/* Plain links inside the form pane (e.g. "back to login") */
.ehq-auth .flex-column-fluid > .flex-column a:not(.btn):not([class*="link-"]):not(.symbol a) { color: var(--role); }

/* Leftovers from an older template: a dead "scroll to top" button and a duplicate
   copyright footer (the brand panel already carries both support + copyright) */
.ehq-auth .scroll-top, .ehq-auth .footer.footer-static { display: none !important; }

/* Links between the login pages */
.ehq-auth .ehq-arrow { flex: none; vertical-align: -2px; }
/* the svg points "forward" for Arabic; mirror it for English, and for "back" in Arabic */
.ehq-auth:lang(en) .ehq-others .ehq-arrow,
.ehq-auth:not(:lang(en)) .ehq-back .ehq-arrow { transform: scaleX(-1); }

.ehq-auth .ehq-others { margin-top: 24px; }
.ehq-auth .ehq-others__debtor {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px;
  margin: 0; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 13px; line-height: 1.6; color: var(--ink-3);
}
.ehq-auth .ehq-others__debtor a {
  display: inline-flex; align-items: center; gap: 6px;
  color: #8A6D28 !important; font-weight: 700; text-decoration: none;   /* debtor theme colour hints where it goes */
}
.ehq-auth .ehq-others__debtor a:hover { color: #65551E !important; text-decoration: underline; text-underline-offset: 3px; }
.ehq-auth .ehq-others__staff {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 20px;
  font-size: 12px; color: var(--muted) !important; text-decoration: none;
}
.ehq-auth .ehq-others__staff:hover { color: var(--ink-2) !important; text-decoration: underline; text-underline-offset: 3px; }

.ehq-auth .ehq-back {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 16px;
  font-size: 13px; font-weight: 600; color: var(--ink-3) !important; text-decoration: none;
}
.ehq-auth .ehq-back:hover { color: var(--role) !important; }

/* Messages — portal-auth .auth__msg / --error / --ok (server + client-side checks) */
.ehq-auth .ehq-alerts:empty { display: none; }
.ehq-auth .ehq-alerts { margin-bottom: 20px; }
.ehq-auth .ehq-msg {
  margin-top: 12px; padding: 12px 16px; border-radius: 10px;
  font-size: 14px; line-height: 1.8; border-inline-start: 2px solid; text-align: start;
}
.ehq-auth .ehq-msg:first-child { margin-top: 0; }
.ehq-auth .ehq-msg--error { background: #FDF1F1; border-color: #A32C2C; color: #7E2323; }
.ehq-auth .ehq-msg--ok    { background: var(--role-soft); border-color: var(--role); color: var(--role); }
.ehq-auth .ehq-msg strong { font-weight: 700; }
.ehq-auth .ehq-msg ul { margin: 6px 0 0; padding-inline-start: 18px; list-style: disc; }

/* Field that failed a check (portal-auth: red border on white) */
.ehq-auth .form-control.is-invalid, .ehq-auth .form-select.is-invalid,
.ehq-auth .form-control.is-invalid:hover, .ehq-auth .form-control.is-invalid:focus {
  border-color: #A32C2C !important; background-color: #fff !important; background-image: none;
}
.ehq-auth .form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(163, 44, 44, .12); }
.ehq-auth input[type="checkbox"].is-invalid { outline: 2px solid #A32C2C; outline-offset: 2px; }

/* Legacy message classes */
.ehq-auth .alert, .ehq-auth .alert-success, .ehq-auth .alert-danger {
  margin: 16px 0; padding: 12px 16px; border: none; border-radius: var(--radius);
  border-inline-start: 2px solid; font-size: 14px; line-height: 1.8; text-align: start !important;
}
.ehq-auth .alert-success { background: var(--role-soft); border-color: var(--role); color: var(--role); }
.ehq-auth .alert-danger  { background: #FDF1F1; border-color: #A32C2C; color: #7E2323; }
.ehq-auth .text-danger { color: #A32C2C !important; }
.ehq-auth .text-success { color: var(--role) !important; }

@media (prefers-reduced-motion: reduce) {
  .ehq-auth *, .ehq-auth *::before, .ehq-auth *::after { transition-duration: .01ms !important; }
}
