/* ========================================================================
   EWA iOS Next Authentication v1
   Shared light/dark authentication experience for login, OTP and recovery.
   ======================================================================== */

:root {
  --auth-font: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  --auth-blue: #007aff;
  --auth-purple: #7756ff;
  --auth-green: #34c759;
  --auth-red: #ff3b30;
  --auth-radius: 20px;
  --auth-radius-sm: 11px;
}

html[data-theme="dark"] {
  --auth-bg: #08090d;
  --auth-surface: rgba(17,19,25,.92);
  --auth-surface-solid: #111319;
  --auth-surface-2: #171a22;
  --auth-control: #0d0f14;
  --auth-fill: rgba(255,255,255,.055);
  --auth-fill-strong: rgba(255,255,255,.095);
  --auth-border: rgba(255,255,255,.105);
  --auth-border-soft: rgba(255,255,255,.065);
  --auth-label: #f5f5f7;
  --auth-label-2: #c6c6cc;
  --auth-label-3: #9898a3;
  --auth-label-4: #6f707b;
  --auth-shadow: 0 30px 90px rgba(0,0,0,.38);
  --auth-orb-a: rgba(119,86,255,.25);
  --auth-orb-b: rgba(10,132,255,.18);
  --auth-blue: #0a84ff;
  --auth-purple: #8f7aff;
  --auth-green: #30d158;
  --auth-red: #ff453a;
}

html[data-theme="light"] {
  --auth-bg: #f2f2f7;
  --auth-surface: rgba(255,255,255,.84);
  --auth-surface-solid: #fff;
  --auth-surface-2: #f8f8fb;
  --auth-control: rgba(255,255,255,.96);
  --auth-fill: rgba(118,118,128,.10);
  --auth-fill-strong: rgba(118,118,128,.16);
  --auth-border: rgba(60,60,67,.18);
  --auth-border-soft: rgba(60,60,67,.10);
  --auth-label: #1c1c1e;
  --auth-label-2: #48484a;
  --auth-label-3: #6e6e73;
  --auth-label-4: #98989d;
  --auth-shadow: 0 28px 80px rgba(37,37,42,.13);
  --auth-orb-a: rgba(119,86,255,.16);
  --auth-orb-b: rgba(0,122,255,.13);
  --auth-blue: #007aff;
  --auth-purple: #7455e8;
  --auth-green: #248a3d;
  --auth-red: #d70015;
}

html {
  min-height: 100%;
  color-scheme: dark;
  background: var(--auth-bg);
}
html[data-theme="light"] { color-scheme: light; }

body.auth-body-bg,
body.ios-auth-body {
  min-height: 100vh;
  margin: 0 !important;
  color: var(--auth-label-2) !important;
  background:
    radial-gradient(55rem 36rem at -10% -10%, var(--auth-orb-a), transparent 60%),
    radial-gradient(48rem 32rem at 110% 0%, var(--auth-orb-b), transparent 62%),
    var(--auth-bg) !important;
  font-family: var(--auth-font) !important;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.auth-body-bg *,
body.ios-auth-body * { box-sizing: border-box; }

body.auth-body-bg a,
body.ios-auth-body a { color: var(--auth-blue); text-decoration: none; }
body.auth-body-bg a:hover,
body.ios-auth-body a:hover { color: color-mix(in srgb,var(--auth-blue) 80%,white); }

.ios-auth-theme-toggle {
  position: fixed;
  z-index: 1100;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--auth-border);
  border-radius: 12px;
  color: var(--auth-label-2);
  background: color-mix(in srgb,var(--auth-surface-solid) 84%,transparent);
  box-shadow: 0 10px 30px rgba(0,0,0,.12), inset 0 1px rgba(255,255,255,.04);
  backdrop-filter: blur(20px) saturate(140%);
  cursor: pointer;
}
.ios-auth-theme-toggle:hover { color: var(--auth-label); background: var(--auth-fill-strong); }
.ios-auth-theme-toggle i { font-size: 18px; }

/* ------------------------------------------------------------------------
   New primary login composition.
   ------------------------------------------------------------------------ */
.ios-auth-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 440px);
  gap: 12px;
}

