/**
 * @file widgets/tax-relief-modal.css
 * Shared tax-relief deduction modal. Same look as the node 261 deduction dialog
 * (wide card, scrollable body, deduction tables), but in its own library so any
 * feature that opens the modal (the checkout billing pane, future pages) can
 * attach it. Markup: a native <dialog class="wwf-tax-modal"> moved to <body> by
 * tax-modal.js; the body is rich text from wwf_core.settings:tax_relief.
 */

.wwf-tax-modal {
  /* Centre deterministically: the theme reset wipes the UA margin:auto on
     dialog, so pin + translate. */
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  width: min(52rem, calc(100vw - 2rem));
  max-width: 100%;
  max-height: calc(100dvh - 3rem);
  padding: 0;
  border: 0;
  border-radius: var(--wwf-radius-lg, 0.5rem);
  background: var(--wwf-color-surface, #fff);
  color: var(--wwf-color-surface-foreground, #1d1d1b);
  box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
.wwf-tax-modal::backdrop {
  background: #000;
  opacity: 0.7;
}
/* Lock the page scroll behind the open modal. */
html:has(.wwf-tax-modal[open]) {
  overflow: hidden;
}

/* Pinned close button: dark circle, white X, stays put while the body scrolls. */
.wwf-tax-modal__close {
  position: absolute;
  top: 0.85rem;
  inset-inline-end: 0.85rem;
  z-index: 1;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  background-color: var(--wwf-color-foreground, #1d1d1b);
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23fff'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M18%206%206%2018'/%3E%3Cpath%20d='m6%206%2012%2012'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 1.25rem 1.25rem;
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.wwf-tax-modal__close:hover {
  opacity: 0.8;
}

/* Scrollable body. Top inset clears the pinned close button. */
.wwf-tax-modal__body {
  max-height: calc(100dvh - 3rem);
  overflow-y: auto;
  padding: 3.75rem 1.75rem 1.75rem;
  font-family: var(--wwf-font-body, sans-serif);
  font-size: 0.9375rem;
  line-height: 1.5;
}
.wwf-tax-modal__body > :first-child {
  margin-top: 0;
}
.wwf-tax-modal__body h2 {
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--wwf-color-accent, #f89840);
  font-family: var(--wwf-font-heading, sans-serif);
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--wwf-color-foreground, #1d1d1b);
}
/* Sub-headings inside a section (who the deduction is for, the questions). */
.wwf-tax-modal__body h3 {
  margin: 1.75rem 0 0.5rem;
  font-family: var(--wwf-font-heading, sans-serif);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--wwf-color-foreground, #1d1d1b);
}
/* Text pasted from a word processor carries its own fonts and sizes inline;
   the modal's type has to win over them, which only !important can do. */
.wwf-tax-modal__body [style] {
  font-family: inherit !important;
  font-size: inherit !important;
  line-height: inherit !important;
}
.wwf-tax-modal__body p {
  margin: 0 0 0.75rem;
}
.wwf-tax-modal__body ul {
  margin: 0 0 0.75rem;
  padding-left: 1.25rem;
  list-style: disc;
}
.wwf-tax-modal__body li {
  margin-bottom: 0.4rem;
}
.wwf-tax-modal__body a {
  color: var(--wwf-color-accent, #1d1d1b);
  text-decoration: underline;
}

.wwf-tax-modal__body .text-small {
  font-size: 0.75rem;
  color: var(--wwf-color-muted-foreground, #6b6b6b);
}

/* Deduction tables: rounded card, dark header, soft zebra rows, the percentage
   column emphasised on the right (mirrors the node 261 modal). */
.wwf-tax-modal__body table {
  width: 100%;
  margin: 0 0 1.5rem;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--wwf-color-border, #e0ddd7);
  border-radius: 0.625rem;
  overflow: hidden;
  font-size: 0.8125rem;
}
.wwf-tax-modal__body caption {
  caption-side: top;
  margin-bottom: 0.4rem;
  text-align: left;
  font-family: var(--wwf-font-heading, sans-serif);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--wwf-color-muted-foreground, #6b6b6b);
}
.wwf-tax-modal__body th,
.wwf-tax-modal__body td {
  width: 50%;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--wwf-color-border, #e0ddd7);
  text-align: left;
  vertical-align: top;
}
.wwf-tax-modal__body thead th {
  background: var(--wwf-color-foreground, #1d1d1b);
  color: var(--wwf-color-surface, #fff);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
/* Second column (the percentage) right-aligned. */
.wwf-tax-modal__body thead th + th,
.wwf-tax-modal__body tbody td {
  text-align: right;
}
.wwf-tax-modal__body tbody th {
  font-weight: 400;
}
/* A value can be a phrase ("10 % de la base liquidable"), so it wraps; the
   content keeps each number with its unit through a non-breaking space. */
.wwf-tax-modal__body tbody td {
  font-weight: 700;
}
.wwf-tax-modal__body tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--wwf-color-surface-soft, #ede9e3) 55%, transparent);
}
.wwf-tax-modal__body .table-striped tbody tr:nth-child(odd) {
  background: color-mix(in srgb, var(--wwf-color-surface-soft, #ede9e3) 55%, transparent);
}
.wwf-tax-modal__body tbody tr:last-child :is(th, td) {
  border-bottom: 0;
}
.wwf-tax-modal__body tfoot td {
  width: auto;
  border-bottom: 0;
  text-align: left;
  font-weight: 400;
  white-space: normal;
  background: color-mix(in srgb, var(--wwf-color-surface-soft, #ede9e3) 30%, transparent);
}
