/* =====================================================================
   Donate shop catalogue
   Mirrors the in-game window: a tab bar across the top, a sidebar of
   sub-categories, and the item grid. The tree is entirely data-driven
   (donate_tab / donate), so nothing here may assume category names or
   counts.
   ===================================================================== */

.donate-shop {
  --ds-ink: #eef7f1;
  --ds-body: #9fb5a8;
  --ds-muted: #7d9488;
  --ds-primary: #45f882;
  --ds-gold: #e8c96a;
  --ds-line: rgba(114, 215, 157, 0.14);
  --ds-line-strong: rgba(114, 215, 157, 0.3);
  --ds-panel: linear-gradient(168deg, rgba(17, 34, 26, 0.92), rgba(8, 18, 13, 0.94));
  --ds-ease: cubic-bezier(0.22, 0.8, 0.3, 1);

  padding: clamp(90px, 12vh, 140px) 0 clamp(60px, 8vw, 110px);
}

/* Intro ------------------------------------------------------------- */
.donate-shop__intro {
  max-width: 720px;
  margin-bottom: clamp(26px, 3vw, 40px);
}

.donate-shop__eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  color: var(--ds-primary);
  font-family: var(--tg-heading-font-family);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.22em;
  line-height: 1;
  text-transform: uppercase;
}

.donate-shop__eyebrow::before {
  content: "";
  width: 26px;
  height: 2px;
  background: linear-gradient(90deg, var(--ds-primary), transparent);
  border-radius: 2px;
}

.donate-shop__title {
  margin: 0 0 14px;
  color: var(--ds-ink);
  font-size: clamp(28px, 3.4vw, 42px);
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.08;
  text-transform: uppercase;
}

.donate-shop__lead {
  margin: 0;
  color: var(--ds-body);
  font-size: 15px;
  line-height: 1.7;
}

.donate-shop__lead strong {
  color: var(--ds-gold);
}

/* Shell ------------------------------------------------------------- */
.donate-shop__panel {
  border: 1px solid var(--ds-line);
  border-radius: 26px;
  background: var(--ds-panel);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
  overflow: hidden;
}

.donate-shop__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--ds-line);
  background: linear-gradient(180deg, rgba(20, 47, 35, 0.6), rgba(11, 25, 19, 0.2));
}

.donate-shop__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.donate-tab {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 18px;
  border: 1px solid var(--ds-line);
  border-radius: 13px;
  background: rgba(4, 10, 7, 0.5);
  color: var(--ds-body);
  font-family: var(--tg-heading-font-family);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.25s var(--ds-ease), background 0.25s var(--ds-ease), color 0.25s var(--ds-ease);
}

.donate-tab:hover {
  border-color: var(--ds-line-strong);
  color: var(--ds-ink);
}

.donate-tab small {
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ds-muted);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
}

.donate-tab.is-active {
  border-color: var(--ds-primary);
  background: linear-gradient(140deg, rgba(69, 248, 130, 0.2), rgba(69, 248, 130, 0.05));
  color: var(--ds-primary);
}

.donate-tab.is-active small {
  background: rgba(69, 248, 130, 0.18);
  color: var(--ds-primary);
}

/* Search ------------------------------------------------------------ */
.donate-shop__search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 1 300px;
  min-width: 200px;
}

.donate-shop__search > i {
  position: absolute;
  left: 14px;
  color: var(--ds-muted);
  font-size: 13px;
  pointer-events: none;
}

.donate-shop__search input {
  width: 100%;
  padding: 12px 34px 12px 36px;
  border: 1px solid var(--ds-line);
  border-radius: 13px;
  background: rgba(3, 9, 6, 0.66);
  color: var(--ds-ink);
  font-size: 14px;
}

.donate-shop__search input::placeholder {
  color: var(--ds-muted);
}

.donate-shop__search input:focus {
  border-color: var(--ds-line-strong);
  outline: none;
}

/* Hide the browser's own clear affordance; we render our own. */
.donate-shop__search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.donate-shop__search-clear {
  position: absolute;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ds-body);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.donate-shop__search-clear:hover {
  background: rgba(255, 255, 255, 0.16);
  color: var(--ds-ink);
}

/* Browser layout ---------------------------------------------------- */
.donate-panel {
  display: none;
  grid-template-columns: 210px minmax(0, 1fr);
  align-items: start;
}

.donate-panel.is-active {
  display: grid;
}

.donate-side {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border-right: 1px solid var(--ds-line);
  background: rgba(4, 10, 7, 0.3);
  /* Sidebars can be long (weapon skins run to nine entries); keep the grid
     in view on tall categories. */
  position: sticky;
  top: 96px;
}

.donate-side__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 11px 13px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--ds-body);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.22s var(--ds-ease), color 0.22s var(--ds-ease), border-color 0.22s var(--ds-ease);
}

.donate-side__item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--ds-ink);
}

.donate-side__item.is-active {
  border-color: var(--ds-line-strong);
  background: linear-gradient(140deg, rgba(69, 248, 130, 0.16), rgba(69, 248, 130, 0.04));
  color: var(--ds-primary);
}

