// Donation detail (single) — aligned with my-donations card style

$gfw-dd-border: #e8eaed;
$gfw-dd-surface: #ffffff;
$gfw-dd-surface-subtle: #f6f7f9;
$gfw-dd-text: black;
$gfw-dd-text-muted: #333;
$gfw-dd-radius: 4px;
$gfw-dd-radius-sm: 3px;

.gfw-donation-detail-page {
  margin: 0 auto;
  padding: 0 0 2rem;
  color: $gfw-dd-text;
  font-size: 0.9375rem;
  line-height: 1.5;
  max-width: 42rem;
}

// -----------------------------------------------------------------------------
// Back link
// -----------------------------------------------------------------------------
.gfw-donation-detail-nav {
  margin-bottom: 1.25rem;
}

.gfw-donation-detail-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0;
  // font-size: 0.8125rem;
  // font-weight: 600;
  // color: $gfw-dd-text-muted;
  text-decoration: none;
  // border-radius: $gfw-dd-radius-sm;
  transition: color 0.15s ease;

  svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    opacity: 0.75;
  }

  &:hover,
  &:focus-visible {
    color: $gfw-dd-text;
    outline: none;
  }

  &:focus-visible {
    outline: 2px solid $primary-color;
    outline-offset: 2px;
  }
}

// -----------------------------------------------------------------------------
// Hero card (summary)
// -----------------------------------------------------------------------------
.gfw-donation-detail-hero {
  margin-bottom: 1.25rem;
  padding: 1.125rem 1.25rem;
  background: $gfw-dd-surface;
  border: 1px solid $gfw-dd-border;
  border-radius: $gfw-dd-radius;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

@media (hover: hover) {
  .gfw-donation-detail-hero:hover {
    border-color: darken($gfw-dd-border, 6%);
    // box-shadow: 0 2px 8px rgba(26, 29, 33, 0.06);
  }
}

.gfw-donation-detail-hero__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid $gfw-dd-border;
}

.gfw-donation-detail-hero__title {
  margin: 0;
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: $gfw-dd-text;
}

.gfw-donation-detail-hero__id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 500;
  font-size: 0.9em;
  color: $gfw-dd-text-muted;
}

.gfw-donation-detail-hero__campaign {
  margin-bottom: 1rem;
}

.gfw-donation-detail-hero__campaign-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: $gfw-dd-text-muted;
}

.gfw-donation-detail-hero__campaign-line {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
}

.gfw-donation-detail-hero__campaign-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: $gfw-dd-text;
  text-decoration: none;
  border-radius: $gfw-dd-radius-sm;
  transition: color 0.15s ease;

  svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    opacity: 0.55;
    transition: opacity 0.15s ease, transform 0.15s ease;
  }

  &:hover,
  &:focus-visible {
    color: $primary-color;
    outline: none;

    svg {
      opacity: 1;
      transform: translate(0.06rem, -0.06rem);
    }
  }
}

.gfw-donation-detail-hero__campaign-name {
  font-size: 0.9375rem;
  font-weight: 500;
  color: $gfw-dd-text;
}

.gfw-donation-detail-hero__amount-block {
  margin-bottom: 1rem;
}

.gfw-donation-detail-hero__amount {
  margin: 0;
  font-size: clamp(1.45rem, 4vw, 1.75rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: $gfw-dd-text;

  .giftflow-currency-formatted-amount {
    font-weight: inherit;
    color: inherit;
  }
}

.gfw-donation-detail-hero__meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid $gfw-dd-border;
}

