/* assets/css/style.css */

/* Define color variables for themes */
:root {
    --primary: #4361ee;
    --secondary: #3f37c9;
    --accent: #4895ef;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #e63946;
    --dark: #1d3557;
    --light: #f8f9fa;
    --text: #212529;
    --text-light: #f8f9fa;
    --gray: #6c757d;
    --border: #dee2e6;
    --card-bg: #ffffff;
    --card-shadow: rgba(0, 0, 0, 0.05);
    --sidebar-bg: #1d3557;
    --sidebar-text: #f8f9fa;
    --primary-rgb: 67, 97, 238;
    --danger-rgb: 230, 57, 70;
    --primary-color: #4361ee;
    --primary-color-dark: #02125c;
    --primary-color: #007bff;
    --primary-color-dark: #0056b3;
    --primary-color-light: #e7f3ff;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.1);
    --info-color: #17a2b8;
    
}

/* Add this to your existing <style> tag */
.employee-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;      /* This creates the circular shape */
    object-fit: cover;       /* This prevents the image from looking stretched */
    vertical-align: middle;  /* This helps align it nicely with text in the row */
}

/* Theme definitions remain as you have them */
[data-theme="blue"] {
    --primary: #4361ee;
    --secondary: #3f37c9;
    --accent: #4895ef;
    --dark: #1d3557;
    --light: #f8f9fa;
    --primary-rgb: 67, 97, 238;
}

/* Green Theme */
[data-theme="green"] {
    --primary: #2ecc71;
    --secondary: #27ae60;
    --accent: #1abc9c;
    --dark: #16a085;
    --light: #d1f2eb;
    --text: #212529;
    --text-light: #f8f9fa;
    --border: #bce7d6;
    --card-bg: #ffffff;
    --card-shadow: rgba(0, 0, 0, 0.05);
    --sidebar-bg: #16a085;
    --sidebar-text: #f8f9fa;
    --success: #2ecc71;
    --warning: #ffbe0b;
    --primary-rgb: 46, 204, 113;
}

/* Purple Theme */
[data-theme="purple"] {
    --primary: #9b59b6;
    --secondary: #8e44ad;
    --accent: #5d3fd3;
    --dark: #4b0082;
    --light: #f5eef8;
    --text: #212529;
    --text-light: #f8f9fa;
    --border: #e0b0ff;
    --card-bg: #ffffff;
    --card-shadow: rgba(0, 0, 0, 0.05);
    --sidebar-bg: #4b0082;
    --sidebar-text: #f8f9fa;
    --success: #6c5ce7;
    --warning: #ffe100;
    --primary-rgb: 155, 89, 182;
}

/* Royal Blue */
[data-theme="dark"] {
    --primary: #5ec6f3;           /* Sky Blue */
    --secondary: #0288d1;           /* Deep Sky Blue */
    --accent: #b2ebf2;              /* Light Cyan Accent */
    --light: #f2fbff;              /* Section/card background */
    --text: #123a5d;               /* Deep Blue Text */
    --text-light: #375a7f;         /* Medium blue for headings or subtext */
    --gray: #90a4ae;               /* Soft gray */
    --border: #d0e6f2;             /* Light bluish-gray border */
    --card-bg: #ffffff;            /* Card background */
    --card-shadow: rgba(0, 123, 255, 0.1); /* Soft blue shadow */
    --sidebar-bg: #0288d1;         /* Pale sky sidebar */
    --sidebar-text: #ffffff;       /* Deep blue text */
    --success: #388e3c;            /* Green */
    --warning: #ffa000;            /* Amber */
    --danger: #d32f2f;             /* Red */
    --primary-rgb: 94, 198, 243;   /* RGB of Sky Blue */
}

/* Coral Theme (formerly Orange Theme) */
[data-theme="coral"] {
    --primary: #FF7F50; /* Coral */
    --secondary: #FA8072; /* Salmon */
    --accent: #F35B53; /* Tomato (another shade of red-orange) */
    --dark: #CD5B45; /* Darker Coral */
    --light: #FFF0EB; /* Very light coral/peach for background */
    --text: #212529;
    --text-light: #f8f9fa;
    --border: #FFC0B3; /* Lighter coral for borders */
    --card-bg: #ffffff;
    --card-shadow: rgba(0, 0, 0, 0.05);
    --sidebar-bg: #CD5B45; /* Use dark coral for sidebar */
    --sidebar-text: #f8f9fa;
    --success: #28a745; /* Keep standard success green */
    --warning: #ffc107; /* Keep standard warning yellow */
    --danger: #e63946;  /* Keep standard danger red */
    --primary-rgb: 255, 127, 80;
}

/* Grey Theme */
[data-theme="grey"] {
    --primary: #6c757d;
    --secondary: #5a6268;
    --accent: #adb5bd;
    --dark: #343a40;
    --light: #f8f9fa;
    --text: #212525;
    --text-light: #f8f9fa;
    --border: #ced4da;
    --card-bg: #ffffff;
    --card-shadow: rgba(0, 0, 0, 0.05);
    --sidebar-bg: #343a40;
    --sidebar-text: #f8f9fa;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #e63946;
    --primary-rgb: 108, 117, 125;
}

[data-theme="wine"] {
    --primary: #800020; /* Deep Red/Burgundy */
    --secondary: #500010; /* Darker Wine */
    --accent: #B22222; /* Firebrick */
    --dark: #400010; /* Very dark red */
    --light: #F8F0F2; /* Light pinkish-grey */
    --text: #212529;
    --text-light: #f8f9fa;
    --gray: #7F5C6A;
    --border: #C8A2C8; /* Thistle */
    --card-bg: #FFFFFF;
    --card-shadow: rgba(0, 0, 0, 0.05);
    --sidebar-bg: #500010; /* Darker Wine for sidebar */
    --sidebar-text: #F8F9FA;
    --success: #28A745; /* Standard green for success */
    --warning: #FFC107; /* Standard yellow for warning */
    --danger: #E63946; /* Standard red for danger */
    --primary-rgb: 128, 0, 32;
}

[data-theme="teal"] {
    --primary: #008080; /* Teal */
    --secondary: #005C5C; /* Darker Teal */
    --accent: #48D1CC; /* MediumTurquoise */
    --dark: #004D4D; /* Very dark teal */
    --light: #E0FFFF; /* Light Cyan */
    --text: #212529;
    --text-light: #f8f9fa;
    --gray: #5F9EA0; /* CadetBlue */
    --border: #AFEEEE; /* PaleTurquoise */
    --card-bg: #FFFFFF;
    --card-shadow: rgba(0, 0, 0, 0.05);
    --sidebar-bg: #005C5C;
    --sidebar-text: #F8F9FA;
    --success: #28A745;
    --warning: #FFC107;
    --danger: #E63946;
    --primary-rgb: 0, 128, 128;
}


