/* Products page — Maui ProductsPage list parity (Phase 4.1) */

.dz-products {
  display: flex;
  flex-direction: column;
  gap: 10px;
  direction: rtl;
}

.dz-products-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 14px;
  border-radius: 24px;
  background: var(--dz-surface);
  border: 1px solid var(--dz-border);
  box-shadow: var(--dz-field-shadow);
  direction: ltr; /* آیکن‌ها چپ، متن راست — مثل Maui */
}

.dz-products-search__actions {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dz-products-search__ico {
  width: 20px;
  height: 20px;
  color: var(--dz-text-muted);
  display: inline-flex;
  flex-shrink: 0;
}

.dz-products-search__ico .dz-ico {
  width: 20px;
  height: 20px;
}

.dz-products-search input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 16px; /* iOS Safari: avoid focus-zoom */
  color: var(--dz-text);
  text-align: right;
  min-width: 0;
  direction: rtl;
}

.dz-products-search input::-webkit-search-cancel-button,
.dz-products-search input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.dz-products-search input::placeholder {
  color: var(--dz-gray-400);
}

.dz-products-search__spin {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--dz-primary-dark) 25%, transparent);
  border-top-color: var(--dz-primary-dark);
  animation: dz-prod-spin 0.75s linear infinite;
}

.dz-products-search__clear {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--dz-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.dz-products-search__clear .dz-ico {
  width: 16px;
  height: 16px;
}

.dz-products-search__clear:hover {
  color: var(--dz-primary-dark);
  background: color-mix(in srgb, var(--dz-primary) 10%, transparent);
}

.dz-products-toolbar {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  /* جا برای بج فیلتر تا بریده نشود */
  padding: 8px 4px 4px;
  scrollbar-width: none;
  direction: ltr;
  /* جلوگیری از پرش افقی لحظه‌ای اسکرول در کروم */
  overscroll-behavior-x: contain;
}

.dz-products-toolbar::-webkit-scrollbar {
  display: none;
}

.dz-products-tools {
  display: flex;
  flex-direction: row;
  gap: 6px;
  flex-shrink: 0;
  direction: ltr; /* نمایش | فیلتر */
  padding-top: 2px;
}

.dz-products-tool {
  position: relative;
  width: 34px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid var(--dz-gray-400);
  background: transparent;
  color: var(--dz-gray-400);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  overflow: visible;
}

.dz-products-tool__badge {
  position: absolute;
  top: -6px;
  left: -6px;
  z-index: 2;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: #fff;
  color: var(--dz-primary);
  font-size: 0.55rem;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  box-shadow: 0 0 0 1px var(--dz-primary);
}

.dz-products-tool .dz-ico {
  width: 16px;
  height: 16px;
}

.dz-products-tool.is-on {
  background: var(--dz-primary);
  border-color: transparent;
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .dz-products-tool.is-on {
    background: var(--dz-secondary-dark, var(--dz-primary-dark));
    color: #fff;
  }
}

.dz-products-chips {
  display: flex;
  gap: 4px;
  flex: 0 1 auto;
  min-width: 0;
  justify-content: flex-start;
  overflow-x: auto;
  scrollbar-width: none;
  direction: rtl; /* ترتیب چیپ‌ها از راستِ گروه: جدیدترین … */
}

.dz-products-chips::-webkit-scrollbar {
  display: none;
}

.dz-products-chip {
  flex: 0 0 auto;
  border: 0;
  border-radius: 10px;
  padding: 3px 10px;
  font-family: inherit;
  font-size: 0.625rem;
  font-weight: 400;
  cursor: pointer;
  background: transparent;
  color: var(--dz-gray-400);
  border: 1px solid var(--dz-gray-400);
  white-space: nowrap;
}

.dz-products-chip.is-on {
  background: var(--dz-primary);
  color: #fff;
  border-color: transparent;
  font-weight: 700;
}

@media (prefers-color-scheme: dark) {
  .dz-products-chip.is-on {
    background: var(--dz-secondary-dark, var(--dz-primary-dark));
    color: #fff;
  }
}

.dz-products-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 20px 16px 28px;
  color: var(--dz-gray-400);
  font-size: 0.9rem;
  font-weight: 700;
}

