/* ============================================
   БАЗОВЫЕ СБРОСЫ И ПЕРЕМЕННЫЕ
   ============================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #4f46e5;
  --primary-light: #818cf8;
  --primary-dark: #3730a3;
  --accent: #f59e0b;
  --danger: #ef4444;
  --success: #10b981;
  --bg: #f1f5f9;
  --text: #0f172a;
  --text-muted: #64748b;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================
   HEADER
   ============================================ */
.header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 2rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.logo {
  font-weight: 800;
  font-size: 1.35rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
}

.logo:hover {
  opacity: 0.8;
  transform: scale(1.03);
}

.nav-list {
  display: flex;
  list-style: none;
  gap: 0.25rem;
  justify-content: center;
  flex-wrap: wrap;
}

.nav-list a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  position: relative;
}

.nav-list a:hover,
.nav-list a.active {
  color: var(--primary);
  background: rgba(79, 70, 229, 0.06);
}

.nav-list a.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

/* Бейдж корзины */
.cart-badge {
  display: none;
  background: var(--danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 9px;
  padding: 0 4px;
  margin-left: 4px;
  vertical-align: middle;
  animation: badge-pop 0.3s ease;
}

@keyframes badge-pop {
  0% { transform: scale(0); }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ============================================
   БУРГЕР-МЕНЮ
   ============================================ */
.burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: var(--transition);
  background: none;
  border: none;
}

.burger:hover { background: var(--bg); }

.burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: var(--transition);
  transform-origin: center;
}

.burger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.burger.active span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.burger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ============================================
   HERO-СЕКЦИЯ
   ============================================ */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  text-align: center;
  padding: 4rem 2rem;
}

.hero h1 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  letter-spacing: -0.5px;
}

.hero p {
  font-size: 1.15rem;
  opacity: 0.9;
  margin-bottom: 1.5rem;
}

/* ============================================
   MAIN
   ============================================ */
