/* ============================================================
   styles/modules/performance_hr.css — Hiệu suất Nhân sự
   ============================================================ */

/* ── Loading spinner ───────────────────────────────────────── */
#hr-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 14px;
}
#hr-loading i { font-size: 24px; animation: hr-spin 1s linear infinite; }
@keyframes hr-spin { to { transform: rotate(360deg); } }

/* ── Filter bar ────────────────────────────────────────────── */
.hr-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}
.hr-range-pill {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
    font-size: 13px;
    cursor: pointer;
    transition: background .2s, border-color .2s;
}
.hr-range-pill:hover { background: rgba(255,255,255,0.1); }
.hr-range-pill.active { background: rgba(74,144,226,0.15); border-color: #4A90E2; color: #4A90E2; font-weight: 600; }

.hr-custom-dates {
    display: none;
    align-items: center;
    gap: 8px;
}
.hr-date-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.hr-custom-dates input[type=date] {
    background: rgba(255,255,255,0.07);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-main);
    padding: 5px 32px 5px 10px;
    font-size: 13px;
    color-scheme: dark;
    appearance: none;
    -webkit-appearance: none;
}
.hr-custom-dates input[type=date]::-webkit-calendar-picker-indicator {
    display: none;
    -webkit-appearance: none;
}
.hr-cal-icon {
    position: absolute;
    right: 8px;
    color: rgba(255,255,255,0.7);
    font-size: 16px;
    cursor: pointer;
    pointer-events: all;
}
.hr-cal-icon:hover { color: #fff; }
.hr-apply-btn {
    padding: 6px 14px;
    border-radius: 8px;
    background: #4A90E2;
    color: #fff;
    border: none;
    font-size: 13px;
    cursor: pointer;
}
.hr-apply-btn:hover { background: #3a7fd5; }

/* ── Custom role dropdown ──────────────────────────────────── */
.hr-role-dropdown {
    margin-left: auto;
    position: relative;
}
.hr-role-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.07);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-main);
    padding: 7px 12px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s;
}
.hr-role-btn:hover { background: rgba(255,255,255,0.12); }
.hr-role-btn i { font-size: 14px; transition: transform .2s; }
.hr-role-dropdown.open .hr-role-btn i { transform: rotate(180deg); }

.hr-role-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 190px;
    background: rgba(18,18,32,0.97);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    z-index: 999;
    overflow: hidden;
    backdrop-filter: blur(12px);
}
.hr-role-dropdown.open .hr-role-menu { display: block; }

.hr-role-item {
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text-main);
    cursor: pointer;
    transition: background .15s;
}
.hr-role-item:hover { background: rgba(255,255,255,0.08); }
.hr-role-item.active { background: rgba(74,144,226,0.15); color: #4A90E2; font-weight: 600; }

/* ── Range label ───────────────────────────────────────────── */
.hr-range-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* ── KPI cards row ─────────────────────────────────────────── */
.hr-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.hr-kpi-card {
    background: var(--glass-bg, rgba(255,255,255,0.05));
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: background .2s;
}
.hr-kpi-card:hover { background: rgba(255,255,255,0.08); }
.hr-kpi-icon { font-size: 22px; color: #4A90E2; }
.hr-kpi-val { font-size: 26px; font-weight: 700; color: var(--text-main); line-height: 1; }
.hr-kpi-label { font-size: 12px; color: var(--text-muted); }

/* ── Charts row ────────────────────────────────────────────── */
.hr-charts-row {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 16px;
    margin-bottom: 24px;
}
@media (max-width: 900px) { .hr-charts-row { grid-template-columns: 1fr; } }

.hr-chart-card {
    background: var(--glass-bg, rgba(255,255,255,0.05));
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 16px;
}
.hr-chart-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* ── Donut ─────────────────────────────────────────────────── */
.hr-donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.hr-donut-legend { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.hr-donut-legend-item { display: flex; align-items: center; gap: 8px; color: var(--text-main); }
.hr-donut-legend-item span { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex-shrink: 0; }

/* ── Leaderboard table ─────────────────────────────────────── */
.hr-table-wrap {
    background: var(--glass-bg, rgba(255,255,255,0.05));
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 24px;
}
.hr-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--glass-border);
}
.hr-table-title { font-size: 14px; font-weight: 600; color: var(--text-main); }

#hr-table { width: 100%; border-collapse: collapse; font-size: 13px; }
#hr-table thead th {
    padding: 10px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .4px;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.03);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
