html, body {
  margin: 0;
  padding: 0;
  font-family: 'BMW Helvetica 97 Condense', sans-serif;
  font-weight: bold;
  background-color: transparent;
  color: #333;
  position: relative;
  scroll-behavior: smooth;
}

/*покачто так*/
.page-title {
  text-align: center;
  font-size: 2rem;
  margin: 20px 0;
  color: #fff;
}

.grid-block {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  padding: 20px;
}

.grid-item {
  background: #1a1a1a;
  border-radius: 15px;
  padding: 40px 20px;
  text-align: center;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.grid-item:hover {
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.back-button {
  display: block;
  margin: 20px auto;
  padding: 10px 20px;
  border: none;
  background: #333;
  color: #fff;
  font-size: 1rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

.back-button:hover {
  background: #555;
}
/*покачто так*/



.container {
  text-align: center;
  margin: 20 auto;
  padding: 40px;
  position: relative;
  z-index: 2;
}

.hero-title {
  font-size: 96px;
  font-weight: bold;
  opacity: 0;
  animation: fadeInleft 3s ease-in-out forwards;
}

.hero-title .highlight {
  color: #ff0000; /* Красный для room */
}

@keyframes fadeInleft {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Фон */
.series-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('/static/img/hero.jpg') center/cover no-repeat;
  z-index: -1;
}

/* Карточка серий и кузовов */
.series-card {
  position: relative;
  width: 180px;
  height: 240px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  background: rgba(0, 0, 0, 0.5);
  animation: fadeInUp 1s ease forwards;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.series-card:hover {
  transform: scale(1.05);
  border: 1px solid #1C3D8C;
  box-shadow: 0 10px 30px rgba(28, 61, 140, 0.6);
}


/* Текст внутри */
.series-card span {
  color: #fff;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.6);
}

/* Изображение */
.series-card .series-image {
  width: 100%;
  height: 100%;
  background-size: 80%;
  background-repeat: no-repeat;
  background-position: center;
}

/* Затемнение */
.series-card .series-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 70px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 12px;
}

.series-card .series-overlay span {
  color: #fff;
  font-size: 28px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.8);
}

/* Карточка категории */
.category-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(2, auto);
  gap: 40px;
  margin: 30px auto 60px auto;
  padding-left: 30px;
}

.category-card {
  position: relative;
  width: 180px;
  height: 240px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  background: rgba(0, 0, 0, 0.5);
  animation: fadeInUp 1s ease forwards;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.category-card:hover {
  transform: scale(1.05);
  border: 1px solid #1C3D8C;
  box-shadow: 0 10px 30px rgba(28, 61, 140, 0.6);
}

.category-card span {
  color: #fff;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.6);
  padding: 8px;
}

.category-card .category-image {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  transition: transform 0.4s ease;
  background: no-repeat;
}

.category-card:hover .category-image {
  transform: scale(1.1);
}

/* Затемнение */
.category-card .category-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 70px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 12px;
}

.category-card .category-overlay span {
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.8);
}

/* Заголовок */
.page-title {
  font-size: 42px;
  font-weight: bold;
  color: #fff;
  margin-bottom: 40px;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
}

.product-background {
  position: fixed; /* фиксируем */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('/static/img/hero.jpg');
  background-size: cover;      /* растягиваем */
  background-position: center; /* центрируем */
  background-repeat: no-repeat;/* без повторов */
  z-index: -1; /* уводим под контент */
}

h1 {
  font-size: 32px;
  margin-top: 20px;
  text-align: center;
  color: #000000;
}

h2 {
  font-size: 80px;
  margin-top: 20px;
  text-align: center;
  color: #ffffff;
}

h3 {
  font-size: 40px;
  margin-top: 80px;
  text-align: center;
  color: #000000;
}

/* BMWroom - на заглавной странице */
h4 {
  font-size: 100px;
  position: center;
  margin-bottom: 0;
  text-align: center;
  color: #ffffff;
}

/* Фраза "общая сумма" в корзине */
h5 {
  font-size: 40px;
  margin-top: 80px;
  text-align: center;
  color: #000000;
}

