/* ================= LOGIN PAGE ================= */

/* Login page: top-left logo only */
auth-anon-layout a:has(> bit-icon),
auth-anon-layout a:has(> svg) {
  display: block !important;
  width: 176px;
  height: 64px;
  background: url("../images/mylogo.png") no-repeat left center / contain;
}
auth-anon-layout a:has(> bit-icon) > *,
auth-anon-layout a:has(> svg) > * {
  display: none !important;
}

/* Login page: safe icon above "Log in" */
bit-svg.tw-max-h-full.tw-flex.tw-justify-center:not(.tw-absolute) > svg {
  display: none !important;
}
bit-svg.tw-max-h-full.tw-flex.tw-justify-center:not(.tw-absolute) {
  display: block !important;
  width: 176px;
  height: 75px;
  margin: 0 auto;
  background: url("../images/mylogo.png") no-repeat center / contain;
}

/* Restore faint background illustrations */
html .tw-opacity-\[\.11\] bit-svg.tw-max-h-full.tw-flex.tw-justify-center {
  display: flex !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  background: none !important;
}
html .tw-opacity-\[\.11\] bit-svg.tw-max-h-full.tw-flex.tw-justify-center > svg {
  display: block !important;
}

/* ================= TOP NAV BAR (desktop widths only) ================= */
@media (min-width: 768px) {

  /* Page grid: no left column, leave room for the 64px bar */
  div:has(> app-side-nav) {
    grid-template-columns: 0 minmax(0, 1fr) 0 !important;
    padding-top: 64px !important;
    box-sizing: border-box !important;
  }

  /* Bar pinned to the top, full width */
  app-side-nav {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    z-index: 40;
    display: block !important;
  }
  bit-side-nav,
  bit-side-nav > div.tw-relative {
    width: 100% !important;
    height: 64px !important;
    overflow: visible !important;
  }

  /* The nav element itself: horizontal, blue */
  nav#bit-side-nav {
    width: 100% !important;
    height: 64px !important;
    display: flex !important;
    flex-direction: row !important;
    overflow: visible !important;
    background-color: #0b3d91 !important;
    transition: none !important;
  }
  #bit-side-nav--scroll {
    flex: 1 1 auto !important;
    height: 64px !important;
    overflow: visible !important;
    container-type: normal !important;
  }
  #bit-side-nav--scroll > div {
    flex-direction: row !important;
    min-height: 0 !important;
    height: 100% !important;
  }
  #bit-side-nav--scroll > div > div.tw-flex-1 {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    height: 100%;
    padding: 0 12px;
    gap: 4px;
  }

  /* Hide bottom product switcher, collapse button and resize handle */
  #bit-side-nav--scroll > div > div:not(.tw-flex-1),
  nav#bit-side-nav > div:not(#bit-side-nav--scroll),
  div[role="separator"][aria-controls="bit-side-nav"] {
    display: none !important;
  }

  /* Logo: white panel at the left of the bar */
  bit-nav-logo > div {
    padding: 0 !important;
    background: transparent !important;
    position: static !important;
  }
  bit-nav-logo a {
    display: block !important;
    box-sizing: border-box;
    width: 160px;
    height: 48px !important;
    margin: 0 16px 0 0;
    padding: 6px !important;
    border-radius: 8px;
    background: #ffffff url("../images/mylogo.png") no-repeat center / contain !important;
    background-origin: content-box !important;
  }
  bit-nav-logo bit-svg,
  bit-nav-logo a svg {
    display: none !important;
    background: none !important;
  }

  /* Menu items side by side */
  bit-side-nav bit-nav-item,
  bit-side-nav bit-nav-group {
    display: block;
    width: auto !important;
    flex: 0 0 auto;
    min-width: 110px;
  }
  bit-side-nav bit-nav-group {
    position: relative;
  }
  bit-side-nav bit-nav-item > div,
  bit-side-nav bit-nav-item > div > div {
    padding-inline-start: 0 !important;
    padding-inline-end: 4px !important;
  }
  div[data-testid="nav-item-container"] {
    background: transparent !important;
    padding-inline-start: 8px !important;
  }
  div[data-testid="nav-item-container"]:hover {
    background: rgba(255, 255, 255, 0.18) !important;
  }

  /* Active page: cyan pill */
  div[data-testid="nav-item-container"]:has(a[aria-current="page"]) {
    background: #19d3e6 !important;
  }
  div[data-testid="nav-item-container"]:has(a[aria-current="page"]) a {
    color: #0b2545 !important;
  }

  /* Dropdown arrow for Tools / Settings: sits after the label */
  div[data-testid="nav-item-container"] > div > div.tw-absolute {
    position: static !important;
    transform: none !important;
    order: 2;
  }

  /* Sub-menu under Tools / Settings opens as a dropdown */
  bit-side-nav bit-nav-group > div {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    z-index: 60;
    background: #0b3d91;
    border-radius: 10px;
    padding: 6px 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  }
}

