/* ===== Data Visualization System ===== */
/* Animated charts, cooling curves, heat maps, comparison bars */

/* ---- Shared visualization styles ---- */
.viz-section { padding: 80px 0; }
.viz-header {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 48px;
}
.viz-header h2 {
    font-size: clamp(28px, 3.5vw, 40px);
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}
.viz-header p {
    font-size: 16px;
    color: #666;
}

.viz-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ---- Temperature Bar Chart ---- */
.bar-chart { padding: 32px 0; }
.bar-chart-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 24px;
    text-align: center;
}
.bar-group { margin-bottom: 20px; }
.bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
}
.bar-label span:last-child {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.bar-track {
    height: 32px;
    background: #f0f0f0;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}
.bar-fill {
    height: 100%;
    border-radius: 8px;
    transition: width 1.5s cubic-bezier(0.16, 1, 0.3, 1);
    width: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 12px;
}
.bar-fill .bar-value {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    opacity: 0;
    transition: opacity 0.3s 1.2s;
}
.bar-chart.animated .bar-fill .bar-value { opacity: 1; }

/* Temperature-color bars */
.bar-hot .bar-fill { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.bar-warm .bar-fill { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.bar-cool .bar-fill { background: linear-gradient(90deg, #60a5fa, #3b82f6); }
.bar-cold .bar-fill { background: linear-gradient(90deg, #34d399, #10b981); }
.bar-brand .bar-fill { background: linear-gradient(90deg, #4a90d9, #357abd); }

/* ---- Dual Comparison Bars (before/after) ---- */
.comparison-dual {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: end;
}
.comparison-dual .bar-group { margin-bottom: 16px; }
.comparison-dual .bar-track { height: 40px; }
.comparison-dual .bar-label { font-size: 14px; }

.comp-column h4 {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
    text-align: center;
}
.comp-column.before h4 { color: #ef4444; }
.comp-column.after h4 { color: #3b82f6; }
.comp-column.before .bar-fill { background: linear-gradient(90deg, #fca5a5, #ef4444); }
.comp-column.after .bar-fill { background: linear-gradient(90deg, #93c5fd, #3b82f6); }

.comp-summary {
    grid-column: 1 / -1;
    text-align: center;
    padding: 24px;
    background: linear-gradient(135deg, #f0f7ff, #e8f4f8);
    border-radius: 16px;
    margin-top: 16px;
}
.comp-summary .big-number {
    font-size: 48px;
    font-weight: 800;
    color: #3b82f6;
    display: block;
    letter-spacing: -0.02em;
}
.comp-summary .big-label {
    font-size: 14px;
    color: #555;
    margin-top: 4px;
    display: block;
}

/* ---- Cooling Curve (Line Chart) ---- */
.chart-curve {
    background: #fff;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.06);
    position: relative;
    overflow: hidden;
}
.curve-container {
    position: relative;
    height: 280px;
    margin: 24px 0 16px;
}
.curve-svg {
    width: 100%;
    height: 100%;
}
.curve-grid line {
    stroke: #f0f0f0;
    stroke-width: 1;
}
.curve-label {
    font-size: 11px;
    fill: #999;
    font-family: 'Inter', sans-serif;
}
.curve-line {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}
.curve-line-hot { stroke: #ef4444; }
.curve-line-cool { stroke: #3b82f6; }
.curve-line-premium { stroke: #10b981; }

.curve-dot {
    r: 5;
    stroke-width: 2;
    fill: #fff;
    cursor: pointer;
    transition: r 0.2s;
}
.curve-dot:hover { r: 8; }
.curve-dot-hot { stroke: #ef4444; }
.curve-dot-cool { stroke: #3b82f6; }
.curve-dot-premium { stroke: #10b981; }

.curve-legend {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: 16px;
}
.curve-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #555;
}
.curve-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
.curve-legend-dot.hot { background: #ef4444; }
.curve-legend-dot.cool { background: #3b82f6; }
.curve-legend-dot.premium { background: #10b981; }
.curve-legend-dot.brand { background: #4a90d9; }
.curve-legend-dot.warning { background: #f59e0b; }
.curve-legend-dot.green { background: #10b981; }

.curve-tooltip {
    position: absolute;
    background: #1a1a2e;
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
    z-index: 10;
}
.curve-tooltip.visible { opacity: 1; }

/* Y-axis labels */
.curve-y-axis {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 4px 0;
    width: 40px;
}
.curve-y-label {
    font-size: 10px;
    color: #bbb;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ---- Heat Map / Thermal Visual ---- */
.thermal-visual {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.thermal-card {
    border-radius: 20px;
    padding: 40px 28px;
    text-align: center;
    position: relative;
    overflow: hidden;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
}
.thermal-card::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.15;
}
.thermal-card-bad {
    background: linear-gradient(180deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fecaca;
}
.thermal-card-good {
    background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #bfdbfe;
}
.thermal-card h4 {
    font-size: 14px;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}
.thermal-temp {
    font-size: 64px;
    font-weight: 800;
    letter-spacing: -0.03em;
    position: relative;
    z-index: 1;
}
.thermal-card-bad .thermal-temp { color: #ef4444; }
.thermal-card-good .thermal-temp { color: #3b82f6; }
.thermal-unit {
    font-size: 18px;
    font-weight: 600;
    margin-top: 4px;
    position: relative;
    z-index: 1;
}
.thermal-card-bad .thermal-unit { color: #fca5a5; }
.thermal-card-good .thermal-unit { color: #93c5fd; }

/* Thermal overlay gradient (simulated heat) */
.thermal-card-bad .thermal-glow {
    position: absolute;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(239,68,68,0.2) 0%, transparent 70%);
    border-radius: 50%;
}
.thermal-card-good .thermal-glow {
    position: absolute;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(59,130,246,0.2) 0%, transparent 70%);
    border-radius: 50%;
}

/* ---- Data Cards with Counters ---- */
.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}
.viz-data-card {
    text-align: center;
    padding: 28px 16px;
    background: #fff;
    border-radius: 16px;
    border: 1px solid rgba(0,0,0,0.06);
    transition: transform 0.3s, box-shadow 0.3s;
}
.viz-data-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.06);
}
.viz-data-card .viz-icon {
    font-size: 28px;
    margin-bottom: 12px;
    display: block;
}
.viz-data-card .viz-number {
    font-size: 36px;
    font-weight: 800;
    color: #1a1a2e;
    display: block;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.viz-data-card .viz-number.blue { color: #3b82f6; }
.viz-data-card .viz-number.green { color: #10b981; }
.viz-data-card .viz-number.orange { color: #f59e0b; }
.viz-data-card .viz-number.red { color: #ef4444; }
.viz-data-card .viz-label {
    font-size: 13px;
    color: #888;
    margin-top: 6px;
    display: block;
    line-height: 1.4;
}

/* ---- UV Spectrum Visual ---- */
.uv-spectrum {
    height: 48px;
    border-radius: 24px;
    background: linear-gradient(90deg,
        #22c55e 0%, #22c55e 20%,
        #eab308 20%, #eab308 40%,
        #f97316 40%, #f97316 60%,
        #ef4444 60%, #ef4444 80%,
        #7c3aed 80%, #7c3aed 100%
    );
    position: relative;
    margin: 40px 0;
    overflow: hidden;
}
.uv-marker {
    position: absolute;
    top: -8px;
    width: 4px;
    height: 64px;
    background: #1a1a2e;
    border-radius: 2px;
    transition: left 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.uv-marker::after {
    content: '▼';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: #1a1a2e;
}
.uv-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 28px;
    font-size: 12px;
    color: #888;
}
.uv-labels span { text-align: center; flex: 1; }
.uv-labels span strong { display: block; color: #1a1a2e; font-weight: 700; margin-top: 4px; }

/* ---- Energy Savings Visual ---- */
.energy-visual {
    position: relative;
    height: 200px;
    margin: 32px 0;
}
.energy-bar {
    position: absolute;
    bottom: 0;
    border-radius: 12px 12px 0 0;
    transition: height 1.5s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 16px;
}
.energy-bar .e-label {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}
.energy-bar .e-value {
    font-size: 11px;
    color: rgba(255,255,255,0.8);
    margin-top: 4px;
}
.energy-baseline {
    position: absolute;
    bottom: 0;
    left: 5%;
    width: 90%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 20px;
}
.energy-baseline .bar-wrapper {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}
.energy-baseline .bar-name {
    font-size: 11px;
    color: #888;
    margin-top: 8px;
    text-align: center;
    font-weight: 500;
}

/* ---- Radar / Polar Chart (Fabric Specs) ---- */
.radar-container {
    display: flex;
    justify-content: center;
    padding: 24px;
}
.radar-svg { width: 320px; height: 320px; }
.radar-polygon {
    fill: rgba(74,144,217,0.15);
    stroke: #4a90d9;
    stroke-width: 2;
}
.radar-grid polygon {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 1;
}
.radar-label {
    font-size: 11px;
    fill: #666;
    font-family: 'Inter', sans-serif;
    text-anchor: middle;
    dominant-baseline: middle;
}
.radar-value {
    font-size: 10px;
    fill: #4a90d9;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    text-anchor: middle;
    dominant-baseline: middle;
}

/* ---- Spec Comparison Table (Enhanced) ---- */
.spec-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 20px rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.06);
}
.spec-table thead { background: #1a1a2e; }
.spec-table th {
    padding: 16px 20px;
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    text-align: left;
}
.spec-table td {
    padding: 14px 20px;
    border-bottom: 1px solid #f0f0f0;
    color: #555;
}
.spec-table tbody tr:hover { background: #f8f9fc; }
.spec-table td:first-child { font-weight: 600; color: #1a1a2e; }
.spec-table .highlight { color: #3b82f6; font-weight: 700; }

/* ---- Cooling Power Meter ---- */
.power-meter {
    text-align: center;
    padding: 32px;
}
.power-meter .meter-ring {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    margin: 0 auto 16px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.power-meter .meter-ring svg {
    transform: rotate(-90deg);
}
.power-meter .meter-ring .bg { fill: none; stroke: #f0f0f0; stroke-width: 8; }
.power-meter .meter-ring .progress {
    fill: none;
    stroke: #4a90d9;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 502.65;
    stroke-dashoffset: 502.65;
    transition: stroke-dashoffset 2s cubic-bezier(0.16, 1, 0.3, 1);
}
.power-meter .meter-ring.animated .progress { stroke-dashoffset: 50.27; } /* ~90% */
.power-meter .meter-value {
    position: absolute;
    font-size: 36px;
    font-weight: 800;
    color: #1a1a2e;
}
.power-meter .meter-value span { font-size: 16px; font-weight: 400; color: #888; }
.power-meter .meter-label {
    font-size: 14px;
    color: #888;
}
.power-meter .meter-sub {
    font-size: 12px;
    color: #aaa;
    margin-top: 4px;
}

/* ---- Cooling Timeline ---- */
.timeline-viz {
    position: relative;
    padding: 32px 0;
}
.timeline-track {
    position: relative;
    height: 6px;
    background: #f0f0f0;
    border-radius: 3px;
    margin: 60px 0 20px;
}
.timeline-progress {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, #4a90d9, #10b981);
    border-radius: 3px;
    width: 0;
    transition: width 2s cubic-bezier(0.16, 1, 0.3, 1);
}
.timeline-marker {
    position: absolute;
    top: -16px;
    transform: translateX(-50%);
    text-align: center;
    transition: left 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.timeline-marker .dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #ddd;
    display: block;
    margin: 0 auto;
    transition: all 0.3s;
}
.timeline-marker .time-label {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: #888;
    white-space: nowrap;
    font-weight: 500;
}
.timeline-marker .temp-label {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    font-weight: 700;
    color: #1a1a2e;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* ---- How It Works Steps (Visual) ---- */
.how-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    margin-top: 48px;
}
.how-step {
    text-align: center;
    padding: 32px 20px;
    background: #fff;
    border-radius: 20px;
    border: 1px solid rgba(0,0,0,0.06);
    position: relative;
    transition: transform 0.3s, box-shadow 0.3s;
}
.how-step:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,0.06); }
.how-step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1a1a2e;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    margin: 0 auto 16px;
}
.how-step-icon { font-size: 36px; margin-bottom: 12px; display: block; }
.how-step h4 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.how-step p { font-size: 14px; color: #666; line-height: 1.6; }

.how-connector {
    position: absolute;
    top: 56px;
    right: -28px;
    width: 56px;
    height: 2px;
    background: linear-gradient(90deg, #4a90d9, transparent);
}
.how-step:last-child .how-connector { display: none; }

/* ---- Product Spec Viz ---- */
.product-viz-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 24px 0;
}
.product-viz-item {
    padding: 16px;
    background: #f8f9fc;
    border-radius: 12px;
    text-align: center;
}
.product-viz-item .pv-icon { font-size: 20px; display: block; margin-bottom: 4px; }
.product-viz-item .pv-value {
    font-size: 22px;
    font-weight: 800;
    color: #1a1a2e;
    display: block;
    font-variant-numeric: tabular-nums;
}
.product-viz-item .pv-value.blue { color: #3b82f6; }
.product-viz-item .pv-value.green { color: #10b981; }
.product-viz-item .pv-value.orange { color: #f59e0b; }
.product-viz-item .pv-label {
    font-size: 11px;
    color: #888;
    display: block;
    margin-top: 2px;
}

/* ---- Animated Counter ---- */
.counter-row {
    display: flex;
    justify-content: center;
    gap: 48px;
    flex-wrap: wrap;
    margin: 40px 0;
}
.counter-item { text-align: center; }
.counter-item .num {
    font-size: 48px;
    font-weight: 800;
    color: #1a1a2e;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.counter-item .num.blue { color: #3b82f6; }
.counter-item .num.green { color: #10b981; }
.counter-item .suffix {
    font-size: 24px;
    font-weight: 600;
    color: #888;
}
.counter-item .desc {
    font-size: 13px;
    color: #888;
    margin-top: 4px;
}

/* ---- Inline Mini Charts ---- */
.mini-chart {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.mini-chart .mini-bar {
    width: 60px;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: #f0f0f0;
    display: inline-flex;
}
.mini-chart .mini-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s ease;
}
.mini-chart .mini-fill.hot { background: #ef4444; }
.mini-chart .mini-fill.cool { background: #3b82f6; }
.mini-chart .mini-text { font-size: 12px; font-weight: 600; color: #555; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .comparison-dual { grid-template-columns: 1fr; gap: 24px; }
    .thermal-visual { grid-template-columns: 1fr; }
    .how-steps { grid-template-columns: 1fr; }
    .how-connector { display: none; }
    .curve-container { height: 200px; }
    .counter-item .num { font-size: 36px; }
    .product-viz-grid { grid-template-columns: 1fr 1fr; }
    .data-grid { grid-template-columns: repeat(2, 1fr); }
    .thermal-temp { font-size: 48px; }
    .curve-legend { flex-wrap: wrap; gap: 16px; }
    .energy-baseline .bar-name { font-size: 9px; }
}

@media (max-width: 480px) {
    .data-grid { grid-template-columns: 1fr 1fr; }
    .curve-container { height: 180px; }
}
