/* Netith Solar - stile ispirato alla dashboard originale (Tailwind), in CSS puro */
:root {
  --bg: #e2e8f0;
  --bg-pattern-opacity: .5;
  --text: #0f172a;          /* slate-900 */
  --text-strong: #020617;   /* slate-950 */
  --text-soft: #1e293b;     /* slate-800 */
  --line: #0f172a;
  --accent: #1e40af;        /* blue-800 */
  --cold: #1d4ed8;          /* blue-700 */
  --hot: #b91c1c;           /* red-700 */
  --glass-header: rgb(255 255 255 / .5);
  --glass-body: rgb(255 255 255 / .2);
  --glass-edge: #fff;
  --card: rgb(255 255 255 / .4);
  --hr: rgb(0 0 0 / .2);
}
body.dark {
  --bg: #020617;
  --bg-pattern-opacity: .4;
  --text: #f1f5f9;
  --text-strong: #f8fafc;
  --text-soft: #e2e8f0;
  --line: #f1f5f9;
  --accent: #3b82f6;
  --cold: #60a5fa;
  --hot: #f87171;
  --glass-header: rgb(255 255 255 / .1);
  --glass-body: rgb(255 255 255 / .05);
  --glass-edge: rgb(255 255 255 / .2);
  --card: rgb(255 255 255 / .05);
  --hr: rgb(255 255 255 / .2);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; font-size: clamp(9px, min(.8333vw, 1.4815vh), 28px); } /* 16px a 1920x1080, poi proporzionale */
body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
  transition: background-color .6s;
}
.light-only { display: block; }
.dark-only { display: none; }
body.dark .light-only { display: none; }
body.dark .dark-only { display: block; }

/* Sfondo con motivo "circuit board" sfumato */
.bg {
  position: fixed; inset: 0;
  background: linear-gradient(to top right, #06b6d4, #a855f7, #ef4444);
  -webkit-mask-image: url("img/circuit-board.svg"); mask-image: url("img/circuit-board.svg");
  -webkit-mask-size: 152px; mask-size: 152px;
  opacity: var(--bg-pattern-opacity);
  pointer-events: none;
}
.page { position: relative; height: 100dvh; width: 100dvw; padding: 2rem; }

.shell {
  position: relative; display: flex; flex-direction: column;
  width: 100%; height: 100%; border-radius: 1.5rem;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / .5), 0 4px 6px -4px rgb(0 0 0 / .5);
  contain: layout;
}
.shell::after {
  content: ""; position: absolute; inset: 0; border-radius: 1.5rem; pointer-events: none;
  box-shadow: inset 0 0 0 1px var(--glass-edge);
}
.header {
  height: 6rem; flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 2rem; border-radius: 1.5rem 1.5rem 0 0;
  background: var(--glass-header); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.logo img { height: 4rem; width: auto; }
.clock { display: flex; align-items: baseline; gap: 1.5rem; font-family: "Poppins", sans-serif; }
.clock-date { font-size: 1.5rem; line-height: 2rem; color: var(--text-soft); text-transform: none; }
.clock-time { font-size: 3rem; line-height: 1; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.badge {
  align-self: center; font-family: ui-sans-serif, system-ui, sans-serif; font-size: .8rem; font-weight: 700;
  letter-spacing: .06em; padding: .3rem .7rem; border-radius: 999px;
  background: #f59e0b; color: #1c1917;
}
.badge.err { background: #dc2626; color: #fff; }

.body {
  position: relative; flex: 1; min-height: 0; contain: paint; border-radius: 0 0 1.5rem 1.5rem;
  display: grid; gap: 1rem; padding: 1rem;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: repeat(6, minmax(0, 1fr));
}
.body::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: var(--glass-body); backdrop-filter: blur(1px); -webkit-backdrop-filter: blur(1px);
  border-top: 1px solid var(--glass-edge);
}
.stats { display: contents; }

.card {
  position: relative; display: grid; contain: strict; border-radius: 1rem;
  background: var(--card); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / .2), 0 2px 4px -2px rgb(0 0 0 / .2);
}
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: 1rem; pointer-events: none;
  box-shadow: inset 0 0 0 1px var(--glass-edge);
}

