/* ===================================
   AREA DIALOG OF THE TARIFF CARD
   One native <dialog> per tile and per detail row (benefit-area-dialog.ejs), ported one to one
   from the app's benefit-area-info-dialog.component.ts styles (its --offer-* tokens: ink #17262b,
   muted #5b6b72, line #e3e9ea, mint #0d6e68): fixed header (area icon, title, description, close),
   scrolling body with the tinted tariff facts (status, value, note, condition chips, sub-benefits)
   and the general explanation of the area (summary, typical treatments, note). The dialogs sit
   inside .tariff-board or .tariff-detail-list, so they inherit the --tp-* tokens and the .bb-site
   re-colouring of benefit-detail-list.css. Linked by includeWithCSS of benefit-area-dialog.ejs.
   Coverage tints as in the app: covered mint, restricted amber #b26a00, excluded and unstated grey.
   Mobile first: full width minus 24 px at 375 px, 480 px at most from there on (the app's
   `min(100vw - 24px, 480px)`).
   =================================== */

.tariff-dialog {
  width: calc(100vw - 24px);
  max-width: 480px;
  max-height: calc(100vh - 48px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: #fff;
  color: var(--tp-ink);
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 11px 15px -7px rgba(0, 0, 0, 0.2), 0 24px 38px 3px rgba(0, 0, 0, 0.14), 0 9px 46px 8px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}
.tariff-dialog::backdrop {
  background: rgba(0, 0, 0, 0.32);
}
.tariff-dialog[open] {
  animation: tariff-dialog-in 150ms cubic-bezier(0, 0, 0.2, 1);
}
@keyframes tariff-dialog-in {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
}

/* The frame splits into the fixed header and the scrolling body (.offer-dialog). */
.tariff-dialog__frame {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
  min-height: 0;
}

/* .offer-dialog-header */
.tariff-dialog__header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--tp-dialog-line);
}

/* .offer-dialog-area-icon */
.tariff-dialog__icon {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.tariff-dialog__heading {
  flex: 1;
  min-width: 0;
}

.tariff-dialog__title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--tp-ink);
}

.tariff-dialog__description {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--tp-muted);
}

/* .offer-dialog-close: a 36 px circle, 44 px on touch screens without moving the heading. */
.tariff-dialog__close {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--tp-muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tariff-dialog__close svg {
  width: 24px;
  height: 24px;
}
.tariff-dialog__close:is(:hover, :focus-visible) {
  background: var(--tp-hover);
  color: var(--tp-ink);
}
.tariff-dialog__close:focus-visible {
  outline: 2px solid rgba(var(--tp-dialog-mint-rgb), 0.45);
  outline-offset: 1px;
}
@media (pointer: coarse) {
  .tariff-dialog__close {
    width: 44px;
    height: 44px;
    margin: -4px -4px -4px 0;
  }
}

/* .offer-dialog-body */
.tariff-dialog__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 12px 16px 18px;
  font-size: 13px;
  color: var(--tp-muted);
  overscroll-behavior: contain;
}
.tariff-dialog__body p {
  margin: 0 0 10px;
}

/* .area-info-lead */
.tariff-dialog__lead {
  margin-top: 14px;
  font-weight: 600;
  color: var(--tp-ink);
}
/* .area-info-examples */
.tariff-dialog__examples {
  margin: 0 0 12px;
  padding-left: 18px;
  line-height: 1.6;
}
/* .area-info-note */
.tariff-dialog__note {
  font-size: 11px;
}

/* --- The tariff facts (.tariff-facts): a tinted card whose accent follows the coverage --- */
.tariff-facts {
  --facts-accent: var(--tp-dialog-mint);
  --facts-tint: rgba(var(--tp-dialog-mint-rgb), 0.06);
  margin: 0 0 4px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--facts-accent) 22%, transparent);
  border-radius: 12px;
  background: var(--facts-tint);
  color: var(--tp-ink);
}
.tariff-facts[data-coverage="restricted"] {
  --facts-accent: #b26a00;
  --facts-tint: rgba(178, 106, 0, 0.07);
}
.tariff-facts[data-coverage="excluded"],
.tariff-facts[data-coverage="unstated"] {
  --facts-accent: #8a9499;
  --facts-tint: rgba(138, 148, 153, 0.1);
}

.tariff-facts__status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--facts-accent);
}
.tariff-facts__status-icon {
  display: inline-flex;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
}
.tariff-facts__status-icon svg {
  width: 100%;
  height: 100%;
}
.tariff-facts__status-label {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--tp-ink);
}

/* Everything under the status line indents to the label column (28 px = icon + gap). */
.tariff-dialog__body .tariff-facts__value {
  margin: 6px 0 0 28px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.3px;
  color: var(--facts-accent);
}
.tariff-facts[data-coverage="excluded"] .tariff-facts__value,
.tariff-facts[data-coverage="unstated"] .tariff-facts__value {
  font-size: 15px;
  font-weight: 700;
}

/* .tariff-facts__description */
.tariff-dialog__body .tariff-facts__note {
  margin: 6px 0 0 28px;
  color: var(--tp-ink);
}

.tariff-facts__conditions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0 28px;
  padding: 0;
  list-style: none;
}
.tariff-facts__conditions li {
  padding: 2px 8px;
  border: 1px solid var(--tp-dialog-line);
  border-radius: 999px;
  background: #fff;
  font-size: 11px;
  line-height: 1.5;
  color: var(--tp-ink);
  white-space: nowrap;
}

/* .tariff-facts .area-info-lead */
.tariff-dialog__body .tariff-facts__lead {
  margin: 12px 0 4px 28px;
  font-size: 12px;
  font-weight: 600;
  color: var(--tp-ink);
}

.tariff-facts__benefits {
  margin: 0 0 0 28px;
  padding: 0;
  list-style: none;
}
.tariff-facts__benefit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 10px;
  padding: 4px 0;
  border-top: 1px solid color-mix(in srgb, var(--tp-dialog-line) 70%, transparent);
  color: var(--tp-ink);
}
.tariff-facts__benefit:first-child {
  border-top: 0;
}
.tariff-facts__benefit-title {
  min-width: 0;
  overflow-wrap: anywhere;
}
.tariff-facts__benefit-value {
  font-weight: 600;
  white-space: nowrap;
}
.tariff-facts__benefit-note {
  grid-column: 1 / -1;
  font-size: 11px;
  line-height: 1.4;
  color: var(--tp-muted);
}
.tariff-facts__benefit--uncovered .tariff-facts__benefit-title,
.tariff-facts__benefit--uncovered .tariff-facts__benefit-value {
  color: var(--tp-muted);
}
.tariff-facts__benefit--uncovered .tariff-facts__benefit-value {
  font-weight: 500;
}

/* Page scroll locked while a dialog is open (tariff-page-card-dialog.js sets the class). */
html.tariff-dialog-open {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .tariff-dialog[open] {
    animation: none;
  }
}