.ios-auth-context,
.ios-auth-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--auth-border);
  border-radius: 24px;
  background: var(--auth-surface);
  box-shadow: var(--auth-shadow), inset 0 1px rgba(255,255,255,.04);
  backdrop-filter: blur(24px) saturate(140%);
}

.ios-auth-context {
  display: flex;
  min-height: 620px;
  padding: clamp(28px,4vw,54px);
  background:
    linear-gradient(135deg, color-mix(in srgb,var(--auth-blue) 12%,var(--auth-surface-solid)), var(--auth-surface) 48%, color-mix(in srgb,var(--auth-purple) 15%,var(--auth-surface-solid)));
}

.ios-auth-context::before,
.ios-auth-context::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.ios-auth-context::before {
  right: -120px;
  bottom: -170px;
  width: 430px;
  height: 430px;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.48), rgba(100,210,255,.24) 14%, rgba(119,86,255,.34) 42%, transparent 70%);
  opacity: .75;
}
.ios-auth-context::after {
  top: 22%;
  left: 48%;
  width: 220px;
  height: 220px;
  border: 1px solid color-mix(in srgb,var(--auth-purple) 26%,transparent);
  background: color-mix(in srgb,var(--auth-purple) 5%,transparent);
  filter: blur(.2px);
}

.ios-auth-context-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: min(100%, 660px);
  min-height: 100%;
  padding-bottom: 112px;
}

.ios-auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  color: var(--auth-label);
  font-size: 14px;
  font-weight: 720;
}
.ios-auth-brand img { display: block; width: auto; max-width: 150px; height: 38px; object-fit: contain; }

html[data-theme="dark"] .ios-auth-logo-light { display: none !important; }
html[data-theme="dark"] .ios-auth-logo-dark { display: block !important; }
html[data-theme="light"] .ios-auth-logo-light { display: block !important; }
html[data-theme="light"] .ios-auth-logo-dark { display: none !important; }

.ios-auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  min-height: 28px;
  margin-top: auto;
  padding: 5px 10px;
  border: 1px solid var(--auth-border);
  border-radius: 999px;
  color: var(--auth-label-2);
  background: var(--auth-fill);
  font-size: 10.5px;
  font-weight: 700;
}
.ios-auth-badge-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--auth-green); box-shadow: 0 0 14px color-mix(in srgb,var(--auth-green) 65%,transparent); }

.ios-auth-context h1 {
  max-width: 680px;
  margin: 18px 0 12px;
  color: var(--auth-label);
  font-size: clamp(38px,5vw,68px);
  font-weight: 780;
  line-height: .98;
  letter-spacing: -.055em;
}
.ios-auth-context-copy {
  max-width: 610px;
  margin: 0;
  color: var(--auth-label-3);
  font-size: 14px;
  line-height: 1.6;
}

.ios-auth-capabilities {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 8px;
  margin-top: 24px;
}
.ios-auth-capability {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--auth-border-soft);
  border-radius: 13px;
  background: var(--auth-fill);
}
.ios-auth-capability i { color: var(--auth-blue); font-size: 18px; }
.ios-auth-capability strong { display: block; margin-top: 7px; color: var(--auth-label); font-size: 11.5px; }
.ios-auth-capability span { display: block; margin-top: 2px; color: var(--auth-label-3); font-size: 10.5px; line-height: 1.35; }

.ios-auth-quote {
  position: absolute;
  right: clamp(24px,4vw,54px);
  bottom: clamp(24px,4vw,54px);
  max-width: 560px;
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--auth-border-soft);
  color: var(--auth-label-3);
  font-size: 11.5px;
  line-height: 1.5;
  text-align: right;
}
.ios-auth-quote strong { display: block; margin-top: 5px; color: var(--auth-label-2); font-size: 10.5px; }

