/* ============================================
   ECOFACTOR - Product Page Styles
   ПОВНА ВЕРСТКА ПІД FIGMA ДИЗАЙН
   ============================================ */

/* ============================================
   PRODUCT SECTION
   ============================================ */
.header {
    background-color: var(--color-gray-95) !important;
}
.product {
  padding: 60px 146px 80px;
}

.product .container {
  max-width: 1148px;
  display: flex;
  flex-direction: column;
  gap: 60px;
}

/* Top Row - Breadcrumbs & Cart */
.product__top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Breadcrumbs */
.product__breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.product__breadcrumb-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: var(--font-regular);
  line-height: 1.6;
  color: #3a3a3a;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.product__breadcrumb-icon {
  flex-shrink: 0;
}

.product__breadcrumb-separator {
  flex-shrink: 0;
  color: var(--text-secondary);
}

button.btn.btn--outline.btn--md {
    width: auto;
}

.product__breadcrumb-icon {
    transition: transform 0.3s ease;
}

.product__breadcrumb-icon path,
.product__breadcrumb-icon rect {
    transition: stroke 0.3s ease, fill 0.3s ease;
}


.product__breadcrumb-item:hover .product__breadcrumb-icon {
    transform: translateX(5px);
}

.product__breadcrumb-item:hover .product__breadcrumb-icon path {
    stroke: var(--color-green-50);
}
svg.product__breadcrumb-icon {
    position: relative;
    top: 2px;
}
.product__breadcrumb-item:hover .product__breadcrumb-icon rect {
    stroke: var(--color-green-50);
    fill: var(--color-green-50);
}
/* ============================================
   PRODUCT LAYOUT - 50/50 РОЗПОДІЛ
   ============================================ */

.product__layout {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  align-items: flex-start;
}

/* ============================================
   GALLERY - 50% ШИРИНИ
   Grid 4×4: головне фото col 1-3 row 1-3, мініатюри row 4
   ============================================ */

.product__gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 20px;
  width: calc(50% - 15px);
  height: 501px;
  flex-shrink: 0;
}

