/* =====================================================
 * 12-views-stats.css - Modern Analytics Dashboard
 * ===================================================== */

.stats-view-container {
    animation: fadeIn 0.4s ease;
}

/* ── KPI Grid ── */
.stats-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stats-row-header {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f1f5f9;
}

.stats-kpi-card {
    background: white;
    border: 1px solid var(--border);
    padding: 12px 20px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 80px;
}

.stats-kpi-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.03);
}

.stats-kpi-icon-box {
    width: 44px;
    height: 44px;
    background: #f1f0fa;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.stats-kpi-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stats-kpi-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.stats-kpi-value {
    font-size: 1.4rem;
    font-weight: 900;
    font-family: 'RTA', sans-serif;
    line-height: 1.2;
}

/* Merged Expense Card Specifics */
.stats-kpi-card-merged {
    grid-column: span 2;
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 12px 24px;
}

.stats-kpi-card-merged .stats-kpi-content {
    border-left: 1px solid #f1f5f9;
    padding-left: 20px;
    margin-left: 20px;
}

.stats-kpi-card-merged .stats-kpi-breakdown {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 180px;
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
}

.breakdown-row span:last-child {
    color: var(--text-dark);
    font-family: 'RTA', sans-serif;
}

.breakdown-row.total-row {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px dashed #e2e8f0;
    font-size: 0.9rem;
    color: var(--text-dark);
}

/* Delta Indicators */
.stats-delta {
    font-size: 0.75rem;
    font-weight: 700;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.stats-delta.up { color: #10b981; }
.stats-delta.down { color: #ef4444; }

/* ── Dashboard Grid ── */
.stats-main-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
}

.stats-grid-balanced {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.stats-section-card {
    background: white;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.stats-section-header {
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stats-section-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.stats-section-body {
    padding: 20px;
    flex: 1;
}

/* ── Top Products Table ── */
.stats-mini-table {
    width: 100%;
    border-collapse: collapse;
}

.stats-mini-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #f8fafc;
    font-size: 0.9rem;
}

.stats-mini-table td:first-child {
    padding-right: 24px;
    padding-left: 24px;
}

.stats-mini-table td:last-child {
    padding-left: 24px;
    padding-right: 24px;
}

.stats-mini-table tr:first-child td {
    padding-top: 20px;
}

.stats-mini-table tr:last-child td {
    padding-bottom: 20px;
    border-bottom: none;
}

.product-rank {
    width: 24px;
    height: 24px;
    background: #f1f5f9;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.product-row-info {
    flex: 1;
}

.product-row-name {
    font-weight: 700;
    color: var(--text-dark);
    display: block;
    margin-bottom: 2px;
}

.product-row-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.product-row-value {
    font-family: 'RTA', sans-serif;
    font-weight: 800;
    color: var(--primary);
    text-align: left;
}

@media (max-width: 1100px) {
    .stats-main-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 800px) {
    .stats-kpi-card-merged {
        grid-column: span 1;
        flex-direction: column;
        align-items: flex-start;
    }
    .stats-kpi-card-merged .stats-kpi-content {
        border-left: none;
        padding-left: 0;
        margin-left: 0;
        margin-bottom: 12px;
    }
}