.ios-auth-card {
  display: flex;
  align-items: center;
  padding: 24px;
  background: color-mix(in srgb,var(--auth-surface-solid) 94%,transparent);
}
.ios-auth-card-inner { width: 100%; max-width: 360px; margin: 0 auto; }
.ios-auth-card-brand { display: none; margin-bottom: 24px; }
.ios-auth-card-brand img { max-width: 140px; max-height: 44px; object-fit: contain; }
.ios-auth-eyebrow { margin: 0 0 6px; color: var(--auth-blue); font-size: 10px; font-weight: 760; letter-spacing: .09em; text-transform: uppercase; }
.ios-auth-card h2 { margin: 0; color: var(--auth-label); font-size: 25px; font-weight: 760; letter-spacing: -.04em; }
.ios-auth-card-copy { margin: 6px 0 0; color: var(--auth-label-3); font-size: 12px; }

.ios-auth-alert {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding: 8px 9px;
  border: 1px solid color-mix(in srgb,var(--auth-red) 32%,var(--auth-border));
  border-radius: 10px;
  color: var(--auth-red);
  background: color-mix(in srgb,var(--auth-red) 8%,transparent);
  font-size: 11px;
  line-height: 1.35;
}
.ios-auth-alert i { margin-top: 1px; font-size: 15px; }

.ios-auth-form { margin-top: 20px; }
.ios-auth-field { margin-bottom: 11px; }
.ios-auth-label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.ios-auth-label-row label,
.ios-auth-field > label { margin: 0 0 4px; color: var(--auth-label-2); font-size: 11px; font-weight: 650; }
.ios-auth-label-row label { margin: 0; }
.ios-auth-label-row a { color: var(--auth-label-3); font-size: 10.5px; }
.ios-auth-label-row a:hover { color: var(--auth-blue); }

.ios-auth-input-wrap { position: relative; }
.ios-auth-input-icon {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 11px;
  transform: translateY(-50%);
  color: var(--auth-label-4);
  font-size: 17px;
  pointer-events: none;
}
.ios-auth-input,
body.auth-body-bg .form-control,
body.auth-body-bg .form-select {
  width: 100%;
  min-height: 40px !important;
  padding: 7px 10px !important;
  border: 1px solid var(--auth-border) !important;
  border-radius: 10px !important;
  color: var(--auth-label) !important;
  background: var(--auth-control) !important;
  background-image: none !important;
  box-shadow: inset 0 1px rgba(255,255,255,.018) !important;
  font-family: var(--auth-font) !important;
  font-size: 12.5px !important;
  line-height: 1.2 !important;
  outline: 0 !important;
}
.ios-auth-input { padding-left: 36px !important; }
.ios-auth-input.has-action { padding-right: 42px !important; }
.ios-auth-input:focus,
body.auth-body-bg .form-control:focus,
body.auth-body-bg .form-select:focus {
  border-color: color-mix(in srgb,var(--auth-blue) 70%,var(--auth-border)) !important;
  box-shadow: 0 0 0 4px color-mix(in srgb,var(--auth-blue) 18%,transparent) !important;
}
.ios-auth-input::placeholder,
body.auth-body-bg .form-control::placeholder { color: var(--auth-label-4) !important; opacity: 1; }

.ios-auth-password-toggle {
  position: absolute;
  z-index: 3;
  top: 50%;
  right: 5px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: 8px;
  color: var(--auth-label-3);
  background: transparent;
  cursor: pointer;
}
.ios-auth-password-toggle:hover { color: var(--auth-label); background: var(--auth-fill); }

.ios-auth-submit,
body.auth-body-bg .btn-primary {
  width: 100%;
  min-height: 40px;
  border: 1px solid color-mix(in srgb,var(--auth-blue) 78%,white 10%) !important;
  border-radius: 10px !important;
  color: #fff !important;
  background: linear-gradient(135deg,var(--auth-blue),var(--auth-purple)) !important;
  box-shadow: 0 10px 28px color-mix(in srgb,var(--auth-blue) 22%,transparent) !important;
  font-family: var(--auth-font) !important;
  font-size: 12.5px;
  font-weight: 720;
  cursor: pointer;
}
.ios-auth-submit:hover,
body.auth-body-bg .btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }

.ios-auth-alt {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 10px;
}
.ios-auth-alt-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--auth-border);
  border-radius: 9px;
  color: var(--auth-label-2) !important;
  background: var(--auth-fill);
  font-size: 10.5px;
  font-weight: 650;
  text-align: center;
}
.ios-auth-alt-link:hover { color: var(--auth-label) !important; background: var(--auth-fill-strong); }

