/* tanso.in — Dashboard Analytics Dark */

/* ===== CSS Custom Properties ===== */
:root {
    --carbon-dark: #0D1117;
    --panel-surface: #161B22;
    --raised-surface: #21262D;
    --border-color: #30363D;
    --light-text: #C9D1D9;
    --muted-text: #8B949E;
    --data-blue: #58A6FF;
    --growth-green: #3FB950;
    --alert-red: #F85149;
    --caution-yellow: #D29922;
}

/* ===== Reset ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== Body ===== */
body {
    background: var(--carbon-dark);
    color: var(--muted-text);
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 1.55;
}

/* ===== Typography ===== */
.section-heading {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 22px;
    color: var(--light-text);
    text-align: center;
    margin-bottom: 1.5rem;
}

.subsection-heading {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 18px;
    color: var(--light-text);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

/* ===== Top Navigation Bar ===== */
.topbar {
    max-width: 960px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.topbar-brand {
    font-weight: 600;
    font-size: 18px;
    color: var(--light-text);
    letter-spacing: -0.02em;
}

.metric-chips {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.chip {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--muted-text);
    background: var(--panel-surface);
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.chip strong {
    color: var(--light-text);
}

.chip .trend-up {
    color: var(--alert-red);
}

/* ===== Hero / Command Center ===== */
.hero {
    max-width: 960px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
}

.hero-title {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 28px;
    color: var(--light-text);
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-size: 14px;
    color: var(--muted-text);
    margin-bottom: 1.5rem;
}

.stacked-bar-container {
    margin-bottom: 2rem;
}

.stacked-bar {
    display: flex;
    height: 32px;
    border-radius: 4px;
    overflow: hidden;
}

.bar-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    width: 0;
    transition: width 0.8s ease;
}

.seg-energy {
    background: var(--data-blue);
}

.seg-industry {
    background: var(--growth-green);
}

.seg-transport {
    background: var(--caution-yellow);
}

.seg-agri {
    background: var(--alert-red);
}

.seg-label {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    color: var(--carbon-dark);
    font-weight: 600;
    white-space: nowrap;
}

.bar-legend {
    display: flex;
    gap: 1.25rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--muted-text);
}

.legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.swatch-energy {
    background: var(--data-blue);
}

.swatch-industry {
    background: var(--growth-green);
}

.swatch-transport {
    background: var(--caution-yellow);
}

.swatch-agri {
    background: var(--alert-red);
}

.hero-aggregates {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.aggregate {
    background: var(--panel-surface);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem 1.5rem;
    flex: 1;
    min-width: 140px;
}

.agg-value {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    font-size: 28px;
    font-variant-numeric: tabular-nums;
    color: var(--light-text);
    display: block;
    line-height: 1.2;
}

.agg-unit {
    font-size: 12px;
    color: var(--muted-text);
    display: block;
    margin-top: 2px;
}

/* ===== Sector Analysis Metric Tiles ===== */
.metrics {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem;
}

.metric-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.metric-tile {
    background: var(--panel-surface);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1.25rem;
    transition: border-color 0.2s ease;
}

.metric-tile:hover {
    border-color: var(--raised-surface);
}

.tile-label {
    font-size: 12px;
    color: var(--muted-text);
    display: block;
    margin-bottom: 0.25rem;
}

.tile-num {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    font-size: 28px;
    font-variant-numeric: tabular-nums;
    color: var(--light-text);
    display: block;
    line-height: 1.2;
}

.tile-unit {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--muted-text);
    display: block;
    margin-bottom: 0.5rem;
}

.tile-trend-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.tile-trend {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: center;
    gap: 3px;
}

.tile-trend.up {
    color: var(--alert-red);
}

.tile-trend.down {
    color: var(--growth-green);
}

.trend-arrow {
    width: 10px;
    height: 10px;
    fill: var(--alert-red);
}

.down-arrow {
    fill: var(--growth-green);
}

.tile-period {
    font-size: 11px;
    color: var(--muted-text);
}

/* Sparkline charts */
.sparkline-container {
    margin-top: 0.25rem;
    height: 30px;
    overflow: hidden;
}

.sparkline {
    width: 100%;
    height: 100%;
}

.sparkline-area {
    fill: var(--alert-red);
    opacity: 0.15;
}

.sparkline-area-green {
    fill: var(--growth-green);
    opacity: 0.15;
}

.sparkline-line {
    fill: none;
    stroke: var(--alert-red);
    stroke-width: 1.5;
    opacity: 0.6;
}

.sparkline-line-green {
    stroke: var(--growth-green);
}

/* ===== Geography Section ===== */
.geography {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem;
}

.geo-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

.map-panel {
    background: var(--panel-surface);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.india-map {
    width: 100%;
    max-width: 320px;
    height: auto;
}

.state {
    stroke: var(--carbon-dark);
    stroke-width: 1.5;
    cursor: pointer;
    transition: opacity 0.2s ease, stroke 0.2s ease;
}

.state:hover {
    stroke: var(--data-blue);
    stroke-width: 2;
}

.map-intensity-scale {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 1rem;
    width: 100%;
    max-width: 240px;
}

.scale-label {
    font-size: 11px;
    color: var(--muted-text);
    white-space: nowrap;
}

.scale-gradient {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, var(--muted-text), var(--caution-yellow), var(--alert-red));
}

.geo-detail-panel {
    background: var(--panel-surface);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1.25rem;
}

.geo-panel-title {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--light-text);
    margin-bottom: 1rem;
}

