/* Solivya - Pagina pubblica Statistiche
   Allineata allo style guide del sito (vedi /css/style.css e /css/homepage.css).
   Niente CDN esterne: i "grafici" sono barre HTML accessibili. */

/* HERO */
.hero-statistiche {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 80px 0 60px;
    text-align: center;
}
.hero-statistiche h1 {
    color: #fff;
    font-size: 2.5rem;
    margin: 0 0 18px;
    line-height: 1.2;
}
.hero-statistiche .hero-subtitle {
    font-size: 1.15rem;
    max-width: 720px;
    margin: 0 auto;
    opacity: 0.95;
    line-height: 1.6;
}
.hero-statistiche strong { color: #fff; }

/* SECTION DASHBOARD */
.section-dashboard {
    padding: 60px 0;
    background: #f7f7fb;
}

.dashboard-loading,
.dashboard-empty {
    text-align: center;
    padding: 48px 16px;
    color: #6b7280;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(20, 25, 50, 0.06);
    max-width: 720px;
    margin: 0 auto;
}
.dashboard-empty p { margin: 0 0 8px; font-size: 1.1rem; color: #1f2433; }
.dashboard-empty .dashboard-empty-sub { font-size: 0.95rem; color: #6b7280; }

/* COUNTER (KPI) */
.counter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}
.counter-card {
    background: #fff;
    border-radius: 12px;
    padding: 28px 20px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(20, 25, 50, 0.06);
    border-top: 4px solid #4c51bf;
    transition: transform 0.2s, box-shadow 0.2s;
}
.counter-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 18px rgba(20, 25, 50, 0.1);
}
.counter-num {
    font-size: 2.6rem;
    font-weight: 700;
    color: #4c51bf;
    line-height: 1.1;
    margin-bottom: 6px;
}
.counter-label {
    font-size: 0.95rem;
    color: #1f2433;
    font-weight: 600;
}
.counter-desc {
    font-size: 0.82rem;
    color: #6b7280;
    margin-top: 6px;
}

/* CHARTS (grid 2 colonne, ogni card e' un widget bar) */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}
.chart-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 6px rgba(20, 25, 50, 0.06);
}
.chart-card h3 {
    margin: 0 0 6px;
    color: #4c51bf;
    font-size: 1.15rem;
}
.chart-card .chart-desc {
    color: #6b7280;
    font-size: 0.88rem;
    margin: 0 0 16px;
}

