/* ============================================================
   PocketDonate FRONT — shop UI (НЕ wp-admin)
   ============================================================ */

/* ---- Shell ---- */
.pmdonate-shop,
.pmdonate-products {
  max-width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.pmdonate-shop *,
.pmdonate-shop *::before,
.pmdonate-shop *::after {
  box-sizing: border-box;
}

/* ---- Layout: filters + grid ---- */
.pmdonate-layout {
  display: block;
  width: 100%;
}

.pmdonate-main {
  min-width: 0;
  width: 100%;
}

/* Filters: horizontal scroll on mobile */
.pmdonate-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.pmdonate-filters::-webkit-scrollbar {
  display: none;
}

.pmdonate-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid var(--border, #343536);
  background: var(--white, #222424);
  color: var(--black, #FAFEFF);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.pmdonate-filter-btn svg {
  flex-shrink: 0;
  opacity: 0.85;
}

.pmdonate-filter-btn:hover {
  border-color: var(--color-accent, #f97316);
}

.pmdonate-filter-btn.active {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.22), rgba(234, 88, 12, 0.12));
  border-color: rgba(249, 115, 22, 0.55);
  box-shadow: 0 4px 18px rgba(249, 115, 22, 0.18);
  color: var(--black, #FAFEFF);
}

.pmdonate-filter-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pmdonate-filter-name {
  white-space: nowrap;
}

.pmdonate-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(249, 115, 22, 0.15);
  color: var(--color-accent, #f97316);
  font-size: 12px;
  font-weight: 700;
}

.pmdonate-filter-btn.active .pmdonate-filter-count {
  background: rgba(249, 115, 22, 0.4);
  color: #fff;
}

/* Desktop: sticky sidebar filters */
@media (min-width: 992px) {
  .pmdonate-layout {
    display: flex;
    gap: 28px;
    align-items: flex-start;
  }

  .pmdonate-filters {
    flex: 0 0 220px;
    flex-direction: column;
    overflow: visible;
    position: sticky;
    top: 100px;
    margin-bottom: 0;
  }

  .pmdonate-filter-btn {
    width: 100%;
    border-radius: 18px;
    padding: 16px 20px;
    gap: 14px;
    font-size: 15px;
  }

  .pmdonate-main {
    flex: 1;
    min-width: 0;
  }
}

/* ---- Grid ---- */
.pmdonate-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  width: 100%;
}

@media (max-width: 1100px) {
  .pmdonate-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .pmdonate-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

/* ---- Card ---- */
/* один фон (карточка), без второго «ящика» у картинки */
.pmdonate-card,
a.pmdonate-card {
  display: flex;
  flex-direction: column;
  background: var(--white, #222424);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 18px;
  padding: 14px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  text-decoration: none !important;
  color: inherit !important;
  min-width: 0;
  height: 100%;
  box-shadow: none;
}

.pmdonate-card:hover,
.pmdonate-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  border-color: rgba(249, 115, 22, 0.55);
  text-decoration: none !important;
  color: inherit !important;
  outline: none;
}

.pmdonate-card:hover .pmdonate-card__title,
.pmdonate-card:focus-visible .pmdonate-card__title {
  color: var(--color-accent, #f97316);
}

/* превью: без отдельного bg-soft — прозрачно на фоне карточки */
.pmdonate-card__image {
  width: 100%;
  height: 168px;
  border-radius: 12px;
  overflow: hidden;
  background: transparent;
  position: relative;
  flex-shrink: 0;
}

.pmdonate-card__image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  padding: 6px;
  margin: 0;
  border: 0;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  user-select: none;
  pointer-events: none;
  display: block;
  transition: transform 0.2s ease;
}

.pmdonate-card:hover .pmdonate-card__image img {
  transform: scale(1.04);
}

.pmdonate-card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  opacity: 0.25;
  color: var(--color-accent, #f97316);
  background: transparent;
}

/* body: title → price + CTA (цены не давятся в одну строку) */
.pmdonate-card__body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 12px 2px 2px;
  margin: 0;
  min-height: 0;
  flex: 0 0 auto;
  background: transparent;
}

.pmdonate-card__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--black, #FAFEFF);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s;
  line-height: 1.25;
  background: transparent;
}

.pmdonate-card__footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.pmdonate-card__price {
  margin: 0;
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  background: transparent;
  line-height: 1.15;
}

/* не дублировать ₽ из старых стилей темы */
.pmdonate-card__price::after,
.pmdonate-price-new::after,
.pmdonate-price-old::after {
  content: none !important;
  display: none !important;
}

.pmdonate-price-old {
  display: block;
  text-decoration: line-through;
  color: var(--grey, #7f8c8d);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0.85;
}

.pmdonate-price-new {
  display: block;
  color: var(--color-accent, #f97316);
  font-size: 16px;
  font-weight: 750;
  line-height: 1.2;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pmdonate-card__cta {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  color: #fff !important;
  background: linear-gradient(135deg, #f97316, #ea580c);
  white-space: nowrap;
  opacity: 0;
  transform: translateX(6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  letter-spacing: 0.02em;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.35);
}

.pmdonate-card:hover .pmdonate-card__cta,
.pmdonate-card:focus-visible .pmdonate-card__cta {
  opacity: 1;
  transform: translateX(0);
}

@media (max-width: 768px) {
  .pmdonate-card {
    padding: 10px;
    border-radius: 16px;
  }
  .pmdonate-card__image {
    height: 132px;
  }
  .pmdonate-card__image img {
    padding: 4px;
  }
  .pmdonate-card__body {
    padding-top: 10px;
    gap: 6px;
  }
  .pmdonate-card__title {
    font-size: 12px;
  }
  .pmdonate-price-old {
    font-size: 10px;
  }
  .pmdonate-price-new {
    font-size: 14px;
  }
  /* на мобилке CTA всегда видна, цены остаются столбно */
  .pmdonate-card__cta {
    opacity: 1;
    transform: none;
    font-size: 10px;
    padding: 6px 10px;
  }
  .pmdonate-card:hover .pmdonate-card__image img {
    transform: none;
  }
}

/* Badges */
.pmdonate-card__badges {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 2;
  pointer-events: none;
  align-items: flex-start;
}

.pmdonate-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  width: fit-content;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.pmdonate-badge-popular {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.pmdonate-badge-discount {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

.pmdonate-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--transparent-grey, rgba(255, 255, 255, 0.75));
  padding: 48px 20px;
  font-size: 16px;
  margin: 0;
}

.pmdonate-empty-filter {
  text-align: center;
  padding: 40px 16px;
  color: var(--grey, #7f8c8d);
}

.pmdonate-empty-filter[hidden] {
  display: none !important;
}

.pmdonate-btn-reset {
  margin-top: 12px;
  padding: 12px 24px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}

/* ---- Product single: pay methods ---- */
.pmd-pay-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pmd-pay-method {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border: 1px solid var(--border-grey, var(--border, #343536));
  border-radius: 14px;
  background: var(--white, #222424);
  cursor: pointer;
  color: var(--black, #FAFEFF);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.pmd-pay-method img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  display: block;
}

.pmd-pay-method:hover,
.pmd-pay-method:focus-visible {
  border-color: var(--color-accent, #f97316);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
  outline: none;
}

.pmd-pay-method.is-loading {
  opacity: 0.55;
  pointer-events: none;
}

.pmd-pay-hint {
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--grey, #7f8c8d);
}

/* Sticky buy mobile */
.pmd-sticky-buy {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(18, 18, 20, 0.96), rgba(18, 18, 20, 0.88));
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  transform: translateY(110%);
  transition: transform 0.25s ease;
  display: none;
}

.pmd-sticky-buy--show {
  transform: translateY(0);
}

.pmd-sticky-buy__btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(249, 115, 22, 0.35);
}

@media (max-width: 768px) {
  .pmd-sticky-buy {
    display: block;
  }
  #pmd-purchase-form input,
  #pmd-purchase-form select,
  #pmd-confirm-buy {
    font-size: 16px !important;
  }
}

/* Toast front */
.pmd-toast-wrap {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100001;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 360px);
  pointer-events: none;
}

.pmd-toast {
  pointer-events: auto;
  padding: 12px 16px;
  border-radius: 12px;
  background: #1e1f22;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.pmd-toast-success {
  border-color: rgba(34, 197, 94, 0.4);
}
.pmd-toast-error {
  border-color: rgba(239, 68, 68, 0.45);
}
.pmd-toast-warning {
  border-color: rgba(245, 158, 11, 0.45);
}

/* Single product image (legacy) */
.pmd-single-image {
  flex: 0 0 280px;
  width: 280px;
  height: 280px;
  max-width: 100%;
  border-radius: 22px;
  overflow: hidden;
  background: var(--bg-soft, #2C3030);
  border: 1px solid var(--border, #343536);
}

.pmd-single-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  padding: 16px;
  display: block;
}

@media (max-width: 768px) {
  .pmd-single-image {
    flex: 0 0 200px;
    width: 200px;
    height: 200px;
    border-radius: 18px;
  }
}

@media (max-width: 576px) {
  .pmd-single-image {
    flex: 1 1 100%;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    max-width: 260px;
    margin: 0 auto;
  }
}

/* Legacy class alias used in theme */
.pmd-shop .pmdonate-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