h6 {
  font-size: 40px;
  margin-top: 80px;
  text-align: center;
  color: #000000;
}

p {
  font-size: 16px;
  line-height: 1.6;
  margin-top: 5px;
  color: #555;
  opacity: 0;
  animation: fadeInleft 1s ease-in-out forwards;
  animation-delay: 1s;
}

p1 {
  font-size: 16px;
  text-align: center;
  color: #000000;
}

a {
  text-decoration: none;
  color: black;
}

.catalog-button {
  display: inline-block;
  background-color: #395aa8;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  transition: background 0.2s ease;
  text-decoration: none;
}

.button:hover, .catalog-button:hover {
  background-color: #3a5cb3;
}

/* Кнопка "Назад" */
.back-button {
  position: absolute;
  top: 20px;
  left: 20px;
  color: #fff;
  font-size: 18px;
  font-weight: bold;
  text-decoration: none;
  text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.8);
}

.back-button:hover {
  color: #1C3D8C;
}

.search-button {
  display: inline-block;
  background-color: #395aa8;
  color: white;
  width: 80px;
  height: 40px;
  border-radius: 8px;
  font-weight: 600;
  transition: background 0.2s ease;
  text-decoration: none;
}

/* Hero-блок */
.hero {
  position: relative;
  height: 105vh;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  text-align: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-image: url("/static/img/hero.jpg");
  background-size: 110%;
  background-position: center;
  filter: brightness(0.6);
  z-index: 1;
  transform: translate(var(--mouse-x, 0), var(--mouse-y, 0));
  transition: transform 0.1s ease;
}

.hero-content {
  position: center;
  margin-top: -140px;
  z-index: 2;
  color: transparent;
  max-width: 800px;
}

.hero h1 {
  font-size: 64px;
  margin-bottom: 10px;
  background-color: rgba(255, 255, 255, 0.3);
  padding: 10px 30px;
  border-radius: 8px;
  color: #111;
  text-align: center;
}

.hero p {
  font-size: 20px;
  margin-bottom: 30px;
  color: #eee;
  text-align: center;
}

.catalog-button {
  background-color: #003399;
}

.catalog-button:hover {
  background-color: #001f66;
}

/* Блок информации */
.info {
  background-color: #f2f2f2;
  padding: 60px 20px;
  text-align: center;
}

.info-block {
  max-width: 600px;
  margin: 0 auto 40px;
}

.info-block h2 {
  font-size: 28px;
  color: #111;
  margin-bottom: 10px;
}

.info-block p {
  font-size: 16px;
  color: #333;
}

/* Сетка */
.series-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(2, auto);
  gap: 30px;
  position: center;
  padding-left: 0px;
  margin: 0px auto 150px auto;
  justify-items: center;
  align-items: center;
}

/* Эффект появления */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(140px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Товары */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  background-color: transparent;
}

.card {
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}


.image-wrapper {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;           /* обрезает всё, что выходит за рамку */
  background: transparent;        /* нейтральный фон */
  display: flex;
  align-items: center;
  justify-content: center;
  object-fit: cover;
}

.image-wrapper img {
  width: auto;
  height: auto;
  transition: transform 0.3s ease;
  transform: scale(0.2);        /* ← начальный масштаб */
}

.image-wrapper img:hover {
  transform: scale(0.15); /* наводим мышкой — фото приближается */
}

img.lazy {
  filter: blur(5px);
  transition: filter 0.3s ease-out;
}

img.lazy:not([src$="placeholder.png"]) {
  filter: blur(0);
}

