* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #117e62;
    --secondary-color: #18725e;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-bg: #f8f9fa;
    --dark-bg: #343a40;
    --border-color: #dee2e6;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #b3b000, #003d82);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Keep the page behind dialogs completely still.  A stable scrollbar prevents
   the layout from shifting horizontally when scrolling is locked. */
html {
    scrollbar-gutter: stable;
}

body.modal-open {
    overflow: hidden;
    overscroll-behavior: none;
}

.hidden {
    display: none !important;
}

/* Login Page */
/* 100vh */
.page-container {
    min-height: 100%;
}

.login-wrapper {
    max-width: 450px;
    margin: 0 auto;
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.company-logo {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    padding: 10px;
}

.company-logo img {
    width: 100px;
    height: auto;
    object-fit: contain;
}

.login-header h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

.login-header p {
    font-size: 16px;
    opacity: 0.9;
}

.login-form {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
}

/* .login-hint {
    text-align: center;
    margin-top: 15px;
    font-size: 13px;
    color: var(--text-secondary);
} */

/* Dashboard Layout */
#dashboardPage {
    display: grid;
    grid-template-areas:
        "nav nav"
        "sidebar main";
    grid-template-columns: 250px 1fr;
    grid-template-rows: 70px 1fr;
    min-height: 100vh;
    background: var(--light-bg);
}

/* Top Navigation */
.top-nav {
    grid-area: nav;
    background: white;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--primary-color);
    cursor: pointer;
    padding: 10px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
}

.nav-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-user span {
    font-weight: 500;
    color: #28a745 !important;
}

/* Enforce success color for the welcome message and user display */
#welcomeUserName, #currentUserName {
    color: #28a745 !important;
}

/* Sidebar */
.sidebar {
    grid-area: sidebar;
    background: white;
    padding: 20px 0;
    box-shadow: var(--shadow);
    overflow-y: auto;
    transition: transform 0.3s ease;
}

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

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 25px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(17, 126, 98, 0.1);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.sidebar-menu i {
    font-size: 18px;
    width: 20px;
}

/* Main Content */
.main-content {
    grid-area: main;
    padding: 30px;
    overflow-y: auto;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.3s;
}

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

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h2 {
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
}

.stat-icon.bg-blue {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-icon.bg-green {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.stat-icon.bg-orange {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-icon.bg-red {
    background: linear-gradient(135deg, #862744 0%, #fee140 100%);
}

.stat-info h3 {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

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

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

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

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

.password-field {
    position: relative;
    width: 100%;
}

.password-field > input {
    width: 100%;
    box-sizing: border-box;
    padding-right: 46px;
}

.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    line-height: 1;
    z-index: 1;
}

#loginPage .password-field .password-toggle { right: 10px; }
.stat-card.is-actionable { cursor: pointer; }
#dashboardStaffCard[title], #dashboardGuardsCard[title] { cursor: pointer; }

.table-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 14px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

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

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

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

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

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

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Loading skeleton for async per-employee breakdowns */
.skeleton {
    position: relative;
    overflow: hidden;
    background: #e9ecef;
    border-radius: 4px;
}
.skeleton::after {
    content: "";
    position: absolute;
    top: 0;
    left: -150px;
    width: 150px;
    height: 100%;
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.6), rgba(255,255,255,0));
    animation: shimmer 1.2s infinite;
}
@keyframes shimmer {
    0% { left: -150px; }
    100% { left: 100%; }
}

/* Details row styling inside bulk modal */
.bulk-details-row td {
    background: #fafafa;
    padding: 12px;
    border-top: 1px solid var(--border-color);
}
.bulk-details-table {
    width: 100%;
    border-collapse: collapse;
}
.bulk-details-table td {
    padding: 6px 8px;
    border-bottom: 1px dashed var(--border-color);
}
.bulk-details-header {
    font-weight: 600;
    margin-bottom: 8px;
}

/* Tables */
.table-responsive {
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow-x: auto;
    overflow-y: auto;
    max-height: min(68vh, 760px);
    overscroll-behavior: contain;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--primary-color);
    color: white;
}

/* Keep column labels available while a long table scrolls. */
.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--primary-color);
}

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

