/* WebSpread OS brand layer for the FOSSBilling client area (login, dashboard, invoices, pay pages).
 *
 * Loaded by ONE line pasted into  Settings -> Theme -> huraga -> "Inject JavaScript":
 *     <link rel="stylesheet" href="/public/branding/wsos-theme.css?v=1">
 * (bump ?v= after editing this file so browsers fetch the new copy). It overrides Bootstrap 5.3's CSS variables instead of
 * patching the theme, so it survives FOSSBilling updates. Source of truth for the colours and fonts is the WSOS shell
 * (public/index.html :root) - src/vps-stack.test.ts fails if they drift apart.
 *
 * Typography matches the shell: Space Grotesk for titles and figures (--font-display), the system UI font for body
 * text (--font-body). The font files are the same ones the shell loads from Google Fonts, served from this server
 * instead so a payment page makes no third-party requests. Space Grotesk is (c) The Space Grotesk Project Authors,
 * SIL Open Font License 1.1 (https://openfontlicense.org), which permits self-hosting.
 */

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("fonts/SpaceGrotesk-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("fonts/SpaceGrotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root,
[data-bs-theme="light"] {
  --wsos-navy: #021533;
  --wsos-navy-2: #0b2a55;
  --wsos-blue: #2170ad;
  --wsos-blue-dark: #1a5a8c;
  --wsos-sky: #3e98d0;
  --wsos-amber: #f1ad0c;
  --wsos-bg: #eef1f8;
  --wsos-ink: #0f172a;
  --wsos-card-bg: #ffffff;
  --wsos-border: rgba(15, 23, 42, 0.08);
  --wsos-shadow: 0 6px 24px rgba(15, 23, 42, 0.06);

  --bs-primary: #2170ad;
  --bs-primary-rgb: 33, 112, 173;
  --bs-link-color: #2170ad;
  --bs-link-color-rgb: 33, 112, 173;
  --bs-link-hover-color: #1a5a8c;
  --bs-link-hover-color-rgb: 26, 90, 140;
  --bs-body-bg: #eef1f8;
  --bs-body-bg-rgb: 238, 241, 248;
  --bs-body-color: #0f172a;
  --bs-body-color-rgb: 15, 23, 42;
  --wsos-font-display: "Space Grotesk", system-ui, sans-serif;
  --bs-body-font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bs-border-radius: 0.75rem;
  --bs-border-radius-lg: 1rem;
  --bs-focus-ring-color: rgba(62, 152, 208, 0.35);
}

/* Display type, as in the WSOS shell: titles, brand name, card headings and invoice figures */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6,
.display-1, .display-2, .display-3, .display-4,
.navbar-brand, .card-header, .card-title, .modal-title,
.invoice-total, .price, .fs-1, .fs-2, .fs-3 {
  font-family: var(--wsos-font-display);
  letter-spacing: 0.01em;
}
h1, h2, h3, .h1, .h2, .h3 {
  font-weight: 600;
}

/* Dark = the WSOS look: deep navy page, the shell's dark card surface, sky-blue accents */
[data-bs-theme="dark"] {
  --wsos-card-bg: rgba(17, 24, 39, 0.92);
  --wsos-border: rgba(255, 255, 255, 0.12);
  --wsos-shadow: 0 10px 34px rgba(0, 0, 0, 0.4);

  --bs-primary: #3e98d0;
  --bs-primary-rgb: 62, 152, 208;
  --bs-link-color: #3e98d0;
  --bs-link-color-rgb: 62, 152, 208;
  --bs-link-hover-color: #7cbde6;
  --bs-link-hover-color-rgb: 124, 189, 230;
  --bs-body-bg: #021533;
  --bs-body-bg-rgb: 2, 21, 51;
  --bs-body-color: #eef2f7;
  --bs-body-color-rgb: 238, 242, 247;
  --bs-emphasis-color: #ffffff;
  --bs-secondary-color: #b3bcc9;
  --bs-secondary-bg: rgba(17, 24, 39, 0.92);
  --bs-tertiary-bg: rgba(17, 24, 39, 0.92);
  --bs-border-color: rgba(255, 255, 255, 0.12);
  --bs-border-radius: 0.75rem;
  --bs-border-radius-lg: 1rem;
  --bs-focus-ring-color: rgba(62, 152, 208, 0.4);
}
[data-bs-theme="dark"] .btn-outline-primary {
  --bs-btn-color: var(--wsos-sky);
  --bs-btn-border-color: var(--wsos-sky);
  --bs-btn-hover-color: #ffffff;
  --bs-btn-hover-bg: var(--wsos-blue);
  --bs-btn-hover-border-color: var(--wsos-blue);
}
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
  background-color: rgba(2, 21, 51, 0.6);
  border-color: rgba(255, 255, 255, 0.16);
}

