/**
 * WPC Frontend Styles
 *
 * @package WPC
 * @since 3.0.0
 */

/* ==========================================================================
   Configurator Main
   ========================================================================== */

.wpc-configurator {
  width: 100%;
  max-width: 100%;
}

.wpc-components-accordion {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.wpc-component-header {
  padding: 20px;
  background: linear-gradient(
    135deg,
    var(--e-global-color-accent) 0%,
    #764ba2 100%
  );
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
}

.wpc-component-header:hover {
  opacity: 0.9;
}

.wpc-component-info {
  flex: 1;
}

.wpc-component-title {
  margin: 0 0 5px 0;
  color: #fff;
  font-size: 20px;
  font-weight: 600;
}

.wpc-component-description {
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
}

.wpc-required-badge {
  display: inline-block;
  padding: 3px 8px;
  background: #ff5252;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  border-radius: 3px;
  text-transform: uppercase;
  margin-top: 5px;
}

.wpc-toggle-icon {
  color: #fff;
  font-size: 20px;
  transition: transform 0.3s ease;
}

.wpc-component-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 0 20px;
}

.wpc-component-content.active {
  max-height: 5000px;
  padding: 20px;
}

/* Section */
.wpc-section {
  margin-bottom: 30px;
}

.wpc-section:last-child {
  margin-bottom: 0;
}

.wpc-section-header {
  margin-bottom: 15px;
}

