/* Общие стили */
/* Компактный header */
header {
  padding: 10px 0 8px !important; /* было 20px сверху/снизу */
}
header h1 {
  font-size: 2.2rem !important;   /* чуть меньше, но всё ещё заметно */
  margin-bottom: 4px !important;
}
nav ul {
  padding: 5px 0 !important;      /* уменьшаем внутренний отступ меню */
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background-color: #f7f7f7;
  color: #333;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
  position: relative;
}

/* Шапка сайта */
header {
  background: linear-gradient(135deg, #7a42c7, #0071b6);
  padding: 20px 0;
  color: white;
  text-align: center;
  position: relative;
}

header h1 {
  font-size: 2.5em;
  margin-bottom: 10px;
}

header h1 a {
  color: inherit;
  text-decoration: none;
}

nav ul {
  list-style: none;
  padding: 10px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

nav ul li {
  margin: 5px 10px;
}

nav ul li a {
  color: white;
  text-decoration: none;
  font-size: 1.1em;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.3s ease;
  display: block;
}

nav ul li a:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

/* Иконки корзины и профиля */
#header-icons {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  z-index: 1000;
}

#cartButton,
#profileIcon {
  font-size: 24px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
}

.profile-icon {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  background-color: #f9f9f9;
  min-width: 160px;
  box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2);
  z-index: 1;
  border-radius: 4px;
  overflow: hidden;
}

.dropdown-content a {
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  font-size: 14px;
}

.dropdown-content a:hover {
  background-color: #f1f1f1;
}

.profile-icon:hover .dropdown-content,
.profile-icon:focus-within .dropdown-content {
  display: block;
}

/* Каталог товаров */
#products-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

/* Обновленные стили для карточек товаров */
.product-card {
  border: 1px solid #e9ecef;
  padding: 20px;
  border-radius: 12px;
  background-color: white;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.product-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  transition: left 0.5s;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  border-color: #007bff;
}

.product-card:hover::before {
  left: 100%;
}

.product-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 15px;
  transition: transform 0.3s ease;
}

.product-card:hover img {
  transform: scale(1.05);
}

.product-card h3 {
  font-size: 1.2em;
  margin: 0 0 10px 0;
  color: #333;
  font-weight: 600;
}

.product-card .price {
  font-size: 1.3em;
  font-weight: bold;
  color: #0071b6;
  margin: 8px 0;
}

.product-card p {
  margin: 5px 0;
  color: #666;
  font-size: 0.95em;
}

