/* ========== CONTENEDOR BASE ========== */
.ema-moodboard{
  position: relative;
  width: 100%;
  height: var(--ema-height, 700px);
  overflow: visible;
}
.ema-moodboard > .ema-bg{
  position:absolute; inset:0;
  width:100%; height:100%;
  object-fit:cover; pointer-events:none;
}
.ema-moodboard .ema-layer{ position:absolute; inset:0; }

/* ========== MODOS DE DISTRIBUCIÓN ========== */
/* Libre (usa left/top/width en %) */
.ema--free .ema-item{ position:absolute; }

/* Grid automático (ignora coordenadas) */
.ema--grid .ema-layer{
  display:grid;
  grid-template-columns: repeat(var(--ema-cols, 4), minmax(0,1fr));
  gap: 16px;
  padding:16px;
  align-content:start;
  justify-items:center;
  overflow:auto;
}
.ema--grid .ema-item{ position:static; width:100%; max-width:100%; }
.ema--grid .ema-item img{ width:100%; height:auto; display:block; }

/* ========== ITEMS ========== */
.ema-moodboard .ema-item{
  background:transparent; border:0; padding:0; cursor:pointer;
  transition: transform .15s ease, filter .15s ease;
}
.ema-moodboard .ema-item img{ display:block; }
.ema-moodboard .ema-item:focus-visible{ outline:2px solid #2e7dff; outline-offset:2px; }
.ema-moodboard .ema-item:hover{ filter:drop-shadow(0 6px 18px rgba(0,0,0,.18)); transform:translateY(-1px); }
.ema-empty{ padding:.5rem 0; opacity:.6; }

/* ========== MODAL DE PRODUCTO (FRONTEND) ========== */
.ema-modal{
  position: fixed; inset:0; display:none; z-index: 999999; pointer-events:none;
  font: 500 14px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}
.ema-modal.is-open{ display:block; }
.ema-modal__backdrop{
  position:absolute; inset:0; z-index:1; pointer-events:auto;
  background: rgba(0 0 0 / var(--ema-backdrop, .25));
}
.ema-modal__panel{
  position:absolute; left:50%; top:50%; transform:translate(-50%,-50%);
  width:min(450px,92vw); max-height:86vh; overflow:auto; z-index:2; pointer-events:auto;
  border-radius:14px; background:#fff; box-shadow:0 20px 60px rgba(0,0,0,.25);
  display:flex; gap:16px; padding:16px;
}
.ema-modal, .ema-modal *{ box-sizing:border-box; }
.ema-modal h1,.ema-modal h2,.ema-modal h3,.ema-modal h4,.ema-modal h5,.ema-modal h6{ margin:0 0 8px; line-height:1.25; }
.ema-modal p{ margin:0 0 8px; }
.ema-modal a{ text-decoration:none; }
.ema-modal ul{ margin:0; padding:0; list-style:none; }
.ema-modal li::marker{ content:''; }

.ema-modal__close{
  position:absolute; right:10px; top:8px;
  background:transparent; border:0; cursor:pointer;
  font-size:24px; line-height:1;
}
.ema-modal__media{ flex:1; align-self:center; display: flex; justify-content: center; align-items: center; height: 150px;}
.ema-modal__media img{ width:auto; height:100%; }
.ema-modal__body{ width:100%; min-width:0; }
.ema-modal__title{ margin:0 0 8px; font-size:1.1rem; }
.ema-modal__meta{ font-size:.95rem; }
.ema-modal__meta li{ padding:2px 0; }
.ema-modal__actions{ margin-top:10px; }
.ema-btn{
  display:inline-block; padding:10px 14px; border-radius:999px;
  text-decoration:none; border:1px solid #e0e0e0; background:#fff;
}

/* ========== TOTAL DE PRECIOS ========== */
.ema-total{
  position:absolute; z-index:6;
  background:rgba(255,255,255,.95);
  border:1px solid #e0e0e0;
  border-radius:999px;
  padding:6px 10px;
  font:600 13px/1 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  box-shadow:0 6px 18px rgba(0,0,0,.08);
}
.ema-total__label{ opacity:.7; margin-right:6px; }
.ema-total-pos-tl .ema-total{ left:8px; top:8px; }
.ema-total-pos-tr .ema-total{ right:8px; top:8px; }
.ema-total-pos-bl .ema-total{ left:8px; bottom:8px; }
.ema-total-pos-br .ema-total{ right:8px; bottom:8px; }

/* ========== BARRA DE ACCIONES (EDITOR) ========== */
.ema-editbar{
  position:absolute; left:8px; bottom:8px; z-index:10;
  display:flex; gap:10px; align-items:center;
  background:rgba(255,255,255,.95); border:1px solid #e0e0e0;
  border-radius:999px; padding:6px 10px;
  font: 500 12px/1 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}
.ema-editbar .ema-save{
  border:1px solid #ddd; background:#fff; padding:6px 10px;
  border-radius:999px; cursor:pointer;
}
.ema-editbar .ema-tip{ opacity:.75; }

/* ========== PANEL DE EDICIÓN POR CLIC (EDITOR) ========== */
.ema-itempanel{
  position:absolute; left:8px; bottom:64px; z-index:20;
  display:none; width:320px;
  background:#fff; border:1px solid #e0e0e0; border-radius:12px;
  box-shadow:0 10px 30px rgba(0,0,0,.15);
  padding:10px;
  font: 500 12px/1.4 system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
}
.ema-itempanel.is-open{ display:block; }
.ema-itempanel__head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; }
.ema-itempanel__head button{ background:transparent; border:0; font-size:18px; line-height:1; cursor:pointer; }
.ema-itempanel__grid{ display:grid; grid-template-columns: 1fr 1fr; gap:6px 10px; }
.ema-itempanel__grid label{ display:flex; flex-direction:column; gap:4px; font-weight:600; }
.ema-itempanel__grid input{
  border:1px solid #d5d5d5; border-radius:8px; padding:6px 8px; font:inherit; width:100%;
}
.ema-itempanel__actions{ display:flex; gap:8px; margin-top:10px; }
.ema-itempanel__actions .ema-apply,
.ema-itempanel__actions .ema-apply-save{
  border:1px solid #ddd; background:#fff; border-radius:999px; padding:6px 10px; cursor:pointer;
}

