/* Products / devices catalog + detail */
.products-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.products-hero-wrap {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 6.25rem 1.25rem 0;
}

.products-hero-wrap.hidden {
  display: none;
}

/* —— Products page hero (devices catalog) —— */
.products-page-hero.home-delivery-unified {
  padding: 0 0 1rem;
  background: transparent;
}

.products-page-hero__figure {
  margin: 0;
}

.products-page {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
  background: transparent;
}

.products-browse.hidden,
.product-detail:not(.active) {
  display: none;
}

.product-detail.active {
  display: block;
  animation: productsFadeIn 0.35s ease;
}

@keyframes productsFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.categories-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}

.cat-btn {
  padding: 0.48rem 1.15rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.cat-btn:hover,
.cat-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.25rem;
}

.product-card {
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.02) 48%, rgba(18, 14, 32, 0.42) 100%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 18px;
  overflow: hidden;
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.product-card:hover {
  border-color: rgba(234, 59, 6, 0.45);
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(234, 59, 6, 0.1);
}

.product-card__media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: radial-gradient(ellipse 80% 70% at 50% 40%, rgba(234, 59, 6, 0.08), rgba(0, 0, 0, 0.35));
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  cursor: pointer;
}

.product-card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  position: relative;
  z-index: 0;
}

.product-card-stock {
  display: flex;
  align-items: center;
}

.product-card-stock .product-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
}

.product-card-body {
  padding: 1.1rem 1.15rem 1.15rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.product-card-cat {
  font-size: 0.72rem;
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.product-card-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.45;
  cursor: pointer;
}

.product-card-desc {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-top: 0.35rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.product-price {
  display: inline-flex;
  align-items: baseline;
  gap: 0.2rem;
  font-weight: 800;
  color: var(--primary);
  direction: ltr;
  unicode-bidi: isolate;
  flex-wrap: wrap;
}

.product-price .price-num {
  font-size: 1.25rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.product-price .price-currency {
  font-size: 1.1rem;
  vertical-align: middle;
  margin: 0 0.12em;
}

.product-price-before {
  display: inline-flex;
  align-items: center;
  font-size: 0.56em;
  color: rgba(255, 255, 255, 0.48);
  text-decoration: line-through;
  font-weight: 500;
  position: relative;
  top: -0.5em;
  margin-inline-end: 0.12rem;
}

html[dir="rtl"] .product-price {
  direction: rtl;
  justify-content: flex-start;
}

html[dir="rtl"] .product-price .product-price-before { order: 1; }
html[dir="rtl"] .product-price .price-num { order: 2; }
html[dir="rtl"] .product-price .price-currency { order: 3; }

.product-badge {
  font-size: 0.72rem;
  padding: 0.32rem 0.68rem;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.35;
}

.badge-stock {
  background: rgba(22, 101, 52, 0.88);
  color: #bbf7d0;
  border: 1px solid rgba(74, 222, 128, 0.45);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
}

.badge-out {
  background: rgba(127, 29, 29, 0.92);
  color: #fff;
  border: 1px solid rgba(252, 165, 165, 0.45);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.32);
}

.product-card--out .product-card__media {
  opacity: 0.72;
}

.btn-view {
  padding: 0.48rem 0.95rem;
  border-radius: 10px;
  background: rgba(234, 59, 6, 0.14);
  color: #ffc9a8;
  border: 1px solid rgba(234, 59, 6, 0.35);
  font-size: 0.78rem;
  font-weight: 700;
  transition: background 0.2s, color 0.2s, transform 0.2s;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.btn-view:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-1px);
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: var(--text-secondary);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
}

.empty-state svg {
  width: 56px;
  height: 56px;
  opacity: 0.35;
  margin-bottom: 0.85rem;
}

/* —— Product detail —— */
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
  cursor: pointer;
  transition: color 0.2s;
  border: none;
  background: none;
  font-family: inherit;
  font-weight: 600;
  padding: 0.35rem 0;
}

.detail-back:hover { color: var(--primary); }

html[dir="rtl"] .detail-back svg { transform: scaleX(-1); }

