/* ==========================================
   1. ПЕРЕМЕННЫЕ И ДИЗАЙН-ТОКЕНЫ
   ========================================== */
:root {
  --primary: #1e4d40;
  --primary-hover: #163a30;
  --accent: #c89b52;
  --accent-hover: #b0843d;
  --bg-main: #f9f8f5;
  --bg-card: #ffffff;
  --text-dark: #2b2e2c;
  --text-muted: #737875;
  --border-color: #eae7e1;
  --badge-orange: #e8804c;
  --badge-green: #3d9b6d;
  --badge-red: #e54b4b;
  --badge-yellow: #8ca336;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 4px 12px rgba(0,0,0,0.03);
  --shadow-hover: 0 12px 28px rgba(0,0,0,0.12);
  --transition: all 0.3s ease;
}

/* ==========================================
   2. СБРОС И БАЗОВЫЕ СТИЛИ (LAYOUT)
   ========================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-dark);
  line-height: 1.5;
  overflow-wrap: break-word;
  max-width: 100%;
  overflow-x: hidden;
}

main {
  flex: 1 0 auto; /* Заполняет пространство, прижимая футер */
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; object-fit: cover; }

.container, .content-wrapper {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}
.content-wrapper { max-width: 1200px; padding: 0 16px; }
.section-margin { margin-bottom: 60px; }

/* ==========================================
   3. КНОПКИ, БЭЙДЖИ И ИНДИКАТОРЫ
   ========================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  color: #fff;
  text-align: center;
}
.btn-primary { background-color: var(--primary); }
.btn-primary:hover { background-color: var(--primary-hover); transform: translateY(-2px); }
.btn-accent { background-color: var(--accent); }
.btn-accent:hover { background-color: var(--accent-hover); transform: translateY(-2px); }
.btn-full { width: 100%; }
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  width: 100%;
}

/* Бэйджи */
.badge {
  position: absolute;
  top: 24px;
  left: 24px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  z-index: 2;
}
.badge-orange { background-color: var(--badge-orange); }
.badge-green  { background-color: var(--badge-green); }
.badge-red, .badge-sale { background-color: var(--badge-red); }
.badge-yellow { background-color: var(--badge-yellow); }

.badge-sale {
  top: 8px;
  left: 8px;
  font-size: 11px;
  padding: 2px 6px;
}

/* Бейдж корзины */
.cart-badge {
  position: absolute;
  top: -5px;
  right: -6px;
  background-color: #ff5722;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 50%;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

/* ==========================================
   4. ЕДИНЫЕ КАРТОЧКИ И СЕТКИ
   ========================================== */
.category-card, .product-card, .product-card-sm, .feature-card, 
.review-card, .cta-card, .catalog-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.category-card:hover, .product-card:hover, .product-card-sm:hover, 
.feature-card:hover, .review-card:hover, .cta-card:hover, .catalog-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
}

