/* ========== PRODUCT PAGE STYLES ========== */

.product {
  padding: var(--space-xl) 0;
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-bottom: var(--space-2xl);
  font-size: var(--font-size-sm);
  color: var(--clr-text-light);
  flex-wrap: wrap;
  padding: 0 var(--space-md);
}

.breadcrumb__link {
  color: var(--clr-primary);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  text-decoration: none;
}

.breadcrumb__link:hover {
  color: var(--clr-primary-dark);
}

.breadcrumb__separator {
  color: var(--clr-text-lighter);
}

.breadcrumb__current {
  color: var(--clr-text);
  font-weight: var(--font-weight-medium);
}

/* Product Layout */
.product__layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl);
  margin-bottom: var(--space-2xl);
  padding: 0 var(--space-md);
  width: 100%;
}

@media (min-width: 1024px) {
  .product__layout {
    grid-template-columns: minmax(400px, 1fr) minmax(400px, 1fr);
    gap: var(--space-3xl);
    align-items: start;
    max-width: var(--max-width);
    margin: 0 auto var(--space-2xl);
  }
}

/* Gallery - PURE CSS SOLUTION - ПОЛНОСТЬЮ ИСПРАВЛЕНА */
.product__gallery {
  display: flex;
  flex-direction: column;
  gap: var(--space);
}

.gallery__main {
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: var(--clr-surface);
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.gallery__images {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Скрываем радио-кнопки */
.gallery__radio {
  display: none;
}

/* Стили для всех изображений */
.gallery__image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: var(--clr-bg);
  padding: var(--space);
}

/* Показываем первое изображение по умолчанию */
.gallery__image:first-of-type {
  opacity: 1;
}

/* Показываем изображение когда выбран соответствующий радио-инпут */
#thumb-0:checked ~ .gallery__image:nth-of-type(1),
#thumb-1:checked ~ .gallery__image:nth-of-type(2),
#thumb-2:checked ~ .gallery__image:nth-of-type(3),
#thumb-3:checked ~ .gallery__image:nth-of-type(4),
#thumb-4:checked ~ .gallery__image:nth-of-type(5),
#thumb-5:checked ~ .gallery__image:nth-of-type(6) {
  opacity: 1;
}

/* Миниатюры */
.gallery__thumbs {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding: var(--space-sm) 0;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  justify-content: center;
}

.gallery__thumbs::-webkit-scrollbar {
  height: 4px;
}

.gallery__thumbs::-webkit-scrollbar-track {
  background: var(--clr-border-light);
  border-radius: var(--radius);
}

.gallery__thumbs::-webkit-scrollbar-thumb {
  background: var(--clr-border-dark);
  border-radius: var(--radius);
}

.thumb__label {
  flex-shrink: 0;
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 2px;
  background: none;
  cursor: pointer;
  transition: var(--transition);
  aspect-ratio: 1 / 1;
  display: block;
}

.thumb__label:hover,
.thumb__label:focus {
  border-color: var(--clr-primary);
  transform: translateY(-2px);
}

/* Подсвечиваем активную миниатюру */
.gallery__radio:checked + .gallery__image + .thumb__label,
#thumb-0:checked ~ .gallery__thumbs .thumb__label:nth-child(1),
#thumb-1:checked ~ .gallery__thumbs .thumb__label:nth-child(2),
#thumb-2:checked ~ .gallery__thumbs .thumb__label:nth-child(3),
#thumb-3:checked ~ .gallery__thumbs .thumb__label:nth-child(4),
#thumb-4:checked ~ .gallery__thumbs .thumb__label:nth-child(5),
#thumb-5:checked ~ .gallery__thumbs .thumb__label:nth-child(6) {
  border-color: var(--clr-primary);
}

.thumb__label img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  display: block;
}

/* Style the label when radio is checked */
.gallery__radio:checked + .thumb__label {
  border-color: var(--clr-primary);
}

.thumb__label img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  display: block;
}

/* Product Info */
.product__info {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.product__header {
  margin-bottom: var(--space);
}

.product__title {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  margin-bottom: var(--space);
  color: var(--clr-text);
}

@media (min-width: 768px) {
  .product__title {
    font-size: var(--font-size-3xl);
  }
}

.product__rating {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.rating-stars {
  display: flex;
  gap: 2px;
}

.rating-star {
  color: var(--clr-border);
  font-size: var(--font-size-lg);
}

.rating-star--active {
  color: #fbbf24;
}

.rating-value {
  font-weight: var(--font-weight-semibold);
  color: var(--clr-text);
  margin-left: var(--space-xs);
}

.rating-count {
  color: var(--clr-text-light);
  font-size: var(--font-size-sm);
}

/* Purchase Section */
.product__purchase {
  background: var(--clr-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow);
  margin-bottom: var(--space);
  border: 1px solid var(--clr-border-light);
}

.product__price {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--clr-primary);
  margin-bottom: var(--space);
  display: flex;
  align-items: baseline;
  gap: var(--space-xs);
}

.price-value {
  font-size: var(--font-size-3xl);
}

.price-currency {
  font-size: var(--font-size-xl);
  color: var(--clr-text-light);
}

.stock-info {
  display: flex;
  align-items: center;
  gap: var(--space);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.stock-badge {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
}

.stock-badge--in-stock {
  background: var(--clr-success-light);
  color: var(--clr-success);
}

.delivery-info {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--clr-text-light);
  font-size: var(--font-size-sm);
}

.purchase-actions {
  display: flex;
  gap: var(--space);
  align-items: center;
}

.btn--purchase {
  flex: 1;
  justify-content: center;
}

/* ИСПРАВЛЕНА КНОПКА WISHLIST */
.btn--wishlist {
  padding: var(--space-sm);
  flex-shrink: 0;
  border-radius: var(--radius);
  width: 48px; /* Фиксированная ширина */
  height: 48px; /* Фиксированная высота */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Features */
.product__features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space);
  margin-bottom: var(--space-lg);
}