.ios-auth-security {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--auth-border-soft);
  color: var(--auth-label-4);
  font-size: 10px;
}
.ios-auth-security i { color: var(--auth-green); font-size: 14px; }
.ios-auth-footer { margin-top: 18px; color: var(--auth-label-4); font-size: 9.5px; line-height: 1.4; text-align: center; }
.ios-auth-footer a { color: var(--auth-label-3); }

/* ------------------------------------------------------------------------
   Compatibility styling for OTP, recovery and registration views that use
   the legacy Bootstrap authentication markup.
   ------------------------------------------------------------------------ */
body.auth-body-bg > div > .container-fluid { min-height: 100vh; padding: 14px !important; }
body.auth-body-bg > div > .container-fluid > .row {
  display: grid !important;
  grid-template-columns: minmax(0,1.25fr) minmax(360px,440px) !important;
  gap: 12px !important;
  min-height: calc(100vh - 28px);
  margin: 0 !important;
}
body.auth-body-bg > div > .container-fluid > .row > [class*="col-"] {
  width: auto !important;
  max-width: none !important;
  padding: 0 !important;
}
body.auth-body-bg .auth-full-bg,
body.auth-body-bg .auth-full-page-content {
  min-height: calc(100vh - 28px) !important;
  height: 100% !important;
  overflow: hidden;
  border: 1px solid var(--auth-border) !important;
  border-radius: 22px !important;
  color: var(--auth-label-2) !important;
  background: var(--auth-surface) !important;
  box-shadow: var(--auth-shadow) !important;
  backdrop-filter: blur(24px) saturate(140%);
}
body.auth-body-bg .auth-full-bg {
  background:
    linear-gradient(135deg, color-mix(in srgb,var(--auth-blue) 10%,var(--auth-surface-solid)), var(--auth-surface) 50%, color-mix(in srgb,var(--auth-purple) 13%,var(--auth-surface-solid))) !important;
}
body.auth-body-bg .auth-full-page-content { display: flex; align-items: center; padding: 24px !important; }
body.auth-body-bg .auth-full-page-content > .w-100,
body.auth-body-bg .auth-full-page-content .d-flex.flex-column.h-100 { width: 100%; min-height: 0 !important; height: auto !important; }
body.auth-body-bg .auth-full-page-content .my-auto { width: 100%; max-width: 350px; margin: auto !important; }
body.auth-body-bg .auth-logo img { max-height: 48px; max-width: 155px; object-fit: contain; }
body.auth-body-bg .auth-logo-dark,
body.auth-body-bg .auth-logo-light { display: block !important; }
body.auth-body-bg h1,
body.auth-body-bg h2,
body.auth-body-bg h3,
body.auth-body-bg h4,
body.auth-body-bg h5,
body.auth-body-bg h6 { color: var(--auth-label) !important; font-family: var(--auth-font) !important; }
body.auth-body-bg .text-muted { color: var(--auth-label-3) !important; }
body.auth-body-bg .text-primary { color: var(--auth-blue) !important; }
body.auth-body-bg .form-label { margin-bottom: 4px; color: var(--auth-label-2); font-size: 11px; font-weight: 650; }
body.auth-body-bg .btn-light,
body.auth-body-bg .input-group .btn { color: var(--auth-label-2) !important; border-color: var(--auth-border) !important; background: var(--auth-fill) !important; }
body.auth-body-bg .input-group > .form-control { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; }
body.auth-body-bg .input-group > .btn { min-width: 40px; border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important; }
body.auth-body-bg .bg-overlay { background: transparent !important; }
body.auth-body-bg .auth-review-carousel,
body.auth-body-bg .auth-review-carousel p { color: var(--auth-label-2) !important; }
body.auth-body-bg .owl-theme .owl-dots .owl-dot span { background: var(--auth-fill-strong) !important; }
body.auth-body-bg .owl-theme .owl-dots .owl-dot.active span { background: var(--auth-blue) !important; }
body.auth-body-bg .alert,
body.auth-body-bg .card,
body.auth-body-bg .modal-content {
  color: var(--auth-label-2) !important;
  border-color: var(--auth-border) !important;
  background: var(--auth-surface-solid) !important;
}

