/*
 * Hurbad sign-in theme for NetBird's embedded login (Dex).
 * Caddy injects this stylesheet into the login pages (platform/Caddyfile, "hurbad_login_theme").
 * NetBird's own HTML is untouched: every error, the MFA QR code and the form posts are still Dex's.
 * Layout: brand panel with the dotted map on the left, the form on the right; one column on phones.
 * Selectors are NetBird v0.83.1's class names (idp/dex/web/templates). Re-check after upgrades.
 */
:root {
  --hb-night: #060b17;
  --hb-s1: #0b1222;
  --hb-s2: #0f182c;
  --hb-hair: #172238;
  --hb-hair2: #24324f;
  --hb-ink: #eef2f8;
  --hb-ink2: #c3cddc;
  --hb-ink3: #8693a8;
  --hb-blue: #3b82d6;
  --hb-blue-hi: #5b9ae2;
  --hb-bad: #ec6a6f;
  color-scheme: dark;
}

html,
body {
  background: var(--hb-night) !important;
  color: var(--hb-ink) !important;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif !important;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(400px, 1fr);
}

/* Brand panel: the map, dimmed toward the edges. */
body::before {
  content: "";
  grid-column: 1;
  grid-row: 1;
  min-height: 100vh;
  border-right: 1px solid var(--hb-hair);
  background:
    linear-gradient(0deg, var(--hb-night) 0%, rgba(6, 11, 23, 0) 38%),
    linear-gradient(90deg, rgba(6, 11, 23, 0) 70%, var(--hb-night) 100%),
    url("/hurbad-login/map.svg") 46% 40% / cover no-repeat,
    var(--hb-night);
}

/* Brand statement, bottom-left of the panel. */
body::after {
  content: "Secure access for your whole organisation.";
  grid-column: 1;
  grid-row: 1;
  align-self: end;
  justify-self: start;
  max-width: 17ch;
  margin: 0 0 64px 64px;
  font-size: clamp(30px, 3.1vw, 44px);
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.035em;
  color: var(--hb-ink);
}

.nb-container {
  grid-column: 2;
  grid-row: 1;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: flex-start !important;
  min-height: 100vh;
  max-width: none !important;
  margin: 0 !important;
  padding: 48px clamp(28px, 6vw, 96px) !important;
  box-sizing: border-box;
}

/* Hurbad mark + word instead of the NetBird logo. */
.nb-logo {
  display: flex !important;
  align-items: center;
  gap: 12px;
  margin: 0 0 44px !important;
  height: 32px;
}
.nb-logo > svg {
  display: none !important;
}
.nb-logo::before {
  content: "";
  width: 30px;
  height: 30px;
  background: url("/hurbad-login/mark.svg") center / contain no-repeat;
}
.nb-logo::after {
  content: "Hurbad";
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--hb-ink);
}

.nb-card {
  width: 100%;
  max-width: 380px !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  text-align: left !important;
}

.nb-heading {
  margin: 0 0 6px !important;
  font-size: 30px !important;
  line-height: 1.1 !important;
  font-weight: 600 !important;
  letter-spacing: -0.03em !important;
  color: var(--hb-ink) !important;
  text-align: left !important;
}

.nb-subheading {
  margin: 0 0 28px !important;
  font-size: 15px !important;
  color: var(--hb-ink3) !important;
  text-align: left !important;
}

.nb-form-group {
  margin-bottom: 16px !important;
}

.nb-label {
  display: block;
  margin-bottom: 7px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: var(--hb-ink) !important;
}

.nb-input {
  width: 100% !important;
  height: 44px !important;
  box-sizing: border-box;
  padding: 0 14px !important;
  border-radius: 10px !important;
  border: 1px solid var(--hb-hair2) !important;
  background: var(--hb-s1) !important;
  color: var(--hb-ink) !important;
  font-size: 15px !important;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.nb-input:hover {
  border-color: #33456a !important;
}
.nb-input:focus {
  outline: none !important;
  border-color: var(--hb-blue) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 214, 0.25) !important;
}
.nb-input::placeholder {
  color: #5d6a82 !important;
}

/* The six-digit code reads like a code. */
#totp.nb-input {
  height: 52px !important;
  font-size: 24px !important;
  letter-spacing: 0.45em !important;
  text-align: center !important;
  font-variant-numeric: tabular-nums;
}

.nb-btn {
  width: 100% !important;
  height: 44px !important;
  margin-top: 8px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: var(--hb-blue) !important;
  color: #fff !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16) !important;
  cursor: pointer;
  transition: background-color 0.15s;
}
.nb-btn:hover {
  background: var(--hb-blue-hi) !important;
}
.nb-btn:focus-visible {
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 214, 0.35) !important;
}

/* Sign in with an external identity provider (Google, Microsoft, ...). */
.nb-btn-connector {
  height: 44px !important;
  border-radius: 10px !important;
  border: 1px solid var(--hb-hair2) !important;
  background: var(--hb-s1) !important;
  color: var(--hb-ink) !important;
}
.nb-btn-connector:hover {
  background: var(--hb-s2) !important;
  border-color: #33456a !important;
}

.nb-divider {
  color: var(--hb-ink3) !important;
}

.nb-error {
  margin-bottom: 18px !important;
  padding: 11px 14px !important;
  border-radius: 10px !important;
  border: 1px solid rgba(236, 106, 111, 0.35) !important;
  background: rgba(236, 106, 111, 0.1) !important;
  color: #f6c3c5 !important;
  font-size: 14px !important;
}

.nb-link,
.nb-back-link {
  color: var(--hb-blue-hi) !important;
}

/* MFA enrolment: the QR code sits on a white tile so phone cameras read it reliably. */
.nb-card img[alt="QR code"] {
  padding: 12px;
  border-radius: 14px;
  background: #fff;
}

/* Phones and narrow windows: map as a short band on top, form below. */
@media (max-width: 900px) {
  body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr;
  }
  body::before {
    min-height: 170px;
    border-right: 0;
    border-bottom: 1px solid var(--hb-hair);
    background:
      linear-gradient(0deg, var(--hb-night) 0%, rgba(6, 11, 23, 0) 60%),
      url("/hurbad-login/map.svg") 50% 34% / 160% auto no-repeat,
      var(--hb-night);
  }
  body::after {
    display: none;
  }
  .nb-container {
    grid-column: 1;
    grid-row: 2;
    min-height: 0;
    justify-content: flex-start !important;
    padding: 28px 20px 40px !important;
  }
  .nb-logo {
    margin-bottom: 28px !important;
  }
  .nb-card {
    max-width: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nb-input,
  .nb-btn {
    transition: none;
  }
}
