/* Phase 8 — Reports & Dashboards */

.reports-page {
    padding: 1.5rem 0;
    max-width: 1450px;
    margin: 0 auto;
}

.reports-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.reports-header h1 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
}

.reports-header h1 i {
    margin-right: 0.5rem;
    color: var(--bs-primary, #0d6efd);
}

.reports-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.kpi-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 0.9rem 1rem;
}

.kpi-card h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
}

.kpi-card p {
    margin: 0.15rem 0 0 0;
    color: #6c757d;
    font-size: 0.85rem;
}

.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1rem;
}

.chart-card,
.report-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 1rem 1.2rem;
}

.chart-card h4,
.report-card h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    font-weight: 600;
}

/* Chart.js canvas container — gives the canvas a definite height so
   Chart.js can size correctly with maintainAspectRatio:false */
.chart-canvas-wrap {
    position: relative;
    height: 280px;
    width: 100%;
}

.chart-canvas-wrap > canvas {
    max-width: 100%;
}

/* ------------------------------------------------------------------ */
/* BI-style report shell, scope line, sections and KPI polish          */
/* ------------------------------------------------------------------ */

.report-shell {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.reports-header-titles h1 {
    display: flex;
    align-items: center;
}

.report-subtitle {
    margin: 0.25rem 0 0 0;
    font-size: 0.9rem;
}

/* Scope / filter context line, mirrors a Power BI report header strip */
.report-scope {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.85rem;
    background: #eef3ff;
    border: 1px solid #d6e0ff;
    color: #274690;
    border-radius: 2rem;
    font-size: 0.82rem;
    font-weight: 600;
    width: fit-content;
}

.report-scope i {
    font-size: 0.9rem;
}

.report-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Titled visual container (KPIs / charts / tables) */
.report-section {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.report-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    border-bottom: 2px solid #eef0f3;
    padding-bottom: 0.5rem;
}

.report-section-head h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.report-section-head h2 i {
    color: var(--bs-primary, #0d6efd);
    font-size: 1rem;
}

.report-section-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* KPI cards get a left accent + hover lift for a dashboard feel */
.kpi-card {
    border-left: 4px solid var(--bs-primary, #0d6efd);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.kpi-card:hover {
    box-shadow: 0 4px 10px rgba(16, 24, 40, 0.1);
    transform: translateY(-1px);
}

/* Chart cards: soft shadow so the visual grid reads like report tiles */
.chart-card {
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
    display: flex;
    flex-direction: column;
}

.chart-card h4 {
    color: #1f2a44;
}

/* Wraps a report table so it sits in its own BI tile */
.report-table-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem 1rem;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
}

/* Quick Reports button grid — fills the card width */
.quick-reports-card {
    margin-top: 1rem;
}

.quick-reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.6rem;
}

.quick-reports-grid > .btn {
    width: 100%;
    justify-content: center;
}

.line-chart {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
    gap: 0.35rem;
    align-items: end;
    min-height: 180px;
}

.line-point {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.line-point span {
    font-size: 0.7rem;
    color: #6c757d;
}

.line-bar {
    width: 100%;
    min-height: 3px;
    background: linear-gradient(180deg, #0d6efd, #6ea8fe);
    border-radius: 0.25rem;
}

.pie-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.4rem;
}

.pie-legend li {
    display: grid;
    grid-template-columns: 18px 1fr auto;
    align-items: center;
    gap: 0.5rem;
}

.pie-color {
    width: 12px;
    height: 12px;
    border-radius: 999px;
}

.pie-color.c-1 { background: #0d6efd; }
.pie-color.c-2 { background: #6f42c1; }
.pie-color.c-3 { background: #20c997; }
.pie-color.c-4 { background: #fd7e14; }
.pie-color.c-5 { background: #dc3545; }
.pie-color.c-6 { background: #198754; }
.pie-color.c-7 { background: #0dcaf0; }
.pie-color.c-8 { background: #ffc107; }

.bar-chart {
    display: grid;
    gap: 0.45rem;
}

.bar-row {
    display: grid;
    grid-template-columns: minmax(100px, 1fr) 2fr auto;
    gap: 0.5rem;
    align-items: center;
}

.bar-label {
    font-size: 0.85rem;
    color: #495057;
}

.bar-track {
    background: #eef2f6;
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0d6efd, #6ea8fe);
    border-radius: 999px;
}

.report-table-wrap {
    overflow-x: auto;
}

.report-table {
    width: 100%;
    table-layout: fixed;
}

.report-table th,
.report-table td {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.report-table thead th {
    position: sticky;
    top: 0;
    background: #eef2f7;
    color: var(--color-primary, #23486a);
    font-weight: 700;
    border-bottom: 2px solid #d6dee8;
}

.report-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

/* Human Capital filter bar */
.hc-filter-bar {
    margin-bottom: 1rem;
}

.hc-filter-field {
    margin-bottom: 0.75rem;
}

.hc-filter-field label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: #5b6b7d;
    margin-bottom: 0.25rem;
}

.hc-filter-field .form-control {
    width: 100%;
}

.hc-filter-actions {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}

.report-summary-line {
    margin: 0.25rem 0 0.75rem;
    color: #5b6b7d;
}

.report-table th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.report-table th.sortable i {
    margin-left: 0.25rem;
    font-size: 0.7rem;
}

