/* ==========================================================
   Noemilla Personalizer v1.3 – Frontend CSS
   Palette: identica a noemilla.it (bianco/nero, minimal)
   ========================================================== */

.np-wrap {
  /* ── Colori identici al sito noemilla.it ── */
  --np-bg:        #FFFFFF;      /* sfondo widget */
  --np-bg2:       #F7F7F7;      /* sfondo header / colonna preview */
  --np-border:    #E8E8E8;      /* bordi sottili */
  --np-border2:   #CCCCCC;      /* bordi enfatizzati / hover */
  --np-accent:    #111111;      /* nero primario (= bottone "Aggiungi al carrello") */
  --np-accent-hv: #333333;      /* hover/focus */
  --np-text:      #111111;      /* testo primario */
  --np-mid:       #555555;      /* testo secondario */
  --np-hint:      #999999;      /* testo terzario / placeholder */
  --np-sur:       #555555;      /* riga sovrapprezzo */
  --np-r:         4px;          /* border-radius piccolo (stesso del sito) */
  --np-rlg:       0px;          /* il sito usa angoli retti sui card principali */
}

.np-wrap, .np-wrap * { box-sizing: border-box; }
.np-wrap {
  font-family: -apple-system, 'Segoe UI', Arial, sans-serif;
  color: var(--np-text);
  margin: 20px 0 28px;
  border: 1px solid var(--np-border);
  background: var(--np-bg);
}

/* ── Header ── */
.np-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  background: var(--np-bg2);
  border-bottom: 1px solid var(--np-border);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--np-text);
}
.np-icon { color: var(--np-text); flex-shrink: 0; }

/* ── Body layout ── */
.np-body {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
}
@media (max-width: 680px) { .np-body { grid-template-columns: 1fr; } }

/* ── Left: preview ── */
.np-col-preview {
  padding: 14px;
  border-right: 1px solid var(--np-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--np-bg2);
}
@media (max-width: 680px) { .np-col-preview { border-right: none; border-bottom: 1px solid var(--np-border); } }

.np-preview-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--np-hint);
}

.np-canvas-outer {
  position: relative;
  width: 100%;
  border: 1px solid var(--np-border);
  background: #fff;
  line-height: 0;
  overflow: hidden;
}
#np-canvas { display: block; width: 100%; height: auto; }

/* ── Position dots ── */
.np-overlay { position: absolute; inset: 0; pointer-events: none; }
.np-dot {
  position: absolute;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  border: 2px solid #111;
  transform: translate(-50%,-50%);
  cursor: pointer;
  pointer-events: all;
  transition: transform 0.12s, background 0.12s;
}
.np-dot:hover { background: #111; transform: translate(-50%,-50%) scale(1.25); }
.np-dot.is-active { background: #111; border-color: #000; }
.np-dot-pulse {
  position: absolute;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,0.35);
  opacity: 0;
  transform: translate(-50%,-50%);
  pointer-events: none;
  animation: np-pulse 2s ease-out infinite;
}
@keyframes np-pulse {
  0%   { opacity: 0.6; transform: translate(-50%,-50%) scale(0.8); }
  100% { opacity: 0;   transform: translate(-50%,-50%) scale(1.8); }
}

.np-preview-caption {
  font-size: 11px;
  color: var(--np-hint);
  text-align: center;
  line-height: 1.4;
  min-height: 14px;
}

/* ── Position selector ── */
.np-position-box {
  background: #fff;
  border: 1px solid var(--np-border);
  padding: 10px 12px;
}
.np-pos-heading {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--np-hint);
  margin-bottom: 7px;
}
.np-pos-grid { display: flex; flex-direction: column; gap: 2px; }
.np-pos-btn {
  text-align: left;
  padding: 6px 9px;
  font-size: 12px;
  color: var(--np-mid);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.10s;
  font-family: inherit;
}
.np-pos-btn:hover { border-color: var(--np-border2); color: var(--np-text); background: var(--np-bg2); }
.np-pos-btn--active {
  background: #111;
  color: #fff;
  border-color: #111;
  font-weight: 600;
}

/* ── Right: options ── */
.np-col-opts {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--np-bg);
}

.np-section {
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--np-border);
}
.np-section:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }

.np-sec-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--np-hint);
  margin-bottom: 8px;
}
.np-sec-hint {
  font-size: 12px;
  color: var(--np-mid);
  margin-bottom: 8px;
  line-height: 1.4;
}

/* ── Type toggle ── */
.np-type-toggle { display: flex; gap: 0; flex-wrap: wrap; margin-bottom: 10px; border: 1px solid var(--np-border); }
.np-type-btn {
  flex: 1;
  min-width: 64px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--np-mid);
  background: #fff;
  border: none;
  border-right: 1px solid var(--np-border);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: background 0.10s, color 0.10s;
  font-family: inherit;
}
.np-type-btn:last-child { border-right: none; }
.np-type-btn:hover { background: var(--np-bg2); color: var(--np-text); }
.np-type-btn--active { background: #111; color: #fff; }
.np-type-extra { font-size: 10px; color: inherit; opacity: 0.7; font-weight: 400; }

/* ── Text / color inputs ── */
.np-text-input,
.np-color-text-input {
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--np-border);
  border-radius: 0;
  background: #fff;
  color: var(--np-text);
  transition: border-color 0.15s;
  letter-spacing: 0.01em;
}
.np-text-input:focus,
.np-color-text-input:focus {
  outline: none;
  border-color: #111;
}

.np-char-progress { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
.np-char-bar { flex: 1; height: 1px; background: var(--np-border); overflow: hidden; }
.np-char-fill {
  height: 100%;
  background: #111;
  width: 0;
  transition: width 0.2s, background 0.2s;
}
.np-char-count { font-size: 10px; color: var(--np-hint); white-space: nowrap; }

/* ── Sizes ── */
.np-size-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  gap: 0;
  border: 1px solid var(--np-border);
}
.np-size-btn {
  padding: 9px 6px;
  border: none;
  border-right: 1px solid var(--np-border);
  background: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: background 0.10s;
  font-family: inherit;
}
.np-size-btn:last-child { border-right: none; }
.np-size-btn:hover { background: var(--np-bg2); }
.np-size-btn--active { background: #111; }
.np-size-name { font-size: 12px; color: var(--np-text); }
.np-size-btn--active .np-size-name { color: #fff; font-weight: 600; }
.np-size-price { font-size: 10px; color: var(--np-hint); }
.np-size-btn--active .np-size-price { color: rgba(255,255,255,0.7); }
.np-size-price em { font-style: italic; }

/* ── Price summary ── */
.np-price-summary {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--np-border);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.np-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--np-mid);
}
.np-price-row--surcharge { color: var(--np-sur); }
.np-sur-val { font-weight: 600; }
.np-price-row--total {
  border-top: 1px solid var(--np-border);
  padding-top: 8px;
  margin-top: 2px;
  font-size: 14px;
  font-weight: 700;
  color: var(--np-text);
  letter-spacing: 0.02em;
}
.np-total-val { font-size: 20px; letter-spacing: 0.01em; }

[hidden] { display: none !important; }
