/* fouradcomposer - front | @author 4ADDICTIC SL */
/* Los @font-face se generan dinamicamente en hookDisplayHeader
   a partir de los .ttf presentes en la carpeta fonts/ */

:root {
  --fcmp-accent: #f07d00;
}

/* En productos con composer la personalizacion es obligatoria:
   se oculta el anadir-al-carrito nativo (cantidad incluida) y el bloque
   nativo de campos de personalizacion. Este CSS solo se carga en fichas
   de productos configurados, y al ser regla CSS sobrevive a los
   re-renders del tema al cambiar de combinacion (talla). */
.product-add-to-cart,
.product-customization {
  display: none !important;
}

.fcmp-launch { margin: 12px 0; }
.fcmp-open-btn { width: 100%; text-transform: uppercase; font-weight: 700; }

body.fcmp-noscroll { overflow: hidden; }

.fcmp-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(20, 20, 20, 0.75);
  padding: 16px;
}
.fcmp-overlay.fcmp-visible { display: flex; align-items: center; justify-content: center; }

.fcmp-modal {
  background: #fff;
  width: 100%;
  max-width: 1100px;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.fcmp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid #e5e5e5;
}
.fcmp-title { font-weight: 700; text-transform: uppercase; font-size: 16px; }
.fcmp-close {
  background: none;
  border: 0;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: #333;
  padding: 0 4px;
}
.fcmp-close:hover { color: var(--fcmp-accent); }

.fcmp-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* Panel de opciones */
.fcmp-panel {
  width: 320px;
  flex-shrink: 0;
  overflow-y: auto;
  border-right: 1px solid #e5e5e5;
  padding: 8px;
}
.fcmp-group { border-bottom: 1px solid #eee; }
.fcmp-group.fcmp-missing > .fcmp-group-title { color: #c0392b; }
.fcmp-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 10px 6px;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  cursor: pointer;
  color: #222;
}
.fcmp-group-title:not(.fcmp-static)::after {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 2px solid #999;
  border-bottom: 2px solid #999;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: 8px;
  margin-top: -4px;
}
.fcmp-group.fcmp-open > .fcmp-group-title:not(.fcmp-static)::after {
  transform: rotate(-135deg);
  margin-top: 4px;
}
.fcmp-group-title.fcmp-static { cursor: default; }
.fcmp-options {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 6px;
  padding: 4px 6px 12px;
}
.fcmp-group.fcmp-open .fcmp-options { display: grid; }
.fcmp-option {
  background: #fff;
  border: 2px solid #ddd;
  border-radius: 4px;
  padding: 2px;
  cursor: pointer;
  overflow: hidden;
}
.fcmp-option img { width: 100%; height: auto; display: block; }
.fcmp-option-name {
  display: block;
  font-size: 9px;
  line-height: 1.15;
  padding: 2px 0 1px;
  color: #555;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fcmp-option:hover { border-color: #999; }
.fcmp-option.fcmp-selected { border-color: var(--fcmp-accent); }

/* Texto */
.fcmp-textwrap { padding: 4px 6px 14px; }
.fcmp-textwrap input[type="text"] {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  text-transform: uppercase;
}
.fcmp-colors { display: flex; gap: 8px; margin-top: 8px; }
.fcmp-color {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #ccc;
  cursor: pointer;
}
.fcmp-color.fcmp-selected { border-color: var(--fcmp-accent); box-shadow: 0 0 0 2px rgba(240, 125, 0, 0.3); }

/* Fuentes */
.fcmp-fonts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.fcmp-font {
  width: 44px;
  height: 38px;
  background: #fff;
  border: 2px solid #ddd;
  border-radius: 4px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: #222;
}
.fcmp-font:hover { border-color: #999; }
.fcmp-font.fcmp-selected { border-color: var(--fcmp-accent); }

/* Sliders de tamano y giro */
.fcmp-slider-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.fcmp-slider-label { font-size: 11px; text-transform: uppercase; color: #555; width: 64px; flex-shrink: 0; margin: 0; }
.fcmp-slider-row input[type="range"] { flex: 1; accent-color: var(--fcmp-accent); }

.fcmp-hint { font-size: 11px; color: #999; margin: 10px 0 0; }

/* Opciones sin capa y "Ninguno" */
.fcmp-option-none .fcmp-none-mark,
.fcmp-option-nolayer .fcmp-none-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  width: 100%;
  font-size: 18px;
  font-weight: 700;
  color: #888;
  background: #f4f4f4;
  border-radius: 2px;
}

/* Previsualizacion */
.fcmp-preview-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #fafafa;
  min-height: 0;
  overflow: hidden;
}
.fcmp-preview {
  position: relative;
  width: min(560px, 100%);
  aspect-ratio: 1 / 1;
}
.fcmp-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.fcmp-text-overlay {
  position: absolute;
  z-index: 50;
  font-weight: 700;
  letter-spacing: 1px;
  white-space: nowrap;
  transform-origin: left bottom;
  cursor: move;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  min-width: 10px;
  min-height: 10px;
}

/* Barra inferior */
.fcmp-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  border-top: 1px solid #e5e5e5;
  background: #fff;
}
.fcmp-clear {
  background: none;
  border: 0;
  color: #888;
  cursor: pointer;
  text-transform: uppercase;
  font-size: 12px;
}
.fcmp-clear:hover { color: #c0392b; }
.fcmp-foot-right { display: flex; align-items: center; gap: 12px; }
.fcmp-price { font-size: 14px; }
.fcmp-qty {
  width: 64px;
  padding: 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  text-align: center;
}
.fcmp-add { text-transform: uppercase; font-weight: 700; }

/* Movil */
@media (max-width: 768px) {
  .fcmp-overlay { padding: 0; }
  .fcmp-modal { max-height: 100vh; height: 100%; border-radius: 0; }
  .fcmp-body { flex-direction: column-reverse; overflow-y: auto; }
  .fcmp-panel { width: 100%; border-right: 0; border-top: 1px solid #e5e5e5; }
  .fcmp-preview-wrap { padding: 8px; flex: 0 0 auto; }
  .fcmp-preview { width: min(340px, 90vw); }
  .fcmp-foot { flex-wrap: wrap; }
}