.stat { grid-column: span 1; grid-row: span 1; }
.stat { align-content: center; justify-items: center; }
.stat-title { font-size: 1.25rem; line-height: 1.75rem; color: var(--text-soft); text-align: center; }
.stat-row { display: flex; gap: .5rem; align-items: center; justify-content: center; margin-bottom: 5%; }
.stat-value { font-size: 2.25rem; line-height: 2.5rem; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.stat-unit { font-size: 1.5rem; line-height: 2rem; color: var(--text-strong); }

.charts { grid-column: span 4; grid-row: span 5; }
.slide {
  position: absolute; width: 100%; height: 100%;
  transition: transform .5s ease-in-out;
}
.chart-box { width: 100%; height: 100%; padding: 1rem; display: flex; flex-direction: column; }
.chart-box h2 { text-align: center; font-weight: 400; font-size: 1.875rem; line-height: 2.25rem; color: var(--text-strong); }
.chart { flex-grow: 1; min-height: 0; contain: strict; }
.chart svg { display: block; width: 100%; height: 100%; }
.chart .grid { stroke: var(--line); stroke-opacity: .35; stroke-dasharray: 3 3; fill: none; }
.chart text { fill: var(--text); font-size: .875rem; font-family: ui-sans-serif, system-ui, sans-serif; }
.chart .line { stroke: var(--accent); stroke-width: .25rem; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.chart .bar { fill: var(--accent); }

.weather { grid-column: span 2; grid-row: span 3; display: flex; flex-direction: column; font-size: 1.125rem; line-height: 1.75rem; color: var(--text); }
.weather > div { flex: 1; display: flex; align-items: center; justify-content: center; }
.weather hr { border: 0; border-top: 1px solid var(--hr); margin: 0 1.5rem; }
.w-cur-icon { width: 6rem; height: 6rem; }
.w-cur-txt { display: flex; flex-direction: column; justify-content: center; text-align: center; }
.w-cur-temp { font-size: 2.25rem; line-height: 2.5rem; }
.w-cur-desc { font-size: 1.5rem; line-height: 2rem; }
.w-cur-pad { width: 6.25%; }
.w-item { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; text-align: center; }
.w-item img { width: 4rem; height: 4rem; margin: -.5rem 0; }
.w-item .min { color: var(--cold); }
.w-item .max { color: var(--hot); }
.weather img { filter: drop-shadow(0 4px 4px rgb(0 0 0 / .5)); }

.photo { grid-column: span 2; grid-row: span 2; }
.photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 1rem; }

@media (max-width: 900px), (max-height: 600px) {
  html { font-size: 16px; }
  body { overflow: auto; }
  .page { height: auto; min-height: 100dvh; padding: .75rem; }
  .shell { contain: none; }
  .header { height: auto; padding: 1rem; flex-wrap: wrap; gap: .5rem; }
  .logo img { height: 2.5rem; }
  .clock { gap: .75rem; flex-wrap: wrap; }
  .clock-date { font-size: 1rem; }
  .clock-time { font-size: 2rem; }
  .body { display: flex; flex-direction: column; contain: none; }
  .stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
  .stat-title { font-size: .95rem; line-height: 1.25rem; padding: 0 .25rem; }
  .stat-value { font-size: 1.6rem; line-height: 2rem; }
  .stat-unit { font-size: 1rem; line-height: 1.5rem; }
  .stat-row { flex-wrap: wrap; gap: .25rem; }
  .clock-time { order: -1; }
  .weather { font-size: .8rem; line-height: 1.2rem; }
  .w-cur-icon { width: 4.5rem; height: 4.5rem; }
  .w-cur-temp { font-size: 1.75rem; line-height: 2rem; }
  .w-cur-desc { font-size: 1.1rem; line-height: 1.5rem; }
  .w-item img { width: 2.75rem; height: 2.75rem; margin: -.25rem 0; }
  .weather > div { padding: .5rem 0; }
  .stat { padding: .75rem .25rem; }
  .card { contain: layout; }
  .charts { height: 24rem; }
  .weather { min-height: 22rem; }
  .photo { height: 14rem; }
}
