/* ============================================================
 * X4fleet — Login Workflow
 * Sits on top of design-system/colors_and_type.css
 * ============================================================ */

/* Re-declare brand font with the right relative path */
@font-face {
  font-family: "Montserrat";
  src: url("design-system/fonts/Montserrat-Variable.ttf") format("truetype-variations"),
       url("design-system/fonts/Montserrat-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("design-system/fonts/Montserrat-Italic-Variable.ttf") format("truetype-variations"),
       url("design-system/fonts/Montserrat-Italic-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "DXIcons";
  src: local("DevExtreme Generic Icons"),
       local("devextreme_generic_icons"),
       url("design-system/fonts/dxicons.woff2") format("woff2"),
       url("design-system/fonts/dxicons.woff") format("woff"),
       url("design-system/fonts/dxicons.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; overscroll-behavior: none; }
body {
  font-family: var(--xp-font-sans);
  color: var(--xp-text);
  background: var(--xp-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
#root { height: 100%; }

/* ============================================================
 * Shell — split layout
 * ============================================================ */
.shell {
  display: grid;
  grid-template-columns: 1fr minmax(440px, 520px);
  height: 100vh;
  min-height: 640px;
  background: var(--xp-bg);
}
.shell.centered {
  grid-template-columns: 1fr;
}

/* ============================================================
 * Hero pane (left)
 * ============================================================ */
.hero {
  position: relative;
  overflow: hidden;
  background: #1a1a1a; /* fallback carousel base */
  isolation: isolate;
}
.shell.centered .hero {
  position: fixed;
  inset: 0;
  z-index: 0;
}
.shell.centered .hero::after {
  /* darker overlay for centered-card mode */
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(26,26,26,0.55), rgba(26,26,26,0.78));
  z-index: 2;
}

.hero-slide {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1.8s ease;
  z-index: 0;
}
.hero-slide.active { opacity: 1; }

/* Tinted overlay so white type sits cleanly */
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(135deg, rgba(26,26,26,0.55) 0%, rgba(26,26,26,0.15) 50%, rgba(26,26,26,0.25) 100%),
    linear-gradient(180deg, rgba(26,26,26,0.10), rgba(26,26,26,0.55));
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 3;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 40px 56px;
  color: #fff;
}
.hero-top {
  display: flex;
  align-items: center;
  gap: 12px;
}
.hero-top .xp-logo { height: 28px; opacity: 0.95; }
.hero-top .by {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.65);
  border-left: 1px solid rgba(255,255,255,0.25);
  padding-left: 12px;
}

.hero-body { margin-top: auto; max-width: 480px; }
.hero-eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--xp-orange-500);
  margin-bottom: 14px;
}
.hero-title {
  font-size: 44px;
  font-weight: 200;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0 0 18px 0;
  color: #fff;
}
.hero-sub {
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
  color: rgba(255,255,255,0.78);
  margin: 0;
  max-width: 420px;
}

.hero-foot {
  margin-top: 24px;
  margin-bottom: 36px;
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 11px;
  color: rgba(255,255,255,0.55);
}
.hero-foot .dot {
  width: 4px; height: 4px; border-radius: 999px;
  background: rgba(255,255,255,0.3);
}

.hero-dots {
  position: absolute;
  z-index: 4;
  left: 56px;
  bottom: 40px;
  display: flex;
  gap: 8px;
}
.hero-dots .d {
  width: 22px; height: 3px; border-radius: 999px;
  background: rgba(255,255,255,0.25);
  transition: background 0.3s ease, width 0.3s ease;
  cursor: pointer;
}
.hero-dots .d.on { background: var(--xp-orange-500); width: 36px; }

.hero-status {
  position: absolute;
  z-index: 4;
  right: 40px;
  bottom: 40px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.04em;
}
.hero-status .svc {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.hero-status .status-title {
  color: rgba(255,255,255,0.88);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.hero-status .pulse {
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--xp-success-500);
  box-shadow: 0 0 0 0 rgba(43,173,48,0.6);
  animation: pulse 2.2s infinite;
}
/* Stagger each service's pulse so the cluster feels alive
   (nth-of-type counts only the <span> services, not the <div> title) */
.hero-status .svc:nth-of-type(2) .pulse { animation-delay: 0.4s; }
.hero-status .svc:nth-of-type(3) .pulse { animation-delay: 0.8s; }
.hero-status .svc:nth-of-type(4) .pulse { animation-delay: 1.2s; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(43,173,48,0.55); }
  70% { box-shadow: 0 0 0 8px rgba(43,173,48,0); }
  100% { box-shadow: 0 0 0 0 rgba(43,173,48,0); }
}

/* ============================================================
 * Form pane (right)
 * ============================================================ */
.form-pane {
  position: relative;
  background: var(--xp-bg);
  border-left: 1px solid var(--xp-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.shell.centered .form-pane {
  position: relative;
  z-index: 5;
  margin: auto;
  background: var(--xp-bg);
  border: 1px solid var(--xp-border);
  border-radius: var(--xp-radius);
  box-shadow: var(--xp-elev-3);
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
}

.form-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 48px 0;
}
.shell.centered .form-top { padding: 24px 32px 0; }
.form-top .brand img { height: 40px; display: block; }
.form-top .help-link {
  font-size: 12px;
  color: var(--xp-text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--xp-radius);
}
.form-top .help-link:hover { background: rgba(0,0,0,0.04); color: var(--xp-text); }
.form-top .help-link .ico {
  font-family: var(--xp-font-icon);
  font-size: 13px;
  color: var(--xp-text-muted);
}

.form-body {
  flex: 1;
  padding: 32px 48px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.shell.centered .form-body { padding: 24px 32px; flex: 0 0 auto; }

.form-card {
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
}

.eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--xp-orange-500);
  margin-bottom: 12px;
}
.heading {
  font-size: 32px;
  font-weight: 200;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0 0 10px 0;
  color: var(--xp-text);
}
.subheading {
  font-size: 14px;
  color: var(--xp-text-muted);
  line-height: 1.5;
  margin: 0 0 28px 0;
  text-wrap: pretty;
}

/* ============================================================
 * Inputs (Xplanis style — orange-underline focus)
 * ============================================================ */
.field { margin-bottom: 18px; }
.field-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  font-weight: 500;
  color: var(--xp-text);
  margin-bottom: 6px;
}
.field-label .hint {
  font-size: 11px;
  color: var(--xp-text-muted);
  font-weight: 400;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  height: 44px;
  background: var(--xp-bg);
  border: 1px solid var(--xp-border);
  border-radius: var(--xp-radius);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.input-wrap:hover { border-color: #c4c4c4; }
.input-wrap.error {
  border-color: var(--xp-danger-500);
  background: #fff8f8;
}

.input-wrap .lead-ico {
  font-family: var(--xp-font-icon);
  color: var(--xp-text-muted);
  font-size: 15px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  height: 100%;
}
.input-wrap input {
  all: unset;
  flex: 1;
  height: 100%;
  font-family: var(--xp-font-sans);
  font-size: 14px;
  color: var(--xp-text);
  padding-right: 12px;
  min-width: 0;
}
.input-wrap input::placeholder {
  color: var(--xp-text-muted);
  font-weight: 400;
}
.input-wrap input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--xp-bg) inset;
  -webkit-text-fill-color: var(--xp-text);
}

