/* --- Stats Page Styles (V7 - The Final, Bulletproof Fix) --- */

.stats-container {
    width: 100%;
    max-width: 1200px;
    padding: 0 15px;
}

.stats-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: #1c1e21;
    margin-bottom: 8px;
}

.stats-header p {
    font-size: 15px;
    color: #606770;
    margin-bottom: 30px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: #ffffff;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #e9e9ed;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.stat-card h3 {
    font-size: 12px;
    color: #333;
    margin: 10px 0 5px 0;
    font-weight: 600;
    text-align: center;
}

.stat-card p {
    font-size: 18px;
    font-weight: 700;
    color: #007aff;
    margin: 0;
}

.stat-card .card-icon {
    font-size: 22px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.charts-area {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.chart-container {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e9e9ed;
    /* --- THE GUARANTEED FIX --- */
    position: relative; /* 1. Set the container to relative */
    height: 300px; /* 2. Give it a fixed height for consistency */
}

.chart-container canvas {
    /* 3. Force the canvas to fill the container perfectly */
    position: absolute;
    top: 50px; /* Space for the title */
    left: 15px;
    right: 15px;
    bottom: 15px;
    width: calc(100% - 30px) !important; 
    height: calc(100% - 65px) !important;
}

.chart-container h2 {
    text-align: right;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: #333;
}

/* --- Tablet & Medium Screens --- */
@media (min-width: 768px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); gap: 20px; }
    .charts-area { grid-template-columns: 1fr 1fr; gap: 25px; }
    .chart-container.full-width { grid-column: 1 / -1; }
    .chart-container { height: 350px; } /* Taller on larger screens */
}

/* --- Desktop & Large Screens --- */
@media (min-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}
