/* =====================================
   ComboSwap Frontend Styles
   Using CSS Variables with fallback defaults
   ===================================== */

/* Total row */
.comboswap-front__total-row{
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--cs-total-size, 1.25rem);
  font-weight: var(--cs-total-weight, 700);
}

.comboswap-front__total-label{
  color: var(--cs-total-label-color, #333);
}

.comboswap-front__total-price{
  color: var(--cs-total-color, #e67e22);
}

/* Delivery Information */
.comboswap-front__delivery-info{
  margin-bottom: 16px;
  padding: 12px;
  background: #f5f5f5;
  border-left: 4px solid #ff6e00;
  border-radius: 4px;
  font-size: 16px;
  line-height: 1.5;
  color: #333;
}

.comboswap-front__delivery-date{
  font-size: 18px;
  font-weight: 600;
  color: #ff6e00;
  margin-bottom: 4px;
}

.comboswap-front__delivery-text{
  font-size: 16px;
  color: #333;
  font-weight: 500;
}

.comboswap-front__price-note{
  font-size: 12px;
  color: #666;
  line-height: 1.4;
}

.comboswap-front__btn-note{
  font-size: 12px;
  color: #666;
  line-height: 1.4;
}

.comboswap-front__variants-title{
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 10px;
  /* Dynamic styles via PHP */
}

/* Collapsible variants title */
.comboswap-front__variants-title--collapsible{
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.comboswap-front__variants-title--collapsible .comboswap-front__collapse-icon{
  transform: rotate(0deg);
}

.comboswap-front__variants-title--open .comboswap-front__collapse-icon{
  transform: rotate(180deg);
}

/* Collapsible variants content */
.comboswap-front__variants-content{
  overflow: hidden;
  max-height: 2000px;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  opacity: 1;
}

.comboswap-front__variants-content--collapsed{
  max-height: 0;
  opacity: 0;
}

.comboswap-front__vgroups{
  /* margin and padding set via dynamic CSS */
}

.comboswap-front__variants{
  /* margin, padding and text-align set via dynamic CSS */
}

/* Main card container */
.comboswap-front__card{
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 10px;
  /* padding set via dynamic CSS */
  margin-top: 16px;
  max-width: var(--cs-container-max-width, 100%);
  overflow: visible;
}

.comboswap-front__title{
  font-weight: var(--cs-widget-title-weight, 700);
  font-size: var(--cs-widget-title-size, 18px);
  color: var(--cs-widget-title-color, #333);
  text-align: var(--cs-widget-title-align, left);
  margin-bottom: 12px;
}

.comboswap-front__label{
  display: block;
  font-size: var(--cs-label-size, 0.875rem);
  font-weight: var(--cs-label-weight, 500);
  margin-bottom: 10px;
  color: var(--cs-label-color, #666);
  text-align: var(--cs-label-align, left);
  background: transparent;
  text-transform: capitalize;
}

/* Collapsible label */
.comboswap-front__label--collapsible{
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.comboswap-front__collapse-icon{
  display: inline-flex;
  width: var(--cs-collapse-icon-size, 12px);
  height: var(--cs-collapse-icon-size, 12px);
  transition: transform 0.3s ease;
  transform: rotate(0deg);
  flex-shrink: 0;
}

.comboswap-front__label--open .comboswap-front__collapse-icon{
  transform: rotate(180deg);
}

/* Collapsible content wrapper */
.comboswap-front__options-wrap{
  overflow: hidden;
  max-height: 2000px;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  opacity: 1;
}

.comboswap-front__options-wrap--collapsed{
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
}

.comboswap-front__small{
  margin-top: 6px;
  font-size: 12px;
  opacity: .75;
}

.comboswap-front__actions{
  display: flex;
  flex-direction: column;
  /* Dynamic styles via PHP: background, padding, align-items, gap, border-radius */
}

.comboswap-front__hint{
  font-size: 13px;
  opacity: .85;
}

.comboswap-front__hint--error{
  color: #b0413e;
  opacity: 1;
}

/* Options container */
.comboswap-front__options{
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: visible;
}

/* Cards grid layout when images present */
.comboswap-front__options--cards{
  display: grid;
  grid-template-columns: repeat(var(--cs-cards-per-row, 4), 1fr);
  gap: var(--cs-card-gap, 10px);
  padding-bottom: 15px;
  overflow: visible;
}

@media (max-width: 768px) {
  .comboswap-front__options--cards{
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .comboswap-front__options--cards{
    grid-template-columns: 1fr;
  }
}

/* Option row (text only, no image) */
.comboswap-front__option-row{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}

.comboswap-front__option-label{
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-width: 180px;
  cursor: pointer;
  font-size: 14px;
}

.comboswap-front__option-label input[type="checkbox"]{
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Card option with image */
.comboswap-front__card-option{
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--cs-card-padding, 10px);
  border: var(--cs-card-border-width, 2px) solid var(--cs-card-border, #e0e0e0);
  border-radius: var(--cs-card-border-radius, 8px);
  cursor: pointer;
  transition: all 0.2s ease, z-index 0s;
  background: var(--cs-card-bg, #fff);
  min-width: var(--cs-card-min-width, 120px);
  user-select: none;
  position: relative;
  z-index: 1;
}

.comboswap-front__card-option:hover{
  background: var(--cs-card-bg-hover, #f9f9f9);
  border-color: var(--cs-card-border-hover, #999);
  box-shadow: var(--cs-card-shadow-hover, 0 2px 8px rgba(0,0,0,0.1));
  z-index: 10;
  overflow: hidden;
}

.comboswap-front__card-option--selected{
  border-color: var(--cs-card-border-selected, #e67e22) !important;
  background: var(--cs-card-bg-selected, #fef5ec);
  box-shadow: var(--cs-card-shadow-selected, 0 2px 12px rgba(230,126,34,0.3));
  z-index: 10;
  overflow: hidden;
}

.comboswap-front__card-image{
  width: 100%;
  max-width: var(--cs-image-size, 80px);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  pointer-events: none;
  border-radius: var(--cs-image-border-radius, 4px);
  box-sizing: border-box;
  transition: border-color 0.2s ease, border-width 0.2s ease;
}

.comboswap-front__card-image img{
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  pointer-events: none;
}

.comboswap-front__card-title{
  font-size: var(--cs-title-size, 0.875rem);
  font-weight: var(--cs-title-weight, 600);
  text-align: var(--cs-title-align, center);
  color: var(--cs-title-color, #333);
  line-height: 1.3;
  word-break: break-word;
  pointer-events: none;
}

.comboswap-front__card-subtitle{
  font-size: var(--cs-subtitle-size, 0.75rem);
  font-weight: var(--cs-subtitle-weight, 400);
  text-align: var(--cs-subtitle-align, center);
  color: var(--cs-subtitle-color, #888);
  line-height: 1.3;
  margin-top: 4px;
  pointer-events: none;
}

.comboswap-front__card-qty{
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 6px;
  gap: 2px;
}

.comboswap-front__card-qty .comboswap-front__qty-btn{
  width: calc(var(--cs-qty-btn-size, 28px) * 0.8);
  height: calc(var(--cs-qty-btn-size, 28px) * 0.8);
  font-size: 14px;
  padding: 0;
  border-radius: 4px;
}

.comboswap-front__card-qty .comboswap-front__option-qty{
  width: 32px !important;
  height: calc(var(--cs-qty-btn-size, 28px) * 0.8);
  font-size: 12px;
  padding: 2px;
}

/* Qty control with +/- buttons */
.comboswap-front__qty-control{
  display: inline-flex;
  align-items: center;
  border: 1px solid #ccc;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.comboswap-front__qty-control.disabled{
  opacity: 0.4;
  background: #f5f5f5;
}

.comboswap-front__qty-btn{
  width: var(--cs-qty-btn-size, 28px);
  height: var(--cs-qty-btn-size, 28px);
  border: none;
  background: var(--cs-qty-btn-bg, #f0f0f0);
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cs-qty-btn-color, #333);
  transition: background 0.15s;
}

.comboswap-front__qty-btn:hover:not(:disabled){
  background: #e0e0e0;
  filter: brightness(0.95);
}

.comboswap-front__qty-btn:disabled{
  cursor: not-allowed;
  /* opacity set via dynamic CSS */
}

.comboswap-front__qty-minus{
  /* border set via dynamic CSS */
}

.comboswap-front__qty-plus{
  /* border set via dynamic CSS */
}

.comboswap-front__option-qty{
  width: 50px !important;
  height: var(--cs-qty-btn-size, 28px);
  padding: 4px 6px;
  border: none;
  text-align: center;
  font-size: 14px;
  -moz-appearance: textfield;
}

.comboswap-front__option-qty::-webkit-outer-spin-button,
.comboswap-front__option-qty::-webkit-inner-spin-button{
  -webkit-appearance: none;
  margin: 0;
}

.comboswap-front__option-qty:disabled{
  /* opacity set via dynamic CSS */
}

/* Virtual group row */
.comboswap-front__row--vgroup{
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eee;
  overflow: visible;
}

.comboswap-front__row--vgroup:last-child{
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

/* Add to cart button */
.comboswap-front__btn{
  background: var(--cs-btn-bg, #2fb5d2);
  color: var(--cs-btn-color, #fff);
  border: none;
  border-radius: var(--cs-btn-border-radius, 4px);
  padding: var(--cs-btn-padding-v, 10px) var(--cs-btn-padding-h, 20px);
  font-size: var(--cs-btn-size, 1rem);
  font-weight: var(--cs-btn-weight, 600);
  cursor: pointer;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: var(--cs-btn-content-align, center);
  gap: var(--cs-btn-icon-gap, 8px);
  box-sizing: border-box;
}

.comboswap-front__btn--with-icon{
  /* Icon-specific styles if needed */
}

.comboswap-front__btn-icon{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.comboswap-front__btn-icon svg{
  width: var(--cs-btn-icon-size, 18px);
  height: var(--cs-btn-icon-size, 18px);
  fill: var(--cs-btn-icon-color, currentColor);
}

.comboswap-front__btn-icon svg path,
.comboswap-front__btn-icon svg circle,
.comboswap-front__btn-icon svg rect,
.comboswap-front__btn-icon svg polygon{
  fill: inherit;
}

.comboswap-front__btn-text{
  display: inline;
}

.comboswap-front__btn:hover{
  background: var(--cs-btn-bg-hover, #239bb5);
}

/* Button in "added" state (stay_change mode) */
.comboswap-front__btn--added{
  /* Optional: different style when product is already in cart */
}