/* Global Reset and Body */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s, color 0.3s;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh; /* Ensure body takes full viewport height */
    overflow-x: hidden; /* Hide horizontal scrollbar on body */
}

/* --- MAIN LAYOUT STRUCTURE --- */
.container {
    display: flex; /* Arranges sidebar and main-content horizontally */
    min-height: 100vh; /* Ensure container takes full viewport height */
    /* Remove overflow: hidden here. Let main-content handle its own overflow. */
}


/* Main container for the theme switcher */
.theme-switcher {
    position: relative; /* Crucial for positioning the dropdown */
    display: inline-block;
    background: transparent;
}

/* The button that opens the dropdown */
.theme-switcher-toggle {
    display: flex;
    align-items: center;
    gap: 8px; /* Space between icon and text */
    padding: 8px 12px;
    background-color: var(--sidebar-bg); /* Use a theme variable */
    color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.theme-switcher-toggle:hover {
    background-color: var(--secondary);
    color:yellow;
}

/* The container for the color buttons (the dropdown itself) */
.theme-switcher-options {
    display: none; /* This ensures it's hidden by default */
    position: absolute;
    right: 0;
    top: calc(100% + 5px); /* Position it right below the toggle button */
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    width: 200px;
    /* REMOVE the display:grid properties from here */
}

/* This class will be added by JavaScript to show the dropdown */
.theme-switcher-options.active {
    display: grid; /* Display as a grid ONLY when active */
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

/* Ensure the theme buttons inside the dropdown look good */
.theme-switcher-options .theme-btn {
    width: 70%;
    height: 25px; /* Give them a uniform height */
    background: transparent; /* Removes the background color */
    border: none;          /* Removes the default border */
    padding: 0;            /* Optional: Removes default button padding */
    /* ----------------------- */
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 20px;
}

.sidebar-header h2 {
    font-size: 1.5rem;
    margin-bottom: 5px;
    color: #fff;
}

.sidebar-header p {
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu .menu-header {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
    padding: 15px 20px 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-menu .menu-header:first-of-type {
    border-top: none;
    margin-top: 0;
}


.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-left: 4px solid transparent;
    transition: all 0.3s;
    opacity: 0.8;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background-color: rgba(255,255,255,0.1);
    border-left: 4px solid var(--primary);
    opacity: 1;
}

.sidebar-menu li a i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.main-content {
    /* flex: 1; is shorthand for flex-grow:1, flex-shrink:1, flex-basis:0% */
    /* This makes it take remaining space, but we need to manage overflow explicitly */
    flex-grow: 1;
    flex-shrink: 1; /* Allow it to shrink if window is very narrow */
    flex-basis: auto; /* Default basis */

    margin-left: 250px; /* Space for the fixed sidebar */
    padding: 20px;
    background-color: var(--light);
    
    /* --- CRITICAL ADDITIONS FOR OVERFLOW --- */
    overflow-x: hidden; /* Hide horizontal scrollbar within main content area */
    overflow-y: auto; /* Allow vertical scroll if content is too long */
    /* You might want a max-width if content gets too wide on very large screens,
       but usually flex-grow:1 combined with overflow-x:hidden is enough. */
    /* max-width: 1200px; */ /* Example: if you want main content to be max 1200px even with lots of space */
    /* If max-width is used, you might need margin: 0 auto; on .main-content itself if its parent (body/container) allows it to float. */
}

/* Overlay for mobile sidebar */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 99;
    display: none; /* Hidden by default, shown with JS */
}


/* Main header */
/* Main header */
/* Main header */
.header {
    position: fixed;
    top: 0;
    left: 250px;
    width: calc(100% - 250px);
    height: 60px;
    background-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 5px 20px;
    z-index: 1000;

    /* 👇 Key changes: Set display to flex and align items vertically */
    display: flex;
    align-items: center;
    /* We will control the spacing with the child element instead */
}

.header h1 {
    color: var(--primary);
    font-size: 1.8rem;
    font-weight: 600;
}

.user-menu {
    display: flex;       /* Ensures items inside are aligned */
    align-items: center; /* Aligns items vertically */
    gap: 20px;           /* Adds space between the theme switcher and avatar */
    margin-left: auto;   /* ✨ The magic! Pushes the entire menu to the right. */
}

.theme-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s;
}

.theme-btn:hover {
    transform: scale(1.1);
    border-color: rgba(0,0,0,0.1);
}

/* --- Rebuilding Theme Switcher Specific Colors --- */
/* These should *not* use var() because they are the literal colors of the buttons */
.theme-btn.blue { background-color: #143C57; }
.theme-btn.green { background-color: #2ecc71; }
.theme-btn.purple { background-color: #9b59b6; }
.theme-btn.dark { background-color: #3498db; }
.theme-btn.coral { background-color: #F35B53; }
.theme-btn.grey { background-color: #6c757d; }
.theme-btn.wine { background-color: #800020; }
.theme-btn.teal { background-color: #008080; }


.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
}

/* Dashboard Cards Layout for a single line of compact stats */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

/* --- GENERAL CARD STYLES --- */
.card {
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--card-shadow);
    padding: 15px;
    position: relative;
    overflow: hidden; /* Important: Prevents children from overflowing the card itself */
    border: 1px solid var(--border);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100px;
    width: 100%; /* Ensure card takes full width of its parent */
    box-sizing: border-box; /* Inherited, but good to ensure */
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.card-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    font-size: 1.1rem;
}
/* New: Specific icon colors for payment dashboard cards */
.card-icon.green-bg {
    background: rgba(46, 204, 113, 0.1); /* Green */
    color: #2ecc71;
}
.card-icon.orange-bg {
    background: rgba(255, 127, 80, 0.1); /* Coral */
    color: #FF7F50;
}
.card-icon.red-bg {
    background: rgba(230, 57, 70, 0.1); /* Danger */
    color: #e63946;
}


.card h3 {
    color: var(--gray);
    margin-bottom: 5px;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card .value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 5px;
    line-height: 1.2;
    /* white-overflow: hidden; <-- Typo here, should be white-space: nowrap; overflow: hidden; */
    white-space: nowrap; /* Corrected typo */
    overflow: hidden; /* Corrected typo */
    text-overflow: ellipsis;
}
/* New: Specific value colors for payment dashboard cards */
.card .value.green-text { color: #2ecc71; }
.card .value.orange-text { color: #FF7F50; }
.card .value.red-text { color: #e63946; }


.card .info {
    color: var(--gray);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive adjustments for 5 cards */
@media (max-width: 1400px) {
    .dashboard-cards {
        grid-template-columns: repeat(4, 1fr);
    }
}
@media (max-width: 1024px) {
    .dashboard-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 768px) {
    .dashboard-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 576px) {
    .dashboard-cards {
        grid-template-columns: 1fr;
    }
    .card {
        padding: 15px 20px;
        min-height: auto;
    }
    .card-icon {
        position: static;
        margin-right: 10px;
    }
    .card h3, .card .value, .card .info {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
}

/* New Grid for 2-column sections (like recent increments and notes on dashboard) */
.data-grid-2-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}
/* New: 3-column grid for dashboard, if needed */
.data-grid-3-cols {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}
@media (max-width: 1200px) {
    .data-grid-3-cols {
        grid-template-columns: 1fr 1fr;
    }
}
@media (max-width: 992px) {
    .data-grid-2-cols, .data-grid-3-cols {
        grid-template-columns: 1fr;
    }
}


.trend-up {
    color: var(--success);
}

.trend-down {
    color: var(--danger);
}

.chart-container { /* Renamed to .chart-card earlier, but updating here based on your CSS */
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--card-shadow);
    padding: 25px;
    margin-bottom: 30px; /* Adjust if using .mt-4 on card */
    border: 1px solid var(--border);
    /* Ensure it takes full width of its parent (.main-content) */
    width: 100%;
    box-sizing: border-box;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.chart-header h2 {
    color: var(--dark);
    font-size: 1.4rem;
    font-weight: 600;
}

.chart-actions {
    display: flex;
    gap: 10px;
}

/* --- BUTTON STYLES --- */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    text-decoration: none;
    box-sizing: border-box; /* Crucial for width calculation */
    flex-shrink: 0; /* Prevents buttons from shrinking excessively in flex containers */
}

.btn i {
    font-size: 0.9rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-secondary {
    background-color: var(--secondary);
    color: white;
}

.btn-accent {
    background-color: var(--accent);
    color: white;
}
.btn-info {
    background-color: var(--accent); /* Using accent for info based on your vars */
    color: white;
}

.btn-danger { /* Added explicit danger button style */
    background-color: var(--danger);
    color: white;
}


.btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Specific button size overrides */
.btn-sm { padding: 6px 10px; font-size: 0.8rem; }
.btn-lg {
    padding: 12px 25px;
    font-size: 1.1rem;
    min-width: 200px; /* Ensure button isn't too small */
}

/* --- DATA TABLE STYLES --- */
.data-table-wrapper { /* Wrapper to apply overflow for responsive tables */
    overflow-x: auto; /* Adds horizontal scrollbar if table is too wide */
    -webkit-overflow-scrolling: touch; /* Improves scrolling on touch devices */
    margin-top: 20px; /* Space above the table */
    width: 100%; /* Ensure wrapper takes full width of its parent */
    box-sizing: border-box;
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}



.data-table {
    width: 100%; /* Table itself should try to take 100% of its wrapper */
    border-collapse: collapse;
    background-color: var(--card-bg); /* Table background */
    border-radius: 12px;
    overflow: hidden; /* Important for border-radius on table */
    box-shadow: 0 4px 15px var(--card-shadow);
    border: 1px solid var(--border);
    /* min-width: 900px; */ /* Consider setting a min-width if columns are collapsing too much on smaller screens, forces scroll */
    /* Remove this if the table is still overflowing and you want it to behave responsively with display: block; on small screens */
}

.data-table th,
.data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap; /* Prevent text wrapping by default */
}

.data-table th {
    background-color: var(--dark);
    color: white;
    font-weight: 600;
}

.data-table tr:hover {
    background-color: rgba(0,0,0,0.02);
}

.data-table tr:nth-child(even) {
    background-color: rgba(0,0,0,0.01);
}

/* Specific styling for the Reason column to allow text wrapping */
.data-table td:nth-child(5) { /* Assuming Reason is the 5th column */
    white-space: normal; /* Allow text to wrap */
    word-wrap: break-word; /* Break long words */
    max-width: 250px; /* Optional: Set a max-width for reason column */
}


.form-container { /* General form container, often used as a .card */
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--card-shadow);
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid var(--border);
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: var(--dark);
}

/* --- Form Controls (Inputs, Selects, Textareas) --- */
.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
    background-color: var(--card-bg);
    color: var(--text);
    box-sizing: border-box; /* Ensure padding/border don't add to width */
}

.form-control:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.2);
}

.form-control[disabled] {
    background-color: #e9ecef;
    cursor: not-allowed;
    opacity: 0.7;
}

.form-row { /* Used for grid-based form layouts */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}



/* Calendar */
.mini-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: bold;
    color: var(--primary-color-dark);
}
.mini-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.85em;
}
.mini-calendar-grid div {
    padding: 5px 0;
    border-bottom: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
}
.mini-calendar-grid div:nth-child(7n) {
    border-right: none;
}
.mini-calendar-grid div.day-name {
    font-weight: bold;
    background-color: var(--background-color);
    color: var(--accent-color);
}
.mini-calendar-grid div.current-day {
    background-color: var(--primary-color-light);
    color: white;
    font-weight: bold;
    border-radius: 5px;
}
.mini-calendar-grid div.weekend {
    color: var(--danger-color); /* Red for weekends */
}


/* Login/Reset Page Specific Styles */
.login-container, .reset-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.login-box, .reset-box {
    width: 100%;
    max-width: 450px;
    background-color: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    padding: 40px;
    border: 1px solid var(--border);
    box-sizing: border-box;
}

.login-header, .reset-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h2, .reset-header h2 {
    color: var(--primary);
    margin-bottom: 10px;
    font-size: 1.8rem;
}

.login-logo, .reset-logo {
    width: 120px;
    height: 120px;
    margin: 0 auto 25px;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.5rem;
    box-shadow: 0 5px 5px rgba(0,0,0,0.1);
}

.security-question {
    background-color: rgba(0,0,0,0.03);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--primary);
}

.password-strength {
    height: 6px;
    background-color: #e9ecef;
    border-radius: 3px;
    margin-top: 5px;
    margin-bottom: 15px;
    overflow: hidden;
}

.password-strength-meter {
    height: 100%;
    width: 0;
    background-color: var(--danger);
    transition: width 0.3s, background-color 0.3s;
}

.password-rules {
    font-size: 0.85rem;
    color: var(--gray);
    margin-top: 10px;
}

.password-rules ul {
    padding-left: 20px;
    margin-top: 5px;
}

.password-rules li {
    margin-bottom: 3px;
}

.password-rules .valid {
    color: var(--success);
}

.password-rules .invalid {
    color: var(--danger);
}

.back-to-login {
    text-align: center;
    margin-top: 20px;
}

/* --- ALERT MESSAGES --- */
.alert {
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 25px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
    /* Added to ensure alerts respect parent width and don't overflow */
    width: 100%;
    box-sizing: border-box;
}

.alert i {
    font-size: 1.2rem;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}
.alert-warning {
    background-color: #fff3cd;
    color: #664d03;
    border: 1px solid #ffecb5;
}


/* --- ANIMATION --- */
.animated {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- UTILITY CLASSES --- */
.text-center { text-align: center; }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.mb-20 { margin-bottom: 20px; }
.mt-20 { margin-top: 20px; }
.mt-4 { margin-top: 1.5rem !important; } /* Re-affirming specific mt-4 as often used */
.hidden { display: none; }
.page-content { display: none; } /* Used for showing/hiding specific page content */
.page-content.active { display: block; }

/* Flexbox utilities for general use */
.d-flex { display: flex; }
.align-items-end { align-items: flex-end; }
.ml-1 { margin-left: 0.25rem !important; } /* Small left margin, e.g., between buttons */
.ml-2 { margin-left: 0.5rem !important; }
/* Assuming mr-3 exists for filter form as you used it in HTML */
.mr-3 { margin-right: 1rem !important; }


/* --- ACTION BUTTONS (General) --- */
.action-btn {
    padding: 8px 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    margin-right: 5px;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    box-sizing: border-box; /* Essential */
}

.action-btn i {
    font-size: 0.9rem;
}

.action-btn.edit { background-color: var(--warning); color: white; }
.action-btn.delete { background-color: var(--danger); color: white; }
.action-btn.view { background-color: var(--primary); color: white; }
/* New: Action buttons for Salary Module */
.action-btn.pay { background-color: var(--success); color: white; }
.action-btn.cancel { background-color: var(--danger); color: white; }
.action-btn.lump-sum { background-color: var(--accent); color: white; }


.import-section {
    background-color: rgba(0,0,0,0.03);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid var(--border);
}

/* --- STATUS BADGES --- */
.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-block;
    min-width: 70px; /* Ensure consistent width */
    text-align: center;
    box-sizing: border-box;
}

.status-pending { background-color: #fcefc7; color: #8d6e0b; }
.status-approved { background-color: #d4edda; color: #155724; }
.status-rejected { background-color: #f8d7da; color: #721c24; }

/* New: Salary Status Badges */
.status-generated { background-color: var(--accent); color: var(--text-light); } /* Using accent for generated */
.status-paid { background-color: var(--success); color: var(--text-light); }
.status-cancelled { background-color: var(--gray); color: var(--text-light); }

/* New: Advance Status Badges */
.status-Active { background-color: var(--success); color: var(--text-light); } /* Note: 'Active' with capital A due to ENUM value */
.status-Completed { background-color: var(--primary); color: var(--text-light); }
.status-Cancelled { background-color: var(--danger); color: var(--text-light); }


/* Priority Badges for Notes */
.priority-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-block;
    min-width: 80px;
    text-align: center;
}

.priority-low { background-color: #d1ecf1; color: #0c5460; }
.priority-medium { background-color: #fcefc7; color: #8d6e0b; }
.priority-high { background-color: #f8d7da; color: #721c24; }


/* --- CHART STYLES --- */
/* Your chart-container was likely intended to be .chart-card */
/* Renaming it to .chart-card to align with your HTML structure */
.chart-card { /* Using the .card base style */
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--card-shadow);
    padding: 25px;
    margin-top: 20px; /* Space between cards */
    border: 1px solid var(--border);
    width: 100%; /* Ensure it takes full width of its parent */
    box-sizing: border-box;
}

#deptChart { /* Specific styling for the canvas itself */
    width: 100% !important; /* Override Chart.js inline styles */
    max-width: 100%; /* Ensure it doesn't overflow */
    height: 300px; /* Set a fixed height for consistency */
}


/* --- TAB STYLES --- */
.tab-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 12px 20px;
    background-color: #f1f1f1;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}

.tab-btn.active {
    background-color: var(--primary);
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* --- INCREMENT TABLE (Specific for Increments Page) --- */
.increment-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: var(--card-bg);
    border-radius: 12px;
    overflow: hidden; /* For table border-radius */
    box-shadow: 0 4px 15px var(--card-shadow);
    border: 1px solid var(--border);
}

.increment-table th,
.increment-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.increment-table th {
    background-color: var(--dark);
    color: white;
    font-weight: 600;
}

.increment-table input, .increment-table select {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background-color: var(--card-bg);
    color: var(--text);
    box-sizing: border-box;
}

/* Specific styles for smaller inputs in the new past increments layout */
.increment-amount,
.increment-date,
.increment-notes {
    width: 100%;
    font-size: 0.9rem;
    padding: 8px 10px;
}

/* New styles for the container holding dynamic increment forms */
.form-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Changed minmin to minmax */
    gap: 20px;
    margin-top: 20px;
}

.employee-increment-form-block {
    background-color: rgba(var(--primary-rgb), 0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    animation: fadeIn 0.3s ease-out;
}

.employee-increment-form-block h4 {
    color: var(--primary);
    font-size: 1.1rem;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.employee-increment-form-block .form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}
.employee-increment-form-block .form-group {
    flex: 1;
    min-width: 150px;
    margin-bottom: 0;
}

.remove-employee-inc-block {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.remove-employee-inc-block:hover {
    background-color: rgba(var(--danger-rgb), 0.1);
}

/* Specific style for the employee selection table to give it distinction */
.employee-selection-table {
    box-shadow: none;
    border-radius: 0;
    border: none;
}
.employee-selection-table th, .employee-selection-table td {
    padding-left: 0;
    padding-right: 0;
}


.increment-table .form-control[disabled] {
    background-color: #f0f0f0;
    cursor: not-allowed;
    opacity: 0.8;
}

/* --- DEPARTMENT CARDS (For Departments Page) --- */
.department-cards-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-top: 20px;
}

.department-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--card-shadow);
    padding: 20px;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.department-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

.department-card h3 {
    color: var(--primary);
    font-size: 1.5rem;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 10px;
}

.department-card .employee-list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.department-card .employee-list-table th,
.department-card .employee-list-table td {
    padding: 10px 0;
    text-align: left;
    border-bottom: 1px dashed var(--border);
}
.department-card .employee-list-table th {
    font-weight: 600;
    color: var(--dark);
    white-space: nowrap;
}
.department-card .employee-list-table td {
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.department-card .employee-list-table .increment-data-cell {
    white-space: normal;
    max-width: none;
    vertical-align: top;
}


.department-card .employee-list-table tr:last-child td {
    border-bottom: none;
}
.department-card .employee-list-table .action-btn {
    padding: 5px 8px;
    font-size: 0.75rem;
    margin-right: 2px;
}
.department-card .employee-list-table .action-btn i {
    margin-right: 4px;
}

.employee-name-link {
    cursor: pointer;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.employee-name-link:hover {
    text-decoration: underline;
}

/* --- MODAL STYLES --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    align-items: center; /* Center modal vertically */
    justify-content: center; /* Center modal horizontally */
}

.modal-content {
    background-color: var(--card-bg);
    margin: auto; /* For centering without flexbox */
    padding: 25px 30px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 700px; /* Default max-width for modals */
    position: relative;
    animation: fadeIn 0.3s ease-out;
    max-height: 80vh; /* Max height for scrollable modal content */
    display: flex;
    flex-direction: column;
}
/* New: Larger modal for salary generation table */
.modal-content.large {
    max-width: 95%;
    max-height: 95vh;
}


.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 1.6rem;
    color: var(--dark);
}

.modal-close-btn {
    color: var(--gray);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
}

.modal-close-btn:hover,
.modal-close-btn:focus {
    color: var(--danger);
    text-decoration: none;
}

.modal-body {
    overflow-y: auto; /* Allow content inside modal body to scroll */
    padding-right: 10px; /* Space for scrollbar */
}

.modal-body table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.modal-body table th,
.modal-body table td {
    padding: 10px;
    border: 1px solid var(--border);
    text-align: left;
    font-size: 0.9rem;
}

.modal-body table th {
    background-color: var(--dark);
    color: white;
}

.modal-body table tr:nth-child(even) {
    background-color: rgba(0,0,0,0.01);
}

.modal-body table tr:hover {
    background-color: rgba(0,0,0,0.03);
}

.modal-body .no-history {
    text-align: center;
    padding: 20px;
    color: var(--gray);
}

.checkbox-container-large {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    cursor: pointer;
    position: relative;
    padding: 5px;
    box-sizing: border-box;
}

.checkbox-container-large input[type="checkbox"] {
    position: relative;
    margin: 0;
    transform: scale(1.2);
}

.checkbox-container-large:hover {
    background-color: rgba(var(--primary-rgb), 0.1);
}

/* IMPORTANT: This rule makes disabled inputs look disabled */
.form-control:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
    opacity: 0.7;
}

/* New CSS for employee ID hover links */
.employee-details-hover {
    cursor: pointer;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s, text-decoration 0.2s;
}

.employee-details-hover:hover {
    text-decoration: underline;
    color: var(--accent);
}

/* WYSIWYG Editor specific styles (TinyMCE) */
.tox-tinymce {
    border: 1px solid var(--border) !important;
    border-radius: 8px !important;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.05) !important;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.tox-tinymce.tox-fullscreen {
    z-index: 10000 !important;
}

.tox-editor-container {
    background-color: var(--card-bg) !important;
    color: var(--text) !important;
}

.tox-toolbar-overlord, .tox-menu, .tox-menubar, .tox-statusbar {
    background-color: var(--light) !important;
    color: var(--dark) !important;
    border-color: var(--border) !important;
}

.tox-toolbar__group, .tox-tbtn, .tox-collection__item {
    color: var(--text) !important;
}

.tox-tbtn:hover, .tox-tbtn--enabled, .tox-collection__item--active, .tox-collection__item:hover {
    background-color: rgba(var(--primary-rgb), 0.1) !important;
    color: var(--primary) !important;
}

.tox .tox-tbtn--disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tox-edit-area__iframe {
    background-color: var(--card-bg) !important;
    color: var(--text) !important;
}

/* Styles for notes page filters */
.notes-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px var(--card-shadow);
    border: 1px solid var(--border);
    align-items: flex-end;
    width: 100%; /* Ensure filter bar takes full width */
    box-sizing: border-box;
}

.notes-filter-bar .form-group {
    flex: 1;
    min-width: 180px;
    margin-bottom: 0;
}

.notes-filter-bar .form-group label {
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.notes-filter-bar .btn {
    padding: 10px 20px;
    min-width: 120px;
    justify-content: center;
}

@media (max-width: 768px) {
    .notes-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .notes-filter-bar .form-group {
        min-width: unset;
        width: 100%;
    }
}

/* View Note Specific Styles */
.detail-item {
    margin-bottom: 10px;
    font-size: 1.05rem;
}
.detail-item strong {
    color: var(--dark);
    display: inline-block;
    min-width: 120px;
}
.note-content-display h3 {
    color: var(--dark);
    margin-bottom: 15px;
    font-size: 1.2rem;
}
.actual-content-area {
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background-color: var(--light);
}

/* New: Add/Edit Note Page Specific Styles */
.form-grid-3-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px; /* Space before next section */
}

.form-section-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    margin-bottom: 20px;
    margin-top: 30px; /* Space after previous form elements */
}

.form-section-header:first-of-type {
    margin-top: 0; /* No top margin for the very first header */
}

.form-section-header h3 {
    font-size: 1.2rem;
    color: var(--dark);
    margin-bottom: 0;
}

.form-actions-bottom {
    margin-top: 40px; /* More space above the final action button */
    display: flex;
    gap: 15px;
    justify-content: flex-end; /* Align buttons to the right */
}
/* For forms with single submit button that should be wide */
.form-actions-bottom.full-width {
    justify-content: stretch;
}
.form-actions-bottom.full-width .btn {
    flex-grow: 1;
}


/* New: Styles for Generate Salary Table */
.salary-generation-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: var(--card-bg);
    border-radius: 12px;
    overflow: hidden; /* Important for table border-radius */
    box-shadow: 0 4px 15px var(--card-shadow);
    border: 1px solid var(--border);
    /* min-width: 1000px; */ /* If table content makes it too wide, uncomment this to force scroll */
}

.salary-generation-table th,
.salary-generation-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    white-space: nowrap; /* Prevent text wrapping in cells by default */
}

