/* ═══════════════════════════════════════════════════════════
   Payroll Management System — Custom Stylesheet
   Design: Modern, clean, professional with soft color palette
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ─── CSS Variables ──────────────────────────────────────── */
:root {
    --primary:        #4F46E5;
    --primary-light:  #6366F1;
    --primary-dark:   #3730A3;
    --secondary:      #0EA5E9;
    --success:        #10B981;
    --warning:        #F59E0B;
    --danger:         #EF4444;
    --info:           #6366F1;

    --bg-main:        #F1F5F9;
    --bg-card:        #FFFFFF;
    --sidebar-bg:     #1E1B4B;
    --sidebar-hover:  #312E81;
    --sidebar-active: #4F46E5;
    --sidebar-text:   #C7D2FE;
    --sidebar-width:  260px;

    --text-dark:      #1E293B;
    --text-muted:     #64748B;
    --text-light:     #94A3B8;
    --border:         #E2E8F0;

    --shadow-sm:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --shadow-md:      0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
    --shadow-lg:      0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
    --shadow-card:    0 4px 24px rgba(79,70,229,.08);

    --radius-sm:      6px;
    --radius-md:      12px;
    --radius-lg:      16px;
    --radius-xl:      24px;

    --transition:     all 0.2s ease;
}

/* ─── Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-main);
    color: var(--text-dark);
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition);
    overflow-y: auto;
}

.sidebar-brand {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-brand .brand-icon {
    width: 40px; height: 40px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: .5rem;
}

.sidebar-brand .brand-name {
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.sidebar-brand .brand-sub {
    color: var(--sidebar-text);
    font-size: .72rem;
    opacity: .7;
}

.sidebar-nav { padding: 1rem 0; flex: 1; }

.nav-section-label {
    padding: 1rem 1.5rem .4rem;
    font-size: .65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(199,210,254,.4);
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: .85rem;
    font-weight: 500;
    border-radius: 0;
    transition: var(--transition);
    margin: .1rem 0;
    position: relative;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
}

.sidebar-nav .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: #A5B4FC;
    border-radius: 0 2px 2px 0;
}

.sidebar-nav .nav-link .nav-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    opacity: .9;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,.08);
}

/* ─── Main Content ───────────────────────────────────────── */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── Top Navbar ─────────────────────────────────────────── */
.topbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: .75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    position: sticky; top: 0; z-index: 100;
}

.topbar-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.topbar-right { display: flex; align-items: center; gap: 1rem; }

.admin-badge {
    display: flex; align-items: center; gap: .5rem;
    background: var(--bg-main);
    padding: .4rem .85rem;
    border-radius: 50px;
    font-size: .82rem;
    font-weight: 500;
    color: var(--text-dark);
}

.admin-badge .avatar {
    width: 28px; height: 28px;
    background: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
}

