/* Professional Office Management System Theme */
/* White Background with Black Accents - Pill Shaped UI */

:root {
    --primary-color: #000000;
    --secondary-color: #333333;
    --accent-color: #000000;
    --text-color: #1a1a1a;
    --text-muted: #666666;
    --bg-white: #ffffff;
    --bg-light: #f8f9fa;
    --border-color: #e0e0e0;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius-pill: 50px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    
    /* DPI Scaling - Safe method that doesn't break canvas coordinates */
    --ui-scale: 1;
    --base-font-size: 14px;
    --scaled-font-size: calc(var(--base-font-size) * var(--ui-scale));
    --spacing-unit: calc(4px * var(--ui-scale));
    --card-padding: calc(16px * var(--ui-scale));
    --container-padding: calc(16px * var(--ui-scale));
}

/* ============================================
   COMPACT UI - Balanced fonts and spacing
   ============================================ */
body {
    font-size: 13px !important;
    line-height: 1.5;
}

/* Balanced headings */
h1, .h1 { font-size: 1.5rem !important; margin-bottom: 0.5rem; }
h2, .h2 { font-size: 1.3rem !important; margin-bottom: 0.5rem; }
h3, .h3 { font-size: 1.15rem !important; margin-bottom: 0.4rem; }
h4, .h4 { font-size: 1rem !important; margin-bottom: 0.4rem; }
h5, .h5 { font-size: 0.9rem !important; margin-bottom: 0.3rem; }
h6, .h6 { font-size: 0.85rem !important; margin-bottom: 0.3rem; }

/* Balanced buttons - with proper centering */
.btn {
    padding: 0.35rem 0.75rem !important;
    font-size: 0.8rem !important;
    border-radius: 6px;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.35rem !important;
    text-align: center !important;
    vertical-align: middle !important;
    line-height: 1.2 !important;
}

.btn i,
.btn .bi,
.btn svg {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: inherit !important;
    line-height: 1 !important;
    vertical-align: middle !important;
}

.btn-sm {
    padding: 0.2rem 0.45rem !important;
    font-size: 0.7rem !important;
    gap: 0.25rem !important;
}

.btn-lg {
    padding: 0.5rem 1rem !important;
    font-size: 0.9rem !important;
    gap: 0.4rem !important;
}

/* Balanced form controls */
.form-control, .form-select {
    padding: 0.4rem 0.65rem !important;
    font-size: 0.8rem !important;
    height: auto !important;
    border-radius: 6px;
}

.form-control-sm, .form-select-sm {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.75rem !important;
}

/* Balanced labels */
.form-label, label {
    font-size: 0.8rem !important;
    margin-bottom: 0.25rem !important;
    font-weight: 500;
}

/* Balanced tables */
.table {
    font-size: 0.8rem !important;
}

.table th, .table td {
    padding: 0.5rem 0.65rem !important;
    vertical-align: middle;
}

.table-sm th, .table-sm td {
    padding: 0.35rem 0.5rem !important;
}

/* Balanced cards */
.card {
    border-radius: 10px;
    margin-bottom: 1rem;
}

