/* ============================================================
   MotoMeteo — Stylesheet principale
   Apple dark style · v1.0
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --bg:           #0a0f0a;
  --glass:        rgba(255,255,255,0.055);
  --glass2:       rgba(255,255,255,0.09);
  --border:       rgba(255,255,255,0.08);
  --border2:      rgba(255,255,255,0.14);
  --text:         #f2f6f2;
  --muted:        rgba(242,246,242,0.45);
  --muted2:       rgba(242,246,242,0.25);
  --brand:        #34C759;
  --brand-dim:    rgba(52,199,89,0.15);
  --brand-border: rgba(52,199,89,0.28);
  --yellow:       #FFD60A;
  --yellow-dim:   rgba(255,214,10,0.13);
  --red:          #FF453A;
  --red-dim:      rgba(255,69,58,0.13);
  --blue:         #64D2FF;
  --blue-dim:     rgba(100,210,255,0.11);
  --orange:       #FF9F0A;
  --orange-dim:   rgba(255,159,10,0.13);
  --purple:       #BF5AF2;
  --f: -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --r:  18px;
  --r2: 14px;
  --r3: 22px;
}

html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--f); font-size: 14px; line-height: 1.4; overflow: hidden; }

/* Fix iOS PWA — safe area per notch e status bar */
:root {
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

/* ── SHELL ───────────────────────────────────────────────────── */
#app-shell  { display: flex; flex-direction: column; height: 100vh; height: 100dvh; max-width: 430px; margin: 0 auto; position: relative; overflow: hidden; }
#auth-shell { height: 100vh; height: 100dvh; }
#onboarding-shell { height: 100vh; height: 100dvh; }
#auth-shell { display: none; align-items: center; justify-content: center; height: 100vh; padding: 20px; background: var(--bg); }

/* ── STATUS BAR ─────────────────────────────────────────────── */
.statusbar { display: flex; justify-content: space-between; align-items: center; padding: calc(var(--sat) + 10px) 20px 4px; font-size: 12px; color: var(--muted); font-weight: 500; flex-shrink: 0; }

/* ── SCROLLABLE CONTENT ──────────────────────────────────────── */
.app-content { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; scroll-behavior: smooth; }
.app-content::-webkit-scrollbar { display: none; }

/* ── BOTTOM NAV ─────────────────────────────────────────────── */
.nav { display: flex; background: rgba(10,15,10,0.92); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); border-top: 0.5px solid var(--border); padding: 6px 0 max(16px, var(--sab)); flex-shrink: 0; }
.nb  { flex: 1; padding: 8px 2px 6px; border: none; background: none; color: var(--muted); font-family: var(--f); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 0; transition: color 0.2s; }
.nb { opacity: 0.38; }
.nb.active { color: var(--brand); opacity: 1; }
.nb-ico { font-size: 26px; line-height: 1; }
.nb > span:not(.nb-ico):not(.nb-bar) { display: none; }
.nb-bar { display: none; }

/* ── SCREENS ─────────────────────────────────────────────────── */
.screen { display: none; padding-bottom: 20px; animation: fi 0.35s cubic-bezier(0.25,0.46,0.45,0.94); }
.screen.active { display: block; }
@keyframes fi { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── BRAND HEADER ────────────────────────────────────────────── */
.brand-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px 4px; }
.brand-name   { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.brand-name span { color: var(--brand); }
.avatar-sm    { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-dim); border: 0.5px solid var(--brand-border); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--brand); cursor: pointer; }

/* ── LOCATION ROW ────────────────────────────────────────────── */
.loc-row   { display: flex; align-items: flex-start; justify-content: space-between; padding: 4px 20px 12px; }
.loc-left  { cursor: pointer; }
.loc-city  { font-size: 30px; font-weight: 300; letter-spacing: -1px; line-height: 1.1; }
.loc-caret { font-size: 14px; color: var(--brand); margin-left: 4px; opacity: 0.7; }
.loc-sub   { font-size: 11px; color: var(--muted); margin-top: 3px; }
.loc-now   { text-align: right; }
.loc-temp  { font-size: 48px; font-weight: 200; letter-spacing: -2px; line-height: 1; }
.loc-desc  { font-size: 12px; color: var(--muted); }

/* ── CARDS ───────────────────────────────────────────────────── */
.card       { margin: 0 16px 10px; background: var(--glass); border: 0.5px solid var(--border); border-radius: var(--r); padding: 16px 18px; }
.card-label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; font-weight: 500; }