.dz-products-loading__spin {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--dz-primary-dark) 22%, transparent);
  border-top-color: var(--dz-primary-dark);
  animation: dz-prod-spin 0.75s linear infinite;
}

.dz-products-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 0 4px;
}

.dz-product-row {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  column-gap: 8px;
  align-items: center;
  height: 88px;
  padding: 0;
  margin: 3.5px 0;
  border-radius: 16px;
  background: var(--dz-surface);
  border: 1px solid var(--dz-gray-200);
  overflow: hidden;
  cursor: pointer;
  text-align: right;
  font-family: inherit;
  color: inherit;
  width: 100%;
  direction: rtl;
  box-shadow: none;
}

.dz-product-row.is-buy {
  border-color: var(--dz-primary-dark);
}

.dz-product-row.is-need {
  border-color: var(--dz-status-download);
}

.dz-product-row.is-ready {
  border-color: var(--dz-gray-200);
}

.dz-product-row__cover {
  width: 88px;
  height: 88px;
  object-fit: cover;
  background: var(--dz-gray-100);
  display: block;
}

.dz-product-row__cover.is-dim {
  opacity: 0.4;
}

.dz-product-row__body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  padding: 8px 0;
}

.dz-product-row__name {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--dz-primary-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.dz-product-row__date {
  margin: 0;
  font-size: 0.625rem;
  color: var(--dz-gray-400);
  font-weight: 400;
}

.dz-product-row__meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px 0 14px;
  min-width: 0;
  color: var(--dz-primary-dark);
}

.dz-product-row__ico {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  display: inline-flex;
  color: inherit;
}

.dz-product-row__ico .dz-ico {
  width: 17px;
  height: 17px;
}

.dz-product-row__badge,
.dz-product-row__price {
  font-size: 0.75rem;
  white-space: nowrap;
  line-height: 1.2;
  color: inherit;
}

.dz-product-row__price {
  font-weight: 700;
}

.dz-product-row.is-buy .dz-product-row__meta {
  color: var(--dz-primary-dark);
}

.dz-product-row.is-need .dz-product-row__meta {
  color: var(--dz-status-download);
}

.dz-product-row.is-ready .dz-product-row__meta {
  color: var(--dz-status-ready);
}

@media (prefers-color-scheme: dark) {
  .dz-product-row.is-buy {
    border-color: #9f58e1;
  }

  .dz-product-row.is-ready {
    border-color: var(--dz-gray-600);
  }

  .dz-product-row__name {
    color: var(--dz-secondary-dark, #9f58e1);
  }

  .dz-product-row.is-buy .dz-product-row__meta {
    color: #9f58e1;
  }
}

.dz-products-empty,
.dz-products-error {
  text-align: center;
  padding: 28px 16px;
  color: var(--dz-text-muted);
  font-weight: 700;
  font-size: 0.9rem;
  background: var(--dz-surface);
  border-radius: 16px;
  border: 1px solid var(--dz-border);
}

.dz-products-more {
  margin: 4px auto 0;
  max-width: 220px;
}

.dz-products-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 0;
  padding: 0 0 4px;
}

.dz-product-card {
  display: flex;
  flex-direction: column;
  height: 256px;
  margin: 0 7px 0;
  border: 1px solid var(--dz-gray-200);
  border-radius: 16px;
  background: var(--dz-surface);
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  text-align: center;
  box-shadow: none;
}

.dz-product-card.is-buy {
  border-color: var(--dz-primary-dark);
}

.dz-product-card.is-need {
  border-color: var(--dz-status-download);
}

.dz-product-card.is-ready {
  border-color: var(--dz-gray-200);
}

.dz-product-card__cover {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
  background: var(--dz-gray-100);
  flex-shrink: 0;
}

.dz-product-card__cover.is-dim {
  opacity: 0.4;
}

.dz-product-card__body {
  padding: 8px 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 0;
}

