/* EFGN Variables WP - Frontend Styles */

/* ── Box sizing global dentro del configurador ── */
.efgn-vw-configurator-frontend *,
.efgn-vw-configurator-frontend *::before,
.efgn-vw-configurator-frontend *::after {
  box-sizing: border-box;
}

/* ── Contenedor principal ── */
.efgn-vw-configurator-frontend {
  margin: 16px 0;
  padding: 16px;
  background: #f9f9f9;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  box-sizing: border-box;
  width: 100%;
}

/* ── Grupo ── */
.efgn-vw-group { margin-bottom: 20px; }
.efgn-vw-group-label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; line-height: 1.4; }
.efgn-vw-required { color: #cc0000; margin-left: 2px; }
.efgn-vw-group-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 12px;
  padding: 8px 12px;
  margin: 4px 0 12px;
  border-radius: 4px;
  line-height: 1.5;
  border-left: 3px solid;
}
.efgn-vw-note-icon { flex-shrink: 0; font-style: normal; font-size: 14px; line-height: 1.4; }

/* info — azul (por defecto) */
.efgn-vw-note-info    { background: #f0f6fc; border-color: #2271b1; color: #1a4a7a; }
/* warning — amarillo */
.efgn-vw-note-warning { background: #fffbe6; border-color: #f0b429; color: #7a5a00; }
/* important — rojo */
.efgn-vw-note-important { background: #fff0f0; border-color: #cc0000; color: #8a0000; }
/* tip — verde */
.efgn-vw-note-tip     { background: #edfaef; border-color: #46b450; color: #1a6b1e; }

/* ── Inputs base ── */
.efgn-vw-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-size: 15px;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}
.efgn-vw-input:focus { outline: 2px solid #2271b1; outline-offset: 1px; border-color: #2271b1; }

/* ── Select ── */
.efgn-vw-select {
  max-width: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23666' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ── Radio ── */
.efgn-vw-radio-group { display: flex; flex-wrap: wrap; gap: 8px; }
.efgn-vw-radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 3px;
  cursor: pointer;
  background: #fff;
  transition: all .2s;
  font-size: 14px;
  min-height: 44px; /* touch target */
  box-sizing: border-box;
}
.efgn-vw-radio-label:hover { border-color: #2271b1; }
.efgn-vw-radio-label:has(input:checked) { border-color: #2271b1; background: #f0f6fc; }
.efgn-vw-radio-label input[type="radio"] { margin: 0; flex-shrink: 0; width: 16px; height: 16px; }

/* ── Swatch ── */
.efgn-vw-swatch-group { display: flex; flex-wrap: wrap; gap: 12px; }
.efgn-vw-swatch-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.efgn-vw-swatch {
  width: 48px;
  height: 48px;
  border: 3px solid #ddd;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  transition: border-color .2s, transform .2s, box-shadow .2s;
  flex-shrink: 0;
  display: block;
  /* El color/imagen se aplica via style inline */
}
.efgn-vw-swatch:hover { border-color: #2271b1; transform: scale(1.1); }
.efgn-vw-swatch.selected { border-color: #2271b1; box-shadow: 0 0 0 3px rgba(34,113,177,.35); transform: scale(1.05); }
.efgn-vw-swatch:disabled { opacity: .4; cursor: not-allowed; transform: none !important; }
.efgn-vw-swatch:focus-visible { outline: 2px solid #2271b1; outline-offset: 3px; }
.efgn-vw-swatch-label {
  font-size: 11px;
  color: #444;
  text-align: center;
  max-width: 64px;
  word-break: break-word;
  line-height: 1.2;
}
.efgn-vw-swatch-price {
  font-size: 11px;
  color: #2271b1;
  font-weight: 600;
  text-align: center;
}

/* ── Imagen ── */
.efgn-vw-image-group { display: flex; flex-wrap: wrap; gap: 10px; }
.efgn-vw-image-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 2px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  min-width: 80px;
  max-width: 120px;
  text-align: center;
  box-sizing: border-box;
  flex: 1 1 80px;
  position: relative;
}
.efgn-vw-image-label:hover { border-color: #2271b1; }
.efgn-vw-image-label:has(input:checked) { border-color: #2271b1; background: #f0f6fc; }
.efgn-vw-image-label.disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }
.efgn-vw-image-radio { position: absolute !important; opacity: 0 !important; width: 0 !important; height: 0 !important; pointer-events: none; }
.efgn-vw-option-image {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 3px;
  display: block;
  flex-shrink: 0;
}
.efgn-vw-image-placeholder {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e5e5e5;
  border-radius: 3px;
  font-size: 28px;
  font-weight: 700;
  color: #999;
  flex-shrink: 0;
}
.efgn-vw-image-text { font-size: 12px; word-break: break-word; line-height: 1.3; }

/* Botón zoom sobre la imagen */
.efgn-vw-zoom-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  background: rgba(0,0,0,.55);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s;
  z-index: 2;
  padding: 0;
}
.efgn-vw-image-label:hover .efgn-vw-zoom-btn { opacity: 1; }
.efgn-vw-zoom-btn:focus-visible { opacity: 1; outline: 2px solid #fff; }

/* Lightbox */
.efgn-vw-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.efgn-vw-lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.82);
  cursor: pointer;
}
.efgn-vw-lightbox-inner {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.efgn-vw-lightbox-img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
  display: block;
}
.efgn-vw-lightbox-caption {
  color: #fff;
  font-size: 14px;
  text-align: center;
  margin: 0;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
}
.efgn-vw-lightbox-close {
  position: absolute;
  top: -36px;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  padding: 0 6px;
  opacity: .8;
  transition: opacity .2s;
}
.efgn-vw-lightbox-close:hover { opacity: 1; }

/* ── Número ── */
.efgn-vw-number { max-width: 120px; min-height: 44px; }

/* ── Textarea ── */
.efgn-vw-textarea { resize: vertical; min-height: 100px; }
.efgn-vw-textarea-simple-wrap { display: flex; flex-direction: column; gap: 6px; }
.efgn-vw-textarea-price-notice { font-size: 13px; color: #2271b1; margin: 0 0 4px; }

/* ── Swatch seleccionado ── */
.efgn-vw-swatch-selected {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
  color: #444;
}
.efgn-vw-swatch-selected-dot {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #2271b1;
  flex-shrink: 0;
}
.efgn-vw-swatch-selected-name { font-weight: 600; }

/* ── Checklist (texto libre y subir archivo con opciones) ── */
.efgn-vw-checklist { display: flex; flex-direction: column; gap: 8px; }
.efgn-vw-checklist-row { display: flex; flex-direction: column; gap: 4px; }
.efgn-vw-checklist-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 3px;
  cursor: pointer;
  background: #fff;
  font-size: 14px;
  min-height: 44px;
  transition: border-color .15s, background .15s;
  box-sizing: border-box;
  user-select: none;
}
.efgn-vw-checklist-label:hover { border-color: #2271b1; }
.efgn-vw-checklist-cb {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  display: inline-block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  cursor: pointer;
  accent-color: #2271b1;
  flex-shrink: 0;
}
.efgn-vw-checklist-label:has(.efgn-vw-checklist-cb:checked) { border-color: #2271b1; background: #f0f6fc; }
.efgn-vw-textarea-opt { resize: none; min-height: 42px; overflow: hidden; transition: height .1s ease; }
.efgn-vw-checklist-row .efgn-vw-file-wrap { padding: 10px; background: #f9f9f9; border: 1px solid #ddd; border-top: none; border-radius: 0 0 3px 3px; }

/* ── File upload ── */
.efgn-vw-file-options { display: flex; flex-direction: column; gap: 10px; }
.efgn-vw-file-option-row { display: flex; flex-direction: column; gap: 0; }
.efgn-vw-file-option-row .efgn-vw-file-wrap { margin-top: 4px; padding: 10px; background: #f9f9f9; border: 1px solid #ddd; border-top: none; border-radius: 0 0 3px 3px; }
.efgn-vw-file-wrap { display: flex; flex-direction: column; gap: 8px; }
.efgn-vw-file-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  flex-wrap: wrap;
}
.efgn-vw-file-label input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.efgn-vw-file-btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  background: #2271b1;
  color: #fff;
  border-radius: 3px;
  font-size: 14px;
  transition: background .2s;
  min-height: 44px;
  white-space: nowrap;
}
.efgn-vw-file-btn:hover { background: #135e96; }
.efgn-vw-file-name { font-size: 13px; color: #666; font-style: italic; word-break: break-all; }
.efgn-vw-file-confirm {
  background: #edfaef;
  border-left: 3px solid #46b450;
  padding: 10px 14px;
  font-size: 13px;
  color: #1a6b1e;
  border-radius: 0 3px 3px 0;
  margin-top: 4px;
  line-height: 1.5;
}

/* ── Checkbox ── */
.efgn-vw-checkbox-group { display: flex; flex-direction: column; gap: 8px; }
.efgn-vw-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 3px;
  cursor: pointer;
  background: #fff;
  transition: all .2s;
  font-size: 14px;
  min-height: 44px;
  box-sizing: border-box;
}
.efgn-vw-checkbox-label:hover { border-color: #2271b1; }
.efgn-vw-checkbox-label:has(input:checked) { border-color: #2271b1; background: #f0f6fc; }
.efgn-vw-checkbox { width: 18px; height: 18px; cursor: pointer; flex-shrink: 0; }
.efgn-vw-opt-price { font-size: 13px; color: #2271b1; font-weight: 600; margin-left: auto; white-space: nowrap; }

/* ── Date ── */
.efgn-vw-date { max-width: 100%; min-height: 44px; }

/* ── Resumen precio ── */
.efgn-vw-summary {
  margin-top: 16px;
  padding: 14px;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
}
.efgn-vw-price-display { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.efgn-vw-price-value { color: #2271b1; }
.efgn-vw-sku-display, .efgn-vw-stock-display { font-size: 13px; color: #666; margin-bottom: 2px; }

/* ── Error ── */
.efgn-vw-group-error { color: #cc0000; font-size: 13px; margin-top: 6px; min-height: 18px; line-height: 1.4; }
.efgn-vw-group-error:empty { display: none; }

/* ── Condicionales ── */
.efgn-vw-group[data-hidden="true"] { display: none; }

/* ── Responsive: tablet (≤ 768px) ── */
@media (max-width: 768px) {
  .efgn-vw-configurator-frontend { padding: 12px; }
  .efgn-vw-radio-label { flex: 1 1 calc(50% - 8px); justify-content: center; }
  .efgn-vw-image-label { flex: 1 1 calc(50% - 10px); max-width: none; }
  .efgn-vw-swatch { width: 40px; height: 40px; }
  .efgn-vw-number { max-width: 100%; }
  .efgn-vw-date { max-width: 100%; }
  .efgn-vw-price-display { font-size: 18px; }
}

/* ── Responsive: móvil (≤ 480px) ── */
@media (max-width: 480px) {
  .efgn-vw-configurator-frontend { padding: 10px; margin: 10px 0; }
  .efgn-vw-group-label { font-size: 15px; }
  .efgn-vw-input { font-size: 16px; } /* evita zoom en iOS */
  .efgn-vw-select { font-size: 16px; }
  .efgn-vw-radio-label { flex: 1 1 100%; }
  .efgn-vw-image-label { flex: 1 1 calc(50% - 10px); }
  .efgn-vw-swatch { width: 38px; height: 38px; }
  .efgn-vw-file-btn { width: 100%; justify-content: center; }
  .efgn-vw-checkbox-label { padding: 10px; }
  .efgn-vw-opt-price { font-size: 12px; }
  .efgn-vw-summary { padding: 10px; }
  .efgn-vw-price-display { font-size: 17px; }
}
