/* PayCore - small overrides. Load order: bootstrap.css -> portal.css -> app.css */

/* ---------- Sidebar links: no underline, clear readable text ---------- */
.sidebar a,
.sidebar a:hover,
.sidebar a:focus,
.sidebar a:active {
    text-decoration: none;
}

.sidebar-nav a {
    color: #c9c7de;
    font-size: .95rem;
    font-weight: 600;
    letter-spacing: .01em;
}
.sidebar-nav a:hover,
.sidebar-nav a:focus { color: #fff; }
.sidebar-nav a:focus-visible { outline: 2px solid rgba(255, 255, 255, .35); outline-offset: 2px; }

.sidebar-nav a.active,
.sidebar-nav a.active:hover { color: #fff; }

.logout-link,
.logout-link:hover { text-decoration: none; }

/* ---------- Sidebar sub menu (Bootstrap collapse) ---------- */
.sidebar-nav .nav-caret {
    margin-left: auto;
    width: auto;
    font-size: .7rem;
    transition: transform .2s ease;
}
.sidebar-nav a[aria-expanded="true"] .nav-caret { transform: rotate(180deg); }
.sidebar-nav a.parent-active { color: #fff; background: rgba(255, 255, 255, .06); }
.sidebar-nav a.parent-active i { color: #fff; }

.sidebar-submenu {
    margin: 2px 0 6px 22px;
    padding-left: 10px;
    border-left: 1px solid rgba(255, 255, 255, .12);
}
.sidebar-submenu a {
    padding: 9px 12px;
    font-size: .9rem;
    font-weight: 500;
}

/* Collapsed (icon-only) sidebar: no caret, no indent */
.app.collapsed .sidebar-nav .nav-caret { display: none; }
.app.collapsed .sidebar-submenu {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
}

/* ---------- Bootstrap components in brand colours ---------- */
.pagination .page-item.active .page-link {
    background-color: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.pagination .page-link { color: var(--brand); }

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .2rem rgba(109, 40, 217, .15);
}
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }

.nav-tabs .nav-link { color: var(--muted); }
.nav-tabs .nav-link.active { color: var(--brand); font-weight: 600; }

/* Cards match the dashboard look */
.card { border-radius: var(--radius); }
.card-header:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.card-header h5 { font-family: 'Space Grotesk', sans-serif; font-weight: 700; }
.table thead th {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    font-weight: 700;
}

/* portal.css .btn resets the border; give outline buttons their border back */
.btn-outline-secondary {
    background: #fff;
    border-color: var(--border);
    color: var(--text);
}
.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    background: #fff;
    border-color: var(--brand);
    color: var(--brand);
}

/* ---------- List tables: same look as the dashboard "Recent Attendance Log" ---------- */
.card-header { border-bottom: 0; padding-top: 1.25rem; }

.table {
    --bs-table-hover-bg: var(--bg-alt);
    --bs-table-border-color: var(--border);
    font-size: .88rem;
    color: var(--text);
}
.table > :not(caption) > * > * {
    padding: 14px;
    border-bottom: 1px solid var(--border);
}
.table thead th {
    background: transparent;
    padding-top: 4px;
    padding-bottom: 12px;
    white-space: nowrap;
}
.table tbody tr:last-child > td { border-bottom: 0; }

/* Column text styles: bold dark for the main column, light grey for the rest */
.table .cell-main { font-weight: 600; color: var(--text); }
.table .cell-muted { color: var(--muted); }

/* Soft status pill for inactive rows (portal.css has the green/amber/red ones) */
.status-inactive { background: rgba(102, 108, 128, .12); color: var(--muted); }

/* Small round icon button for row actions */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--muted);
    font-size: .8rem;
    text-decoration: none;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.btn-icon:hover {
    color: var(--brand);
    border-color: var(--brand);
    background: #faf7ff;
}

/* Two-line cell: bold name on top, small grey line below (e.g. employee code) */
.table .cell-sub { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.table .cell-main + .cell-sub { line-height: 1.3; }

/* Department pill in employee list (soft violet, like the dashboard reference) */
.dept-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .76rem;
    font-weight: 600;
    padding: 4px 11px;
    border-radius: 20px;
    background: rgba(109, 40, 217, .1);
    color: var(--brand);
    white-space: nowrap;
}
.dept-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Salary tab */
.salary-stat {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    background: var(--bg-alt);
}
.salary-stat .label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.salary-stat .value { font-family: 'Space Grotesk', sans-serif; font-size: 1.15rem; font-weight: 700; margin-top: 2px; }
.section-title { font-family: 'Space Grotesk', sans-serif; font-weight: 700; margin-bottom: 12px; }

/* Payroll settings summary boxes */
.settings-box {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    height: 100%;
}
.settings-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: .9rem;
    margin-bottom: 8px;
}
.settings-title i { color: var(--brand); margin-right: 6px; }
.settings-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: .85rem;
    padding: 4px 0;
    color: var(--muted);
}
.settings-row strong { color: var(--text); font-weight: 600; }

/* Keep compact history rows on one line (table scrolls sideways on small screens) */
.table-nowrap td { white-space: nowrap; }