.salary-generation-table th {
    background-color: var(--dark);
    color: white;
    font-weight: 600;
}

.salary-generation-table td {
    font-size: 0.9rem;
    color: var(--text);
}

.salary-generation-table input[type="number"],
.salary-generation-table input[type="text"],
.salary-generation-table textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 0.9rem;
    background-color: var(--light); /* Slightly different background for inputs in table */
    color: var(--text);
    box-sizing: border-box; /* Crucial */
}
.salary-generation-table input[type="number"]:focus,
.salary-generation-table input[type="text"]:focus,
.salary-generation-table textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.2);
}

.salary-generation-table .net-pay-cell {
    font-weight: bold;
    color: var(--primary);
    font-size: 1rem;
    white-space: nowrap;
}
.salary-generation-table .net-pay-cell.negative {
    color: var(--danger);
}

.salary-generation-table .include-extras-checkbox {
    transform: scale(1.1);
    margin-left: 5px;
}

.salary-generation-table .extras-fields {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 5px;
    font-size: 0.8rem;
}
.salary-generation-table .extras-fields input {
    width: 80px; /* Smaller inputs for extras */
    padding: 4px;
    font-size: 0.8rem;
}
.salary-generation-table .extras-fields label {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 0;
    font-weight: normal;
    color: var(--gray);
}