.data-table tbody tr:hover {
    background: rgba(17, 126, 98, 0.05);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.timesheet-table {
    min-width: 1200px;
    table-layout: auto;
}

.timesheet-table th,
.timesheet-table td {
    white-space: nowrap;
    text-align: center;
}

.timesheet-table th:first-child,
.timesheet-table td:first-child,
.timesheet-table th:nth-child(2),
.timesheet-table td:nth-child(2) {
    text-align: left;
}

.timesheet-cell.marked {
    background: #e8f7ee;
    color: #176c35;
    font-weight: 600;
}

.timesheet-cell.unmarked {
    background: #fff5f5;
    color: #9b1c1c;
}

.guard-selection-container {
    max-height: 320px;
    overflow: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.bulk-employee-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #eef2f7;
}

.bulk-employee-row:last-child {
    border-bottom: 0;
}

/* Status Badges */
.badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
}

.badge-danger {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

.badge-warning {
    background: rgba(255, 193, 7, 0.1);
    color: #856404;
}

.badge-info {
    background: rgba(23, 162, 184, 0.1);
    color: var(--info-color);
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.filter-select {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    min-width: 150px;
}

#guard-operations .section-header {
    margin-bottom: 16px;
}

.guard-ops-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
}

.guard-ops-tabs .tab-btn {
    border: 1px solid var(--border-color);
    background: var(--light-color);
    color: var(--secondary-color);
    border-radius: 6px;
    padding: 9px 12px;
    white-space: nowrap;
    cursor: pointer;
    font-weight: 600;
}

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

.guard-ops-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    margin-bottom: 10px;
}

#management-reports .filter-bar {
    align-items: center;
}

#management-reports .data-table td:nth-child(5) {
    min-width: 260px;
    color: var(--text-color);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    /* Do not blur/scale the page behind a dialog: it can look like a zoom. */
    backdrop-filter: none;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* FIX: Paystack OTP modal must always be above any other modals/overlays */
#paystackOtpModal.modal {
    position: fixed;
    z-index: 20000 !important;
    background-color: rgba(0, 0, 0, 0.55);
}

#paystackOtpModal.modal.active {
    display: flex !important;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: none;
}

.modal-content {
    background: white;
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    animation: none;
}

.modal-content.modal-lg {
    max-width: 900px;
}

/* Long modal tables (especially bulk payment) scroll independently while
   retaining their headers and keeping the modal actions reachable. */
.modal-content .table-responsive {
    max-height: min(52vh, 560px);
}

.modal-content .modal-header {
    position: sticky;
    top: 0;
    z-index: 4;
    background: white;
}

.modal-content .modal-footer,
.modal-content .bulk-payment-content > .btn-block {
    position: sticky;
    bottom: 0;
    z-index: 3;
    background: white;
    padding-bottom: 12px;
}

.table-responsive.is-loading::after {
    content: "Loading more records…";
    display: block;
    padding: 12px;
    text-align: center;
    color: var(--primary-color);
    font-weight: 600;
}

.modal-content.modal-sm {
    max-width: 400px;
}

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

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

.modal-header h3 {
    margin: 0;
    color: var(--secondary-color);
}

.close {
    font-size: 28px;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: var(--danger-color);
}

.modal-content form {
    padding: 25px;
}

/* Camera Section */
.camera-section {
    margin: 20px 0;
    text-align: center;
}

#cameraVideo {
    width: 100%;
    max-width: 400px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
}

#capturedImage img {
    width: 100%;
    max-width: 400px;
    border-radius: 10px;
    margin-top: 15px;
}