/* Головне фото - col 1-4, row 1-3 (на всю ширину) */
.product__gallery-main {
  grid-column: 1 / 5;
  grid-row: 1 / 4;
  position: relative;
  background: linear-gradient(180deg, #f1f3f5 0%, #ffffff 100%);
  border: 1px solid #f1f3f5;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  padding: 0;
  cursor: zoom-in;
}

.product__gallery-image {
  flex: 1 0 0;
  min-height: 1px;
  min-width: 1px;
  position: relative;
  width: 100%;
  object-fit: cover;
}

/* Type Badge */
.product__type-badge {
  position: absolute;
  bottom: 39.75px;
  left: -1px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background-color: #f1f3f5;
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
  font-family: var(--font-primary);
  font-size: 14px;
  line-height: 1.55;
  font-weight: var(--font-regular);
  color: #3a3a3a;
  z-index: 2;
  overflow: hidden;
}

.product__type-badge svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* Arrow Navigation */
.product__gallery .arrow-nav {
  position: absolute;
  bottom: 16.75px;
  right: 17.5px;
  display: flex;
  gap: 13px;
  align-items: center;
  z-index: 2;
}

.product__gallery .arrow-btn {
  width: 32px;
  height: 32px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
  box-sizing: border-box;
}

.product__gallery .arrow-btn:hover {
  background: rgba(255, 255, 255, 1);
}

.product__gallery .arrow-btn__icon {
  width: 8px;
  height: 12px;
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product__gallery .arrow-btn__icon svg {
  width: 100%;
  height: 100%;
  color: white;
  display: block;
  max-width: none;
}

/* Мініатюри - row 4, горизонтально */
.product__thumb {
  grid-row: 4;
  border: 1px solid #eaeaea;
  border-radius: 12px;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.product__thumb:nth-child(2) { grid-column: 1; }
.product__thumb:nth-child(3) { grid-column: 2; }
.product__thumb:nth-child(4) { grid-column: 3; }
.product__thumb:nth-child(5) { grid-column: 4; }

.product__thumb:nth-of-type(1) { grid-column: 1; }
.product__thumb:nth-of-type(2) { grid-column: 2; }
.product__thumb:nth-of-type(3) { grid-column: 3; }
.product__thumb:nth-of-type(4) { grid-column: 4; }

/* When 5 thumbnails: switch to 5-column sub-grid for row 4 */
.product__gallery--five-thumbs {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.product__gallery--five-thumbs .product__gallery-main {
  grid-column: 1 / 6;
}

.product__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: relative;
}

/* Оверлей на всіх мініатюрах крім активної */
.product__thumb:not(.product__thumb--active)::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(58, 58, 58, 0.1);
  border-radius: 12px;
  pointer-events: none;
}

/* ============================================
   PRODUCT INFO - 50% ШИРИНИ
   ============================================ */

.product__info {
  width: calc(50% - 15px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.product__sku {
  font-family: var(--font-primary);
  font-size: 12px;
  line-height: 1.3;
  font-weight: var(--font-regular);
  color: #3a3a3a;
}

.product__title {
  font-family: var(--font-primary);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.3;
  color: #3a3a3a;
  margin: 0;
}

.product__price {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 31px;
}

.product__price-current {
  font-family: var(--font-primary);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.45;
  color: #3a3a3a;
  text-transform: uppercase;
}

.product__price-old {
  position: relative;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.45;
  color: #9c9c9c;
  text-transform: uppercase;
  text-decoration: none;
}

.product__price-old::after {
  content: '';
  position: absolute;
  left: 0.5px;
  top: 50%;
  width: 100%;
  height: 1px;
  background: #9c9c9c;
  border-radius: 20px;
}

.product__description {
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: var(--font-regular);
  line-height: 1.5;
  color: #3a3a3a;
  margin: 0;
}

/* Options */
.product__options {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 32px;
}

.product__options-label {
  font-family: var(--font-primary);
  font-size: 12px;
  line-height: 1.55;
  font-weight: var(--font-regular);
  color: #525252;
}

.product__options-chips {
  display: flex;
  gap: 8px;
}

/* Buy Button */
.product__buy-btn {
  align-self: flex-start;
  min-width: 160px;
  padding: 14px 32px;
}

.product__buy-btn.in-cart {
  background-color: var(--color-green-60);
  border-color: var(--color-green-60);
}

.product__buy-btn--disabled,
.product__buy-btn--disabled:hover {
  background-color: transparent;
  border-color: var(--color-gray-35);
  color: var(--text-secondary);
  cursor: not-allowed;
}

/* ============================================
   ACCORDIONS
   ============================================ */

.product__accordions {
  display: flex;
  flex-direction: column;
  border: 1px solid #f1f3f5;
  border-radius: 16px;
  overflow: hidden;
}

.product__accordion {
  border-bottom: 1px solid #f1f3f5;
  background: white;
}

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

.product__accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.1;
  color: #3a3a3a;
  text-align: left;
  transition: background 0.2s ease;
}

.product__accordion-header:hover {
  background: #fafafa;
}

.product__accordion-header span {
  flex: 1;
  min-width: 0;
}

.product__accordion-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  color: #525252;
  transition: transform 0.2s ease;
}

.product__accordion.open .product__accordion-icon {
  transform: rotate(180deg);
}

.product__accordion-content {
  display: none;
  padding: 0 12px 12px 12px;
}

.product__accordion.open .product__accordion-content {
  display: block;
}

.product__accordion-content p {
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: var(--font-regular);
  line-height: 1.55;
  color: #3a3a3a;
  margin: 0;
}

.product__accordion-content p + p {
  margin-top: 8px;
}

/* ============================================
   SPECIFICATIONS - З ТАБАМИ
   ============================================ */

.product__specs-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 40px;
  align-items: flex-start;
}

.product__specs {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Table Wrapper з Табами */
.product__specs-table-wrapper {
  border: 1px solid #f1f3f5;
  border-radius: 16px;
  overflow: hidden;
  background: white;
}

/* Tabs */
.product__specs-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid #f1f3f5;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
}

.product__specs-tab {
  flex: 1;
  padding: 16px;
  background: #f1f3f5;
  border: none;
  border-bottom: 1px solid #f1f3f5;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.1px;
  text-align: center;
  color: #3a3a3a;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.product__specs-tab::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: transparent;
}

.product__specs-tab:hover {
  background: #e8eaec;
}

.product__specs-tab--active {
  background: #fefefe;
  border-bottom-color: #fefefe;
}

/* Table */
.product__specs-table {
  width: 100%;
  border-collapse: collapse;
}

.product__specs-table tr {
  border-bottom: 1px solid #f1f3f5;
}

.product__specs-table tr:last-child {
  border-bottom: none;
}

.product__specs-table td {
  padding: 12px 16px;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: var(--font-regular);
  line-height: 1.6;
}

.product__specs-table td:first-child {
  color: #1f1f1f;
  width: 50%;
}

.product__specs-table td:last-child {
  color: #1f1f1f;
}

/* Description Tab Content */
.product__specs-description {
  display: none;
  padding: 24px;
  gap: 20px;
  flex-direction: column;
  color: #3a3a3a;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: var(--font-regular);
  line-height: 1.5;
}

.product__specs-description.active {
  display: flex;
}

/* Title inside description (first strong/h-tag or .description-title) */
.product__specs-description > h1,
.product__specs-description > h2,
.product__specs-description > h3,
.product__specs-description > h4,
.product__specs-description > h5,
.product__specs-description > h6 {
  font-family: var(--font-primary);
  font-size: 20px;
  font-weight: var(--font-semibold);
  line-height: 1.5;
  color: #3a3a3a;
  margin: 0;
}

.product__specs-description p {
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: var(--font-regular);
  line-height: 1.5;
  color: #3a3a3a;
  margin: 0 0 10px 0;
}

.product__specs-description p:last-child {
  margin-bottom: 0;
}

/* strong/b всередині p — inline жирний */
.product__specs-description p strong,
.product__specs-description p b {
  font-weight: var(--font-semibold);
}

/* strong/b як прямий дочірній — виступає як h4 */
.product__specs-description > strong,
.product__specs-description > b {
  display: block;
  font-size: 20px;
  font-weight: var(--font-semibold);
  line-height: 1.5;
  color: #3a3a3a;
  margin: 0 0 10px 0;
}

/* p що містить тільки strong/b — теж виступає як h4 (WordPress wpautop обгортає в p) */
.product__specs-description p:has(> strong:only-child),
.product__specs-description p:has(> b:only-child) {
  font-size: 20px;
  font-weight: var(--font-semibold);
  line-height: 1.5;
  margin: 0 0 10px 0;
}

.product__specs-description p:has(> strong:only-child) strong,
.product__specs-description p:has(> b:only-child) b {
  font-size: inherit;
  font-weight: inherit;
}

.product__specs-description ul,
.product__specs-description ol {
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: var(--font-regular);
  line-height: 1.5;
  color: #3a3a3a;
  margin: 0 0 10px 0;
  padding-left: 20px;
}

.product__specs-description li {
  margin-bottom: 4px;
}

/* Downloads - ВСЕРЕДИНІ SPECS */
.product__downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  background: white;
  border: 1px solid #f1f3f5;
  border-radius: 16px;
}