.card-header {
    padding: 0.75rem 1rem !important;
    font-size: 0.9rem !important;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header h5,
.card-header h6,
.card-header .card-title {
    margin-bottom: 0 !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header i,
.card-header .bi {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.card-body {
    padding: 1rem !important;
}

.card-footer {
    padding: 0.75rem 1rem !important;
}

/* Balanced badges - with proper centering */
.badge {
    padding: 0.25em 0.5em !important;
    font-size: 0.7rem !important;
    border-radius: 4px;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.25rem !important;
    text-align: center !important;
    vertical-align: middle !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
}

.badge i,
.badge .bi,
.badge svg {
    font-size: inherit !important;
    line-height: 1 !important;
    vertical-align: middle !important;
}

/* Balanced alerts */
.alert {
    padding: 0.65rem 1rem !important;
    font-size: 0.8rem !important;
    border-radius: 8px;
}

/* Balanced dropdowns */
.dropdown-menu {
    font-size: 0.8rem !important;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.dropdown-item {
    padding: 0.4rem 1rem !important;
}

/* Balanced pagination */
.pagination {
    font-size: 0.8rem !important;
}

.page-link {
    padding: 0.35rem 0.65rem !important;
}

/* Balanced nav tabs/pills */
.nav-tabs .nav-link,
.nav-pills .nav-link {
    padding: 0.5rem 1rem !important;
    font-size: 0.8rem !important;
}

/* Balanced list groups */
.list-group-item {
    padding: 0.6rem 1rem !important;
    font-size: 0.8rem !important;
}

/* Balanced modals */
.modal-header {
    padding: 0.75rem 1rem !important;
}

.modal-body {
    padding: 1rem !important;
}

.modal-footer {
    padding: 0.75rem 1rem !important;
}

.modal-title {
    font-size: 1rem !important;
    font-weight: 600;
}

/* Balanced breadcrumbs */
.breadcrumb {
    font-size: 0.8rem !important;
    padding: 0.5rem 0 !important;
    margin-bottom: 0.5rem;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: wrap;
}

.breadcrumb-item {
    font-size: 0.8rem !important;
    display: inline-flex !important;
    align-items: center !important;
}

.breadcrumb-item a {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.3rem !important;
}

.breadcrumb-item i,
.breadcrumb-item .bi {
    font-size: 0.85rem !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
}

/* Balanced text utilities */
.small, small {
    font-size: 0.75rem !important;
}

/* ============================================
   UI BUG FIXES - Prevents text breaking
   ============================================ */

/* Prevent amounts from breaking into lines */
.text-nowrap,
.amount,
.price,
.currency {
    white-space: nowrap !important;
}

/* Display utilities - prevent breaking */
.display-1, .display-2, .display-3, .display-4, .display-5, .display-6 {
    white-space: nowrap;
    font-size: 1.5rem !important;
}

/* Card amounts/numbers - prevent line breaks */
.card h2, .card h3, .card h4 {
    white-space: nowrap;
}

/* Employee/Invoice card mobile view fixes */
.card .d-flex {
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Fix action buttons alignment */
.action-buttons,
.btn-group-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    align-items: center !important;
    justify-content: center !important;
}

.action-buttons .btn,
.btn-group-actions .btn {
    padding: 6px 12px !important;
    font-size: 0.7rem !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    min-width: auto !important;
}

/* Fix icon buttons */
.btn-icon,
.btn-sm.rounded-pill {
    width: 32px;
    height: 32px;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
}

.btn-sm.rounded-pill {
    width: auto !important;
    height: auto !important;
    padding: 6px 14px !important;
    border-radius: 50px !important;
}

/* Card action buttons - pill style */
.card .btn-outline-info,
.card .btn-outline-warning,
.card .btn-outline-primary,
.card .btn-outline-success,
.card .btn-outline-danger,
.card .btn-outline-secondary {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    padding: 6px 12px !important;
    font-size: 0.7rem !important;
    line-height: 1.2 !important;
    border-radius: 50px !important;
    min-height: 30px !important;
}

/* Ensure button text and icons are aligned */
.card .btn i,
.card .btn .bi {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.75rem !important;
    width: auto !important;
    height: auto !important;
}

/* Employee dashboard cards fix */
.employee-stat-card,
.performance-card {
    text-align: center;
}

.employee-stat-card h3,
.performance-card h3,
.employee-stat-card .value,
.performance-card .value {
    white-space: nowrap;
    font-size: 1.3rem !important;
}

/* Target badge fix */
.badge.bg-success,
.badge.bg-danger,
.badge.bg-warning,
.badge.bg-info,
.badge.bg-primary,
.badge.bg-secondary {
    white-space: nowrap;
    font-size: 0.65rem !important;
    padding: 0.25em 0.5em !important;
}

/* Fix for conversion rate text */
.text-success, .text-danger, .text-warning {
    white-space: nowrap;
}

/* ============================================
   GLOBAL CENTERING FIXES
   ============================================ */

/* Flex alignment utilities */
.d-flex {
    align-items: center;
}

.d-flex.align-items-start {
    align-items: flex-start !important;
}

.d-flex.align-items-end {
    align-items: flex-end !important;
}

/* Ensure all icons are properly aligned - but respect Bootstrap display utilities */
.btn i, .btn .bi,
.badge i, .badge .bi,
.nav-link i, .nav-link .bi,
.dropdown-item i, .dropdown-item .bi,
.list-group-item i:not(.d-none):not(.d-md-none):not(.d-lg-none),
.list-group-item .bi:not(.d-none):not(.d-md-none):not(.d-lg-none),
.card-header i:not(.d-none):not(.d-md-none):not(.d-lg-none),
.card-header .bi:not(.d-none):not(.d-md-none):not(.d-lg-none),
.input-group-text i, .input-group-text .bi {
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    line-height: 1;
}

/* Don't override Bootstrap's responsive display utilities */
.d-none { display: none !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }

@media (min-width: 768px) {
    .d-md-none { display: none !important; }
    .d-md-inline { display: inline !important; }
    .d-md-inline-block { display: inline-block !important; }
    .d-md-block { display: block !important; }
    .d-md-flex { display: flex !important; }
    .d-md-inline-flex { display: inline-flex !important; }
}

@media (min-width: 992px) {
    .d-lg-none { display: none !important; }
    .d-lg-inline { display: inline !important; }
    .d-lg-inline-block { display: inline-block !important; }
    .d-lg-block { display: block !important; }
    .d-lg-flex { display: flex !important; }
    .d-lg-inline-flex { display: inline-flex !important; }
}

/* Fix text alignment in flex containers */
.d-flex span,
.d-flex small,
.d-flex strong {
    display: inline-flex;
    align-items: center;
}

/* Fix gap for flex items */
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 0.75rem !important; }

/* Fix button groups */
.btn-group {
    display: inline-flex !important;
    align-items: stretch !important;
}

.btn-group .btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Fix input groups */
.input-group {
    display: flex !important;
    align-items: stretch !important;
}

.input-group-text {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0.4rem 0.65rem !important;
    font-size: 0.8rem !important;
}

.input-group-text i,
.input-group-text .bi {
    font-size: inherit !important;
}

/* Fix list items */
.list-group-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Fix nav items */
.nav-link {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
}

.nav-link i,
.nav-link .bi {
    font-size: inherit !important;
}

/* Fix dropdown items */
.dropdown-item {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
}

.dropdown-item i,
.dropdown-item .bi {
    width: 1rem !important;
    text-align: center !important;
}

/* Additional card fixes */
.card .fw-bold,
.card .h3,
.card .h4,
.card .h5 {
    white-space: nowrap;
}

/* Invoice/Order card mobile fixes */
.card .d-flex.justify-content-between {
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Employee dashboard specific fixes */
.col-6 .card,
.col-md-3 .card,
.col-lg-3 .card {
    text-align: center;
}

.col-6 .card h2,
.col-6 .card h3,
.col-6 .card h4,
.col-md-3 .card h2,
.col-md-3 .card h3,
.col-md-3 .card h4 {
    font-size: 1.2rem !important;
    white-space: nowrap;
    margin-bottom: 0.25rem;
}

/* Fix for amounts in small cards */
.card .fs-4,
.card .fs-3,
.card .fs-2 {
    font-size: 1.1rem !important;
    white-space: nowrap;
}

/* Fix empty quick action cards */
.quick-action-btn,
.action-card {
    min-height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px !important;
}

.quick-action-btn i,
.action-card i {
    font-size: 1.2rem !important;
    margin-bottom: 4px;
}

.quick-action-btn span,
.action-card span {
    font-size: 0.7rem !important;
    text-align: center;
}

.fs-6 {
    font-size: 0.85rem !important;
}

/* Container padding */
.container-fluid {
    padding: 1rem !important;
}

/* Row margins - keep Bootstrap defaults */
.row {
    margin-left: -0.5rem !important;
    margin-right: -0.5rem !important;
}

.row > * {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
}

/* Spacing utilities - balanced */
.mb-3 { margin-bottom: 0.75rem !important; }
.mb-4 { margin-bottom: 1rem !important; }
.mt-3 { margin-top: 0.75rem !important; }
.mt-4 { margin-top: 1rem !important; }
.p-3 { padding: 0.75rem !important; }
.p-4 { padding: 1rem !important; }
.py-3 { padding-top: 0.75rem !important; padding-bottom: 0.75rem !important; }
.py-4 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
.px-3 { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
.px-4 { padding-left: 1rem !important; padding-right: 1rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 0.75rem !important; }

/* Balanced icons in tables */
.table .bi, .table i {
    font-size: 0.9rem !important;
}

/* Input groups */
.input-group-text {
    padding: 0.4rem 0.65rem !important;
    font-size: 0.8rem !important;
}

/* Form text/help */
.form-text {
    font-size: 0.7rem !important;
    margin-top: 0.2rem;
}

/* Base Styles */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-white);
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
}

/* ============================================
   GLOBAL OVERFLOW & RESPONSIVE FIXES
   Prevents content from going out of frame
   ============================================ */

/* CRITICAL: Prevent body/html from expanding beyond viewport */
html {
    overflow-x: hidden !important;
    max-width: 100vw !important;
}

body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
}

/* Smooth touch scrolling on touch devices - avoid conflicts */
@media (hover: none) and (pointer: coarse) {
    html {
        -webkit-overflow-scrolling: touch;
        overflow-y: scroll;
    }
    body {
        -webkit-overflow-scrolling: touch;
    }
}

/* Main content wrapper must contain overflow */
main, 
.main-content,
.content-wrapper {
    overflow-x: hidden !important;
    max-width: 100% !important;
}

/* Global overflow handling */
.container-fluid {
    overflow-x: hidden !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.card {
    overflow: hidden !important;
    max-width: 100% !important;
}

.card-body {
    overflow-x: auto !important;
    max-width: 100% !important;
}

/* Reports page - remove unnecessary scrollbars from card body containers */
.card-body.p-0 > .row,
.card-body.p-0 > .row > .col-12 {
    overflow: visible !important;
}

/* Reports page - only scroll when table-responsive is present */
.card-body.p-0:not(:has(.table-responsive)) {
    overflow: visible !important;
}

/* Reports page specific - report cards should not have scrollbars */
.report-card .card-body {
    overflow: visible !important;
}

/* Tables - always scrollable horizontally within their container */
.table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    max-width: 100% !important;
    display: block !important;
}

/* Ensure tables don't force parent width */
.table {
    width: 100%;
    table-layout: auto;
}

/* Prevent text overflow - truncate with ellipsis */
.text-truncate-auto {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Flex containers - allow children to shrink */
.row {
    min-width: 0;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.row > * {
    min-width: 0;
    max-width: 100%;
}

.d-flex {
    min-width: 0;
}

.d-flex > * {
    min-width: 0;
}

/* Forms - prevent overflow */
.form-control, .form-select {
    max-width: 100%;
}

/* Buttons - allow wrapping on small screens */
.btn-group {
    flex-wrap: wrap;
}

/* Fix col-12 overflow */
.col-12 {
    max-width: 100% !important;
    overflow-x: hidden !important;
}

/* IMPORTANT: Force table containers to scroll instead of expand page */
.card .table-responsive {
    overflow-x: auto !important;
    overflow-y: auto;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Ensure card-body containing tables doesn't expand beyond viewport */
.card-body:has(.table-responsive),
.card-body:has(table) {
    overflow-x: auto !important;
    max-width: 100% !important;
}

/* Shipping analytics: no scrollbars on state/city tables - content flows naturally */
.ship-analytics-page .chart-card.h-100 { height: auto !important; }
.ship-analytics-page .card .table-responsive,
.ship-analytics-page .chart-card .table-responsive,
.ship-analytics-page .chart-card .card-body,
.ship-analytics-page .chart-card .card-body:has(.table-responsive),
.ship-analytics-page .chart-card .card-body:has(table) {
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    max-height: none !important;
}

/* Prevent main container from expanding */
.container-fluid .row {
    flex-wrap: wrap !important;
    max-width: 100% !important;
}

/* Dashboard specific - Team Performance table */
.card-body.p-0 {
    overflow-x: auto !important;
    max-width: 100% !important;
}

/* ============================================
   UI SCALE - Simplified (Font size only)
   Does NOT scale padding/margins to avoid overflow
   ============================================ */

/* Ensure charts are NOT scaled - keep them at normal size */
body.ui-scaled .chart-container,
body.ui-scaled .chart-wrapper,
body.ui-scaled canvas {
    transform: none !important;
    zoom: 1 !important;
}

/* Exclude navbar from scaling - keep it at normal size */
body.ui-scaled .modern-navbar,
body.ui-scaled .modern-navbar * {
    font-size: inherit !important;
}

body.ui-scaled .mn-mobile-panel,
body.ui-scaled .mn-mobile-panel * {
    font-size: inherit !important;
}

.container-fluid {
    flex: 1;
    background-color: var(--bg-white);
    padding: 20px;
    position: relative;
}

/* Customers - Amount widgets (admin only) - minimal redesign */
.customer-amount-widgets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
@media (min-width: 992px) {
    .customer-amount-widgets {
        gap: 12px;
        margin-bottom: 14px;
    }
}
.customer-widget-item {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    background: #f8f9fa;
}
.customer-widget-item .customer-widget-label {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
    margin-bottom: 2px;
}
.customer-widget-item .customer-widget-value {
    font-size: 0.75rem;
    font-weight: 700;
    color: #212529;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.customer-widget-total { border-left: 3px solid #0d6efd; }
.customer-widget-paid { border-left: 3px solid #198754; }
.customer-widget-balance { border-left: 3px solid #ffc107; }
@media (min-width: 768px) {
    .customer-amount-widgets {
        gap: 10px;
        margin-bottom: 14px;
    }
    .customer-widget-item {
        padding: 8px 12px;
        border-radius: 8px;
    }
    .customer-widget-item .customer-widget-label {
        font-size: 0.65rem;
    }
    .customer-widget-item .customer-widget-value {
        font-size: 0.9rem;
    }
}

/* Customers - Collapsible filters (admin only, all devices) */
.customer-filters-toggle {
    display: flex !important;
    cursor: pointer;
    border: 1px solid var(--border-color) !important;
    background: var(--bg-light) !important;
    min-height: 44px; /* Touch target for mobile */
    touch-action: manipulation; /* Removes 300ms tap delay on mobile */
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    width: 100%;
    text-align: left;
    /* Reset button defaults */
    appearance: none;
    -webkit-appearance: none;
}
@media (hover: none) and (pointer: coarse) {
    .customer-filters-toggle {
        /* Extra tap area on touch devices */
        padding: 12px 16px !important;
    }
}
.customer-filters-toggle:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}
.customer-filters-toggle .collapse-toggle-icon {
    transition: transform 0.2s ease;
    pointer-events: none; /* Ensure tap goes to button */
}
.customer-filters-toggle .badge,
.customer-filters-toggle span {
    pointer-events: none; /* Ensure tap goes to button */
}
.customer-filters-toggle[aria-expanded="true"] .collapse-toggle-icon {
    transform: rotate(180deg);
}

/* Customers - Excluded from Sales: clear visual distinction */
.customer-excluded-from-sales {
    border-left: 4px solid #fd7e14 !important;
    background: rgba(253, 126, 20, 0.06) !important;
}
.customer-excluded-from-sales-row {
    border-left: 4px solid #fd7e14;
    background: rgba(253, 126, 20, 0.06) !important;
}

/* Impersonation Banner */
.impersonation-banner {
    background-color: #fff3cd !important;
    border-bottom: 2px solid #ffc107 !important;
    padding: 10px 0 12px;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.impersonation-banner-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.impersonation-banner-info {
    flex: 1;
    min-width: 0;
}

.impersonation-banner-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.impersonation-banner-email {
    font-size: 0.875rem;
    color: #856404;
    margin-top: 2px;
    word-break: break-all;
}

.impersonation-banner i {
    font-size: 1.15rem;
    color: #856404;
    flex-shrink: 0;
}

.impersonation-banner strong {
    color: #856404;
    flex-shrink: 0;
}

.impersonation-banner .impersonation-name {
    color: #856404;
}

.impersonation-banner .impersonation-stop-btn {
    font-weight: 600;
    border-radius: var(--radius-pill);
    min-height: 44px;
    padding: 8px 16px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Mobile: stack vertically, full-width button */
@media (max-width: 575.98px) {
    .impersonation-banner {
        padding: 12px 0;
    }

    .impersonation-banner-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .impersonation-banner-info {
        min-width: unset;
    }

    .impersonation-banner-row {
        gap: 4px;
    }

    .impersonation-banner-email {
        font-size: 0.8125rem;
    }

    .impersonation-banner .impersonation-stop-btn {
        width: 100%;
        min-height: 44px;
        justify-content: center;
    }
}

/* Navigation - Modern Professional Header */
.main-navbar {
    background-color: var(--bg-white) !important;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    padding: 0;
    min-height: 70px;
}

.main-navbar .container-fluid {
    padding: 0 24px;
}

/* Brand Logo */
.navbar-brand {
    color: var(--primary-color) !important;
    font-weight: 700;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.navbar-brand:hover {
    opacity: 0.8;
}

.brand-logo {
    height: 36px;
    width: auto;
    object-fit: contain;
}

.brand-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-light);
    border-radius: var(--radius-sm);
    color: var(--primary-color);
    font-size: 1.2rem;
}

.brand-text {
    color: var(--primary-color);
    font-weight: 700;
    letter-spacing: -0.3px;
}

/* Navigation Actions (Right Side) */
.navbar-actions {
    gap: 12px;
}

/* Notification Button */
.notification-dropdown {
    position: relative;
}

.notification-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-pill);
    background-color: var(--bg-light);
    color: var(--text-color);
    text-decoration: none;
    position: relative;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    border: 2px solid transparent;
}

.notification-btn:hover {
    background-color: var(--primary-color);
    color: var(--bg-white);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.notification-btn i {
    font-size: 1.2rem;
}

.notification-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 10px;
    height: 10px;
    background-color: var(--danger-color);
    border: 2px solid var(--bg-white);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Notification Menu */
.notification-menu {
    min-width: 360px;
    max-width: 400px;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    padding: 0;
    margin-top: 12px;
    overflow: hidden;
}

.notification-header {
    padding: 16px 20px;
    background-color: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
}

.notification-header h6 {
    margin: 0;
    font-weight: 700;
    color: var(--text-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.notification-empty {
    padding: 32px 20px;
    text-align: center;
    color: var(--text-muted);
}

.notification-empty i {
    font-size: 2rem;
    display: block;
    margin-bottom: 8px;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    padding: 16px 20px;
    text-decoration: none;
    color: var(--text-color);
    transition: background-color 0.15s ease;
    border-bottom: 1px solid var(--border-color);
}

.notification-item:hover {
    background-color: var(--bg-light);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-light);
    border-radius: var(--radius-sm);
    margin-right: 12px;
    flex-shrink: 0;
}

.notification-icon i {
    font-size: 1.1rem;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-message {
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 4px;
    line-height: 1.4;
}

.notification-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.notification-footer {
    padding: 12px 20px;
    background-color: var(--bg-light);
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.notification-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s ease;
}

.notification-footer a:hover {
    gap: 10px;
}

/* Main Menu (3 Dots) */
.main-menu-dropdown {
    position: relative;
}

.menu-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-pill);
    background-color: var(--bg-light);
    color: var(--text-color);
    text-decoration: none;
    position: relative;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
    border: 2px solid transparent;
    font-size: 1.3rem;
}

.menu-btn:hover {
    background-color: var(--primary-color);
    color: var(--bg-white);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Main Menu Dropdown */
.main-menu {
    min-width: 280px;
    max-width: 320px;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    padding: 0;
    margin-top: 12px;
    overflow: hidden;
    max-height: 80vh;
    overflow-y: auto;
}

/* Custom Scrollbar for Menu */
.main-menu::-webkit-scrollbar {
    width: 6px;
}

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

.main-menu::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: var(--radius-pill);
}

.main-menu::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

.menu-header {
    padding: 16px 20px;
    background-color: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background-color: var(--bg-white);
    z-index: 10;
}

.menu-header h6 {
    margin: 0;
    font-weight: 700;
    color: var(--text-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.menu-section-title {
    padding: 8px 20px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 700;
    background-color: var(--bg-light);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    text-decoration: none;
    color: var(--text-color);
    transition: background-color 0.15s ease;
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:hover {
    background-color: var(--bg-light);
    color: var(--primary-color);
    padding-left: 24px;
}

.menu-item i {
    width: 24px;
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-muted);
}

.menu-item:hover i {
    color: var(--primary-color);
}

.menu-item.text-danger {
    color: var(--danger-color);
}

.menu-item.text-danger:hover {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

.menu-item.text-danger i {
    color: var(--danger-color);
}

.menu-item span {
    flex: 1;
}

.menu-item.active {
    background-color: var(--bg-light);
    color: var(--primary-color);
    font-weight: 600;
    border-left: 3px solid var(--primary-color);
    padding-left: 17px;
}

.menu-item.active i {
    color: var(--primary-color);
}

/* User Dropdown */
.user-dropdown {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    background-color: var(--bg-light);
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    border: 2px solid transparent;
    font-weight: 500;
}

.user-btn:hover {
    background-color: var(--primary-color);
    color: var(--bg-white);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.user-avatar {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-white);
    border-radius: 50%;
    color: var(--primary-color);
    font-size: 1.5rem;
    border: 2px solid var(--border-color);
}

.user-name {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
}

.user-btn:hover .user-name {
    color: var(--bg-white);
}

.user-btn i.bi-chevron-down {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    color: var(--text-muted);
}

.user-btn:hover i.bi-chevron-down {
    color: var(--bg-white);
}

.user-btn[aria-expanded="true"] i.bi-chevron-down {
    transform: rotate(180deg);
}

/* User Menu */
.user-menu {
    min-width: 240px;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    padding: 0;
    margin-top: 12px;
    overflow: hidden;
}

.user-menu-header {
    padding: 16px 20px;
    background-color: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-info strong {
    color: var(--text-color);
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.user-info small {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.user-menu .dropdown-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background-color 0.15s ease;
    color: var(--text-color);
}

.user-menu .dropdown-item i {
    width: 20px;
    text-align: center;
}

.user-menu .dropdown-item:hover {
    background-color: var(--bg-light);
    color: var(--primary-color);
}

.user-menu .dropdown-item.text-danger {
    color: var(--danger-color);
}

.user-menu .dropdown-item.text-danger:hover {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

/* Mobile Menu Toggle */
.navbar-toggler {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    background-color: var(--bg-light);
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(0,0,0,0.1);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='%23000000' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5z'/%3E%3C/svg%3E");
}

/* Colleagues Performance - Mobile Card Design */
.colleague-card {
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    will-change: transform;
}

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

.colleague-card-me {
    background-color: var(--bg-light);
    border-left: 4px solid var(--primary-color);
    border-left-width: 4px;
}

.colleague-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.colleague-metric small {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.colleague-metric strong {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-color);
}

.colleague-card h6 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
}

/* Recent Sales - Mobile Card Design */
.sale-card {
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    will-change: transform;
}

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

.sale-card-total {
    background-color: var(--bg-light);
    border: 2px solid var(--primary-color);
    font-weight: 600;
}

.sale-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sale-metric small {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sale-metric strong {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-color);
}

.sale-card h6 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
}

/* Mobile Navigation */
@media (max-width: 991px) {
    .navbar-actions {
        gap: 8px;
    }
    
    .user-avatar-display {
        padding: 6px 12px;
    }
    
    .user-name {
        display: none !important;
    }
    
    /* Ensure dropdowns stay within viewport on mobile */
    .main-menu,
    .notification-menu,
    .user-menu {
        max-width: calc(100vw - 32px) !important;
        min-width: 280px;
        width: calc(100vw - 32px) !important;
        max-height: calc(100vh - 120px) !important;
    }
    
    /* Force positioning for dropdowns on mobile - only when shown */
    .main-menu-dropdown.show .dropdown-menu.dropdown-menu-end,
    .notification-dropdown.show .dropdown-menu.dropdown-menu-end,
    .user-dropdown.show .dropdown-menu.dropdown-menu-end {
        right: 16px !important;
        left: auto !important;
        transform: none !important;
        position: fixed !important;
        margin-top: 8px !important;
    }
    
    /* Ensure dropdown container doesn't interfere */
    .navbar-actions .dropdown {
        position: static;
    }
}

.nav-link.text-white {
    color: var(--text-color) !important;
}

/* Buttons - Pill Shaped */
.btn {
    border-radius: var(--radius-pill);
    padding: 10px 24px;
    font-weight: 600;
    border: 2px solid transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    text-transform: none;
    letter-spacing: 0.3px;
    will-change: transform;
}

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

.btn-primary:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover {
    background-color: var(--bg-light);
    border-color: var(--text-color);
    color: var(--primary-color);
}

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

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

.btn-warning {
    background-color: var(--warning-color);
    color: var(--text-color);
    border-color: var(--warning-color);
}

.btn-info {
    background-color: var(--info-color);
    color: var(--bg-white);
    border-color: var(--info-color);
}

.btn-sm {
    padding: 6px 16px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1.1rem;
}

.btn-action {
    padding: 6px 12px;
    font-size: 0.875rem;
    margin: 0 2px;
    border-radius: var(--radius-pill);
}

/* Cards - Clean White with Subtle Shadows */
.card {
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    will-change: transform;
}

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

/* Disable card hover effect for static cards */
.card.no-hover,
.card.card-static {
    transition: none;
}

.card.no-hover:hover,
.card.card-static:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}

.card-header {
    background-color: var(--bg-white);
    border-bottom: 2px solid var(--border-color);
    padding: 20px 24px;
    font-weight: 700;
    color: var(--text-color);
    font-size: 1.1rem;
}

.card-body {
    padding: 24px;
    background-color: var(--bg-white);
}

.card-footer {
    background-color: var(--bg-light);
    border-top: 1px solid var(--border-color);
    padding: 16px 24px;
}

/* Form Elements - Pill Shaped Inputs */
.form-control,
.form-select {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-pill);
    padding: 12px 20px;
    background-color: var(--bg-white);
    color: var(--text-color);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    font-size: 0.95rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.1);
    outline: none;
    background-color: var(--bg-white);
}

.form-control-lg {
    padding: 14px 24px;
    font-size: 1rem;
    border-radius: var(--radius-pill);
}

.form-label {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 8px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

textarea.form-control {
    border-radius: var(--radius-md);
    min-height: 100px;
}

/* Tables - Clean Design */
.table {
    background-color: var(--bg-white);
    color: var(--text-color);
}

.table thead {
    background-color: var(--bg-light);
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
}

.table thead th {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    text-align: left;
    letter-spacing: 0.5px;
    padding: 16px;
    border: none;
    color: var(--text-color);
    white-space: nowrap;
}

.table tfoot {
    background-color: var(--bg-light);
    border-top: 2px solid var(--border-color);
}

.table tfoot th {
    font-weight: 700;
    color: var(--text-color);
    padding: 16px;
}

.table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.15s ease;
}

.table tbody tr:hover {
    background-color: var(--bg-light);
}

.table tbody td {
    padding: 16px;
    vertical-align: middle;
    border: none;
    word-wrap: break-word;
}

.table tbody td strong {
    color: var(--text-color);
    font-weight: 600;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--bg-light);
}

.table-responsive {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

/* Employee Leave Balance table fixes */
.table td {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.table td strong {
    word-break: break-word;
    display: block;
}

.table td .d-flex.flex-column {
    gap: 4px;
}

.table td .d-flex.flex-column > * {
    flex-shrink: 0;
}

/* Ensure badges don't cause overflow */
.table td .badge {
    white-space: nowrap;
    display: inline-block;
    max-width: 100%;
}

/* Mobile card layout for employee leave balance */
@media (max-width: 767.98px) {
    .d-md-none .card {
        margin-bottom: 16px;
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-sm);
    }
    
    .d-md-none .card .card-body {
        padding: 16px;
    }
    
    .d-md-none .border.rounded {
        border-radius: var(--radius-md) !important;
        background-color: var(--bg-light);
    }
    
    .d-md-none .row.g-2 > [class*="col-"] {
        padding-left: 8px;
        padding-right: 8px;
    }
}

/* Payroll Management mobile fixes */
@media (max-width: 767.98px) {
    .btn-group.btn-group-sm {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .btn-group.btn-group-sm .btn {
        flex: 1 1 auto;
        min-width: 44px;
        padding: 6px 8px;
    }
    
    .table td .btn-group {
        width: 100%;
        justify-content: center;
    }
}

/* Reports table improvements */
/* Reports Card-based Design */
.report-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background-color: var(--bg-white);
}

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

.report-card .card-body {
    background-color: var(--bg-white);
}

/* Metric Boxes */
.metric-box {
    background-color: var(--bg-light);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.metric-box:hover {
    background-color: var(--bg-white);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.metric-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 4px;
}

.metric-badge {
    font-size: 0.8rem;
}

/* Info Boxes */
.info-box {
    background-color: var(--bg-light);
    border-radius: var(--radius-md);
    padding: 14px;
    border: 1px solid var(--border-color);
}

.info-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.info-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
}

/* Comparison Section */
.comparison-section {
    background-color: var(--bg-light);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid var(--border-color);
    margin-top: 20px;
}

.comparison-header h6 {
    color: var(--text-color);
    font-weight: 700;
    margin-bottom: 0;
}

.comparison-box {
    background-color: var(--bg-white);
    border-radius: var(--radius-sm);
    padding: 16px;
    border: 1px solid var(--border-color);
    height: 100%;
}

.comparison-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.comparison-value {
    font-size: 1rem;
    color: var(--text-color);
}

/* Responsive adjustments for reports */
@media (max-width: 767.98px) {
    .report-card .card-body {
        padding: 20px !important;
    }
    
    .metric-box {
        padding: 12px;
    }
    
    .metric-value {
        font-size: 1rem;
    }
    
    .comparison-section {
        padding: 16px;
    }
    
    .comparison-box {
        padding: 12px;
    }
}

/* Report Details Page Responsive */
@media (max-width: 767.98px) {
    .table th,
    .table td {
        padding: 10px 8px;
        font-size: 0.85rem;
    }
    
    .table th {
        font-size: 0.75rem;
    }
    
    .table .badge {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
    
    .info-box {
        padding: 12px !important;
    }
    
    .info-label {
        font-size: 0.7rem;
    }
    
    .info-value {
        font-size: 0.9rem;
    }
    
    .info-value .badge {
        font-size: 1rem !important;
        padding: 6px 10px;
    }
}

@media (max-width: 767.98px) {
    #reportsTable td {
        padding: 12px 8px;
        word-wrap: break-word;
    }
    
    #reportsTable td .d-flex.flex-wrap {
        gap: 8px;
    }
    
    #reportsTable td .d-flex.flex-wrap > div {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
    }
    
    #reportsTable td .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    #reportsTable td .btn-group .btn {
        width: 100%;
        margin: 2px 0;
    }
}

/* System Settings improvements */
.nav-tabs {
    border-bottom: 2px solid var(--border-color);
}

.nav-tabs .nav-link {
    color: var(--text-color);
    border: none;
    border-bottom: 3px solid transparent;
    padding: 12px 16px;
    transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
    border-radius: 0;
}

.nav-tabs .nav-link:hover {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
    background-color: var(--bg-light);
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    background-color: var(--bg-white);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

@media (max-width: 767.98px) {
    .nav-tabs {
        flex-wrap: wrap;
    }
    
    .nav-tabs .nav-link {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    .nav-tabs.nav-justified .nav-item {
        flex: 1 1 50%;
    }
}

/* Badges - Pill Shaped */
.badge {
    border-radius: var(--radius-pill);
    padding: 6px 14px;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.bg-primary {
    background-color: var(--primary-color) !important;
    color: var(--bg-white);
}

.bg-success {
    background-color: var(--success-color) !important;
    color: var(--bg-white);
}

.bg-danger {
    background-color: var(--danger-color) !important;
    color: var(--bg-white);
}

.bg-warning {
    background-color: var(--warning-color) !important;
    color: var(--text-color);
}

.bg-info {
    background-color: var(--info-color) !important;
    color: var(--bg-white);
}

.bg-secondary {
    background-color: var(--text-muted) !important;
    color: var(--bg-white);
}

.bg-light {
    background-color: var(--bg-light) !important;
    color: var(--text-color);
}

/* Alerts - Rounded */
.alert {
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    padding: 16px 20px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-success {
    background-color: rgba(40, 167, 69, 0.1);
    border-color: var(--success-color);
    color: #155724;
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.1);
    border-color: var(--danger-color);
    color: #721c24;
}

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

.alert-info {
    background-color: rgba(23, 162, 184, 0.1);
    border-color: var(--info-color);
    color: #0c5460;
}

/* Dashboard Stat Cards */
.stat-card {
    background-color: #ffffff !important;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 16px;
    color: #000000 !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    min-height: auto;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-light);
    border-radius: 50%;
    margin-bottom: 12px;
    color: #000000 !important;
    font-size: 1.5rem;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
}

.stat-card h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: #000000 !important;
    line-height: 1.2;
    white-space: nowrap;
    max-width: 100%;
    width: 100%;
    text-align: center;
}

.stat-card p {
    margin-bottom: 0;
    color: #666666 !important;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.3px;
    max-width: 100%;
    width: 100%;
    text-align: center;
}

/* Force all stat card text elements to have proper colors */
.stat-card span,
.stat-card div,
.stat-card strong {
    color: #000000 !important;
}

/* Stat card amounts - prevent breaking */
.stat-card .amount,
.stat-card h3,
.stat-card .display-6,
.stat-card .display-5,
.stat-card .display-4 {
    white-space: nowrap;
    font-size: 1.4rem !important;
}

/* Remove gradient backgrounds - use solid colors */
.bg-gradient-primary,
.bg-gradient-success,
.bg-gradient-warning,
.bg-gradient-danger {
    background: var(--bg-white) !important;
    border: 2px solid var(--border-color);
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-light);
}

.login-card {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    background-color: var(--bg-white);
    border: 2px solid var(--border-color);
    max-width: 450px;
    width: 100%;
}

.login-card .card-header {
    background-color: var(--bg-white);
    border-bottom: 2px solid var(--border-color);
    color: var(--text-color);
    padding: 32px;
    text-align: center;
}

.login-card .card-body {
    padding: 32px;
}

/* Page Headers */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-color);
    font-weight: 700;
    margin-bottom: 16px;
}

h2 {
    font-size: 2rem;
    margin-bottom: 24px;
}

/* Dropdown Menu */
.dropdown-menu {
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-md);
    padding: 8px;
    background-color: var(--bg-white);
}

.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    transition: background-color 0.15s ease, color 0.15s ease;
    color: var(--text-color);
}

.dropdown-item:hover {
    background-color: var(--bg-light);
    color: var(--primary-color);
}

.dropdown-header {
    color: var(--text-color);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

/* Modal - Full screen backdrop fix */
.modal-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 100vw !important;
    min-height: 100vh !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
    z-index: 1055 !important;
}

.modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 1060 !important;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Ensure body doesn't clip modal */
body.modal-open {
    overflow: hidden;
}

body.modal-open .modal-backdrop,
body.modal-open .modal {
    position: fixed !important;
}

.modal-content {
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    z-index: 1065 !important;
    position: relative;
}

.modal-header {
    border-bottom: 2px solid var(--border-color);
    background-color: var(--bg-white);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-footer {
    border-top: 2px solid var(--border-color);
    background-color: var(--bg-light);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Flatpickr Date Picker Styles */
.flatpickr-input {
    cursor: pointer;
    background-color: var(--bg-white);
    transition: border-color 0.15s ease;
}

.flatpickr-input:hover {
    border-color: var(--primary-color);
}

.flatpickr-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 0, 0, 0.1);
}

.flatpickr-calendar {
    z-index: 1060 !important;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover {
    background: var(--secondary-color) !important;
    border-color: var(--secondary-color) !important;
}

/* Progress Bar */
.progress {
    height: 12px;
    border-radius: var(--radius-pill);
    background-color: var(--bg-light);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.progress-bar {
    border-radius: var(--radius-pill);
    background-color: var(--primary-color);
    font-weight: 600;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-white);
}

.progress[style*="height: 30px"] {
    height: 30px !important;
    border-radius: var(--radius-pill);
}

.progress[style*="height: 30px"] .progress-bar {
    border-radius: var(--radius-pill);
    font-size: 0.9rem;
}

/* Date Picker */
.date-picker {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23000000' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 20px 20px;
    padding-right: 48px;
    cursor: pointer;
}

/* Flatpickr Custom Styles */
.flatpickr-calendar {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--border-color);
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    border-radius: var(--radius-sm);
}

.flatpickr-day.today {
    border-color: var(--primary-color) !important;
}

.flatpickr-day.today:hover {
    background: var(--bg-light);
    border-color: var(--primary-color) !important;
}

/* Footer */
footer {
    background-color: var(--bg-white);
    border-top: 2px solid var(--border-color);
    color: var(--text-muted);
    padding: 20px 0;
    margin-top: auto;
}

/* Outline Buttons - Admin Pages */
.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background-color: var(--bg-white);
    border-radius: var(--radius-pill);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: var(--bg-white);
    border-color: var(--primary-color);
}

.btn-outline-secondary {
    border: 2px solid var(--text-muted);
    color: var(--text-muted);
    background-color: var(--bg-white);
    border-radius: var(--radius-pill);
}

.btn-outline-secondary:hover {
    background-color: var(--text-muted);
    color: var(--bg-white);
    border-color: var(--text-muted);
}

.btn-outline-success {
    border: 2px solid var(--success-color);
    color: var(--success-color);
    background-color: var(--bg-white);
    border-radius: var(--radius-pill);
}

.btn-outline-success:hover {
    background-color: var(--success-color);
    color: var(--bg-white);
    border-color: var(--success-color);
}

.btn-outline-danger {
    border: 2px solid var(--danger-color);
    color: var(--danger-color);
    background-color: var(--bg-white);
    border-radius: var(--radius-pill);
}

.btn-outline-danger:hover {
    background-color: var(--danger-color);
    color: var(--bg-white);
    border-color: var(--danger-color);
}

.btn-outline-warning {
    border: 2px solid var(--warning-color);
    color: var(--text-color);
    background-color: var(--bg-white);
    border-radius: var(--radius-pill);
}

.btn-outline-warning:hover {
    background-color: var(--warning-color);
    color: var(--text-color);
    border-color: var(--warning-color);
}

.btn-outline-info {
    border: 2px solid var(--info-color);
    color: var(--info-color);
    background-color: var(--bg-white);
    border-radius: var(--radius-pill);
}

.btn-outline-info:hover {
    background-color: var(--info-color);
    color: var(--bg-white);
    border-color: var(--info-color);
}

/* Admin Dashboard Cards */
.card.border-primary {
    border: 2px solid var(--primary-color) !important;
    background-color: var(--bg-white);
}

.card.border-success {
    border: 2px solid var(--success-color) !important;
    background-color: var(--bg-white);
}

.card.border-warning {
    border: 2px solid var(--warning-color) !important;
    background-color: var(--bg-white);
}

.card.border-danger {
    border: 2px solid var(--danger-color) !important;
    background-color: var(--bg-white);
}

.card.border-info {
    border: 2px solid var(--info-color) !important;
    background-color: var(--bg-white);
}

/* Card Headers with Background Colors */
.card-header.bg-primary {
    background-color: var(--primary-color) !important;
    color: var(--bg-white);
}

.card-header.bg-success {
    background-color: var(--success-color) !important;
    color: var(--bg-white);
}

.card-header.bg-danger {
    background-color: var(--danger-color) !important;
    color: var(--bg-white);
}

.card-header.bg-warning {
    background-color: var(--warning-color) !important;
    color: var(--text-color);
}

.card-header.bg-info {
    background-color: var(--info-color) !important;
    color: var(--bg-white);
}

.card-header.bg-secondary {
    background-color: var(--text-muted) !important;
    color: var(--bg-white);
}

/* Summary Cards with Colored Backgrounds */
.card.bg-primary,
.card.bg-success,
.card.bg-danger,
.card.bg-warning,
.card.bg-info {
    border: none;
    color: var(--bg-white);
}

.card.bg-primary .card-body,
.card.bg-success .card-body,
.card.bg-danger .card-body,
.card.bg-info .card-body {
    color: var(--bg-white);
}

.card.bg-warning .card-body {
    color: var(--text-color);
}

.card.bg-primary .card-title,
.card.bg-success .card-title,
.card.bg-danger .card-title,
.card.bg-info .card-title {
    color: var(--bg-white);
    opacity: 0.9;
}

.card.bg-warning .card-title {
    color: var(--text-color);
}

/* Tabs */
.nav-tabs {
    border-bottom: 2px solid var(--border-color);
}

.nav-tabs .nav-link {
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    color: var(--text-muted);
    padding: 12px 20px;
    margin-bottom: -2px;
}

.nav-tabs .nav-link:hover {
    border-color: var(--border-color);
    background-color: var(--bg-light);
    color: var(--text-color);
}

.nav-tabs .nav-link.active {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
    background-color: var(--bg-white);
    font-weight: 600;
}

.tab-content {
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 var(--radius-md) var(--radius-md) var(--radius-md);
    padding: 24px;
}

/* Charts Container */
.chart-container {
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
}

/* Analytics Cards */
.analytics-card {
    background-color: var(--bg-white);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.analytics-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Utility Classes */
.text-primary {
    color: var(--primary-color) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.border-primary {
    border-color: var(--primary-color) !important;
}

.text-white {
    color: var(--bg-white) !important;
}

.bg-white {
    background-color: var(--bg-white) !important;
}

.bg-light {
    background-color: var(--bg-light) !important;
}

/* Leave Balance Cards */
.leave-balance-card {
    background-color: var(--bg-white);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.leave-balance-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

.leave-balance-card.leave-warning {
    border-color: var(--danger-color);
    background-color: rgba(220, 53, 69, 0.05);
}

.leave-balance-card.leave-pending {
    border-color: var(--warning-color);
    background-color: rgba(255, 193, 7, 0.05);
}

/* UX Enhancements */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.form-control.is-valid {
    border-color: var(--success-color);
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='m2.3 6.73.98-.98-.98-.98-.98.98.98.98zm2.5-2.5L4.82 3.25l-.98.98.98.98.98-.98z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-invalid {
    border-color: var(--danger-color);
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 3.6.4.4.4-.4m0 4.8-.4-.4-.4.4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--danger-color);
}

.empty-state {
    padding: 3rem 1rem;
}

.empty-state i {
    opacity: 0.3;
    margin-bottom: 1rem;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.loading-content {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.breadcrumb {
    background-color: var(--bg-light);
    padding: 12px 16px;
    margin-bottom: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

/* Breadcrumb container - stable height to prevent layout shift */
.breadcrumb-container:empty {
    display: none;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "/";
    color: var(--text-muted);
    padding: 0 0.75rem;
    font-weight: 300;
}

.breadcrumb-item {
    display: inline-flex;
    align-items: center;
}

.breadcrumb-item a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.breadcrumb-item a:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb-item a i,
.breadcrumb-item a .bi {
    font-size: 0.9rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.breadcrumb-item.active {
    color: var(--text-muted);
    font-weight: 500;
}

/* Mobile breadcrumbs */
@media (max-width: 767.98px) {
    .breadcrumb {
        padding: 10px 14px;
        font-size: 0.85rem;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .breadcrumb::-webkit-scrollbar {
        display: none;
    }
    
    .breadcrumb-item + .breadcrumb-item::before {
        padding: 0 0.5rem;
    }
}

/* Enhanced Alert Animations */
.alert {
    animation: slideDown 0.3s ease;
}

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

/* Tooltip Enhancements */
[data-bs-toggle="tooltip"] {
    cursor: help;
}

/* Focus States for Better Accessibility */
.form-control:focus,
.form-select:focus,
.btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* 
 * NOTE: Removed global "transition: all" - causes animation conflicts.
 * Each element type has its own specific transition defined below.
 */

/* Enhanced Empty States */
.empty-state {
    padding: 4rem 2rem;
    text-align: center;
}

.empty-state i {
    font-size: 4rem;
    opacity: 0.2;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    display: block;
}

.empty-state p {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.empty-state a {
    margin-top: 1rem;
}

/* Better Mobile Touch Targets */
@media (max-width: 767.98px) {
    .btn {
        min-height: 44px;
        padding: 10px 20px;
    }
    
    .btn-sm {
        min-height: 36px;
        padding: 6px 16px;
    }
    
    .form-control,
    .form-select {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Larger touch targets for mobile cards */
    .card .btn {
        min-height: 40px;
    }
}

/* Form Field Focus Enhancement */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 0, 0, 0.1);
}

/* Required Field Indicator */
.form-label .text-danger {
    font-weight: 700;
}

/* Loading Button States */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
    to { transform: rotate(360deg); }
}

/* Success Animation */
@keyframes successPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.alert-success {
    animation: successPulse 0.5s ease;
}

/* Shake Animation for Errors */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s ease;
}

/* Fade Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Copy Feedback */
.copy-feedback {
    animation: fadeInUp 0.3s ease;
}

/* Form Section Dividers */
.form-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.form-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-section-title i {
    color: var(--primary-color);
}

/* Required Field Asterisk */
.required-asterisk {
    color: var(--danger-color);
    font-weight: 700;
}

/* Form Help Text */
.form-help {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Input with Icon */
.input-icon-wrapper {
    position: relative;
}

.input-icon-wrapper .form-control {
    padding-left: 40px;
}

.input-icon-wrapper .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    z-index: 4;
}

.input-icon-wrapper .form-control:focus + .input-icon {
    color: var(--primary-color);
}

/* Improved Tooltip Styling */
.tooltip {
    font-size: 0.875rem;
}

.tooltip-inner {
    background-color: var(--primary-color);
    color: var(--bg-white);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    max-width: 250px;
}

/* Better Form Group Spacing */
.form-group,
.mb-3 {
    margin-bottom: 1.5rem !important;
}

/* Enhanced Input Groups */
.input-group .form-control:focus {
    z-index: 3;
}

/* Better Select Styling */
.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.5rem;
}

.form-select:focus {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
}

.leave-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-light);
    border-radius: 50%;
    margin-bottom: 12px;
    color: var(--primary-color);
    font-size: 1.5rem;
    border: 2px solid var(--border-color);
}

.leave-balance-card.leave-warning .leave-icon {
    background-color: rgba(220, 53, 69, 0.1);
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.leave-balance-card.leave-pending .leave-icon {
    background-color: rgba(255, 193, 7, 0.1);
    border-color: var(--warning-color);
    color: var(--warning-color);
}

.leave-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
    line-height: 1;
}

.leave-label {
    font-weight: 600;
    color: var(--text-color);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.leave-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Incentive Metric Cards */
.incentive-metric-card {
    background-color: var(--bg-white);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.incentive-metric-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

.incentive-metric-card.incentive-total {
    background-color: var(--bg-white) !important;
    border-color: var(--border-color);
    color: var(--text-color);
}

.incentive-metric-card.incentive-total .metric-icon {
    background-color: var(--bg-light);
    border-color: var(--border-color);
    color: var(--primary-color);
}

.incentive-metric-card.incentive-total .metric-value,
.incentive-metric-card.incentive-total .metric-label {
    color: var(--primary-color);
}

.incentive-metric-card.incentive-total .metric-value {
    color: #000000 !important;
}

.incentive-metric-card.incentive-total .metric-label {
    color: var(--text-muted) !important;
}

.metric-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-light);
    border-radius: 50%;
    margin-bottom: 12px;
    color: var(--primary-color);
    font-size: 1.3rem;
    border: 2px solid var(--border-color);
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
    line-height: 1;
}

.metric-label {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Conversion Rate Metric Cards */
.conversion-metric-card {
    background-color: var(--bg-white);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.conversion-metric-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

.conversion-metric-card .metric-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-light);
    border-radius: 50%;
    margin-bottom: 12px;
    color: var(--primary-color);
    font-size: 1.3rem;
    border: 2px solid var(--border-color);
}

.conversion-metric-card .metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
    line-height: 1;
}

.conversion-metric-card .metric-label {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .stat-card {
        padding: 12px 10px;
    }
    
    .stat-card h3 {
        font-size: 1.2rem !important;
        white-space: nowrap;
    }
    
    .stat-card p {
        font-size: 0.65rem;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        margin-bottom: 8px;
    }
    
    .stat-card i {
        font-size: 1.2rem;
    }
    
    /* Stat card amounts - smaller on mobile */
    .stat-card .amount,
    .stat-card .display-6,
    .stat-card .display-5,
    .stat-card .display-4 {
        font-size: 1.1rem !important;
    }
    
    .btn {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
    
    .card-body {
        padding: 12px;
    }
    
    .container-fluid {
        padding: 10px;
    }
    
    /* Mobile card view - Invoice cards */
    .card.mb-3 {
        margin-bottom: 0.75rem !important;
    }
    
    .card.mb-3 .card-body {
        padding: 12px !important;
    }
    
    /* Table responsive fixes */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        font-size: 0.75rem;
    }
    
    .table th,
    .table td {
        padding: 6px 8px;
        white-space: nowrap;
    }
    
    .table td {
        white-space: normal;
        word-break: break-word;
    }
    
    /* Button group fixes */
    .btn-group {
        display: flex;
        flex-wrap: nowrap;
    }
    
    .btn-group .btn {
        padding: 4px 8px;
        font-size: 0.7rem;
    }
    
    /* Fix badge text */
    .badge {
        font-size: 0.6rem !important;
        padding: 0.2em 0.4em !important;
        white-space: nowrap;
    }
    
    /* Card padding on mobile */
    .card-body.p-0 {
        padding: 0 !important;
    }
    
    .card-body.p-0 .table-responsive {
        padding: 12px;
    }
    
    /* Header fixes */
    h2 {
        font-size: 1.5rem;
    }
    
    /* Action buttons spacing */
    .btn-action {
        margin: 2px;
    }
    
    /* Mobile Navigation Header Improvements */
    .main-navbar {
        min-height: 56px;
        padding: 6px 0;
    }
    
    .main-navbar .container-fluid {
        padding: 0 10px;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        align-items: center !important;
    }
    
    .navbar-brand {
        padding: 4px 0;
        gap: 8px;
        flex-shrink: 1;
        min-width: 0;
        max-width: 55%;
    }
    
    .brand-logo {
        height: 30px;
        flex-shrink: 0;
    }
    
    .brand-text {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .navbar-actions {
        gap: 4px !important;
        flex-shrink: 0;
    }
    
    .notification-btn,
    .menu-btn {
        width: 38px;
        height: 38px;
    }
    
    .notification-btn i,
    .menu-btn i {
        font-size: 1.1rem;
    }
    
    .user-btn {
        padding: 6px;
    }
    
    .user-avatar {
        width: 32px;
        height: 32px;
    }
    
    .user-avatar i {
        font-size: 1.4rem;
    }
    
    /* Notification dropdown mobile fix */
    .notification-menu {
        min-width: 300px;
        max-width: calc(100vw - 24px);
        right: -60px !important;
    }
    
    /* Main menu dropdown mobile fix */
    .main-menu {
        min-width: 260px;
        max-width: calc(100vw - 24px);
    }
    
    /* User menu dropdown mobile fix */
    .user-menu {
        min-width: 220px;
        max-width: calc(100vw - 24px);
    }
}

@media (max-width: 576px) {
    /* Extra small mobile header */
    .main-navbar {
        min-height: 50px;
        padding: 4px 0;
    }
    
    .main-navbar .container-fluid {
        padding: 0 8px;
    }
    
    .navbar-brand {
        gap: 6px;
        max-width: 50%;
    }
    
    .brand-text {
        font-size: 0.9rem;
        max-width: 120px;
    }
    
    .brand-logo {
        height: 26px;
    }
    
    .navbar-actions {
        gap: 2px !important;
    }
    
    .notification-btn,
    .menu-btn {
        width: 32px;
        height: 32px;
        border-width: 1px;
    }
    
    .notification-btn i,
    .menu-btn i {
        font-size: 1rem;
    }
    
    .user-btn {
        padding: 4px;
        border-width: 1px;
    }
    
    .user-avatar {
        width: 28px;
        height: 28px;
    }
    
    .user-avatar i {
        font-size: 1.2rem;
    }
    
    .notification-badge {
        width: 8px;
        height: 8px;
        top: 4px;
        right: 4px;
    }
    .table {
        font-size: 0.75rem;
    }
    
    .table th,
    .table td {
        padding: 6px 8px;
    }
    
    .btn-group .btn {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
    
    .btn-sm {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    .card-body {
        padding: 12px;
    }
}

/* DataTables Responsive Fixes */
.dataTables_wrapper {
    overflow-x: auto;
    width: 100%;
}

.dataTables_wrapper .row {
    margin-left: 0;
    margin-right: 0;
    display: flex;
    flex-wrap: wrap;
}

.dataTables_wrapper .row > div {
    padding-left: 0;
    padding-right: 0;
    flex: 1 1 auto;
}

.dataTables_wrapper .row > div:first-child {
    flex: 0 0 auto;
}

.dataTables_wrapper .row > div:last-child {
    flex: 0 0 auto;
    margin-left: auto;
}

/* DataTables Length and Search Controls */
.dataTables_length,
.dataTables_filter {
    margin-bottom: 15px;
}

.dataTables_length label,
.dataTables_filter label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
    font-size: 0.9rem;
}

.dataTables_length select {
    margin: 0 5px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.dataTables_filter input {
    margin-left: 8px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    width: 200px;
    max-width: 100%;
}

/* Mobile DataTables Controls */
@media (max-width: 768px) {
    .dataTables_wrapper .row {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    
    .dataTables_wrapper .row > div {
        width: 100% !important;
        flex: 1 1 100% !important;
        margin-left: 0 !important;
        margin-bottom: 10px;
    }
    
    .dataTables_length,
    .dataTables_filter {
        width: 100% !important;
        margin-bottom: 12px;
        display: block;
    }
    
    .dataTables_length label,
    .dataTables_filter label {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 8px;
        display: flex;
    }
    
    .dataTables_length select {
        width: 100% !important;
        max-width: 200px;
        margin: 0;
    }
    
    .dataTables_filter input {
        width: 100% !important;
        max-width: 100%;
        margin: 0;
    }
    
    .dataTables_info {
        font-size: 0.85rem;
        margin-bottom: 10px;
        text-align: center;
        width: 100%;
        display: block;
    }
    
    .dataTables_paginate {
        font-size: 0.85rem;
        text-align: center;
        width: 100%;
        display: block;
    }
    
    .dataTables_paginate .paginate_button {
        padding: 4px 8px;
        margin: 2px;
    }
}

@media (max-width: 576px) {
    .dataTables_length label,
    .dataTables_filter label {
        font-size: 0.8rem;
    }
    
    .dataTables_length select,
    .dataTables_filter input {
        font-size: 0.85rem;
        padding: 5px 10px;
    }
    
    .dataTables_info {
        font-size: 0.75rem;
        text-align: center;
        margin-bottom: 8px;
    }
    
    .dataTables_paginate {
        font-size: 0.75rem;
        text-align: center;
    }
    
    .dataTables_paginate .paginate_button {
        padding: 3px 6px;
        margin: 1px;
        font-size: 0.75rem;
    }
}

@media (max-width: 576px) {
    .login-card .card-body {
        padding: 24px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    h2 {
        font-size: 1.5rem;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .btn,
    footer,
    .no-print {
        display: none !important;
    }
    
    .container-fluid {
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* Empty States - Consistent Styling */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 64px;
    color: var(--border-color);
    margin-bottom: 16px;
    opacity: 0.6;
}

.empty-state-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 8px;
}

.empty-state-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state-action {
    margin-top: 16px;
}

/* Small Text Utility Classes */
.text-xs {
    font-size: 0.75rem !important;
}

.text-sm {
    font-size: 0.875rem !important;
}

.text-base {
    font-size: 1rem !important;
}

.text-lg {
    font-size: 1.125rem !important;
}

/* Loading Button State */
.btn.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.is-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btn-spinner 0.6s linear infinite;
}

.btn.is-loading.btn-primary::after,
.btn.is-loading.btn-success::after,
.btn.is-loading.btn-danger::after,
.btn.is-loading.btn-info::after {
    border-color: rgba(255, 255, 255, 0.5);
    border-right-color: transparent;
}

@keyframes btn-spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Focus Ring Improvements */
.form-control:focus,
.form-select:focus,
.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.btn-primary:focus {
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.2);
}

.btn-success:focus {
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.3);
}

.btn-danger:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.3);
}

/* Truncation Utilities */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Mobile Card Improvements */
@media (max-width: 767.98px) {
    .mobile-card {
        border-radius: var(--radius-md);
        border: 1px solid var(--border-color);
        margin-bottom: 12px;
        transition: background-color 0.15s ease;
    }
    
    .mobile-card:active {
        transform: scale(0.98);
        background-color: var(--bg-light);
    }
    
    .mobile-card .card-body {
        padding: 16px;
    }
    
    .mobile-card-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 12px;
    }
    
    .mobile-card-title {
        font-weight: 600;
        font-size: 1rem;
        color: var(--text-color);
        margin-bottom: 4px;
    }
    
    .mobile-card-subtitle {
        font-size: 0.8rem;
        color: var(--text-muted);
    }
    
    .mobile-card-meta {
        font-size: 0.75rem;
        color: var(--text-muted);
    }
    
    .mobile-card-stats {
        display: flex;
        gap: 16px;
        padding: 12px;
        background: var(--bg-light);
        border-radius: var(--radius-sm);
        margin: 12px 0;
    }
    
    .mobile-card-stat {
        flex: 1;
        text-align: center;
    }
    
    .mobile-card-stat-value {
        font-weight: 700;
        font-size: 1.1rem;
        color: var(--text-color);
    }
    
    .mobile-card-stat-label {
        font-size: 0.7rem;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .mobile-card-actions {
        display: flex;
        gap: 8px;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid var(--border-color);
    }
    
    .mobile-card-actions .btn {
        flex: 1;
        padding: 8px 12px;
        font-size: 0.85rem;
    }
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Input Groups */
.input-group .form-control {
    border-radius: var(--radius-pill) !important;
}

.input-group-text {
    background-color: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-pill) !important;
    color: var(--text-color);
}

/* Fix input-group border-radius when elements are connected */
/* Left side (input-group-text) - rounded left, flat right */
.input-group > .input-group-text:first-child {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-top-left-radius: var(--radius-pill) !important;
    border-bottom-left-radius: var(--radius-pill) !important;
}

/* Right side (form-control) - flat left, rounded right */
.input-group > .form-control.border-start-0,
.input-group > .form-control:not(:first-child) {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-top-right-radius: var(--radius-pill) !important;
    border-bottom-right-radius: var(--radius-pill) !important;
}

/* Standalone form-control in input-group (no text prefix) */
.input-group > .form-control:first-child:not(.border-start-0) {
    border-radius: var(--radius-pill) !important;
}

/* Input-group-text after form-control */
.input-group > .input-group-text:not(:first-child) {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-top-right-radius: var(--radius-pill) !important;
    border-bottom-right-radius: var(--radius-pill) !important;
}

/* Pagination */
.pagination .page-link {
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-color);
    color: var(--text-color);
    margin: 0 4px;
}

.pagination .page-link:hover {
    background-color: var(--bg-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--bg-white);
}

/* ================================================
   DARK MODE THEME
   ================================================ */

/* Dark mode CSS variables */
[data-theme="dark"] {
    --primary-color: #ffffff;
    --secondary-color: #cccccc;
    --accent-color: #ffffff;
    --text-color: #e4e4e4;
    --text-muted: #a0a0a0;
    --bg-white: #1a1a1a;
    --bg-light: #2d2d2d;
    --border-color: #404040;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
}

/* Dark mode body */
body.dark-mode {
    background-color: #1a1a1a;
    color: #e4e4e4;
}

body.dark-mode .container-fluid {
    background-color: #1a1a1a;
}

/* Dark mode navbar */
body.dark-mode .navbar {
    background-color: #0d0d0d !important;
    border-bottom: 1px solid #333 !important;
}

body.dark-mode .navbar-brand,
body.dark-mode .nav-link {
    color: #e4e4e4 !important;
}

body.dark-mode .nav-link:hover {
    color: #ffffff !important;
}

body.dark-mode .dropdown-menu {
    background-color: #2d2d2d;
    border-color: #404040;
}

body.dark-mode .dropdown-item {
    color: #e4e4e4;
}

body.dark-mode .dropdown-item:hover {
    background-color: #404040;
    color: #ffffff;
}

body.dark-mode .dropdown-divider {
    border-color: #404040;
}

/* Dark mode cards */
body.dark-mode .card {
    background-color: #2d2d2d;
    border-color: #404040;
}

body.dark-mode .card-header {
    background-color: #252525;
    border-color: #404040;
    color: #e4e4e4;
}

body.dark-mode .card-body {
    color: #e4e4e4;
}

body.dark-mode .stat-card {
    background-color: #2d2d2d;
    border-color: #404040;
}

/* Dark mode tables */
body.dark-mode .table {
    color: #e4e4e4;
}

body.dark-mode .table thead th {
    background-color: #252525;
    border-color: #404040;
    color: #e4e4e4;
}

body.dark-mode .table tbody td {
    border-color: #404040;
}

body.dark-mode .table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(255, 255, 255, 0.05);
}

body.dark-mode .table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Dark mode forms */
body.dark-mode .form-control,
body.dark-mode .form-select {
    background-color: #1a1a1a;
    border-color: #404040;
    color: #e4e4e4;
}


/* Fix date column alignment in expenses table */
/* Date column is 2nd column (after ID or checkbox if present) */
#expensesTable thead th:nth-child(2),
#expensesTable tbody td:nth-child(2) {
    text-align: left !important;
}