.input-wrap .trail-btn {
  all: unset;
  height: 100%;
  padding: 0 12px;
  cursor: pointer;
  color: var(--xp-text-muted);
  font-family: var(--xp-font-icon);
  font-size: 15px;
  display: inline-flex;
  align-items: center;
}
.input-wrap .trail-btn:hover { color: var(--xp-text); }

.input-feedback {
  font-size: 11px;
  color: var(--xp-danger-500);
  margin-top: 6px;
  min-height: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.input-feedback .ico {
  font-family: var(--xp-font-icon);
  font-size: 12px;
}

/* ============================================================
 * Buttons
 * ============================================================ */
.btn {
  all: unset;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  border-radius: var(--xp-radius);
  font-family: var(--xp-font-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.05s;
  user-select: none;
}
.btn:active { transform: translateY(0.5px); }
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--xp-orange-500);
}

.btn.primary {
  background: var(--xp-orange-500);
  color: var(--xp-fg-on-primary);
}
.btn.primary:hover { background: var(--xp-orange-700); }
.btn.primary:active { background: var(--xp-orange-950); }
.btn.primary[disabled],
.btn.primary.loading {
  background: var(--xp-orange-500);
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.secondary {
  background: var(--xp-bg);
  color: var(--xp-text);
  border-color: var(--xp-border);
}
.btn.secondary:hover { background: rgba(0,0,0,0.04); border-color: #c4c4c4; }
.btn.secondary:active { background: rgba(0,0,0,0.08); }

.btn.ghost {
  background: transparent;
  color: var(--xp-text);
}
.btn.ghost:hover { background: rgba(0,0,0,0.04); }

.btn.full { width: 100%; }

/* Horizontal pair: [secondary][primary], primary takes remaining width */
.btn-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.btn-row .btn { flex-shrink: 0; }
.btn-row .btn.flex { flex: 1 1 auto; }

/* Centered text-link sized like a button but not full-width */
.text-link-row {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}
.text-link {
  font-size: 13px;
  color: var(--xp-text-muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--xp-radius);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  text-decoration: none;
}
.text-link:hover { color: var(--xp-text); background: rgba(0,0,0,0.04); }
.text-link .ico { width: 14px; height: 14px; }

.btn .ico {
  font-family: var(--xp-font-icon);
  font-size: 15px;
}

/* spinner */
.btn .spin {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 999px;
  animation: spin 0.7s linear infinite;
}
.btn.secondary .spin {
  border: 2px solid rgba(0,0,0,0.15);
  border-top-color: var(--xp-text);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
 * Row utilities
 * ============================================================ */
.row { display: flex; align-items: center; justify-content: space-between; }
.row.tight { gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.muted { color: var(--xp-text-muted); font-size: 12px; }

/* Checkbox */
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--xp-text);
  user-select: none;
}
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box {
  width: 16px; height: 16px;
  border: 1px solid var(--xp-border);
  border-radius: var(--xp-radius-sm);
  background: var(--xp-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, border-color 0.12s ease;
  flex-shrink: 0;
}
.check:hover .box { border-color: #b0b0b0; }
.check input:checked + .box {
  background: var(--xp-orange-500);
  border-color: var(--xp-orange-500);
}
.check input:checked + .box::after {
  content: "";
  width: 8px; height: 4px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}

/* Inline link */
.link-inline {
  font-size: 12px;
  color: var(--xp-orange-500);
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
}
.link-inline:hover { text-decoration: underline; }

/* ============================================================
 * Divider with "or"
 * ============================================================ */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--xp-text-muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 18px 0;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--xp-border);
}

/* ============================================================
 * Status / banner
 * ============================================================ */
.banner {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  background: #fff8eb;
  border: 1px solid #f5deab;
  border-left: 3px solid var(--xp-orange-500);
  border-radius: var(--xp-radius);
  font-size: 12px;
  color: #6b4a04;
  margin-bottom: 18px;
  line-height: 1.5;
}
.banner.success {
  background: #ebf7ec;
  border-color: #b9dfba;
  border-left-color: var(--xp-success-500);
  color: #144f16;
}
.banner.danger {
  background: #fdecec;
  border-color: #f3b9b9;
  border-left-color: var(--xp-danger-500);
  color: var(--xp-danger-500);
}
.banner .ico {
  font-family: var(--xp-font-icon);
  font-size: 16px;
  flex-shrink: 0;
  line-height: 1.4;
}
.banner strong { font-weight: 700; }

/* ============================================================
 * Form footer (language + version)
 * ============================================================ */
.form-foot {
  padding: 18px 48px 24px 32px;
  border-top: 1px solid var(--xp-border);
  font-size: 11px;
  color: var(--xp-text-muted);
  white-space:nowrap;
}
.shell.centered .form-foot { padding: 14px 12px 18px; }
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--xp-bg-tab);
  border: 1px solid var(--xp-border);
  border-radius: var(--xp-radius);
  padding: 2px;
}
.lang-switch .l {
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--xp-text-muted);
  cursor: pointer;
  border-radius: 3px;
  letter-spacing: 0.04em;
}
.lang-switch .l:hover { color: var(--xp-text); }
.lang-switch .l.on {
  background: var(--xp-bg);
  color: var(--xp-text);
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
}