.geo-table {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.geo-row {
    display: grid;
    grid-template-columns: 1fr 60px 80px;
    gap: 0.5rem;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--raised-surface);
    transition: background 0.15s ease;
}

.geo-row:hover:not(.geo-header-row) {
    background: rgba(88, 166, 255, 0.05);
}

.geo-header-row {
    border-bottom: 1px solid var(--border-color);
}

.geo-cell {
    font-size: 12px;
    color: var(--muted-text);
}

.geo-header-row .geo-cell {
    font-weight: 600;
    color: var(--light-text);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.geo-cell-val {
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.geo-cell-state {
    color: var(--light-text);
}

.geo-cell-int {
    display: flex;
    align-items: center;
}

.intensity-bar {
    display: block;
    height: 6px;
    border-radius: 3px;
    width: var(--bar-pct);
    background: linear-gradient(to right, var(--caution-yellow), var(--alert-red));
    transition: width 0.5s ease;
}

/* ===== Compliance Section ===== */
.compliance {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem;
}

.compliance-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.comp-row {
    background: var(--panel-surface);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    transition: border-color 0.2s ease;
}

.comp-row:hover {
    border-color: var(--raised-surface);
}

.comp-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.comp-name {
    font-size: 14px;
    color: var(--light-text);
}

.comp-desc {
    font-size: 12px;
    color: var(--muted-text);
}

.comp-status {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.comp-status.active {
    background: rgba(63, 185, 80, 0.15);
    color: var(--growth-green);
}

.comp-status.pending {
    background: rgba(210, 153, 34, 0.15);
    color: var(--caution-yellow);
}

/* Benchmark comparison chart */
.benchmark-chart {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.bench-row {
    display: grid;
    grid-template-columns: 140px 1fr 80px;
    gap: 0.75rem;
    align-items: center;
}

.bench-label {
    font-size: 12px;
    color: var(--muted-text);
    text-align: right;
}

.bench-bar-track {
    background: var(--raised-surface);
    border-radius: 4px;
    height: 16px;
    overflow: hidden;
}

.bench-bar {
    height: 100%;
    border-radius: 4px;
    width: var(--bench-pct);
    transition: width 0.6s ease;
}

.bench-bar-you {
    background: var(--data-blue);
}

.bench-bar-avg {
    background: var(--caution-yellow);
}

.bench-bar-best {
    background: var(--growth-green);
}

.bench-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--light-text);
}

/* ===== Footer ===== */
.footer {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.footer-status {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    margin-bottom: 1rem;
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--growth-green);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

.status-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--muted-text);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.flink {
    font-size: 13px;
    color: var(--data-blue);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.flink:hover {
    opacity: 0.8;
}

.footer-copy {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--muted-text);
}

/* ===== State Tooltip ===== */
.state-tooltip {
    position: fixed;
    background: var(--raised-surface);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 6px 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--light-text);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 1000;
    white-space: nowrap;
}

.state-tooltip.visible {
    opacity: 1;
}

/* ===== Fade-in Animation ===== */
.fade-in {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Responsive ===== */
@media (max-width: 700px) {
    .metric-tiles {
        grid-template-columns: 1fr 1fr;
    }

    .geo-layout {
        grid-template-columns: 1fr;
    }

    .hero-aggregates {
        flex-direction: column;
    }

    .bench-row {
        grid-template-columns: 100px 1fr 60px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .metric-tiles {
        grid-template-columns: 1fr;
    }

    .bench-row {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .bench-label {
        text-align: left;
    }
}