/* Activity List */
.recent-activity {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.activity-list {
    margin-top: 20px;
}

.activity-item {
    padding: 15px;
    border-left: 3px solid var(--primary-color);
    background: var(--light-bg);
    margin-bottom: 15px;
    border-radius: 5px;
}

.activity-item:last-child {
    margin-bottom: 0;
}

.activity-item .time {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* Notifications */
.notifications-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.notification {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--info-color);
}

.notification.success {
    border-left-color: var(--success-color);
}

.notification.error {
    border-left-color: var(--danger-color);
}

.notification.warning {
    border-left-color: var(--warning-color);
}

.notification strong {
    display: block;
    margin-bottom: 5px;
}

.notification .time {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 10px;
}

.notification {
    cursor: pointer;
}

.notification.is-unread {
    border-left-width: 5px;
    background: #ffffff;
}

.notification.is-read {
    opacity: 0.82;
}

.notification-detail-message {
    margin-top: 16px;
    padding: 14px;
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.detail-section {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.detail-section h4 {
    margin-bottom: 12px;
    color: var(--primary-color);
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
}

.detail-table td {
    padding: 8px 0;
    border-bottom: 1px solid #f0f2f4;
    vertical-align: top;
}

.detail-table td:first-child {
    width: 42%;
    color: var(--text-secondary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.code-block {
    max-height: 280px;
    overflow: auto;
    padding: 12px;
    background: #111827;
    color: #f8fafc;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.5;
}

/* Payment Details */
.payment-details {
    background: var(--light-bg);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.payment-details .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.payment-details .detail-row:last-child {
    border-bottom: none;
    font-weight: bold;
    font-size: 18px;
}

/* OTP Input */
.otp-content {
    padding: 30px;
    text-align: center;
}

.otp-input {
    text-align: center;
    font-size: 24px;
    letter-spacing: 10px;
    font-weight: bold;
    margin: 20px 0;
}

.otp-timer {
    color: var(--text-secondary);
    margin: 15px 0;
}

/* Payslip */
.payslip-generator {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

/* Add to your payslip preview CSS or inline in the generated HTML */
.payslip-preview {
    width: 8.5in;
    min-height: 11in;
    padding: 0.5in;
    box-sizing: border-box;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 12pt;
    line-height: 1.4;
    color: #000;
    background: #fff;
}

.payslip-preview * {
    color: #000 !important; /* Force black text for PDF */
}

/* Prevent content from being cut off */
.payslip-section {
    page-break-inside: avoid;
    margin-bottom: 15px;
}

.payslip-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed #ccc;
}

.payslip-total {
    font-weight: bold;
    font-size: 14pt;
    border-top: 2px solid #000;
    padding-top: 10px;
    margin-top: 10px;
    page-break-inside: avoid;
}

.payslip-header {
    text-align: center;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 20px;
    margin-bottom: 30px;
}

/* .payslip-section {
    margin-bottom: 25px;
} */

/* .payslip-preview {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: var(--shadow);
} */

/* .payslip-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border-color);
} */

/* .payslip-total {
    font-weight: bold;
    font-size: 18px;
    border-top: 2px solid var(--primary-color);
    padding-top: 15px;
    margin-top: 15px;
} */

/* Attendance Summary */
.attendance-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    text-align: center;
}

.summary-card h4 {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 10px;
}

.summary-card p {
    font-size: 32px;
    font-weight: bold;
    color: var(--primary-color);
}

/* Image Preview Overlay */
.image-preview-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    display: none;
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.image-preview-overlay.active {
    display: flex;
}

.preview-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.preview-content img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.close-preview {
    position: absolute;
    top: -40px; right: 0;
    color: white; font-size: 35px; cursor: pointer;
}

/* Account Creation */
.account-creation-form {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    max-width: 800px;
}

.generated-id-display {
    background: var(--light-bg);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin: 20px 0;
    border: 2px dashed var(--primary-color);
}

.generated-id-display strong {
    color: var(--primary-color);
    font-size: 20px;
}

/* Bulk Paymentk */
.bulk-payment-content {
    padding: 25px;
}

.bulk-summary {
    background: var(--light-bg);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.bulk-summary h4 {
    margin-bottom: 15px;
    color: var(--secondary-color);
}

.bulk-summary p {
    margin-bottom: 10px;
    font-size: 16px;
}

.payment-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Toast */
.toast {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    animation: slideInRight 0.3s;
    max-width: 350px;
}

.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
      background: rgba(0, 0, 0, 0.5);
      pointer-events: none;
      display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner-overlay.hidden {
    display: none;
}

.spinner-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-weight: 600;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
      animation: spin 0.45s linear infinite;
  }

.spinner-text {
    min-height: 20px;
    text-align: center;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* .spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 6px;
}

.hidden {
    display: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
} */


/* .footer {
    position: relative;
    text-align: center; 
    margin-bottom: 20px; 
    padding-top: 20px;
    color: #24d406de;
    font-size: 0.9rem; 
    background: white; 
}
.footer p {
    padding: 20px;
} */

@keyframes slideInRight {
    from {
        transform: translateX(400px);
    }
    to {
        transform: translateX(0);
    }
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--danger-color);
}

.toast.warning {
    border-left: 4px solid var(--warning-color);
}

.toast.info {
    border-left: 4px solid var(--info-color);
}

/* Responsive Design - Mobile First */

/* 290px - 480px (Small Mobile) */
@media (max-width: 480px) {
    #dashboardPage {
        grid-template-areas:
            "nav"
            "main";
        grid-template-columns: 1fr;
        grid-template-rows: 60px 1fr;
    }

    .hamburger {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: -100%;
        top: 60px;
        width: 250px;
        height: calc(100vh - 60px);
        z-index: 99;
    }

    .sidebar.active {
        left: 0;
    }

    .top-nav {
        padding: 0 15px;
    }

    .nav-brand span {
        display: none;
    }

    .nav-user span {
        display: none;
    }

    .main-content {
        padding: 15px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        width: 100%;
    }

    .filter-bar {
        flex-direction: column;
    }

    .search-input,
    .filter-select {
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 10px;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }

    .login-wrapper {
        padding: 20px 15px;
    }

    .login-form {
        padding: 25px 20px;
    }

    .company-logo {
        width: 80px;
        height: 80px;
    }

    .login-header h1 {
        font-size: 22px;
    }
}

/* 481px - 768px (Tablet) */
@media (min-width: 481px) and (max-width: 768px) {
    #dashboardPage {
        grid-template-areas:
            "nav"
            "main";
        grid-template-columns: 1fr;
    }

    .hamburger {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: -100%;
        top: 70px;
        width: 250px;
        height: calc(100vh - 70px);
        z-index: 99;
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        padding: 20px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal-content {
        width: 90%;
    }

    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 769px - 1024px (Desktop) */
@media (min-width: 769px) and (max-width: 1024px) {
    #dashboardPage {
        grid-template-columns: 220px 1fr;
    }

    .main-content {
        padding: 25px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 1025px+ (Large Desktop) */
@media (min-width: 1025px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }

    .payslip-preview,
    .payslip-preview * {
        visibility: visible;
    }

    .payslip-preview {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0; /* 1down*/
        padding: 20px;
        background: white;
    }

    /* Hide buttons and actions */
        .no-print,
        .btn,
        .modal,
        .navbar,
        .sidebar,
        .actions {
            display: none !important;
        }
        .payslip-page {
            page-break-after: always;
        }
        .payslip-page:last-child {
            page-break-after: avoid;
        }
}.payslip-container {
    max-width: 800px;
    margin: 0 auto;
    background: #ffffff;
    border: 2px solid #1a237e;
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.payslip-header {
    text-align: center;
    border-bottom: 3px solid #1a237e;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.payslip-logo {
    max-width: 120px;
    height: auto;
    margin-bottom: 15px;
}

.payslip-company-name {
    font-size: 28px;
    font-weight: bold;
    color: #1a237e;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.payslip-company-info {
    font-size: 12px;
    color: #666;
    margin-top: 8px;
}

.payslip-title {
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    margin: 20px 0;
    color: #333;
    text-transform: uppercase;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

/* ============================================
   EMPLOYEE INFO SECTION
   ============================================ */

.payslip-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
}

.payslip-info-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dotted #ddd;
}

.payslip-info-label {
    font-weight: 600;
    color: #555;
    font-size: 13px;
}

.payslip-info-value {
    font-weight: 500;
    color: #333;
    font-size: 13px;
}

/* ============================================
   EARNINGS & DEDUCTIONS TABLES
   ============================================ */

.payslip-section {
    margin-bottom: 25px;
}

.payslip-section-title {
    font-size: 16px;
    font-weight: bold;
    color: #1a237e;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-left: 4px solid #1a237e;
    padding-left: 10px;
}

.payslip-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.payslip-table th {
    background: #1a237e;
    color: white;
    padding: 12px;
    text-align: left;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.payslip-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 13px;
}

.payslip-table tr:nth-child(even) {
    background: #f8f9fa;
}

.payslip-table .amount {
    text-align: right;
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

/* ============================================
   TOTALS SECTION
   ============================================ */

.payslip-totals {
    background: #1a237e;
    color: white;
    padding: 20px;
    border-radius: 6px;
    margin-top: 20px;
}

.payslip-total-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 14px;
}

.payslip-total-row:last-child {
    border-bottom: none;
    font-size: 18px;
    font-weight: bold;
    margin-top: 10px;
    padding-top: 15px;
    border-top: 2px solid rgba(255, 255, 255, 0.4);
}

.payslip-net-salary {
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border: 2px dashed #1a237e;
    border-radius: 6px;
    color: #1a237e;
}

/* ============================================
   FOOTER & SIGNATURES
   ============================================ */

.payslip-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid #1a237e;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.payslip-signature-box {
    text-align: center;
}

.payslip-signature-line {
    border-top: 1px solid #333;
    margin-top: 40px;
    padding-top: 8px;
    font-size: 12px;
    color: #666;
}

.payslip-date {
    text-align: right;
    font-size: 12px;
    color: #666;
    margin-top: 20px;
}

.payslip-disclaimer {
    margin-top: 30px;
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    font-size: 11px;
    color: #856404;
    text-align: center;
}

/* ============================================
   DOWNLOAD & ACTION BUTTONS
   ============================================ */

.payslip-actions {
    text-align: center;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.payslip-actions .btn {
    margin: 0 8px;
    padding: 10px 24px;
    font-size: 14px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-download {
    background: #1a237e;
    color: white;
    border: none;
}

.btn-download:hover {
    background: #0d1642;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-print {
    background: #28a745;
    color: white;
    border: none;
}

.btn-print:hover {
    background: #1e7e34;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* ============================================
   NOTIFICATION STYLES
   ============================================ */

.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 350px;
}

.notification {
    background: white;
    border-left: 4px solid #1a237e;
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease;
}

.notification-success {
    border-left-color: #28a745;
}

.notification-error {
    border-left-color: #dc3545;
}

.notification-warning {
    border-left-color: #ffc107;
}

.notification-info {
    border-left-color: #17a2b8;
}

.notification-message {
    flex: 1;
    font-size: 14px;
    color: #333;
}

.notification-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 0 0 0 10px;
    line-height: 1;
}

.notification-close:hover {
    color: #333;
}

.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* ============================================
   MODAL STYLES
   ============================================ */

.modal {
    display: flex;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
    margin-top: 0;
    color: #1a237e;
    font-size: 20px;
    margin-bottom: 20px;
}

/* Keep every modal title visually fixed above its independently scrolling
   content; rows can never show through the title area. */
.modal-content {
    isolation: isolate;
}

.modal-content .modal-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.modal-content .table-responsive {
    position: relative;
    z-index: 1;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* Static modal frame: the header never shares a scrolling container with its
   contents, and the viewport itself never scrolls behind the overlay. */
.modal,
.modal.active {
    overflow: hidden;
    align-items: flex-start;
    padding: 3vh 16px 16px;
}

.modal-content {
    max-height: 94vh;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-content .modal-header {
    position: relative;
    flex: 0 0 auto;
    padding: 5px 25px 14px;
    z-index: 20;
}

.modal-content > form,
.modal-content > .modal-body,
.modal-content > .otp-content,
.modal-content > .bulk-payment-content {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 25px;
}

/* Keep the bulk-payment action available even when the employee table is
   long. It remains pinned to the bottom of the modal's own scroll area. */
#bulkPaymentModal .bulk-payment-content > .btn-block {
    position: sticky;
    bottom: -25px;
    z-index: 25;
    display: block;
    width: calc(100% + 50px);
    min-height: 48px;
    margin: 16px -25px -25px;
    padding: 14px 25px;
    border-radius: 0 0 15px 15px;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.12);
}

body.modal-open { overflow: hidden; overscroll-behavior: none; }

.employee-selection-value { display: none; }
.employee-selector-results {
    display: none;
    max-height: 180px;
    overflow-y: auto;
    margin-top: 4px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #fff;
}
.employee-selector-results.active { display: block; }
.employee-selector-option {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    border-bottom: 1px solid var(--border-color);
    background: #fff;
    text-align: left;
    cursor: pointer;
}
.employee-selector-option:hover { background: #f4f7fb; }

.table-pagination .spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 7px;
    vertical-align: -2px;
    border-width: 2px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================
   BADGE STYLES
   ============================================ */

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-secondary {
    background: #e2e3e5;
    color: #383d41;
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */

@media (max-width: 768px) {
    .payslip-container {
        padding: 20px;
        margin: 10px;
    }
    
    .payslip-info-grid {
        grid-template-columns: 1fr;
    }
    
    .payslip-footer {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .payslip-table th,
    .payslip-table td {
        padding: 8px;
        font-size: 12px;
    }
}



/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    width: auto;
    max-width: 450px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.toast {
    background: #ffffff !important;
    color: #000000 !important;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    border: 1px solid #eeeeee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideIn 0.3s ease-out;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.success {
    border: 2px solid #28a745;
}

.toast.error {
    border: 2px solid #dc3545;
}

.toast.warning {
    border: 2px solid #dc3545;
}

.toast.info {
    border: 2px solid #28a745;
}

.toast-content {
    flex: 1;
    margin-right: 10px;
}

.toast-message {
    font-size: 14px;
    font-weight: 500;
}

.toast-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    color: var(--text-primary);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.fade-out {
    opacity: 0;
    transform: translateX(100%);
}