.card-body {
  background: white;
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.name {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 8px;
}

.description {
  font-size: 14px;
  color: #000000;
  flex-grow: 1;
  margin-bottom: 12px;
}

.price {
  font-size: 16px;
  font-weight: bold;
  color: #ff0000;
}

.quantity {
  font-size: 13px;
  color: #888;
  margin-top: 4px;
}

.cart-icon-button {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #1C3D8C;
  margin-top: 10px;
  align-self: flex-end;
}

.cart-icon-button:hover {
  color: #163073;
}

/* Поиск */
.search-bar {
  margin-bottom: 30px;
  display: flex;
  justify-content: center;
}

.search-bar input[type="text"] {
  padding: 10px 14px;
  border: 2px solid #1C3D8C;
  border-radius: 8px;
  width: 300px;
  font-size: 14px;
  outline: none;
}

.search-header {
  position: absolute;
  margin-top: center;
  z-index: 1000;
  display: flex;
}

.cart-header {
  position: fixed;
  top: 20px;
  right: 30px;
  z-index: 1000;
}

.cart-link {
  font-size: 28px;
  color: #1C3D8C;
  text-decoration: none;
  position: relative;
}

.cart-count {
  position: absolute;
  top: -10px;
  right: -12px;
  background: red;
  color: white;
  border-radius: 50%;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: bold;
}



.order-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  padding-top: 40px;
  left: 0;
  top: 0;
  width: 100px;
  height: 400px;
  background-color: rgba(0,0,0,0.4);
}

.order-modal-content {
  background: rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  padding: 20px;
  position: center;
  
  width: 100px;    /* максимальная ширина */
  height: 300px;   /* минимальная высота */
  overflow-y: auto;    /* скролл если контента слишком много */
}

.close {
  color: #aaa;
  position: absolute;
  right: 10px;
  top: 5px;
  font-size: 24px;
  cursor: pointer;
}

.button, .offer-button {
  display: inline-block;
  background-color: #395aa8;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  transition: background 0.2s ease;
  text-decoration: none;
}

.button:hover, .offer-button:hover {
  background-color: #3a5cb3;
}

.button, .done-button {
  display: inline-block;
  background-color: #395aa8;
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  font-weight: 400;
  transition: background 0.2s ease;
  text-decoration: none;
}

.button:hover, .done-button:hover {
  background-color: #3a5cb3;
}

.telegram-fab {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 50px;
  height: 50px;
  background-color: #0088cc;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, background-color 0.2s ease;
  z-index: 9999;
}

.telegram-fab img {
  width: 28px;
  height: 28px;
}

.telegram-fab:hover {
  background-color: #0077b5;
  transform: scale(1.1);
}

.input_wrapper {
  margin-bottom: 15px;
}

.input_wrapper input {
  width: 80%;
  padding: 10px;
  border: 2px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
}

.polisText {
  font-size: 13px;
  margin: 10px 0;
}

.polisText a {
  color: #1C3D8C;
  text-decoration: underline;
}

button[type="submit"] {
  background-color: #395aa8;
  color: white;
  padding: 12px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
}

button[type="submit"]:hover {
  background-color: #2f4c94;
}


.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0; top: 0;
  width: 100%; 
  height: 100%;
  background-color: rgba(0,0,0,0.8);
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  padding: 10px;
  position: relative;

  width: 70vh;
  height: 90vh;

  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.modal-gallery {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-gallery img {
  width: 50vh;
  height: 90vh; /* ограничение, чтобы фото не уехало за экран */
  object-fit: contain;
}

.gallery-thumbs {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.gallery-thumbs img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 4px;
  transition: border 0.2s ease;
}

.gallery-thumbs img.active {
  border: 2px solid #007bff;
}

button {
  padding: 10px 15px;
  background-color: #395aa8;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

button:hover {
  background-color: #2e4785;
}


#mainImage {
  width: 300px;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  transition: transform 0.3s ease;
}

#mainImage:hover {
  transform: scale(1.05);
}

.gallery-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 15px;
  overflow-x: auto;
  padding: 5px 0;
}

.gallery-thumbs img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0.7;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.gallery-thumbs img:hover {
  transform: scale(1.1);
  opacity: 1;
}

.gallery-thumbs img.active {
  border: 2px solid #0056b3;
  opacity: 1;
}

.modal-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.modal-info h2 {
  margin-bottom: 10px;
  font-size: 24px;
  color: #222;
}

.modal-info p {
  margin: 8px 0;
  font-size: 16px;
}

.modal-price {
  font-size: 22px;
  font-weight: bold;
  color: #d32f2f;
  margin: 10px 0;
}