@media (min-width: 480px) {
  .gfw-donation-detail-hero__meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.gfw-donation-detail-hero__meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.gfw-donation-detail-hero__meta-key {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: $gfw-dd-text-muted;
}

.gfw-donation-detail-hero__meta-val {
  font-size: 0.8125rem;
  color: $gfw-dd-text;
  word-break: break-word;
}

.gfw-donation-detail-hero__type {
  text-transform: capitalize;
}

// Status pills (match my-donations)
.gfw-donation-detail-page .donation-status {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 9999px;
  text-transform: capitalize;
  white-space: nowrap;
  letter-spacing: 0.02em;

  &.status-completed {
    background: #e8f5e9;
    color: #1b5e20;
  }

  &.status-refunded {
    background: #fff8e1;
    color: #e65100;
  }

  &.status-pending {
    background: #e8eaf6;
    color: #3949ab;
  }

  &.status-failed {
    background: #ffebee;
    color: #c62828;
  }

  &.status-cancelled {
    background: $gfw-dd-surface-subtle;
    color: $gfw-dd-text-muted;
  }
}

// -----------------------------------------------------------------------------
// Details section + definition list
// -----------------------------------------------------------------------------
.gfw-donation-detail-section {
  margin-bottom: 1.5rem;
}

.gfw-donation-detail-section__title {
  margin: 0 0 0.65rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: $gfw-dd-text-muted;
}

.gfw-donation-detail-card {
  padding: 0.25rem 1.125rem 0.5rem;
  background: $gfw-dd-surface;
  border: 1px solid $gfw-dd-border;
  border-radius: $gfw-dd-radius;
}

.gfw-donation-detail-fields {
  margin: 0;
}

.gfw-donation-detail-field {
  display: grid;
  grid-template-columns: minmax(0, 8.5rem) 1fr;
  gap: 0.35rem 1.25rem;
  align-items: start;
  padding: 0.85rem 0;
  border-bottom: 1px solid $gfw-dd-border;

  &:last-child {
    border-bottom: none;
    padding-bottom: 0.35rem;
  }
}

@media (max-width: 520px) {
  .gfw-donation-detail-field {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}

.gfw-donation-detail-field__label {
  // margin: 0;
  // font-size: 0.6875rem;
  // font-weight: 600;
  // text-transform: uppercase;
  // letter-spacing: 0.06em;
  // color: $gfw-dd-text-muted;
  // line-height: 1.4;
}

.gfw-donation-detail-field__value {
  // margin: 0;
  // font-size: 0.875rem;
  // font-weight: 400;
  color: $gfw-dd-text;
  // word-break: break-word;

  margin-inline-start: 0 !important;
  margin-block: 0 !important;
}

.gfw-donation-detail-field__value.gfw-donation-detail-email {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8125rem;
  color: $gfw-dd-text;
}

.gfw-donation-detail-field__value.gfw-donation-detail-message {
  // white-space: pre-wrap;
  font-size: 0.875rem;
  line-height: 1.55;
  color: $gfw-dd-text;
}

.gfw-donation-detail-field__value.gfw-donation-detail-date {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8125rem;
}

// -----------------------------------------------------------------------------
// Footer actions
// -----------------------------------------------------------------------------
.gfw-donation-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.25rem;
  border-top: 1px solid $gfw-dd-border;
}

.gfw-donation-detail-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;

  svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
  }

  &:focus-visible {
    outline: 2px solid $primary-color;
    outline-offset: 2px;
  }
}

.gfw-donation-detail-action--ghost {
  color: $gfw-dd-text-muted;
  background: transparent;
  border-color: transparent;
  padding-left: 0;
  padding-right: 0.75rem;

  &:hover {
    color: $gfw-dd-text;
  }
}

.gfw-donation-detail-action--primary {
  // color: $gfw-dd-text;
  // background: $gfw-dd-surface-subtle;
  // border-color: $gfw-dd-border;

  svg {
    opacity: 0.55;
    transition: opacity 0.15s ease, transform 0.15s ease;
  }

  &:hover {
    border-color: $primary-color;
    color: $primary-color;

    svg {
      opacity: 1;
      transform: translate(0.06rem, -0.06rem);
    }
  }
}

@media (max-width: 520px) {
  .gfw-donation-detail-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .gfw-donation-detail-action {
    width: 100%;
  }

  .gfw-donation-detail-action--ghost {
    justify-content: center;
    padding: 0.65rem 1rem;
    border: 1px solid $gfw-dd-border;
    background: $gfw-dd-surface;
    box-sizing: border-box;
  }
}
