/* KPI Dashboard — Cards: KPI Grid, Card Styling, Icons, Trends, Lapsed Advertisers */

/* Categorical Color System — Mockup HUD Palette */
:root {
    --color-growth: #10b981;
    --color-electric-blue: #00A3FF;
    --color-magenta: #D000FF;
    --color-gold: #FFB800;
}

/* ================================================================
   KPI CARDS â€” True Glassmorphism
   ================================================================ */
/* ================================================================
   MOCKUP STYLES: KPI CARDS & TREND PILLS
   ================================================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.kpi-grid.kpi-grid-3 {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.kpi-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: rgba(20, 24, 40, 0.65);
    /* Dark frosted glass */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    /* Subtle rim light */

    /* The Mockup Magic: Dynamic glowing bottom border */
    border-bottom: 2px solid var(--kpi-color, var(--teal));
    box-shadow:
        0 8px 24px -4px rgba(0, 0, 0, 0.5),
        /* Standard drop shadow */
        0 8px 12px -6px var(--kpi-color, var(--teal)),
        /* Neon underglow */
        inset 0 1px 1px rgba(255, 255, 255, 0.05);
    /* Inner casing highlight */

    padding: 24px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: default;
}

.kpi-card:hover {
    transform: translateY(-4px);
    background: rgba(28, 34, 55, 0.85);
    box-shadow:
        0 12px 32px -4px rgba(0, 0, 0, 0.6),
        0 12px 16px -6px var(--kpi-color, var(--teal)),
        inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

.kpi-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    margin-bottom: 12px;
    position: relative;
    z-index: 2;
}

.kpi-data-wrapper {
    position: relative;
    z-index: 2;
    flex: 1;
    margin-bottom: 30px;
    /* Space for sparkline */
}

.kpi-value {
    font-size: 2rem;
    /* Scaled up to match mockup */
    font-weight: 800;
    color: #FFFFFF;
    line-height: 1.1;
    margin-bottom: 6px;
}

.kpi-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #8B95A5;
    /* Muted secondary text */
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* The Glowing Percentage Pills */
.kpi-trend {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;

    /* Dynamically inherits the card's specific color */
    color: var(--kpi-color);
    border: 1px solid var(--kpi-color);
    background: rgba(255, 255, 255, 0.05);
    /* Fallback */
    background: color-mix(in srgb, var(--kpi-color) 12%, transparent);
    box-shadow: inset 0 0 8px color-mix(in srgb, var(--kpi-color) 20%, transparent);
}

.kpi-sparkline-canvas {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 45px;
    z-index: 1;
    opacity: 0.9;
    pointer-events: none;
}

/* Sparkline data pulse on card hover */
.kpi-card:hover .kpi-sparkline-canvas {
    opacity: 1;
    filter: brightness(1.3);
}

/* Volumetric 3D Icons */
.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.kpi-icon.green {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.06));
    color: var(--green);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.kpi-icon.blue {
    background: linear-gradient(135deg, rgba(0, 163, 255, 0.2), rgba(0, 163, 255, 0.06));
    color: #00A3FF;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.kpi-icon.teal {
    background: linear-gradient(135deg, rgba(0, 163, 255, 0.2), rgba(0, 163, 255, 0.06));
    color: #00A3FF;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.kpi-icon.purple {
    background: linear-gradient(135deg, rgba(208, 0, 255, 0.2), rgba(208, 0, 255, 0.06));
    color: #D000FF;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.kpi-icon.amber {
    background: linear-gradient(135deg, rgba(255, 184, 0, 0.2), rgba(255, 184, 0, 0.06));
    color: #FFB800;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ----------------------------------------------------------------
   KPI HEADER ROW â€” icon left, trend pill right
   ---------------------------------------------------------------- */
.kpi-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    margin-bottom: 8px;
    position: relative;
    z-index: 2;
}

/* ----------------------------------------------------------------
   KPI DATA WRAPPER â€” big number + label
   ---------------------------------------------------------------- */
.kpi-data-wrapper {
    position: relative;
    z-index: 2;
    flex: 1;
    margin-bottom: 40px;
}

