/* ── Keymono shared components ────────────────────────────────────────────
   Styles for the components in common:vaadin. Separate from
   keymono-brand.css, which answers what the brand is; this file answers how
   our components are built. Both apps load both.

   Everything here is a class the Java side attaches by name. Java sets no
   style properties of its own — appearance is decided here, state is decided
   there.
   ───────────────────────────────────────────────────────────────────────── */

/* ── Buttons ──
   Aura has no theme variant for either of these. `tertiary-inline` and `icon`
   exist as Lumo names only, and `[theme~=tertiary]` does not match
   `tertiary-inline`, so a button asking for them keeps full button chrome. */

/* Sits inside a line of text: tertiary already removes background and border,
   this removes the space a standalone button reserves around its label. */
vaadin-button.km-button-inline {
  --vaadin-button-padding: 0;
  min-width: 0;
}

/* Square around its icon, instead of the width a text label would need. */
vaadin-button.km-button-icon {
  --vaadin-button-padding: 0;
  min-width: 0;
  aspect-ratio: 1;
}

/* ── Recurring text and surface shapes ──
   Named once here because both applications reach for them; a view that wants
   quiet text asks for the class, not for a colour. */

.km-text-secondary {
  color: var(--vaadin-text-color-secondary);
}

.km-text-strong {
  font-weight: var(--aura-font-weight-semibold);
}

.km-text-danger {
  color: var(--aura-red-text);
}

/* Text that arrived with its own line breaks — API descriptions, model output. */
.km-text-preserve-lines {
  white-space: pre-wrap;
}

/* A bordered block grouping related content inside a view, one step below the
   card surface: an outline rather than a background, so nesting stays readable. */
.km-panel {
  border: 1px solid var(--vaadin-border-color);
  border-radius: var(--vaadin-radius-m);
}

/* ── BaseCardView ── */

.km-card {
  background: var(--aura-surface-color);
  border-radius: var(--vaadin-radius-l);
  overflow: hidden;
  padding: var(--vaadin-gap-xl);
}

.km-card-header {
  margin: var(--vaadin-gap-l) 0 var(--vaadin-gap-xl) 0;
}

/* The scroller gives the content its height; without border-box the padding
   is added on top of it and the last field ends up beyond the scroll range. */
.km-card-content {
  box-sizing: border-box;
}

/* ── BaseDashboardView ── */

.km-dashboard {
  text-align: center;
}

/* ── BaseDetailView ── */

.km-detail-header {
  border-bottom: 1px solid var(--vaadin-border-color);
}

.km-detail-footer {
  border-top: 1px solid var(--vaadin-border-color);
}

/* ── Forms ── */

.km-form-error {
  color: var(--aura-red-text);
  text-align: center;
}

.km-form-note {
  color: var(--vaadin-text-color-secondary);
  font-size: var(--aura-font-size-s);
}

.km-form-actions {
  margin-top: var(--vaadin-gap-l);
}

/* ── Pagination ── */

vaadin-button.km-pagination-button {
  --vaadin-button-padding: 0;
  min-width: 1.875rem;
}

.km-pagination-group {
  gap: 2px;
}

.km-pagination-info {
  white-space: nowrap;
  color: var(--vaadin-text-color-secondary);
  font-size: var(--aura-font-size-s);
}

/* ── Table cells ── */

.km-cell-tags {
  flex-wrap: wrap;
  gap: 4px;
}

.km-cell-image-round {
  border-radius: 50%;
}

/* Ledger amounts: fixed-width digits so the decimal points line up down a
   column, right-aligned within the cell the renderer is given. */
.km-balance {
  font-family: var(--font-mono);
  text-align: right;
  display: inline-block;
  width: 100%;
}

/* ── HoverImage ──
   The overlay's position follows the cursor and is set from JavaScript; its
   appearance is here. The backdrop is white because product art arrives as
   transparent PNGs that vanish against the dark canvas. */

.km-hover-image {
  display: inline-block;
}

.km-hover-thumbnail {
  cursor: pointer;
  object-fit: contain;
}

.km-hover-enlarged {
  object-fit: contain;
}

.km-hover-overlay {
  display: none;
  position: fixed;
  z-index: 9999;
  background: white;
  border: 1px solid var(--vaadin-border-color);
  border-radius: var(--vaadin-radius-m);
  box-shadow: var(--aura-shadow-m);
  padding: var(--vaadin-gap-s);
}

.km-hover-overlay-visible {
  display: block;
}

/* ── EmptyState ── */

.km-empty-state {
  min-height: 200px;
}

/* ── PayoutMatrix ── */

.km-payout-section {
  margin-bottom: var(--vaadin-gap-l);
}

.km-payout-section-header {
  display: flex;
  align-items: center;
  gap: var(--vaadin-gap-s);
  margin-bottom: var(--vaadin-gap-s);
}

.km-payout-table {
  overflow-x: auto;
}

.km-payout-tier-toggles {
  flex-wrap: wrap;
  margin-top: var(--vaadin-gap-xs);
}