@media (min-width: 640px) {
  .product__features {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 480px) {
  .product__features {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }
}

.feature {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--font-size-sm);
  color: var(--clr-text-light);
  padding: var(--space-sm);
  background: var(--clr-border-light);
  border-radius: var(--radius);
}

.feature__icon {
  font-size: var(--font-size-lg);
  flex-shrink: 0;
}

/* Short Description */
.product__short-desc {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-relaxed);
  color: var(--clr-text);
  margin-bottom: var(--space-lg);
  padding: var(--space);
  background: var(--clr-border-light);
  border-radius: var(--radius);
  border-left: 4px solid var(--clr-primary);
}

/* Highlights */
.product__highlights {
  background: var(--clr-border-light);
  padding: var(--space-xl);
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-lg);
  border: 1px solid var(--clr-border);
}

.highlights__title {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space);
  color: var(--clr-text);
}

.highlights__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.highlight__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  padding: var(--space-xs) 0;
}

.highlight__icon {
  color: var(--clr-success);
  font-size: var(--font-size-lg);
  flex-shrink: 0;
}

.highlight__text {
  color: var(--clr-text);
  line-height: var(--line-height-relaxed);
}

/* Specifications */
.product__specs {
  margin-bottom: var(--space-lg);
}

.specs__title {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space);
  color: var(--clr-text);
}

.specs__grid {
  display: grid;
  gap: var(--space-sm);
  background: var(--clr-surface);
  padding: var(--space);
  border-radius: var(--radius);
  border: 1px solid var(--clr-border);
}

.spec__item {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--clr-border);
}

.spec__item:last-child {
  border-bottom: none;
}

.spec__name {
  font-weight: var(--font-weight-medium);
  color: var(--clr-text-light);
}

.spec__value {
  color: var(--clr-text);
  text-align: right;
  font-weight: var(--font-weight-medium);
}

/* Tabs - ИСПРАВЛЕНА СТРУКТУРА */
.product__tabs {
  background: var(--clr-surface);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-top: var(--space-2xl);
  border: 1px solid var(--clr-border);
  margin: var(--space-2xl) var(--space-md) 0;
}

@media (min-width: 1024px) {
  .product__tabs {
    margin: var(--space-2xl) auto 0;
    max-width: var(--max-width);
  }
}

.tabs__header {
  display: flex;
  border-bottom: 1px solid var(--clr-border);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.tabs__header::-webkit-scrollbar {
  display: none;
}

.tab__radio {
  display: none;
}

.tab__label {
  padding: var(--space-md) var(--space-xl);
  background: none;
  border: none;
  font-weight: var(--font-weight-medium);
  color: var(--clr-text-light);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  flex: 1;
  min-width: 120px;
  text-align: center;
  display: block;
}

.tab__label:hover {
  color: var(--clr-primary);
  background: var(--clr-border-light);
}

/* Tab content switching with CSS - ИСПРАВЛЕНА ЛОГИКА */
.tabs__content {
  position: relative;
}

.tab__content {
  display: none;
  padding: var(--space-xl);
}

/* Правильный селектор для табов */
#tab-desc:checked ~ .tabs__content .tab__content:nth-of-type(1),
#tab-specs:checked ~ .tabs__content .tab__content:nth-of-type(2),
#tab-reviews:checked ~ .tabs__content .tab__content:nth-of-type(3),
#tab-delivery:checked ~ .tabs__content .tab__content:nth-of-type(4) {
  display: block;
}

/* Правильный селектор для активных табов */
#tab-desc:checked ~ .tabs__header .tab__label[for="tab-desc"],
#tab-specs:checked ~ .tabs__header .tab__label[for="tab-specs"],
#tab-reviews:checked ~ .tabs__header .tab__label[for="tab-reviews"],
#tab-delivery:checked ~ .tabs__header .tab__label[for="tab-delivery"] {
  color: var(--clr-primary);
  border-bottom-color: var(--clr-primary);
  background: var(--clr-border-light);
}

/* Full Description */
.product__full-desc {
  line-height: var(--line-height-relaxed);
}

.product__full-desc p {
  margin-bottom: var(--space);
}

.product__full-desc ul,
.product__full-desc ol {
  margin-bottom: var(--space);
  padding-left: var(--space-lg);
}

