body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f5f5f5;
}

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

img {
  max-width: 100%;
}

/* HEADER */
.header {
  padding: 20px;
  background: white;
  border-bottom: 1px solid #eee;
}

.logo {
  height: 64px;
  width: auto;
}

/* FILTERS */
.controls {
  display: flex;
  justify-content: center; /* центр */
  padding: 30px;
  background: white;
  border-bottom: 1px solid #eee;
}

/* ПОИСК */
.controls input {
  width: 100%;
  max-width: 600px; /* увеличили */
  padding: 14px 18px;
  font-size: 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
}

/* GRID */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  padding: 20px;
  align-items: stretch;
}

/* CARD */
.card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  height: 100%;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}

/* IMAGE */
.card img {
  width: 100%;
  height: 220px;
  object-fit: contain;
  background: #fafafa;
  padding: 10px;
}

/* CONTENT */
.card-content {
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

/* TITLE */
.card h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;

  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;

  min-height: 40px;
}

/* PRICE */
.price {
  font-size: 18px;
  font-weight: 700;
  margin-top: 5px;
}

/* BUTTON */
.card button {
  margin-top: auto;
  padding: 10px;
  border: none;
  background: linear-gradient(90deg, #4cd964, #cddc39);
  color: white;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  font-weight: 500;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* ========================= */
/* МОДАЛЬНОЕ ОКНО */
/* ========================= */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  overflow-y: auto;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  width: 100%;
  max-width: 1100px;
  border-radius: 16px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 25px;
  position: relative;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

/* TOP BLOCK */
.modal-top {
  display: flex;
  gap: 30px;
}

/* ГАЛЕРЕЯ */
.gallery {
  flex: 1;
}

.main-image {
  width: 100%;
  height: 420px;
  object-fit: contain;
  background: #fafafa;
  border-radius: 10px;
  cursor: zoom-in;
}

.thumbs {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.thumbs img {
  width: 70px;
  height: 70px;
  object-fit: contain;
  cursor: pointer;
  border: 1px solid #ddd;
  border-radius: 8px;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.88);
}

.image-viewer.active {
  display: flex;
}

.image-viewer img {
  max-width: 96vw;
  max-height: 94vh;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
  cursor: zoom-in;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.image-viewer.zoomed {
  align-items: flex-start;
  justify-content: flex-start;
  overflow: auto;
}

.image-viewer.zoomed img {
  max-width: none;
  max-height: none;
  cursor: zoom-out;
}

.image-viewer-close {
  position: fixed;
  top: 18px;
  right: 22px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #222;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}

/* ИНФО */
.modal-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.modal-info h2 {
  font-size: 22px;
  margin: 10px 0 0 0; /* опустили заголовок */
  font-weight: 600;
}

.modal-price {
  font-size: 24px;
  font-weight: 700;
}

.modal-category {
  font-size: 13px;
  color: #888;
}

.modal-tags {
  font-size: 13px;
  color: #666;
}

.modal-desc {
  font-size: 14px;
  line-height: 1.5;
  color: #444;
}

/* ПОДОБНЫЕ ТОВАРЫ */
.related {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #eee; /* линия-разделитель */
}

.related h3 {
  font-size: 18px;
  margin-bottom: 10px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.related-item {
  background: #fafafa;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
}

.related-item img {
  width: 100%;
  height: 80px;
  object-fit: contain;
}

.related-item div {
  font-size: 12px;
}

/* КРЕСТИК */
.close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 20px;
  cursor: pointer;
}

/* MORE CARD */
.more-card {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4cd964, #cddc39);
  color: white;
  text-align: center;
}

.more-content {
  padding: 20px;
}

.more-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.more-sub {
  font-size: 14px;
  opacity: 0.9;
}

/* TRACKER (выделенный блок) */
.tracker-box {
  margin-top: 20px;
  padding: 18px;
  background: linear-gradient(135deg, #fffbe6, #fff3c4);
  border: 2px solid #ffd84d;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(255, 200, 0, 0.25);
}

.tracker-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 8px;
  color: #8a6d00;
}

.tracker-text {
  font-size: 13px;
  color: #6b5a00;
  margin-bottom: 12px;
}

.tracker-form {
  display: flex;
  gap: 10px;
}

.tracker-form input {
  flex: 1;
  padding: 10px;
  border: 2px solid #ffd84d;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

.tracker-form input:focus {
  border-color: #ffb300;
  box-shadow: 0 0 0 3px rgba(255, 184, 0, 0.2);
}

.tracker-form button {
  padding: 10px 16px;
  border: none;
  background: linear-gradient(90deg, #ffcc00, #ff9900);
  color: #000;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.tracker-form button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 150, 0, 0.3);
}

.tracker-result {
  margin-top: 12px;
  font-size: 14px;
  font-weight: 500;
}

/* RESULT BASE */
.tracker-result {
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}

/* SUCCESS */
.tracker-success {
  background: #e6ffed;
  border: 2px solid #2ecc71;
  color: #0a5d2a;
}

/* ERROR */
.tracker-error {
  background: #ffe6e6;
  border: 2px solid #ff3b3b;
  color: #7a0000;
}

/* ========================= */
/* MOBILE MODAL */
/* ========================= */

@media (max-width: 768px) {
  .header {
    padding: 14px 16px;
    text-align: center;
  }

  .logo {
    height: 52px;
  }

  .controls {
    padding: 16px;
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .controls input {
    max-width: none;
    padding: 12px 14px;
    font-size: 16px;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 12px;
  }

  .card img {
    height: 150px;
    padding: 8px;
  }

  .card-content {
    padding: 12px;
    gap: 8px;
  }

  .card h3 {
    font-size: 13px;
    min-height: 34px;
  }

  .price {
    font-size: 16px;
  }

  .card button {
    padding: 9px;
    font-size: 13px;
  }

  .modal {
    align-items: flex-start;
    padding: 10px;
  }

  .modal-content {
    width: min(100%, 560px);
    padding: 16px;
    max-height: calc(100dvh - 20px);
    border-radius: 8px;
    overflow-y: auto;
    gap: 16px;
  }

  /* ГЛАВНОЕ — меняем направление */
  .modal-top {
    flex-direction: column;
    gap: 14px;
  }

  /* ГАЛЕРЕЯ ВВЕРХУ */
  .gallery {
    order: 1;
  }

  /* ФОТО */
  .main-image {
    height: min(58vw, 270px);
  }

  /* МИНИАТЮРЫ */
  .thumbs {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .thumbs img {
    width: 56px;
    height: 56px;
  }

  /* ОПИСАНИЕ НИЖЕ */
  .modal-info {
    order: 2;
  }

  /* ТЕКСТ компактнее */
  .modal-info h2 {
    font-size: 18px;
    line-height: 1.25;
    margin-right: 32px;
  }

  .modal-price {
    font-size: 20px;
  }

  .modal-desc {
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }

  .modal-sku,
  .modal-category,
  .modal-tags {
    font-size: 12px;
    line-height: 1.4;
  }

  .close {
    top: 10px;
    right: 12px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.92);
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    z-index: 2;
  }

  .tracker-box {
    padding: 14px;
  }

  .tracker-form {
    flex-direction: column;
  }

  .tracker-form button {
    width: 100%;
  }

  .related {
    margin-top: 10px;
    padding-top: 14px;
  }

  .related h3 {
    font-size: 16px;
  }

  /* ПОХОЖИЕ ТОВАРЫ */
  .related-grid {
    grid-template-columns: repeat(2, 1fr);
  }

}

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

  .card img {
    height: 190px;
  }

  .main-image {
    height: 230px;
  }

  .related-grid {
    grid-template-columns: 1fr;
  }
}

/* VISUAL SHOP POLISH */
body {
  background:
    linear-gradient(180deg, #ffffff 0, #f5f7f8 190px),
    #f5f7f8;
  color: #141414;
}

.header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 36px;
  box-shadow: 0 8px 28px rgba(20, 20, 20, 0.05);
}

.brand {
  display: inline-flex;
  align-items: center;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 14px;
}

.top-nav a,
.top-nav span {
  color: #555;
  text-decoration: none;
}

.top-nav a:hover {
  color: #151515;
}

.controls {
  display: block;
  padding: 28px 20px 10px;
  border-bottom: none;
  background: transparent;
}

.shop-panel {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px;
  border: 1px solid #e8ecef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(18, 29, 43, 0.06);
}

.shop-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.eyebrow {
  margin-bottom: 8px;
  color: #40bf62;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.shop-head h1 {
  margin: 0 0 8px;
  font-size: 34px;
  line-height: 1.15;
}

.shop-head p {
  max-width: 560px;
  margin: 0;
  color: #666;
  line-height: 1.5;
}

.shop-metrics {
  display: grid;
  grid-template-columns: repeat(2, 120px);
  gap: 10px;
}

.shop-metrics div {
  padding: 14px;
  border: 1px solid #ecf0f1;
  border-radius: 8px;
  background: #f9fbfa;
}

.shop-metrics strong {
  display: block;
  font-size: 20px;
}

.shop-metrics span {
  color: #777;
  font-size: 13px;
}

.search-row {
  position: relative;
}

.search-row::before {
  content: "⌕";
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #8a8a8a;
  font-size: 20px;
}

.controls input {
  max-width: none;
  padding-left: 46px;
  border-color: #dfe5e8;
  background: #fbfcfc;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

.controls input:focus {
  border-color: #4cd964;
  outline: none;
  box-shadow: 0 0 0 3px rgba(76, 217, 100, 0.16);
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.category-chips button {
  padding: 9px 14px;
  border: 1px solid #e1e7e4;
  border-radius: 8px;
  background: #fff;
  color: #333;
  cursor: pointer;
  font-weight: 600;
}

.category-chips button:hover {
  border-color: #4cd964;
  color: #15963a;
}

.grid {
  max-width: 1220px;
  margin: 0 auto;
  padding: 22px 20px 44px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}

.card {
  border: 1px solid #edf0f2;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(18, 29, 43, 0.04);
}

.card:hover {
  box-shadow: 0 16px 38px rgba(18, 29, 43, 0.1);
}

.card-image {
  position: relative;
  background: #fafafa;
}

.card-image img,
.card > img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: contain;
  padding: 14px;
  background: #fafafa;
}

.stock-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(230, 255, 237, 0.96);
  color: #14843a;
  font-size: 12px;
  font-weight: 700;
}

.card-content {
  padding: 16px;
}

.card-meta {
  color: #888;
  font-size: 12px;
  line-height: 1.3;
}

.price {
  color: #111;
  font-size: 20px;
}

.delivery-note {
  color: #14843a;
  font-size: 13px;
  font-weight: 600;
}

.card button {
  min-height: 38px;
  border-radius: 8px;
  font-weight: 700;
}

.more-card {
  min-height: 360px;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.55), transparent 30%),
    linear-gradient(135deg, #38d85e, #c6dd26);
}

.modal-content {
  box-shadow: 0 30px 80px rgba(0,0,0,0.22);
}

@media (max-width: 768px) {
  .header {
    padding: 12px 16px;
    gap: 12px;
  }

  .top-nav {
    gap: 10px;
    font-size: 12px;
    overflow-x: auto;
    white-space: nowrap;
  }

  .top-nav span {
    display: none;
  }

  .controls {
    padding: 14px 12px 2px;
    position: static;
  }

  .shop-panel {
    padding: 16px;
  }

  .shop-head {
    display: block;
  }

  .shop-head h1 {
    font-size: 26px;
  }

  .shop-head p {
    font-size: 14px;
  }

  .shop-metrics {
    grid-template-columns: repeat(2, 1fr);
    margin-top: 14px;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 12px;
  }

  .card-image img,
  .card > img {
    height: 150px;
    padding: 10px;
  }

  .stock-badge {
    font-size: 11px;
  }
}

@media (max-width: 420px) {
  .header {
    align-items: flex-start;
    flex-direction: column;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .card-image img,
  .card > img {
    height: 190px;
  }
}