.dz-product-card__name {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--dz-primary-dark);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  width: 100%;
  text-align: center;
  /* فارسی: نزول حروف خط دوم با clamp بریده نشود */
  padding-bottom: 0.15em;
  box-decoration-break: clone;
}

.dz-product-card__meta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--dz-primary-dark);
  max-width: 100%;
}

.dz-product-card__ico {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  display: inline-flex;
  color: inherit;
}

.dz-product-card__ico .dz-ico {
  width: 17px;
  height: 17px;
}

.dz-product-card__badge {
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: inherit;
}

.dz-product-card__price {
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  color: inherit;
}

.dz-product-card__date {
  margin: 0;
  font-size: 0.625rem;
  color: var(--dz-gray-400);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.dz-product-card.is-buy .dz-product-card__meta {
  color: var(--dz-primary-dark);
}

.dz-product-card.is-need .dz-product-card__meta {
  color: var(--dz-status-download);
}

.dz-product-card.is-ready .dz-product-card__meta {
  color: var(--dz-status-ready);
}

@media (prefers-color-scheme: dark) {
  .dz-product-card.is-buy {
    border-color: #9f58e1;
  }

  .dz-product-card.is-ready {
    border-color: var(--dz-gray-600);
  }

  .dz-product-card__name {
    color: var(--dz-secondary-dark, #9f58e1);
  }

  .dz-product-card.is-buy .dz-product-card__meta {
    color: #9f58e1;
  }
}

.dz-products-sentinel {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0 8px;
}

.dz-products-loadmore {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--dz-text-muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.dz-products-loadmore__spin {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, var(--dz-primary-dark) 25%, transparent);
  border-top-color: var(--dz-primary-dark);
  animation: dz-prod-spin 0.75s linear infinite;
}

@keyframes dz-prod-spin {
  to { transform: rotate(360deg); }
}

.dz-products-filterbar {
  display: flex;
  align-items: center;
  gap: 8px;
  direction: rtl;
  padding: 0 2px;
}

.dz-products-filterbar__text {
  flex: 1;
  min-width: 0;
  font-size: 0.7rem;
  color: var(--dz-gray-400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dz-products-filterbar__clear {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: var(--dz-primary-dark);
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

/* Filter modal — theme tokens only (avoid inverted gray-* as backgrounds) */
.dz-filter-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: var(--dz-modal-scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.dz-filter-modal {
  --dz-filter-panel: #f5f3f8;
  --dz-filter-chip-bg: #ffffff;
  --dz-filter-chip-fg: #6e6e6e;
  --dz-filter-on-bg: #350066;
  --dz-filter-on-fg: #ffffff;
  --dz-filter-title: #350066;
  --dz-filter-apply: #350066;
  --dz-filter-apply-fg: #ffffff;
  --dz-filter-clear: #919191;
  --dz-filter-clear-fg: #ffffff;

  width: min(320px, 100%);
  max-height: min(80vh, 560px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 18px 16px;
  border-radius: 18px;
  background: var(--dz-surface);
  color: var(--dz-text);
  border: 1px solid var(--dz-border);
  direction: rtl;
  box-shadow: var(--dz-shadow-soft);
}

.dz-filter-modal__title {
  margin: 0;
  text-align: center;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--dz-filter-title);
}

.dz-filter-modal__sub,
.dz-filter-modal__empty,
.dz-filter-modal__loading {
  margin: 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--dz-text-muted);
}

.dz-filter-modal__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 0;
}

.dz-filter-section {
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--dz-filter-panel);
}

.dz-filter-section__label {
  margin: 0 0 8px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--dz-filter-title);
}

.dz-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.dz-filter-chip {
  border: 0;
  border-radius: 20px;
  padding: 7px 12px;
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  background: var(--dz-filter-chip-bg);
  color: var(--dz-filter-chip-fg);
}

.dz-filter-chip.is-on {
  background: var(--dz-filter-on-bg);
  color: var(--dz-filter-on-fg);
  font-weight: 700;
}

.dz-filter-modal__loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 8px;
  font-size: 0.85rem;
  font-weight: 700;
}

.dz-filter-modal__actions {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: stretch;
  gap: 10px;
  margin-top: 8px;
  direction: rtl;
}

.dz-filter-btn {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  margin: 0;
  border: 0;
  border-radius: 14px;
  min-height: 44px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dz-filter-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.dz-filter-btn--apply {
  background: var(--dz-filter-apply);
  color: var(--dz-filter-apply-fg);
}

.dz-filter-btn--clear {
  background: var(--dz-filter-clear);
  color: var(--dz-filter-clear-fg);
}

@media (prefers-color-scheme: dark) {
  .dz-filter-modal {
    --dz-filter-panel: #2a2a2a;
    --dz-filter-chip-bg: #3a3a3a;
    --dz-filter-chip-fg: #e8e8e8;
    --dz-filter-on-bg: var(--dz-secondary-dark);
    --dz-filter-on-fg: #ffffff;
    --dz-filter-title: var(--dz-secondary-dark-text);
    --dz-filter-apply: var(--dz-secondary-dark);
    --dz-filter-apply-fg: #ffffff;
    --dz-filter-clear: #555555;
    --dz-filter-clear-fg: #f0f0f0;

    background: #1c1c1e;
    border-color: #333333;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  }

  .dz-products-filterbar__clear {
    color: var(--dz-secondary-dark-text);
  }

  .dz-products-tool__badge {
    background: #1a1028;
    color: var(--dz-secondary-dark-text);
    box-shadow: 0 0 0 1px var(--dz-secondary-dark);
  }
}

/* Purchase modal — Maui PurchasePopup parity */
.dz-buy-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: rgba(0, 0, 0, 0.53);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.dz-buy-modal {
  width: min(70vw, 340px);
  max-height: min(92vh, 680px);
  overflow: visible;
  border-radius: 20px;
  background: transparent;
  direction: rtl;
  filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.45))
          drop-shadow(0 6px 14px rgba(25, 6, 73, 0.35));
}

.dz-buy-modal__stage {
  position: relative;
  border-radius: 12px;
  background: var(--dz-surface);
  border: 1px solid var(--dz-border);
  box-shadow:
    0 24px 56px rgba(0, 0, 0, 0.38),
    0 10px 24px rgba(25, 6, 73, 0.32),
    0 2px 6px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  min-height: 360px;
}

.dz-buy-modal__cover-wrap {
  position: absolute;
  inset: 0 0 auto;
  height: 250px;
  overflow: hidden;
  pointer-events: none;
}

.dz-buy-modal__cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  opacity: 0;
  /* Maui FadeTo CoverTargetOpacity 0.6 / 1000ms SinIn */
  transition: opacity 1000ms cubic-bezier(0.47, 0, 0.745, 0.715);
}

