/* =========================================
   WK Product Options – Interfaccia Frontend
   ========================================= */

/* Base container: no grey box */
.wk_custom_variant .wk-product-variants{
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
}

/* Each option row: minimal separator */
.wk_custom_variant .wk-product-variants > .wk-product-variants-item{
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(0,0,0,.08);
  border-radius: 0 !important;
  padding: 12px 0;
  margin: 0;
}

.wk_custom_variant .wk-product-variants > .wk-product-variants-item:last-child{
  border-bottom: 0;
}

/* Label row */
.wk_custom_variant .wk-product-variants > .wk-product-variants-item .control-label{
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.wk_custom_variant .wk_option_title{
  font-weight: 800;
  color: #111827;
}

.wk_custom_variant .wk_price_impact{
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
}

.wk-product-variants>.wk-product-variants-item .wk_option_title {
  font-size: 16px;
}

/* Required star */
.wk_custom_variant .control-label > span[style*="color:brown"]{
  color: #b91c1c !important;
  font-weight: 800;
}

/* Inputs: square */
.wk_custom_variant input[type="number"].wk_shape_field_input,
.wk_custom_variant select.wk_select_dropdown_single,
.wk_custom_variant textarea.wk_option_text_area,
.wk_custom_variant .wk-custom-file{
  border-radius: 0 !important;
}

/*Input height*/
.wk_custom_variant input[type="number"].wk_shape_field_input, .wk_custom_variant select.wk_select_dropdown_single, .wk_custom_variant textarea.wk_option_text_area, .wk_custom_variant .wk-custom-file, .wk-product-variants>.wk-product-variants-item select {
  min-height: 42px;
}

 .wk-product-variants-item:has(.wk-custom-file) {
  padding-bottom: 20px !important;
}

/* =========================================
   SHAPES GRID
   ========================================= */

.wk_shape_option {
  border: none;
  padding: 0;
}

.wk_custom_variant .wk_shape_option_wrapper .wk_shape_options{
  display: grid;
  gap: 10px;
}

/* 1/2/3 columns controlled by JS class */
.wk_custom_variant .wk_shape_option_wrapper.wk-cols-1 .wk_shape_options{ grid-template-columns: 1fr; }
.wk_custom_variant .wk_shape_option_wrapper.wk-cols-2 .wk_shape_options{ grid-template-columns: repeat(2, minmax(0,1fr)); }
.wk_custom_variant .wk_shape_option_wrapper.wk-cols-3 .wk_shape_options{ grid-template-columns: repeat(3, minmax(0,1fr)); }

/* Shape card: compact, equal height */
.wk_custom_variant .wk_shape_label_wrapper{
  position: relative;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 0 !important;
  background: #fff;
  padding: 10px;
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  cursor: pointer;
}

.wk_custom_variant .wk_shape_label_wrapper:hover{
  border-color: rgba(0,0,0,.22);
}

/* Hide native radio */
.wk_custom_variant .wk_shape_label_wrapper .wk_shape_radio{
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.wk_custom_variant .wk_shape_image{
  width: 40px;
  height: 40px;
  object-fit: contain;
}

/* Selected */
.wk_custom_variant .wk_shape_label_wrapper.is-selected{
  border-color: #111827;
  outline: 2px solid rgba(17,24,39,.14);
  outline-offset: 0;
}

/* IMPORTANT: hide price + errors inside grid cards (we show in panel) */
.wk_custom_variant .wk_shape_options .wk_shape_price_preview{
  display: none !important;
}

/* Also hide fields inside each option (JS will move selected into panel) */
.wk_custom_variant .wk_shape_option .wk_shape_fields{
  display: none !important;
}

/* =========================================
   DETAILS PANEL UNDER GRID (single border only)
   ========================================= */

.wk_custom_variant .wk_shape_details_panel{
  margin-top: 12px;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 0 !important;
  background: #fff;
  padding: 12px;
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 14px;
  align-items: start;
}

@media (min-width: 765px) and (max-width: 1025px) {
  .wk_custom_variant .wk_shape_details_panel {
    grid-template-columns: 150px 1fr;
  }
}

@media (max-width: 575px){
  .wk_custom_variant .wk_shape_details_panel{
    grid-template-columns: 1fr;
  }
}

/* Remove inner border to avoid "double boxes" */
.wk_custom_variant .wk_shape_details_preview{
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wk_custom_variant .wk_shape_details_img{
  width: 100%;
  max-width: 250px;
  height: auto;
  object-fit: contain;
}

/* Content */
.wk_custom_variant .wk_shape_details_title{
  font-weight: 900;
  margin-bottom: 10px;
}

/* Fields inside panel */
.wk_custom_variant .wk_shape_details_fields .wk_shape_fields{
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;

  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

@media (max-width: 575px){
  .wk_custom_variant .wk_shape_details_fields .wk_shape_fields{
    grid-template-columns: 1fr;
  }
}

.wk_custom_variant .wk_shape_field label{
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
  color: #111827;
}

.wk_custom_variant .wk_shape_field_error{
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #b91c1c;
}

.wk_custom_variant .wkpo_case_thickness{
  grid-column: 1 / -1;
  margin: 0;
  padding: 8px 10px;
  border-left: 4px solid #113a77;
  background: #edf3fb;
  color: #113a77;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

.wk_custom_variant .wkpo_case_thickness strong{
  color: inherit;
  font-size: 20px;
  font-weight: 800;
  white-space: nowrap;
}

.wk_custom_variant .wkpo_case_thickness[hidden]{
  display: none !important;
}

/* Price + error UNDER inputs */
.wk_custom_variant .wk_shape_details_meta{
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.wk_custom_variant .wk_shape_details_price{
  font-weight: 900;
  font-size: 16px;
  color: #111827;
}
.wk_custom_variant .wk_shape_details_min_info{
  color: #111827;
  font-size: 13px;
  font-weight: 700;
}
.wk_custom_variant .wk_shape_details_base_price,
.wk_custom_variant .wk_shape_details_mq_price{
  color: #374151;
  font-size: 13px;
  font-weight: 600;
}
.wk_custom_variant .wk_shape_details_min_warning{
  color: #b91c1c;
  font-size: 13px;
  font-weight: 700;
}

.wk_custom_variant .wk_shape_details_error{
  color: #b91c1c;
  font-size: 13px;
  font-weight: 700;
}

/* Keep invalid input styling visible (your module adds wk_shape_field_invalid) */
.wk_custom_variant .wk_shape_field_input.wk_shape_field_invalid{
  border-color: rgba(185, 28, 28, .9) !important;
  outline: 2px solid rgba(185, 28, 28, .14);
  outline-offset: 0;
}

/* Flatten dropdown/textarea/file too */
.wk_custom_variant select.wk_select_dropdown_single,
.wk_custom_variant textarea.wk_option_text_area,
.wk_custom_variant .wk-custom-file{
  border-radius: 0 !important;
}

/* =========================================
   FIX: responsive shapes grid < 600px => 1 colonna
   ========================================= */
@media (max-width: 600px) {
  /* forza una colonna indipendentemente da wk-cols-* */
  .wk_custom_variant .wk_shape_option_wrapper .wk_shape_options{
    grid-template-columns: 1fr !important;
  }

  /* card un filo più alta e con spazi migliori su mobile */
  .wk_custom_variant .wk_shape_label_wrapper{
    min-height: 62px;
    padding: 12px;
  }
}

/* =========================================
   FIX: shape cards senza immagine (grid e panel)
   - Se l'img ha src vuoto o manca, mostro placeholder
   ========================================= */

/* 1) placeholder nella GRIGLIA: se l'immagine manca o è rotta, nascondila e usa un quadratino neutro */
.wk_custom_variant .wk_shape_label_wrapper .wk_shape_image {
  background: #f3f4f6;
  border: 1px solid rgba(0,0,0,.08);
  padding: 6px;
}

/* quando l'immagine è assente/rotta: la "nascondi" visivamente */
.wk_custom_variant .wk_shape_label_wrapper .wk_shape_image:not([src]),
.wk_custom_variant .wk_shape_label_wrapper .wk_shape_image[src=""]{
  opacity: 0;
}

/* crea un placeholder nello spazio dell'icona */
.wk_custom_variant .wk_shape_label_wrapper::before{
  content: "";
  width: 40px;
  height: 40px;
  grid-column: 1;
  grid-row: 1;
  background: #f3f4f6;
  border: 1px solid rgba(0,0,0,.08);
  display: block;
}

/* se invece l'immagine esiste, non serve il placeholder */
.wk_custom_variant .wk_shape_label_wrapper:has(.wk_shape_image[src]:not([src=""]))::before{
  content: none;
}

/* 2) se il browser non supporta :has, non succede niente di “grave”:
      vedrai comunque il quadratino neutro dietro l'immagine (ok). */

/* 3) quando c'è UNA SOLA shape, rendila più “bella”: icona più grande e testo centrato */
.wk_custom_variant .wk_shape_option_wrapper.wk-cols-1 .wk_shape_label_wrapper{
  grid-template-columns: 56px 1fr auto;
  min-height: 72px;
}

.wk_custom_variant .wk_shape_option_wrapper.wk-cols-1 .wk_shape_label_wrapper .wk_shape_image{
  width: 56px;
  height: 56px;
}

/* placeholder coerente quando 1 colonna */
.wk_custom_variant .wk_shape_option_wrapper.wk-cols-1 .wk_shape_label_wrapper::before{
  width: 56px;
  height: 56px;
}

/* =========================================
   FIX: preview nel pannello quando non c'è immagine
   - mostro un riquadro placeholder con testo
   ========================================= */
.wk_custom_variant .wk_shape_details_preview{
  position: relative;
  min-height: 120px; /* evita "vuoto" */
}

.wk_custom_variant .wk_shape_details_img{
  display: block;
}

/* se src vuoto -> nascondi img e mostra placeholder */
.wk_custom_variant .wk_shape_details_img:not([src]),
.wk_custom_variant .wk_shape_details_img[src=""]{
  opacity: 0;
  height: 0;
}

/* placeholder panel */
.wk_custom_variant .wk_shape_details_preview::after{
  content: "FORMA";
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 120px;
  background: #f3f4f6;
  border: 1px solid rgba(0,0,0,.12);
  color: #6b7280;
  font-weight: 800;
  letter-spacing: .06em;
}

/* se l'immagine esiste, non mostrare placeholder */
.wk_custom_variant .wk_shape_details_preview:has(.wk_shape_details_img[src]:not([src=""]))::after{
  content: none;
}

/* =========================================
   OPTIONAL: su mobile il pannello preview non serve enorme
   ========================================= */
@media (max-width: 600px) {
  .wk_custom_variant .wk_shape_details_panel{
    grid-template-columns: 1fr !important;
  }

  .wk_custom_variant .wk_shape_details_preview{
    min-height: 90px;
  }

  .wk_custom_variant .wk_shape_details_preview::after{
    min-height: 90px;
  }
}

/* FINE CUSTM STYE OPZIOE INTERFACCIA FRONTED*/