/* Styling for Month/Year picker */
.month-year-picker {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}
.month-year-picker .form-group {
    flex: 1;
    min-width: 120px;
    margin-bottom: 0;
}
.month-year-picker .form-control {
    padding: 10px;
}

/* Checkbox for select all in tables */
.select-all-checkbox {
    transform: scale(1.2);
    margin-right: 5px;
}

/* Styles for the "Mark as Paid" modal form */
#markAsPaidModal .modal-body .form-group {
    margin-bottom: 15px;
}
#markAsPaidModal .modal-body .form-group label {
    margin-bottom: 5px;
    font-size: 0.95rem;
}
#markAsPaidModal .modal-body .form-control {
    padding: 10px 12px;
    font-size: 0.95rem;
}

/* Styles for Advance Payment forms */
.advance-form-section {
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--card-shadow);
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid var(--border);
}

.advance-form-section h3 {
    color: var(--dark);
    font-size: 1.4rem;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

/* Specific styles for advance history table */
.advance-history-table th,
.advance-history-table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px; /* Adjust as needed */
}
.advance-history-table td:last-child {
    max-width: none; /* Allow action buttons to take space */
}

/* Specific styles for advance repayment history modal table */
#advanceRepaymentHistoryModal .modal-body table th,
#advanceRepaymentHistoryModal .modal-body table td {
    white-space: normal;
    max-width: none;
}