.product__full-desc li {
  margin-bottom: var(--space-xs);
}

/* Specifications Table */
.specs-table-container {
  overflow-x: auto;
}

.specs-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 500px;
}

.specs-table__header {
  padding: var(--space-sm) var(--space);
  text-align: left;
  border-bottom: 1px solid var(--clr-border);
  font-weight: var(--font-weight-medium);
  color: var(--clr-text-light);
  width: 40%;
  background: var(--clr-border-light);
}

.specs-table__value {
  padding: var(--space-sm) var(--space);
  text-align: left;
  border-bottom: 1px solid var(--clr-border);
  color: var(--clr-text);
  font-weight: var(--font-weight-medium);
}

/* Reviews */
.reviews-container {
  min-height: 200px;
}

.reviews-summary {
  text-align: center;
  padding: var(--space-xl);
  color: var(--clr-text-light);
  background: var(--clr-border-light);
  border-radius: var(--radius);
}

.reviews-empty {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--clr-text-light);
}

.reviews-empty__icon {
  font-size: var(--font-size-4xl);
  margin-bottom: var(--space);
  opacity: 0.5;
}

.reviews-empty__title {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space);
  color: var(--clr-text);
}

.reviews-empty__text {
  line-height: var(--line-height-relaxed);
}

/* Delivery Info */
.delivery-info-content {
  padding: var(--space);
}

.delivery-info__title {
  margin-bottom: var(--space);
  color: var(--clr-text);
  font-size: var(--font-size-lg);
}

.delivery-info__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.delivery-info__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space);
  padding: var(--space-sm);
  background: var(--clr-border-light);
  border-radius: var(--radius);
  border-left: 4px solid var(--clr-primary);
}

.delivery-info__item-icon {
  font-size: var(--font-size-lg);
  flex-shrink: 0;
}

.delivery-info__item-text {
  color: var(--clr-text);
  font-weight: var(--font-weight-medium);
}

/* Responsive Design */
@media (max-width: 768px) {
  .product {
    padding: var(--space) 0;
  }
  
  .breadcrumb {
    margin-bottom: var(--space-xl);
    padding: 0 var(--space);
  }
  
  .product__layout {
    padding: 0 var(--space);
    gap: var(--space-xl);
  }
  
  .product__title {
    font-size: var(--font-size-2xl);
  }
  
  .product__price {
    font-size: var(--font-size-xl);
  }
  
  .price-value {
    font-size: var(--font-size-2xl);
  }
  
  .product__purchase {
    padding: var(--space-lg);
  }
  
  .purchase-actions {
    flex-direction: column;
  }
  
  .btn--purchase {
    width: 100%;
  }
  
  /* ИСПРАВЛЕНА КНОПКА WISHLIST НА МОБИЛЬНЫХ */
  .btn--wishlist {
    width: 100%;
    height: 48px;
    margin-top: var(--space-sm);
  }
  
  .spec__item {
    grid-template-columns: 1fr;
    gap: var(--space-xs);
    text-align: left;
  }
  
  .spec__value {
    text-align: left;
  }
  
  .tab__content {
    padding: var(--space);
  }
  
  .tab__label {
    padding: var(--space) var(--space-lg);
    font-size: var(--font-size-sm);
    min-width: 100px;
  }
  
  .product__short-desc {
    font-size: var(--font-size-base);
    padding: var(--space);
  }
  
  /* Mobile gallery fixes */
  .gallery__main {
    aspect-ratio: 1 / 1;
    max-height: none;
    min-height: 250px;
  }
  
  .thumb__label img {
    width: 50px;
    height: 50px;
  }
  
  .gallery__thumbs {
    gap: var(--space-xs);
    padding: var(--space-xs) 0;
    justify-content: flex-start;
  }
}

@media (max-width: 480px) {
  .gallery__main {
    min-height: 200px;
  }
  
  .thumb__label img {
    width: 45px;
    height: 45px;
  }
  
  .gallery__thumbs {
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .stock-info {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }
  
  .tabs__header {
    flex-direction: column;
  }
  
  .tab__label {
    border-bottom: none;
    border-left: 3px solid transparent;
    text-align: left;
    justify-content: flex-start;
  }
  
  #tab-desc:checked ~ .tabs__header .tab__label[for="tab-desc"],
  #tab-specs:checked ~ .tabs__header .tab__label[for="tab-specs"],
  #tab-reviews:checked ~ .tabs__header .tab__label[for="tab-reviews"],
  #tab-delivery:checked ~ .tabs__header .tab__label[for="tab-delivery"] {
    border-bottom: none;
    border-left-color: var(--clr-primary);
  }
  
  .specs-table {
    min-width: 300px;
    font-size: var(--font-size-sm);
  }
  
  .specs-table__header,
  .specs-table__value {
    padding: var(--space-xs) var(--space-sm);
  }
}

/* Loading state for images */
.gallery__image.loading {
  background: linear-gradient(90deg, var(--clr-border-light) 25%, var(--clr-border) 50%, var(--clr-border-light) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}