/* Bar list (riusato dalle barre admin ma stilizzato in modo coerente al sito) */
.stat-bars { display: flex; flex-direction: column; gap: 10px; }
.stat-bar-row {
    display: grid;
    grid-template-columns: 1fr 2fr auto;
    gap: 12px;
    align-items: center;
}
.stat-bar-label {
    font-size: 0.92rem;
    color: #1f2433;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.stat-bar-track {
    background: #eef0f7;
    border-radius: 999px;
    height: 14px;
    overflow: hidden;
}
.stat-bar-fill {
    background: linear-gradient(90deg, #667eea, #764ba2);
    height: 100%;
    border-radius: 999px;
    transition: width 0.6s ease-out;
}
.stat-bar-value {
    font-size: 0.9rem;
    color: #4c51bf;
    font-weight: 600;
    min-width: 36px;
    text-align: right;
}

/* Vertical bar chart (per ore di picco 24h) */
.vbars-wrapper { overflow-x: auto; }
.vbars {
    display: flex;
    gap: 4px;
    align-items: flex-end;
    height: 180px;
    padding: 8px 0;
    min-width: 600px;
}
.vbar-col {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 22px;
}
.vbar-fill {
    width: 100%;
    background: linear-gradient(180deg, #667eea, #764ba2);
    border-radius: 4px 4px 0 0;
    min-height: 2px;
    transition: height 0.6s ease-out;
}
.vbar-axis {
    font-size: 0.7rem;
    color: #6b7280;
}

/* No data nel widget */
.no-data {
    color: #6b7280;
    font-style: italic;
    font-size: 0.9rem;
    padding: 12px 0;
}

/* SECTION TRASPARENZA */
.section-trasparenza {
    padding: 60px 0;
    background: #fff;
}
.trasparenza-box {
    max-width: 800px;
    margin: 0 auto;
    background: #f7f7fb;
    border-radius: 12px;
    padding: 32px;
    border-left: 4px solid #4c51bf;
}
.trasparenza-box h2 {
    color: #4c51bf;
    margin: 0 0 16px;
}
.trasparenza-box p {
    color: #1f2433;
    line-height: 1.7;
    margin: 0 0 12px;
}
.trasparenza-box p:last-child { margin-bottom: 0; }
.trasparenza-box strong { color: #4c51bf; }

/* ============================================================
 * Sessione 26 decies - stat extra (pie/donut/stacked/heatmap/line/delta)
 * ============================================================ */
.chart-card-wide { grid-column: 1 / -1; }

.pie-chart-wrap {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: center;
}
.pie-chart-wrap svg {
    filter: drop-shadow(0 4px 10px rgba(15, 23, 42, 0.08));
    max-width: 100%;
    height: auto;
}
.pie-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    min-width: 200px;
    max-width: 340px;
}
.pie-legend-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    max-width: none;
    margin-top: 14px;
}
.pie-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #eef0f6;
    font-size: 14px;
}
.pie-legend-row .pie-legend-item { border-bottom: none; padding: 4px 10px; background: #f7f7fb; border-radius: 7px; }
.pie-legend-item:last-child { border-bottom: none; }
.pie-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(15, 23, 42, 0.08);
}
.pie-legend-label { flex: 1; color: #1f2433; font-weight: 500; }
.pie-legend-value { color: #6b7280; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }
.pie-legend-value small { color: #94a3b8; font-weight: 500; }

/* Stacked bar */
.stack-bar-wrap { padding: 8px 0; }
.stack-bar {
    display: flex;
    width: 100%;
    height: 36px;
    border-radius: 999px;
    overflow: hidden;
    background: #eef0f6;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05) inset;
}
.stack-seg {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #fff;
    font-weight: 700;
}
.stack-bar-total { margin-top: 10px; color: #6b7280; font-size: 14px; text-align: right; }

/* Line chart */
.line-chart-wrap {
    background: #fafbfd;
    border-radius: 10px;
    padding: 14px 16px 6px;
    border: 1px solid #eef0f6;
}
.line-chart-wrap svg { display: block; width: 100%; height: auto; }

/* Heatmap */
.heatmap-grid {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 4px 0;
    overflow-x: auto;
}
.heat-row {
    display: grid;
    grid-template-columns: 50px repeat(24, minmax(26px, 1fr));
    gap: 3px;
    align-items: center;
}
.heat-row.heat-header { color: #6b7280; font-size: 11px; font-weight: 600; }
.heat-hour { text-align: center; font-size: 10px; color: #94a3b8; font-variant-numeric: tabular-nums; }
.heat-day { font-size: 12px; font-weight: 700; color: #334155; text-align: right; padding-right: 6px; }
.heat-cell {
    height: 26px;
    border-radius: 4px;
    background: #f1f3f9;
    border: 1px solid #eef0f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    font-size: 12px;
    color: #6b7280;
    justify-content: center;
}
.heat-legend-step {
    width: 22px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid #eef0f6;
}

/* Delta cards */
.delta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.delta-card {
    background: #fff;
    border: 1px solid #e3e6ee;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 2px 6px rgba(20, 25, 50, 0.06);
}
.delta-label {
    color: #6b7280;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    margin-bottom: 8px;
}
.delta-now {
    font-size: 30px;
    font-weight: 800;
    color: #1f2433;
    letter-spacing: -0.02em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.delta-prev { color: #94a3b8; font-size: 12.5px; margin-top: 4px; }
.delta-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 12px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}
.delta-pill.delta-up   { background: rgba(22, 163, 74, 0.12); color: #15803d; }
.delta-pill.delta-down { background: rgba(220, 38, 38, 0.10); color: #dc2626; }
.delta-pill.delta-zero { background: #eef0f6; color: #6b7280; }

.recensioni-header {
    text-align: center;
    margin-bottom: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid #eef0f6;
}
.recensioni-media-num {
    font-size: 38px;
    font-weight: 800;
    color: #f59e0b;
    letter-spacing: -0.02em;
    line-height: 1;
}
.recensioni-media-num::after { content: ' ★'; }
.recensioni-media-label { color: #6b7280; font-size: 13px; margin-top: 4px; }

/* RESPONSIVE */
@media (max-width: 768px) {
    .hero-statistiche { padding: 60px 0 40px; }
    .hero-statistiche h1 { font-size: 1.9rem; }
    .section-dashboard { padding: 40px 0; }
    .counter-num { font-size: 2rem; }
    .vbars { height: 140px; min-width: 480px; }
    .heat-row { grid-template-columns: 40px repeat(24, minmax(18px, 1fr)); }
    .heat-cell { height: 22px; font-size: 9px; }
    .pie-chart-wrap { flex-direction: column; }
}