main {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

h1 {
  margin-bottom: 1.5rem;
  font-size: 1.75rem;
  font-weight: 700;
}

h2 {
  margin: 2rem 0 1rem;
  font-size: 1.35rem;
  font-weight: 600;
}

/* ============================================
   КАРТОЧКИ
   ============================================ */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card h3 {
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.card p {
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* Иконка в карточке новости */
.card-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.news-card { text-align: center; }

/* ============================================
   КНОПКИ
   ============================================ */
.btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 0.55rem 1.2rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition);
  line-height: 1.4;
}

.btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active { transform: translateY(0); }

.btn-lg {
  padding: 0.75rem 1.75rem;
  font-size: 1.05rem;
}

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

/* ============================================
   СЕТКИ (новости, товары, контакты)
   ============================================ */
.news-grid,
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.contacts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

/* ============================================
   ТОВАРЫ
   ============================================ */
.product-card {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.product-img {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-emoji {
  font-size: 4rem;
  transition: var(--transition);
}

.product-card:hover .product-emoji {
  transform: scale(1.15) rotate(-3deg);
}

.product-info {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-info h3 { font-size: 1.1rem; }

.product-info p { font-size: 0.9rem; flex: 1; }

.price {
  font-size: 1.2rem;
  color: var(--text);
  margin: 0.75rem 0;
}

.add-to-cart-btn {
  width: 100%;
  text-align: center;
  margin-top: auto;
}

/* Фильтры */
.filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.45rem 1rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--card-bg);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

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

/* ============================================
   КОРЗИНА
   ============================================ */
.empty-cart {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-cart-icon { font-size: 4rem; display: block; margin-bottom: 1rem; }

.empty-cart h2 { color: var(--text); }

.empty-cart p { color: var(--text-muted); margin-bottom: 1.5rem; }

.cart-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cart-item-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: grid;
  grid-template-columns: 60px 1fr auto auto auto;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.cart-item-card:hover { box-shadow: var(--shadow-md); }

.cart-item-img {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-item-img .product-emoji { font-size: 1.8rem; }

.cart-item-details h3 { font-size: 1rem; margin-bottom: 0.15rem; }

.cart-item-price { font-size: 0.85rem; color: var(--text-muted); margin: 0; }

.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.qty-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-weight: 600;
  color: var(--text);
}

.qty-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(79, 70, 229, 0.05);
}

.qty-value {
  font-weight: 600;
  min-width: 24px;
  text-align: center;
}

.cart-item-subtotal {
  font-size: 1.05rem;
  min-width: 110px;
  text-align: right;
}

.btn-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-remove:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

/* Сводка корзины */
.cart-summary {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1.5rem;
  box-shadow: var(--shadow);
}

.cart-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  color: var(--text-muted);
}

.cart-summary-total {
  border-top: 2px solid var(--border);
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  color: var(--text);
  font-size: 1.2rem;
}

/* ============================================
   ФОРМА ЗАКАЗА
   ============================================ */
.order-summary {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.order-summary h3 { margin-bottom: 0.75rem; }

.order-item {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.order-total {
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  text-align: right;
  font-size: 1.1rem;
}

.info-box {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  color: #92400e;
}

.order-form {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: var(--radius);
  max-width: 600px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}

.form-group { margin-bottom: 1.25rem; }

.form-group label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 500;
  font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition);
  background: var(--card-bg);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.form-group input.invalid {
  border-color: var(--danger);
}

.form-group input.invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.form-group textarea { resize: vertical; min-height: 100px; }

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox-group input { width: auto; }

.error-msg {
  display: block;
  color: var(--danger);
  font-size: 0.82rem;
  margin-top: 0.25rem;
  min-height: 1.2em;
}

/* ============================================
   МОДАЛЬНОЕ ОКНО
   ============================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.3s ease;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: modal-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-icon { font-size: 3.5rem; margin-bottom: 0.75rem; }

.modal h2 { margin-bottom: 0.5rem; }

.modal p { color: var(--text-muted); margin-bottom: 1.5rem; }

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-pop {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ============================================
   КОНТАКТЫ
   ============================================ */
.contact-card { display: flex; flex-direction: column; gap: 1.25rem; }

.contact-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.contact-icon { font-size: 1.5rem; flex-shrink: 0; margin-top: 2px; }

.contact-item h3 { font-size: 0.95rem; margin-bottom: 0.15rem; }

.contact-item p { margin: 0; font-size: 0.9rem; }

.contact-item a {
  color: var(--primary);
  text-decoration: none;
}

.contact-item a:hover { text-decoration: underline; }

.map-card {
  padding: 0;
  overflow: hidden;
  min-height: 300px;
}

.map-placeholder {
  height: 100%;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e0e7ff, #f1f5f9);
  color: var(--text-muted);
  text-align: center;
  gap: 0.5rem;
}

.map-placeholder span { font-size: 3rem; }

/* Форма обратной связи */
.feedback-section { margin-top: 2.5rem; }

.feedback-form {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: var(--radius);
  max-width: 600px;
  box-shadow: var(--shadow);
}

/* ============================================
   TOAST-УВЕДОМЛЕНИЯ
   ============================================ */
.toast {
  position: fixed;
  bottom: -80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  transition: bottom 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  font-size: 0.95rem;
}

.toast.show { bottom: 2rem; }

.toast-icon { font-size: 1.2rem; }

/* ============================================
   FOOTER
   ============================================ */
footer {
  text-align: center;
  padding: 1.5rem 2rem;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: auto;
}

/* ============================================
   АНИМАЦИИ
   ============================================ */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  animation: fade-up 0.5s ease both;
}

.news-grid .card:nth-child(2) { animation-delay: 0.1s; }
.news-grid .card:nth-child(3) { animation-delay: 0.2s; }
.products-grid .card:nth-child(2) { animation-delay: 0.05s; }
.products-grid .card:nth-child(3) { animation-delay: 0.1s; }
.products-grid .card:nth-child(4) { animation-delay: 0.15s; }
.products-grid .card:nth-child(5) { animation-delay: 0.2s; }
.products-grid .card:nth-child(6) { animation-delay: 0.25s; }
.products-grid .card:nth-child(7) { animation-delay: 0.3s; }
.products-grid .card:nth-child(8) { animation-delay: 0.35s; }

/* ============================================
   АДАПТИВ
   ============================================ */
@media (max-width: 768px) {
  .header {
    grid-template-columns: auto auto;
    padding: 0.7rem 1rem;
  }

  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: none;
    flex-direction: column;
    padding: 0.75rem 0;
    box-shadow: var(--shadow-md);
  }

  .nav.active { display: flex; }

  .nav-list {
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
  }

  .nav-list a {
    display: block;
    padding: 0.6rem 1.5rem;
    width: 100%;
    text-align: center;
  }

  .nav-list a.active::after { display: none; }

  .burger { display: flex; }

  .hero { padding: 2.5rem 1rem; }
  .hero h1 { font-size: 1.6rem; }
  .hero p { font-size: 1rem; }

  main { padding: 1.25rem; }

  h1 { font-size: 1.4rem; }

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

  .cart-item-card {
    grid-template-columns: 50px 1fr;
    gap: 0.75rem;
  }

  .cart-item-qty,
  .cart-item-subtotal,
  .btn-remove {
    grid-column: 1 / -1;
  }

  .cart-item-qty { justify-content: center; }
  .cart-item-subtotal { text-align: center; }
  .btn-remove { justify-self: center; }
}

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

  .filters { gap: 0.35rem; }

  .filter-btn { padding: 0.35rem 0.75rem; font-size: 0.82rem; }

  .order-form,
  .feedback-form {
    padding: 1.25rem;
  }
}