.product__download-link {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 20px;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #3dd078;
  text-decoration: none;
  transition: all 0.2s ease;
}

.product__download-link span {
  border-bottom: 1px solid #3dd078;
  line-height: 1.35;
}

.product__download-link:hover {
  color: #2ab865;
}

.product__download-link:hover span {
  border-bottom-color: #2ab865;
}

.product__download-link svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* CTA Banner */
.product__cta-banner {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #f1f3f5;
}

.product__cta-banner img {
  width: 100%;
  height: auto;
  display: block;
}

.product__cta-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.product__cta-text {
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: var(--font-regular);
  line-height: 1.5;
  color: #3a3a3a;
  margin: 0;
}

/* ============================================
   RELATED PRODUCTS
   ============================================ */

.related-products {
  padding: 0 146px 80px;
  background-color: var(--color-gray-98);
}

.related-products .container {
  max-width: 1148px;
  padding-top: 60px;
}

.related-products__title {
  font-family: var(--font-primary);
  font-size: var(--h3-size);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin: 0 0 40px 0;
}

.related-products__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 30px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1279px) {
  .product {
    padding: 40px 40px 60px;
  }

  .product__layout {
    gap: 40px;
  }

  .product__gallery {
    width: calc(50% - 20px);
  }

  .product__info {
    width: calc(50% - 20px);
  }

  .product__specs-layout {
    grid-template-columns: 1fr 260px;
    gap: 30px;
  }

  .related-products {
    padding: 0 40px 60px;
  }

  .related-products__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1024px) {
  .related-products__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .product {
    padding: 30px 20px 40px;
  }

  .product .container {
    gap: 30px;
  }

  .product__layout {
    flex-direction: column;
  }

  .product__gallery {
    width: 100%;
    height: auto;
  }

  .product__gallery--five-thumbs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .product__info {
    width: 100%;
  }

  .product__gallery-main {
    aspect-ratio: 4 / 3;
  }

  .product__thumb {
    aspect-ratio: 1;
  }

  .product__title {
    font-size: 24px;
  }

  .product__price-current {
    font-size: 18px;
  }

  .product__buy-btn {
    width: 100%;
  }

  .product__specs-layout {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .product__downloads {
    flex-direction: column;
    align-items: stretch;
  }

  .product__download-link {
    justify-content: center;
  }

  .related-products {
    padding: 0 20px 40px;
  }

  .related-products .container {
    padding-top: 40px;
  }

  .related-products__title {
    font-size: var(--h4-size);
    margin-bottom: 24px;
  }

  .related-products__grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* ============================================
   LIGHTBOX
   ============================================ */

.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.lightbox.open {
  opacity: 1;
  visibility: visible;
}

.lightbox__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  cursor: pointer;
}

.lightbox__content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__image {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-lg);
}

.lightbox__close {
  position: absolute;
  top: -50px;
  right: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--color-white);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lightbox__close:hover {
  color: var(--color-green-60);
  transform: scale(1.1);
}

.lightbox__nav {
  position: absolute;
  bottom: -60px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
}

.lightbox__nav .arrow-btn {
  background-color: var(--color-white);
}

.lightbox__counter {
  position: absolute;
  bottom: -55px;
  right: 0;
  font-family: var(--font-primary);
  font-size: var(--body-size);
  color: var(--color-white);
}

/* Mobile lightbox */
@media (max-width: 768px) {
  .lightbox__close {
    top: 10px;
    right: 10px;
    position: fixed;
  }

  .lightbox__nav {
    bottom: 30px;
    position: fixed;
  }

  .lightbox__counter {
    bottom: 35px;
    right: 20px;
    position: fixed;
  }
}
