/* Стили для динамического каталога товаров */

.catalog-empty {
  padding: 40px 20px;
  text-align: center;
  color: #666;
  font-size: 16px;
}

.catalog-error {
  padding: 40px 20px;
  background-color: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 4px;
  color: #856404;
  text-align: center;
}

/* Карточки товаров */
.catalog-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.catalog-product-card {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
  background: white;
}

.catalog-product-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.catalog-product-image {
  position: relative;
  width: 100%;
  padding-bottom: 100%;
  overflow: hidden;
  background: #f5f5f5;
}

.catalog-product-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.catalog-product-card:hover .catalog-product-image img {
  transform: scale(1.05);
}

.catalog-product-stock {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 12px;
  background-color: #4caf50;
  color: white;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.catalog-product-stock.out {
  background-color: #f44336;
}

.catalog-product-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.catalog-product-title {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: #222;
  line-height: 1.3;
  flex-grow: 1;
}

.catalog-product-description {
  margin: 0 0 12px 0;
  font-size: 13px;
  color: #666;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.catalog-product-price {
  font-size: 18px;
  font-weight: 700;
  color: #d81696;
  margin: 12px 0;
}

.catalog-product-actions {
  display: flex;
  gap: 8px;
}

.catalog-product-btn {
  flex: 1;
  padding: 10px 16px;
  background-color: #d81696;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.catalog-product-btn:hover {
  background-color: #b81480;
}

.catalog-product-btn:active {
  transform: scale(0.98);
}

/* Пагинация */
.catalog-pagination {
  display: flex;
  justify-content: center;
  gap: 16px;
  align-items: center;
  margin: 40px 0;
  padding: 20px;
}

.catalog-pagination button {
  padding: 10px 20px;
  background-color: #d81696;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.catalog-pagination button:hover {
  background-color: #b81480;
}

.catalog-pagination button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.catalog-pagination span {
  font-size: 14px;
  color: #666;
  font-weight: 500;
}

/* Модальное окно товара */
.catalog-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.catalog-modal {
  background: white;
  border-radius: 12px;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  gap: 24px;
  position: relative;
}

.catalog-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 32px;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.catalog-modal-close:hover {
  color: #333;
}

.catalog-modal-image {
  flex: 0 0 40%;
  max-width: 400px;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
}

.catalog-modal-content {
  flex: 1;
  padding: 32px;
  padding-top: 40px;
}

.catalog-modal-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.catalog-modal-info h2 {
  margin: 0;
  font-size: 28px;
  color: #222;
  line-height: 1.3;
}

.catalog-modal-description {
  margin: 0;
  font-size: 16px;
  color: #666;
  line-height: 1.5;
}

.catalog-modal-price {
  font-size: 24px;
  font-weight: 700;
  color: #d81696;
}

.catalog-modal-characteristics {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 16px;
}

.catalog-modal-characteristics thead {
  background-color: #f5f5f5;
}

.catalog-modal-characteristics th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: #333;
  border-bottom: 2px solid #ddd;
}

.catalog-modal-characteristics td {
  padding: 12px;
  border-bottom: 1px solid #eee;
}

.catalog-modal-characteristics tr:last-child td {
  border-bottom: none;
}

/* Поиск товаров */
.catalog-search {
  margin-bottom: 24px;
}

.catalog-search input {
  width: 100%;
  max-width: 400px;
  padding: 12px 16px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
  transition: border-color 0.2s ease;
}

.catalog-search input:focus {
  outline: none;
  border-color: #d81696;
  box-shadow: 0 0 0 3px rgba(216, 22, 150, 0.1);
}

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

  .catalog-modal {
    flex-direction: column;
  }

  .catalog-modal-image {
    flex: none;
    max-width: 100%;
    width: 100%;
    height: auto;
  }

  .catalog-modal-content {
    padding: 24px;
    padding-top: 40px;
  }

  .catalog-modal-info h2 {
    font-size: 20px;
  }

  .catalog-modal-price {
    font-size: 20px;
  }
}

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

  .catalog-modal {
    max-width: 95%;
  }

  .catalog-modal-content {
    padding: 16px;
  }

  .catalog-pagination {
    flex-direction: column;
    gap: 12px;
  }
}

/* Вариант сетки для более крупных товаров */
.catalog-products-grid.large {
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
}

/* Вариант списка вместо сетки */
.catalog-products-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.catalog-products-list .catalog-product-card {
  display: grid;
  grid-template-columns: 200px 1fr;
  overflow: visible;
}

.catalog-products-list .catalog-product-image {
  grid-column: 1;
  padding-bottom: 0;
  height: 200px;
}

.catalog-products-list .catalog-product-image img {
  position: relative;
  top: auto;
  left: auto;
}

.catalog-products-list .catalog-product-content {
  grid-column: 2;
  padding: 16px 20px;
}

/* ========================================
   Страница товара
   ======================================== */

.product-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.product-breadcrumb {
  font-size: 14px;
  color: #666;
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.product-breadcrumb a {
  color: #d81696;
  text-decoration: none;
}

.product-breadcrumb a:hover {
  text-decoration: underline;
}

.product-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-bottom: 60px;
}

.product-image {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.product-image img {
  max-width: 100%;
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.product-info h1 {
  font-size: 28px;
  margin: 0 0 20px 0;
  color: #222;
  line-height: 1.3;
}

.product-description {
  font-size: 16px;
  color: #666;
  line-height: 1.6;
  margin-bottom: 20px;
}

.product-price {
  font-size: 24px;
  font-weight: 700;
  color: #d81696;
  margin: 20px 0;
}

.product-price strong {
  font-weight: 600;
  color: #333;
  margin-right: 10px;
}

.product-stock {
  padding: 10px 16px;
  border-radius: 4px;
  font-weight: 600;
  margin: 20px 0;
  display: inline-block;
}

.product-stock.available {
  background-color: #e8f5e9;
  color: #2e7d32;
  border-left: 4px solid #4caf50;
}

.product-stock.unavailable {
  background-color: #ffebee;
  color: #c62828;
  border-left: 4px solid #f44336;
}

.product-sku {
  font-size: 14px;
  color: #666;
  margin: 15px 0;
}

.product-sku strong {
  color: #333;
  margin-right: 10px;
}

.product-characteristics {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid #eee;
}

.product-characteristics h3 {
  margin: 0 0 20px 0;
  font-size: 18px;
  color: #222;
}

.product-char {
  display: grid;
  grid-template-columns: 200px 1fr;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
}

.product-char strong {
  color: #333;
  padding-right: 20px;
}

.product-actions {
  display: flex;
  gap: 12px;
  margin-top: 30px;
  flex-wrap: wrap;
}

.btn-back,
.btn-contact {
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-back {
  background-color: #f0f0f0;
  color: #333;
}

.btn-back:hover {
  background-color: #e0e0e0;
}

.btn-contact {
  background-color: #d81696;
  color: white;
  flex: 1;
  min-width: 150px;
}

.btn-contact:hover {
  background-color: #b81480;
}

@media (max-width: 768px) {
  .product-container {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .product-info h1 {
    font-size: 22px;
  }

  .product-char {
    grid-template-columns: 1fr;
  }

  .product-char strong {
    display: block;
    margin-bottom: 5px;
  }

  .product-actions {
    flex-direction: column;
  }

  .btn-contact {
    flex: none;
    width: 100%;
  }
}
