/* =============================================================================
 * indox brand theme overrides for Material for MkDocs
 *
 * Source palette: frontend/src/app/globals.css + theme-indox.css
 *   primary (light) #1f3ab3   blue-btn / --primary / --blue-btn
 *   accent          #4989ff   bright blue / --blue / --brand-second
 *   gradient        #4989ff → #1f3ab3
 *   dark page       #081125   --indox-bg
 *   dark card       #0c204e   --indox-bg2
 *   light page      #fbfbff   --bg
 * ========================================================================== */

/* ---------- LIGHT (default scheme) ---------- */
[data-md-color-scheme="default"] {
  --md-primary-fg-color:           #1f3ab3;
  --md-primary-fg-color--light:    #4989ff;
  --md-primary-fg-color--dark:     #16297e;
  --md-primary-bg-color:           #ffffff;
  --md-primary-bg-color--light:    #ffffffb3;

  --md-accent-fg-color:            #4989ff;
  --md-accent-fg-color--transparent: rgba(73, 137, 255, 0.10);
  --md-accent-bg-color:            #ffffff;
  --md-accent-bg-color--light:     #ffffffb3;

  --md-default-bg-color:           #fbfbff;
  --md-default-fg-color:           #252525;

  --md-typeset-a-color:            #1f3ab3;
}

/* ---------- DARK (slate scheme) ---------- */
[data-md-color-scheme="slate"] {
  --md-primary-fg-color:           #4989ff;
  --md-primary-fg-color--light:    #6ba1ff;
  --md-primary-fg-color--dark:     #1f3ab3;
  --md-primary-bg-color:           #081125;
  --md-primary-bg-color--light:    #081125b3;

  --md-accent-fg-color:            #4989ff;
  --md-accent-fg-color--transparent: rgba(73, 137, 255, 0.15);

  /* indox dark surface — navy, not slate gray */
  --md-default-bg-color:           #081125;   /* page bg */
  --md-default-fg-color:           #ffffff;
  --md-default-fg-color--light:    #cdd6e0;
  --md-default-fg-color--lighter:  #9ba3ae;
  --md-default-fg-color--lightest: rgba(255, 255, 255, 0.07);

  --md-code-bg-color:              #0c204e;   /* card surface */
  --md-code-fg-color:              #cdd6e0;

  --md-footer-bg-color:            #0c204e;
  --md-footer-bg-color--dark:      #081125;

  --md-typeset-a-color:            #6ba1ff;
}