body.auth-body-bg input:-webkit-autofill,
body.auth-body-bg input:-webkit-autofill:hover,
body.auth-body-bg input:-webkit-autofill:focus,
body.ios-auth-body input:-webkit-autofill,
body.ios-auth-body input:-webkit-autofill:hover,
body.ios-auth-body input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--auth-label) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--auth-control) inset !important;
  caret-color: var(--auth-label) !important;
}

.swal2-popup {
  border: 1px solid var(--auth-border) !important;
  border-radius: 16px !important;
  color: var(--auth-label-2) !important;
  background: var(--auth-surface-solid) !important;
  box-shadow: var(--auth-shadow) !important;
  font-family: var(--auth-font) !important;
}
.swal2-title { color: var(--auth-label) !important; font-size: 18px !important; }
.swal2-confirm { border-radius: 9px !important; background: var(--auth-blue) !important; }

@media (max-width: 900px) {
  .ios-auth-shell { grid-template-columns: 1fr; width: min(620px,calc(100% - 20px)); margin: 10px auto; }
  .ios-auth-context { min-height: 240px; padding: 24px; }
  .ios-auth-context-inner { padding-bottom: 0; }
  .ios-auth-context h1 { max-width: 520px; margin-top: 16px; font-size: clamp(32px,8vw,48px); }
  .ios-auth-badge { margin-top: 38px; }
  .ios-auth-capabilities { display: none; }
  .ios-auth-quote { position: static; margin-top: 16px; }
  .ios-auth-card { min-height: 0; padding: 22px; }

  body.auth-body-bg > div > .container-fluid { padding: 8px !important; }
  body.auth-body-bg > div > .container-fluid > .row { grid-template-columns: 1fr !important; min-height: calc(100vh - 16px); }
  body.auth-body-bg .auth-full-bg { display: none !important; }
  body.auth-body-bg .auth-full-page-content { min-height: calc(100vh - 16px) !important; padding: 22px !important; }
}

@media (max-width: 520px) {
  .ios-auth-shell { width: calc(100% - 12px); margin: 6px auto; gap: 6px; }
  .ios-auth-context { display: none; }
  .ios-auth-card { min-height: calc(100vh - 12px); padding: 20px 16px; border-radius: 20px; }
  .ios-auth-card-brand { display: block; }
  .ios-auth-alt { grid-template-columns: 1fr; }
  .ios-auth-theme-toggle { top: 14px; right: 14px; width: 36px; height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  body.auth-body-bg *,
  body.ios-auth-body * { transition: none !important; animation-duration: .001ms !important; }
}

/* Long recovery/consent forms must remain scrollable on shorter displays. */
body.auth-body-bg .auth-full-bg { overflow: hidden !important; }
body.auth-body-bg .auth-full-page-content { height: auto !important; overflow: auto !important; }


/* iOS Next v10 viewport repair
   Preserve the original compact composition and 16px outer breathing room.
   Only the page scrollbar is removed on desktop; the card may scroll internally
   on unusually short viewports without stretching the overall layout. */
@media (min-width: 901px) {
  body.ios-auth-body {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }
  body.ios-auth-body .ios-auth-shell {
    height: calc(100vh - 32px);
    height: calc(100dvh - 32px);
    min-height: 0;
  }
  body.ios-auth-body .ios-auth-context,
  body.ios-auth-body .ios-auth-card {
    height: 100%;
    min-height: 0;
    margin-top: 8px;
    margin-bottom: 20px;
  }
  body.ios-auth-body .ios-auth-card {
    overflow-x: hidden;
    /* overflow-y: auto; */
    /* overscroll-behavior: contain; */
    /* scrollbar-width: thin; */
  }
}

/* iOS Next v11: remove only the outer top offset from the compact login shell. */
body.ios-auth-body .ios-auth-shell {
  margin-top: 0 !important;
}
@media (min-width: 901px) {
  body.ios-auth-body .ios-auth-shell {
    margin-bottom: 27px !important;
    height: calc(100vh - 16px);
    height: calc(100dvh - 16px);
  }
}
