/* ═══════════════════════════════════════════════════════════════
   SolarCloud Pro v0.6.25 — "WOW" UI Layer
   Override estetico applicato sopra solarpi.css.
   Glassmorphism + gradient + hover effects + chart animation.
   ═══════════════════════════════════════════════════════════════ */

/* ─────────────────── BACKGROUND ANIMATO GLOBALE ─────────────── */
body {
  position: relative;
  background:
    radial-gradient(at 0% 0%, rgba(124, 58, 237, .08) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(0, 212, 255, .08) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(255, 107, 53, .05) 0px, transparent 50%),
    var(--bg-page, #0a1929);
}

/* Stelle leggere fluttuanti (solo dark) - v0.6.25a: z-index negativo per
   non coprire mai i contenuti */
@media (prefers-color-scheme: dark) {
  body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
      radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,.15), transparent),
      radial-gradient(1px 1px at 60% 70%, rgba(255,255,255,.1), transparent),
      radial-gradient(2px 2px at 80% 20%, rgba(0,212,255,.2), transparent),
      radial-gradient(1px 1px at 40% 90%, rgba(124,58,237,.2), transparent);
    background-size: 600px 600px;
    pointer-events: none;
    z-index: -1;  /* v0.6.25a: sotto i contenuti */
    animation: wow-stars 60s linear infinite;
  }
}

/* v0.6.25a: assicura che il contenuto stia SOPRA lo sfondo */
.app-main, main, .app-sidebar, .app-header, .login-wrap {
  position: relative;
  z-index: 1;
}
@keyframes wow-stars {
  from { transform: translateY(0); }
  to   { transform: translateY(-600px); }
}

/* ─────────────────── CARD MODERN GLASS ─────────────────────── */
/* v0.6.25a: fallback solid background per browser senza color-mix */
.card,
.kpi-card,
.diag-card,
.us-card,
.contact-block {
  position: relative;
  background: var(--bg-card) !important;  /* fallback solido */
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--bg-card) 92%, transparent) 0%,
    color-mix(in srgb, var(--bg-card) 82%, transparent) 100%
  ) !important;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--border-card) !important;
  border-radius: 18px !important;
  transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
  overflow: hidden;
  z-index: 2;  /* v0.6.25a: card sempre sopra background */
}

/* Bordo gradient sottile animato */
.card::before,
.kpi-card::before,
.diag-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(0, 212, 255, .35),
    transparent 40%,
    transparent 60%,
    rgba(124, 58, 237, .35)
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity .35s ease;
}
.card:hover::before,
.kpi-card:hover::before,
.diag-card:hover::before {
  opacity: 1;
}

.card:hover,
.kpi-card:hover,
.diag-card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, .35),
    0 0 0 1px rgba(0, 212, 255, .2);
}

/* ─────────────────── KPI VALUE: gradient + glow ─────────────── */
.kpi-value,
.flow-value,
.fd-value,
.bat-info-val {
  background: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent !important;
  font-weight: 700;
  text-shadow: 0 0 30px rgba(0, 212, 255, .25);
  letter-spacing: -0.02em;
}