/* Header gradient — matches indox landing CTA gradient */
.md-header {
  background: linear-gradient(90deg, #4989ff 0%, #1f3ab3 100%) !important;
}

/* Tabs (top-level nav) inherit the gradient header */
.md-tabs {
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

/* Logo sizing */
.md-header__button.md-logo img,
.md-header__button.md-logo svg {
  height: 1.6rem;
  width: auto;
}

/* Subtle border on cards/admonitions in dark mode */
[data-md-color-scheme="slate"] .md-typeset .admonition,
[data-md-color-scheme="slate"] .md-typeset details {
  border: 1px solid rgba(73, 137, 255, 0.18);
  background: #0c204e;
}

/* Code blocks — tighter and matches indox surface */
[data-md-color-scheme="slate"] .md-typeset pre > code {
  background: #0c204e;
  border: 1px solid rgba(73, 137, 255, 0.18);
}

/* Tables — readable in dark mode */
[data-md-color-scheme="slate"] .md-typeset table:not([class]) {
  background: #0c204e;
  border: 1px solid rgba(73, 137, 255, 0.18);
}
[data-md-color-scheme="slate"] .md-typeset table:not([class]) th {
  background: #1a3b8b;
  color: #ffffff;
}

/* Search box — match brand */
.md-search__form {
  background: rgba(255, 255, 255, 0.12);
}
.md-search__form:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* ============================================================================
 * Announce bar — three-zone layout:
 *   left   : "← Back to indox"      (secondary, small)
 *   middle : secondary text links    (optional, e.g. "Tools")
 *   right  : primary CTA pill button (e.g. "Open Dashboard →")
 *
 * Source: docs/overrides/main.html (overrides Material's `announce` block).
 * URLs come from mkdocs.yml `extra.indox_app` (no hardcoding).
 * ========================================================================== */
.indox-announce-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0.3rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.indox-announce-left  { justify-self: start;  }
.indox-announce-middle { justify-self: center; display: flex; gap: 1rem; }
.indox-announce-right { justify-self: end;   }

.indox-announce-back,
.indox-announce-link {
  color: inherit;
  text-decoration: none;
  opacity: 0.85;
  transition: opacity 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.indox-announce-back:hover,
.indox-announce-link:hover {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.indox-announce-back {
  font-weight: 600;
}

.indox-announce-arrow {
  display: inline-block;
  transition: transform 0.15s ease;
}

.indox-announce-back:hover .indox-announce-arrow {
  transform: translateX(-3px);
}

/* ── Primary CTA button — meant to convert readers to dashboard users ──── */
.indox-announce-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: #ffffff;
  color: #1f3ab3 !important;
  font-weight: 700;
  font-size: 0.78rem;
  text-decoration: none !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.indox-announce-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.indox-announce-cta .indox-announce-arrow--right {
  transition: transform 0.15s ease;
}

.indox-announce-cta:hover .indox-announce-arrow--right {
  transform: translateX(3px);
}

/* Dark mode — CTA gets the indox blue background instead of white-on-gradient */
[data-md-color-scheme="slate"] .indox-announce-cta {
  background: #4989ff;
  color: #ffffff !important;
}

/* Mobile: stack zones, keep CTA visible */
@media (max-width: 600px) {
  .indox-announce-bar {
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
  }
  .indox-announce-middle { display: none; }
  .indox-announce-right  { justify-self: end; }
}

/* ============================================================================
 * Headings — explicit dark-mode contrast (the user flagged this).
 * Material's defaults can look washed out against indox's deep navy.
 * ========================================================================== */
.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-typeset h4,
.md-typeset h5,
.md-typeset h6 {
  font-weight: 700;
  letter-spacing: -0.01em;
}

[data-md-color-scheme="default"] .md-typeset h1 { color: #1f3ab3; }
[data-md-color-scheme="default"] .md-typeset h2 { color: #16297e; }
[data-md-color-scheme="default"] .md-typeset h3,
[data-md-color-scheme="default"] .md-typeset h4,
[data-md-color-scheme="default"] .md-typeset h5,
[data-md-color-scheme="default"] .md-typeset h6 { color: #252525; }

[data-md-color-scheme="slate"] .md-typeset h1 { color: #ffffff; }
[data-md-color-scheme="slate"] .md-typeset h2 { color: #ffffff; }
[data-md-color-scheme="slate"] .md-typeset h3,
[data-md-color-scheme="slate"] .md-typeset h4 { color: #cdd6e0; }
[data-md-color-scheme="slate"] .md-typeset h5,
[data-md-color-scheme="slate"] .md-typeset h6 { color: #9ba3ae; }

/* H1 underline accent in light mode (matches indox section dividers) */
[data-md-color-scheme="default"] .md-typeset h1 {
  border-bottom: 2px solid rgba(31, 58, 179, 0.15);
  padding-bottom: 0.4rem;
}
[data-md-color-scheme="slate"] .md-typeset h1 {
  border-bottom: 2px solid rgba(73, 137, 255, 0.25);
  padding-bottom: 0.4rem;
}

/* Body text — ensure good contrast in dark mode */
[data-md-color-scheme="slate"] .md-typeset {
  color: #cdd6e0;
}

/* Inline code — readable in both modes */
[data-md-color-scheme="default"] .md-typeset code {
  background: rgba(31, 58, 179, 0.08);
  color: #1f3ab3;
}
[data-md-color-scheme="slate"] .md-typeset code {
  background: rgba(73, 137, 255, 0.15);
  color: #6ba1ff;
}