/* If checkbox is added, Date becomes 3rd column (after checkbox and ID) */
#expensesTable thead th:nth-child(3),
#expensesTable tbody td:nth-child(3) {
    text-align: left !important;
}

/* Ensure date cells have proper alignment */
#expensesTable tbody td:nth-child(2),
#expensesTable tbody td:nth-child(3) {
    vertical-align: middle !important;
    padding-left: 0.75rem !important;
}

/* Mobile swipe actions */
@media (max-width: 767.98px) {
    .table tbody tr {
        transition: transform 0.3s ease;
        position: relative;
    }
    
    .row-actions {
        position: absolute;
        right: -80px;
        top: 0;
        bottom: 0;
        display: flex;
        align-items: center;
        gap: 8px;
        background: var(--bg-white);
        padding: 0 12px;
        transition: right 0.3s ease;
    }
}

body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus {
    background-color: #1a1a1a;
    border-color: #666;
    color: #e4e4e4;
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.1);
}

body.dark-mode .form-control::placeholder {
    color: #888;
}

body.dark-mode .form-label {
    color: #e4e4e4;
}

body.dark-mode .input-group-text {
    background-color: #252525;
    border-color: #404040;
    color: #e4e4e4;
}

/* Dark mode buttons */
body.dark-mode .btn-primary {
    background-color: #ffffff;
    border-color: #ffffff;
    color: #1a1a1a;
}