/* Varianti colore KPI conservano semantica ma con gradient */
.kpi-card.green   .kpi-value { background-image: linear-gradient(135deg, #00d97e 0%, #00d4ff 100%); }
.kpi-card.yellow  .kpi-value { background-image: linear-gradient(135deg, #ffb547 0%, #ff7849 100%); }
.kpi-card.orange  .kpi-value { background-image: linear-gradient(135deg, #ff7849 0%, #ff5470 100%); }
.kpi-card.red     .kpi-value { background-image: linear-gradient(135deg, #ff5470 0%, #d946ef 100%); }
.kpi-card.purple  .kpi-value { background-image: linear-gradient(135deg, #7c3aed 0%, #d946ef 100%); }
.kpi-card.cyan    .kpi-value { background-image: linear-gradient(135deg, #00d4ff 0%, #06b6d4 100%); }

/* Pulse sul valore al cambiamento (richiede class .updated aggiunta via JS) */
@keyframes wow-pulse-value {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.08); text-shadow: 0 0 40px rgba(0,212,255,.7); }
  100% { transform: scale(1); }
}
.kpi-value.updated,
.flow-value.updated {
  animation: wow-pulse-value .6s ease;
}

/* ─────────────────── KPI ICON: glow + float ───────────────── */
.kpi-icon,
.flow-icon {
  filter: drop-shadow(0 0 8px currentColor);
  animation: wow-float 4s ease-in-out infinite;
}
@keyframes wow-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

/* ─────────────────── CARD-TITLE: barra accento ──────────────── */
.card-title,
.diag-card h3,
.us-card h2 {
  position: relative;
  padding-left: 14px !important;
}
.card-title::before,
.diag-card h3::before,
.us-card h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 70%;
  background: linear-gradient(180deg, #00d4ff 0%, #7c3aed 100%);
  border-radius: 4px;
  box-shadow: 0 0 12px rgba(0, 212, 255, .6);
}

/* ─────────────────── SIDEBAR: nav-item hover wow ───────────── */
.sb-item {
  position: relative;
  transition: all .2s ease;
  padding-left: 20px !important;
}
.sb-item::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px;
  height: 60%;
  background: linear-gradient(180deg, #00d4ff 0%, #7c3aed 100%);
  border-radius: 3px;
  transition: transform .25s ease;
  box-shadow: 0 0 10px rgba(0, 212, 255, .8);
}
.sb-item:hover,
.sb-item.active {
  background: linear-gradient(90deg, rgba(0,212,255,.08) 0%, transparent 100%);
  padding-left: 26px !important;
  color: #fff !important;
}
.sb-item:hover::before,
.sb-item.active::before {
  transform: translateY(-50%) scaleY(1);
}

/* ─────────────────── APP HEADER: gradient + blur ───────────── */
.app-header {
  background: var(--bg-card) !important;  /* fallback solido v0.6.25a */
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--bg-card) 90%, transparent),
    color-mix(in srgb, var(--bg-page, #0a1929) 80%, transparent)) !important;
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-bottom: 1px solid rgba(0, 212, 255, .15) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .15);
  position: relative;
  z-index: 10;
}

/* App-user pill: gradient avatar */
.app-user-avatar {
  background: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%) !important;
  box-shadow: 0 0 16px rgba(0, 212, 255, .4);
  border: 2px solid rgba(255, 255, 255, .15);
  font-weight: 800;
}

/* ─────────────────── BUTTONS: gradient primary ─────────────── */
.btn-primary,
.wizard-btn-primary {
  background: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%) !important;
  border: none !important;
  color: #fff !important;
  font-weight: 700 !important;
  letter-spacing: 0.3px;
  box-shadow:
    0 6px 18px rgba(124, 58, 237, .35),
    inset 0 1px 0 rgba(255, 255, 255, .15);
  transition: all .2s ease;
  position: relative;
  overflow: hidden;
}
.btn-primary:hover,
.wizard-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow:
    0 10px 28px rgba(124, 58, 237, .5),
    inset 0 1px 0 rgba(255, 255, 255, .2);
}
.btn-primary::after,
.wizard-btn-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.25), transparent);
  transition: left .6s ease;
}
.btn-primary:hover::after,
.wizard-btn-primary:hover::after {
  left: 100%;
}

/* ─────────────────── BADGE pills enhanced ──────────────────── */
.pill,
.badge,
.us-user-badge {
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  backdrop-filter: blur(8px);
  font-weight: 600;
  letter-spacing: 0.3px;
}
.pill.ok,
.badge.ok,
.us-user-badge.active {
  background: linear-gradient(135deg, rgba(0,217,126,.2) 0%, rgba(0,212,255,.15) 100%) !important;
  border-color: rgba(0, 217, 126, .4) !important;
  color: #00d97e !important;
  text-shadow: 0 0 8px rgba(0, 217, 126, .4);
}
.pill.warn,
.badge.warn {
  background: linear-gradient(135deg, rgba(255,181,71,.2), rgba(255,120,73,.15)) !important;
  border-color: rgba(255, 181, 71, .4) !important;
  color: #ffb547 !important;
}
.pill.err,
.badge.err,
.pill.offline,
.us-user-badge.inactive {
  background: linear-gradient(135deg, rgba(255,84,112,.2), rgba(217,70,239,.15)) !important;
  border-color: rgba(255, 84, 112, .4) !important;
  color: #ff5470 !important;
}

/* ─────────────────── CANVAS / CHARTS smooth entry ─────────── */
canvas {
  animation: wow-fade-in .6s ease both;
}
@keyframes wow-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─────────────────── FLOW NODES: glow + gradient ──────────── */
.flow-node {
  background: var(--bg-card) !important;  /* fallback v0.6.25a */
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--bg-card) 88%, transparent),
    color-mix(in srgb, var(--bg-card-hover, var(--bg-card)) 78%, transparent)) !important;
  border: 1px solid rgba(0, 212, 255, .15) !important;
  border-radius: 20px !important;
  transition: all .35s ease;
  position: relative;
  z-index: 2;
}
.flow-node.active {
  border-color: rgba(0, 212, 255, .5) !important;
  box-shadow:
    0 0 40px rgba(0, 212, 255, .25),
    inset 0 0 20px rgba(0, 212, 255, .08);
}
.flow-icon-wrap .flow-icon {
  background: linear-gradient(135deg, rgba(0,212,255,.15), rgba(124,58,237,.15));
  box-shadow: 0 0 24px rgba(0, 212, 255, .3);
}
.flow-node.active .flow-icon {
  animation: wow-icon-pulse 1.8s ease-in-out infinite;
}
@keyframes wow-icon-pulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 8px rgba(0,212,255,.5)); }
  50%      { transform: scale(1.06); filter: drop-shadow(0 0 16px rgba(0,212,255,.8)); }
}