.wpc-section-title {
  margin: 0 0 5px 0;
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.wpc-section-description {
  margin: 0;
  color: #666;
  font-size: 14px;
}

/* Products Container */
.wpc-products-container {
  display: grid;
  gap: 15px;
}

/* Thumbnail Layout */
.wpc-products-container.wpc-layout-thumbnail {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

/* List Layout */
.wpc-products-container.wpc-layout-checkbox,
.wpc-products-container.wpc-layout-multiple_checkbox {
  grid-template-columns: 1fr;
}

/* Product Item */
.wpc-product-item {
  position: relative;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 15px;
  transition: all 0.3s ease;
  background: #fff;
}

.wpc-product-item:hover {
  border-color: var(--e-global-color-accent);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

/* Selected Product Styling */
.wpc-product-item.selected {
  border-color: var(--e-global-color-accent);
  background: #f5f7ff;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

/* Deleted Product Styling */
.wpc-product-item.wpc-product-deleted {
  background: #ffe5e5;
  border-color: #ff4444;
  opacity: 0.7;
}

.wpc-product-item.wpc-product-deleted .wpc-product-name {
  text-decoration: line-through;
  color: #999;
}

.wpc-product-item.wpc-product-deleted .wpc-deleted-badge {
  display: inline-block;
  background: #ff4444;
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 8px;
  text-transform: uppercase;
  font-weight: bold;
  text-decoration: none;
}

/* Price Changed Product Styling */
.wpc-product-item.wpc-product-price-changed {
  background: #e8f5e9;
  border-color: #4caf50;
}

.wpc-product-item.wpc-product-price-changed .wpc-price-change-note {
  display: block;
  color: #2e7d32;
  font-size: 12px;
  margin-top: 4px;
  font-style: italic;
}

.wpc-product-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  margin: 0;
}

.wpc-product-input {
  cursor: pointer;
  accent-color: var(--e-global-color-accent);
}

/* Thumbnail Layout Specific */
.wpc-layout-thumbnail .wpc-product-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.wpc-layout-thumbnail .wpc-product-label {
  flex-direction: column;
  text-align: center;
}

.wpc-layout-thumbnail .wpc-product-content {
  width: 100%;
}

.wpc-product-image {
  width: 100%;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  background: #f8f9fa;
  border-radius: 6px;
  overflow: hidden;
}

.wpc-product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.wpc-product-image.wpc-no-image {
  color: #ccc;
}

.wpc-product-image.wpc-no-image .dashicons {
  font-size: 60px;
}

.wpc-product-details {
  flex: 1;
}

.wpc-product-name {
  margin: 0 0 8px 0;
  font-size: 15px;
  font-weight: 500;
  color: #333;
}

.wpc-product-price {
  font-size: 16px;
  font-weight: 600;
  color: var(--e-global-color-accent);
}

.wpc-regular-price {
  text-decoration: line-through;
  color: var(--e-global-color-primary);
  font-weight: 600;
  font-size: 16px;
  opacity: 0.6;
}

.wpc-sale-price {
  color: #ff5252;
}

.wpc-product-price .wpc-regular-price.negative-price {
  text-decoration: line-through;
  color: #999;
  margin-right: 8px;
}

.wpc-product-price .wpc-sale-price.negative-price {
  color: #ee1e07;
}

.wpc-info-button {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  border: none;
  background: var(--e-global-color-accent);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.wpc-info-button:hover {
  background: #764ba2;
  transform: scale(1.1);
}

.wpc-info-button .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
}

/* ==========================================================================
   Notices
   ========================================================================== */

.wpc-notice {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 15px 20px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.wpc-notice.wpc-notice-show {
  opacity: 1;
  transform: translateY(0);
}

.wpc-notice-success {
  border-left: 4px solid #4caf50;
  color: #4caf50;
}

.wpc-notice-error {
  border-left: 4px solid #ff5252;
  color: #ff5252;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
  .wpc-products-container.wpc-layout-thumbnail {
    grid-template-columns: repeat(2, 1fr);
  }

  .wpc-component-title {
    font-size: 18px;
  }

  .wpc-sidebar {
    position: static;
    margin-top: 20px;
  }
}

@media (max-width: 480px) {
  .wpc-products-container.wpc-layout-thumbnail {
    grid-template-columns: 1fr;
  }

  .wpc-component-header {
    padding: 15px;
  }

  .wpc-component-content.active {
    padding: 15px;
  }
}

/* ==========================================================================
   Accordion Layout (Old Plugin Compatibility)
   ========================================================================== */

.wpc-accordion {
  display: flex;
  flex-direction: column;
}

.wpc-accordion-item {
  border: 1px solid var(--e-global-color-ee9dd3a, #e0e0e0);
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.wpc-accordion-header {
  background: var(--e-global-color-primary, #667eea);
  padding: 20px;
  cursor: pointer;
  font-weight: 500;
  font-size: 24px;
  border: none;
  color: var(--e-global-color-secondary, #fff);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.wpc-accordion-header:hover {
  opacity: 0.9;
}

.accordion-label {
  position: relative;
  z-index: 1;
}

.wpc-accordion-content {
  display: none;
  background: var(--e-global-color-b241a82, #fff);
  padding: 25px;
}

.wpc-accordion-content.active {
  display: block;
}

/* Section Styles */
.wpc-section-item {
  margin-bottom: 25px;
}

.wpc-section-item:last-child {
  margin-bottom: 0;
}

.wpc-section-header {
  display: flex;
  flex-direction: column;
  margin-bottom: 15px;
}

.wpc-section-info {
  display: flex;
  gap: 10px;
  flex-direction: column;
}

.wpc-section-heading {
  font-size: 18px;
  margin: 0;
  font-weight: 600;
  color: var(--e-global-color-primary, #333);
}

.wpc-section-subtitle {
  margin: 0;
  color: var(--e-global-color-text, #666);
  font-size: 13px;
}

.wpc-section-content {
  display: block;
}

/* Thumbnail Grid */
.wpc-thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin: 15px 0 35px 0;
}

.wpc-thumbnail-product {
  position: relative;
  background: var(--e-global-color-secondary, #fff);
  border: 1px solid var(--e-global-color-ee9dd3a, #e0e0e0);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
}

.wpc-thumbnail-product:hover {
border: 1px solid var(--e-global-color-accent);
  outline: 1px solid var(--e-global-color-accent);
}

/* Selected state - active selection with purple accent */
/* Supports both radio buttons and checkboxes */
.wpc-thumbnail-product.selected,
.wpc-thumbnail-product:has(.wpc-product-radio:checked),
.wpc-thumbnail-product:has(.wpc-multiple-checkbox:checked) {
  border: 1px solid var(--e-global-color-accent);
  outline: 1px solid var(--e-global-color-accent);
  -webkit-box-shadow: inset 0px 0px 15px 0px rgba(138, 1, 252, 0.18);
    box-shadow: inset 0px 0px 15px 0px rgba(138, 1, 252, 0.18);
}

.wpc-thumbnail-product .wpc-product-radio {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.wpc-product-label {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin: 0;
  padding: 15px;
  cursor: pointer;
  align-items: center;
}

.wpc-product-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wpc-product-thumb {
  width: 100%;
  height: 160px !important;
  object-fit: contain;
}

.wpc-product-thumb-placeholder {
  width: 100%;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 14px;
  background: #f8f9fa;
}

.wpc-product-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--e-global-color-primary, #333);
  text-align: center;
  line-height: 1.4;
}

.wpc-product-price {
  display: flex;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
}

.wpc-price-value {
  color: var(--e-global-color-primary);
  font-weight: 600;
  font-size: 16px;
}

@media (max-width: 400px) {
  .wpc-price-value {
    font-size: 13px;
  }
}

/* List Container */
.wpc-list-container {
  margin: 15px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wpc-list-product-label {
  display: flex;
  align-items: center;
  padding: 10px;
  cursor: pointer;
  gap: 10px;
  transition: all 0.3s ease;
}

.wpc-list-product-label .wpc-product-radio {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--e-global-color-accent, #667eea);
}

.wpc-list-product-content {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.wpc-list-product-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--e-global-color-primary, #333);
  line-height: 20px;
}
@media (max-width: 400px) {
  .wpc-list-product-name {
    font-size: 12px;
  }
}

.wpc-list-right-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wpc-list-product-price {
  font-size: 15px;
  font-weight: 600;
  text-align: end;
}

/* Info Icon Button */
.wpc-info-icon {
  padding: 0 !important;
  cursor: pointer;
  transition: all 0.3s;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none !important;
  padding: 0;
  border-radius: 50% !important;
  background-color: var(--e-global-color-accent) !important;
  width: 20px !important;
  height: 20px !important;
}

.wpc-info-icon:hover {
  transform: scale(1.1);
}

.wpc-info-icon::after {
    content: "i";
    position: absolute;
    color: white;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 13px;
}

/* Info icon for thumbnail layout */
.wpc-thumbnail-product .wpc-info-icon {
  position: absolute;
  top: 10px;
  right: 10px;
}

/* No content messages */
.wpc-no-components,
.wpc-no-sections,
.wpc-no-products {
  padding: 20px;
  text-align: center;
  color: #999;
}

/* Responsive */
@media (max-width: 1400px) {
  .wpc-thumbnail-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1000px) {
  .wpc-thumbnail-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 767px) {
  .wpc-accordion-content {
    padding: 15px;
  }

  .wpc-product-name {
    font-size: 13px;
  }
}

@media (max-width: 650px) {
  .wpc-thumbnail-grid {
    grid-template-columns: 1fr;
  }
}