.dz-buy-modal__cover.is-in {
  opacity: 0.6;
}

.dz-buy-modal__cover-fade {
  position: absolute;
  inset: 0;
  height: 325px;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, #aaaaaa 33%, transparent) 0%,
    var(--dz-surface) 55%
  );
  pointer-events: none;
}

.dz-buy-modal__body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 16px 18px 16px;
  text-align: center;
  min-height: 360px;
}

.dz-buy-modal__content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 0;
  padding: 8px 0 12px;
}

.dz-buy-modal__eyebrow {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--dz-primary-dark);
}

.dz-buy-modal__name {
  margin: 0 0 4px;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--dz-primary);
  text-shadow: 2px 2px 6px color-mix(in srgb, var(--dz-secondary) 35%, transparent);
}

.dz-buy-modal__price-row {
  margin: 0 0 4px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  font-size: 0.9rem;
  color: var(--dz-text);
}

.dz-buy-modal__price-row strong {
  color: var(--dz-secondary);
  font-weight: 700;
}

.dz-buy-modal__balance {
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.75rem;
  line-height: 1.2;
  white-space: nowrap;
  max-width: none;
}

.dz-buy-modal__balance-text {
  white-space: nowrap;
}

.dz-buy-modal__balance-ico {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  display: inline-flex;
}

