/* FlowWedding — configuratore (/crea) ed editor del sito (/pannello/sito): modulo a sinistra, anteprima dal vivo a destra. */
@font-face { font-family: 'Great Vibes'; src: url('../fonts/great-vibes-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Playfair Display'; src: url('../fonts/playfair-display-latin-wght-normal.woff2') format('woff2'); font-weight: 400 900; font-display: swap; }
@font-face { font-family: 'Lora'; src: url('../fonts/lora-latin-wght-normal.woff2') format('woff2'); font-weight: 400 700; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url('../fonts/fraunces-latin-wght-normal.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('../fonts/dm-sans-latin-wght-normal.woff2') format('woff2'); font-weight: 100 1000; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('../fonts/montserrat-latin-wght-normal.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Outfit'; src: url('../fonts/outfit-latin-wght-normal.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

/* ---------- impianto ---------- */
.ed { display: grid; grid-template-columns: minmax(0, 540px) minmax(0, 1fr); align-items: start; }
.ed-form { min-width: 0; }
.ed .f { align-content: start; }
.crea-page .pub-nav .btn { display: none; }
.ed-preview { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 10px; padding: 14px 18px 18px; background: var(--bg-2); min-width: 0; }
.pv-bar { display: flex; align-items: center; gap: 12px; }
.pv-title { font: 600 20px/1 var(--f-display); margin-right: auto; }
.pv-bar .seg button { font-size: 13px; padding: 5px 12px; }
.pv-close { display: none; }
.frame { flex: 1; min-height: 0; display: flex; justify-content: center; }
.frame iframe { width: 100%; height: 100%; border: 0; border-radius: 14px; background: var(--card); box-shadow: 0 1px 2px rgb(38 34 29 / .06), 0 20px 50px -30px rgb(38 34 29 / .45); transition: width .25s ease; }
.frame.phone iframe { width: 390px; max-width: 100%; border-radius: 28px; border: 8px solid #1f1c19; }
.frame iframe.loading { background: var(--card) linear-gradient(90deg, transparent, rgb(255 255 255 / .6), transparent) no-repeat -200px 0 / 200px 100%; animation: pv-load 1.2s infinite; }
@keyframes pv-load { to { background-position: calc(100% + 200px) 0; } }
.preview-fab { display: none; }

/* configuratore a tutta pagina */
.crea-page .ed { min-height: calc(100vh - 57px); }
.crea-page .ed-form { padding: 28px clamp(16px, 3vw, 36px) 48px; border-right: 1px solid var(--line); background: var(--bg); }
.crea-page .ed-preview { top: 57px; height: calc(100vh - 57px); }
.crea-head { margin-bottom: 18px; }
.crea-head .kicker { font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.crea-head h1 { font-size: clamp(34px, 4vw, 44px); }
.crea-head .lead { color: var(--muted); margin-top: 6px; }
.partner-note { margin-bottom: 16px; }
.crea-login { margin-top: 18px; }

/* editor nel pannello */
.editor { gap: 20px; }
.editor .ed-preview { top: 12px; height: calc(100vh - 24px); border-radius: var(--r); border: 1px solid var(--line-2); }

/* ---------- passi ---------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 4px 0 22px; }
.step-btn { border: 0; background: none; padding: 8px 0 6px; text-align: left; cursor: pointer; border-top: 3px solid var(--line); color: var(--muted); font-size: 14px; font-weight: 500; }
.step-btn small { display: block; font-weight: 400; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.step-btn[aria-current="step"] { border-color: var(--brand); color: var(--brand); }
.step-btn.done { border-color: var(--accent); }
.step { display: grid; gap: 16px; }
.step + .step { margin-top: 28px; }
.step[hidden] + .step, .step + .step[hidden] { margin-top: 0; }
.step h2 { font-size: 30px; }
.step-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; }
.site-addr { background: var(--brand-soft); border-radius: 12px; padding: 12px 14px; font-size: 15px; overflow-wrap: anywhere; }
.site-addr b { color: var(--brand); font-weight: 500; }

/* ---------- interruttore ---------- */
.sw { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-size: 15px; position: relative; }
.sw input[type=checkbox] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw i { width: 40px; height: 24px; border-radius: 999px; background: rgb(38 34 29 / .2); position: relative; flex: none; transition: background .2s; }
.sw i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .2s; }
.sw input:checked + i { background: var(--brand); }
.sw input:checked + i::after { transform: translateX(16px); }
.sw input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.sw b { font-weight: 600; }

.ed-block { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: grid; gap: 12px; background: var(--card); }
.ed-sec .ed-block { border: 0; padding: 0; background: none; }
.ed-block.off .ed-body { opacity: .45; }
.ed-body { display: grid; gap: 12px; }

/* ---------- foto ---------- */
.photo-pick { display: flex; align-items: center; gap: 14px; border: 1px dashed rgb(38 34 29 / .22); border-radius: 14px; padding: 12px; background: var(--card); }
.photo-th { width: 84px; height: 84px; border-radius: 12px; background: var(--bg-2); display: grid; place-items: center; overflow: hidden; flex: none; color: var(--muted); }
.photo-th img { width: 100%; height: 100%; object-fit: cover; }
.photo-txt { display: grid; gap: 4px; min-width: 0; }
.photo-txt b { font-weight: 600; font-size: 15px; }
.photo-act { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.photo-act label.btn { cursor: pointer; }
.photo-act label.btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

.gal { display: grid; gap: 10px; justify-items: start; }
.gal-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; width: 100%; }
.gal-list:empty { display: none; }
.gal-item { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.gal-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--bg-2); }
.gal-item span { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.gal-item:has(input:checked) img { opacity: .3; }
.gal-item .btn { justify-self: start; }
.gal label.btn { cursor: pointer; }

/* ---------- stile ---------- */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.swatch, .fontcard, .layoutcard, .plan { position: relative; cursor: pointer; }
.swatch input, .fontcard input, .layoutcard input, .plan input { position: absolute; opacity: 0; pointer-events: none; }
.sw-c { display: flex; align-items: flex-end; gap: 4px; height: 56px; border-radius: 12px; padding: 8px; border: 1px solid var(--line); }
.sw-c i { width: 18px; height: 18px; border-radius: 50%; box-shadow: 0 0 0 1px rgb(0 0 0 / .08); }
.sw-c i:first-child { margin-right: auto; width: 26px; height: 26px; border-radius: 8px; }
.sw-n { display: block; font-size: 13px; margin-top: 5px; line-height: 1.25; }
.sw-n em { font-style: normal; color: var(--muted); }
.swatch input:checked + .sw-c { outline: 2px solid var(--brand); outline-offset: 2px; }
.swatch input:focus-visible + .sw-c, .fontcard input:focus-visible ~ .fc-names, .layoutcard input:focus-visible + svg { outline: 2px solid var(--accent); outline-offset: 2px; }
.own-color { display: flex; align-items: center; gap: 14px; margin-top: 6px; flex-wrap: wrap; }

.fontcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.fontcard { display: grid; gap: 2px; justify-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 12px 8px 10px; background: var(--card); text-align: center; }
.fc-names { font-size: 30px; line-height: 1.15; color: var(--ink); }
.fc-name { font-size: 13px; color: var(--muted); }
.fontcard:has(input:checked), .layoutcard:has(input:checked), .plan:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); background: var(--brand-soft); }

.layouts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.layoutcard { display: grid; gap: 2px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--card); }
.layoutcard svg { width: 100%; height: auto; fill: rgb(38 34 29 / .2); border-radius: 6px; background: var(--bg); margin-bottom: 6px; }
.layoutcard svg .w { fill: #fff; }
.layoutcard b { font-weight: 600; font-size: 14px; }
.layoutcard .hint { font-size: 12px; line-height: 1.3; }

/* ---------- formula e codice ---------- */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.plan { display: grid; gap: 6px; align-content: start; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: var(--card); }
.plan-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.plan-h b { font: 600 22px/1.1 var(--f-display); }
.price { font-weight: 500; white-space: nowrap; }
.price s { color: var(--muted); font-weight: 400; }
.code-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.code-msg { font-size: 14px; min-height: 1.4em; color: var(--muted); }
.code-msg.ok { color: var(--ok); }
.code-msg.err { color: var(--err); }

/* ---------- righe ripetibili ---------- */
.rep { display: grid; gap: 10px; justify-items: start; }
.rep [data-rep-list] { display: grid; gap: 8px; width: 100%; }
.rep-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: start; border: 1px solid var(--line); border-radius: 12px; padding: 10px 8px 10px 12px; background: var(--bg); }
.rep-f { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.rep-f textarea { min-height: 64px; }
.rep-row .icon-btn { margin-top: 22px; color: var(--muted); }

/* ---------- sezioni dell'editor ---------- */
.ed-sec { background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: 10px; scroll-margin-top: 16px; }
.ed-sec > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 18px; cursor: pointer; font-weight: 500; font-size: 17px; list-style: none; }
.ed-sec > summary::-webkit-details-marker { display: none; }
.ed-sec > summary::after { content: ""; width: 9px; height: 9px; border-right: 1.7px solid var(--muted); border-bottom: 1.7px solid var(--muted); transform: rotate(45deg); margin: -4px 4px 0 0; transition: transform .2s; flex: none; }
.ed-sec[open] > summary::after { transform: rotate(225deg); margin-top: 4px; }
.ed-sec > summary span:first-child { margin-right: auto; }
.ed-sec-b { padding: 2px 18px 18px; }
.savebar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 30%); }
.is-dirty .savebar .hint { color: var(--warn); }
.export { margin-top: 18px; }
.export .badge .ic { width: 14px; height: 14px; }