.foot-meta { display: inline-flex; align-items: center; gap: 10px; margin-left:10px; }
.foot-meta a {
  color: var(--xp-text-muted);
  text-decoration: none;
  cursor: pointer;
}
.foot-meta a:hover { color: var(--xp-text); text-decoration: underline; }
.foot-meta .sep {
  width: 1px; height: 10px; background: var(--xp-border);
}

/* ============================================================
 * Password strength
 * ============================================================ */
.pw-strength {
  margin-top: 8px;
}
.pw-bar {
  display: flex;
  gap: 4px;
  height: 4px;
  margin-bottom: 8px;
}
.pw-bar .seg {
  flex: 1;
  background: var(--xp-border);
  border-radius: 2px;
  transition: background 0.2s ease;
}
.pw-bar .seg.on-1 { background: var(--xp-danger-500); }
.pw-bar .seg.on-2 { background: var(--xp-warning-500); }
.pw-bar .seg.on-3 { background: var(--xp-orange-500); }
.pw-bar .seg.on-4 { background: var(--xp-success-500); }
.pw-rules {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  font-size: 11px;
  color: var(--xp-text-muted);
}
.pw-rules .r {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pw-rules .r .ico {
  font-family: var(--xp-font-icon);
  font-size: 11px;
  color: var(--xp-border);
  width: 12px;
  height: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pw-rules .r.ok {
  color: var(--xp-success-700);
}
.pw-rules .r.ok .ico {
  color: var(--xp-success-500);
}
.pw-meter-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--xp-text-muted);
  margin-bottom: 4px;
}
.pw-meter-label .lvl { font-weight: 600; color: var(--xp-text); }