/* ── SCORE HERO ──────────────────────────────────────────────── */
.score-hero { position: relative; overflow: hidden; background: var(--brand-dim); border: 0.5px solid var(--brand-border); border-radius: var(--r3); padding: 22px 18px; margin: 0 16px 12px; }
.score-tag  { font-size: 10px; letter-spacing: 1.8px; text-transform: uppercase; color: rgba(52,199,89,0.65); margin-bottom: 4px; font-weight: 500; }
.score-row  { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 12px; }
.score-num  { font-size: 72px; font-weight: 200; letter-spacing: -4px; line-height: 0.9; color: var(--brand); }
.score-right { padding-bottom: 8px; }
.score-desc { font-size: 16px; font-weight: 500; color: var(--brand); }
.score-hint { font-size: 12px; color: rgba(52,199,89,0.6); margin-top: 3px; }
.pills      { display: flex; gap: 5px; flex-wrap: wrap; }
.pill       { padding: 4px 9px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.p-ok       { background: var(--brand-dim);  color: var(--brand);  border: 0.5px solid var(--brand-border); }
.p-warn     { background: var(--yellow-dim); color: var(--yellow); border: 0.5px solid rgba(255,214,10,0.3); }
.p-bad      { background: var(--red-dim);    color: var(--red);    border: 0.5px solid rgba(255,69,58,0.3); }
.p-info     { background: var(--blue-dim);   color: var(--blue);   border: 0.5px solid rgba(100,210,255,0.3); }

/* ── METRIC GRID ─────────────────────────────────────────────── */
.g2      { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 16px 12px; row-gap: 10px; }
.mc      { background: var(--glass); border: 0.5px solid var(--border); border-radius: var(--r); padding: 15px 14px; transition: border-color .3s, background .3s; }
.mc-lbl  { font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; font-weight: 500; }
.mc-val  { font-size: 26px; font-weight: 200; letter-spacing: -0.5px; line-height: 1; transition: color .3s; }
.mc-unit { font-size: 13px; color: var(--muted); }
.mc-sub  { font-size: 11px; color: var(--muted2); margin-top: 3px; transition: color .3s; }
/* Card principali (temp e pioggia) più grandi */
.mc-primary     { grid-column: span 2; }
.mc-primary .mc-val { font-size: 42px; }
.mc-primary .mc-lbl { font-size: 11px; }

/* ── ASFALTO ─────────────────────────────────────────────────── */
.asphalt-card   { margin: 0 16px 12px; background: var(--glass); border: 0.5px solid var(--border); border-radius: var(--r); padding: 16px 18px; }
.asphalt-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.asphalt-badge  { padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; border: 0.5px solid; }
.asphalt-g2     { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.asphalt-item   { background: rgba(255,255,255,0.04); border-radius: var(--r2); padding: 10px 11px; border: 0.5px solid var(--border); }
.ai-lbl         { font-size: 10px; color: var(--muted2); margin-bottom: 4px; }
.ai-val         { font-size: 14px; font-weight: 500; }
.grip-meter     { margin-top: 11px; }
.grip-label     { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.grip-track     { height: 5px; border-radius: 3px; background: linear-gradient(90deg, var(--red) 0%, var(--yellow) 40%, var(--brand) 70%); position: relative; }
.grip-cursor    { position: absolute; top: -5px; width: 15px; height: 15px; border-radius: 50%; background: white; border: 2px solid var(--brand); transform: translateX(-50%); transition: left 0.5s ease; }
.grip-zones     { display: flex; justify-content: space-between; font-size: 9px; color: var(--muted2); margin-top: 4px; }

/* ── RAFFICA ─────────────────────────────────────────────────── */
.gust-card    { margin: 0 16px 12px; background: var(--glass); border: 0.5px solid var(--border); border-radius: var(--r); padding: 16px 18px; transition: background .3s, border-color .3s; }
.gust-top     { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.gust-badge   { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.gust-main    { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.gust-compass { display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.gust-arrow   { font-size: 22px; color: var(--yellow); display: inline-block; transition: transform 0.5s ease; }
.gust-info    { flex: 1; }
.gust-val     { font-size: 24px; font-weight: 200; color: var(--yellow); letter-spacing: -0.5px; }
.gust-sub     { font-size: 11px; color: var(--muted); margin-top: 2px; }
.gust-risk-note { font-size: 11px; color: rgba(255,214,10,0.7); padding: 6px 9px; background: rgba(255,214,10,0.07); border-radius: 8px; line-height: 1.4; }

/* ── NEBBIA ──────────────────────────────────────────────────── */
.fog-card  { margin: 0 16px 10px; background: var(--blue-dim); border: 0.5px solid rgba(100,210,255,0.18); border-radius: var(--r); padding: 13px 16px; }
.fog-top   { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.fog-badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.fog-row   { display: flex; align-items: center; gap: 12px; }
.fog-ico   { font-size: 30px; opacity: 0.8; }

/* ── ABBIGLIAMENTO ───────────────────────────────────────────── */
.outfit-card  { margin: 0 16px 12px; background: rgba(191,90,242,0.07); border: 0.5px solid rgba(191,90,242,0.18); border-radius: var(--r); padding: 16px 18px; }
.outfit-items { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 8px; }
.outfit-item  { background: rgba(255,255,255,0.04); border-radius: var(--r2); padding: 9px 10px; border: 0.5px solid rgba(191,90,242,0.12); display: flex; align-items: center; gap: 7px; }
.oi-ico       { font-size: 18px; flex-shrink: 0; }
.oi-name      { font-size: 12px; font-weight: 500; }
.oi-detail    { font-size: 10px; color: var(--muted2); margin-top: 1px; }
.oi-req       { font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 8px; flex-shrink: 0; }
.oi-must      { background: var(--red-dim);    color: var(--red); }
.oi-warn      { background: var(--yellow-dim); color: var(--yellow); }
.oi-yes       { background: var(--brand-dim);  color: var(--brand); }
.oi-opt       { background: rgba(255,255,255,0.06); color: var(--muted); }

/* ── TIMELINE ────────────────────────────────────────────────── */
.h-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; cursor: grab; user-select: none; -webkit-overflow-scrolling: touch; }
.h-scroll::-webkit-scrollbar { display: none; }
.h-scroll.dragging { cursor: grabbing; }
.h-item   { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 42px; padding: 8px 5px; border-radius: 12px; border: 0.5px solid transparent; }
.h-item.now { background: var(--brand-dim); border-color: var(--brand-border); }
.h-time   { font-size: 11px; color: var(--muted); }
.h-time.now { color: var(--brand); font-weight: 500; }
.h-ico    { font-size: 20px; line-height: 1; }
.h-temp   { font-size: 13px; font-weight: 400; }
.h-rain   { font-size: 10px; color: var(--blue); }

/* ── 7 GIORNI ────────────────────────────────────────────────── */
.week-scroll { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; cursor: grab; user-select: none; }
.week-scroll::-webkit-scrollbar { display: none; }
.week-scroll.dragging { cursor: grabbing; }
.day-item    { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 50px; padding: 9px 5px; border-radius: 14px; border: 0.5px solid var(--border); background: var(--glass); }
.day-item.today { border-color: var(--brand-border); background: var(--brand-dim); }
.day-name    { font-size: 10px; color: var(--muted); text-transform: uppercase; }
.day-name.today { color: var(--brand); }
.day-ico     { font-size: 20px; }
.day-hi      { font-size: 13px; }
.day-lo      { font-size: 11px; color: var(--muted); }
.day-score   { font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 8px; }
.sg { background: var(--brand-dim);  color: var(--brand); }
.sy { background: var(--yellow-dim); color: var(--yellow); }
.sr { background: var(--red-dim);    color: var(--red); }

/* ── TRATTE ──────────────────────────────────────────────────── */
.page-header  { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px 8px; }
.page-title   { font-size: 26px; font-weight: 300; letter-spacing: -0.8px; }
.filter-tabs  { display: flex; gap: 0; margin: 0 16px 12px; background: rgba(255,255,255,0.06); border-radius: 12px; padding: 3px; }
.ftab         { flex: 1; padding: 7px 4px; border: none; background: none; color: var(--muted); font-size: 12px; font-family: var(--f); cursor: pointer; border-radius: 9px; transition: all 0.18s; font-weight: 500; }
.ftab.active  { background: var(--brand-dim); color: var(--brand); }
.active-banner { margin: 0 16px 10px; background: var(--brand-dim); border: 0.5px solid var(--brand-border); border-radius: 12px; padding: 9px 13px; display: flex; align-items: center; gap: 9px; }
.banner-dot   { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); flex-shrink: 0; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity:1; transform:scale(1); } 50% { opacity:0.4; transform:scale(0.7); } }
.rc           { margin: 0 16px 12px; background: var(--glass); border: 0.5px solid var(--border); border-radius: var(--r3); padding: 17px 19px; cursor: pointer; transition: background 0.15s; }
.rc:active    { background: var(--glass2); }
.rc.highlighted { border-color: var(--brand-border); background: var(--brand-dim); }
.rc-top       { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 9px; }
.rc-name      { font-size: 16px; font-weight: 500; letter-spacing: -0.3px; }
.rc-meta      { font-size: 11px; color: var(--muted); margin-top: 3px; }
.badge        { padding: 4px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.b-go         { background: var(--brand-dim);  color: var(--brand);  border: 0.5px solid var(--brand-border); }
.b-back       { background: var(--blue-dim);   color: var(--blue);   border: 0.5px solid rgba(100,210,255,0.28); }
.b-trip       { background: var(--orange-dim); color: var(--orange); border: 0.5px solid rgba(255,159,10,0.28); }
.b-done       { background: rgba(255,255,255,0.06); color: var(--muted); border: 0.5px solid var(--border); }
.path-row     { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.path-dot     { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); flex-shrink: 0; }
.path-line    { flex: 1; height: 0.5px; background: rgba(52,199,89,0.3); }
.path-dest    { font-size: 12px; color: var(--text); }
.ss-note      { font-size: 11px; color: var(--blue); background: rgba(100,210,255,0.07); padding: 6px 9px; border-radius: 9px; border-left: 2px solid rgba(100,210,255,0.4); margin-bottom: 8px; line-height: 1.5; }
.mini-row     { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mini         { display: flex; align-items: center; gap: 4px; background: rgba(255,255,255,0.05); border-radius: 9px; padding: 4px 8px; font-size: 11px; color: var(--muted); }
.mdot         { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.fab          { display: block; margin: 4px 16px 16px; padding: 14px; background: var(--brand); color: #041a03; border: none; border-radius: 14px; font-size: 14px; font-weight: 700; font-family: var(--f); cursor: pointer; transition: opacity 0.15s; text-align: center; width: calc(100% - 32px); }
.fab:hover    { opacity: 0.88; }
.add-icon-btn { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); border: none; color: #041a03; font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-weight: 300; flex-shrink: 0; line-height: 1; }

/* ── LUCE ────────────────────────────────────────────────────── */
.sun-hero   { margin: 0 16px 10px; background: linear-gradient(160deg, rgba(255,159,10,0.12), rgba(10,15,10,0)); border: 0.5px solid rgba(255,159,10,0.2); border-radius: var(--r3); padding: 18px 18px 14px; }
.sun-arc    { width: 100%; height: 100px; }
.sun-times  { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 10px; }
.sun-item   { text-align: center; }
.sun-big    { font-size: 20px; font-weight: 300; letter-spacing: -0.5px; }
.sun-lbl    { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }
.sun-center { text-align: center; }
.sun-duration { font-size: 14px; font-weight: 400; color: var(--yellow); }
.sw-item    { flex-shrink: 0; min-width: 50px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 5px; border-radius: 13px; border: 0.5px solid var(--border); background: var(--glass); }
.sw-item.today { border-color: var(--brand-border); background: var(--brand-dim); }
.sw-day     { font-size: 10px; color: var(--muted); text-transform: uppercase; }
.sw-day.today { color: var(--brand); }
.sw-rise    { font-size: 11px; font-weight: 500; color: var(--orange); }
.sw-set     { font-size: 11px; color: var(--muted); }
.sw-dur     { font-size: 10px; color: var(--muted2); }
.route-light-card { margin: 0 16px 10px; background: var(--glass); border: 0.5px solid var(--border); border-radius: var(--r); overflow: hidden; }
.rl-item    { display: flex; align-items: center; gap: 11px; padding: 12px 15px; border-bottom: 0.5px solid var(--border); }
.rl-item:last-child { border-bottom: none; }
.rl-ico     { font-size: 22px; flex-shrink: 0; width: 30px; text-align: center; }
.rl-name    { font-size: 13px; font-weight: 500; }
.rl-detail  { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── PROFILO ─────────────────────────────────────────────────── */
.profile-hero  { margin: 0 16px 14px; background: var(--glass); border: 0.5px solid var(--border); border-radius: var(--r3); padding: 20px; }
.avatar-lg     { width: 68px; height: 68px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), #2da84a); display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; color: #041a03; margin: 0 auto 12px; }
.profile-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); border-radius: 12px; overflow: hidden; margin-top: 14px; }
.ps-item       { background: rgba(255,255,255,0.03); padding: 11px 8px; text-align: center; }
.ps-val        { font-size: 20px; font-weight: 200; }
.ps-lbl        { font-size: 10px; color: var(--muted2); margin-top: 2px; }
.sg-section    { font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; padding: 0 20px; margin: 14px 0 6px; }
.sg            { margin: 0 16px 4px; background: var(--glass); border: 0.5px solid var(--border); border-radius: var(--r); overflow: hidden; }
.sg-row        { display: flex; align-items: center; justify-content: space-between; padding: 15px 17px; border-bottom: 0.5px solid var(--border); }
.sg-row:last-child { border-bottom: none; }
.sg-left       { display: flex; align-items: center; gap: 10px; }
.sg-icon       { width: 28px; height: 28px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.sg-label      { font-size: 14px; }
.sg-val        { font-size: 13px; color: var(--muted); }
.sg-chev       { font-size: 16px; color: var(--muted2); margin-left: 4px; }
.tog            { width: 44px; height: 26px; border-radius: 13px; background: rgba(255,255,255,0.14); position: relative; cursor: pointer; flex-shrink: 0; transition: background 0.25s ease; display: flex; align-items: center; padding: 0 3px; }
.tog:not(.off)  { background: var(--brand); }
.tog-knob       { width: 20px; height: 20px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(0,0,0,0.3); transition: transform 0.25s ease; transform: translateX(0px); flex-shrink: 0; }
.tog:not(.off) .tog-knob { transform: translateX(18px); }

/* ── DRAWER ──────────────────────────────────────────────────── */
.drawer-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 200; align-items: flex-end; justify-content: center; backdrop-filter: blur(4px); }
.drawer-overlay.open { display: flex; animation: fadeIn 0.2s ease; }
.drawer         { width: 100%; max-width: 430px; background: #111811; border-radius: 22px 22px 0 0; padding: 16px 20px max(24px, env(safe-area-inset-bottom)); max-height: 80vh; overflow-y: auto; }
.drawer-handle  { width: 36px; height: 4px; background: rgba(255,255,255,0.18); border-radius: 2px; margin: 0 auto 16px; }
.drawer-title   { font-size: 16px; font-weight: 500; margin-bottom: 14px; letter-spacing: -0.3px; }
.dsearch        { width: 100%; background: rgba(255,255,255,0.07); border: 0.5px solid var(--border); border-radius: 12px; padding: 10px 14px; color: var(--text); font-size: 14px; font-family: var(--f); outline: none; margin-bottom: 12px; }
.dloc           { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 0.5px solid var(--border); cursor: pointer; }
.dloc:last-child { border-bottom: none; }
.dloc-name      { font-size: 15px; }
.dloc-sub       { font-size: 11px; color: var(--muted); margin-top: 2px; }
.drawer-close   { width: 100%; margin-top: 14px; padding: 13px; background: rgba(255,255,255,0.07); border: 0.5px solid var(--border); border-radius: 12px; color: var(--muted); font-size: 14px; cursor: pointer; font-family: var(--f); }

/* ── FORM TRATTA ─────────────────────────────────────────────── */
.type-grid     { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.type-btn      { padding: 10px 8px; border: 0.5px solid var(--border); border-radius: var(--r2); background: var(--glass); color: var(--muted); font-size: 12px; cursor: pointer; text-align: center; transition: all 0.15s; font-family: var(--f); line-height: 1.4; }
.type-btn.active { border-color: var(--brand); color: var(--brand); background: var(--brand-dim); border-width: 1.5px; }
.form-label    { font-size: 11px; color: var(--muted); margin-bottom: 5px; margin-top: 12px; display: block; letter-spacing: 0.3px; }
.form-input    { width: 100%; background: rgba(255,255,255,0.07); border: 0.5px solid var(--border); border-radius: 11px; padding: 11px 13px; color: var(--text); font-size: 14px; font-family: var(--f); outline: none; transition: border-color 0.2s; }
.form-input:focus { border-color: var(--brand-border); }
.form-row      { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.days-row      { display: flex; gap: 6px; margin: 8px 0; }
.day-btn       { width: 36px; height: 36px; border-radius: 50%; border: 0.5px solid var(--border); background: var(--glass); color: var(--muted); font-size: 11px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s; font-family: var(--f); }
.day-btn.active { background: var(--brand-dim); border-color: var(--brand); color: var(--brand); font-weight: 500; }
.smart-hint    { font-size: 11px; color: var(--blue); background: var(--blue-dim); padding: 8px 11px; border-radius: 9px; border-left: 2px solid rgba(100,210,255,0.4); margin: 10px 0; line-height: 1.5; display: none; }
.smart-hint.show { display: block; }

/* ── AUTH ────────────────────────────────────────────────────── */
.auth-card    { background: rgba(255,255,255,0.05); border: 0.5px solid var(--border); border-radius: 22px; padding: 32px 28px; width: 100%; max-width: 380px; }
.auth-logo    { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.auth-logo span { color: var(--brand); }
.auth-sub     { font-size: 11px; color: var(--muted); text-align: center; letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 28px; }
.auth-tabs    { display: flex; background: rgba(255,255,255,0.06); border-radius: 10px; padding: 3px; margin-bottom: 22px; }
.auth-tab     { flex: 1; padding: 8px; border: none; background: none; color: var(--muted); font-size: 13px; font-family: var(--f); cursor: pointer; border-radius: 8px; transition: all 0.18s; }
.auth-tab.active { background: var(--brand-dim); color: var(--brand); }
.auth-error   { background: var(--red-dim); border: 0.5px solid rgba(255,69,58,0.3); color: var(--red); border-radius: 10px; padding: 9px 13px; font-size: 13px; margin-bottom: 12px; display: none; }
.auth-btn     { width: 100%; padding: 14px; background: var(--brand); color: #041a03; border: none; border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: var(--f); margin-top: 16px; transition: opacity 0.15s; }
.auth-btn:hover { opacity: 0.88; }
.auth-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── TOAST ───────────────────────────────────────────────────── */
.toast        { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); background: #1a241a; border: 0.5px solid var(--brand-border); border-radius: 20px; padding: 10px 18px; font-size: 13px; color: var(--brand); z-index: 500; white-space: nowrap; display: none; }
.toast.error  { border-color: rgba(255,69,58,0.4); color: var(--red); }
.toast.show   { display: block; animation: fadeIn 0.25s ease; }

/* ── OFFLINE BANNER ──────────────────────────────────────────── */
.offline-bar  { background: var(--yellow-dim); border-bottom: 0.5px solid rgba(255,214,10,0.3); padding: 7px 16px; font-size: 12px; color: var(--yellow); text-align: center; display: none; }
body.offline .offline-bar { display: block; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── OPTION LIST (drawer selezione) ─────────────────────────── */
.opt-list  { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.opt-item  { display: flex; align-items: center; gap: 12px; padding: 13px 14px;
             background: var(--glass); border: 0.5px solid var(--border);
             border-radius: var(--r2); cursor: pointer; transition: background 0.15s; }
.opt-item:hover { background: var(--glass2); }
.opt-item.selected { border-color: var(--brand-border); background: var(--brand-dim); }
.opt-ico   { font-size: 22px; flex-shrink: 0; width: 28px; text-align: center; }
.opt-info  { flex: 1; }
.opt-name  { font-size: 14px; font-weight: 500; }
.opt-sub   { font-size: 11px; color: var(--muted); margin-top: 2px; }
.opt-check { font-size: 14px; color: var(--brand); font-weight: 700; min-width: 16px; text-align: right; }

/* ── SLIDER PREFERENZE ──────────────────────────────────────── */
.slider-wrap       { padding: 8px 0 4px; }
.slider-val-display { font-size: 32px; font-weight: 200; color: var(--brand);
                      letter-spacing: -1px; text-align: center; margin-bottom: 14px; }
.pref-slider       { width: 100%; -webkit-appearance: none; appearance: none;
                      height: 4px; border-radius: 2px; outline: none; cursor: pointer;
                      background: linear-gradient(90deg, var(--brand) 0%, var(--brand) 50%, rgba(255,255,255,0.12) 50%); }
.pref-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px;
                      border-radius: 50%; background: white; border: 2px solid var(--brand);
                      box-shadow: 0 1px 4px rgba(0,0,0,0.3); }
.slider-labels     { display: flex; justify-content: space-between;
                      font-size: 11px; color: var(--muted2); margin-top: 8px; }
.opt-hints         { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.opt-hint          { font-size: 12px; color: var(--muted); padding: 7px 12px;
                      background: rgba(255,255,255,0.04); border-radius: 10px; }

/* ── METEO TOPBAR ────────────────────────────────────────────── */
.meteo-topbar { display:flex; align-items:flex-start; justify-content:space-between; padding:6px 16px 12px; }
.topbar-btn   { background:rgba(255,255,255,0.06); border:0.5px solid var(--border); color:var(--muted); padding:5px 10px; border-radius:20px; font-size:12px; cursor:pointer; font-family:var(--f); white-space:nowrap; }

/* ── SCORE ORARIO ────────────────────────────────────────────── */
.h-score { font-size:10px; font-weight:600; margin-top:2px; text-align:center; }

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ── ONBOARDING ──────────────────────────────────────────────── */
.ob-slide       { position:absolute;inset:0;display:flex;flex-direction:column;
                  align-items:center;justify-content:flex-start;
                  padding:28px 24px 12px;overflow-y:auto;
                  opacity:0;transform:translateX(60px);transition:all 0.4s ease;pointer-events:none; }
.ob-slide.active { opacity:1;transform:translateX(0);pointer-events:auto; }
.ob-slide.out   { opacity:0;transform:translateX(-60px); }
.ob-content     { display:flex;flex-direction:column;align-items:center;text-align:center;
                  max-width:340px;width:100%;padding-bottom:12px; }
.ob-logo        { font-size:28px;font-weight:700;letter-spacing:-0.5px;margin-bottom:4px; }
.ob-logo span   { color:var(--brand); }
.ob-slide-title { font-size:22px;font-weight:500;letter-spacing:-0.5px;margin-bottom:6px; }
.ob-tagline     { font-size:15px;font-weight:400;color:var(--muted);margin-bottom:10px;line-height:1.4; }
.ob-desc        { font-size:13px;color:var(--muted);line-height:1.55;margin-bottom:14px; }
.ob-free-badge  { background:var(--brand-dim);border:0.5px solid var(--brand-border);
                  color:var(--brand);padding:7px 18px;border-radius:20px;font-size:13px;font-weight:600; }
.ob-features    { display:flex;flex-direction:column;gap:7px;width:100%;margin-bottom:16px; }
.ob-feat        { background:var(--glass);border:0.5px solid var(--border);border-radius:12px;
                  padding:9px 14px;font-size:13px;text-align:left;color:var(--text); }
.ob-cta         { width:100%;padding:14px;background:var(--brand);color:#041a03;border:none;
                  border-radius:14px;font-size:15px;font-weight:700;font-family:var(--f);
                  cursor:pointer;margin-bottom:10px;transition:opacity 0.2s; }
.ob-cta:hover   { opacity:0.88; }
.ob-skip        { background:none;border:none;color:var(--muted);font-size:13px;
                  font-family:var(--f);cursor:pointer;padding:6px; }
.ob-nav         { padding:12px 24px max(20px,env(safe-area-inset-bottom));
                  display:flex;align-items:center;justify-content:space-between;flex-shrink:0; }
.ob-dots        { display:flex;gap:8px; }
.ob-dot         { width:7px;height:7px;border-radius:50%;background:rgba(255,255,255,0.2);
                  cursor:pointer;transition:all 0.2s; }
.ob-dot.active  { background:var(--brand);width:18px;border-radius:4px; }
.ob-next        { background:var(--glass2);border:0.5px solid var(--border);color:var(--text);
                  padding:9px 20px;border-radius:20px;font-size:13px;font-weight:500;
                  font-family:var(--f);cursor:pointer;transition:all 0.2s; }
.ob-next:hover  { border-color:var(--brand-border);color:var(--brand); }

/* Nascondi scrollbar orizzontali ma mantieni scroll touch */
#rd-window-bar { scrollbar-width:none; overflow-x:auto; -webkit-overflow-scrolling:touch; }
#rd-window-bar::-webkit-scrollbar { display:none; }
#rd-hourly-strip { scrollbar-width:none; overflow-x:auto; -webkit-overflow-scrolling:touch; }
#rd-hourly-strip::-webkit-scrollbar { display:none; }

/* ── MAPPA LEAFLET ───────────────────────────────────────────── */
.map-tooltip {
  background: #111811 !important;
  border: 0.5px solid rgba(52,199,89,0.3) !important;
  color: #f2f6f2 !important;
  font-family: -apple-system,'Helvetica Neue',Arial,sans-serif !important;
  font-size: 12px !important;
  border-radius: 8px !important;
  padding: 6px 10px !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5) !important;
}
.map-tooltip::before { display:none !important; }
.leaflet-container { background: #080c08; }
/* Mappa area — non deve intercettare eventi sopra le modali */
#area-map-card .leaflet-container { z-index: 1; }
#area-map { pointer-events: none; }
#area-map.leaflet-grab { pointer-events: auto; }
.leaflet-control-zoom a {
  background: #111811 !important;
  color: #f2f6f2 !important;
  border-color: rgba(255,255,255,0.1) !important;
}

/* ── SPEED SELECTOR ─────────────────────────────────────────── */
.speed-opt { background:var(--glass);border:0.5px solid var(--border);border-radius:14px;
  padding:13px 16px;cursor:pointer;transition:all 0.2s; }
.speed-opt.active { background:var(--brand-dim);border-color:var(--brand-border); }
.speed-opt.active div:first-child { color:var(--brand); }

/* ── SPEED CHIP (inline selector) ───────────────────────────── */
.speed-chip {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: var(--glass);
  border: 1px solid var(--border);
  color: var(--muted);
  transition: all 0.2s;
}
.speed-chip.active {
  background: var(--brand-dim);
  border-color: var(--brand-border);
  color: var(--brand);
}
.speed-chip::after { content: ' km/h'; font-size: 10px; font-weight: 400; }

/* ── TRIP RETURN TOGGLE KNOB ─────────────────────────── */
#trip-return-knob::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: var(--knob-x, 2px);
  transition: left .2s;
}

/* ── NETWORK STATUS BANNER ───────────────────────────── */
.net-banner         { border-radius: 12px; padding: 10px 14px; font-size: 13px; align-items: center; gap: 8px; }
.net-banner.loading { background: rgba(255,255,255,0.05); border: 0.5px solid rgba(255,255,255,0.1); color: rgba(242,246,242,0.6); }
.net-banner.error   { background: rgba(255,69,58,0.08); border: 0.5px solid rgba(255,69,58,0.3); color: #FF453A; }
.net-banner.warn    { background: rgba(255,214,10,0.07); border: 0.5px solid rgba(255,214,10,0.25); color: #FFD60A; }

/* ── TOAST SUCCESS ───────────────────────────────────────── */
.toast.success { background: rgba(52,199,89,0.15); border-color: rgba(52,199,89,0.4); color: #34C759; }

/* ── OFFLINE BANNER ──────────────────────────────────────── */
#offline-banner {
  display: none;
  position: fixed;
  top: env(safe-area-inset-top, 0);
  left: 0; right: 0;
  background: rgba(255,214,10,0.12);
  border-bottom: 0.5px solid rgba(255,214,10,0.3);
  color: #FFD60A;
  font-size: 12px;
  padding: 8px 16px;
  z-index: 998;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
/* ── MICROANIMAZIONI ─────────────────────────────────────────── */
/* Bottoni active state */
button:active, .rc:active, .nb:active { opacity: 0.7; transform: scale(0.97); transition: opacity 0.1s, transform 0.1s; }

/* Verdict expand con opacity */
#verdict-detail, #rd-verdict-detail-wrap {
  transition: max-height 0.4s cubic-bezier(0.25,0.46,0.45,0.94), opacity 0.3s ease;
  opacity: 0;
}
#verdict-detail[style*="500px"], #rd-verdict-detail-wrap[style*="500px"] { opacity: 1; }

/* Counter animato score */
@keyframes scoreIn { from { opacity:0; transform: scale(0.85); } to { opacity:1; transform: scale(1); } }
.score-num, #rd-score { animation: scoreIn 0.5s cubic-bezier(0.34,1.56,0.64,1); }

/* Pill entrada */
@keyframes pillIn { from { opacity:0; transform: translateY(4px) scale(0.95); } to { opacity:1; transform: translateY(0) scale(1); } }
.pill { animation: pillIn 0.3s cubic-bezier(0.25,0.46,0.45,0.94) both; }
.pills .pill:nth-child(1) { animation-delay: 0.05s; }
.pills .pill:nth-child(2) { animation-delay: 0.10s; }
.pills .pill:nth-child(3) { animation-delay: 0.15s; }
.pills .pill:nth-child(4) { animation-delay: 0.20s; }
.pills .pill:nth-child(5) { animation-delay: 0.25s; }
.pills .pill:nth-child(6) { animation-delay: 0.30s; }

/* Card metric entrada */
@keyframes cardIn { from { opacity:0; transform: translateY(6px); } to { opacity:1; transform: translateY(0); } }
.mc { animation: cardIn 0.4s cubic-bezier(0.25,0.46,0.45,0.94) both; }
.g2 .mc:nth-child(1) { animation-delay: 0.05s; }
.g2 .mc:nth-child(2) { animation-delay: 0.10s; }
.g2 .mc:nth-child(3) { animation-delay: 0.15s; }
.g2 .mc:nth-child(4) { animation-delay: 0.20s; }

/* ── ANIMAZIONE CRITICA BUSSOLA ──────────────────────────── */
@keyframes criticalPulse {
  0%, 100% { box-shadow: 0 0 14px rgba(255,69,58,0.5), 0 0 4px rgba(255,69,58,0.3); }
  50%       { box-shadow: 0 0 22px rgba(255,69,58,0.7), 0 0 8px rgba(255,69,58,0.5); }
}

/* ── WIDGET ARCO SOLARE ──────────────────────────────────────── */
/* Animazione alone sole pulsante quando è il giorno corrente */
@keyframes sunPulse {
  0%, 100% { opacity: 0.95; r: 8; }
  50%       { opacity: 1;    r: 9; }
}
#solar-sun circle:first-child {
  animation: sunPulse 3s ease-in-out infinite;
}

/* Transizione fluida del sole lungo l'arco */
#solar-sun {
  transition: transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Linea verticale ritorno — dissolvenza */
#solar-return-line {
  transition: opacity 0.4s ease;
}

/* Countdown — layout responsive */
#solar-countdown {
  transition: background 0.3s ease, border-color 0.3s ease;
}

/* Testo alba/tramonto — posizionamento assoluto rispetto al parent relativo */
#rd-solar-card .solar-label-left,
#rd-solar-card .solar-label-right {
  position: absolute;
  bottom: 0;
  font-size: 11px;
  line-height: 1.3;
}

/* ══ CRUSCOTTO LIVE RADAR ══════════════════════════════════════ */

/* Bottoni selettore profondità — grandi, facili con i guanti */
.cr-depth-btn {
  flex: 1;
  padding: 14px 8px;
  border-radius: 12px;
  border: 1.5px solid rgba(52,199,89,0.25);
  background: rgba(52,199,89,0.05);
  color: rgba(52,199,89,0.6);
  font-size: 18px;
  font-weight: 700;
  font-family: -apple-system, Arial, sans-serif;
  letter-spacing: -0.5px;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.cr-depth-btn.active {
  background: rgba(52,199,89,0.2);
  border-color: #34C759;
  color: #34C759;
  box-shadow: 0 0 16px rgba(52,199,89,0.3);
}
.cr-depth-btn:active {
  transform: scale(0.96);
}

/* Badge allerta nel pannello */
.cr-alert-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  font-family: -apple-system, Arial, sans-serif;
  letter-spacing: -0.3px;
  min-width: 120px;
}
.cr-alert-badge.cr-danger {
  background: rgba(255,69,58,0.25);
  border: 1.5px solid rgba(255,69,58,0.6);
  color: #FF453A;
  animation: crDangerPulse 1.2s ease-in-out infinite;
}
.cr-alert-badge.cr-warn {
  background: rgba(255,159,10,0.2);
  border: 1.5px solid rgba(255,159,10,0.5);
  color: #FF9F0A;
}
.cr-alert-badge.cr-info {
  background: rgba(255,214,10,0.15);
  border: 1.5px solid rgba(255,214,10,0.4);
  color: #FFD60A;
}

/* Sweep radar */
@keyframes crSweep {
  from { transform: rotate(-90deg); }
  to   { transform: rotate(90deg); }
}

/* Cerchio pulsante moto */
@keyframes crPulse {
  0%, 100% { opacity: 0.4; r: 14; }
  50%       { opacity: 0.1; r: 18; }
}

/* Lampeggio badge pericolo */
@keyframes crDangerPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

/* Ottimizzazione touch per guanti — area tap aumentata */
#cruscotto-view button {
  min-height: 48px;
  touch-action: manipulation;
}

/* ── CRUSCOTTO LAYOUT LANDSCAPE ────────────────────────────── */
@media (orientation: landscape) {
  #cruscotto-view {
    flex-direction: row !important;
    flex-wrap: wrap;
  }

  /* Topbar a tutta larghezza */
  #cruscotto-view > div:first-child {
    width: 100%;
    flex-shrink: 0;
    padding: 6px 16px;
  }

  /* Selettore profondità: colonna a sinistra */
  #cruscotto-view > div:nth-child(2) {
    flex-direction: column;
    width: 90px;
    padding: 8px;
    gap: 6px;
    align-self: stretch;
  }
  #cruscotto-view > div:nth-child(2) .cr-depth-btn {
    padding: 10px 4px;
    font-size: 14px;
    writing-mode: horizontal-tb;
  }

  /* Radar: centro */
  #cruscotto-view > div:nth-child(3) {
    flex: 1;
    align-items: center;
    padding: 0 8px;
  }

  /* Pannello allerte: colonna a destra */
  #cr-alerts-panel {
    width: 160px !important;
    border-top: none !important;
    border-left: 0.5px solid rgba(52,199,89,0.1);
    padding: 12px 10px !important;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  #cr-alerts-inner {
    flex-direction: column !important;
  }
}