:root {
  --color-primary: #8B0000;
  --color-primary-hover: #a00000;
  --color-accent: #FFC107;
  --color-dark: #1a1a1a;
  --color-light: #f8f9fa;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #fafafa;
  color: #222;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

/* ---- Верхняя панель ---- */
.top-bar { background: var(--color-dark); color: #ccc; padding: 8px 0; font-size: 13px; }
.top-link { color: #ccc; text-decoration: none; transition: color 0.2s; }
.top-link:hover { color: var(--color-accent); }

/* ---- Навигация ---- */
.bg-dark-red { background: var(--color-primary) !important; }
.navbar-brand { font-size: 1.3rem; }
.nav-link { transition: color 0.2s; }
.nav-link:hover { color: var(--color-accent) !important; }

.cart-btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.cart-btn .badge { font-size: 0.7rem; }
@media (max-width: 576px) { .cart-btn { padding: 0.375rem 0.6rem; } }

/* ---- Мобильные кнопки связи ---- */
.mobile-contact { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 1000; }
.mobile-btn { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 24px; box-shadow: 0 4px 12px rgba(0,0,0,0.2); transition: transform 0.2s; text-decoration: none; }
.mobile-btn:hover { transform: scale(1.1); color: #fff; }
.mobile-btn.phone { background: #28a745; }
.mobile-btn.max { background: #2AABEE; }

/* ---- Сетка товаров (Grid) ---- */
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  align-items: stretch; /* Ряд растягивается по самой высокой карточке */
}
@media (min-width: 992px) {
  .products-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ---- Карточка товара ---- */
.product-card {
  border: none;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.product-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.1); }
.product-card img { width: 100%; height: 160px; object-fit: cover; background: #eee; cursor: zoom-in; }
@media (min-width: 768px) { .product-card img { height: 200px; } }

.product-card .card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.desc-wrapper {
  margin-bottom: 10px;
}

.product-card .price {
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--color-primary);
  margin-top: auto; /* Прижимает цену и кнопку к низу */
  padding-top: 10px;
}
.product-card .unit { color: #777; font-size: 0.9rem; margin-bottom: 10px; }

.read-more-btn {
  background: none;
  border: none;
  color: var(--color-primary);
  padding: 0;
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
  display: block;
  margin-top: 5px;
}

/* ---- Кнопки ---- */
.btn-primary-red {
  background: var(--color-primary);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 500;
  transition: background 0.2s;
}
.btn-primary-red:hover { background: var(--color-primary-hover); color: #fff; }

/* ---- Подвал ---- */
.footer { background: var(--color-dark); color: #ccc; margin-top: auto; }
.footer h5 { color: #fff; font-size: 1.1rem; }
.footer-link { color: #ccc; text-decoration: none; transition: color 0.2s; }
.footer-link:hover { color: var(--color-accent); }

/* ---- Hero-блок ---- */
.hero { background: var(--color-primary); color: #fff; border-radius: 16px; padding: 48px 32px; margin-bottom: 32px; text-align: center; }
.hero h1 { font-size: 2.5rem; font-weight: bold; margin-bottom: 12px; }
.hero p { font-size: 1.1rem; opacity: 0.9; }
@media (max-width: 768px) { .hero { padding: 32px 20px; } .hero h1 { font-size: 1.8rem; } }

/* ---- Toast ---- */
.toast-msg { position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%); background: #28a745; color: #fff; padding: 12px 24px; border-radius: 8px; z-index: 2000; animation: slideUp 0.3s ease; box-shadow: 0 4px 16px rgba(0,0,0,0.2); }
.toast-msg.error { background: #dc3545; }
@keyframes slideUp { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---- Спиннер ---- */
.spinner-box { display: flex; justify-content: center; padding: 60px 0; }

/* ---- Просмотр фото товара ---- */
#imageModal .modal-body img { cursor: default; }
#imageModal .modal-content { background: transparent !important; }
.btn-close-custom { width: 44px; height: 44px; border-radius: 50%; border: none; background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 22px; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10; transition: background 0.2s, transform 0.2s; backdrop-filter: blur(4px); padding: 0; }
.btn-close-custom:hover { background: rgba(220, 53, 69, 0.9); transform: scale(1.1); }
.btn-close-custom i { line-height: 1; }