.donate-side__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.donate-side__count {
  flex: 0 0 auto;
  color: var(--ds-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.donate-side__item.is-active .donate-side__count {
  color: var(--ds-primary);
}

.donate-shop__content {
  padding: 18px;
  min-width: 0;
}

.donate-subpanel {
  display: none;
}

.donate-subpanel.is-active {
  display: block;
}

.donate-subpanel__empty {
  margin: 0;
  padding: 32px;
  border: 1px dashed var(--ds-line);
  border-radius: 16px;
  color: var(--ds-muted);
  text-align: center;
}

/* Item grid --------------------------------------------------------- */
.donate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 12px;
}

.donate-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--ds-line);
  border-radius: 16px;
  background: linear-gradient(168deg, rgba(14, 31, 24, 0.9), rgba(7, 18, 13, 0.94));
  transition: transform 0.25s var(--ds-ease), border-color 0.25s var(--ds-ease), box-shadow 0.25s var(--ds-ease);
}

.donate-card:hover {
  transform: translateY(-3px);
  border-color: var(--ds-line-strong);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.42);
  /* Lift above neighbouring cards so the tooltip is not clipped by them. */
  z-index: 5;
}

.donate-card__thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  border: 1px solid var(--ds-line);
  border-radius: 12px;
  background: radial-gradient(circle at 32% 22%, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.5));
}

.donate-card__thumb img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.donate-card__body {
  min-width: 0;
}

.donate-card__name {
  margin: 0 0 5px;
  color: var(--ds-ink);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  /* main.css uppercases every heading; item names must render exactly as
     they are stored ("Ice Shield[Skin]", "Divine Potion(7days)"). */
  text-transform: none;
  /* Names vary a lot in length; clamp so every card stays the same height.
     overflow-wrap is required because engine names run together without
     spaces ("Blackskullhands[Skin]") and would otherwise overflow the card
     rather than wrapping onto the second line. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.donate-card__price {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin: 0;
  color: var(--ds-gold);
  font-family: var(--tg-heading-font-family);
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.donate-card__price small {
  color: var(--ds-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

/* Description tooltip ------------------------------------------------ */
.donate-card__tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 210px;
  max-width: 280px;
  padding: 10px 12px;
  border: 1px solid var(--ds-line-strong);
  border-radius: 12px;
  background: rgba(4, 10, 7, 0.97);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translate(-50%, 6px);
  pointer-events: none;
  transition: opacity 0.2s var(--ds-ease), transform 0.2s var(--ds-ease);
}

.donate-card:hover .donate-card__tip {
  opacity: 1;
  transform: translate(-50%, 0);
}

.donate-card__tip-line {
  font-size: 12px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}

.donate-card__tip-line--gap {
  height: 6px;
}

/* Cards near the top of a grid flip their tooltip below instead. */
.donate-grid > .donate-card:nth-child(-n + 4) .donate-card__tip {
  bottom: auto;
  top: calc(100% + 8px);
}

/* Search results ---------------------------------------------------- */
.donate-results {
  padding: 18px;
}

.donate-results__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.donate-results__title {
  margin: 0;
  color: var(--ds-ink);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.donate-results__title span {
  color: var(--ds-primary);
}

.donate-results__back {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  border: 1px solid var(--ds-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--ds-body);
  font-family: var(--tg-heading-font-family);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.donate-results__back:hover {
  border-color: var(--ds-line-strong);
  color: var(--ds-primary);
}

.donate-results__empty {
  margin: 0;
  padding: 40px;
  color: var(--ds-muted);
  text-align: center;
}

/* Result cards carry the category they came from. */
.donate-results .donate-card__origin {
  display: block;
  margin-top: 5px;
  color: var(--ds-muted);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Empty / footnote -------------------------------------------------- */
.donate-shop__empty {
  padding: 70px 20px;
  border: 1px dashed var(--ds-line);
  border-radius: 24px;
  color: var(--ds-muted);
  text-align: center;
}

.donate-shop__empty i {
  margin-bottom: 14px;
  font-size: 30px;
}

.donate-shop__empty p {
  margin: 0;
}

.donate-shop__footnote {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 18px 0 0;
  color: var(--ds-muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.donate-shop__footnote i {
  margin-top: 3px;
  color: var(--ds-primary);
}

/* Responsive -------------------------------------------------------- */
@media (max-width: 991px) {
  .donate-panel,
  .donate-panel.is-active {
    grid-template-columns: minmax(0, 1fr);
  }

  /* The sidebar becomes a horizontal chip rail above the grid. */
  .donate-side {
    position: static;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--ds-line);
    -webkit-overflow-scrolling: touch;
  }

  .donate-side__item {
    width: auto;
    flex: 0 0 auto;
    border-color: var(--ds-line);
    border-radius: 999px;
    white-space: nowrap;
  }
}

@media (max-width: 767px) {
  .donate-shop__bar {
    flex-direction: column;
    align-items: stretch;
  }

  .donate-shop__search {
    flex-basis: auto;
  }

  .donate-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }

  /* Tooltips have nowhere to go on narrow screens and would overflow the
     viewport, so drop them; the catalogue still reads fine without. */
  .donate-card__tip {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .donate-card,
  .donate-card__tip {
    transition: none;
  }

  .donate-card:hover {
    transform: none;
  }
}
