/* ==========================================================================
   COMPONENT: Quick Donate + amount chips + donate widget
   Shared by: the persistent widget, appeal cards, the appeal-detail aside,
   and /donate/. One component, four placements — no copy-paste.
   ========================================================================== */

/* --------------------------------------------------------------------------
   AMOUNT CHIPS
   -------------------------------------------------------------------------- */

.c-chips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-2);
}

.c-chips--2col { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.c-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: var(--sp-2) var(--sp-2);
  font-family: var(--ff-utility);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums;
  color: var(--c-ink);
  background-color: var(--surface-raised);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  cursor: pointer;
  transition:
    border-color var(--d-fast) var(--e-out),
    background-color var(--d-fast) var(--e-out),
    color var(--d-fast) var(--e-out);
}

.c-chip:hover { border-color: var(--c-ink); }

/* Chips are radio inputs underneath — checked state, not a JS-only class. */
.c-chip[aria-pressed="true"],
.c-chip.is-selected {
  background-color: var(--c-ink);
  border-color: var(--c-ink);
  color: var(--c-text-inv);
}

.is-inverted .c-chip {
  color: var(--c-text-inv);
  background-color: rgb(255 255 255 / 0.06);
  border-color: rgb(255 255 255 / 0.22);
}

.is-inverted .c-chip[aria-pressed="true"],
.is-inverted .c-chip.is-selected {
  background-color: var(--c-white);
  border-color: var(--c-white);
  color: var(--c-ink);
}

/* --------------------------------------------------------------------------
   FREQUENCY TOGGLE — two real radios, styled as a segmented control
   -------------------------------------------------------------------------- */

.c-freq {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  background-color: var(--surface-sunken);
  border-radius: var(--r-full);
  position: relative;
}

.is-inverted .c-freq { background-color: rgb(255 255 255 / 0.08); }

.c-freq__opt { position: relative; }

.c-freq__input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.c-freq__label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding-inline: var(--sp-3);
  font-family: var(--ff-utility);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--c-text-muted);
  border-radius: var(--r-full);
  cursor: pointer;
  transition: background-color var(--d-fast) var(--e-out), color var(--d-fast) var(--e-out);
  pointer-events: none;
}

.c-freq__input:checked + .c-freq__label {
  background-color: var(--c-white);
  color: var(--c-ink);
  box-shadow: var(--shadow-1);
}

.is-inverted .c-freq__input:checked + .c-freq__label {
  background-color: var(--c-white);
  color: var(--c-ink);
}

.c-freq__input:focus-visible + .c-freq__label {
  outline: var(--focus-width) solid var(--focus-color);
  outline-offset: 1px;
}

/* --------------------------------------------------------------------------
   CUSTOM AMOUNT
   -------------------------------------------------------------------------- */

/* min-width: 0, because a number input does not shrink on its own. As a grid
   item .c-amount had min-width: auto, and its min-content was the ₹ symbol plus
   the input's default ~208px preferred width — so on the Zakat pages at 320px
   the field measured 252px inside a 172px column and pushed the whole document
   6px sideways. The pair below is the fix: the row may shrink, and the input
   takes its width from the row rather than from the UA default. */
.c-amount {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
  padding-inline-start: var(--sp-4);
  background-color: var(--surface-raised);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  transition: border-color var(--d-fast) var(--e-out);
}

.c-amount:focus-within { border-color: var(--c-ink); }

.c-amount__symbol {
  font-family: var(--ff-utility);
  font-size: var(--fs-base);
  color: var(--c-text-muted);
  flex: none;
}

.c-amount__input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding-inline-end: var(--sp-4);
  font-family: var(--ff-utility);
  font-size: var(--fs-lg);
  font-variant-numeric: tabular-nums;
  background: transparent;
  border: 0;
}

.c-amount__input:focus { outline: none; }

/* Hide the number spinner — it is meaningless for a donation amount. */
.c-amount__input::-webkit-outer-spin-button,
.c-amount__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.c-amount__input { -moz-appearance: textfield; appearance: textfield; }

/* Quantity stepper for unit gifts (ration kits, winter kits, Qurbani shares). */
.c-qty {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.c-qty__btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-full);
  font-size: var(--fs-lg);
  line-height: 1;
}

.c-qty__btn:hover { border-color: var(--c-ink); }

.c-qty__value {
  min-width: 3ch;
  text-align: center;
  font-family: var(--ff-utility);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   DONATE WIDGET — the shared body
   -------------------------------------------------------------------------- */

.c-donate-widget {
  display: grid;
  gap: var(--sp-4);
  padding: var(--sp-5);
  background-color: var(--surface-raised);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
}

.c-donate-widget--flush {
  padding: 0;
  background: none;
  border: 0;
}

.c-donate-widget__title {
  font-family: var(--ff-utility);
  font-size: var(--fs-3xs);
  letter-spacing: var(--tr-wide);
  text-transform: uppercase;
  color: var(--c-text-muted);
}

.c-donate-widget__impact {
  font-size: var(--fs-sm);
  line-height: 1.45;
  color: var(--c-verdigris-ink);
  min-height: 2.9em;
}

.c-donate-widget__impact strong {
  font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   SELECT
   -------------------------------------------------------------------------- */

.c-select {
  position: relative;
  display: block;
}

.c-select__input {
  width: 100%;
  min-height: 48px;
  padding: var(--sp-3) var(--sp-8) var(--sp-3) var(--sp-4);
  font-size: var(--fs-sm);
  color: var(--c-ink);
  background-color: var(--surface-raised);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  appearance: none;
  cursor: pointer;
}

.c-select__input:hover { border-color: var(--c-ink); }

.c-select__chev {
  position: absolute;
  inset-inline-end: var(--sp-4);
  inset-block-start: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  pointer-events: none;
  color: var(--c-text-muted);
}

/* --------------------------------------------------------------------------
   PERSISTENT QUICK-DONATE WIDGET
   Desktop: docked bottom-right, collapsible. Mobile: the sticky donate bar
   handles this role instead, so the widget is hidden below 1024px.
   -------------------------------------------------------------------------- */

.c-quick-donate {
  position: fixed;
  inset-block-end: var(--sp-5);
  inset-inline-end: var(--sp-5);
  z-index: var(--z-quickdonate);
  width: 21rem;
  max-width: calc(100vw - var(--gutter) * 2);
  background-color: var(--c-paper);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  display: none;
}

@media (min-width: 1024px) {
  .c-quick-donate { display: block; }
}

.c-quick-donate__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-4) var(--sp-5);
  font-family: var(--ff-utility);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tr-wide);
  text-transform: uppercase;
  color: var(--c-ink);
  border-radius: var(--r-lg);
}

.c-quick-donate__toggle svg {
  width: 16px;
  height: 16px;
  transition: transform var(--d-fast) var(--e-out);
}

.c-quick-donate__toggle[aria-expanded="true"] svg { transform: rotate(180deg); }

.c-quick-donate__body {
  padding: 0 var(--sp-5) var(--sp-5);
  border-block-start: 1px solid var(--c-line);
  padding-block-start: var(--sp-4);
}

/* Collapsed by default so it never obscures content; opens on demand. */
.c-quick-donate__body[hidden] { display: none; }