/* Crisp primary metrics — tabular nums for stable columns */
.kpi-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: #FFFFFF;
    line-height: 1.1;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* Technical readout labels */
.kpi-label {
    font-size: 13px;
    font-weight: 600;
    color: #B0B8C8;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0;
}

/* ----------------------------------------------------------------
   KPI TREND â€” sleek pill badge
   ---------------------------------------------------------------- */
.kpi-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
    text-shadow: none;
    position: relative;
    z-index: 2;
}

.kpi-trend.positive {
    color: #4FFFDD;
    background: rgba(0, 255, 204, 0.12);
    border: 1px solid rgba(0, 255, 204, 0.25);
}

.kpi-trend.negative {
    color: #FF6B6B;
    background: rgba(255, 77, 77, 0.12);
    border: 1px solid rgba(255, 77, 77, 0.25);
}

/* Legacy support */
.kpi-trend.up {
    color: #4FFFDD;
    background: rgba(0, 255, 204, 0.12);
    border: 1px solid rgba(0, 255, 204, 0.25);
}

.kpi-trend.down {
    color: #FF6B6B;
    background: rgba(255, 77, 77, 0.12);
    border: 1px solid rgba(255, 77, 77, 0.25);
}

/* Trend arrow breathing animation */
.kpi-trend svg {
    animation: trendBob 3s ease-in-out infinite;
}

@keyframes trendBob {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-2px);
    }
}

/* ================================================================
   SKELETON LOADING â€” Neural Pulse
   ================================================================ */