/* ---------- Payslip ---------- */
.payslip-brand { font-family: 'Space Grotesk', sans-serif; font-weight: 700; color: var(--brand); }
.payslip-net-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.payslip-net { font-family: 'Space Grotesk', sans-serif; font-size: 1.6rem; font-weight: 700; color: var(--status-good); }
.payslip-info th { color: var(--muted); font-weight: 500; width: 45%; padding-left: 0; }
.payslip-info td { font-weight: 600; }
.payslip-table thead th { background: var(--bg-alt); }
.payslip-table tfoot th { border-top: 2px solid var(--border); font-weight: 700; }
.payslip-net-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 18px; border-radius: var(--radius-sm);
    background: rgba(15, 157, 88, .08); color: var(--status-good); font-weight: 600;
}
.payslip-net-row strong { font-size: 1.2rem; }

/* Print only the payslip */
@media print {
    .sidebar, .topbar, .no-print, .overlay { display: none !important; }
    .main { margin-left: 0 !important; }
    .content { padding: 0 !important; }
    body { background: #fff !important; }
    .payslip { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* portal.css .btn resets borders; give the danger outline button its border back */
.btn-outline-danger { background: #fff; border-color: #f3c9d8; color: var(--brand-3); }
.btn-outline-danger:hover, .btn-outline-danger:focus { background: #fdf1f6; border-color: var(--brand-3); color: var(--brand-3); }

/* ---------- Payslip list: all components, sticky View + Employee columns ---------- */
.payslip-grid { font-size: .82rem; }
.payslip-grid thead th { vertical-align: middle; }
.payslip-grid .group-row th { font-size: .68rem; border-bottom: 0; color: var(--muted-2); }
.payslip-grid th.group-earn, .payslip-grid td.group-earn,
.payslip-grid th.group-ded, .payslip-grid td.group-ded { border-left: 2px solid var(--border); }
.payslip-grid .sticky-col { position: sticky; background: #fff; z-index: 2; }
.payslip-grid .sticky-1 { left: 0; width: 52px; min-width: 52px; }
.payslip-grid .sticky-2 { left: 52px; min-width: 190px; box-shadow: 2px 0 0 var(--border); }
.payslip-grid tbody tr:hover .sticky-col { background: var(--bg-alt); }

/* ---------- Dashboard ---------- */
.stat-foot { font-size: .76rem; color: var(--muted-2); margin-top: 4px; }
.grid-2 { margin-bottom: 22px; }

/* Column chart: thin columns (<=24px), 4px rounded top, square baseline, hairline grid */
.col-chart { display: flex; gap: 10px; height: 220px; }
.col-chart-axis { display: flex; flex-direction: column; justify-content: space-between; font-size: .7rem; color: var(--muted-2); text-align: right; min-width: 64px; padding-bottom: 0; transform: translateY(-.45em); }
.col-chart-plot { position: relative; flex: 1; display: flex; align-items: flex-end; justify-content: space-around; border-bottom: 1px solid var(--border); }
.col-chart-grid { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.col-chart-grid i { display: block; border-top: 1px solid var(--bg-alt); }
.col-chart-grid i:last-child { border-top: 0; }
.col-chart-slot { position: relative; height: 100%; flex: 1; display: flex; justify-content: center; align-items: flex-end; cursor: default; outline: none; }
.col-chart-slot:hover, .col-chart-slot:focus-visible { background: rgba(109, 40, 217, .04); }
.col-chart-bar { width: 24px; max-width: 60%; min-height: 2px; background: var(--brand); border-radius: 4px 4px 0 0; position: relative; z-index: 1; }
.col-chart-value { position: absolute; font-size: .72rem; font-weight: 600; color: var(--text); white-space: nowrap; z-index: 2; }
.col-chart-labels { display: flex; justify-content: space-around; margin-left: 74px; font-size: .72rem; color: var(--muted); padding-top: 6px; }
.col-chart-tip {
    position: fixed; transform: translate(-50%, -100%); pointer-events: none; opacity: 0; transition: opacity .12s ease;
    background: #12131c; color: #fff; font-size: .75rem; line-height: 1.45; padding: 8px 10px; border-radius: 8px; z-index: 50; white-space: nowrap;
}
.col-chart-tip.show { opacity: 1; }

.attention-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: .86rem; color: var(--text); text-decoration: none; }
.attention-row:last-child { border-bottom: 0; }
a.attention-row:hover { color: var(--brand); }

.quick-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick-actions a {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: .78rem; font-weight: 600; color: var(--text); text-decoration: none; text-align: center;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.quick-actions a i { font-size: 1.1rem; color: var(--brand); }
.quick-actions a:hover { border-color: var(--brand); color: var(--brand); background: #faf7ff; }

.dept-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; font-size: .85rem; }
.dept-name { width: 130px; flex-shrink: 0; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dept-track { flex: 1; height: 10px; background: var(--bg-alt); border-radius: 0 4px 4px 0; overflow: hidden; }
.dept-bar { display: block; height: 100%; background: var(--brand); border-radius: 0 4px 4px 0; }
.dept-count { width: 32px; text-align: right; font-weight: 600; color: var(--text); }
