Benzina Abruzzo: PWA completa (mappa PMTiles, lista a pannello, dettaglio impianto)

This commit is contained in:
Claptrap 2026-11-27 22:14:06 +01:00
commit 176e6acd6f
16 changed files with 3180 additions and 0 deletions

369
static/app.css Normal file
View file

@ -0,0 +1,369 @@
:root{
--bg:#FBF9F6; --surface:#FFFFFF; --surface-2:#F4F1EC;
--ink:#14181C; --ink-2:#5A6570; --ink-3:#98A2AC;
--brand:#0B7A5A; --brand-2:#0E9C73; --brand-soft:#E4F3ED;
--cheap:#0B7A5A; --mid:#C08A1E; --pricey:#C24A38;
--accent:#E19A2B;
--line:#E7E3DC;
--safe-b:env(safe-area-inset-bottom,0px);
--safe-t:env(safe-area-inset-top,0px);
}
@media (prefers-color-scheme:dark){
:root{
--bg:#0E1114; --surface:#171C21; --surface-2:#1F262C;
--ink:#EEF2F5; --ink-2:#A3AEB8; --ink-3:#6B7883;
--brand:#25B98C; --brand-2:#2FD39F; --brand-soft:#123028;
--cheap:#2FD39F; --mid:#E2B352; --pricey:#E87461;
--line:#262E35;
}
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{height:100%}
body{
margin:0;background:var(--bg);color:var(--ink);
font:15px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Inter,Roboto,sans-serif;
overscroll-behavior-y:none;
}
button,select,input{font:inherit;color:inherit}
button{border:0;background:none;cursor:pointer}
a{color:var(--brand);text-decoration:none}
/* ============================================================
LAYOUT — la mappa occupa tutto. La lista e' un pannello che si
apre solo se lo chiedi. Riferimenti: Apple Maps e Waze (controlli
in capsule, nessun pannello permanente) e i pattern di Mobbin per
le liste di luoghi (una riga per item, prezzo a destra).
============================================================ */
.app{height:100dvh;display:flex;flex-direction:column;overflow:hidden;position:relative}
#map{position:absolute;inset:0;z-index:0;background:var(--surface-2)}
.map-wrap{position:relative;flex:1;min-height:0}
.leaflet-container{background:var(--surface-2);font:inherit}
.leaflet-control-attribution{
font-size:9px;opacity:.5;background:transparent!important;
padding:0 4px!important;bottom:0!important;right:0!important;
}
/* ---------- barra superiore ---------- */
.topbar{
position:absolute;top:calc(10px + var(--safe-t));left:10px;right:10px;z-index:600;
display:flex;gap:8px;align-items:center;pointer-events:none;
}
.topbar>*{pointer-events:auto}
.pill{
display:flex;align-items:center;gap:7px;height:42px;padding:0 14px;
background:var(--surface);
font-size:14px;font-weight:650;white-space:nowrap;color:var(--ink);
}
.pill.round{width:42px;padding:0;justify-content:center;position:relative}
.pill.brand{font-size:15px;letter-spacing:-.01em}
.pill.brand svg{color:var(--brand)}
#filterchip,#vbtn{margin-left:auto}
#filterchip+#vbtn{margin-left:0}
.badge-dot{
position:absolute;top:-2px;right:-2px;min-width:17px;height:17px;padding:0 5px;
background:var(--brand);color:#fff;
font-size:10.5px;font-weight:800;display:none;align-items:center;justify-content:center;
}
.badge-dot.on{display:flex}
.pill:active{background:var(--surface-2)}
/* ---------- chips ordinamento ---------- */
.chips{
position:absolute;top:calc(60px + var(--safe-t));left:10px;right:10px;z-index:600;
display:flex;gap:7px;padding:0 0 4px;overflow-x:auto;scrollbar-width:none;
}
.chips::-webkit-scrollbar{display:none}
.chip{
flex:0 0 auto;height:32px;padding:0 13px;background:var(--surface);color:var(--ink-2);
font-size:13px;font-weight:600;display:flex;align-items:center;
transition:background .15s,color .15s;
}
.chip[aria-pressed="true"]{background:var(--ink);color:var(--bg)}
/* ---------- comandi in basso a destra ---------- */
.fab-stack{
position:absolute;right:10px;bottom:calc(14px + var(--safe-b));z-index:600;
display:flex;flex-direction:column;gap:9px;align-items:flex-end;
transition:opacity .22s ease,transform .22s ease;
}
/* con la lista aperta i comandi spariscono: la lista e' il contesto */
.app.sheet-open .fab-stack{opacity:0;pointer-events:none;transform:translateY(8px)}
.fab{width:44px;height:44px}
.fab.on{background:var(--brand);color:#fff}
.btn-list{
display:flex;align-items:center;gap:8px;height:46px;padding:0 18px 0 15px;
background:var(--ink);color:var(--bg);
font-size:14.5px;font-weight:650;letter-spacing:-.01em;
}
.btn-list:active{transform:scale(.97)}
/* ============================================================
PANNELLO LISTA — chiuso per default, si apre dal pulsante
============================================================ */
.sheet{
position:absolute;left:0;right:0;bottom:0;z-index:700;
background:var(--bg);
display:flex;flex-direction:column;
height:min(74dvh,620px);
padding-bottom:var(--safe-b);
transform:translateY(102%);visibility:hidden;
transition:transform .3s cubic-bezier(.32,.72,0,1),visibility .3s;
}
.sheet.open{transform:none;visibility:visible}
.grab{width:100%;padding:10px 0 2px;display:flex;justify-content:center;flex:0 0 auto}
.grab span{width:34px;height:4px;border-radius:99px;background:var(--ink-3);opacity:.3}
.sheet-head{
padding:6px 16px 10px;display:flex;align-items:flex-start;
justify-content:space-between;gap:12px;flex:0 0 auto;
}
.sheet-head h2{font-size:19px;margin:0;letter-spacing:-.022em;font-weight:700}
.sheet-head .sub{font-size:12.5px;color:var(--ink-3);font-weight:500;margin-top:1px}
.icon-btn{
width:32px;height:32px;border-radius:50%;background:var(--surface-2);
display:flex;align-items:center;justify-content:center;color:var(--ink-2);flex:0 0 auto;
}
.list{flex:1;overflow-y:auto;padding:0 8px 8px;-webkit-overflow-scrolling:touch;overscroll-behavior:contain}
.list.empty{display:flex;align-items:center;justify-content:center;color:var(--ink-3);font-size:14px;padding:30px}
.footline{padding:8px 16px calc(6px + var(--safe-b));font-size:11px;color:var(--ink-3);font-weight:500;
border-top:1px solid var(--line);flex:0 0 auto}
/* ---------- riga impianto: una linea, prezzo a destra ---------- */
.card{
display:flex;align-items:center;gap:12px;
padding:11px 10px;transition:background .15s;cursor:pointer;
}
.card+.card{border-top:1px solid var(--line);}
.card:active,.card.sel{background:var(--surface-2)}
.card .dot{
width:9px;height:9px;border-radius:50%;flex:0 0 auto;background:var(--ink-3);
box-shadow:0 0 0 3px color-mix(in srgb,var(--ink-3) 14%,transparent);
}
.card .dot.c-cheap{background:var(--cheap);box-shadow:0 0 0 3px color-mix(in srgb,var(--cheap) 16%,transparent)}
.card .dot.c-mid{background:var(--mid);box-shadow:0 0 0 3px color-mix(in srgb,var(--mid) 16%,transparent)}
.card .dot.c-pricey{background:var(--pricey);box-shadow:0 0 0 3px color-mix(in srgb,var(--pricey) 16%,transparent)}
.card .body{flex:1;min-width:0}
.card .brand{
font-size:14.5px;font-weight:600;letter-spacing:-.012em;
white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.card .sub{
font-size:12.5px;color:var(--ink-3);margin-top:1px;
white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.card .sub .d{color:var(--ink-2);font-weight:600}
.card .right{display:flex;flex-direction:column;align-items:flex-end;flex:0 0 auto}
.card .price{
font-size:16.5px;font-weight:700;letter-spacing:-.022em;
font-variant-numeric:tabular-nums;line-height:1.15;
}
.card .per{font-size:10.5px;color:var(--ink-3);font-weight:600;letter-spacing:.03em;text-transform:uppercase}
.c-cheap{color:var(--cheap)} .c-mid{color:var(--mid)} .c-pricey{color:var(--pricey)}
.dist{color:var(--ink-3);font-size:12px;font-weight:600}
/* ============================================================
DETTAGLIO — il pannello che risponde a "cosa costa qui".
Non un cruscotto: una tabella di prezzi leggibile, un pulsante.
============================================================ */
.modal.sheet-modal#detail{align-items:flex-end;padding:0;overflow:hidden}
#detail .det{
width:100%;max-height:min(90dvh,700px);overflow-y:auto;overscroll-behavior:contain;
background:var(--bg);padding:6px 18px calc(18px + var(--safe-b));
animation:sheetUp .3s cubic-bezier(.32,.72,0,1);
}
.det-head{display:flex;align-items:flex-start;gap:12px;margin-bottom:16px}
.det-title{flex:1;min-width:0}
.det-x{
width:32px;height:32px;border-radius:50%;background:var(--surface-2);flex:0 0 auto;
display:flex;align-items:center;justify-content:center;color:var(--ink-2);margin-top:2px;
}
#detail h2{
font-size:19px;line-height:1.28;letter-spacing:-.022em;margin:0;font-weight:700;
overflow-wrap:anywhere;
}
.det-addr{font-size:13px;line-height:1.4;color:var(--ink-3);margin:3px 0 0;overflow-wrap:anywhere}
/* tabella carburanti: nome a sinistra, self e servito incolonnati */
.fuel-head{
display:flex;justify-content:space-between;align-items:baseline;
font-size:10.5px;font-weight:700;letter-spacing:.07em;text-transform:uppercase;
color:var(--ink-3);padding:0 2px 7px;border-bottom:1px solid var(--line);
}
.fuel-list{display:flex;flex-direction:column}
.fuel-row{
display:flex;align-items:baseline;gap:10px;
padding:11px 2px;border-bottom:1px solid var(--line);
}
.fuel-row:last-child{border-bottom:0}
.fuel-row .fname{flex:1;min-width:0;font-size:14.5px;font-weight:600;letter-spacing:-.012em}
.fuel-row .fv{
font-size:14.5px;font-weight:650;font-variant-numeric:tabular-nums;
min-width:56px;text-align:right;letter-spacing:-.015em;
}
.fuel-row .fv.empty{color:var(--ink-3);font-weight:500}
.fuel-row.main{background:var(--brand-soft);margin:0 -8px;padding:11px 10px;border-bottom:0}
.fuel-row.main .fname{font-weight:700;color:var(--brand)}
.det-meta{font-size:11.5px;color:var(--ink-3);margin:12px 0 16px;line-height:1.45}
.det-actions{display:flex;gap:9px;margin-bottom:16px}
.det-nav{
flex:1;height:50px;background:var(--brand);color:#fff;
display:flex;align-items:center;justify-content:center;gap:8px;
font-size:15.5px;font-weight:650;letter-spacing:-.01em;
}
.det-nav:active{opacity:.9}
.det-icon-btn{
width:50px;height:50px;background:var(--surface-2);
display:flex;align-items:center;justify-content:center;color:var(--ink);flex:0 0 auto;
}
.histwrap{background:var(--surface-2);padding:10px 12px;margin-bottom:12px}
.histhead{
font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;color:var(--ink-3);
font-weight:700;margin-bottom:6px;display:flex;justify-content:space-between;
}
#d-hist{width:100%;height:44px;display:block;overflow:visible}
#d-hist polyline{fill:none;stroke:var(--brand);stroke-width:2;stroke-linejoin:round;stroke-linecap:round;vector-effect:non-scaling-stroke}
#d-hist polygon{fill:var(--brand);opacity:.10}
#d-hist circle{fill:var(--brand);r:2.2}
#d-hist text{font-size:8px;fill:var(--ink-3);font-weight:600}
/* ---------- setup sheet ---------- */
.setup{display:none;position:fixed;inset:0;z-index:950;background:var(--bg);overflow-y:auto;
padding:calc(20px + var(--safe-t)) 20px calc(28px + var(--safe-b));
overscroll-behavior:contain}
.setup.open{display:block}
.setup h2{font-size:22px;margin:8px 0 6px;letter-spacing:-.02em}
.setup p.lede{color:var(--ink-2);font-size:14px;margin:0 0 20px}
.field{margin-bottom:16px}
.field label{display:block;font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--ink-3);margin-bottom:7px}
.field input,.field select{
width:100%;height:52px;padding:0 14px;background:var(--surface-2);
font-size:16px;
}
.hintline{font-size:12px;color:var(--ink-3);margin-top:6px}
.seg{display:flex;background:var(--surface-2);padding:4px;gap:4px}
.seg button{flex:1;height:44px;font-weight:600;font-size:14px;color:var(--ink-2)}
.seg button[aria-pressed="true"]{background:var(--bg);color:var(--ink)}
/* ---------- misc ---------- */
.toast{
position:fixed;left:50%;bottom:calc(26px + var(--safe-b));transform:translate(-50%,20px);
background:var(--ink);color:var(--bg);padding:11px 18px;font-size:13.5px;font-weight:600;
opacity:0;pointer-events:none;transition:.25s;z-index:1000;max-width:88vw;text-align:center;
}
.toast.show{opacity:1;transform:translate(-50%,0)}
.skel{height:74px;background:linear-gradient(90deg,var(--surface-2) 25%,var(--surface) 50%,var(--surface-2) 75%);
background-size:200% 100%;animation:sh 1.3s infinite;margin-bottom:6px}
@keyframes sh{0%{background-position:200% 0}100%{background-position:-200% 0}}
.mk{width:30px;height:30px;border-radius:50%;background:var(--brand);color:#fff;border:2.5px solid #fff;
box-shadow:0 2px 8px rgba(0,0,0,.35);display:flex;align-items:center;justify-content:center;
font-size:11px;font-weight:800;font-variant-numeric:tabular-nums}
.mk.cheap{background:var(--cheap)} .mk.mid{background:var(--brand)} .mk.pricey{background:var(--pricey)}
.mk.user{background:#2E7DF6;width:16px;height:16px;border-width:3px}
@media (min-width:820px){
.sheet{
left:auto;right:16px;bottom:16px;width:400px;
height:min(72dvh,640px);transform:translateX(112%);
}
.sheet.open{transform:none}
.fab-stack{bottom:16px;transition:right .3s cubic-bezier(.32,.72,0,1),opacity .2s}
.app.sheet-open .fab-stack{opacity:1;pointer-events:auto;transform:none}
.app.sheet-open .fab-stack{right:432px}
.modal.sheet-modal#detail{align-items:flex-end}
}
/* ---------- modali ---------- */
.modal{
position:fixed;inset:0;z-index:980;display:none;
background:rgba(20,24,28,.42);backdrop-filter:blur(3px);
padding:16px;overflow-y:auto;
}
.modal.open{display:flex;align-items:flex-start;justify-content:center}
/* margin-top:auto spinge il box in basso ma, se e' piu' alto dello schermo,
il margine collassa a 0 e il contenuto resta raggiungibile in cima (niente
taglio del titolo su iPhone SE). Niente align-items:flex-end, che creerebbe
overflow non scrollabile. */
.modal-box{margin-top:auto}
@media(min-width:640px){.modal-box{margin-top:auto;margin-bottom:auto}}
.modal-box{
width:100%;max-width:440px;background:var(--bg);padding:20px 20px calc(20px + var(--safe-b));
animation:up .25s cubic-bezier(.32,.72,0,1);
}
@keyframes up{from{transform:translateY(24px);opacity:.6}to{transform:none;opacity:1}}
.modal-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px}
.modal-head h2{font-size:20px;margin:0;letter-spacing:-.02em}
.xbtn{width:36px;height:36px;border-radius:50%;background:var(--surface-2);display:flex;align-items:center;justify-content:center;font-size:15px}
.geolook{width:72px;height:72px;border-radius:50%;background:var(--brand-soft);color:var(--brand);
display:flex;align-items:center;justify-content:center;margin:4px auto 14px}
.modal-box h2{text-align:center}
.modal-box .lede{text-align:center}
.modal-box .field label{text-align:left}
.modal-box .btn{height:50px}
/* ============================================================
SHEET D'AVVISO — una sola grammatica per GPS e installazione
Riferimenti: sheet di Apple Maps (grabber, stato, azione singola)
e HIG iOS (pre-prompt con beneficio, non con il nome del permesso).
Niente icone giganti, niente gradienti: tipografia e spazi.
============================================================ */
.modal.sheet-modal{align-items:flex-end;padding:0;overflow:hidden}
.sheet-modal .shd{
width:100%;max-width:520px;margin:auto auto 0;background:var(--surface);
padding:10px 22px calc(22px + var(--safe-b));
animation:sheetUp .32s cubic-bezier(.32,.72,0,1);
}
@keyframes sheetUp{from{transform:translateY(100%)}to{transform:none}}
.shd-grab{width:36px;height:4px;border-radius:99px;background:var(--ink-3);opacity:.28;margin:0 auto 18px}
.shd-status{
display:flex;align-items:center;gap:7px;margin:0 0 10px;
font-size:11.5px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--ink-3);
}
.shd-dot{width:6px;height:6px;border-radius:50%;background:var(--ink-3);flex:none}
.shd-status.ok .shd-dot{background:var(--brand)}
.shd-status.bad .shd-dot{background:var(--pricey)}
.shd-status.wait .shd-dot{background:var(--mid);animation:blink 1.1s steps(2,start) infinite}
@keyframes blink{50%{opacity:.25}}
.shd h2{
font-size:24px;line-height:1.22;letter-spacing:-.026em;font-weight:700;
margin:0 0 8px;text-align:left;
}
.shd .lede{font-size:14.5px;line-height:1.5;color:var(--ink-2);margin:0 0 20px;text-align:left}
.shd-steps{list-style:none;margin:0 0 20px;padding:0;display:flex;flex-direction:column;gap:0}
.shd-steps:empty{display:none}
.shd-steps li{display:flex;gap:13px;align-items:flex-start;padding:11px 0;border-top:1px solid var(--line)}
.shd-steps li:first-child{border-top:0;padding-top:0}
.shd-steps .k{
flex:none;width:24px;height:24px;background:var(--surface-2);
display:flex;align-items:center;justify-content:center;
font-size:11.5px;font-weight:700;color:var(--ink-2);
}
.shd-steps .v{font-size:14px;line-height:1.42;color:var(--ink-2);padding-top:2px}
.shd-steps .v b{color:var(--ink);font-weight:600}
.shd-btn{
width:100%;height:50px;background:var(--ink);color:var(--bg);
font-size:15.5px;font-weight:600;display:flex;align-items:center;justify-content:center;gap:8px;
transition:transform .12s ease,opacity .12s ease;
}
.shd-btn:active{transform:scale(.985);opacity:.9}
.shd-btn[disabled]{opacity:.4}
.shd-btn.ghost{background:var(--surface-2);color:var(--ink);margin-top:8px}
.shd-skip{
display:block;width:100%;margin-top:6px;padding:13px 8px 4px;
font-size:14px;font-weight:500;color:var(--ink-3);
}
.shd-note{font-size:12.5px;line-height:1.45;color:var(--ink-3);margin:8px 0 0;text-align:left}
.shd-note:empty{display:none}
@media (prefers-color-scheme:dark){
.shd-btn{background:var(--brand);color:#06231B}
}
@media(min-width:640px){
.modal.sheet-modal{align-items:center;padding:20px;overflow-y:auto}
.sheet-modal .shd{margin:auto;padding-bottom:22px;animation:up .25s cubic-bezier(.32,.72,0,1)}
.shd-grab{display:none}
.shd h2{font-size:22px}
}
@media (prefers-reduced-motion: reduce){
.sheet-modal .shd{animation:none}
.shd-status.wait .shd-dot{animation:none}
.shd-btn:active{transform:none}
}