/* Обновленные стили для кнопок на карточках товаров */
.product-card .add-to-cart,
.product-card .favorite-btn,
.product-card .info-btn {
  border: none;
  padding: 10px 15px;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 8px;
  font-size: 0.95em;
  width: 100%;
  transition: all 0.3s ease;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Цветовая схема для разных кнопок */
.product-card .add-to-cart {
  background: linear-gradient(135deg, #28a745, #20c997);
  color: white;
  box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.product-card .add-to-cart:hover {
  background: linear-gradient(135deg, #218838, #1ca085);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.product-card .favorite-btn {
  background: linear-gradient(135deg, #ffc107, #ffca2c);
  color: #333;
  box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

.product-card .favorite-btn:hover {
  background: linear-gradient(135deg, #e0a800, #ffb700);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
}

.product-card .info-btn {
  background: linear-gradient(135deg, #17a2b8, #20c9e7);
  color: white;
  box-shadow: 0 2px 8px rgba(23, 162, 184, 0.3);
}

.product-card .info-btn:hover {
  background: linear-gradient(135deg, #138496, #17a2b8);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(23, 162, 184, 0.4);
}

/* Состояние disabled для кнопки "Добавить в корзину" */
.product-card .add-to-cart[disabled] {
  background: linear-gradient(135deg, #6c757d, #868e96);
  color: #fff;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 2px 4px rgba(108, 117, 125, 0.2);
}

.product-card .add-to-cart[disabled]:hover {
  background: linear-gradient(135deg, #6c757d, #868e96);
  transform: none;
  box-shadow: 0 2px 4px rgba(108, 117, 125, 0.2);
}

/* Кнопки корзины */
.checkout-btn,
.clear-cart-btn {
  margin-top: 10px;
  padding: 10px 15px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.checkout-btn {
  background-color: #007bff;
  color: white;
}

.clear-cart-btn {
  background-color: #dc3545;
  color: white;
  margin-left: 10px;
}

/* Страница оформления заказа */
.checkout-container {
  max-width: 600px;
  margin: 40px auto;
  padding: 30px;
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.checkout-container h2 {
  font-size: 2em;
  margin-bottom: 20px;
  color: #7a42c7;
}

.checkout-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.checkout-form label {
  text-align: left;
  font-size: 1.1em;
  font-weight: bold;
}

.checkout-form input,
.checkout-form select,
.checkout-form textarea {
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 1em;
}

.checkout-form button {
  background-color: #28a745;
  color: white;
  padding: 12px;
  border: none;
  border-radius: 5px;
  font-size: 1.2em;
  cursor: pointer;
}

.checkout-form button:hover {
  background-color: #218838;
}

.checkout-summary {
  text-align: left;
  margin-bottom: 20px;
  background-color: #f7f7f7;
  padding: 15px;
  border-radius: 5px;
}

.checkout-summary p {
  margin-bottom: 10px;
  font-size: 1.1em;
}

.checkout-summary strong {
  color: #0071b6;
}

/* Контактная страница */
.contacts-page {
  padding: 20px;
}

.contact-info,
.contact-form,
.map {
  margin-bottom: 30px;
}

.contact-form .form-group {
  margin-bottom: 15px;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
}

.contact-form button {
  padding: 10px 20px;
  background-color: #6a5acd;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.contact-form button:hover {
  background-color: #483d8b;
}

.map iframe {
  border-radius: 10px;
  width: 100%;
  height: 400px;
  border: 0;
}

.logo img {
  margin-right: 10px;
}

.contacts p {
  margin: 5px 0;
}

.documents ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.documents li {
  margin-bottom: 5px;
}

.payment-methods img {
  margin: 0 5px;
}

/* Стили для количества в корзине */
.quantity-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

.quantity-controls button {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
}

.quantity-controls button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.quantity-controls button:hover:not(:disabled) {
  background-color: #0056b3;
}

.quantity-controls span {
  font-weight: bold;
  min-width: 120px;
  text-align: center;
}

/* Стили для модального окна товара */
.product-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: none;
}

.product-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(2px);
}

.product-modal-content {
  position: relative;
  max-width: 800px;
  max-height: 90vh;
  margin: 2% auto;
  background: white;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(0, 0, 0, 0.1);
  border: none;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  color: #666;
  z-index: 1001;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  background: rgba(0, 0, 0, 0.2);
  color: #000;
}

.modal-body {
  display: flex;
  min-height: 400px;
}

.modal-image {
  flex: 1;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-image img {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.modal-info {
  flex: 1;
  padding: 30px;
  display: flex;
  flex-direction: column;
}

.modal-info h2 {
  margin: 0 0 20px 0;
  color: #333;
  font-size: 1.5em;
}

.modal-details {
  margin-bottom: 25px;
}

.modal-details p {
  margin: 8px 0;
  font-size: 1.1em;
}

.modal-price {
  color: #0071b6;
  font-weight: bold;
  font-size: 1.2em !important;
}

.modal-stock {
  color: #28a745;
}

.modal-category {
  color: #6c757d;
}

.modal-description {
  flex: 1;
}

.modal-description h3 {
  margin: 0 0 10px 0;
  color: #555;
  font-size: 1.1em;
}

.modal-description p {
  line-height: 1.6;
  color: #666;
}

/* Анимация загрузки */
@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

.product-card.loading {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200px 100%;
  animation: shimmer 1.5s infinite;
}

/* ===== АДАПТИВНОСТЬ ===== */

/* Планшеты */
@media (max-width: 1024px) {
  header h1 {
    font-size: 2.2em;
  }

  #header-icons {
    top: 15px;
    right: 15px;
    gap: 15px;
  }

  nav ul li a {
    font-size: 1em;
    padding: 6px 10px;
  }

  #products-container {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
  }

  .checkout-container {
    margin: 30px 15px;
    padding: 25px;
  }

  .product-modal-content {
    margin: 5% 15px;
    max-height: 85vh;
  }
}

/* Мобильные устройства */
@media (max-width: 768px) {
  .container {
    padding: 0 10px;
  }

  /* Адаптация header для мобильных */
  header {
    padding: 15px 0;
    text-align: center;
  }

  header h1 {
    font-size: 1.8em;
    margin-bottom: 15px;
    padding: 0 60px; /* Оставляем место для иконок */
  }

  /* Иконки на мобильных */
  #header-icons {
    position: absolute;
    top: 15px;
    right: 10px;
    gap: 10px;
    flex-direction: row;
  }

  #cartButton,
  #profileIcon {
    width: 35px;
    height: 35px;
    font-size: 20px;
  }

  #cartButton img,
  #profileIcon img {
    width: 35px;
    height: 35px;
  }

  /* Навигация на мобильных */
  nav ul {
    padding: 5px;
    gap: 5px;
    justify-content: center;
  }

  nav ul li {
    margin: 2px 5px;
  }

  nav ul li a {
    font-size: 0.9em;
    padding: 8px 10px;
    white-space: nowrap;
  }

  /* Dropdown адаптация */
  .dropdown-content {
    min-width: 140px;
    right: -10px;
  }

  .dropdown-content a {
    padding: 10px 12px;
    font-size: 13px;
  }

  /* Товары на мобильных */
  #products-container {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 15px;
  }

  .product-card {
    padding: 15px;
  }

  .product-card img {
    height: 150px;
    margin-bottom: 12px;
  }

  .product-card h3 {
    font-size: 1.1em;
    margin-bottom: 8px;
  }

  .product-card .price {
    font-size: 1.2em;
  }

  .product-card .add-to-cart,
  .product-card .favorite-btn,
  .product-card .info-btn {
    padding: 12px 15px;
    font-size: 0.9em;
    margin-top: 6px;
  }

  /* Модальное окно на мобильных */
  .product-modal-content {
    margin: 5% 10px;
    max-height: 85vh;
  }
  
  .modal-body {
    flex-direction: column;
    min-height: auto;
  }
  
  .modal-image {
    min-height: 200px;
  }
  
  .modal-info {
    padding: 20px;
  }

  /* Формы на мобильных */
  .checkout-container {
    margin: 20px 10px;
    padding: 20px;
  }

  .checkout-container h2 {
    font-size: 1.6em;
  }

  .contact-form input,
  .contact-form textarea,
  .checkout-form input,
  .checkout-form select,
  .checkout-form textarea {
    font-size: 16px; /* Предотвращает зум на iOS */
  }

  .map iframe {
    height: 300px;
  }
}

/* Маленькие мобильные устройства */
@media (max-width: 480px) {
  header {
    padding: 12px 0;
  }

  header h1 {
    font-size: 1.5em;
    margin-bottom: 12px;
    padding: 0 50px;
  }

  #header-icons {
    top: 12px;
    right: 8px;
    gap: 8px;
  }

  #cartButton,
  #profileIcon {
    width: 30px;
    height: 30px;
    font-size: 18px;
  }

  #cartButton img,
  #profileIcon img {
    width: 30px;
    height: 30px;
  }

  /* Навигация на очень маленьких экранах */
  nav ul {
    gap: 2px;
    padding: 5px 0;
  }

  nav ul li {
    margin: 2px 3px;
  }

  nav ul li a {
    font-size: 0.8em;
    padding: 6px 8px;
  }

  /* Dropdown на маленьких экранах */
  .dropdown-content {
    min-width: 120px;
    right: -5px;
  }

  .dropdown-content a {
    padding: 8px 10px;
    font-size: 12px;
  }

  /* Товары на маленьких экранах */
  #products-container {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
  }

  .product-card {
    padding: 12px;
  }

  .product-card img {
    height: 130px;
    margin-bottom: 10px;
  }

  .product-card h3 {
    font-size: 1em;
    margin-bottom: 6px;
  }

  .product-card .price {
    font-size: 1.1em;
  }

  .product-card p {
    font-size: 0.9em;
  }

  .product-card .add-to-cart,
  .product-card .favorite-btn,
  .product-card .info-btn {
    padding: 10px 12px;
    font-size: 0.85em;
    margin-top: 5px;
  }

  /* Формы на маленьких экранах */
  .checkout-container {
    margin: 15px 5px;
    padding: 15px;
  }

  .checkout-container h2 {
    font-size: 1.4em;
    margin-bottom: 15px;
  }

  .modal-info {
    padding: 15px;
  }

  .modal-close-btn {
    width: 30px;
    height: 30px;
    font-size: 16px;
    top: 10px;
    right: 10px;
  }
}

/* Очень маленькие экраны */
@media (max-width: 360px) {
  header h1 {
    font-size: 1.3em;
    padding: 0 45px;
  }

  nav ul li a {
    font-size: 0.75em;
    padding: 5px 6px;
  }

  #products-container {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
  }

  .product-card {
    padding: 10px;
  }

  .product-card img {
    height: 110px;
  }

  .product-card h3 {
    font-size: 0.95em;
  }

  .product-card .add-to-cart,
  .product-card .favorite-btn,
  .product-card .info-btn {
    padding: 8px 10px;
    font-size: 0.8em;
  }
}

/* Горизонтальная ориентация на мобильных */
@media (max-width: 768px) and (orientation: landscape) {
  header {
    padding: 10px 0;
  }

  header h1 {
    font-size: 1.6em;
    margin-bottom: 8px;
  }

  nav ul {
    padding: 3px;
  }

  nav ul li a {
    padding: 5px 8px;
    font-size: 0.85em;
  }

  #header-icons {
    top: 8px;
    right: 8px;
  }
}

/* Очень широкие экраны */
@media (min-width: 1400px) {
  .container {
    max-width: 1400px;
  }

  header h1 {
    font-size: 2.8em;
  }

  nav ul li a {
    font-size: 1.2em;
    padding: 10px 15px;
  }

  #products-container {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
  }
#header-icons img,
.icon-button img {
  filter: invert(1);
}
}