/* Elevar capa de items para clic cómodo en modo panel */
.ema--paneledit .ema-layer{ position:absolute; inset:0; z-index:5; }

/* ========== ESTADOS Y BLOQUEOS (EDITOR) ========== */
.ema--editing-active .ema-layer { z-index: 5; position: relative; }
.ema--editing-active{
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
}
.ema--editing-active .ema-item{ cursor: move; }
.ema--editing-active img{ -webkit-user-drag: none; user-drag: none; }

.ema-lock > .elementor-element-overlay,
.ema-lock .elementor-element-overlay,
.ema-lock > .elementor-editor-element-settings,
.ema-lock .elementor-editor-element-settings{
  pointer-events: none !important;
}
.ema-host-lock .elementor-element-overlay,
.ema-host-lock .elementor-editor-element-settings,
.ema-host-lock .elementor-add-new-section{
  pointer-events: none !important;
}

body.ema-dragging .elementor-element-overlay,
body.ema-dragging .elementor-editor-element-settings,
body.ema-dragging .elementor-add-new-section{
  pointer-events: none !important;
}

html.ema-noscroll, body.ema-noscroll{ overflow: hidden !important; }

/* === Popup más grande y tipografías === */
.ema-moodboard{
  /* Variables ajustables */
  --ema-modal-max: 250px;      /* ancho máx del panel */
  --ema-modal-padding: 22px;   /* padding interno */
  --ema-modal-radius: 18px;    /* bordes redondeados */
  --ema-modal-media: 60%;      /* ancho del bloque de imagen */
  --ema-font: 18px;            /* tamaño base */
  --ema-title: 1.80rem;        /* título */
  --ema-meta: 1.40rem;         /* texto meta (precio, proveedor…) */
  --ema-btn: 14px;             /* tamaño del botón */
}

.ema-modal{ font-size: var(--ema-font); }
.ema-modal__panel{
  width: min(var(--ema-modal-max), 96vw);
  border-radius: var(--ema-modal-radius);
  padding: var(--ema-modal-padding);
  display: flex;
  align-items: center;
}
.ema-modal__media{ flex-basis: var(--ema-modal-media); }
.ema-modal__title{ font-size: var(--ema-title); }
.ema-modal__meta{ font-size: var(--ema-meta); }
.ema-modal__meta li{ padding: 4px 0; }
.ema-btn{ font-size: var(--ema-btn); padding: 12px 16px; }
.ema-modal__close{ font-size: 28px; right: 12px; top: 10px; }

/* Responsive: en móvil, apila imagen y contenido */
@media (max-width: 768px){
  .ema-modal__panel{ width: 96vw; max-height: 88vh; }
  .ema-modal__panel{ flex-direction: column; }
  .ema-modal__media{ flex-basis: auto; }
}

