/* TSAjera Employee Performance Dashboard */

body {
    background-color: #f5f6fa;
    font-size: 0.9rem;
}

/* Legend swatches */
.legend-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    vertical-align: middle;
    margin-right: 4px;
}

/* Metric bar container */
.metric-bar-container {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 4px;
}

.metric-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease, background-color 0.3s ease;
    width: 0%;
}

/* Group cards */
.group-card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #fff;
    overflow: hidden;
}

.group-header {
    padding: 10px 16px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    transition: background 0.2s;
}

.group-header:hover {
    background: #e9ecef;
}

.group-header .group-title {
    font-weight: 600;
    font-size: 1rem;
}

.group-header .group-metrics {
    display: flex;
    gap: 24px;
    align-items: center;
}

.group-header .metric-pill {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
}

.group-body {
    display: none;
    padding: 0;
}

.group-body.show {
    display: block;
}

/* Employee table */
.emp-table {
    width: 100%;
    margin: 0;
    font-size: 0.85rem;
}

.emp-table thead th {
    background: #f0f0f0;
    padding: 6px 12px;
    font-weight: 600;
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.emp-table tbody td {
    padding: 6px 12px;
    vertical-align: middle;
    border-bottom: 1px solid #f0f0f0;
}

.emp-table tbody tr:hover {
    background: #f8f9fa;
}

/* Inline metric bars in table */
.inline-bar-container {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 160px;
}

.inline-bar-bg {
    flex: 1;
    height: 20px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    min-width: 80px;
}

.inline-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    min-width: 2px;
}

.inline-bar-label {
    font-weight: 600;
    min-width: 48px;
    text-align: right;
    white-space: nowrap;
}

/* Target line on bars */
.inline-bar-bg .target-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #333;
    opacity: 0.5;
    z-index: 1;
}

/* Color classes for metrics */
.metric-red { color: #dc3545; }
.metric-yellow { color: #f0ad4e; }
.metric-green { color: #198754; }
.metric-blue { color: #0dcaf0; }

.bar-red { background-color: #dc3545; }
.bar-yellow { background-color: #f0ad4e; }
.bar-green { background-color: #198754; }
.bar-blue { background-color: #0dcaf0; }
.bar-nodata { background-color: #dee2e6; }

/* No timesheet data available (API permission limitation) */
.metric-nodata {
    color: #adb5bd;
    font-style: italic;
    font-weight: 400;
}

/* Principal/Supervisor badges */
.badge-principal {
    background: #6f42c1;
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 6px;
}

.badge-supervisor {
    background: #0d6efd;
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 6px;
}

/* Chevron animation */
.group-chevron {
    transition: transform 0.2s;
}

.group-chevron.open {
    transform: rotate(90deg);
}

/* Print styles */
@media print {
    .no-print { display: none !important; }
    .group-body { display: block !important; }
    body { background: #fff; font-size: 0.8rem; }
    .group-card { break-inside: avoid; }
}

/* Stacked Period/YTD row labels */
.row-label {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.row-label-period {
    background: #e2e6ea;
    color: #495057;
}

.row-label-ytd {
    background: #d1ecf1;
    color: #0c5460;
}

/* Employee name cell spanning both rows */
.emp-name-cell {
    vertical-align: middle !important;
    border-bottom: 2px solid #dee2e6 !important;
}

/* Period row: no bottom border (visually grouped with YTD) */
.emp-row-period td {
    border-bottom: 1px dashed #e9ecef;
    padding-top: 5px;
    padding-bottom: 3px;
}

/* YTD row: heavier bottom border to separate employees */
.emp-row-ytd td {
    border-bottom: 2px solid #dee2e6;
    padding-top: 3px;
    padding-bottom: 5px;
}

/* Hover both rows together */
.emp-row-period:hover,
.emp-row-period:hover + .emp-row-ytd,
.emp-row-ytd:hover {
    background: #f8f9fa;
}

/* Small text for hours */
.hours-detail {
    font-size: 0.75rem;
    color: #6c757d;
}

/* Responsive */
@media (max-width: 768px) {
    .group-header .group-metrics {
        gap: 12px;
        font-size: 0.75rem;
    }
    .inline-bar-container {
        min-width: 120px;
    }
}
