/**
 * Frontend styles for WPBridge plugin
 * Product card badges and overlay positioning
 */

/* Import filter widget styles */
@import url("./filter-widget.css");

/* =========================================================================
   Product Card Badges - Base styles
   ========================================================================= */

.wpbridge-product-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.wpbridge-product-card__badge {
  display: inline-block;
  padding: 4px 8px;
  background-color: #f0f0f0;
  color: #333;
  font-size: 0.85em;
  font-weight: 600;
  border-radius: 3px;
  white-space: nowrap;
}

/* =========================================================================
   Badge Types - Default colors
   ========================================================================= */

.wpbridge-product-card__badge--new {
  background-color: #4caf50;
  color: #ffffff;
}

.wpbridge-product-card__badge--sale {
  background-color: #ff6b6b;
  color: #ffffff;
}

.wpbridge-product-card__badge--lot {
  background-color: #2196f3;
  color: #ffffff;
}

.wpbridge-product-card__badge--limited-stock {
  background-color: #ff9800;
  color: #ffffff;
}

/* =========================================================================
   Badges - Inline positioning (default)
   ========================================================================= */

.wpbridge-product-card__badges--inline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

/* =========================================================================
   Badges - Image overlay positioning
   ========================================================================= */

.wpbridge-product-card__media {
  position: relative;
  overflow: hidden;
}

/* Base positioning for image overlays */
.wpbridge-product-card__badges--image-top-left,
.wpbridge-product-card__badges--image-top-right,
.wpbridge-product-card__badges--image-bottom-left,
.wpbridge-product-card__badges--image-bottom-right {
  position: absolute;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  z-index: 10;
  pointer-events: auto;
}

/* Top Left */
.wpbridge-product-card__badges--image-top-left {
  top: var(--badges-offset-y, 8px);
  left: var(--badges-offset-x, 8px);
}

/* Top Right */
.wpbridge-product-card__badges--image-top-right {
  top: var(--badges-offset-y, 8px);
  right: var(--badges-offset-x, 8px);
}

/* Bottom Left */
.wpbridge-product-card__badges--image-bottom-left {
  bottom: var(--badges-offset-y, 8px);
  left: var(--badges-offset-x, 8px);
}

/* Bottom Right */
.wpbridge-product-card__badges--image-bottom-right {
  bottom: var(--badges-offset-y, 8px);
  right: var(--badges-offset-x, 8px);
}

/* =========================================================================
   Product Card - General
   ========================================================================= */

.wpbridge-product-card {
  display: flex;
  flex-direction: column;
}

.wpbridge-product-card--classic {
  /* Default classic layout */
}

.wpbridge-product-card--compact {
  /* Compact variant */
}

.wpbridge-product-card--overlay {
  position: relative;
  height: 100%;
}

.wpbridge-product-card--overlay .wpbridge-product-card__media {
  flex: 1;
  background-size: cover;
  background-position: center;
}

.wpbridge-product-card--overlay .wpbridge-product-card__body {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  padding: 12px;
  z-index: 5;
}

.wpbridge-product-card--horizontal {
  display: flex;
  flex-direction: row;
  gap: 12px;
}

.wpbridge-product-card--horizontal .wpbridge-product-card__media {
  flex: 0 0 200px;
  min-height: 200px;
}

.wpbridge-product-card--horizontal .wpbridge-product-card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* =========================================================================
   Product Card Body
   ========================================================================= */

.wpbridge-product-card__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  max-width: 300px;
}

.wpbridge-product-card__title {
  margin: 0;
  font-size: 1em;
  font-weight: 600;
}

.wpbridge-product-card__title a {
  text-decoration: none;
  color: inherit;
}

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

.wpbridge-product-card__sku {
  margin: 0;
  font-size: 0.85em;
  color: #666;
}

.wpbridge-product-card__price {
  font-weight: 600;
}

.wpbridge-product-card__unit-price {
  display: block;
  margin-top: 4px;
  font-size: 0.9em;
}

.wpbridge-product-card__actions {
  margin-top: 8px;
}

.wpbridge-product-card__atc {
  display: inline-block;
  padding: 8px 16px;
  background-color: #333;
  color: #fff;
  text-decoration: none;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.wpbridge-product-card__atc:hover {
  background-color: #111;
}

.wpbridge-price-restricted,
.wpbridge-cart-restricted {
  color: #999;
  font-size: 0.9em;
}

.wpbridge-product-card__price-row--sale {
  display: flex;
  justify-content: space-between;
}

.wpbridge-sp-hero__image img {
  height: 100%;
}

.woocommerce-product-gallery__trigger {
  position: absolute;
  z-index: 1;
  right: 5px;
  top: 5px;
}

.wpbridge-price-wrapper {
  display: flex;
  flex-direction: column;
}

.wpb-product-search-results-theme
  .wpbridge-product-card
  .wpbridge-price-row--sale {
  display: flex;
}

.wpbridge-category-product-slider__slide .wpbridge-product-card__media {
  width: max-content;
}

.wpbridge-direct-total-row {
  display: flex;
  justify-content: space-between;
}

.wpbridge-direct-qty {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* =========================================================================
   Product Gallery Widget
   ========================================================================= */

.wpbridge-product-gallery {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.wpbridge-product-gallery__stage {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  background: #f7f4ef;
}

.wpbridge-product-gallery__main-link {
  display: block;
  width: 100%;
}

.wpbridge-product-gallery__main-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 820px;
  object-fit: contain;
}

.wpbridge-product-gallery__thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 0.75rem;
}

.wpbridge-product-gallery__thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0;
  border: 1px solid #e7e0d1;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.wpbridge-product-gallery__thumb:hover {
  border-color: #b6921e;
  transform: translateY(-1px);
}

.wpbridge-product-gallery__thumb.is-active {
  border-color: #b6921e;
  box-shadow: 0 0 0 2px rgba(182, 146, 30, 0.15);
}

.wpbridge-product-gallery__thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

@media (max-width: 767px) {
  .wpbridge-product-gallery__stage {
    border-radius: 12px;
  }

  .wpbridge-product-gallery__thumbs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
