/* ---------- Receipt line + custom help tooltip ----------
 * The "?" help button is a real <button> (not a span) so it gets
 * keyboard focus by default. The tooltip is a CSS pseudo-element keyed
 * off `data-tip` — no JS, instant show, fully styleable, no 500ms
 * delay like the native browser title attribute.
 */

.receipt-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

/* Subtle gold tint highlights the one-way transfer line so admins and
 * customers can scan past the routine "cost × days" rows. */
.receipt-line--transfer {
  margin: 0.4rem -0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    rgba(212, 175, 55, 0.10),
    rgba(212, 175, 55, 0.03)
  );
  border-left: 2px solid var(--accent);
}

.receipt-line-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}

.receipt-line-amount {
  font-weight: 600;
  white-space: nowrap;
}

/* The ? button itself */
.receipt-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15em;
  height: 1.15em;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--dark-bg);
  font-size: 0.7em;
  font-weight: 800;
  line-height: 1;
  cursor: help;
  position: relative;
  vertical-align: middle;
  transition: transform 0.15s ease, background 0.15s ease;
}

.receipt-help:hover,
.receipt-help:focus-visible {
  transform: scale(1.15);
  background: var(--gold-light, var(--accent));
}

.receipt-help:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The tooltip itself — a pseudo-element so we don't add DOM weight. */
.receipt-help::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);

  /* Sizing */
  width: max-content;
  max-width: 260px;
  padding: 0.6rem 0.75rem;

  /* Styling */
  background: #1a1f28;
  color: var(--ink, #fff);
  border: 1px solid var(--accent);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.35;
  text-align: left;
  letter-spacing: 0.01em;
  white-space: normal;

  /* Hidden by default */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 100;
}

/* Small arrow under the bubble pointing down at the ? */
.receipt-help::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  border: 6px solid transparent;
  border-top-color: var(--accent);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 101;
}

.receipt-help:hover::after,
.receipt-help:focus-visible::after,
.receipt-help:hover::before,
.receipt-help:focus-visible::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* On very narrow screens, clamp the bubble inside the viewport */
@media (max-width: 480px) {
  .receipt-help::after {
    max-width: 200px;
    font-size: 0.72rem;
  }
}
