/* assets/css/home.css — FINETICA A (TradingView-like) + C widgets */
/* NOTE: homepage NON scrollabile (overflow hidden) su desktop */

:root{
  --ink:#0f172a;
  --muted:#64748b;
  --bg:#ffffff;

  --g:#16a34a;   /* green stock */
  --g2:#22c55e;
  --r:#dc2626;   /* red stock */
  --r2:#ef4444;

  --card: rgba(255,255,255,.78);
  --stroke: rgba(15,23,42,.10);
  --stroke2: rgba(15,23,42,.08);

  --shadow: 0 30px 70px rgba(15,23,42,.10);
  --shadow2: 0 18px 45px rgba(15,23,42,.10);
  --radius: 18px;
}

*{ box-sizing:border-box; margin:0; padding:0; }
html,body{ height:100%; }
body{
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden; /* NON scrollabile */
}

.bg{
  position:fixed; inset:0; z-index:-2;
  background:
    radial-gradient(900px 520px at 12% 15%, rgba(22,163,74,.14), transparent 60%),
    radial-gradient(900px 520px at 92% 18%, rgba(220,38,38,.10), transparent 55%),
    radial-gradient(900px 520px at 92% 90%, rgba(37,99,235,.08), transparent 60%),
    linear-gradient(#fff,#fff);
}
.grid{
  position:fixed; inset:0; z-index:-1;
  background-image:
    linear-gradient(to right, rgba(15,23,42,.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15,23,42,.05) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity:.30;
  mask-image: radial-gradient(circle at 40% 30%, black 0%, black 45%, transparent 75%);
  pointer-events:none;
}

/* header */
.topbar{
  height:78px;
  padding: 18px 34px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.brand{
  display:flex;
  align-items:center;
  gap:14px;
  min-width: 420px;
}
.logo{
  width: 180px; /* ~80% più grande rispetto a 100px */
  height:auto;
  display:block;
  user-select:none;
  pointer-events:none; /* non cliccabile */
}
.motto{
  font-size:14px;
  color: var(--muted);
  font-weight:650;
  white-space:nowrap;
}

.nav{ display:flex; align-items:center; gap:12px; }
.nav .nav-link{
  text-decoration:none;
  font-weight:800;
  color: var(--ink);
  display:inline-flex;
  align-items:center;
  height:38px;
  padding: 0 14px;
  border-radius:999px;
}
.nav .nav-link:hover{ background: rgba(15,23,42,.04); }
.nav .cta{
  background: rgba(22,163,74,.12);
  border: 1px solid rgba(22,163,74,.25);
  color: var(--g);
}
.nav .cta:hover{ background: rgba(22,163,74,.18); }

/* layout */
.wrap{
  position:relative;
  height: calc(100vh - 78px);
  padding: 18px 44px 22px;
  display:grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 52px;
  align-items:start;
}

/* hero left */
.hero-left{ max-width: 720px; }

.chips{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding: 8px 12px;
  border-radius:999px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.70);
  box-shadow: 0 10px 30px rgba(15,23,42,.06);
  font-size:12px;
  color:#334155;
  margin-bottom:12px;
}
.chips .dot{
  width:8px; height:8px; border-radius:999px;
  background: var(--g);
  box-shadow: 0 0 0 4px rgba(22,163,74,.18);
}

.h1{
  font-size: 58px;
  line-height:1.05;
  letter-spacing:-0.02em;
  margin-bottom:10px;
}
.accent{ color: var(--g); }
.lead{
  color:#475569;
  font-size:16px;
  line-height:1.5;
  max-width: 56ch;
  margin-bottom: 16px;
}

.ctaRow{ display:flex; gap:14px; align-items:center; margin-bottom: 10px; }
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height:44px;
  padding:0 18px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  text-decoration:none;
  font-weight:900;
  cursor:pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  user-select:none;
}
.btn:active{ transform: translateY(1px); }
.btn.primary{
  background: linear-gradient(90deg, rgba(22,163,74,.92), rgba(22,163,74,.75));
  color:#fff;
  border-color: rgba(22,163,74,.25);
  box-shadow: 0 14px 34px rgba(22,163,74,.18);
}
.btn.primary:hover{ box-shadow: 0 18px 44px rgba(22,163,74,.22); }
.btn.ghost{
  background: rgba(255,255,255,.70);
  color:#0f172a;
}
.btn.ghost:hover{ background: rgba(15,23,42,.04); }

.bullets{ list-style:none; display:grid; gap:10px; margin-top: 14px; color:#334155; font-size:13px; }
.bullets .b{ display:flex; gap:10px; align-items:center; }
.tick{
  width:18px; height:18px; border-radius:6px;
  background: rgba(22,163,74,.12);
  border:1px solid rgba(22,163,74,.25);
  display:flex; align-items:center; justify-content:center;
  color: var(--g);
  font-weight:900;
  font-size:12px;
}

/* hero right / preview */
.hero-right{ display:flex; justify-content:flex-end; align-self:stretch; align-items:flex-start; padding-top:8px; }
.preview{
  width: 560px;
  max-width: 100%;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  padding: 14px;
  position: relative;
  overflow: hidden;

  /* non deve uscire dallo schermo */
  max-height: calc(100vh - 78px - 34px - 22px);
}

.windowTop{
  display:flex; align-items:center; justify-content:space-between;
  padding: 8px 10px 12px;
  color:#334155;
  font-weight:900;
  font-size:13px;
}
.dots{ display:flex; gap:6px; align-items:center; }
.dots span{
  width:10px; height:10px; border-radius:999px;
  background:#e2e8f0;
  border:1px solid rgba(15,23,42,.10);
}
.windowTitle{ opacity:.85; }
.mini{ display:flex; gap:10px; align-items:center; font-weight:900; }
.up{ color: var(--g); }
.down{ color: var(--r); }

/* KPIs */
.gridCards{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.kpi{
  background: rgba(255,255,255,.86);
  border:1px solid var(--stroke);
  border-radius: 14px;
  padding: 12px 12px;
  box-shadow: var(--shadow2);
}
.kpi .t{ font-size:12px; color:#64748b; font-weight:900; margin-bottom:6px; }
.kpi .v{ font-size:18px; font-weight:950; color:#0f172a; }
.kpi .s{ font-size:12px; margin-top:4px; color:#64748b; }
.kpi .s .pos{ color: var(--g); font-weight:950; }
.kpi.wide{ grid-column: 1 / -1; padding: 12px 12px 10px; }

.bar{
  height: 10px;
  border-radius: 999px;
  background: rgba(15,23,42,.08);
  overflow:hidden;
  margin-top: 10px;
}
.bar > i{
  display:block;
  height:100%;
  width: 62%;
  background: linear-gradient(90deg, rgba(22,163,74,.85), rgba(22,163,74,.55));
  border-radius: 999px;
  animation: barPulse 3.6s ease-in-out infinite;
}
@keyframes barPulse{
  0%,100%{ transform: translateX(0); filter: brightness(1); }
  50%{ transform: translateX(3px); filter: brightness(1.08); }
}

/* widgets row (C) */
.widgetRow{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.widget{
  background: rgba(255,255,255,.86);
  border:1px solid var(--stroke);
  border-radius: 14px;
  padding: 10px 10px 10px;
  box-shadow: var(--shadow2);
  min-height: 170px;
}
.wTop{
  display:flex; justify-content:space-between; align-items:center;
  padding: 2px 4px 8px;
  font-size:12px;
  font-weight:950;
  color:#64748b;
}
.wTitle{ color:#334155; }
.wMeta{ opacity:.85; }

/* pie */
.pieWrap{
  position: relative;
  width: 140px;
  height: 140px;
  margin: 6px auto 8px;
}
.pie{ width:140px; height:140px; display:block; }
.pie-bg{ fill:none; stroke: rgba(15,23,42,.08); stroke-width: 14; }
.pie-hole{ fill: rgba(255,255,255,.92); }
.pie-slice{
  fill:none;
  stroke-width: 14;
  transform: rotate(-90deg);
  transform-origin: 60px 60px;
  stroke-linecap: round;
  filter: drop-shadow(0 4px 8px rgba(15,23,42,.06));
}
.pie-etf{ stroke: rgba(22,163,74,.92); }
.pie-stock{ stroke: rgba(59,130,246,.92); }
.pie-bond{ stroke: rgba(220,38,38,.92); }

.pieCenter{
  position:absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align:center;
  pointer-events:none;
  line-height: 1.2;
}
.pieBig{ font-weight: 950; color:#0f172a; font-size: 18px; letter-spacing:-.3px; }
.pieSmall{ font-weight: 700; color:#94a3b8; font-size: 9px; text-transform: uppercase; letter-spacing: .5px; }

.pieLegend{
  display:flex;
  justify-content: center;
  gap: 12px;
  font-size: 11px;
  font-weight: 700;
  color:#475569;
  margin-top: 8px;
  flex-wrap: wrap;
}
.pieLegend div{ display:flex; align-items:center; gap:4px; white-space:nowrap; }
.pieLegend b{ font-weight:900; color:#1e293b; }
.lg{
  width:8px;height:8px;border-radius:999px; display:inline-block; flex-shrink:0;
}
.lg.etf{ background: rgba(22,163,74,.92); }
.lg.stock{ background: rgba(59,130,246,.92); }
.lg.bond{ background: rgba(220,38,38,.92); }

/* bars */
.bars{ width:100%; height:120px; display:block; }
.bars rect{ opacity:.85; }
.bars-axis{ stroke: rgba(15,23,42,.10); stroke-width:1; }
.b1{ fill: rgba(22,163,74,.55); }
.b2{ fill: rgba(59,130,246,.45); }
.b3{ fill: rgba(220,38,38,.35); }
.b4{ fill: rgba(99,102,241,.35); }
.b5{ fill: rgba(22,163,74,.42); }
.b6{ fill: rgba(59,130,246,.42); }
.b7{ fill: rgba(22,163,74,.35); }

.barsCap{
  font-size: 12px;
  color:#64748b;
  font-weight: 850;
  text-align:center;
  margin-top: 4px;
}

/* Trend chart box */
.chartBox{
  background: rgba(255,255,255,.86);
  border:1px solid var(--stroke);
  border-radius: 14px;
  padding: 10px 10px 8px;
  box-shadow: var(--shadow2);
}
.chartTitle{
  display:flex; justify-content:space-between; align-items:center;
  font-size:12px; color:#64748b; font-weight:950;
  padding: 2px 4px 8px;
}
.tags{ display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.tag{
  font-size:11px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.75);
  color:#334155;
  font-weight:900;
}

/* This is the critical fix: the SVG can't overflow */
.chartViewport{
  height: 160px;            /* slightly shorter than the old 170 */
  overflow: hidden;
  border-radius: 12px;
}
.chartViewport svg{ width:100%; height: 170px; display:block; transform: translateY(-4px); }

.axis{ stroke: rgba(15,23,42,.08); stroke-width:1; }
.gline{ stroke: var(--g); stroke-width: 4; fill:none; stroke-linecap:round; stroke-linejoin:round; }
.rline{ stroke: var(--r); stroke-width: 3; fill:none; stroke-linecap:round; stroke-linejoin:round; opacity:.95; }
.glow{ filter: drop-shadow(0 6px 10px rgba(22,163,74,.18)); }
.rglow{ filter: drop-shadow(0 6px 10px rgba(220,38,38,.14)); }
.dotG{ fill: rgba(22,163,74,.95); }
.dotR{ fill: rgba(220,38,38,.92); }

/* ============================================
   PIE CHART — proper segments via dasharray
============================================ */
.pie-etf{
  stroke-dasharray: 132.7 276.46;
  stroke-dashoffset: 0;
  animation: pieIn .8s ease-out both;
}
.pie-stock{
  stroke-dasharray: 88.47 276.46;
  stroke-dashoffset: -132.7;
  animation: pieIn .8s .15s ease-out both;
}
.pie-bond{
  stroke-dasharray: 55.29 276.46;
  stroke-dashoffset: -221.17;
  animation: pieIn .8s .3s ease-out both;
}
@keyframes pieIn{
  from{ stroke-dasharray: 0 276.46; opacity:0; }
}

/* ============================================
   COOKIE BANNER — professional GDPR
============================================ */
.ck-banner{
  position:fixed;
  left:50%; bottom:20px;
  transform:translateX(-50%);
  background:#0f172a;
  color:#e2e8f0;
  border-radius:20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.06);
  backdrop-filter:blur(20px);
  z-index:9999;
  max-width:min(580px, calc(100vw - 32px));
  max-height:calc(100vh - 40px);
  width:100%;
  display:none; /* shown by JS */
  flex-direction:column;
  font-size:13px;
  line-height:1.55;
  animation: ckSlide .4s ease-out;
}
@keyframes ckSlide{
  from{transform:translateX(-50%) translateY(30px);opacity:0}
}
.ck-main{ padding:22px 24px; border-radius:20px; }
.ck-icon{ font-size:28px; margin-bottom:4px; }
.ck-title{ font-size:16px; font-weight:800; color:#fff; margin:0 0 6px; }
.ck-desc{ color:#94a3b8; font-size:13px; margin:0 0 10px; }
.ck-links{ display:flex; gap:14px; margin-bottom:16px; flex-wrap:wrap; }
.ck-links a{
  color:#60a5fa; font-size:12px; font-weight:600;
  text-decoration:none; border-bottom:1px solid rgba(96,165,250,.3);
  transition: color .2s;
}
.ck-links a:hover{ color:#93bbfc; border-color:#93bbfc; }
.ck-buttons{ display:flex; gap:8px; flex-wrap:wrap; }
.ck-btn{
  border:none; height:38px; padding:0 18px;
  border-radius:10px; font-weight:700; font-size:13px;
  cursor:pointer; transition:all .15s; white-space:nowrap;
}
.ck-settings-btn{ background:rgba(255,255,255,.08); color:#cbd5e1; }
.ck-settings-btn:hover{ background:rgba(255,255,255,.14); }
.ck-reject{ background:rgba(255,255,255,.1); color:#fff; }
.ck-reject:hover{ background:rgba(255,255,255,.18); }
.ck-accept{ background:#16a34a; color:#fff; }
.ck-accept:hover{ background:#15803d; }

/* settings panel — simple, bulletproof */
.ck-settings{
  display:none;
}
.ck-settings-head{
  display:flex; justify-content:space-between; align-items:center;
  padding:22px 24px 12px;
}
.ck-settings-body{
  padding:0 24px;
  max-height:calc(100vh - 260px);
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
}
.ck-settings-foot{
  padding:16px 24px 22px;
  border-top:1px solid rgba(255,255,255,.08);
}
.ck-back{
  background:none; border:none; color:#60a5fa; font-size:13px;
  font-weight:600; cursor:pointer; padding:4px 8px;
}
.ck-back:hover{ color:#93bbfc; }
.ck-category{
  padding:14px 0;
  border-top:1px solid rgba(255,255,255,.06);
}
.ck-cat-head{ display:flex; justify-content:space-between; align-items:flex-start; gap:16px; }
.ck-cat-head strong{ font-size:13px; color:#fff; }
.ck-cat-desc{ font-size:11px; color:#64748b; margin:3px 0 0; }
.ck-cat-detail{
  margin-top:8px; font-size:11px; color:#475569;
  padding:8px 10px; background:rgba(255,255,255,.03);
  border-radius:8px;
}
.ck-cat-detail span{ font-family:monospace; color:#94a3b8; }

/* toggle switch */
.ck-toggle{
  width:42px; height:24px; border-radius:12px;
  background:rgba(255,255,255,.12); position:relative;
  flex-shrink:0; cursor:pointer; transition:background .2s;
}
.ck-toggle.on{ background:#16a34a; }
.ck-toggle.disabled{ opacity:.5; cursor:default; pointer-events:none; }
.ck-dot{
  width:18px; height:18px; border-radius:50%;
  background:#fff; position:absolute; top:3px; left:3px;
  transition:transform .2s;
  box-shadow:0 1px 3px rgba(0,0,0,.3);
}
.ck-toggle.on .ck-dot{ transform:translateX(18px); }

/* ============================================
   RESPONSIVE — TABLET
============================================ */
@media (max-width: 1100px){
  body{ overflow:auto; }
  .wrap{ grid-template-columns: 1fr; height:auto; padding: 22px; }
  .hero-right{ display:none; } /* HIDE preview completely */
  .brand{ min-width: 0; }
  .motto{ display:none; }
  .h1{ font-size: 38px; }
  .ck-banner{ bottom:10px; border-radius:14px; }
  .ck-main{ padding:16px; }
  .ck-settings-head{ padding:16px 16px 8px; }
  .ck-settings-body{ padding:0 16px; max-height:calc(100vh - 220px); }
  .ck-settings-foot{ padding:12px 16px 16px; }
  .ck-buttons{ flex-direction:column; }
  .ck-btn{ width:100%; text-align:center; min-height:44px; display:flex; align-items:center; justify-content:center; }
}

/* ============================================
   RESPONSIVE — MOBILE
============================================ */
@media (max-width: 680px){
  body{ overflow:auto; }

  /* TOPBAR: compact */
  .topbar{
    height:auto;
    padding:12px 16px;
    flex-wrap:wrap;
    gap:8px;
  }
  .brand{
    min-width:0;
    gap:6px;
    flex:1;
  }
  .logo{ width:120px; display:block !important; visibility:visible !important; opacity:1 !important; }
  .etf-live-link{
    margin-top:24px !important;
  }
  .nav{ gap:6px; }
  .nav .nav-link{
    height:32px;
    padding:0 12px;
    font-size:13px;
  }

  /* HERO: readable text */
  .wrap{
    grid-template-columns:1fr;
    height:auto;
    padding:8px 16px 40px;
    gap:0;
  }
  .hero-left{ max-width:100%; }
  .hero-right{ display:none; } /* REMOVE preview */
  .chips{
    font-size:10px;
    padding:5px 10px;
    margin-bottom:14px;
  }
  .h1{
    font-size:28px;
    line-height:1.15;
    letter-spacing:-.01em;
    margin-bottom:12px;
    word-break:break-word;
  }
  .lead{
    font-size:14px;
    line-height:1.5;
    max-width:100%;
    margin-bottom:18px;
  }

  /* BUTTONS: stack */
  .ctaRow{
    flex-direction:column;
    gap:10px;
    align-items:stretch;
  }
  .ctaRow .btn{
    width:100%;
    justify-content:center;
    height:48px;
    font-size:15px;
  }

  /* BULLETS */
  .bullets{ gap:8px; margin-top:16px; font-size:12px; }
}
