.impact-page {
    background: #f1f5f9;
    color: #333;
    min-height: 100vh;
}

.impact-main {
    padding: 48px 40px 64px;
}

.impact-container {
    max-width: 1200px;
    margin: 0 auto;
}

.impact-title {
    text-align: center;
    font-size: 32px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 40px 0;
}

/* Metric Cards */
.impact-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.impact-card {
    background: #fff;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    position: relative;
}

.impact-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.impact-card-icon.blue {
    background: #dbeafe;
}
.impact-card-icon.blue svg { stroke: #2563eb; }

.impact-card-icon.green {
    background: #dcfce7;
}
.impact-card-icon.green svg { stroke: #16a34a; }

.impact-card-icon.purple {
    background: #f3e8ff;
}
.impact-card-icon.purple svg { stroke: #7c3aed; }

.impact-card-icon.orange {
    background: #ffedd5;
}
.impact-card-icon.orange svg { stroke: #ea580c; }

.impact-card-value {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.impact-card-label {
    font-size: 15px;
    font-weight: 600;
    color: #374151;
}

.impact-card-sub {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
}

.impact-card-change {
    position: absolute;
    top: 24px;
    right: 24px;
    font-size: 13px;
    font-weight: 600;
}

.impact-card-change.positive {
    color: #16a34a;
}

.impact-card-badge {
    position: absolute;
    top: 24px;
    right: 24px;
    font-size: 12px;
    font-weight: 600;
    background: #2563eb;
    color: #fff;
    padding: 4px 10px;
    border-radius: 20px;
}

/* Tabs */
.impact-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
}

.impact-tab {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    background: #e2e8f0;
    color: #64748b;
}

.impact-tab.active {
    background: #fff;
    color: #1e293b;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.impact-tab:hover:not(.active) {
    background: #cbd5e1;
}

/* Charts */
.impact-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 40px;
}

.impact-chart-card {
    background: #fff;
    padding: 28px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.impact-chart-card h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 8px 0;
}

.impact-chart-desc {
    font-size: 14px;
    color: #64748b;
    margin: 0 0 20px 0;
}

.impact-line-chart {
    position: relative;
}

.impact-line-chart .trend-chart {
    width: 100%;
    height: auto;
}

.chart-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    padding: 0 10px;
    font-size: 12px;
    color: #64748b;
}

.impact-donut-legend {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 40px; /* Increased gap for better spacing */
    margin-top: 16px;
}

.impact-donut-wrap {
    width: 160px; /* Made slightly larger to fit the card perfectly */
    height: 160px;
    flex-shrink: 0;
}

.donut-chart {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg); /* Rotates the chart so it starts at 12 o'clock */
    overflow: visible;
}

/* --- THE DRAWING ANIMATION --- */
.donut-slice {
    /* Uses a custom cubic-bezier for a smooth, natural easing */
    animation: drawCircle 1s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

/* Chart Filter Buttons */
.chart-filters {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 6px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    background: #f8fafc;
    color: #475569;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    background: #e2e8f0;
}

.filter-btn.active {
    background: #3b82f6; /* ShareCircle Blue */
    color: white;
    border-color: #3b82f6;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

@keyframes drawCircle {
    0% {
        stroke-dasharray: 0 251.2;
    }
    100% {
        /* This pulls the specific size from the HTML inline style! */
        stroke-dasharray: var(--target-dasharray);
    }
}

.impact-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 14px;
    color: #475569;
}

/* Staggered fade-in animation for the legend items */
.impact-legend li {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    animation: fadeRight 0.5s ease forwards;
}

.impact-legend li:nth-child(1) { animation-delay: 0.1s; }
.impact-legend li:nth-child(2) { animation-delay: 0.2s; }
.impact-legend li:nth-child(3) { animation-delay: 0.3s; }
.impact-legend li:nth-child(4) { animation-delay: 0.4s; }

@keyframes fadeRight {
    0% { opacity: 0; transform: translateX(-10px); }
    100% { opacity: 1; transform: translateX(0); }
}

.impact-legend .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.impact-legend .dot.blue { background: #3b82f6; }
.impact-legend .dot.green { background: #22c55e; }
.impact-legend .dot.orange { background: #f97316; }
.impact-legend .dot.purple { background: #a855f7; }
.impact-legend .dot.gray { background: #94a3b8; }

/* Recent Impact Stories */
.impact-stories {
    background: #fff;
    padding: 32px 28px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.impact-stories h2 {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 8px 0;
}

.impact-stories-sub {
    font-size: 14px;
    color: #64748b;
    margin: 0 0 24px 0;
}

.impact-story-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.impact-story-card {
    display: flex;
    gap: 20px;
    padding: 24px 0;
    border-bottom: 1px solid #e5e7eb;
    border-left: 4px solid transparent;
    padding-left: 20px;
    margin-left: -20px;
}

.impact-story-card:last-child {
    border-bottom: none;
}

.impact-story-card.blue { border-left-color: #2563eb; }
.impact-story-card.green { border-left-color: #16a34a; }
.impact-story-card.purple { border-left-color: #7c3aed; }

.impact-story-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.impact-story-icon.blue {
    background: #dbeafe;
}
.impact-story-icon.blue svg { stroke: #2563eb; }

.impact-story-icon.green {
    background: #dcfce7;
}
.impact-story-icon.green svg { stroke: #16a34a; }

.impact-story-icon.purple {
    background: #f3e8ff;
}
.impact-story-icon.purple svg { stroke: #7c3aed; }

.impact-story-body h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 8px 0;
}

.impact-story-body p {
    font-size: 14px;
    color: #475569;
    line-height: 1.6;
    margin: 0 0 8px 0;
}

.impact-story-body time {
    font-size: 13px;
    color: #64748b;
}

@media (max-width: 900px) {
    .impact-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .impact-charts {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .impact-cards {
        grid-template-columns: 1fr;
    }

    .impact-tabs {
        flex-wrap: wrap;
    }
}

/* =========================================
   Impact Tab Content Switching
   ========================================= */
.impact-tab-content {
    display: none; /* Hide all content by default */
    animation: fadeIn 0.3s ease-in-out;
}

.impact-tab-content.active {
    display: block; /* Show only the active content */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.distributions-list th {
    text-align: left;
    padding: 14px 12px;
    border-bottom: 2px solid #e2e8f0;
    color: #64748b;
    font-weight: 600;
    font-size: 14px;
}

.distributions-list td {
    text-align: left;
    padding: 16px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: #374151;
    font-size: 15px;
    vertical-align: middle;
}

/* Responsive Table Wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Enables smooth swiping on iPhones */
    padding-bottom: 8px; /* Gives a little breathing room for the scrollbar */
}

.distributions-list table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px; /* Forces the table to stay wide so it scrolls instead of squishing! */
}

.distributions-list th, .distributions-list td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
}

/* =========================================
   Impact Tab Content Switching
   ========================================= */
.impact-tab-content {
    display: none; /* Hide all content by default */
    animation: fadeIn 0.3s ease-in-out;
}

.impact-tab-content.active {
    display: block; /* Show only the active content */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.distributions-list {
    background: #fff;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.distributions-list table {
    width: 100%;
    border-collapse: collapse;
}

.distributions-list th, .distributions-list td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
}

/* =========================================
   Mobile Fixes for Impact Charts
   ========================================= */
@media (max-width: 768px) {
    /* 1. Reduce the thick page padding so cards have more room to breathe */
    .impact-main {
        padding: 32px 16px 64px; 
    }

    /* 2. Reduce the padding inside the cards slightly */
    .impact-chart-card {
        padding: 24px 16px;
    }

    /* 3. Stack the donut and the legend vertically */
    .impact-donut-legend {
        flex-direction: column;
        gap: 20px;
        align-items: center; /* Centers the donut */
    }

    /* 4. Make the legend stretch neatly under the donut */
    .impact-legend {
        width: 100%;
        max-width: 240px; /* Keeps the list looking neat and centered */
    }
}
