/* ==========================================================================
   PRODUCT PREVIEW - Component Styles
   ========================================================================== */

.product-preview {
  display: flex;
  flex-direction: column;
}

/* Product Image Section */
.product-preview__image {
  background: var(--color-secondary);
  border-radius: 0 10px 0 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--spacing-5xl);
  flex: 1;
  width: 397px;
  height: 397px;
}

/* Frame Preview Container */
.frame-preview-display {
  position: relative;
  display: inline-block;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.frame-preview-display__image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  position: relative;
  z-index: 1;
  transition: all 0.3s ease;
}

.frame-preview-display__frame {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: all 0.4s ease;
  z-index: 2;
}

/* Loading State */
.frame-preview-display.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid rgba(1, 107, 255, 0.2);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Product Info Section */
.product-preview__info {
  display: flex;
  flex-direction: column;
  padding: var(--spacing-3xl);
  gap: var(--spacing-xxl);
  border-radius: 0 0 10px 0;
  background: var(--color-accent);
}

.product-info__row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: var(--spacing-xl);
}

.product-info__details {
  display: flex;
  align-items: start;
  gap: var(--spacing-md);
  flex: 1;
}

/* Frame Thumbnail */
.product-info__thumbnail {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid transparent;
  transition: border-color 0.3s ease;
}

.product-info__thumbnail.active {
  border-color: var(--color-primary);
}
.product-info__thumbnail-default {
  background: linear-gradient(0deg, var(--color-secondary) 10.27%, rgba(14, 17, 24, 0) 100%);
}

/* Frame Details */
.product-info__frame {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.product-info__title {
  color: var(--color-secondary-alt);
  font-size: 16px;
  font-weight: 600;
  line-height: normal;
  letter-spacing: 0.16px;
  text-transform: uppercase;
  margin: 0;
}

.product-info__description {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.product-info__name,
.product-info__size {
  color: #909090;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
}

.product-info__name {
  color: #b0b0b0;
}

/* Price */
.product-info__price {
  color: var(--color-secondary-alt);
  font-size: 16px;
  font-weight: 600;
  line-height: normal;
  letter-spacing: 0.16px;
  text-transform: uppercase;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Divider */
.product-info__divider {
  width: 100%;
  height: 2px;
  background-color: var(--color-secondary);
  border-radius: 2px;
}

/* Empty State */
.product-preview__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: #909090;
  text-align: center;
  gap: 10px;
}

.product-preview__empty-icon {
  width: 60px;
  height: 60px;
  opacity: 0.3;
}

.product-preview__empty-text {
  font-size: 14px;
  font-weight: 500;
}

/* Animations */
@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes fadeInPreview {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.frame-preview-display__frame.updated {
  animation: fadeInPreview 0.4s ease;
}

/* ==========================================================================
   Responsive - grouped at the end
   ========================================================================== */

/* Desktop and larger */
@media (max-width: 1025px) {
  /* Product preview sections are separated */
  .product-preview {
    display: contents; /* Children become direct children of flex container */
  }

  /* Image is on right side, top corner */
  .product-preview__image {
    order: 1; /* After frame-selector on desktop */
    border-radius: 0 10px 0 0;
    height: auto;
  }

  /* Info is on right side, bottom corner */
  .product-preview__info {
    order: 3; /* After image on desktop */
    border-radius: 0 0 10px 0;
  }
}

/* Tablet / small desktop and mobile */
@media (max-width: 1024px) {
  .product-preview {
    min-width: auto;
    width: 100%;
    display: contents; /* Override display: contents on mobile */
  }

  .frame-preview-display__frame {
    max-width: 100%;
    height: auto;
  }

  .product-preview__image {
    border-radius: 0;
    /* min-height: 300px; */
    width: 100%;
    order: 1; /* First on mobile */
  }

  .product-preview__info {
    border-radius: 0;
    order: 3; /* Third on mobile, after frame-selector */
  }
}

/* Mobile */
@media (max-width: 768px) {
  .product-preview__image {
    padding: 20px;
    /* min-height: 250px; */
  }

  .product-preview__info {
    padding: 20px;
    gap: 15px;
  }

  .product-info__thumbnail {
    width: 40px;
    height: 40px;
  }

  .product-info__title {
    font-size: 14px;
  }

  .product-info__price {
    font-size: 14px;
  }
}