/* ─────────────────── INPUTS: glass + glow focus ────────────── */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="search"],
select,
textarea {
  background: rgba(255, 255, 255, .04) !important;
  border: 1px solid rgba(255, 255, 255, .12) !important;
  border-radius: 10px !important;
  transition: all .2s ease;
}
input:focus,
select:focus,
textarea:focus {
  outline: none !important;
  border-color: #00d4ff !important;
  box-shadow:
    0 0 0 3px rgba(0, 212, 255, .15),
    0 0 20px rgba(0, 212, 255, .25) !important;
}

/* ─────────────────── PAGE ENTRY animation ─────────────────── */
.app-main {
  animation: wow-page-enter .5s ease;
}
@keyframes wow-page-enter {
  from { opacity: 0; transform: translateX(10px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ─────────────────── DARK theme tweaks ───────────────────── */
@media (prefers-color-scheme: dark) {
  body {
    --bg-page: #0a1929;
  }
}
[data-theme="dark"] body {
  --bg-page: #0a1929;
}
[data-theme="light"] body {
  background:
    radial-gradient(at 0% 0%, rgba(124, 58, 237, .04) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(0, 212, 255, .04) 0px, transparent 50%),
    linear-gradient(160deg, #f5f9ff 0%, #e8f1ff 100%);
}
[data-theme="light"] body::before {
  display: none; /* niente stelle in tema chiaro */
}

/* ─────────────────── TOAST / NOTIFICA glass ───────────────── */
.toast,
.banner {
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 12px 36px rgba(0, 0, 0, .35);
  border-radius: 12px !important;
}

/* ─────────────────── SCROLLBAR custom ─────────────────────── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, .02);
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #00d4ff 0%, #7c3aed 100%);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #06b6d4 0%, #6d28d9 100%);
}

/* ─────────────────── PROGRESS-BAR animated ───────────────── */
.flow-bat-bar,
.strength-bar {
  background: rgba(255, 255, 255, .06);
  overflow: hidden;
  position: relative;
}
.flow-bat-fill,
.strength-fill {
  background: linear-gradient(90deg, #00d97e 0%, #00d4ff 50%, #7c3aed 100%);
  background-size: 200% 100%;
  animation: wow-bar-shimmer 3s ease-in-out infinite;
  box-shadow: 0 0 12px rgba(0, 212, 255, .4);
}
@keyframes wow-bar-shimmer {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

/* ─────────────────── TABELLE: hover row glow ─────────────── */
table tbody tr {
  transition: background .2s ease;
}
table tbody tr:hover {
  background: linear-gradient(90deg,
    rgba(0, 212, 255, .04),
    rgba(124, 58, 237, .04));
}

/* ─────────────────── LOGGED-AS top banner ────────────────── */
[class*="loggato"],
[id*="loggato"] {
  background: linear-gradient(135deg, rgba(0,217,126,.15), rgba(0,212,255,.1)) !important;
  border: 1px solid rgba(0, 217, 126, .35) !important;
  box-shadow: 0 0 16px rgba(0, 217, 126, .2);
}

/* ─────────────────── EMPTY-STATE elegante ────────────────── */
.empty-state,
[class*="empty"] {
  text-align: center;
  padding: 48px 24px;
  opacity: .85;
}

/* ─────────────────── ANIMATIONS UTILITY ──────────────────── */
.wow-glow {
  animation: wow-glow-anim 2s ease-in-out infinite;
}
@keyframes wow-glow-anim {
  0%, 100% { box-shadow: 0 0 10px rgba(0, 212, 255, .4); }
  50%      { box-shadow: 0 0 25px rgba(0, 212, 255, .8); }
}

/* ─────────────────── COCKPIT specifico ───────────────────── */
.cockpit-main-kpi {
  font-size: clamp(48px, 8vw, 96px) !important;
  font-weight: 800 !important;
  background: linear-gradient(135deg, #00d4ff 0%, #7c3aed 50%, #ff7849 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent !important;
  animation: wow-gradient-shift 8s ease-in-out infinite;
  letter-spacing: -0.04em;
}
@keyframes wow-gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