body.dark-mode .btn-primary:hover {
    background-color: #e4e4e4;
    border-color: #e4e4e4;
    color: #1a1a1a;
}

body.dark-mode .btn-secondary {
    background-color: #404040;
    border-color: #404040;
    color: #e4e4e4;
}

body.dark-mode .btn-outline-primary {
    border-color: #e4e4e4;
    color: #e4e4e4;
}

body.dark-mode .btn-outline-primary:hover {
    background-color: #e4e4e4;
    color: #1a1a1a;
}

body.dark-mode .btn-outline-secondary {
    border-color: #666;
    color: #e4e4e4;
}

body.dark-mode .btn-outline-secondary:hover {
    background-color: #404040;
    color: #ffffff;
}

/* Dark mode alerts */
body.dark-mode .alert-info {
    background-color: rgba(23, 162, 184, 0.2);
    border-color: rgba(23, 162, 184, 0.4);
    color: #7dd3fc;
}

body.dark-mode .alert-success {
    background-color: rgba(40, 167, 69, 0.2);
    border-color: rgba(40, 167, 69, 0.4);
    color: #86efac;
}

body.dark-mode .alert-warning {
    background-color: rgba(255, 193, 7, 0.2);
    border-color: rgba(255, 193, 7, 0.4);
    color: #fde68a;
}

