/* shared/ui/components.css — Card, Select, and Button presentational
   primitives, generalized from the de facto styles that had already been
   hand-rolled per remote (orchestrator/frontend/src/AiChat.css's
   `.message`/`.metrics-modal`/`.chat-conversation-bar select`, comb/
   frontend/src/index.css's `.nav-icon-btn`, orchestrator's
   `.composer-icon`). REQ-SHUI-001.

   Distribution model matches tokens.css exactly: every consuming app
   vendors this file by literal copy — see scripts/check_drift.py for the
   list of vendored paths and README.md for how to use it. Edit only here,
   then re-copy into each vendored path; never hand-edit a vendored copy
   directly, or the next drift check will catch it.

   All classes are prefixed `hive-` so they can never collide with a
   remote's own classes, per coding_standards/standards/frontend.md's
   cross-remote CSS-isolation contract. This file only reads tokens.css's
   custom properties (--bg-panel, --border, --accent, etc.) — it never
   redeclares them, and it declares no bare/global selector (no `body`,
   `*`, `html`, element-only rules), so it is safe to ship inside a Module
   Federation remote's merged CSS bundle. Requires tokens.css to be loaded
   first (for the custom properties this file reads); load order matters,
   not import order, since these are plain vendored CSS files. */

/* ---------------------------------------------------------------------
   Card — generic bordered container. Generalized from AiChat.css's
   `.message` box (border/radius/background) with the chat-bubble-specific
   asymmetric corner and tail kept out of this shared primitive — that's
   app-specific presentation a consumer layers on top with its own class,
   the same way tokens.css lets an app extend but never redeclare a token.
   --------------------------------------------------------------------- */
.hive-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-panel);
  padding: 16px 20px;
}

/* Emphasized/selected variant — generalized from `.message.user`'s
   raised background + accent-colored border. */
.hive-card--raised {
  background: var(--bg-panel-raised);
  border: 2px solid var(--accent);
}

/* Elevated variant for modals/popovers — generalized from
   `.metrics-modal`'s box-shadow. Combine with `.hive-card` (or
   `.hive-card--raised`) for the border/background. */
.hive-card--floating {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* Tighter padding for compact cards (small modals, list rows). */
.hive-card--tight {
  padding: 10px 14px;
  border-radius: 10px;
}

/* ---------------------------------------------------------------------
   Select — styled <select> with an appearance reset, custom chevron, and
   dark/light color-scheme handling. This is the exact pattern from
   AiChat.css's `.chat-conversation-bar select` rule, generalized to a
   standalone class. The chevron is a fixed --text-muted-colored inline
   SVG (matching the dark theme's --text-muted, #8f9baa) rather than a
   token-driven color, because CSS `background-image` cannot reference a
   custom property inside an embedded data URI — this is a known, accepted
   limitation carried over unchanged from the pattern being generalized;
   revisit with a masked-icon approach if per-theme chevron color is ever
   required.
   --------------------------------------------------------------------- */
.hive-select {
  height: 30px;
  padding: 0 22px 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%238f9baa' d='M1 1l5 5 5-5'/%3E%3C/svg%3E")
    no-repeat right 8px center;
  color: var(--text);
  font-weight: 600;
  color-scheme: dark;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  /* The chevron SVG above declares only a viewBox, no width/height. With
     background-size left at `auto`, Chromium sizes such an image as
     `contain` -- the chevron rendered 25px tall, the full height of the
     control (seen in orchestrator's conversation picker). Pin it to the
     viewBox's own 12x8. */
  background-size: 12px 8px;
}
.hive-select:hover,
.hive-select:focus-visible {
  border-color: var(--border-strong);
  outline: none;
}
.hive-select:disabled {
  opacity: 0.48;
  cursor: default;
}
/* Vendoring apps that also copy the html.light block from tokens.css get
   correct native-control coloring in light mode by pairing this rule with
   their own `html.light .hive-select { color-scheme: light; }` — kept as
   a one-line override per app rather than baked in here, matching how
   AiChat.css did it (`html.light .chat-conversation-bar select`). */

/* ---------------------------------------------------------------------
   Button — generalized from comb/frontend/src/index.css's
   `.nav-icon-btn` (square icon button) and orchestrator's
   `.composer-icon`/`.chat-conversation-bar button`. `.hive-btn` alone is
   a neutral (secondary-weight) text/icon button; add `--primary` or
   `--secondary` for explicit emphasis, and `--icon` for a fixed-size
   square icon button.
   --------------------------------------------------------------------- */
.hive-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.hive-btn:hover {
  color: var(--text-head);
  border-color: var(--border-strong);
  background: var(--bg-hover);
}
.hive-btn:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.hive-btn:disabled {
  opacity: 0.48;
  cursor: default;
  pointer-events: none;
}

/* Primary — filled with the accent color, for the one main action in a
   view (send, save, confirm). --on-accent is only declared in the bzz
   theme today; the fallback (--bg-deep, a near-black) keeps text legible
   against the amber/gold --primary used by the dark and light themes. */
.hive-btn--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-accent, var(--bg-deep));
}
.hive-btn--primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--on-accent, var(--bg-deep));
}

/* Secondary — outlined/transparent, for the supporting action next to a
   primary one. */
.hive-btn--secondary {
  background: transparent;
}
.hive-btn--secondary:hover {
  background: var(--bg-hover);
}

/* Icon-only square button — fixed footprint, no text label. Pair with an
   inline SVG or a single glyph child. */
.hive-btn--icon {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 18px;
}
