/* NBUnify HRM: Bootstrap 5 theme overrides. Brand purple from the NBUnify logo. */

:root {
    --hrm-primary: #5b30c4;
    --hrm-primary-rgb: 91, 48, 196;
    --hrm-primary-dark: #4a24a8;
    --hrm-primary-soft: #efe9fc;
    --hrm-sidebar-bg: #1f1640;
    --hrm-sidebar-text: #c9c2e3;
    --hrm-sidebar-width: 240px;
    --hrm-body-bg: #f5f6fa;

    --bs-primary: var(--hrm-primary);
    --bs-primary-rgb: var(--hrm-primary-rgb);
    --bs-link-color: var(--hrm-primary);
    --bs-link-color-rgb: var(--hrm-primary-rgb);
    --bs-link-hover-color: var(--hrm-primary-dark);
    --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --bs-body-font-size: 0.9rem;
    --bs-border-radius: 0.5rem;
}

/* Page background only; --bs-body-bg stays white because Bootstrap also uses it for inputs. */
body { background-color: var(--hrm-body-bg); }

.btn-primary {
    --bs-btn-bg: var(--hrm-primary);
    --bs-btn-border-color: var(--hrm-primary);
    --bs-btn-hover-bg: var(--hrm-primary-dark);
    --bs-btn-hover-border-color: var(--hrm-primary-dark);
    --bs-btn-active-bg: var(--hrm-primary-dark);
    --bs-btn-active-border-color: var(--hrm-primary-dark);
    --bs-btn-disabled-bg: var(--hrm-primary);
    --bs-btn-disabled-border-color: var(--hrm-primary);
}

.btn-outline-primary {
    --bs-btn-color: var(--hrm-primary);
    --bs-btn-border-color: var(--hrm-primary);
    --bs-btn-hover-bg: var(--hrm-primary);
    --bs-btn-hover-border-color: var(--hrm-primary);
    --bs-btn-active-bg: var(--hrm-primary-dark);
    --bs-btn-active-border-color: var(--hrm-primary-dark);
}

/* Compact controls: forms and buttons match the 0.9rem body text. */
.btn { --bs-btn-font-size: .875rem; --bs-btn-padding-y: .4rem; --bs-btn-padding-x: .8rem; }
.btn-sm { --bs-btn-font-size: .8rem; --bs-btn-padding-y: .2rem; --bs-btn-padding-x: .45rem; }
.form-control, .form-select, .input-group-text { font-size: .875rem; padding-top: .4rem; padding-bottom: .4rem; }
.form-select { padding-right: 2rem; }

a { text-decoration: none; }
a:hover { text-decoration: underline; }
.btn:hover, .nav-link:hover, .dropdown-item:hover, .page-link:hover, .stretched-link:hover, .app-brand-link:hover { text-decoration: none; }

.text-bg-primary { background-color: var(--hrm-primary) !important; }
.text-primary { color: var(--hrm-primary) !important; }
.bg-primary-soft { background-color: var(--hrm-primary-soft) !important; }

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: rgba(var(--hrm-primary-rgb), .5);
    box-shadow: 0 0 0 .2rem rgba(var(--hrm-primary-rgb), .15);
}

.form-check-input:checked {
    background-color: var(--hrm-primary);
    border-color: var(--hrm-primary);
}

.pagination {
    --bs-pagination-color: var(--hrm-primary);
    --bs-pagination-active-bg: var(--hrm-primary);
    --bs-pagination-active-border-color: var(--hrm-primary);
    margin-bottom: 0;
}

/* ---------- Shell ---------- */

.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    --bs-offcanvas-width: var(--hrm-sidebar-width);
    --bs-offcanvas-bg: var(--hrm-sidebar-bg);
    /* !important: Bootstrap's .offcanvas-lg forces a transparent background on large screens. */
    background-color: var(--hrm-sidebar-bg) !important;
    color: var(--hrm-sidebar-text);
}

@media (min-width: 992px) {
    .app-sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        width: var(--hrm-sidebar-width);
        flex: 0 0 var(--hrm-sidebar-width);
        overflow-y: auto;
    }

    /* Bootstrap hides the offcanvas header and strips body padding on large screens. */
    .app-sidebar .offcanvas-header { display: flex; }
    .app-sidebar .app-nav { padding: .75rem; }
}

.app-brand { padding: 1rem 1.25rem; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.app-brand-link { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-size: 1.05rem; }

.app-brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; border-radius: .5rem;
    background: linear-gradient(135deg, #7b3fe4, #c13ad6);
    color: #fff; font-weight: 700; font-size: .8rem; letter-spacing: .02em;
}
.app-brand-mark-lg { width: 3rem; height: 3rem; font-size: 1.1rem; border-radius: .75rem; }

.app-nav { display: flex; padding: .75rem; gap: 2px; }
.app-nav .nav-link {
    display: flex; align-items: center; gap: .65rem;
    padding: .5rem .75rem; border-radius: .4rem;
    color: var(--hrm-sidebar-text); font-weight: 500;
}
.app-nav .nav-link i { font-size: 1rem; width: 1.1rem; text-align: center; }
.app-nav .nav-link:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.app-nav .nav-link.active { color: #fff; background: var(--hrm-primary); }
.app-nav .nav-link.disabled { opacity: .45; }
.app-nav-section {
    margin: .9rem .75rem .3rem; font-size: .7rem; font-weight: 600;
    letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 255, 255, .4);
}

.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.app-topbar {
    position: sticky; top: 0; z-index: 1020;
    display: flex; align-items: center; gap: .75rem;
    padding: .6rem 1.5rem; background: #fff; border-bottom: 1px solid var(--bs-border-color);
}

.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.6rem; height: 1.6rem; border-radius: 50%;
    background: var(--hrm-primary-soft); color: var(--hrm-primary); font-weight: 600; font-size: .75rem;
}