body.dark-mode .alert-danger {
    background-color: rgba(220, 53, 69, 0.2);
    border-color: rgba(220, 53, 69, 0.4);
    color: #fca5a5;
}

/* Dark mode nav tabs */
body.dark-mode .nav-tabs {
    border-color: #404040;
}

body.dark-mode .nav-tabs .nav-link {
    color: #a0a0a0;
}

body.dark-mode .nav-tabs .nav-link:hover {
    border-color: #404040 #404040 transparent;
    color: #e4e4e4;
}

body.dark-mode .nav-tabs .nav-link.active {
    background-color: #2d2d2d;
    border-color: #404040 #404040 #2d2d2d;
    color: #e4e4e4;
}

/* Dark mode badges */
body.dark-mode .badge.bg-secondary {
    background-color: #404040 !important;
}

body.dark-mode .badge.bg-light {
    background-color: #404040 !important;
    color: #e4e4e4 !important;
}

/* Dark mode pagination */
body.dark-mode .pagination .page-link {
    background-color: #2d2d2d;
    border-color: #404040;
    color: #e4e4e4;
}

body.dark-mode .pagination .page-link:hover {
    background-color: #404040;
    color: #ffffff;
}

/* Dark mode text utilities */
body.dark-mode .text-muted {
    color: #a0a0a0 !important;
}