.skeleton-shape {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.skeleton-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.skeleton-trend {
    width: 80px;
    height: 24px;
    border-radius: 12px;
}

.skeleton-value {
    width: 60%;
    height: 36px;
    margin-bottom: 8px;
}

.skeleton-label {
    width: 40%;
    height: 16px;
}

.skeleton-graph {
    width: 100%;
    height: 100%;
    border-radius: 0 0 12px 12px;
}

.skeleton-shape::after {
    content: "";
    position: absolute;
    top: 0;
    left: -150%;
    width: 150%;
    height: 100%;
    background: linear-gradient(90deg,
            rgba(0, 229, 255, 0) 0%,
            rgba(0, 229, 255, 0.1) 50%,
            rgba(255, 255, 255, 0.15) 50%,
            rgba(0, 229, 255, 0) 100%);
    animation: neural-shimmer 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes neural-shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* ================================================================
   CUSTOM CHART TOOLTIP â€” Targeting Reticle System
   ================================================================ */

/* The vertical tracking line â€” a scanning laser */
.chart-tracking-line {
    position: absolute;
    width: 1px;
    height: 100%;
    top: 0;
    background: linear-gradient(to bottom,
            rgba(0, 229, 255, 0) 0%,
            rgba(0, 229, 255, 0.5) 50%,
            rgba(0, 229, 255, 0) 100%);
    pointer-events: none;
    z-index: 10;
    transition: left 0.05s linear;
}

/* The lock-on reticle node */
.chart-target-node {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #0D111A;
    border: 2px solid #00E5FF;
    border-radius: 50%;
    box-shadow:
        0 0 12px rgba(0, 229, 255, 0.8),
        inset 0 0 4px rgba(0, 229, 255, 0.5);
    transition: all 0.1s cubic-bezier(0.25, 0.8, 0.25, 1);
    transform: translate(-50%, -50%);
    z-index: 11;
    pointer-events: none;
    animation: reticle-pulse 1.5s infinite;
}

@keyframes reticle-pulse {
    0% {
        box-shadow: 0 0 12px rgba(0, 229, 255, 0.8), inset 0 0 4px rgba(0, 229, 255, 0.5);
    }

    50% {
        box-shadow: 0 0 20px rgba(0, 229, 255, 1), inset 0 0 6px rgba(0, 229, 255, 0.7);
    }

    100% {
        box-shadow: 0 0 12px rgba(0, 229, 255, 0.8), inset 0 0 4px rgba(0, 229, 255, 0.5);
    }
}

/* Glassmorphic data readout panel */
.chart-tooltip-panel {
    position: absolute;
    background: rgba(13, 17, 26, 0.85);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(0, 229, 255, 0.5);
    border-radius: 6px;
    padding: 12px 16px;
    color: #FFFFFF;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    z-index: 12;
    pointer-events: none;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.chart-tooltip-panel.visible {
    opacity: 1;
}

.tooltip-date {
    font-size: 13px;
    color: #8B95A5;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.tooltip-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.tooltip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tooltip-label {
    font-size: 13px;
    color: #8B95A5;
}

.tooltip-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: #00E5FF;
    margin-left: auto;
}

.tooltip-value.goal {
    color: #8B95A5;
}

/* ================================================================
   CHART CARDS
   ================================================================ */
.chart-card {
    background: rgba(13, 17, 26, 0.4);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.section-controls {
    display: flex;
    gap: 8px;
}

.section-exports {
    display: flex;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}

/* Export CSV button in scraper section â€” aligned right */
.btn-export-csv {
    background: rgba(13, 17, 26, 0.5);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #8B95A5;
    padding: 5px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    margin-left: auto;
}

.btn-export-csv:hover {
    color: #00E5FF;
    border-color: rgba(0, 229, 255, 0.3);
    background: rgba(0, 229, 255, 0.06);
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.15), 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Time toggle chips â€” premium pill buttons */
.chip {
    background: transparent;
    border: 1px solid transparent;
    color: #8B95A5;
    padding: 6px 16px;
    border-radius: 99px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.chip:hover {
    color: #00E5FF;
    background: rgba(0, 229, 255, 0.06);
    border-color: rgba(0, 229, 255, 0.15);
}

.chip.active {
    background: rgba(0, 229, 255, 0.15);
    border-color: rgba(0, 229, 255, 0.3);
    color: #00E5FF;
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
}

/* ================================================================
   LAPSED ADVERTISERS TABLE
   ================================================================ */
.table-card {
    background: rgba(13, 17, 26, 0.4);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    background: rgba(13, 17, 26, 0.6);
    padding: 14px 16px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #8B95A5;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    transition: all 0.2s ease;
}

/* Laser scan row hover */
.data-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(0, 229, 255, 0.05) 0%, transparent 100%);
}

.data-table tbody tr:hover td {
    color: #FFFFFF;
}

.data-table tbody td {
    padding: 14px 16px;
    font-size: 13px;
    color: #E2E8F0;
    transition: color 0.2s ease;
}

.risk-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}

.risk-dot.high {
    background: var(--red);
    box-shadow: 0 0 8px var(--red-glow);
}

.risk-dot.medium {
    background: var(--amber);
    box-shadow: 0 0 8px var(--amber-glow);
}

.risk-dot.low {
    background: var(--green);
    box-shadow: 0 0 8px var(--green-glow);
}

/* Status badge â€” translucent neon readouts */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.status-badge.contacted {
    background: rgba(0, 255, 204, 0.1);
    border: 1px solid rgba(0, 255, 204, 0.2);
    color: #00FFCC;
}

.status-badge.not-contacted {
    background: rgba(255, 77, 77, 0.1);
    border: 1px solid rgba(255, 77, 77, 0.3);
    color: #FF4D4D;
    box-shadow: 0 0 8px rgba(255, 77, 77, 0.15);
}

.status-badge.scheduled {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #60A5FA;
}

/* Action button â€” tactical command control */
.btn-action {
    background: rgba(0, 229, 255, 0.05);
    border: 1px solid rgba(0, 229, 255, 0.2);
    color: #00E5FF;
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-action:hover {
    background: rgba(0, 229, 255, 0.15);
    border-color: rgba(0, 229, 255, 0.6);
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(0, 229, 255, 0.3), inset 0 0 8px rgba(0, 229, 255, 0.1);
    transform: translateY(-2px);
}

.btn-action:active {
    transform: translateY(0);
    background: rgba(0, 229, 255, 0.25);
    box-shadow: 0 2px 4px rgba(0, 229, 255, 0.2);
}