.detail-panel {
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.015) 50%, rgba(0, 0, 0, 0.2) 100%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 22px;
  padding: clamp(1.15rem, 3vw, 1.75rem);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(1.5rem, 4vw, 2.5rem);
  align-items: start;
}

.detail-images {
  position: sticky;
  top: 5.5rem;
}

.detail-main-frame {
  aspect-ratio: 1;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: radial-gradient(ellipse 75% 65% at 50% 42%, rgba(234, 59, 6, 0.1), rgba(0, 0, 0, 0.38));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  overflow: hidden;
}

.detail-main-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.detail-thumbs {
  display: flex;
  gap: 0.55rem;
  margin-top: 0.85rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.detail-thumb {
  width: 68px;
  height: 68px;
  flex-shrink: 0;
  object-fit: contain;
  padding: 0.35rem;
  border-radius: 12px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: border-color 0.2s, opacity 0.2s;
  opacity: 0.72;
}

.detail-thumb:hover,
.detail-thumb.active {
  border-color: var(--primary);
  opacity: 1;
}

.detail-info {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.detail-cat {
  font-size: 0.78rem;
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.detail-info h1 {
  font-size: clamp(1.45rem, 3.2vw, 2rem);
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.35;
}

.detail-price {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  font-weight: 800;
  color: var(--primary);
  direction: ltr;
  unicode-bidi: isolate;
  padding: 0.65rem 0;
}

.detail-price .price-num {
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.detail-price .price-currency {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  margin: 0 0.12em;
}

.detail-price .old {
  display: inline-flex;
  align-items: center;
  font-size: 0.52em;
  color: rgba(255, 255, 255, 0.48);
  text-decoration: line-through;
  font-weight: 500;
  position: relative;
  top: -0.45em;
  margin-inline-end: 0.12rem;
}

html[dir="rtl"] .detail-price { direction: rtl; justify-content: flex-start; }
html[dir="rtl"] .detail-price .old { order: 1; }
html[dir="rtl"] .detail-price .price-num { order: 2; }
html[dir="rtl"] .detail-price .price-currency { order: 3; }

.detail-desc {
  color: var(--text-secondary);
  line-height: 1.85;
  font-size: 0.95rem;
  white-space: pre-line;
  padding: 1rem 1.05rem;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.detail-features {
  padding-top: 0.25rem;
}

.detail-features h3 {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 0.65rem;
  color: var(--text-primary);
}

.detail-features ul {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.detail-features li {
  padding: 0.55rem 0.75rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-features li::before {
  content: '';
  width: 7px;
  height: 7px;
  margin-top: 0.42rem;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}

.detail-actions {
  margin-top: 0.35rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 320px;
  padding: 0.95rem 1.5rem;
  border-radius: 14px;
  background: linear-gradient(135deg, #ea3b06, #c43305);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.2s, transform 0.2s, box-shadow 0.2s;
  min-height: 50px;
  box-shadow: 0 10px 28px rgba(234, 59, 6, 0.28);
}

.btn-order:hover:not(:disabled) {
  opacity: 0.95;
  transform: translateY(-1px);
}

.btn-order:disabled,
.btn-order.is-unavailable {
  opacity: 1;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  background: linear-gradient(135deg, #7f1d1d, #991b1b);
  color: #fff;
  border: 1px solid rgba(252, 165, 165, 0.42);
  -webkit-text-fill-color: #fff;
}

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.8rem 1.5rem;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 3000;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.toast.show { opacity: 1; }
.toast.error { background: #ef4444; }

@media (max-width: 900px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-images {
    position: static;
  }
}

@media (max-width: 768px) {
  .products-hero-wrap {
    padding-top: 5.5rem;
    padding-inline: 0.85rem;
  }

  .products-page {
    padding: 1.5rem 0.85rem 2.5rem;
  }

  .products-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .product-card-footer {
    flex-wrap: wrap;
  }

  .btn-view {
    width: 100%;
    text-align: center;
  }

  .product-badge {
    font-size: 0.8rem;
    padding: 0.38rem 0.78rem;
  }

  .detail-meta .product-badge {
    font-size: 0.82rem;
  }

  .btn-order {
    max-width: none;
  }
}