/* Сеточные системы */
.categories-grid, .products-grid-6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.products-grid-4, .features-grid    { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.reviews-grid                       { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.bottom-cta-grid                    { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.catalog-grid                       { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.products-grid                      { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; width: 100%; }

/* Заголовки секций и крошки */
.section-header { 
  display: flex; 
  justify-content: space-between; 
  align-items: flex-end; 
  margin-bottom: 24px; 
  gap: 12px; 
}
.section-title { font-size: 22px; font-weight: 700; line-height: 1.2; }
.section-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.section-link { font-size: 14px; font-weight: 500; color: var(--text-muted); transition: var(--transition); white-space: nowrap; }
.section-link:hover { color: var(--primary); }

.breadcrumbs { display: flex; gap: 8px; font-size: 13px; color: var(--text-muted); margin-bottom: 12px; flex-wrap: wrap; }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs i { font-size: 10px; color: #a0a5a2; margin-top: 4px; }

/* ==========================================
   5. ШАПКА, НАВИГАЦИЯ И ПОИСК
   ========================================== */
.header { background: var(--bg-card); border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 1000; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 80px; gap: 20px; }

.logo { display: flex; flex-direction: column; }
.logo-text { font-size: 20px; font-weight: 800; letter-spacing: 1px; color: var(--primary); }
.logo-sub { font-size: 11px; color: var(--text-muted); margin-top: -2px; }

.nav-menu { display: flex; gap: 28px; }
.nav-link { font-size: 14px; font-weight: 500; transition: var(--transition); }
.nav-link:hover, .nav-link.active { color: var(--primary); }

.search-bar { position: relative; flex: 0 1 280px; }
.search-input { width: 100%; padding: 10px 16px 10px 40px; background: var(--bg-main); border: 1px solid var(--border-color); border-radius: 20px; font-size: 14px; outline: none; transition: var(--transition); }
.search-input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(30, 77, 64, 0.1); }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 14px; }

.user-actions { display: flex; align-items: center; gap: 18px; }
.action-btn { position: relative; background: none; border: none; font-size: 18px; cursor: pointer; transition: var(--transition); color: var(--text-dark); }
.action-btn:hover { color: var(--primary); transform: scale(1.1); }

.burger-btn { display: none; background: none; border: none; font-size: 22px; cursor: pointer; padding: 4px; color: var(--text-dark); }

/* Мобильное меню */
.mobile-menu-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1001; opacity: 0; visibility: hidden; transition: var(--transition); }
.mobile-menu-overlay.active { opacity: 1; visibility: visible; }
.mobile-menu { position: fixed; top: 0; left: -280px; width: 280px; height: 100%; background: var(--bg-card); z-index: 1002; padding: 24px 20px; box-shadow: var(--shadow-hover); transition: 0.3s ease; display: flex; flex-direction: column; }
.mobile-menu.active { left: 0; }
.mobile-menu-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; padding-bottom: 12px; border-bottom: 1px solid var(--border-color); }
.close-menu-btn { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-dark); }
.mobile-nav ul { display: flex; flex-direction: column; gap: 16px; }
.mobile-nav a { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 500; }
.mobile-nav a.active, .mobile-nav a:hover { color: var(--primary); }

/* ==========================================
   6. СЕКЦИИ И КОМПОНЕНТЫ СТРАНИЦ
   ========================================== */
/* Hero Banner */
.hero { padding-top: 30px; }
.hero-card { background: #fff; border-radius: var(--radius-lg); padding: 40px; display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; box-shadow: var(--shadow-sm); }
.hero-tag { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; display: inline-block; }
.hero-title { font-size: 38px; font-weight: 800; line-height: 1.2; margin-bottom: 12px; color: var(--primary); }
.hero-desc { font-size: 15px; color: var(--text-muted); margin-bottom: 28px; max-width: 420px; }
.hero-features { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 32px; border-top: 1px solid var(--border-color); padding-top: 24px; }
.hero-feature-item { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--text-muted); }
.hero-feature-item i { color: var(--primary); font-size: 16px; }
.hero-image { border-radius: var(--radius-md); overflow: hidden; height: 380px; }

/* Категории */
.category-card { text-align: center; cursor: pointer; border: 1px solid transparent; }
.category-img { height: 140px; width: 100%; flex-shrink: 0; }
.category-img img { width: 100%; height: 100%; object-fit: cover; }
.category-info { padding: 14px 10px; flex-grow: 1; display: flex; flex-direction: column; justify-content: center; }
.category-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.category-desc { font-size: 11px; color: var(--text-muted); }

/* Карточки товаров */
.product-card { padding: 16px; position: relative; height: 100%; }
.wishlist-btn { position: absolute; top: 24px; right: 24px; background: rgba(255,255,255,0.8); border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border: none; color: var(--text-muted); cursor: pointer; font-size: 14px; z-index: 2; transition: var(--transition); }
.wishlist-btn:hover { color: var(--badge-red); background: #fff; transform: scale(1.1); }
.product-img { height: 180px; border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 14px; flex-shrink: 0; }
.product-img img { transition: transform 0.4s ease; }
.product-card:hover .product-img img { transform: scale(1.05); }
.product-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; line-height: 1.3; }
.product-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }
.product-bottom { display: flex; flex-direction: column; gap: 12px; margin-top: auto; }
.product-price { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; color: var(--primary); }
.old-price { font-size: 13px; color: var(--text-muted); text-decoration: line-through; font-weight: 400; }

.product-card-sm { padding: 12px; position: relative; height: 100%; }
.product-card-sm .product-img { height: 130px; }
.product-card-sm .product-title { font-size: 13px; margin-bottom: 8px; }
.product-card-sm .product-price { font-size: 14px; margin-top: auto; color: var(--primary); font-weight: 700; }
.product-card-sm .wishlist-btn { top: 16px; right: 16px; }

