/* ═══════════════════════════════════════════════════════════
 *  WCP Wizard — Mobile-first CSS
 *  v0.2 — canvas draw, satellite map, dynamic services
 * ═══════════════════════════════════════════════════════════ */

/* ── Reset helpers ───────────────────────────────────────── */
.wcp-no-scroll { overflow: hidden !important; }

.wcp-open-btn,
.wcp-btn {
  border: 0;
  border-radius: 10px;
  padding: 12px 16px;
  font-weight: 600;
  cursor: pointer;
}

.wcp-open-btn,
.wcp-btn-primary {
  background: #2d6b2f;
  color: #fff;
}

.wcp-btn-secondary {
  background: #eef3ef;
  color: #1f2a20;
}

.wcp-modal[hidden] {
  display: none;
}

.wcp-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow-y: auto;
  padding: 12px;
  box-sizing: border-box;
}

.wcp-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.wcp-panel {
  position: relative;
  margin: 0 auto;
  width: 100%;
  max-width: 760px;
  max-height: calc(100vh - 24px);
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  box-sizing: border-box;
  top: 6px;
  padding-top: 47px !important;
}

.wcp-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  border: 0;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.wcp-progress {
  font-size: 12px;
  color: #486348;
  margin-bottom: 10px;
}

.wcp-form label {
  display: block;
  margin: 0 0 10px;
}

.wcp-option {
  display: flex !important;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
}

.wcp-map {
  width: 100%;
  height: 240px;
  border: 1px solid #ced8cf;
  border-radius: 10px;
  margin: 8px 0 12px;
  overflow: hidden;
}

.wcp-map--draw {
  height: 280px;
}

.wcp-hint {
  margin: 0 0 8px;
  color: #486348;
  font-size: 13px;
}

.wcp-form input[type="text"],
.wcp-form input[type="email"],
.wcp-form input[type="number"],
.wcp-form input[type="file"],
.wcp-form textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #ced8cf;
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 4px;
}

.wcp-form input[type="file"] {
  height: 50px;
}

.wcp-form input[type="radio"],
.wcp-form input[type="checkbox"] {
  margin-right: 8px;
}

.wcp-step {
  display: none;
}

.wcp-step.is-active {
  display: block;
}

.wcp-step h3 {
  margin: 8px 0 14px;
  font-size: 20px;
  line-height: 1.2;
}

.wcp-actions {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-top: 12px;
}

.wcp-actions .wcp-btn {
  flex: 1;
  min-height: 46px;
}

.wcp-message {
  margin-top: 10px;
  font-size: 14px;
}

.wcp-message.is-error {
  color: #b42318;
}

.wcp-message.is-success {
  color: #166534;
}

.wcp-estimate {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #b7d5ba;
  border-radius: 10px;
  background: #f3fbf4;
  font-size: 14px;
}

.wcp-success {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #b7d5ba;
  border-radius: 10px;
  background: #f3fbf4;
}

.wcp-success h3 {
  margin: 0 0 8px;
  font-size: 22px;
}

.wcp-success p {
  margin: 0 0 10px;
}

.wcp-success-estimate {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #9ac69f;
  font-size: 15px;
}

/* ── Panel header with progress bar ─────────────────────── */
.wcp-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e8f0e9;
}

.wcp-progress-bar-wrap {
  flex: 1;
  height: 6px;
  background: #e8f0e9;
  border-radius: 999px;
  overflow: hidden;
}

.wcp-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #2d6b2f, #52c25e);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.wcp-progress-text {
  font-size: 12px;
  color: #486348;
  white-space: nowrap;
  font-weight: 600;
}

.wcp-close {
  background: transparent;
  border: 0;
  padding: 4px;
  cursor: pointer;
  color: #486348;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.wcp-close:hover { color: #1f2a20; }

/* ── Option cards (step 1) ───────────────────────────────── */
.wcp-option-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 6px 0 16px;
}

.wcp-option-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 10px;
  border: 2px solid #ced8cf;
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s;
  font-size: 14px;
  font-weight: 500;
}
.wcp-option-card:hover { border-color: #2d6b2f; background: #f3fbf4; }
.wcp-option-card input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.wcp-option-card:has(input:checked) { border-color: #2d6b2f; background: #eef7ef; }

.wcp-option-icon { font-size: 28px; line-height: 1; }

/* ── Labels & inputs ─────────────────────────────────────── */
.wcp-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 14px;
  font-weight: 500;
  color: #1f2a20;
  margin-bottom: 12px;
}

.wcp-form input[type="text"],
.wcp-form input[type="email"],
.wcp-form input[type="number"],
.wcp-form input[type="tel"],
.wcp-form textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid #ced8cf;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  color: #1f2a20;
  transition: border-color .15s;
}
.wcp-form input:focus, .wcp-form textarea:focus {
  outline: none;
  border-color: #2d6b2f;
}

.wcp-fields-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ── Canvas draw ─────────────────────────────────────────── */
.wcp-canvas-wrap {
  position: relative;
  width: 100%;
  height: 320px;
  border: 2px solid #ced8cf;
  border-radius: 12px;
  overflow: hidden;
  margin: 10px 0 6px;
  background: #cbd5cb;
  touch-action: none;
}
@media (max-width: 480px) {
  .wcp-canvas-wrap { height: 220px; }
}
@media (min-width: 768px) {
  .wcp-canvas-wrap { height: 380px; }
}

.wcp-canvas-map {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.wcp-canvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  cursor: crosshair;
  width: 100%;
  height: 100%;
  background: transparent;
}