/* ================= VAULT LIST ================= */

/* Row hover and checked rows: cyan highlight */
html bit-table tbody tr:hover > td,
html bit-table tbody tr:hover > th {
  background-color: #b8f0f6 !important;
}
html bit-table tbody tr:has(input[type="checkbox"]:checked) > td,
html bit-table tbody tr:has(input[type="checkbox"]:checked) > th {
  background-color: #19d3e6 !important;
}

/* Column headings bolder */
html bit-table thead th {
  font-weight: 700 !important;
}

/* Highlight active Collection in left FILTERS panel */
app-vault-filter a.tw-font-bold,
app-vault-filter button.tw-font-bold {
  background-color: #19d3e6 !important;
  color: #0b2545 !important;
  border-radius: 6px !important;
  padding: 4px 8px !important;
}

/* Bordered two-column table look inside Item Details drawer */
app-vault-view bit-section,
app-cipher-view bit-section {
  border: 1px solid #b0b7c3 !important;
  border-radius: 0 !important;
  margin-bottom: 0 !important;
}
app-vault-view bit-section > div,
app-cipher-view bit-section > div {
  display: grid !important;
  grid-template-columns: 160px 1fr !important;
  border-bottom: 1px solid #d8dde6 !important;
  padding: 8px 12px !important;
  align-items: center !important;
}
/* ================= NARROWER FILTERS PANEL ================= */

/* Shrink the Filters column (the panel's width comes from its wrapper) */
app-vault-filter,
app-vault-filter > *,
app-organization-vault-filter,
app-organization-vault-filter > * {
  width: 260px !important;
  max-width: 260px !important;
  min-width: 0 !important;
}

/* Let the vault list take the freed space */
app-vault-filter ~ *,
app-organization-vault-filter ~ * {
  min-width: 0;
  flex: 1 1 auto;
}
/* ================= TOP BAR TEXT: ALWAYS WHITE (all vaults and organizations) ================= */
@media (min-width: 768px) {

  nav#bit-side-nav a,
  nav#bit-side-nav a *,
  nav#bit-side-nav button,
  nav#bit-side-nav button *,
  nav#bit-side-nav bit-icon,
  nav#bit-side-nav i,
  nav#bit-side-nav span {
    color: #ffffff !important;
  }

  nav#bit-side-nav svg {
    fill: currentColor;
  }

  /* Active page keeps dark text on the cyan pill */
  nav#bit-side-nav div[data-testid="nav-item-container"]:has(a[aria-current="page"]) a,
  nav#bit-side-nav div[data-testid="nav-item-container"]:has(a[aria-current="page"]) a * {
    color: #0b2545 !important;
  }
}
/* ================= LOGIN FOOTER ================= */

/* Line 1: "Vaultwarden Web" -> "RattleTech Vault" */
bit-landing-footer footer > div[bittypography="body2"]:has(+ div[bittypography="body2"]) {
  font-size: 0 !important;
}
bit-landing-footer footer > div[bittypography="body2"]:has(+ div[bittypography="body2"])::before {
  content: "RattleTech Vault";
  font-size: 0.95rem;
  font-weight: 600;
}

/* Line 2: hide the version number */
bit-landing-footer footer > div[bittypography="body2"] + div[bittypography="body2"] {
  display: none !important;
}

/* Disclaimer: replace with your own text */
#vw-disclaimer > * {
  display: none !important;
}
#vw-disclaimer::before {
  content: "Authorized users only.";
  white-space: pre-line;
  font-size: 0.75rem;
}