body {
    min-height: 100vh;
    overflow-x: hidden;
    margin: 0;
}

/* Global font for the whole project */
body,
input,
button,
select,
textarea {
    font-family: 'Inter', 'Segoe UI', sans-serif;
}

.login-logo {
    max-width: 150px;
    height: auto;
}

.main-content {
    min-height: 100vh;
    padding: 2rem;
    background-color: #f0f2f7;
}

/*1-Sidebar */
.sidebar {
    width: 240px;
    min-height: 100vh;
    background: linear-gradient(160deg, #6a11cb 0%, #2575fc 100%);
    color: #fff;
    padding: 1rem 0.5rem;
    font-size: 0.95rem;
    transition: all 0.3s;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

/* Sidebar collapsed (desktop toggle) */
.sidebar.collapsed {
    width: 70px;
    text-align: center;
}

/* Sidebar header */
.sidebar-header .logo {
    font-weight: 700;
    font-size: 1.3rem;
    letter-spacing: 0.3px;
}

.sidebar-header .text-white-50 {
    font-size: 0.8rem;
}

/* 2-Menu links */
.nav-link {
    color: #fff;
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    transition: all 0.3s;
}

.nav-link i {
    font-size: 1.1rem;
    transition: color 0.3s;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

.nav-link:hover {
    background: #fff;
    color: #6610f2;
    font-weight: 600;
    text-decoration: none;
}

.nav-link:hover i {
    color: #6610f2;
}

/* Collapsed sidebar adjustments */
.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.5rem 0;
}

.sidebar.collapsed .nav-link i {
    margin-right: 0;
}

/* Main content styling */
main.flex-grow-1 {
    margin-left: 240px;
    transition: margin-left 0.3s;
    width: calc(100% - 240px);
}

/* Adjust margin when sidebar is collapsed */
.sidebar.collapsed+main {
    margin-left: 70px;
    width: calc(100% - 70px);
}

/* Card small styling */
.card-small {
    width: 100%;
    max-width: 1200px;
    border-radius: 16px;
    background-color: #ffffff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    padding: 2rem;
    transition: transform 0.3s, box-shadow 0.3s;
}

.card-small:hover {
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
}

/* Header */
.card-small h4 {
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #212529;
}

/* Search Input */
.search-container {
    position: relative;
    width: 250px;
}

#global-datatable-search {
    border-radius: 50px;
    padding-left: 38px;
    height: 40px;
    border: 1px solid #ced4da;
    transition: all 0.3s;
}

#global-datatable-search:focus {
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
    border-color: #4e73df;
}

.search-container i {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    color: #adb5bd;
    font-size: 1rem;
}

/* AG Grid container */
.ag-theme-alpine {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    font-size: 14px;
}

/* Form required asterisk */
.form-required::after {
    content: "*";
    color: #dc3545;
    margin-left: 4px;
}

/* Table responsiveness */
.table-responsive {
    overflow-x: auto;
}

/* Optional: smoother scrollbars for tables */
.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

/* Optional: hover effect for table rows */
.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* Small adjustments to reduce spacing inside menu */
.nav-link {
    padding: 0.35rem 0.6rem;
}

/* ===== 3-KPI Cards ===== */

/* KPI Cards */
.kpi-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px;
    border-radius: 16px;
    color: #fff;
    flex: 1 1 180px;
    /* min width, flex-grow to fill row */
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.12);
    transition: all 0.25s ease;
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 35px rgba(0, 0, 0, 0.18);
}

.kpi-icon {
    font-size: 28px;
    width: 55px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.2);
}

.kpi-title {
    font-size: 12px;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-value {
    font-size: 22px;
    font-weight: 700;
}

/* Colors */
.kpi-employees {
    background: linear-gradient(135deg, #6f42c1, #4c1d95);
}

.kpi-income {
    background: linear-gradient(135deg, #198754, #0f5132);
}

.kpi-expense {
    background: linear-gradient(135deg, #dc3545, #842029);
}

.kpi-payroll {
    background: linear-gradient(135deg, #0d6efd, #084298);
}

.kpi-net {
    background: linear-gradient(135deg, #fd7e14, #b45309);
}


/* ===== Color Variants ===== */

.kpi-employees {
    background: linear-gradient(135deg, #6f42c1, #4c1d95);
}

.kpi-income {
    background: linear-gradient(135deg, #198754, #0f5132);
}

.kpi-expense {
    background: linear-gradient(135deg, #dc3545, #842029);
}

.kpi-payroll {
    background: linear-gradient(135deg, #0d6efd, #084298);
}

.kpi-net {
    background: linear-gradient(135deg, #fd7e14, #b45309);
}

/* ===== 4-Financial Section ===== */

.finance-section {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 18px 35px rgba(0, 0, 0, 0.08);
    border-left: 5px solid #0d6efd;
    overflow: hidden;
}

.finance-header {
    padding: 16px 20px;
    background: linear-gradient(135deg,
            rgba(13, 110, 253, 0.08),
            rgba(13, 110, 253, 0.02));
    border-bottom: 1px solid #eef2f7;
}

.finance-header h5 {
    margin-bottom: 2px;
}

.finance-body {
    padding: 20px;
}

.year-select {
    width: 120px;
    border-radius: 8px;
}

/* Optional: subtle animation */
.finance-section {
    transition: all 0.25s ease;
}

.finance-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 45px rgba(0, 0, 0, 0.12);
}

/* ===== 5-Page Loader ===== */
#pageLoader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
    opacity: 1;
    pointer-events: all;
}

#pageLoader.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.loader-text {
    font-size: 14px;
    color: #0d6efd;
    font-weight: 500;
}

/* 6-RESPONSIVENESS */
/* Mobile sidebar behavior */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    main.flex-grow-1 {
        margin-left: 0;
        width: 100%;
        overflow-x: auto;
    }

    /* When sidebar is open on mobile, push content */
    body.sidebar-open main.flex-grow-1 {
        margin-left: 240px;
        width: calc(100% - 240px);
    }

    .search-container {
        width: 100%;
        margin-top: 1rem;
    }

    .d-flex.justify-content-between {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}