/* db Analytics - White-label override for Plausible CE v2 */

/* ======================================
   1. REMOVE PLAUSIBLE FOOTER
   ====================================== */
.mt-24.bg-gray-800 {
  display: none !important;
}

/* ======================================
   2. LOGO: Hide Plausible images, inject db logo
   :not(.ln-logo) and :not(.db-hl) prevent double logo on
   landing page nav and injected header (which have their own <img>)
   ====================================== */
img[alt="Plausible logo"] {
  display: none !important;
}

a:has(> img[alt="Plausible logo"]) {
  display: inline-flex !important;
  align-items: center !important;
  min-width: 100px !important;
  min-height: 36px !important;
  text-decoration: none !important;
}
a:has(> img[alt="Plausible logo"])::before {
  content: "" !important;
  display: block !important;
  width: 110px !important;
  height: 35px !important;
  background-image: url("/db-custom/favicon.svg") !important;
  background-repeat: no-repeat !important;
  background-size: contain !important;
  background-position: left center !important;
}

/* Fallback (browsers without :has) - exclude our own anchors that have a real <img> */
nav a[href="/"]:not(.ln-logo) img[alt="Plausible logo"],
nav a[href="/sites"] img[alt="Plausible logo"],
header a[href="/"]:not(.db-hl) img[alt="Plausible logo"],
header a[href="/sites"] img[alt="Plausible logo"] {
  display: none !important;
}
nav a[href="/"]:not(.ln-logo),
nav a[href="/sites"],
header a[href="/"]:not(.db-hl),
header a[href="/sites"] {
  display: inline-flex !important;
  align-items: center !important;
  min-width: 100px !important;
  min-height: 36px !important;
  text-decoration: none !important;
}
nav a[href="/"]:not(.ln-logo)::before,
nav a[href="/sites"]::before,
header a[href="/"]:not(.db-hl)::before,
header a[href="/sites"]::before {
  content: "" !important;
  display: block !important;
  width: 110px !important;
  height: 35px !important;
  background-image: url("/db-custom/favicon.svg") !important;
  background-repeat: no-repeat !important;
  background-size: contain !important;
  background-position: left center !important;
}

/* ======================================
   3. PRIMARY COLOR: Indigo/Purple -> Green #59B031
   ====================================== */
button[type="submit"],
input[type="submit"] {
  background-color: #59B031 !important;
  border-color: #59B031 !important;
}
button[type="submit"]:hover,
input[type="submit"]:hover {
  background-color: #4a9025 !important;
}
a.button,
.button {
  background-color: #59B031 !important;
  border-color: #59B031 !important;
}
a.button:hover,
.button:hover {
  background-color: #4a9025 !important;
}
.bg-indigo-600, .bg-indigo-500, .bg-indigo-700,
.bg-purple-600, .bg-purple-500 {
  background-color: #59B031 !important;
}
.hover\:bg-indigo-500:hover,
.hover\:bg-indigo-700:hover,
.hover\:bg-indigo-600:hover {
  background-color: #4a9025 !important;
}
.text-indigo-600, .text-indigo-500, .text-indigo-700 {
  color: #59B031 !important;
}
.hover\:text-indigo-600:hover,
.hover\:text-indigo-500:hover {
  color: #4a9025 !important;
}
.border-indigo-600, .border-indigo-500 {
  border-color: #59B031 !important;
}
.ring-indigo-500, .ring-indigo-600 {
  --tw-ring-color: #59B031 !important;
}
.bg-indigo-100,
.hover\:bg-indigo-100:hover,
.bg-indigo-50 {
  background-color: #f0f9eb !important;
}
.text-indigo-800 {
  color: #3a7019 !important;
}

/* ======================================
   4. HIDE RESIDUAL CE BRANDING
   ====================================== */
.selfhosted,
.ce-notice,
[data-testid="selfhosted-notice"] {
  display: none !important;
}

/* ======================================
   5. CUSTOM INJECTED ELEMENTS
   ====================================== */

/* -- Branded header (injected on /login and /password/* pages) -- */
#db-header {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 24px;
}
.db-hi {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60px;
}
.db-hl {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #444;
  text-decoration: none;
}
.db-hl img {
  width: 32px;
  height: 32px;
  display: block !important;
}
.db-hl strong { color: #59B031; }

/* Hide Plausible native nav when our branded header is present */
body:has(#db-header) nav:not(#db-header nav),
body:has(#db-header) header:not(#db-header) {
  display: none !important;
}

/* -- Full footer (injected on /login and /password/* pages) -- */
#db-footer {
  background: #1a1a2e;
  color: #ccc;
  padding: 28px 24px 20px;
  margin-top: 48px;
}
.db-fi {
  max-width: 900px;
  margin: 0 auto;
  font-size: .83rem;
  line-height: 1.65;
  padding-bottom: 20px;
  text-align: center;
}
.db-fi a { color: #59B031; text-decoration: none; }
.db-fi a:hover { text-decoration: underline; }
.db-fbot {
  max-width: 900px;
  margin: 0 auto;
  padding-top: 16px;
  border-top: 1px solid #2a2a3e;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .78rem;
  color: #555;
  flex-wrap: wrap;
  gap: 8px;
}
.db-fbot-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #888;
}
.db-fbot-brand img {
  width: 20px;
  height: 20px;
  display: block !important;
}

/* -- Mini footer (injected on authenticated app pages) -- */
#db-footer-mini {
  background: #f5f7fa;
  border-top: 1px solid #e2e8f0;
  color: #999;
  font-size: .78rem;
  text-align: center;
  padding: 10px 16px;
}
#db-footer-mini a { color: #59B031; text-decoration: none; }
#db-footer-mini a:hover { text-decoration: underline; }