/* ============================================
   ECAI Dashboard v2 — Light Pearl Theme
   ============================================ */

/* --- Material Symbols helper --- */
.material-symbols-rounded {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    vertical-align: middle;
    user-select: none;
}
.icon-filled {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* --- KPI Cards --- */
.kpi-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 1.25rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.02);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                border-color 0.3s ease;
}
.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.1);
}

.kpi-value {
    font-weight: 700;
    font-size: 1.75rem;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.kpi-label {
    font-weight: 500;
    font-size: 0.8125rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.kpi-sub {
    font-weight: 400;
    font-size: 0.75rem;
    margin-top: 0.375rem;
    opacity: 0.5;
}

.kpi-icon-wrapper {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Chart Containers --- */
.chart-container {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 1.25rem;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.02);
    transition: border-color 0.3s ease;
}
.chart-container:hover {
    border-color: rgba(0, 0, 0, 0.1);
}

/* --- Tables (Apple-grade) --- */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8125rem;
}
.data-table thead th {
    font-weight: 500;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(100, 116, 139, 0.7);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    text-align: right;
}
.data-table thead th:first-child {
    text-align: left;
}
.data-table tbody td {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    color: #475569;
}
.data-table tbody tr {
    transition: background 0.15s ease;
}
.data-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}
.data-table .row-bold td {
    font-weight: 600;
    background: rgba(0, 0, 0, 0.02);
    color: #1e293b;
}

/* --- Amount colors --- */
.amount-positive { color: #059669; }
.amount-negative { color: #dc2626; }

/* --- Detail expandable rows --- */
.detail-row {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.detail-row.expanded {
    max-height: 3000px;
}

.detail-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-radius: 0.875rem;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    color: inherit;
    font: inherit;
}
.detail-toggle:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
}

.detail-toggle .chevron {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-size: 1.25rem;
    opacity: 0.4;
}
.detail-toggle.open .chevron {
    transform: rotate(180deg);
}

/* --- Incidence bar --- */
.incidence-bar {
    height: 0.375rem;
    border-radius: 0.1875rem;
    transition: width 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* --- Scrollbar (minimal) --- */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.12); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.2); }

/* --- Smooth page load --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-in {
    animation: fadeInUp 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    opacity: 0;
}
.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.1s; }
.delay-3 { animation-delay: 0.15s; }
.delay-4 { animation-delay: 0.2s; }
.delay-5 { animation-delay: 0.25s; }

/* --- Responsive --- */
@media (max-width: 768px) {
    .kpi-value { font-size: 1.375rem; }
    .chart-container { padding: 1.25rem; }
}