/* Buttons and form controls */
.btn-primary {
  --bs-btn-bg: var(--wsos-blue);
  --bs-btn-border-color: var(--wsos-blue);
  --bs-btn-hover-bg: var(--wsos-blue-dark);
  --bs-btn-hover-border-color: var(--wsos-blue-dark);
  --bs-btn-active-bg: #164d78;
  --bs-btn-active-border-color: #164d78;
  --bs-btn-disabled-bg: var(--wsos-blue);
  --bs-btn-disabled-border-color: var(--wsos-blue);
  --bs-btn-focus-shadow-rgb: 62, 152, 208;
}
.btn-outline-primary {
  --bs-btn-color: var(--wsos-blue);
  --bs-btn-border-color: var(--wsos-blue);
  --bs-btn-hover-bg: var(--wsos-blue);
  --bs-btn-hover-border-color: var(--wsos-blue);
  --bs-btn-active-bg: var(--wsos-blue-dark);
  --bs-btn-active-border-color: var(--wsos-blue-dark);
  --bs-btn-focus-shadow-rgb: 62, 152, 208;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--wsos-sky);
  box-shadow: 0 0 0 0.25rem rgba(62, 152, 208, 0.25);
}
.form-check-input:checked {
  background-color: var(--wsos-blue);
  border-color: var(--wsos-blue);
}

/* Header: the WSOS navy bar */
header .navbar {
  background: linear-gradient(135deg, var(--wsos-navy), var(--wsos-navy-2));
  border-radius: 0 0 var(--bs-border-radius-lg) var(--bs-border-radius-lg);
  padding-left: 1rem;
  padding-right: 1rem;
  box-shadow: 0 8px 24px rgba(2, 21, 51, 0.18);
}
header .navbar a,
header .navbar .navbar-text,
header .navbar .btn-link {
  color: #eef2f7;
}
header .navbar a:hover {
  color: #ffffff;
}
header .navbar .dropdown-menu a {
  color: var(--bs-body-color);
}
header .navbar .navbar-brand img {
  height: 40px;
  width: auto;
  border-radius: 10px;
}
header .navbar .navbar-toggler {
  border-color: rgba(255, 255, 255, 0.35);
}
header .navbar .navbar-toggler-icon {
  filter: invert(1);
}

/* Cards, sidebar, footer */
.card {
  --bs-card-bg: var(--wsos-card-bg);
  border: 1px solid var(--wsos-border);
  border-radius: var(--bs-border-radius-lg);
  box-shadow: var(--wsos-shadow);
}
.card-header {
  background: transparent;
  border-bottom-color: var(--wsos-border);
}
.list-group-item.active {
  background-color: var(--wsos-blue);
  border-color: var(--wsos-blue);
  box-shadow: inset 3px 0 0 var(--wsos-amber);
}
#footer {
  text-align: center;
}

/* Login: the WSOS deep-navy hero with a white card */
body.page-login {
  min-height: 100vh;
  background-color: var(--wsos-navy);
  background-image: radial-gradient(1100px 560px at 50% -8%, #17508f 0%, var(--wsos-navy-2) 38%, var(--wsos-navy) 72%);
  background-repeat: no-repeat;
  background-attachment: fixed;   /* stays put behind a page taller than the screen - no band where it would otherwise end */
}
body.page-login .card {
  border: 0;
  border-radius: 1.1rem;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}
body.page-login img {
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
/* The login hero is navy in BOTH light and dark mode, so the text around the card is always light */
body.page-login .wsos-login-row {
  min-height: 100vh;
  padding: 1rem 0 2.5rem;
}
body.page-login .wsos-welcome h1 {
  color: #ffffff;
}
body.page-login .wsos-welcome-sub,
body.page-login .wsos-newhere {
  color: #c9d3e2;
}
body.page-login .wsos-newhere a:not(.btn) {
  color: #7cbde6;
}
body.page-login .wsos-newhere .btn-outline-primary {
  --bs-btn-color: #7cbde6;
  --bs-btn-border-color: rgba(124, 189, 230, 0.6);
  --bs-btn-hover-color: #ffffff;
  --bs-btn-hover-bg: var(--wsos-blue);
  --bs-btn-hover-border-color: var(--wsos-blue);
}
/* Trust signals under the card: quiet, readable, each with an amber tick */
body.page-login .wsos-trust {
  color: #c9d3e2;
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 0 0 1.25rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--bs-border-radius);
  background: rgba(255, 255, 255, 0.04);
}
body.page-login .wsos-trust li {
  position: relative;
  padding-left: 1.5rem;
}
body.page-login .wsos-trust li + li {
  margin-top: 0.6rem;
}
body.page-login .wsos-trust li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--wsos-amber);
  font-weight: 700;
}
body.page-login .wsos-trust strong {
  color: #ffffff;
  font-weight: 600;
}
body.page-login .wsos-trust a,
body.page-login .wsos-legal,
body.page-login .wsos-legal a {
  color: #7cbde6;
}
body.page-login .wsos-legal {
  color: #b3bcc9;
}

/* Printing an invoice: just the invoice, on white */
@media print {
  body { background: #ffffff; }
  header, #footer { display: none !important; }
  .card { box-shadow: none; border: 0; }
}