/* Responsive adjustments for tables with many columns (e.g., generate salary) */
/* The "flip table" effect for small screens */
@media (max-width: 1200px) { /* This breakpoint applies the table transformation */
    /* This rule set applies to both .salary-generation-table and .data-table */
    .salary-generation-table,
    .data-table {
        display: block; /* Make the table a block element */
        width: 100%;
        /* overflow-x: auto; */ /* This should ideally be on the wrapper, but sometimes needed here too if table is direct child of container */
    }
    .salary-generation-table thead,
    .salary-generation-table tbody,
    .salary-generation-table th,
    .salary-generation-table td,
    .salary-generation-table tr {
        display: block; /* Make table elements stack */
    }
    .salary-generation-table thead tr {
        position: absolute; /* Hide table headers visually */
        top: -9999px;
        left: -9999px;
    }
    .salary-generation-table tr {
        border: 1px solid var(--border);
        margin-bottom: 10px;
        border-radius: 8px;
    }
    .salary-generation-table td {
        border: none; /* Remove individual cell borders */
        border-bottom: 1px solid var(--border); /* Add bottom border for separation */
        position: relative;
        padding-left: 50%; /* Make space for the data-label */
        text-align: right;
    }
    .salary-generation-table td:before {
        position: absolute;
        top: 0;
        left: 6px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        color: var(--dark);
        content: attr(data-label); /* Use data-label for column names */
    }
    .salary-generation-table td:last-child {
        border-bottom: none; /* Remove bottom border for last cell in row */
    }
    .salary-generation-table .extras-fields {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 10px;
    }
    .salary-generation-table .extras-fields label {
        flex-basis: 45%;
        justify-content: flex-end;
    }
    .salary-generation-table .extras-fields input {
        width: auto;
        flex-grow: 1;
    }
    
    /* Modern Late Rule Form */
    .modern-form .form-group {
        margin-bottom: 20px;
    }
    .modern-form label {
        font-weight: 600;
        margin-bottom: 8px;
        display: block;
    }
    .modern-form input,
    .modern-form select {
        padding: 8px 12px;
        border-radius: 6px;
        border: 1px solid #ccc;
        width: 100%;
    }
    .modern-form .form-actions {
        margin-top: 20px;
    }
}