/* Баннер спецпредложения */
.banner-card { background: linear-gradient(135deg, #ede7de 0%, #e3dad0 100%); border-radius: var(--radius-lg); padding: 30px 40px; display: flex; align-items: center; justify-content: space-between; position: relative; gap: 30px; }
.banner-content { max-width: 450px; flex: 1; }
.banner-subtitle { font-size: 13px; font-weight: 600; color: var(--primary); text-transform: uppercase; margin-bottom: 8px; display: inline-flex; gap: 6px; }
.banner-title { font-size: 28px; font-weight: 800; margin-bottom: 12px; line-height: 1.2; }
.banner-desc { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }
.banner-images { display: flex; gap: 16px; flex-shrink: 0; }
.banner-img-box { width: 140px; height: 140px; border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm); }
.banner-img-box img { width: 100%; height: 100%; object-fit: cover; }

/* Преимущества */
.feature-card { padding: 24px; flex-direction: row; align-items: flex-start; gap: 16px; }
.feature-icon { width: 48px; height: 48px; border-radius: 12px; background: rgba(30, 77, 64, 0.05); display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--primary); flex-shrink: 0; }
.feature-text { flex: 1; min-width: 0; }
.feature-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; color: var(--text-dark); }
.feature-desc { font-size: 13px; color: var(--text-muted); line-height: 1.4; }

