/* ============================================================
   Digital Store — адаптация под шаблон PRIME
   ============================================================ */

/* --- Шапка раздела (резерв, если темплейт не подхватил page-head) --- */
.ds-layout .page-head-back {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--card2);
  border: 1px solid var(--divider);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-second);
  flex-shrink: 0;
  transition: border-color .15s, color .15s;
  text-decoration: none;
}
.ds-layout .page-head-back:hover {
  border-color: rgba(0, 158, 255, .35);
  color: var(--accent);
}
.ds-layout .page-head-back svg { width: 16px; height: 16px; }

/* --- Сетка: товары + сайдбар --- */
.ds-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}
.ds-main { min-width: 0; }

/* --- Сетка карточек товаров --- */
.ds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

/* Если категория пуста — текст «Категория пуста» от движка */
.ds-grid:empty,
.ds-grid {
  color: var(--text-second);
}

/* --- Карточка товара --- */
.ds-card {
  display: flex;
  flex-direction: column;
  background: var(--hover);
  border: 1px solid var(--divider);
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.ds-card:hover {
  border-color: rgba(0, 158, 255, .4);
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .35);
}

.ds-card-img {
  position: relative;
  height: 170px;
  background-color: #1a1a1b;
  background-size: cover;
  background-position: center;
}
.ds-card-img::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(23, 23, 23, .85) 0%, rgba(23, 23, 23, .15) 45%, transparent 100%);
}

.ds-card-price {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 11px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .2px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  box-shadow: 0 4px 12px rgba(0, 158, 255, .35);
}

.ds-card-stock {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-white);
  background: rgba(0, 0, 0, .5);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, .08);
}
.ds-card-stock i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2ecc71;
  box-shadow: 0 0 6px rgba(46, 204, 113, .8);
}
.ds-card-stock.is-empty {
  color: #ff6b6b;
  border-color: rgba(255, 107, 107, .3);
  background: rgba(255, 107, 107, .12);
}

.ds-card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 13px 14px 14px;
  flex: 1;
}
.ds-card-name {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-white);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ds-card-action {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 36px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(0, 158, 255, .08);
  border: 1px solid rgba(0, 158, 255, .2);
  transition: background .15s, color .15s, border-color .15s;
}
.ds-card-action svg { width: 14px; height: 14px; transition: transform .15s; }
.ds-card:hover .ds-card-action {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border-color: transparent;
  color: #fff;
}
.ds-card:hover .ds-card-action svg { transform: translateX(3px); }

/* ============================================================
   Сайдбар категорий
   ============================================================ */
.ds-side { min-width: 0; }
.ds-side-sticky {
  position: sticky;
  top: 16px;
  background: var(--hover);
  border: 1px solid var(--divider);
  border-radius: 14px;
  overflow: hidden;
  padding: 0;
}
.ds-side-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 15px;
  background: var(--card2);
  border-bottom: 1px solid var(--divider);
}
.ds-side-head-ico {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(0, 158, 255, .1);
  border: 1px solid rgba(0, 158, 255, .22);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ds-side-head-ico svg { width: 13px; height: 13px; color: var(--accent); }
.ds-side-head-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .9px;
  color: var(--text-dim);
}

.ds-cats {
  list-style: none;
  margin: 0;
  padding: 6px;
}
.ds-cats li { list-style: none; }
.ds-cats li a {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  text-decoration: none;
  transition: background .12s, color .12s, padding-left .12s;
}
.ds-cats li a::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--divider);
  margin-right: 10px;
  flex-shrink: 0;
  transition: background .12s, box-shadow .12s;
}
.ds-cats li a:hover {
  background: rgba(255, 255, 255, .03);
  color: var(--text-white);
  padding-left: 16px;
}
.ds-cats li a:hover::before { background: var(--accent); }
.ds-cats li.active a {
  color: var(--accent);
  background: rgba(0, 158, 255, .08);
  padding-left: 16px;
}
.ds-cats li.active a::before {
  background: var(--accent);
  box-shadow: 0 0 6px rgba(0, 158, 255, .6);
}