.dz-buy-modal__balance-ico .dz-ico {
  width: 15px;
  height: 15px;
}

.dz-buy-modal__balance.is-ok {
  color: darkgreen;
}

.dz-buy-modal__balance.is-ok .dz-buy-modal__balance-ico {
  color: darkgreen;
}

.dz-buy-modal__balance.is-low {
  color: #9e0b0f; /* Maui DarkRed */
}

.dz-buy-modal__balance.is-low .dz-buy-modal__balance-ico {
  color: #9e0b0f;
}

.dz-buy-modal__balance.is-hidden,
.dz-buy-modal__balance.is-leaving {
  opacity: 0;
  pointer-events: none;
  max-height: 0;
  margin: 0;
  overflow: hidden;
  transition: opacity 200ms ease, max-height 200ms ease;
}

.dz-buy-modal__actions {
  width: 100%;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 4px;
  min-height: 110px;
  justify-content: center;
}

.dz-buy-pay-block,
.dz-buy-gateways,
.dz-buy-topup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  opacity: 0;
  transition: opacity 200ms ease;
}

.dz-buy-pay-block.is-in,
.dz-buy-gateways.is-in,
.dz-buy-topup.is-in {
  opacity: 1;
}

.dz-buy-pay-block.is-leaving,
.dz-buy-gateways.is-leaving,
.dz-buy-topup.is-leaving {
  opacity: 0;
}

.dz-buy-gateways {
  gap: 3px; /* Maui RowSpacing=3 */
}

.dz-buy-gw {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 150px;
  height: 50px;
  padding: 8px;
  border: 1px solid #b0b0b0;
  background: transparent;
  opacity: 0.35;
  cursor: pointer;
  overflow: hidden;
  transition:
    opacity 100ms ease,
    border-color 100ms ease,
    background-color 100ms ease,
    transform 100ms ease;
}

.dz-buy-gw--saman {
  border-radius: 8px;
}

.dz-buy-gw--mellat {
  border-radius: 10px;
}

.dz-buy-gw--side {
  width: auto;
  min-width: 0;
  flex: 1 1 0;
  padding: 5px;
}

.dz-buy-gw:disabled {
  cursor: default;
}

.dz-buy-gw.is-ready {
  opacity: 1;
}

.dz-buy-gw.is-disabled {
  opacity: 0.3;
  pointer-events: none;
}

.dz-buy-gw.is-selected.dz-buy-gw--saman {
  opacity: 1;
  border-color: #0078d7;
  background: #e6f2fa;
}

.dz-buy-gw.is-selected.dz-buy-gw--mellat {
  opacity: 1;
  border-color: #c8102e;
  background: #fae6e8;
}

.dz-buy-gw.is-press {
  transform: scale(0.95);
}

.dz-buy-gw.is-transfer {
  transform: scale(1);
}

.dz-buy-gw.is-other {
  opacity: 0.35;
  transform: scale(0.8);
}

.dz-buy-gw__logo {
  height: 28px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  pointer-events: none;
  opacity: 1;
  transition: opacity 100ms ease;
}

.dz-buy-gw__logo.is-out {
  opacity: 0;
  position: absolute;
  visibility: hidden;
}

.dz-buy-gw__transfer {
  display: none;
  font-size: 0.75rem; /* Maui 12 */
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 100ms ease;
}

.dz-buy-gw--side .dz-buy-gw__transfer {
  font-size: 0.6875rem; /* keep one line in half-width top-up gateways */
}

.dz-buy-gw__transfer.is-saman {
  color: #0078d7;
}

.dz-buy-gw__transfer.is-mellat {
  color: #c8102e;
}

.dz-buy-gw__transfer.is-in {
  display: block;
  opacity: 1;
}

.dz-buy-topup {
  gap: 5px;
  padding-bottom: 4px;
}

.dz-buy-topup__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 14px;
  border-radius: 70px;
  background: var(--dz-primary);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
}

