/* Praetorian theme for NetBox: the black-and-white look of the Praetorian GNOME desktops and Icinga Web
 * (files/icingaweb2/praetorian.less): near-black surfaces, white accent with black text, Inter, the
 * Praetorian logo and the desktop login wallpaper. Status colours (success / warning / danger) are kept:
 * they carry meaning. Applied to light and dark mode alike, so everyone sees the same look.
 * Loaded through BANNER_TOP / BANNER_LOGIN (configuration.py); managed by Puppet
 * (praetorian::ubuntu::netbox), served from /static/praetorian/. INFRA-297.
 */
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap;
  src: local("Inter"), local("Inter Regular"), url("Inter-Regular.otf") format("opentype"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap;
  src: local("Inter SemiBold"), url("Inter-SemiBold.otf") format("opentype"); }

:root, :root[data-bs-theme], [data-bs-theme=dark], [data-bs-theme=light], body[data-bs-theme] {
  color-scheme: dark;
  --tblr-font-sans-serif: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tblr-body-font-family: var(--tblr-font-sans-serif);
  --tblr-body-bg: #0d0d0d;
  --tblr-body-bg-rgb: 13, 13, 13;
  --tblr-body-color: #f2f2f2;
  --tblr-body-color-rgb: 242, 242, 242;
  --tblr-emphasis-color: #ffffff;
  --tblr-emphasis-color-rgb: 255, 255, 255;
  --tblr-secondary-color: rgba(242, 242, 242, .65);
  --tblr-tertiary-color: rgba(242, 242, 242, .45);
  --tblr-muted: rgba(242, 242, 242, .6);
  --tblr-bg-surface: #141414;
  --tblr-bg-surface-secondary: #0d0d0d;
  --tblr-bg-surface-tertiary: #1f1f1f;
  --tblr-bg-forms: #0d0d0d;
  --tblr-secondary-bg: #141414;
  --tblr-tertiary-bg: #1f1f1f;
  --tblr-border-color: #262626;
  --tblr-border-color-translucent: rgba(255, 255, 255, .08);
  --tblr-active-bg: #1f1f1f;
  --tblr-primary: #ffffff;
  --tblr-primary-rgb: 255, 255, 255;
  --tblr-primary-fg: #000000;
  --tblr-primary-text-emphasis: #ffffff;
  --tblr-primary-bg-subtle: #1f1f1f;
  --tblr-primary-border-subtle: #333333;
  --tblr-link-color: #ffffff;
  --tblr-link-color-rgb: 255, 255, 255;
  --tblr-link-hover-color: #d9d9d9;
  --tblr-link-hover-color-rgb: 217, 217, 217;
  --tblr-navbar-color: rgba(242, 242, 242, .75);
  --tblr-navbar-hover-color: #ffffff;
  --tblr-navbar-active-color: #ffffff;
  --tblr-navbar-brand-color: #ffffff;
  --tblr-card-bg: #141414;
  --tblr-card-cap-bg: #141414;
}