.site-status { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; padding: 14px 18px; }
.ss-main { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }
.ss-url { overflow-wrap: anywhere; font-weight: 500; }

/* ---------- telefono e tablet ---------- */
@media (max-width: 980px) {
  .ed { grid-template-columns: minmax(0, 1fr); }
  .crea-page .ed-form { border-right: 0; }
  .ed-preview, .crea-page .ed-preview, .editor .ed-preview { display: none; position: fixed; inset: 0; top: 0; height: 100dvh; z-index: 70; border-radius: 0; border: 0; padding: 10px 10px 12px; }
  body.show-preview .ed-preview { display: flex; }
  body.show-preview { overflow: hidden; }
  .pv-close { display: inline-grid; }
  .frame.desk iframe { border-radius: 10px; }
  .preview-fab { display: inline-flex; position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 60; box-shadow: 0 10px 30px -10px rgb(0 0 0 / .45); }
  .savebar { padding-right: 150px; }
  .crea-page .ed-form { padding-bottom: 90px; }
}
@media (max-width: 520px) {
  .steps { gap: 4px; }
  .step-btn { font-size: 13px; }
  .layouts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .layoutcard .hint { display: none; }
  .code-row { grid-template-columns: minmax(0, 1fr); }
  .code-row .btn { justify-self: start; }
  .photo-pick { align-items: flex-start; }
  .savebar { padding-right: 175px; }
  .savebar .hint { display: none; }
}