#deptChart {
    max-height: 300px;
}

/* --- Pagination Styles --- */

.pagination-controls {
    /* Existing: d-flex justify-content-center for centering from Bootstrap is applied in PHP */
    margin-top: 20px; /* Space above pagination block */
    display: flex; /* Ensure it's a flex container for centering */
    justify-content: center; /* Center the pagination ul */
}

.pagination {
    /* Existing: Bootstrap handles most of this */
    display: flex;
    padding-left: 0;
    list-style: none;
    border-radius: .25rem;
}

.page-item:first-child .page-link {
    border-top-left-radius: .25rem;
    border-bottom-left-radius: .25rem;
}

.page-item:last-child .page-link {
    border-top-right-radius: .25rem;
    border-bottom-right-radius: .25rem;
}

.page-link {
    position: relative;
    display: block;
    padding: .5rem .75rem;
    margin-left: -1px; /* To make borders overlap neatly */
    line-height: 1.25;
    color: var(--primary); /* Text color for clickable pages */
    background-color: var(--card-bg); /* Background for non-active pages */
    border: 1px solid var(--border); /* Border color for pages */
    text-decoration: none; /* Ensure no underline */
    transition: all 0.3s ease; /* Smooth hover effects */
}

.page-link:hover {
    z-index: 2; /* Ensures hover state border is on top */
    color: var(--primary); /* Maintain primary color or choose accent */
    background-color: rgba(var(--primary-rgb), 0.1); /* Light background on hover */
    border-color: var(--primary); /* Border matches primary on hover */
    text-decoration: none; /* Ensure no underline on hover */
}

.page-item.active .page-link {
    z-index: 3; /* Active page on top */
    color: var(--text-light); /* White text for active page */
    background-color: var(--primary); /* Primary background for active page */
    border-color: var(--primary); /* Primary border for active page */
}

.page-item.disabled .page-link {
    color: var(--gray); /* Grayed out text for disabled links (e.g., "Previous" on first page) */
    pointer-events: none; /* Prevents clicking disabled links */
    background-color: var(--card-bg); /* Match background of other non-active pages */
    border-color: var(--border); /* Match border of other non-active pages */
    cursor: default; /* Indicate it's not clickable */
}

/* --- Sidebar Styles --- */

.collapsible {
  width: 100%;
  background: #34495e;
  color: white;
  padding: 10px;
  border: none;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
}

.submenu {
  display: none;
  list-style: none;
  padding-left: 20px;
  background: #3b4d61;
  position: relative;       /* keep submenus inside the flow */
  z-index: 1;               /* lower than header */
}

.submenu li a {
  display: block;
  padding: 8px 10px;
  color: white;
  text-decoration: none;
}

.submenu li a:hover {
  background: #16a085;
}

/* --- MAIN LAYOUT STRUCTURE --- */
.container {
    display: flex; /* Arranges sidebar and main-content horizontally */
    min-height: 100vh; /* Ensure container takes full viewport height */
}

