/* ================== Базовые стили ================== */
body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  color: #333;
  background: #f9f9f9;
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: auto;
}

/* ================== Шапка ================== */
.site-header {
  background: #222;
  color: #fff;
  padding: 15px 0;
}

.header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 22px;
  font-weight: bold;
  color: #fff;
  text-decoration: none;
}

.nav a {
  color: #fff;
  margin-left: 20px;
  text-decoration: none;
  transition: color 0.3s;
}

.nav a:hover {
  color: #ffcc00;
}

/* ================== Hero ================== */
.hero {
  text-align: center;
  padding: 60px 20px;
  background: #fff;
  margin: 20px 0;
  border-radius: 12px;
}

.hero h1 {
  font-size: 36px;
  margin-bottom: 10px;
}

.hero p {
  font-size: 18px;
  margin-bottom: 20px;
}

/* ================== Кнопки ================== */
.btn {
  display: inline-block;
  background: #ffcc00;
  color: #222;
  padding: 12px 25px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  transition: 0.3s;
}

.btn:hover {
  background: #e6b800;
}

.btn.small {
  padding: 8px 16px;
  font-size: 14px;
}

.btn-outline {
  background: #fff;
  border: 2px solid #ffcc00;
  color: #222;
}

.btn-outline:hover {
  background: #ffcc00;
  color: #000;
}

/* ================== Каталог авто ================== */
.car-catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px;
  justify-items: center;
  margin-top: 30px;
}

.car-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  width: 160px;
}

.car-block img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #f5f7fa;
  padding: 10px;
  box-shadow: inset 0 0 4px rgba(0,0,0,0.1);
  margin-bottom: 10px;
}

.car-block h2 {
  font-size: 1rem;
  color: #003366;
  margin: 0 0 10px;
}

.car-block:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.model-list {
  width: 100%;
  text-align: left;
  margin-top: 10px;
}

.model-block {
  margin-bottom: 8px;
  padding: 6px;
  border-radius: 6px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.model-block:hover {
  transform: translateX(4px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.engine-list {
  margin: 5px 0 0 20px;
  font-size: 14px;
}

.engine-list li {
  margin: 5px 0;
}

.car-block.hidden {
  display: none;
}

.show-more {
  display: inline-block;
  margin: 25px auto;
  padding: 10px 20px;
  background: #003366;
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.3s;
}

.show-more:hover {
  background: #0050a0;
}

/* ================== Страница товаров ================== */
.products-grid {
  margin: 40px 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.card {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.card img {
  max-width: 100%;
  height: auto;
  margin-bottom: 15px;
  border-radius: 8px;
}

.card h3 {
  font-size: 18px;
  margin: 10px 0;
}

.price {
  font-size: 24px;
  font-weight: bold;
  color: #e60000;
  margin: 15px 0;
}

/* ================== Страница товара ================== */
.product-page {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-top: 30px;
}

.product-image {
  flex: 1 1 300px;
  text-align: center;
}

.product-image img {
  max-width: 100%;
  border-radius: 8px;
}

.product-info {
  flex: 2 1 400px;
}

.product-info h1 {
  font-size: 28px;
  margin-bottom: 10px;
}

.article, .brand {
  color: #666;
  font-size: 14px;
}

.cart-form {
  margin: 20px 0;
}

.cart-form input[type="number"] {
  width: 70px;
  padding: 6px;
  margin: 0 15px 0 10px;
}

.cart-form .btn {
  padding: 10px 20px;
  font-size: 16px;
}

.back-link {
  margin-top: 20px;
}

.back-link a {
  color: #333;
  text-decoration: none;
}

.back-link a:hover {
  text-decoration: underline;
}

/* ================== Корзина ================== */
.cart-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

.cart-table th, .cart-table td {
  border-bottom: 1px solid #ddd;
  padding: 10px;
  text-align: center;
}

.cart-table th {
  background: #f2f2f2;
}

.qty-input {
  width: 60px;
  text-align: center;
  padding: 5px;
}

.remove-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: red;
  cursor: pointer;
}

.cart-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}

/* ================== Мини-корзина ================== */
.mini-cart {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  justify-content: center;
  align-items: center;
}

.mini-cart-content {
  background: #fff;
  color: #000;
  padding: 20px;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.mini-cart-close {
  position: absolute;
  top: 10px; right: 15px;
  font-size: 24px;
  cursor: pointer;
}

.mini-cart-item {
  display: flex;
  justify-content: space-between;
  margin: 10px 0;
  border-bottom: 1px solid #eee;
  padding-bottom: 5px;
}

.mini-cart-total {
  font-size: 18px;
  font-weight: bold;
  margin: 15px 0;
}

.mini-cart-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

/* ================== Тост уведомления ================== */
.toast {
  visibility: hidden;
  min-width: 200px;
  background: #333;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 12px;
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.5s, bottom 0.5s;
}

.toast.show {
  visibility: visible;
  opacity: 1;
  bottom: 50px;
}

/* ================== Адаптив ================== */
@media (max-width: 768px) {
  .car-catalog {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
  }

  .car-block img { width: 70px; height: 70px; }

  .header-flex {
    flex-direction: column;
  }

  .nav {
    margin-top: 10px;
  }
}

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