.dz-buy-topup__badge .dz-ico {
  width: 18px;
  height: 18px;
}

.dz-buy-topup__entry {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 0 10px;
  border: 1px solid #b0b0b0;
  border-radius: 10px;
  min-height: 44px;
  background: transparent;
}

.dz-buy-topup__input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 16px; /* iOS Safari: avoid focus-zoom (1rem was 15px) */
  text-align: center;
  color: var(--dz-text);
  outline: none;
}

.dz-buy-topup__input::placeholder {
  color: color-mix(in srgb, var(--dz-text) 45%, transparent);
  font-size: 0.85rem;
}

.dz-buy-topup__rial {
  flex: 0 0 auto;
  font-size: 0.875rem;
  opacity: 0.6;
  color: var(--dz-primary-dark);
}

.dz-buy-topup__gws {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  width: 100%;
}

.dz-buy-btn {
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 40px;
  min-height: 50px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.dz-buy-btn--pill {
  border-radius: 80px; /* Maui BtnDirectPay CornerRadius 80 */
}

.dz-buy-btn--wallet {
  border-radius: 40px; /* Maui BtnWalletAction RoundRectangle 40 */
  height: 50px;
}

.dz-buy-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.dz-buy-btn--primary {
  background: var(--dz-primary);
  color: #fff;
  box-shadow: inset 0 0 0 2px var(--dz-primary);
}

.dz-buy-btn--outline {
  background: transparent;
  color: var(--dz-primary-dark);
  box-shadow: inset 0 0 0 2px var(--dz-primary-dark);
}

.dz-buy-btn__spin {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, #fff 35%, transparent);
  border-top-color: #fff;
  animation: dz-spin 0.7s linear infinite;
}

.dz-buy-btn--outline .dz-buy-btn__spin {
  border-color: color-mix(in srgb, var(--dz-primary-dark) 25%, transparent);
  border-top-color: var(--dz-primary-dark);
}

/* Maui footer labels: انصراف | بازگشت */
.dz-buy-footer {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding-top: 8px;
  opacity: 1;
  transition: opacity 200ms ease;
}

.dz-buy-footer.is-leaving {
  opacity: 0;
}

.dz-buy-footer__sep {
  margin: 0 25px;
  color: var(--dz-gray-200, #c8c8c8);
  user-select: none;
}

.dz-buy-link {
  margin: 0;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--dz-gray-600, #404040);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  transition: transform 90ms ease, opacity 120ms ease;
}

.dz-buy-link:disabled {
  opacity: 0.45;
  cursor: default;
}

.dz-buy-link.is-press {
  transform: scale(0.8);
}

.dz-buy-link.is-dim {
  opacity: 0.2;
}

.dz-buy-link--back {
  color: var(--dz-primary);
}

.dz-buy-link--back .dz-ico {
  width: 12px;
  height: 12px;
}

.dz-buy-feedback {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 20px 20px;
  min-height: 360px;
  text-align: center;
  animation: dz-buy-feedback-in 300ms ease-out;
  background: var(--dz-surface);
}

.dz-buy-feedback__lottie {
  width: 125px;
  height: 125px;
}

.dz-buy-feedback__msg {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--dz-primary);
  line-height: 1.35;
}

/* Success copy stays on one line (خرید / افزایش اعتبار) */
.dz-buy-feedback.is-success .dz-buy-feedback__msg {
  white-space: nowrap;
  max-width: none;
}

.dz-buy-feedback.is-fail .dz-buy-feedback__msg {
  color: #9e0b0f; /* Maui DarkRed */
  max-width: 28ch;
  white-space: normal;
}

.dz-buy-feedback .dz-buy-link {
  margin-top: 4px;
}

.dz-buy-feedback__bar {
  width: 120px;
  height: 8px;
  margin-top: 50px; /* Maui Margin 0,50,0,0 */
  border-radius: 5px;
  background: color-mix(in srgb, #8a2be2 18%, transparent);
  overflow: hidden;
}

.dz-buy-feedback__bar span {
  display: block;
  height: 100%;
  width: 0;
  background: #8a2be2; /* Maui Secondary / ProgressColor */
  border-radius: 5px;
  animation: dz-buy-bar 2s linear forwards;
}

.dz-buy-feedback__bar.is-fail {
  background: color-mix(in srgb, #9e0b0f 18%, transparent);
}

.dz-buy-feedback__bar.is-fail span {
  background: #9e0b0f;
}

@keyframes dz-buy-feedback-in {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes dz-buy-bar {
  from { width: 0; }
  to { width: 100%; }
}

.dz-product-row.is-just-bought,
.dz-product-card.is-just-bought {
  animation: dz-bought-pulse 0.85s ease-out;
}

@keyframes dz-bought-pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 color-mix(in srgb, var(--dz-status-ready) 45%, transparent); }
  35% { transform: scale(1.03); box-shadow: 0 0 0 6px color-mix(in srgb, var(--dz-status-ready) 22%, transparent); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 transparent; }
}

@media (prefers-color-scheme: dark) {
  .dz-buy-modal {
    filter: drop-shadow(0 22px 48px rgba(0, 0, 0, 0.75))
            drop-shadow(0 8px 18px rgba(0, 0, 0, 0.55));
  }

  .dz-buy-modal__stage,
  .dz-buy-feedback {
    background: #1c1c1e;
    border-color: #333;
    box-shadow:
      0 28px 64px rgba(0, 0, 0, 0.72),
      0 10px 24px rgba(0, 0, 0, 0.5);
  }

  .dz-buy-modal__cover-fade {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.53) 0%, #1c1c1e 55%);
  }

  .dz-buy-modal__eyebrow,
  .dz-buy-modal__name {
    color: var(--dz-secondary-dark-text);
  }

  .dz-buy-modal__name {
    text-shadow: 2px 2px 6px color-mix(in srgb, var(--dz-secondary-dark-text) 30%, transparent);
  }

  .dz-buy-modal__price-row strong {
    color: var(--dz-secondary-dark);
  }

  .dz-buy-modal__balance.is-ok,
  .dz-buy-modal__balance.is-ok .dz-buy-modal__balance-ico {
    color: limegreen;
  }

  .dz-buy-modal__balance.is-low,
  .dz-buy-modal__balance.is-low .dz-buy-modal__balance-ico {
    color: #ed1c24; /* Maui Red */
  }

  .dz-buy-btn--primary {
    background: var(--dz-secondary-dark);
    color: #fff;
    box-shadow: inset 0 0 0 2px var(--dz-secondary-dark);
  }

  .dz-buy-btn--outline {
    color: var(--dz-secondary-dark);
    box-shadow: inset 0 0 0 2px var(--dz-secondary-dark);
  }

  .dz-buy-topup__badge {
    background: var(--dz-primary); /* Maui StaticResource Primary (same both themes) */
  }

  .dz-buy-topup__rial {
    color: var(--dz-secondary-dark-text);
  }

  .dz-buy-footer__sep {
    color: #acacac; /* Gray300 */
  }

  .dz-buy-link {
    color: #acacac; /* Maui Gray300 */
  }

  .dz-buy-link--back {
    color: #acacac;
  }

  .dz-buy-feedback__msg {
    color: var(--dz-secondary-dark-text);
  }

  .dz-buy-feedback.is-fail .dz-buy-feedback__msg {
    color: #ed1c24;
  }

  .dz-buy-feedback__bar.is-fail {
    background: color-mix(in srgb, #ed1c24 18%, transparent);
  }

  .dz-buy-feedback__bar.is-fail span {
    background: #ed1c24;
  }
}

/* فقط وقتی قاب دسکتاپ پهن است (container روی body فقط ≥900px ست می‌شود) */
@container dz-stage (min-width: 450px) {
  .dz-products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px 4px;
  }

  .dz-product-card {
    height: 240px;
    margin: 0 4px;
  }

  .dz-product-card__cover {
    height: 120px;
  }

  .dz-product-card__name {
    font-size: 0.85rem;
  }
}