/* ============================================================
   Страница товара
   ============================================================ */
.ds-product {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  background: var(--hover);
  border: 1px solid var(--divider);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
}
.ds-product-media {
  height: 100%;
  min-height: 240px;
  border-radius: 12px;
  background-color: #1a1a1b;
  background-size: cover;
  background-position: center;
  border: 1px solid var(--divider);
}
.ds-product-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.ds-product-title {
  margin: 2px 0 16px;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--text-white);
}

.ds-product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}
.ds-meta-item {
  flex: 1;
  min-width: 130px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 11px;
  background: var(--card2);
  border: 1px solid var(--divider);
}
.ds-meta-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-dim);
}
.ds-meta-value {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-white);
}
.ds-meta-value.ds-price { color: var(--accent); }

.ds-buy-btn {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 50px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .3px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  box-shadow: 0 8px 22px rgba(0, 158, 255, .3);
  transition: transform .12s ease, box-shadow .15s ease, opacity .12s;
}
.ds-buy-btn svg { width: 19px; height: 19px; }
.ds-buy-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(0, 158, 255, .42); }
.ds-buy-btn:active { transform: translateY(0); }

/* --- Блок описания --- */
.ds-block {
  background: var(--hover);
  border: 1px solid var(--divider);
  border-radius: 14px;
  overflow: hidden;
}
.ds-block-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 16px;
  background: var(--card2);
  border-bottom: 1px solid var(--divider);
}
.ds-block-head-ico {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(0, 158, 255, .1);
  border: 1px solid rgba(0, 158, 255, .22);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ds-block-head-ico svg { width: 14px; height: 14px; color: var(--accent); }
.ds-block-head-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .9px;
  color: var(--text-dim);
}
.ds-block-body {
  padding: 18px 18px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-second);
}
.ds-block-body p { margin: 0 0 10px; }
.ds-block-body p:last-child { margin-bottom: 0; }
.ds-block-body img { max-width: 100%; height: auto; border-radius: 8px; }
.ds-block-body a { color: var(--accent); text-decoration: none; }
.ds-block-body a:hover { text-decoration: underline; }

/* ============================================================
   Модалка покупки
   ============================================================ */
#buy_modal .modal-content {
  background: var(--hover);
  border: 1px solid var(--divider);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .6);
}
#buy_modal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  background: var(--card2);
  border-bottom: 1px solid var(--divider);
}
#buy_modal .modal-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-white);
}
#buy_modal .modal-header .close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: var(--hover);
  border: 1px solid var(--divider);
  color: var(--text-second);
  font-size: 18px;
  line-height: 1;
  opacity: 1;
  text-shadow: none;
  transition: border-color .12s, color .12s;
}
#buy_modal .modal-header .close:hover {
  border-color: rgba(255, 107, 107, .4);
  color: #ff6b6b;
}
#buy_modal .modal-body {
  padding: 18px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-second);
}
#buy_modal .modal-body img { max-width: 100%; height: auto; border-radius: 8px; }
#buy_modal .modal-body a { color: var(--accent); text-decoration: none; }
#buy_modal .modal-footer {
  padding: 13px 18px;
  background: var(--card2);
  border-top: 1px solid var(--divider);
  text-align: right;
}
#buy_modal .modal-footer .btn {
  height: 38px;
  padding: 0 18px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-white);
  background: var(--hover);
  border: 1px solid var(--divider);
  cursor: pointer;
  transition: border-color .12s, color .12s;
}
#buy_modal .modal-footer .btn:hover {
  border-color: rgba(0, 158, 255, .35);
  color: var(--accent);
}

/* ============================================================
   Адаптив
   ============================================================ */
@media (max-width: 991px) {
  .ds-layout {
    grid-template-columns: 1fr;
  }
  .ds-side { order: -1; }
  .ds-side-sticky { position: static; }
}

@media (max-width: 600px) {
  .ds-product {
    grid-template-columns: 1fr;
  }
  .ds-product-media { min-height: 200px; }
  .ds-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }
  .ds-card-img { height: 140px; }
}