/* ===== MODERN SIDEBAR ===== */
.sidebar {
    width: 250px; /* Slightly wider for better content display */
    height: calc(100vh - 40px); /* Full height minus header height */
    position: fixed;
    top: 0;
    left: 0;
    background: var(--sidebar-bg); /* Now using your theme's sidebar background */
    color: var(--sidebar-text); /* Now using your theme's sidebar text color */
    transition: width 0.3s ease-in-out, transform 0.3s ease-in-out; /* Added transform for mobile slide */
    overflow-y: auto;           /* Allow vertical scrolling if content exceeds height */
    z-index: 1000; /* High z-index to be on top */
    display: flex;
    flex-direction: column;
    border-radius: 0 15px 15px 0; /* Rounded right edge */
    box-shadow: 10px 0 10px rgba(0,0,0,0.2);
}

/* Hides sidebar on desktop */
.sidebar.hidden {
    left: -250px;
}

/* Collapsed Sidebar */
.sidebar.collapsed {
    width: 80px; /* Wider collapsed state for icon visibility */
}

/* Sidebar Header */
.sidebar-header {
  display: flex;
  align-items: center;      /* Align logo and text vertically */
  gap: 8px;                /* Space between logo and text */
  background: var(--sidebar-bg);      /* Example: match your sidebar bg */
  padding: 18px 20px;
  height: 95px;             /* Optional: lock height for consistency */
  width: 250px; /* Slightly wider for better content display */
  position: fixed;       /* For menu icon overlay, if needed */
  z-index: 3000;
}

.sidebar-logo {
  height: 50px;            /* Adjust to your logo's natural size */
  width: 50px;
  border-radius: 50%;      /* Optional: round logo */
  object-fit: contain;
  background: #fff0;       /* Transparent, or match your design */
  flex-shrink: 0;
  position: sticky;
}

.sidebar-header-text {
  display: flex;
  flex-direction: column;
  justify-content: center;    /* Vertically center within logo height */
  height: 50px;               /* Match logo height for perfect stacking */
}

.sidebar-title {
  font-size: 1.3em;
  font-weight: bold;
  color: #fff;
  margin-bottom: 2px;
  letter-spacing: 1px;
  line-height: 1.15;
}

.sidebar-tagline {
  font-size: 0.9em;
  color: #eee;
  opacity: 0.7;
  line-height: 1.42em;
  max-width: 140px;

}
.sidebar-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--sidebar-text);
    white-space: nowrap; /* Prevent text wrapping */
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out, visibility 0s linear 0.3s;
}

.sidebar-header p {
    font-size: 14px;
    margin: 5px 0 0;
    opacity: 0.9;
    white-space: nowrap;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out, visibility 0s linear 0.3s;
}

/* Header in Collapsed State */
.sidebar.collapsed .sidebar-header h2,
.sidebar.collapsed .sidebar-header p {
    opacity: 0;
    transform: translateX(-20px);
    pointer-events: none; /* Disable interaction */
    visibility: hidden; /* Ensures element is completely hidden */
    transition-delay: 0s; /* No delay for hiding */
}

/* ===== MENU STYLING ===== */
.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 10px 0;
    flex-grow: 1;
    margin-top: 105px;
    position: relative;       /* create stacking context */
    z-index: 1;               /* ensures it's below header */
}

.sidebar-menu li {
    margin-bottom: 8px; /* More spacing between items */
}

.sidebar-menu li a,
.collapsible {
    display: flex;
    align-items: center;
    gap: 15px; /* Consistent spacing */
    padding: 15px 25px; /* More padding for larger clickable area */
    font-size: 15px;
    font-weight: 500;
    color: var(--sidebar-text);
    text-decoration: none;
    border-left: 5px solid transparent; /* Thicker border on active/hover */
    transition: background 0.3s ease, border-left 0.3s ease, color 0.3s ease, padding 0.3s ease;
    cursor: pointer;
    border-radius: 0 30px 30px 0; /* Rounded right edge for menu items */
    overflow: hidden; /* For text transition in collapsed state */
    white-space: nowrap;
}

.sidebar-menu li a i,
.collapsible i {
    font-size: 1.3rem; /* Slightly larger icons */
    width: 25px; /* Fixed width for icons */
    text-align: center;
    flex-shrink: 0; /* Prevent icon from shrinking */
}

.sidebar-menu li a span,
.collapsible span {
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
    flex-grow: 1; /* Allows text to take available space */
}

/* Hover & Active Effects */
.sidebar-menu li a:hover,
.collapsible:hover {
    background: rgba(255, 255, 255, 0.2); /* Using fixed rgba for hover background */
    border-left-color: var(--primary); /* Using your theme's primary color */
    transform: translateX(5px); /* Subtle slide animation on hover */
}

.sidebar-menu li a.active,
.collapsible.active {
    background: rgba(255, 255, 255, 0.2); /* Using fixed rgba for active background */
    border-left-color: var(--accent); /* Using your theme's accent color for active border */
    font-weight: 600;
}

/* ===== COLLAPSIBLE MENU ===== */
.collapsible {
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    display: flex; /* Ensure flex for icon/text/chevron arrangement */
    justify-content: space-between; /* Push chevron to the right */
}

.collapsible i.fa-chevron-right {
    margin-left: auto; /* Pushes the chevron to the far right */
    transition: transform 0.3s ease;
    font-size: 0.9rem; /* Smaller chevron icon */
    color: rgba(255, 255, 255, 0.7); /* Lighter color */
}

.collapsible.active i.fa-chevron-right {
    transform: rotate(90deg);
}

/* Submenu Styling */
.submenu {
    display: none; /* Managed by JS */
    list-style: none;
    padding-left: 0; /* Submenu items will handle their own padding for alignment */
    background: rgba(0, 0, 0, 0.15); /* Darker background for distinction */
    max-height: 0; /* For collapse animation */
    overflow: hidden; /* Hide overflow during animation */
    transition: max-height 0.3s ease-out, padding-top 0.3s ease-out, padding-bottom 0.3s ease-out;
    position: relative;       /* keep submenus inside the flow */
    z-index: 1;               /* lower than header */
}

.submenu.open {
    display: block; /* Make sure it's block for max-height animation */
    max-height: 500px; /* A value larger than the expected submenu height */
    padding-top: 10px; /* Add padding for visual spacing when open */
    padding-bottom: 10px;
}