/* ============================================================
 * SSO providers row
 * ============================================================ */
.sso-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.sso-row.cols-2 { grid-template-columns: 1fr 1fr; }
.btn.sso .lead {
  width: 18px; height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ============================================================
 * Screen transitions
 * ============================================================ */
.screen-anim {
  animation: screen-in 0.32s cubic-bezier(.4, 0, .2, 1);
}
@keyframes screen-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
 * Success / done states
 * ============================================================ */
.success-icon {
  width: 56px; height: 56px;
  border-radius: 999px;
  background: #ebf7ec;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  position: relative;
}
.success-icon .ico {
  font-family: var(--xp-font-icon);
  font-size: 26px;
  color: var(--xp-success-700);
}
.success-icon::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  border: 1px dashed #b9dfba;
}

.email-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--xp-bg-alt);
  border: 1px solid var(--xp-border);
  border-radius: var(--xp-radius);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--xp-text);
  margin-bottom: 18px;
}
.email-pill .ico {
  font-family: var(--xp-font-icon);
  color: var(--xp-orange-500);
  font-size: 14px;
}

/* ============================================================
 * Identifier chip — shows the chosen user on the password step
 * ============================================================ */
.ident-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 12px;
  background: var(--xp-bg-alt);
  border: 1px solid var(--xp-border);
  border-radius: var(--xp-radius);
  margin-bottom: 18px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.ident-chip:hover {
  border-color: #c4c4c4;
  background: var(--xp-bg);
}
.ident-chip .ident-icon {
  width: 24px; height: 24px;
  border-radius: 999px;
  background: var(--xp-orange-500);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
}
.ident-chip .ident-value {
  flex: 1;
  font-weight: 500;
  color: var(--xp-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ident-chip .ident-edit {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--xp-orange-500);
  flex-shrink: 0;
}
.ident-chip:hover .ident-edit { text-decoration: underline; }

/* ============================================================
 * Stepper (for change-password flow)
 * ============================================================ */
.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}
.stepper .step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--xp-text-muted);
  font-weight: 500;
}
.stepper .step .dot {
  width: 20px; height: 20px;
  border-radius: 999px;
  background: var(--xp-bg-alt);
  border: 1px solid var(--xp-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--xp-text-muted);
}
.stepper .step.done .dot {
  background: var(--xp-success-500);
  border-color: var(--xp-success-500);
  color: #fff;
  font-family: var(--xp-font-icon);
  font-size: 10px;
}
.stepper .step.active .dot {
  background: var(--xp-orange-500);
  border-color: var(--xp-orange-500);
  color: #fff;
}
.stepper .step.active { color: var(--xp-text); }
.stepper .step.done { color: var(--xp-text); }
.stepper .bar {
  flex: 1;
  height: 1px;
  background: var(--xp-border);
}
.stepper .bar.done { background: var(--xp-success-500); }

/* ============================================================
 * Mobile fallback
 * ============================================================ */
@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .hero { display: none; }
  .form-pane { border-left: 0; }
  .form-top { padding: 20px 24px 0; }
  .form-body { padding: 24px 24px 16px; }
  .form-foot { padding: 14px 24px 18px; }
}