/* Отзывы */
.review-card { padding: 24px; justify-content: space-between; }
.review-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.review-avatar { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; flex-shrink: 0; border: 2px solid var(--border-color); }
.review-stars { color: #ffb800; font-size: 12px; margin-top: 2px; display: flex; gap: 2px; }
.review-text { font-size: 14px; font-style: italic; margin-bottom: 20px; color: var(--text-dark); line-height: 1.6; }
.review-author { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-top: auto; }

/* Нижние CTA блоки */
.cta-card { padding: 32px; flex-direction: row; align-items: center; gap: 24px; }
.cta-content { flex: 1; min-width: 0; }
.cta-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.cta-desc { font-size: 14px; color: var(--text-muted); margin-bottom: 20px; line-height: 1.5; }
.cta-form { display: flex; gap: 8px; flex-wrap: wrap; }
.cta-input { flex: 1; min-width: 180px; padding: 12px 16px; border: 1px solid var(--border-color); border-radius: var(--radius-sm); font-size: 14px; outline: none; transition: var(--transition); }
.cta-input:focus { border-color: var(--primary); }

/* Каталог */
.catalog-header { margin-bottom: 28px; }
.catalog-page-title { font-size: 28px; font-weight: 800; }
.catalog-card { padding: 16px 16px 12px; justify-content: space-between; height: 180px; border: 1px solid var(--border-color); position: relative; }
.catalog-card:hover { border-color: rgba(30, 77, 64, 0.2); }
.catalog-card-title { font-size: 14px; font-weight: 600; line-height: 1.3; z-index: 2; }
.catalog-card-img { width: 100%; height: 110px; display: flex; align-items: flex-end; justify-content: center; margin-top: auto; }
.catalog-card-img img { max-width: 90%; max-height: 100%; object-fit: contain; transition: transform 0.4s ease; }
.catalog-card:hover .catalog-card-img img { transform: scale(1.08); }

/* ==========================================
   7. МОДАЛЬНОЕ ОКНО
   ========================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 1000;
  padding: 16px;
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 24px;
  max-width: 560px;
  width: 100%;
  position: relative;
  box-shadow: var(--shadow-hover);
  transform: translateY(-20px);
  transition: transform 0.3s ease;
}
.modal-overlay.active .modal-card { transform: translateY(0); }

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  transition: color 0.2s ease;
}
.modal-close:hover { color: var(--text-dark); }

.modal-header h3 { margin: 0 0 4px; font-size: 20px; color: var(--primary); }
.modal-header p  { margin: 0 0 20px; font-size: 14px; color: var(--text-muted); }

.modal-products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-product-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: #fff;
}
.modal-product-item img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 8px;
}
.modal-product-info h4 { font-size: 14px; margin: 4px 0 8px; }

.modal-prices {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin-bottom: 10px;
}
.price-current { font-weight: 700; color: var(--primary); }
.price-old     { text-decoration: line-through; font-size: 12px; color: var(--text-muted); }

/* ==========================================
   8. ФУТЕР
   ========================================== */
.footer { background: var(--primary); color: #fff; padding: 60px 0 24px; margin-top: 0; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1.5fr; gap: 40px; padding-bottom: 40px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.footer-logo { font-size: 24px; font-weight: 800; margin-bottom: 12px; letter-spacing: 1px; }
.footer-tagline { font-size: 13px; color: rgba(255,255,255,0.7); line-height: 1.5; }
.footer-title { font-size: 14px; font-weight: 700; text-transform: uppercase; margin-bottom: 20px; letter-spacing: 0.5px; }
.footer-links li { margin-bottom: 12px; }
.footer-links a { font-size: 14px; color: rgba(255,255,255,0.7); transition: var(--transition); display: inline-block; }
.footer-links a:hover { color: #fff; transform: translateX(4px); }
.social-links { display: flex; gap: 12px; flex-wrap: wrap; }
.social-icon { width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; transition: var(--transition); }
.social-icon:hover { background: var(--accent); transform: translateY(-3px); }
.footer-bottom { padding-top: 24px; text-align: center; font-size: 13px; color: rgba(255,255,255,0.5); }

/* ==========================================
   9. АДАПТИВНОСТЬ (МЕДИА-ЗАПРОСЫ)
   ========================================== */
@media (max-width: 1100px) {
  .catalog-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 1024px) {
  .categories-grid, .products-grid-6 { grid-template-columns: repeat(3, 1fr); }
  .products-grid-4, .features-grid    { grid-template-columns: repeat(2, 1fr); }
  .footer-grid                       { grid-template-columns: repeat(2, 1fr); gap: 30px; }
}

@media (max-width: 850px) {
  .catalog-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .catalog-card { height: 160px; padding: 12px 12px 8px; }
  .catalog-card-img { height: 95px; }
  .hero-image { display: none; }
  .hero-card { grid-template-columns: 1fr; padding: 32px; text-align: center; }
  .hero-desc { margin: 0 auto 28px auto; }
  .hero-features { justify-content: center; }
}

@media (max-width: 768px) {
  .header-inner { flex-wrap: wrap; height: auto; padding: 12px 16px; gap: 16px 0; }
  .burger-btn { display: flex; order: 1; }
  .logo { order: 2; }
  .desktop-nav, .action-user-desktop { display: none !important; }
  .user-actions { order: 3; gap: 14px; }
  .search-bar { order: 4; width: 100%; flex: 1 1 100%; }

  .section-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .section-title { font-size: 20px; }

  .hero-card { padding: 24px; }
  .hero-title { font-size: 28px; }

  .banner-card { flex-direction: column; align-items: flex-start; padding: 24px; gap: 20px; text-align: center; }
  .banner-content { max-width: 100%; margin: 0 auto; }
  .banner-subtitle { justify-content: center; width: 100%; }
  .banner-images { width: 100%; justify-content: center; }
  .banner-img-box { width: 120px; height: 120px; }

  .reviews-grid, .products-grid-4, .features-grid { grid-template-columns: 1fr; gap: 16px; }
  .bottom-cta-grid { grid-template-columns: 1fr; gap: 16px; }
  .categories-grid, .products-grid-6 { grid-template-columns: repeat(2, 1fr); gap: 12px; }

  .cta-card { flex-direction: column; text-align: center; padding: 24px; }
  .cta-title { justify-content: center; }
  .cta-form { flex-direction: column; width: 100%; }

  .feature-card { padding: 20px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 30px; }
  .footer-col-full { grid-column: span 2; text-align: center; }
}

@media (max-width: 550px) {
  .catalog-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .catalog-card { height: 140px; padding: 10px 8px 6px; border-radius: var(--radius-sm); }
  .catalog-card-title { font-size: 12px; }
  .catalog-card-img { height: 80px; }

  .banner-img-box { width: 100px; height: 100px; }
  .footer-grid { grid-template-columns: 1fr; text-align: center; }
  .footer-col-full { grid-column: 1; }
  .social-links { justify-content: center; }
}

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

@media (max-width: 380px) {
  .catalog-grid { grid-template-columns: repeat(2, 1fr); }
  .categories-grid { gap: 8px; }
  .banner-images { gap: 10px; }
  .banner-img-box { width: 90px; height: 90px; }
}