/* DealMachine brand overrides for SigNoz UI.
 *
 * Loaded from `/etc/signoz/web/assets/dm-overrides.css` via a <link>
 * tag injected into index.html by the Dockerfile. Runs last in the
 * cascade, so everything here beats the bundled Ant Design + SigNoz
 * stylesheets without needing `!important` in most cases.
 *
 * Source of truth for values:
 *   atlas/packages/design-system/tokens.css  → --brand-*
 *   atlas/tailwind.config.js                 → brand scale names
 *
 * Design principle: only override *color* tokens. Everything structural
 * (spacing, typography, layout) stays upstream so SigNoz UI fixes keep
 * flowing in on version bumps without conflict.
 */

/* ── Ant Design v5 primary palette (CSS variables) ────────────────── */
/* SigNoz v0.121 uses the Ant Design v5 theme system, which exposes its
 * palette as `--ant-color-*` CSS custom properties. Overriding here
 * recolors: primary buttons, active tabs, input focus rings, checkbox/
 * radio selected states, and anything that reads these tokens. */
:root,
[data-theme='dark'],
[data-theme='light'],
.ant-app {
  /* DealMachine teal scale (matches Tailwind teal-300 … teal-700) */
  --ant-color-primary: #14b8a6;
  --ant-color-primary-hover: #2dd4bf;
  --ant-color-primary-active: #0d9488;
  --ant-color-primary-bg: #ccfbf1;
  --ant-color-primary-bg-hover: #99f6e4;
  --ant-color-primary-border: #5eead4;
  --ant-color-primary-border-hover: #2dd4bf;
  --ant-color-primary-text: #14b8a6;
  --ant-color-primary-text-hover: #2dd4bf;
  --ant-color-primary-text-active: #0d9488;

  /* Links (read by Ant Design's Typography + Anchor components) */
  --ant-color-link: #14b8a6;
  --ant-color-link-hover: #2dd4bf;
  --ant-color-link-active: #0d9488;

  /* Legacy Ant Design v4 fallback tokens (still referenced by a few
   * older SigNoz components that haven't migrated to v5 yet) */
  --ant-primary-color: #14b8a6;
  --ant-primary-color-hover: #2dd4bf;
  --ant-primary-color-active: #0d9488;
  --ant-primary-1: #f0fdfa;
  --ant-primary-2: #ccfbf1;
  --ant-primary-3: #99f6e4;
  --ant-primary-4: #5eead4;
  --ant-primary-5: #2dd4bf;
  --ant-primary-6: #14b8a6;
  --ant-primary-7: #0d9488;
  --ant-primary-color-outline: rgba(20, 184, 166, 0.2);
}

/* ── SigNoz custom tokens (best-effort names) ─────────────────────── */
/* SigNoz ships its own "robin" (blue) scale on top of Ant Design for
 * navigation highlights, graph accents, and alert badges. Overriding
 * these here tints the sidebar active item, graph cursors, etc. If a
 * future SigNoz version renames these, the worst case is those specific
 * bits revert to blue — the rest of the UI stays DealMachine-teal via
 * the Ant tokens above. */
:root {
  --bg-robin-100: #ccfbf1;
  --bg-robin-200: #99f6e4;
  --bg-robin-300: #5eead4;
  --bg-robin-400: #2dd4bf;
  --bg-robin-500: #14b8a6;
  --bg-robin-600: #0d9488;
  --bg-robin-700: #0f766e;

  /* Sidenav active-item highlight (SigNoz custom class) */
  --text-robin-500: #14b8a6;
  --text-robin-400: #2dd4bf;
}

/* ── Primary button (belt + suspenders) ───────────────────────────── */
/* Ant Design generates these via CSS-in-JS, so the CSS var overrides
 * above are enough on first paint. Explicit selectors here guard
 * against any component that inlines styles from an older theme
 * snapshot (hot-reload edge cases, etc.). */
.ant-btn-primary:not(:disabled):not(.ant-btn-dangerous) {
  background-color: #14b8a6;
  border-color: #14b8a6;
}
.ant-btn-primary:not(:disabled):not(.ant-btn-dangerous):hover {
  background-color: #2dd4bf;
  border-color: #2dd4bf;
}
.ant-btn-primary:not(:disabled):not(.ant-btn-dangerous):active {
  background-color: #0d9488;
  border-color: #0d9488;
}

/* Text-variant primary buttons (used in table row actions) */
.ant-btn-link:not(:disabled) {
  color: #14b8a6;
}
.ant-btn-link:not(:disabled):hover {
  color: #2dd4bf;
}

/* ── Links in content areas ───────────────────────────────────────── */
.ant-typography a,
a.ant-typography,
.ant-breadcrumb a:hover,
.ant-pagination-item-active a {
  color: #14b8a6;
}
.ant-typography a:hover,
a.ant-typography:hover {
  color: #2dd4bf;
}

/* ── Selected/active rows in tables + selects ─────────────────────── */
.ant-select-item-option-selected:not(.ant-select-item-option-disabled),
.ant-menu-item-selected,
.ant-dropdown-menu-item-selected {
  color: #14b8a6;
  background-color: rgba(20, 184, 166, 0.08);
}

/* ── Focus rings on inputs ────────────────────────────────────────── */
.ant-input-focused,
.ant-input:focus,
.ant-select-focused .ant-select-selector,
.ant-picker-focused {
  border-color: #14b8a6 !important;
  box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.2) !important;
}

/* ── Switch/toggle ────────────────────────────────────────────────── */
.ant-switch-checked {
  background-color: #14b8a6;
}
.ant-switch-checked:hover:not(.ant-switch-disabled) {
  background-color: #0d9488;
}

/* ── Loading spinners + progress bars ─────────────────────────────── */
.ant-spin-dot-item {
  background-color: #14b8a6;
}
.ant-progress-bg {
  background-color: #14b8a6;
}