.wcp-canvas-tools {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wcp-tool-btn {
  width: 38px; height: 38px;
  border: 2px solid #ced8cf;
  border-radius: 8px;
  background: rgba(255,255,255,.92);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s, background .15s;
  backdrop-filter: blur(4px);
}
.wcp-tool-btn:hover, .wcp-tool-btn.is-active {
  border-color: #2d6b2f;
  background: #eef7ef;
}
.wcp-tool-clear { border-color: #fca5a5; }
.wcp-tool-clear:hover { background: #fef2f2; border-color: #dc2626; }

/* ── Services list (step 3) ──────────────────────────────── */
.wcp-service-cat {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #486348;
  margin: 14px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #e8f0e9;
}
.wcp-service-cat:first-child { margin-top: 4px; }

.wcp-service-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1.5px solid #ced8cf;
  border-radius: 10px;
  margin-bottom: 7px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  position: relative;
}
.wcp-service-item input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
/* Checkbox visuale reale (span inserito via JS) */
.wcp-check-box {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid #ced8cf;
  border-radius: 5px;
  background: #fff;
  transition: background .15s, border-color .15s;
  align-self: center;
}
.wcp-service-item:has(input:checked) .wcp-check-box {
  background: #2d6b2f;
  border-color: #2d6b2f;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1 5l3 4L11 1' stroke='%23fff' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 10px 8px;
}
.wcp-service-item:hover { border-color: #2d6b2f; background: #f9fdf9; }
.wcp-service-item:has(input:checked) { border-color: #2d6b2f; background: #eef7ef; }

.wcp-service-label {
  font-size: 14px;
  font-weight: 600;
  color: #1f2a20;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.wcp-service-price {
  font-size: 13px;
  color: #2d6b2f;
  font-weight: 700;
  margin-left: auto;
  white-space: nowrap;
}
.wcp-service-desc {
  font-size: 12px;
  color: #646970;
  margin-top: 3px;
  line-height: 1.4;
}

/* ── Photo upload ────────────────────────────────────────── */
.wcp-file-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: 2px dashed #ced8cf;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #486348;
  background: #f9fdf9;
  transition: border-color .15s;
  width: 100%;
  box-sizing: border-box;
  justify-content: center;
}
.wcp-file-label:hover { border-color: #2d6b2f; }
.wcp-file-label input { display: none; }

.wcp-photo-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.wcp-photo-thumb {
  width: 72px; height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #ced8cf;
}

/* ── Consent ─────────────────────────────────────────────── */
.wcp-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  margin: 12px 0;
  cursor: pointer;
}
.wcp-consent input { flex-shrink: 0; margin-top: 2px; width: 18px; height: 18px; cursor: pointer; }

/* ── Success screen ──────────────────────────────────────── */
.wcp-success-icon { font-size: 48px; text-align: center; margin: 8px 0; }
.wcp-success { text-align: center; padding: 20px 10px; }
.wcp-success h3 { font-size: 22px; margin: 0 0 10px; }
.wcp-success p  { color: #486348; margin: 0 0 12px; }
.wcp-success-estimate {
  display: inline-block;
  padding: 10px 20px;
  background: #eef7ef;
  border-radius: 8px;
  font-size: 16px;
  margin-top: 8px;
}

/* ── Item thumbnail (servizi e materiali con immagine) ───── */
.wcp-service-item--has-img {
  align-items: center;
}
.wcp-item-thumb {
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  border: 1px solid #dce8dc;
  cursor: zoom-in;
  transition: opacity .15s;
}
.wcp-item-thumb:hover { opacity: .85; }
.wcp-item-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
/* label e prezzo sulla stessa riga */
.wcp-item-body .wcp-service-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  width: 100%;
  gap: 6px;
}

/* ── Lightbox zoom foto ───────────────────────────────────── */
.wcp-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0,0,0,.82);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: wcp-lb-in .15s ease;
}
@keyframes wcp-lb-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.wcp-lightbox img {
  max-width: 90vw;
  max-height: 86vh;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
  pointer-events: none;
}
.wcp-lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  color: #fff;
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  text-shadow: 0 1px 4px rgba(0,0,0,.5);
}

/* ── Disclaimer prezzo ───────────────────────────────────── */
.wcp-price-disclaimer {
  margin: 14px 0 0;
  padding: 10px 14px;
  background: #fffbe6;
  border-left: 3px solid #f5c400;
  border-radius: 0 8px 8px 0;
  font-size: 12px;
  color: #6b5900;
  line-height: 1.5;
}

/* ── Sezione materiali suggeriti / altri ─────────────────── */
.wcp-materials-section-hdr {
  margin: 14px 0 6px;
  padding: 6px 12px;
  background: #eaf4ea;
  border-left: 3px solid #2d6b2f;
  font-size: 12px;
  font-weight: 700;
  color: #2d6b2f;
  border-radius: 0 6px 6px 0;
}
.wcp-materials-section-hdr--other {
  background: #f6f7f7;
  border-left-color: #9aabb9;
  color: #5a6872;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 480px) {
  .wcp-modal  { padding: 0; }
  .wcp-panel  { border-radius: 16px 16px 0 0; min-height: 60vh; }
  .wcp-option-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .wcp-option-card { padding: 12px 6px; font-size: 12px; }
  .wcp-option-icon { font-size: 22px; }
  .wcp-fields-row { grid-template-columns: 1fr; }
  .wcp-tool-btn { width: 34px; height: 34px; font-size: 16px; }
}

@media (min-width: 768px) {
  .wcp-modal  { padding: 20px; }
  .wcp-panel  {
    max-height: calc(100vh - 40px);
    padding: 24px 28px;
    top: 5%;
  }
  .wcp-step h3 { font-size: 22px; }
}