.app-content { padding: 1.25rem 1.5rem 2rem; }

@media (max-width: 575.98px) {
    .app-topbar { padding: .5rem 1rem; }
    .app-content { padding: 1rem 1rem 1.5rem; }
}

/* ---------- Cards, tables, details ---------- */

.card { border-color: #e6e7ee; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.card-header { background: #fff; font-weight: 600; }

.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > thead th {
    font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
    color: #6b7280; background: #fafafc; white-space: nowrap;
}
.table > :not(caption) > * > * { padding: .65rem .75rem; vertical-align: middle; }
.table td.actions, .table th.actions { text-align: end; white-space: nowrap; width: 1%; }

.sort-link { color: inherit; text-decoration: none; }
.sort-link i { opacity: .45; font-size: .8rem; }
.sort-link.active, .sort-link:hover { color: var(--hrm-primary); }
.sort-link.active i { opacity: 1; }

.detail-label { font-size: .75rem; color: #6b7280; margin-bottom: .1rem; }
.detail-value { font-weight: 500; word-break: break-word; }
.text-pre-line { white-space: pre-line; }

.form-label { font-weight: 500; margin-bottom: .3rem; }
.form-section-title {
    font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
    color: var(--hrm-primary); border-bottom: 1px solid #ecebf3; padding-bottom: .35rem; margin-bottom: .9rem;
}
fieldset + fieldset { margin-top: 1.25rem; }

/* ---------- Dashboard ---------- */

.stat-card .stat-icon {
    width: 2.5rem; height: 2.5rem; border-radius: .6rem;
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem;
}
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat-card a.stretched-link:hover ~ * { color: var(--hrm-primary); }

.pipeline-step { border: 1px solid #ecebf3; border-radius: .5rem; padding: .6rem .75rem; background: #fff; height: 100%; }
.pipeline-step .count { font-size: 1.25rem; font-weight: 700; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.25rem; border-left: 2px solid #ecebf3; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
    content: ""; position: absolute; left: -6px; top: .25rem;
    width: 10px; height: 10px; border-radius: 50%; background: var(--hrm-primary);
}

/* ---------- Guest ---------- */

.guest-body { background: linear-gradient(160deg, #f5f3ff 0%, #f5f6fa 60%); }
.guest-wrapper { max-width: 400px; margin: 0 auto; padding: 4rem 1rem 2rem; }

/* ---------- Print (offer letter) ---------- */

.letter { max-width: 800px; margin: 0 auto; background: #fff; padding: 2.5rem; }
@media print {
    body { background: #fff; }
    .no-print { display: none !important; }
    .letter { padding: 0; box-shadow: none; border: 0; }
}

/* ---------- Simple HRMS screens ---------- */

/* One line under a page title: "You enter -> You get". */
.io-strip {
    display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem;
    padding: .55rem .85rem; margin-bottom: 1rem; border: 1px dashed #dcd9e8; border-radius: .5rem;
    background: #faf9fd; font-size: .825rem;
}
.io-strip .io-group { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.io-strip .io-label { font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #6b7280; }
.io-strip .io-pill { padding: .05rem .6rem; border: 1px solid #e3e1ec; border-radius: 99px; background: #fff; }
.io-strip .io-get .io-pill { border-color: var(--hrm-primary); color: var(--hrm-primary); }
.io-strip .io-arrow { color: var(--hrm-primary); font-weight: 700; }

/* Numbered progress steps (onboarding, exit). */
.stepper { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; padding: 0; margin: 0; counter-reset: step; }
.stepper li {
    counter-increment: step; display: flex; align-items: center; gap: .4rem;
    padding: .2rem .75rem .2rem .3rem; border: 1px solid #e3e1ec; border-radius: 99px; font-size: .8rem; color: #6b7280; background: #fff;
}
.stepper li::before {
    content: counter(step); display: inline-flex; align-items: center; justify-content: center;
    width: 1.25rem; height: 1.25rem; border-radius: 50%; background: #f1f0f6; font-size: .7rem; font-weight: 700;
}
.stepper li.done { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); border-color: transparent; }
.stepper li.done::before { content: "\2713"; background: var(--bs-success); color: #fff; }
.stepper li.now { border-color: var(--hrm-primary); color: var(--hrm-primary); font-weight: 600; }
.stepper li.now::before { background: var(--hrm-primary); color: #fff; }


/* Clickable rows (Home page "Needs your attention"). */
.list-link { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .7rem 1rem; border-bottom: 1px solid #ecebf3; color: inherit; text-decoration: none; }
.list-link:last-child { border-bottom: 0; }
.list-link:hover { background: #faf9fd; text-decoration: none; }
.list-link.active { background: var(--hrm-primary-soft); }

/* Salary breakup and slips. */
.calc-table td { padding: .4rem 0; border-bottom: 1px dashed #e6e7ee; }
.calc-table tr.total td { font-weight: 700; border-top: 2px solid #e6e7ee; border-bottom: 0; }
.net-pay { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .5rem; padding: .75rem 1rem; border-radius: .5rem; background: var(--hrm-primary-soft); }
.net-pay .amount { font-size: 1.4rem; font-weight: 700; color: var(--hrm-primary); }
.letter-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; border-bottom: 2px solid var(--hrm-primary); padding-bottom: .75rem; margin-bottom: 1rem; }
.letter-head strong { font-size: 1.1rem; color: var(--hrm-primary); }
