/* Solar Dashboard – interaktivni demo nadzorne ploče (assets/demo.js); boje i oblici kao u aplikaciji (tamna tema) */
figure.screen { margin: 0; }
.screen.demo-on .screen-shot { display: none; }
.demo {
  --d-card: rgba(22, 31, 51, 0.74); --d-border: rgba(255, 255, 255, 0.07); --d-line: rgba(255, 255, 255, 0.08);
  --d-text: #E6EAF2; --d-muted: #94A3B8; --d-greet: #CBD5E1; --d-accent: #7C9CFF; --d-green: #22C55E; --d-lime: #8BD449; --d-amber: #F59E0B;
  padding: 16px; min-height: 620px; color: var(--d-text); border-radius: 0 0 18px 18px;
  background: radial-gradient(1200px 600px at 85% 0%, #16264A 0%, transparent 60%), linear-gradient(180deg, #0B1120 0%, #0D1424 100%);
}
.demo[hidden] { display: none; }

/* ---- alatna traka demoa ---- */
.demo-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.demo-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.demo-badge { font-size: 0.72rem; letter-spacing: 0.05em; text-transform: uppercase; color: #ffd27a; border: 1px dashed rgba(255, 190, 80, 0.5); border-radius: 999px; padding: 5px 11px; }
.demo-btn { font: inherit; font-size: 0.85rem; font-weight: 700; cursor: pointer; border-radius: 11px; padding: 8px 14px; color: var(--d-text);
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--d-line); transition: border-color 0.2s, box-shadow 0.2s; }
.demo-btn:hover, .demo-btn:focus-visible { border-color: var(--cyan); box-shadow: 0 0 18px rgba(125, 249, 255, 0.18); outline: none; }
.demo-btn.primary { color: #031024; border: 0; background: linear-gradient(135deg, var(--cyan), var(--blue)); }
.demo-add { position: relative; }
.demo-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 15; min-width: 240px; max-height: 340px; overflow: auto; padding: 6px;
  background: rgba(8, 16, 38, 0.98); border: 1px solid var(--d-line); border-radius: 14px; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5); }
.demo-menu[hidden] { display: none; }
.demo-menu button { display: block; width: 100%; text-align: left; font: inherit; font-size: 0.9rem; color: var(--d-muted); background: none; border: 0;
  padding: 9px 12px; border-radius: 9px; cursor: pointer; }
.demo-menu button:hover, .demo-menu button:focus-visible { background: rgba(125, 249, 255, 0.08); color: var(--d-text); outline: none; }
.demo-menu-empty { padding: 10px 12px; color: var(--d-muted); font-size: 0.86rem; }

/* ---- zaglavlje s fotografijom elektrane ---- */
.d-hero { position: relative; display: flex; justify-content: space-between; gap: 16px; padding: 18px 20px; border-radius: 22px; overflow: hidden;
  min-height: 268px; margin-bottom: 14px;
  background: linear-gradient(90deg, rgba(11, 17, 32, 0.82) 0%, rgba(11, 17, 32, 0.35) 45%, rgba(11, 17, 32, 0.55) 100%), url("demo-hero.webp") center 45% / cover no-repeat; }
.d-hero-left { display: flex; flex-direction: column; justify-content: space-between; gap: 14px; min-width: 0; }
.d-hero .greet { font-size: 0.98rem; color: var(--d-greet); font-weight: 500; display: flex; align-items: center; gap: 4px; }
.d-hero .greet img { width: 18px; height: 18px; }
.d-hero .clock { font-variant-numeric: tabular-nums; }
.d-title { font-size: 1.95rem; line-height: 1.12; font-weight: 600; letter-spacing: -0.02em; max-width: 13em; margin-top: 4px; }
.d-title .hl { color: var(--d-accent); }
.glass-card { background: rgba(22, 31, 51, 0.62); border: 1px solid var(--d-border); border-radius: 18px;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); }
.site-card { padding: 12px 18px; width: 330px; max-width: 100%; box-sizing: border-box; display: flex; flex-direction: column; gap: 6px; }
.site-card .name { font-size: 0.82rem; color: var(--d-muted); }
.site-card .logo { display: flex; align-items: center; gap: 8px; font-size: 1.35rem; font-weight: 700; color: var(--d-lime); }
.site-card .logo img { width: 40px; height: 40px; }
.fact { border-left: 3px solid var(--d-line); padding-left: 10px; }
.fact.ok { border-color: var(--d-green); }
.fact .k { font-size: 0.74rem; color: var(--d-muted); }
.fact .v { font-size: 0.98rem; font-weight: 600; }
.d-weather { width: 290px; flex: none; padding: 14px 18px; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; box-sizing: border-box; }
.d-weather .date { text-align: center; font-size: 0.85rem; font-weight: 500; color: var(--d-greet); }
.d-weather .now { display: flex; align-items: center; justify-content: center; gap: 12px; }
.d-weather .now img { width: 52px; height: 52px; }
.d-weather .temp { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.d-weather .cond { font-size: 0.82rem; color: var(--d-muted); }
.d-weather .row { display: flex; gap: 10px; justify-content: space-between; font-size: 0.82rem; color: var(--d-muted); }
.d-weather .row b { color: var(--d-text); font-weight: 600; white-space: nowrap; }
.d-weather .days { display: flex; justify-content: space-between; border-top: 1px solid var(--d-line); padding-top: 8px; }
.d-weather .day { text-align: center; font-size: 0.74rem; color: var(--d-muted); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.d-weather .day img { width: 26px; height: 26px; }
.d-weather .day b { color: var(--d-text); }

/* ---- mreža widgeta (12 stupaca kao u aplikaciji) ---- */
.demo-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; grid-auto-flow: dense; }
.sp-k { grid-column: span 3; }
.sp-today, .sp-history { grid-column: span 5; }
.sp-impact { grid-column: span 4; }
.sp-gauge { grid-column: span 3; }
.sp-flow { grid-column: span 7; }
.demo-empty { grid-column: 1 / -1; text-align: center; color: var(--d-muted); padding: 60px 10px; border: 1px dashed var(--d-line); border-radius: 22px; }
.dw { position: relative; background: var(--d-card); border: 1px solid var(--d-border); border-radius: 22px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.3);
  padding: 16px 20px; min-width: 0; cursor: grab; transition: border-color 0.2s, opacity 0.2s; }