body.dark-mode .text-dark {
    color: #e4e4e4 !important;
}

body.dark-mode a {
    color: #6db3f2;
}

body.dark-mode a:hover {
    color: #a5d4ff;
}

/* Dark mode footer */
body.dark-mode footer {
    background-color: #0d0d0d !important;
    border-color: #333 !important;
}

/* Dark mode modals */
body.dark-mode .modal-content {
    background-color: #2d2d2d;
    border-color: #404040;
}

body.dark-mode .modal-header {
    border-color: #404040;
}

body.dark-mode .modal-footer {
    border-color: #404040;
}

body.dark-mode .modal-title {
    color: #e4e4e4;
}

body.dark-mode .btn-close {
    filter: invert(1);
}

/* Dark mode hr */
body.dark-mode hr {
    border-color: #404040;
}

/* Dark mode list groups */
body.dark-mode .list-group-item {
    background-color: #2d2d2d;
    border-color: #404040;
    color: #e4e4e4;
}

/* Dark mode progress bar */
body.dark-mode .progress {
    background-color: #404040;
}

/* DataTables dark mode */
body.dark-mode .dataTables_wrapper .dataTables_length,
body.dark-mode .dataTables_wrapper .dataTables_filter,
body.dark-mode .dataTables_wrapper .dataTables_info,
body.dark-mode .dataTables_wrapper .dataTables_paginate {
    color: #e4e4e4;
}

