/* ==========================================================================
   3D STL Multipart Maker — style.css
   Versione: 0.7.0-beta — 2026-10-08 12:00
   Tema scuro, layout a griglia: top / tools | view | panel / status
   ========================================================================== */
:root {
  --bg: #14171d; --bg2: #1b1f27; --bg3: #232834; --line: #2e3442; --tx: #e6e9ef; --tx2: #9aa3b2;
  --acc: #4f9dff; --acc2: #2b6fd6; --ok: #2ed573; --warn: #ffb142; --err: #ff5e57;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--tx); font: 13px/1.4 "Segoe UI", system-ui, sans-serif; overflow: hidden; user-select: none; }
body { display: grid; grid-template: "top top top" 44px "tools view panel" 1fr "status status status" 26px / 78px 1fr 320px; }
button { background: var(--bg3); color: var(--tx); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; font: inherit; cursor: pointer; }
button:hover { border-color: var(--acc); }
button.primary { background: var(--acc2); border-color: var(--acc); font-weight: 600; }
button.primary:hover { background: var(--acc); }
button.danger:hover { border-color: var(--err); color: var(--err); }
button.on { background: var(--acc2); border-color: var(--acc); }
button:disabled { opacity: .45; cursor: default; }
button.mini { padding: 2px 7px; font-size: 11px; }
input, select { background: var(--bg); color: var(--tx); border: 1px solid var(--line); border-radius: 5px; padding: 4px 6px; font: inherit; }
input[type=number] { width: 72px; }
input[type=range] { accent-color: var(--acc); }
input[type=checkbox] { accent-color: var(--acc); }
.hidden { display: none !important; }
.grow { flex: 1; }
.small { font-size: 11px; color: var(--tx2); }

/* barra superiore */
#top { grid-area: top; display: flex; align-items: center; gap: 6px; padding: 0 10px; background: var(--bg2); border-bottom: 1px solid var(--line); }
#top .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.brand { display: flex; align-items: center; gap: 6px; margin-right: 10px; }
.brand img { width: 24px; height: 24px; }
.brand span { color: var(--acc); font-weight: 700; }
.brand em { color: var(--tx2); font-size: 11px; font-style: normal; }
.explode { display: flex; align-items: center; gap: 6px; color: var(--tx2); }

/* barra strumenti */
#tools { grid-area: tools; background: var(--bg2); border-right: 1px solid var(--line); overflow-y: auto; padding: 6px 5px; display: flex; flex-direction: column; gap: 3px; }
#tools .grp { font-size: 9px; text-transform: uppercase; letter-spacing: .08em; color: var(--tx2); margin: 6px 0 1px 3px; }
#tools button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 2px; font-size: 10.5px; border-color: transparent; background: transparent; }
#tools button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#tools button:hover { background: var(--bg3); }
#tools button.on { background: var(--acc2); border-color: var(--acc); }

/* vista */
#view { grid-area: view; position: relative; overflow: hidden; }
#view canvas { display: block; width: 100%; height: 100%; }
#overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#overlay .lasso { fill: rgba(79,157,255,.12); stroke: var(--acc); stroke-width: 2; stroke-dasharray: 6 4; }
#overlay .line { stroke: var(--warn); stroke-width: 2.5; }
#overlay .handle { fill: #fff; stroke: var(--acc2); stroke-width: 2; pointer-events: all; cursor: move; }
#overlay .handle.pin { fill: var(--acc); stroke: #fff; }
#overlay .mid { fill: var(--acc); opacity: .6; pointer-events: all; cursor: copy; }
#drop { position: absolute; inset: 12px; border: 3px dashed var(--acc); border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 20px; background: rgba(20,23,29,.8); z-index: 5; }
#empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; text-align: center; color: var(--tx2); }
#empty h2 { color: var(--tx); font-weight: 500; margin: 0 0 6px; }
#empty button { pointer-events: all; margin-top: 10px; }
#brushCursor { position: absolute; border: 2px solid rgba(255,255,255,.8); border-radius: 50%; pointer-events: none; transform: translate(-50%,-50%); box-shadow: 0 0 0 1px rgba(0,0,0,.5); }

/* pannello destro */
#panel { grid-area: panel; background: var(--bg2); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
/* [2026-09-28 v0.1.0] versione precedente:
#toolpanel { padding: 12px; overflow-y: auto; flex: 1 1 60%; border-bottom: 1px solid var(--line); } */
/* v0.2.0: il pannello strumenti occupa lo spazio restante; l'altezza delle Parti è fissata dallo splitter */
#toolpanel { padding: 12px; overflow-y: auto; flex: 1 1 auto; min-height: 120px; }
#toolpanel h3 { margin: 0 0 4px; font-size: 15px; }
#toolpanel p.desc { margin: 0 0 10px; color: var(--tx2); font-size: 12px; }
#toolpanel .row { display: flex; align-items: center; gap: 8px; margin: 6px 0; flex-wrap: wrap; }
#toolpanel .row > label:first-child { min-width: 108px; color: var(--tx2); }
#toolpanel .row input[type=range] { flex: 1; min-width: 80px; }
#toolpanel .btns { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
#toolpanel fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px 8px; margin: 10px 0; }
#toolpanel legend { color: var(--acc); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 0 4px; }
#toolpanel .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
#toolpanel .seg button { border: 0; border-radius: 0; padding: 4px 9px; }
#toolpanel table { width: 100%; border-collapse: collapse; font-size: 12px; }
#toolpanel td { padding: 2px 4px; border-bottom: 1px solid var(--line); }
#toolpanel td:first-child { color: var(--tx2); }
#toolpanel kbd { background: var(--bg3); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; font-size: 11px; }
/* [2026-09-28 v0.1.0] versione precedente:
#partsbox { flex: 1 1 40%; display: flex; flex-direction: column; min-height: 120px; } */
#partsbox { flex: 0 0 var(--parts-h, 38%); display: flex; flex-direction: column; min-height: 90px; }
/* v0.2.0: barra trascinabile per ridimensionare in altezza la sezione Parti (doppio click = ripristina) */
#splitter { flex: none; height: 7px; cursor: row-resize; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--bg3); position: relative; }
#splitter::after { content: ''; position: absolute; left: 50%; top: 2px; width: 36px; height: 2px; margin-left: -18px; border-radius: 2px; background: var(--tx2); opacity: .6; }
#splitter:hover, #splitter.drag { background: var(--acc2); }
body.resizing { cursor: row-resize; }
.ph { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
#partcount { color: var(--tx2); }
#parts { list-style: none; margin: 0; padding: 4px; overflow-y: auto; flex: 1; }
#parts li { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
#parts li:hover { background: var(--bg3); }
#parts li.sel { background: #24406b; }
#parts .dot { width: 11px; height: 11px; border-radius: 3px; flex: none; }
#parts .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#parts .sz { color: var(--tx2); font-size: 10.5px; }
#parts .bad { color: var(--err); font-size: 10.5px; }
#parts .eye { background: none; border: 0; padding: 0 3px; color: var(--tx2); }
#parts li.hid .nm { opacity: .45; }

/* stato, attesa, notifiche */
#status { grid-area: status; display: flex; align-items: center; gap: 10px; padding: 0 10px; background: var(--bg2); border-top: 1px solid var(--line); color: var(--tx2); font-size: 12px; }
#busy { position: fixed; inset: 0; background: rgba(10,12,16,.55); z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; font-size: 15px; }
.spin { width: 38px; height: 38px; border: 4px solid var(--line); border-top-color: var(--acc); border-radius: 50%; animation: sp 0.9s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
#toasts { position: fixed; right: 336px; bottom: 36px; display: flex; flex-direction: column; gap: 6px; z-index: 60; }
.toast { background: var(--bg3); border: 1px solid var(--line); border-left: 4px solid var(--acc); padding: 8px 12px; border-radius: 6px; max-width: 420px; box-shadow: 0 4px 16px rgba(0,0,0,.4); }
.toast.err { border-left-color: var(--err); }
.toast.ok { border-left-color: var(--ok); }
.toast.warn { border-left-color: var(--warn); }

/* v0.4.0: link "Versione Windows" mostrato solo nella versione web */
#top a.dl { color: var(--tx); text-decoration: none; background: var(--bg3); border: 1px solid var(--acc); border-radius: 6px; padding: 5px 10px; margin-right: 4px; }
#top a.dl:hover { background: var(--acc2); }

/* v0.4.1: la barra superiore non va a capo nelle finestre strette */
#top { overflow: hidden; }
#top .brand, #top button, #top .explode { white-space: nowrap; flex: none; }

/* v0.5.0: barra dei passi della procedura guidata (in alto sulla vista) */
#steps { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 2px; background: rgba(27,31,39,.92); border: 1px solid var(--line); border-radius: 10px; padding: 4px 6px; max-width: calc(100% - 16px); overflow-x: auto; white-space: nowrap; }
#steps .step { display: inline-flex; align-items: center; gap: 5px; background: transparent; border: 1px solid transparent; padding: 3px 8px; font-size: 12px; color: var(--tx2); }
#steps .step i { font-style: normal; display: inline-flex; width: 18px; height: 18px; border-radius: 50%; align-items: center; justify-content: center; background: var(--bg3); border: 1px solid var(--line); font-size: 10.5px; color: var(--tx); }
#steps .step.done i { background: var(--ok); border-color: var(--ok); color: #0c2a17; }
#steps .step.cur { color: var(--tx); border-color: var(--acc); background: var(--acc2); }
#steps .step:hover { color: var(--tx); border-color: var(--line); }
#steps .arr { color: var(--line); font-size: 14px; }
/* schede di scelta del metodo */
#toolpanel .card { display: block; width: 100%; text-align: left; margin: 6px 0; padding: 9px 11px; }
#toolpanel .card b { display: block; font-size: 13.5px; margin-bottom: 2px; }
#toolpanel .card b em { font-style: normal; font-size: 10.5px; color: #0c2a17; background: var(--ok); border-radius: 4px; padding: 1px 5px; margin-left: 6px; vertical-align: 1px; }
#toolpanel .card span { color: var(--tx2); font-size: 12px; }
#toolpanel .card.rec { border-color: var(--acc); }
#toolpanel .gnav { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 14px; }
#toolpanel .gback { margin: -4px 0 10px; }
#toolpanel .gback button { width: 100%; background: #1d3354; border-color: var(--acc); }

/* v0.5.1: manuale integrato (finestra sopra l'app) */
#manual { position: fixed; inset: 0; z-index: 80; background: rgba(8,10,14,.6); display: flex; align-items: center; justify-content: center; }
#manual .mbox { width: min(1100px, 94vw); height: 90vh; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.5); overflow: hidden; }
#manual header { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
#manual header b { font-size: 15px; }
#manual header input { width: 260px; }
#manual header a.gh { color: var(--acc); text-decoration: none; font-size: 12px; }
#manual header .close { background: transparent; border-color: transparent; font-size: 16px; }
#manual .mbody { flex: 1; display: flex; min-height: 0; }
#manual nav { width: 230px; flex: none; overflow-y: auto; border-right: 1px solid var(--line); padding: 10px 6px; }
#manual nav a { display: block; color: var(--tx2); text-decoration: none; padding: 4px 8px; border-radius: 5px; font-size: 12.5px; }
#manual nav a.n1 { color: var(--acc); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .06em; margin-top: 8px; }
#manual nav a:hover { background: var(--bg3); color: var(--tx); }
#manual nav a.on { background: var(--acc2); color: #fff; }
#manual article { position: relative; flex: 1; overflow-y: auto; padding: 18px 28px 40px; user-select: text; line-height: 1.55; font-size: 13.5px; scroll-behavior: smooth; }
#manual article h1 { font-size: 22px; margin: 26px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
#manual article h1:first-child { margin-top: 0; }
#manual article h2 { font-size: 17px; margin: 24px 0 8px; color: var(--acc); }
#manual article h3 { font-size: 14px; margin: 16px 0 6px; }
#manual article p, #manual article li { color: var(--tx); }
#manual article ul, #manual article ol { padding-left: 22px; }
#manual article li { margin: 3px 0; }
#manual article a { color: var(--acc); }
#manual article img { max-width: 100%; border-radius: 8px; border: 1px solid var(--line); margin: 6px 0; }
#manual article code { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; font-size: 12px; }
#manual article pre { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px; overflow-x: auto; }
#manual article .tw { overflow-x: auto; margin: 8px 0; }
#manual article table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
#manual article th, #manual article td { border: 1px solid var(--line); padding: 5px 8px; text-align: left; vertical-align: top; }
#manual article th { background: var(--bg3); }
#manual article tr:nth-child(even) td { background: rgba(255,255,255,.02); }
#manual article mark { background: var(--warn); color: #000; border-radius: 2px; }
@media (max-width: 800px) { #manual nav { display: none; } #manual header input { width: 140px; } }

/* v0.6.0: avviso lingua del manuale */
#manual .langnote { padding: 8px 14px; background: #3a2f12; color: #ffd98a; border-bottom: 1px solid var(--line); font-size: 12.5px; }