body { font-family: var(--tblr-font-sans-serif); background: #0d0d0d; color: #f2f2f2; }

/* Sidebar and top bar: same surface as the desktop panels */
.navbar, .navbar-vertical, aside.navbar, header.navbar { background: #0d0d0d !important; border-color: #262626 !important; }
.navbar-vertical .nav-link.active, .navbar-vertical .dropdown-item.active,
.navbar .nav-item.active > .nav-link { background: #1f1f1f !important; color: #ffffff !important; }
.dropdown-menu { background: #141414; border-color: #262626; }
.dropdown-item:hover, .dropdown-item:focus { background: #1f1f1f; color: #ffffff; }

/* Cards, tables, forms */
.card, .card-header, .card-footer, .modal-content, .offcanvas, .list-group-item { background: #141414; border-color: #262626; }
.table { --tblr-table-bg: transparent; --tblr-table-border-color: #262626; --tblr-table-hover-bg: rgba(255, 255, 255, .05);
         --tblr-table-striped-bg: rgba(255, 255, 255, .03); --tblr-table-active-bg: rgba(255, 255, 255, .12); }
.form-control, .form-select, .ts-control, .ts-dropdown, .input-group-text {
  background-color: #0d0d0d !important; color: #f2f2f2 !important; border-color: #333333 !important; }
.form-control:focus, .form-select:focus, .ts-wrapper.focus .ts-control {
  border-color: #ffffff !important; box-shadow: 0 0 0 .2rem rgba(255, 255, 255, .15) !important; }

/* Accent: white buttons with black text */
.btn-primary, .btn-primary:hover, .btn-primary:focus, .btn-primary:active, .bg-primary, .badge.bg-primary {
  --tblr-btn-bg: #ffffff; --tblr-btn-color: #000000; --tblr-btn-border-color: #ffffff;
  --tblr-btn-hover-bg: #d9d9d9; --tblr-btn-hover-color: #000000; --tblr-btn-hover-border-color: #d9d9d9;
  --tblr-btn-active-bg: #bfbfbf; --tblr-btn-active-color: #000000;
  background-color: #ffffff !important; color: #000000 !important; border-color: #ffffff !important; }
.btn-primary:hover { background-color: #d9d9d9 !important; border-color: #d9d9d9 !important; }
.nav-tabs .nav-link.active { background: #141414; color: #ffffff; border-color: #262626 #262626 #141414; }
.page-link.active, .active > .page-link { background: #ffffff; color: #000000; border-color: #ffffff; }
a:not(.btn):not(.nav-link):not(.dropdown-item):hover { color: #d9d9d9; }

/* Logo: the Praetorian wordmark (desktop login logo, 445x98) instead of NetBox's (same element, so layout and links stay) */
img.navbar-brand-image, img.logo { content: url("logo.png") !important; height: 28px !important; width: auto !important; }
.page-center img.logo { height: 56px !important; }

/* Login page: the desktop login wallpaper behind a dark card */
.page.page-center { background: #0d0d0d url("login.jpg") center / cover no-repeat; }
.page.page-center .card { background: rgba(13, 13, 13, .88); border-color: #262626; backdrop-filter: blur(6px); }
.netbox-edition { color: rgba(242, 242, 242, .6); }

/* The banners only carry the link to this stylesheet: hide their empty boxes */
div:has(> link#praetorian-theme) { display: none !important; }

/* ---- Round 2 (27 Oct, racks screenshot) ----
 * NetBox's dark mode hard-codes navy #001423 (page header, cards, sidebar under a teal gradient, table
 * headers), #081b2a (active tab) and teal #00f2d4 (sidebar section headings, open-section bar), several
 * with !important and html[data-bs-theme=dark] selectors: matched here with html[data-bs-theme] + !important.
 */
html[data-bs-theme] body, html[data-bs-theme] .page, html[data-bs-theme] .page-wrapper, html[data-bs-theme] .page-body,
html[data-bs-theme] .page-header, html[data-bs-theme] .page-body-card, html[data-bs-theme] .container-fluid {
  background: #0d0d0d !important; }
html[data-bs-theme] .card, html[data-bs-theme] .card-header, html[data-bs-theme] .card-footer,
html[data-bs-theme] .markdown > table thead th, html[data-bs-theme] .table thead th {
  background: #141414 !important; border-color: #262626 !important; }
html[data-bs-theme] .page-tabs .nav-tabs .nav-link.active, html[data-bs-theme] .nav-tabs .nav-link.active {
  background-color: #141414 !important; color: #ffffff !important; border-color: #262626 #262626 #141414 !important; }
html[data-bs-theme] .page-tabs .nav-tabs .nav-link:not(.active) { background-color: #0d0d0d !important; color: rgba(242, 242, 242, .7) !important; }

/* Sidebar: plain black, no teal gradient; white-grey headings; light-grey bar on the open section */
html[data-bs-theme] .navbar-vertical.navbar-expand-lg { background: #0d0d0d !important; border-right: 1px solid #262626 !important; }
html[data-bs-theme] .navbar-vertical.navbar-expand-lg .text-secondary,
html[data-bs-theme] .navbar-vertical.navbar-expand-lg .dropdown-header { color: rgba(242, 242, 242, .55) !important; letter-spacing: .04em; }
html[data-bs-theme] .navbar-vertical.navbar-expand-lg .nav-item.dropdown.active::after,
html[data-bs-theme] .navbar-vertical.navbar-expand-lg .nav-item.dropdown.active:after { border-color: #ffffff !important; }
html[data-bs-theme] .navbar-vertical.navbar-expand-lg .nav-item.dropdown.active > .nav-link,
html[data-bs-theme] .navbar-vertical.navbar-expand-lg .dropdown-item.active,
html[data-bs-theme] .navbar-vertical.navbar-expand-lg .dropdown-item:hover { background-color: #1f1f1f !important; }
html[data-bs-theme] .navbar-vertical .netbox-edition, html[data-bs-theme] .navbar-brand .netbox-edition { display: none !important; }

/* Top bar */
html[data-bs-theme] header.navbar { background: #0d0d0d !important; border-bottom: 1px solid #262626 !important; }

/* Primary-coloured text/backgrounds that NetBox ties to navy/teal */
html[data-bs-theme] .text-bg-primary, html[data-bs-theme] .active > .page-link { color: #000000 !important; background-color: #ffffff !important; }
html[data-bs-theme] .text-primary:not(.btn) { color: #ffffff !important; }