#addToCartBtn {
  padding: 12px 20px;
  background-color: #0056b3;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

#addToCartBtn:hover {
  background-color: #003f8a;
}

/* ==== Анимации ==== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleUp {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ==== Скроллбар для миниатюр ==== */
.gallery-thumbs::-webkit-scrollbar {
  height: 6px;
}

.gallery-thumbs::-webkit-scrollbar-thumb {
  background-color: #ccc;
  border-radius: 3px;
}

.gallery-thumbs::-webkit-scrollbar-thumb:hover {
  background-color: #aaa;
}



@media (max-width: 1024px) {

  .hero-bg {
  position: absolute;
  inset: 0;
  background-image: url("/static/img/hero.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: brightness(0.6);
  z-index: 1;
  transform: translate(var(--mouse-x, 0), var(--mouse-y, 0));
  transition: transform 0.1s ease;
  }

  .hero-content {
  position: relative;
  text-align: center;
  color: transparent;
  max-width: 1000px;
  z-index: 2;
  }

  .card-body {
  padding: 16px;
  display: flex;
  grid-template-columns: repeat(2, 1fr);
  flex-grow: 1;
  }

  .cart-header {
  position: fixed;
  top: 50px;
  right: 60px;
  z-index: 1000;
  }

  .cart-link {
  font-size: 50px;
  color: #1C3D8C;
  text-decoration: none;
  position: relative;
  }

  .series-grid {
  grid-template-columns: repeat(4, 1fr);
  transform: none;
  gap: 30px;
  padding-left: 0;
  margin: auto;
  }

  h1 {
  font-size: 48px;
  }
  
  h6 {
  font-size: 40px;
  margin-top: 120px;
  text-align: center;
  color: #000000;
  }

  h4 {
  font-size: 60px;
  position: center;
  text-align: center;
  color: #ffffff;
  }

  .search-bar {
  width: 600px;
  height: 80px;
  margin-bottom: 20px;
  margin-top: 30px;
  justify-content: center;
  }

  .search-bar input[type="text"] {
  border: 2px solid #1C3D8C;
  border-radius: 8px;
  width: 400px;
  height: 40px;
  font-size: 22px;
  }

  .back-button {
  position: absolute;
  top: 55px;
  left: 30px;
  font-size: 28px;
  padding: 8px 14px;
  border-radius: 6px;
  color: #000000;
  font-weight: 600;
  transition: background-color 0.3s, color 0.3s;
  z-index: 10;
  }

  .grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 2fr));
  grid-template-rows: repeat(2, auto);
  gap: 24px;
  }


  .image-wrapper {
  width: 100%;
  aspect-ratio: 10 / 10;
  overflow: hidden;           /* обрезает всё, что выходит за рамку */
  background: transparent;        /* нейтральный фон */
  display: flex;
  align-items: center;
  justify-content: center;
  object-fit: cover;
  }

  .image-wrapper img {
  width: auto;
  height: auto;
  transition: transform 0.3s ease;
  transform: scale(0.3);        /* ← начальный масштаб */
  }

  .image-wrapper img:hover {
  transform: scale(0.2); /* наводим мышкой — фото приближается */
  }

  .name {
  font-weight: 600;
  font-size: 32px;
  margin-bottom: 8px;
  }

  .description {
  font-size: 20px;
  color: #000000;
  flex-grow: 1;
  margin-bottom: 12px;
  }

  .price {
  font-size: 40px;
  font-weight: bold;
  color: #ff0000;
  }

  .quantity {
  font-size: 22px;
  color: #888;
  margin-top: 4px;
  }

  .cart-icon-button {
  background: none;
  border: none;
  font-size: 50px;
  cursor: pointer;
  color: #1C3D8C;
  margin-top: -60px;
  margin-left: 60px;
  align-self: flex-end;
  }

  .search-button {
  display: inline-block;
  background-color: #395aa8;
  color: white;
  width: 140px;
  height: 65px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 20px;
  transition: background 0.2s ease;
  text-decoration: none;
  }
}