:root {
    --bg-color: #05070a;
    --card-bg: rgba(16, 20, 28, 0.6);
    --accent-blue: #0070f3;
    --accent-electric: #00d4ff;
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
    --good: #10b981;
    --bad: #ef4444;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

.glass-bg {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 70% 30%, rgba(0, 112, 243, 0.15) 0%, transparent 40%),
                radial-gradient(circle at 20% 70%, rgba(0, 212, 255, 0.1) 0%, transparent 40%);
    z-index: -1;
    pointer-events: none;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #fff, var(--accent-electric));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.date-badge {
    background: rgba(0, 112, 243, 0.2);
    border: 1px solid var(--accent-blue);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 1.5rem;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
}

.kpi-card.highlight {
    background: linear-gradient(135deg, rgba(0, 112, 243, 0.3), rgba(16, 20, 28, 0.6));
    border-color: var(--accent-blue);
}

.label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.value {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0.5rem 0;
    font-family: 'Outfit', sans-serif;
}

.trend {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.main-grid, .secondary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.chart-container {
    height: 400px;
    display: flex;
    flex-direction: column;
}

.chart-container canvas {
    flex-grow: 1;
    max-height: 300px; /* Limit the canvas height to prevent expansion */
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: 24px;
}

h3 {
    font-family: 'Outfit', sans-serif;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    font-size: 1.2rem;
}

/* Funnel Styles */
.funnel-viz {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
}

.funnel-step {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.step-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.funnel-step .bar {
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}

.funnel-step .bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: var(--accent-blue);
    opacity: 0.6;
}

.funnel-step .bar.highlight::after {
    background: var(--accent-electric);
    opacity: 1;
    box-shadow: 0 0 10px var(--accent-electric);
}

.conversion-tag {
    align-self: center;
    background: rgba(0, 212, 255, 0.1);
    color: var(--accent-electric);
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid rgba(0, 212, 255, 0.2);
    font-weight: bold;
    margin: -5px 0;
    z-index: 2;
}

.insight {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 10px;
}

.insight strong {
    color: var(--accent-electric);
}

.bar {
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}

.bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 100%;
    background: var(--accent-blue);
    border-radius: 6px;
}

.bar.highlight::after {
    background: var(--accent-electric);
    box-shadow: 0 0 10px var(--accent-electric);
}

.insight {
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--glass-border);
}

td {
    padding: 1rem;
    font-size: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.good { color: var(--good); }
.bad { color: var(--bad); }

.product-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 2rem;
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-electric);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.comparison p {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.matrix-card {
    grid-column: span 2;
    overflow-x: auto;
    height: auto !important; /* Allow expansion for many accounts */
    min-height: 400px;
}

#heatmap {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.matrix-container {
    display: grid;
    grid-template-columns: 200px repeat(30, 32px);
    gap: 4px;
    padding: 4px 0;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.matrix-header-cell {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
    padding: 4px 0;
}

.matrix-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 15px;
    border-right: 1px solid var(--glass-border);
}

.matrix-cell {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

.matrix-cell:hover {
    border: 1px solid var(--accent-electric);
    color: #fff;
    transform: scale(1.1);
    z-index: 10;
}

.intensity-1 { background: rgba(0, 112, 243, 0.15); }
.intensity-2 { background: rgba(0, 112, 243, 0.3); }
.intensity-3 { background: rgba(0, 112, 243, 0.5); }
.intensity-4 { background: rgba(0, 112, 243, 0.7); }
.intensity-5 { background: var(--accent-blue); box-shadow: 0 0 8px var(--accent-blue); color: #fff; }

/* Responsive Design */
@media (max-width: 1200px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
    .matrix-card {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .top-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-card h2 {
        font-size: 1.2rem;
    }

    .main-grid, .secondary-grid {
        grid-template-columns: 1fr;
    }

    .chart-container {
        height: 350px;
        padding: 1rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .matrix-container {
        grid-template-columns: 120px repeat(30, 32px); /* Smaller label for mobile */
    }

    .matrix-label {
        font-size: 0.75rem;
        padding-right: 8px;
    }
}

@media (max-width: 480px) {
    .top-stats {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        height: 300px;
    }
}

/* Month Selector Tabs */
.month-selector {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 4px;
    border-radius: 30px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(8px);
}

.month-tab {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-secondary);
    padding: 0.5rem 1.2rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Inter', sans-serif;
}

.month-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.month-tab.active {
    background: var(--accent-blue);
    color: #fff;
    box-shadow: 0 0 12px rgba(0, 112, 243, 0.4);
}