.submenu li a {
    padding: 10px 25px 10px 60px; /* Deeper indentation for submenu items */
    font-size: 15px;
    opacity: 0.95;
    border-radius: 0px; /* Remove specific rounded corners for submenu items if not desired */
    border-left: 0 solid transparent; /* Thinner border for submenu active/hover */
    border-right: 0 solid transparent; /* Thinner border for submenu active/hover */
    background: transparent; /* Ensure no residual background from parent menu */
    position: relative; /* CRUCIAL: Parent needs positioning context for absolute children */
    display: block; /* Ensures the link takes up full space and padding works as expected */
    text-decoration: none;
    color: var(--text-color, #eee); /* Example default text color */
    white-space: nowrap; /* Prevent text wrapping if links are long */
    overflow: hidden; /* Hide overflowing text if nowrap is used */
    text-overflow: ellipsis; /* Add ellipsis for overflowing text */
}

/* Arrow/Bullet Before Each Submenu Item - Initially Hidden */
.submenu li a::before {
    content: "•";
    position: absolute;
    left: 35px; /* Adjust this to align with your desired position */
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--primary); /* Default color, could be transparent if you want it to fade in */
    opacity: 0; /* Make it invisible by default */
    transition: transform 0.2s ease, color 0.2s ease, opacity 0.2s ease; /* Add opacity to transition */
}

/* Show bullet and apply active styles only when the link has the 'active' class */
.submenu li a.active::before {
    opacity: 1; /* Make it visible */
    transform: translateY(-50%) translateX(5px); /* Apply the slight shift */
    color: var(--secondary); /* Active color */
}

/* Still allow hover effect for non-active items if desired */
.submenu li a:not(.active):hover::before {
    opacity: 0.5; /* Slightly show on hover for non-active */
    transform: translateY(-50%) translateX(2px); /* Slight shift on hover */
}
/* Highlight active submenu link */
.submenu li a.active {
    background: transparent;
    border-left-color: var(--accent); /* Using your theme's accent color */
    font-weight: 600;
}

/* Keep submenu open if it has an active link */
.submenu li a.active::before {
    color: var(--accent); /* Using your theme's accent color */
}


/* ===== COLLAPSED STATE STYLING ===== */
.sidebar.collapsed .sidebar-header h2,
.sidebar.collapsed .sidebar-header p {
    opacity: 0;
    visibility: hidden; /* Hide completely */
    transition: opacity 0.2s, visibility 0.2s;
}

.sidebar.collapsed a span,
.sidebar.collapsed .collapsible span {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    width: 0; /* Collapse text width */
}

.sidebar.collapsed a,
.sidebar.collapsed .collapsible {
    justify-content: center; /* Center icons */
    padding: 15px 0; /* Adjust padding for icon-only display */
}

.sidebar.collapsed .submenu {
    /* Submenus should generally be hidden in collapsed state or
        be handled by specific JS for flyout menus */
    display: none;
}

/* Hide chevron in collapsed state */
.sidebar.collapsed .collapsible i.fa-chevron-right {
    display: none;
}

.page-title {
    font-size: 15px;
    font-weight: 600;
    padding-left: 30px; /* 👈 Adjust padding here */
    margin: 15px 0;
    color: var(--text-color); /* Works with theme */
}

/* Main content adjustment based on sidebar state */
.main-content {
    margin-top: 40px; /* Below header */
    flex-grow: 1;
    flex-shrink: 1; /* From second file */
    flex-basis: auto; /* From second file */
    margin-left: 250px; /* Match sidebar width */
    padding: 25px; /* More generous padding */
    background-color: var(--light); /* Using your theme's light background */
    color: var(--text); /* Using your theme's text color */
    transition: margin-left 0.3s ease-in-out;
    overflow-x: hidden;
    overflow-y: auto;
}

.sidebar.collapsed + .main-content {
    margin-left: 60px; /* Adjust margin when sidebar is collapsed */
}

/* When sidebar is hidden, shift content */
.main-content.shifted {
    margin-left: 0 !important;
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.sidebar-overlay.active {
    display: block;
}

/* Overlay for general use (e.g., modals) */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6); /* Darker overlay */
    z-index: 999; /* Below sidebar, above main content */
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile fixes */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%); /* Use transform to slide off-screen */
        border-radius: 0; /* Remove rounded corner for full mobile slide */
    }
    .sidebar.active {
        left: 0; /* slide in */
        transform: translateX(0); /* Slide in sidebar */
    }
    .main-content {
        margin-left: 0 !important; /* Main content takes full width on mobile */
        width: 100%;
        padding: 15px;
    }
    .sidebar.collapsed { /* Ensure collapsed state still hides */
        transform: translateX(-100%);
    }
    .sidebar.collapsed.active {
        transform: translateX(0); /* Still slide in if active */
    }
    .sidebar-logo {
        height: 62px;
  }
  .sidebar-title {
    font-size: 1.1em !important;
    font-weight: bold;
    color: #fff !important;
    margin-bottom: 2px !important;
    line-height: 1.1 !important;
    letter-spacing: 0.5px;
  }
  .sidebar-tagline {
    white-space: nowrap !important;      /* Prevents wrapping */
    overflow: hidden;                    /* Optional: hides overflow */
    text-overflow: ellipsis;             /* Optional: adds ... if too long */
    max-width: 100%;                     /* Use full width of sidebar */
    font-size: 0.95em !important;        /* (Optional) adjust for fit */
  }
    .sidebar-header {
        padding-top: 82px;       /* Less top padding on mobile */
        background: var(--sidebar-bg);
    }     
}

/* 🔹 Keep header transparent only for mobile */
@media (max-width: 676px) {
    .header {
        flex-direction: column;
        align-items: center;
        background-color: transparent !important;
        border: none !important;
        box-shadow: none !important;
        left: 0;
        width: 100%;
}
    }

/* --- Corrected Toggle Button CSS --- */

/* 1. Hide the toggle button by default (for desktop view) */
.page-sidebar-toggle {
    display: none; /* Hide by default */
    position: fixed;
    top: 10px;
    left: 15px;
    background: var(--primary);
    color: white;
    padding: 10px;
    font-size: 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    z-index: 2000;
    align-items: center;
}

.page-sidebar-toggle:hover {
    background: var(--primary-hover, #0056b3);
}

/* 2. Show the toggle button ONLY on mobile/tablet screens */
@media (max-width: 768px) {
    .page-sidebar-toggle {
        display: flex; /* This makes it visible on screens 768px and smaller */
    }
}

/* Transition for sidebar */
.sidebar {
    transition: left 0.3s ease, width 0.3s ease;
}



/* When sidebar is collapsed */
.sidebar.collapsed ~ .header {
    left: 60px; /* Collapsed sidebar width */
    width: calc(100% - 60px);
}

/* Footer */
.footer {
    background: var(--sidebar-bg); /* Matches theme */
    color: var(--sidebar-text); /* Matches theme text */
    text-align: center;
    padding: 12px;
    padding-bottom: 25px;
    font-size: 12px;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;}

.footer a {
  color: #fff;                  /* white */
  text-decoration: none;
  transition: color .2s ease;
}
.footer a:hover,
.footer a:focus {
  color: aqua;                  /* hover/focus = aqua */
}
.footer a:visited {
  color: #fff;                  /* keep visited links white too */
}