#hr-table thead th:hover { color: var(--text-main); }
#hr-table thead th.sort-asc::after  { content: ' ↑'; color: #4A90E2; }
#hr-table thead th.sort-desc::after { content: ' ↓'; color: #4A90E2; }

.hr-row { cursor: pointer; transition: background .15s; }
.hr-row:hover { background: rgba(255,255,255,0.05); }
.hr-row td { padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,0.04); color: var(--text-main); vertical-align: middle; }
.hr-row:last-child td { border-bottom: none; }

.hr-row-gold   { background: rgba(255, 215, 0,  0.04); }
.hr-row-silver { background: rgba(192, 192, 192, 0.04); }
.hr-row-bronze { background: rgba(205, 127, 50,  0.03); }

.hr-medal { font-size: 18px; }
.hr-pos { font-size: 13px; color: var(--text-muted); font-weight: 600; }

.hr-name-cell { display: flex; align-items: center; gap: 10px; }
.hr-fullname   { font-weight: 600; color: var(--text-main); }
.hr-role-pill  {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(74,144,226,0.12);
    color: #4A90E2;
    margin-top: 2px;
}
.hr-done { color: #4A90E2; font-weight: 600; }
.hr-overdue-num { color: #E74C3C; font-weight: 600; }

/* ── Rank badge ────────────────────────────────────────────── */
.hr-rank-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.hr-rank-excellent { background: rgba(39,174,96,.15);  color: #27AE60; border: 1px solid rgba(39,174,96,.3); }
.hr-rank-good      { background: rgba(74,144,226,.15); color: #4A90E2; border: 1px solid rgba(74,144,226,.3); }
.hr-rank-average   { background: rgba(241,196,15,.15); color: #F1C40F; border: 1px solid rgba(241,196,15,.3); }
.hr-rank-poor      { background: rgba(231,76,60,.12);  color: #E74C3C; border: 1px solid rgba(231,76,60,.3); }

/* ── Avatar ────────────────────────────────────────────────── */
.hr-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.hr-avatar-initials {
    background: linear-gradient(135deg,#4A90E2,#6B48FF);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Detail popup ──────────────────────────────────────────── */
.hr-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: hr-fadein .2s ease;
}
@keyframes hr-fadein { from { opacity: 0; } to { opacity: 1; } }

.hr-detail-popup {
    background: var(--glass-bg-heavy, rgba(20,20,35,0.95));
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 28px;
    max-width: 560px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    max-height: 90vh;
    overflow-y: auto;
}
.hr-detail-close {
    position: absolute;
    top: 14px; right: 14px;
    background: rgba(255,255,255,0.08);
    border: none;
    color: var(--text-muted);
    width: 30px; height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    transition: background .2s;
}
.hr-detail-close:hover { background: rgba(255,255,255,0.15); color: #fff; }

.hr-detail-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}
.hr-detail-header .hr-avatar { width: 52px; height: 52px; font-size: 18px; }
.hr-detail-name { font-size: 18px; font-weight: 700; color: var(--text-main); }

.hr-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}
.hr-detail-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 12px 10px;
    text-align: center;
}
.hr-dc-label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.hr-dc-val   { font-size: 20px; font-weight: 700; color: var(--text-main); }

/* ── Progress bar ──────────────────────────────────────────── */
.hr-detail-progress-wrap { margin-top: 4px; }
.hr-detail-progress-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.hr-progress-bar-bg {
    height: 8px;
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}
.hr-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4A90E2, #6B48FF);
    border-radius: 4px;
    transition: width .6s ease;
}
.hr-detail-progress-nums { font-size: 12px; color: var(--text-muted); }

/* ── Error ─────────────────────────────────────────────────── */
.hr-error {
    padding: 40px;
    text-align: center;
    color: #E74C3C;
    font-size: 14px;
}

/* ── Responsive table ──────────────────────────────────────── */
@media (max-width: 768px) {
    .hr-kpi-row { grid-template-columns: repeat(2, 1fr); }
    .hr-table-wrap { overflow-x: auto; }
    #hr-table { min-width: 700px; }
}