.dw:hover { border-color: rgba(124, 156, 255, 0.28); }
.dw.drag { opacity: 0.45; }
.dw.over { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(125, 249, 255, 0.25); }
.dw.new { animation: demo-in 0.5s ease-out; }
@keyframes demo-in { from { transform: scale(0.95); opacity: 0; } }
.dw-x { position: absolute; top: 10px; right: 10px; z-index: 3; font: inherit; font-size: 1rem; line-height: 1; width: 26px; height: 26px; border-radius: 8px; cursor: pointer;
  color: var(--d-muted); background: rgba(11, 17, 32, 0.7); border: 1px solid var(--d-line); opacity: 0; transition: opacity 0.2s, color 0.2s, border-color 0.2s; }
.dw:hover .dw-x, .dw-x:focus-visible { opacity: 1; }
.dw-x:hover, .dw-x:focus-visible { color: #F87171; border-color: rgba(248, 113, 113, 0.45); outline: none; }
@media (hover: none) { .dw-x { opacity: 0.85; } }

/* KPI (traka pokazatelja) */
.kpi { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "tile label" "tile value" "spark spark" "sub sub"; column-gap: 12px; align-items: center; }
.kpi .tile { grid-area: tile; }
.tile { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.tile img { width: 30px; height: 30px; }
.tile.sm { width: 44px; height: 44px; border-radius: 12px; }
.tile.sm img { width: 26px; height: 26px; }
.tile.blue { background: rgba(79, 134, 247, 0.16); }
.tile.amber { background: rgba(245, 158, 11, 0.16); }
.tile.green { background: rgba(34, 197, 94, 0.15); }
.tile.violet { background: rgba(167, 139, 250, 0.16); }
.kpi-mid { display: contents; }
.kpi .label { grid-area: label; font-size: 0.86rem; color: var(--d-muted); padding-right: 24px; line-height: 1.25; align-self: end; }
.kpi .value { grid-area: value; align-self: start; font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi .value small { font-size: 0.92rem; font-weight: 600; color: var(--d-muted); margin-left: 4px; }
.kpi .sub { grid-area: sub; font-size: 0.78rem; color: var(--d-muted); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.kpi .sub.warn { color: var(--d-amber); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--d-green); box-shadow: 0 0 8px var(--d-green); animation: demo-pulse 2s infinite; }
@keyframes demo-pulse { 50% { opacity: 0.35; } }
.kpi-spark { grid-area: spark; width: 100%; height: 34px; margin-top: 8px; }
.kpi-spark .ln { fill: none; stroke: var(--d-lime); stroke-width: 2; vector-effect: non-scaling-stroke; }

/* kartice */
.card-title { font-size: 1.04rem; font-weight: 600; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 10px; padding-right: 26px; }
.card-title small { font-size: 0.76rem; font-weight: 500; color: var(--d-muted); text-align: right; }
.headline { display: flex; align-items: baseline; gap: 14px; margin-top: 4px; flex-wrap: wrap; }
.headline .big { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.headline .big small { font-size: 0.95rem; color: var(--d-muted); font-weight: 600; margin-left: 3px; }
.headline .meta { font-size: 0.82rem; color: var(--d-muted); }
.chart { display: block; width: 100%; height: auto; margin-top: 6px; overflow: visible; }
.chart .gl { stroke: var(--d-line); stroke-width: 1; }
.chart .ax { fill: var(--d-muted); font-size: 11px; }
.chart .ln { fill: none; stroke: var(--d-lime); stroke-width: 2.4; stroke-linejoin: round; }
.chart .fc { fill: none; stroke: var(--d-amber); stroke-width: 1.8; stroke-dasharray: 2 5; stroke-linecap: round; }
.chart .pk { fill: #0D1424; stroke: var(--d-lime); stroke-width: 2.4; }
.chart .tip rect { fill: rgba(22, 31, 51, 0.95); stroke: var(--d-border); }
.chart .tip .tv { fill: var(--d-text); font-size: 12px; font-weight: 700; }
.chart .tip .tt { fill: var(--d-muted); font-size: 10px; }
.chart rect { fill: var(--d-lime); transition: y 0.6s, height 0.6s; }
.chart rect.now { fill: var(--d-amber); }
.list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.item { display: flex; align-items: center; gap: 14px; }
.item .k { font-size: 0.84rem; color: var(--d-muted); }
.item .v { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.item .v small { font-size: 0.8rem; color: var(--d-muted); font-weight: 600; margin-left: 4px; }

/* brzinomjer */
.speedo { display: block; width: 100%; max-width: 260px; margin: 2px auto 0; overflow: visible; }
.speedo .track { fill: none; stroke: rgba(255, 255, 255, 0.07); stroke-width: 12; stroke-linecap: round; }
.speedo .val { fill: none; stroke: var(--d-lime); stroke-width: 12; stroke-linecap: round; }
.speedo .tk { stroke: rgba(230, 234, 242, 0.35); stroke-width: 1; }
.speedo .tk.mj { stroke: var(--d-text); stroke-width: 2; }
.speedo .tn { fill: var(--d-text); font-size: 10px; }
.speedo .needle { stroke: #E6EAF2; stroke-width: 3; stroke-linecap: round; transition: transform 1s ease; }
.speedo .hub { fill: #0D1424; stroke: #E6EAF2; stroke-width: 3; }
.speedo .gv { fill: var(--d-text); font-size: 22px; font-weight: 700; }
.gauge-sub { text-align: center; font-size: 0.76rem; color: var(--d-muted); margin-top: 2px; }

/* tok energije */
.dw-body.flow { position: relative; min-height: 236px; }
.flow-lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.flow-lines path { fill: none; stroke: rgba(124, 156, 255, 0.25); stroke-width: 2; stroke-dasharray: 5 7; vector-effect: non-scaling-stroke; }
.flow-lines path.on { stroke: rgba(125, 249, 255, 0.75); animation: demo-flow 1s linear infinite; }
.flow-lines path.on.rev { animation-direction: reverse; stroke: rgba(245, 158, 11, 0.8); }
@keyframes demo-flow { to { stroke-dashoffset: -12; } }
.flow .chip { position: absolute; z-index: 1; display: flex; align-items: center; gap: 10px; padding: 9px 14px; min-width: 190px; box-sizing: border-box;
  background: rgba(30, 42, 70, 0.9); border: 1px solid var(--d-border); border-radius: 14px; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3); }
.flow .chip img { width: 30px; height: 30px; }
.flow .chip .k { font-size: 0.74rem; color: var(--d-muted); }
.flow .chip .k::first-letter { text-transform: uppercase; }
.flow .chip .v { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.flow .chip.tl { left: 0; top: 14px; }
.flow .chip.bl { left: 0; bottom: 14px; }
.flow .chip.tr { right: 0; top: 14px; }
.flow .chip.br { right: 0; bottom: 14px; }
.flow .building { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.45)); }
.flow .building img { width: 132px; height: 132px; }

/* inverteri */
.inv { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; font-size: 0.86rem; }
.inv li { display: flex; align-items: center; gap: 8px; }
.inv li span { flex: 1; color: var(--d-muted); }
.inv i { width: 8px; height: 8px; border-radius: 50%; background: var(--d-green); box-shadow: 0 0 8px var(--d-green); }
.inv b { font-variant-numeric: tabular-nums; }
.inv-ok { font-size: 0.78rem; color: var(--d-green); margin-top: 8px; }

.demo-hint { margin: 12px 0 0; text-align: center; color: var(--d-muted); font-size: 0.8rem; }

/* ---- prilagodba manjim zaslonima ---- */
@media (max-width: 1100px) {
  .sp-k { grid-column: span 6; }
  .sp-today, .sp-history, .sp-flow { grid-column: span 12; }
  .sp-impact { grid-column: span 7; }
  .sp-gauge { grid-column: span 5; }
}
@media (max-width: 760px) {
  .d-hero { flex-direction: column; min-height: 0; background-position: 30% center; }
  .d-weather, .site-card { width: 100%; }
  .d-title { font-size: 1.5rem; }
  .sp-k, .sp-impact, .sp-gauge { grid-column: span 12; }
  .dw-body.flow { min-height: 0; display: grid; grid-template-columns: 1fr; gap: 8px; }
  .flow-lines { display: none; }
  .flow .chip { position: static; min-width: 0; }
  .flow .building { position: static; transform: none; justify-self: center; order: -1; }
  .flow .building img { width: 96px; height: 96px; }
}
@media (max-width: 620px) {
  .demo { padding: 10px; min-height: 420px; }
  .demo-tools { width: 100%; }
  .demo-add { flex: 1; }
  .demo-add .demo-btn { width: 100%; }
  .demo-menu { left: 0; right: auto; width: min(280px, 82vw); }
  .dw { padding: 14px 14px; border-radius: 18px; }
  .kpi .value { font-size: 1.35rem; }
  .demo-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .flow-lines path.on, .live-dot, .dw.new { animation: none; }
}