/* ─── Page Content ───────────────────────────────────────── */
.page-content { padding: 2rem; flex: 1; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.page-header .breadcrumb {
    font-size: .8rem;
    color: var(--text-muted);
    margin: .2rem 0 0;
}

/* ─── Cards ──────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.card-header-custom {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
}

.card-header-custom h5 {
    font-weight: 600;
    font-size: .95rem;
    color: var(--text-dark);
    margin: 0;
}

.card-body-content { padding: 1.5rem; }

/* ─── Summary Cards (Dashboard) ─────────────────────────── */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 80px; height: 80px;
    border-radius: 50%;
    transform: translate(20px, -20px);
    opacity: .1;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-card.salary::after  { background: var(--primary); }
.stat-card.expense::after { background: var(--danger); }
.stat-card.income::after  { background: var(--success); }
.stat-card.profit::after  { background: var(--warning); }

.stat-icon {
    width: 56px; height: 56px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-icon.salary  { background: rgba(79,70,229,.1);  color: var(--primary); }
.stat-icon.expense { background: rgba(239,68,68,.1);  color: var(--danger); }
.stat-icon.income  { background: rgba(16,185,129,.1); color: var(--success); }
.stat-icon.profit  { background: rgba(245,158,11,.1); color: var(--warning); }

.stat-info { flex: 1; }

.stat-label {
    font-size: .78rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: .25rem;
}

.stat-value {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1;
}

.stat-value.profit-positive { color: var(--success); }
.stat-value.profit-negative { color: var(--danger); }

.stat-period {
    font-size: .75rem;
    color: var(--text-light);
    margin-top: .2rem;
}

/* ─── Tables ─────────────────────────────────────────────── */
.table-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.table {
    margin: 0;
    font-size: .855rem;
}

.table thead th {
    background: #F8FAFC;
    color: var(--text-muted);
    font-weight: 600;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 1px solid var(--border);
    padding: .9rem 1.25rem;
    white-space: nowrap;
}

.table tbody td {
    padding: .9rem 1.25rem;
    vertical-align: middle;
    border-bottom: 1px solid #F1F5F9;
    color: var(--text-dark);
}

.table tbody tr:last-child td { border-bottom: none; }

.table tbody tr:hover { background: #FAFBFC; }

/* ─── Badges ─────────────────────────────────────────────── */
.badge-status {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .25rem .75rem;
    border-radius: 50px;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.badge-status.active   { background: rgba(16,185,129,.12); color: #059669; }
.badge-status.inactive { background: rgba(239,68,68,.1);   color: #DC2626; }
.badge-status.paid     { background: rgba(16,185,129,.12); color: #059669; }
.badge-status.unpaid   { background: rgba(245,158,11,.12); color: #D97706; }

.badge-status::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ─── Buttons ────────────────────────────────────────────── */
.btn { border-radius: var(--radius-sm); font-weight: 500; font-size: .85rem; transition: var(--transition); }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-sm { padding: .3rem .7rem; font-size: .78rem; }
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); }

/* ─── Forms ──────────────────────────────────────────────── */
.form-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    padding: 2rem;
}

.form-label {
    font-weight: 500;
    font-size: .83rem;
    color: var(--text-dark);
    margin-bottom: .4rem;
}

.form-control, .form-select {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .875rem;
    padding: .55rem .85rem;
    color: var(--text-dark);
    transition: var(--transition);
    background: #fff;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
    outline: none;
}

.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.12); }

/* Toggle Switch */
.form-switch .form-check-input { width: 2.4em; height: 1.3em; cursor: pointer; }
.form-switch .form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }

/* ─── Search Bar ─────────────────────────────────────────── */
.search-box {
    position: relative;
    width: 280px;
}

.search-box .search-icon {
    position: absolute;
    left: .75rem; top: 50%; transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-box .form-control { padding-left: 2.3rem; }

/* ─── Filter Bar ─────────────────────────────────────────── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}

/* ─── Auth Page ──────────────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1E1B4B 0%, #312E81 50%, #4F46E5 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 2rem;
}

.auth-card {
    background: #fff;
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 50px rgba(0,0,0,.25);
    padding: 2.5rem;
    width: 100%; max-width: 420px;
}

.auth-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-brand .brand-logo {
    width: 60px; height: 60px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-md);
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.6rem;
    color: #fff;
    box-shadow: 0 8px 20px rgba(79,70,229,.35);
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: .25rem;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: .875rem;
}

/* ─── Pagination ─────────────────────────────────────────── */
.pagination { gap: .25rem; }
.page-link {
    border-radius: var(--radius-sm) !important;
    border: 1.5px solid var(--border);
    color: var(--text-dark);
    font-size: .82rem;
    padding: .35rem .7rem;
    transition: var(--transition);
}
.page-link:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); }

/* ─── Alerts / Toasts ────────────────────────────────────── */
.toast-container-top { position: fixed; top: 1.25rem; right: 1.25rem; z-index: 9999; }

.alert {
    border-radius: var(--radius-md);
    border: none;
    font-size: .875rem;
    font-weight: 500;
    box-shadow: var(--shadow-md);
}

.alert-success { background: rgba(16,185,129,.12); color: #047857; border-left: 4px solid var(--success); }
.alert-danger  { background: rgba(239,68,68,.1);   color: #B91C1C; border-left: 4px solid var(--danger); }
.alert-warning { background: rgba(245,158,11,.1);  color: #92400E; border-left: 4px solid var(--warning); }
.alert-info    { background: rgba(99,102,241,.1);  color: #4338CA; border-left: 4px solid var(--info); }

/* ─── Chart wrapper ──────────────────────────────────────── */
.chart-wrapper { padding: 1.5rem; }

/* ─── Empty State ────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}
.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: .4;
}
.empty-state p { margin: 0; font-size: .9rem; }

/* ─── Action column ──────────────────────────────────────── */
.action-btns { display: flex; gap: .35rem; align-items: center; }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
    .stat-value { font-size: 1.35rem; }
}