body.dark-mode .dataTables_wrapper .dataTables_filter input {
    background-color: #1a1a1a;
    border-color: #404040;
    color: #e4e4e4;
}

/* ================================================
   FONT SIZE SCALING
   ================================================ */
:root {
    --base-font-size: 16px;
    --ui-scale: 1;
}

/* Apply font size to body */
body {
    font-size: var(--base-font-size);
}

/* Customer search results styling */
#customer_search_results {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    background: white;
}

#customer_search_results .list-group-item {
    cursor: pointer;
    border: none;
    border-bottom: 1px solid #dee2e6;
    padding: 0.75rem 1rem;
    transition: background-color 0.15s ease;
}

#customer_search_results .list-group-item:last-child {
    border-bottom: none;
}

#customer_search_results .list-group-item:hover,
#customer_search_results .list-group-item.active {
    background-color: #f8f9fa;
    color: #000;
}

#customer_search_results .list-group-item:active {
    background-color: #e9ecef;
}


.input-focused {
    position: relative;
}

.input-focused::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
    animation: input-focus-line 0.3s ease;
}

@keyframes input-focus-line {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

/* Smooth number animations */
[data-animate-number] {
    display: inline-block;
}

/* 
 * Card entrance animations - only on initial page load
 * Uses opacity + transform for GPU acceleration
 */
@keyframes card-enter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Only animate cards on page load, not on every render */
.card.animate-in {
    animation: card-enter 0.3s ease-out;
}

/* Button hover - simple transform-based effect for performance */
.btn {
    position: relative;
    overflow: hidden;
}

/* Table row hover enhancement - simple background change, no pseudo-elements to avoid layout shift */
.table tbody tr {
    transition: background-color 0.15s ease;
}

/* Badge styling - remove hover animation to reduce visual noise */
.badge {
    /* No hover animation by default - keeps UI calm */
}

/* Loading spinner enhancement */
.spinner-border {
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

/* 
 * NOTE: Global transition rule removed - was causing animation conflicts.
 * Transitions are now defined specifically on each element type above.
 */

/* Focus ring enhancement */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Scroll reveal animation */
@keyframes scroll-reveal {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.scroll-reveal {
    animation: scroll-reveal 0.6s ease;
}

#customer_search_results .list-group-item.text-muted {
    cursor: default;
    font-style: italic;
}

#customer_search_results .list-group-item.text-danger {
    cursor: default;
    color: #dc3545 !important;
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Disable animations on mobile for better performance */
@media (max-width: 767.98px) {
    .card,
    .btn,
    .table tbody tr,
    .dropdown-menu {
        animation: none !important;
    }
    
    /* Faster transitions on mobile */
    .btn,
    .card,
    .form-control,
    .form-select {
        transition-duration: 0.1s !important;
    }
}

/* Paint containment for performance */
.card,
.modal,
.dropdown-menu {
    contain: layout style;
}
