:root {
    --dark-bg: #121212;
    --dark-surface: #1e1e1e;
    --dark-card: #252525;
    --primary-blue: #2B3990;
    --secondary-blue: #1c75bc;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #6c757d;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-700: #495057;
    --gray-800: #343a40;
    --sidebar-width: 250px;
    --header-height: 80px;
    --danger: #dc3545;
    --success: #28a745;
    --warning: #ffc107;
    --info: #17a2b8;
}

/* Global Styles */
body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--dark-bg);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Notification text color fix */
.list-group-item, 
.list-group-item h5, 
.list-group-item p {
    color: white !important;
}

.list-group-item .text-muted {
    color: #adb5bd !important;
}

a {
    color: var(--secondary-blue);
    text-decoration: none;
}

a:hover {
    color: var(--primary-blue);
    text-decoration: underline;
}

.content-wrapper {
    display: flex;
    flex: 1;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 30px;
    margin: 100px auto;
    background-color: var(--dark-surface);
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

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

.login-logo {
    max-width: 140px;
    margin-bottom: 15px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--gray-800);
    border-radius: 4px;
    background-color: var(--dark-card);
    color: var(--text-primary);
}

.form-control:focus {
    border-color: var(--primary-blue);
    outline: none;
    box-shadow: 0 0 0 2px rgba(43, 57, 144, 0.25);
}

.btn {
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

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

.btn-primary:hover {
    background-color: #232e73;
}

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

.btn-secondary:hover {
    background-color: #175e96;
}

.btn-block {
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--dark-surface);
    position: fixed;
    top: 0;
    left: 0;
    padding-top: var(--header-height);
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    z-index: 1000;
    padding-bottom: 120px; /* Add padding at the bottom to ensure space for the sidebar footer */
    scrollbar-width: thin; /* Firefox */
}

/* Customize sidebar scrollbar specifically */
.sidebar::-webkit-scrollbar {
    width: 4px; /* Even thinner for the sidebar */
}

.sidebar::-webkit-scrollbar-track {
    background-color: transparent; /* More subtle track for sidebar */
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(28, 117, 188, 0.5); /* Semi-transparent blue */
    border-radius: 4px;
}

.sidebar-logo {
    text-align: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--gray-800);
    margin-bottom: 20px;
}

.sidebar-logo img {
    max-width: 120px;
    margin-bottom: 10px;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu-item {
    margin-bottom: 8px; /* Increased from 5px to 8px for more space between items */
    position: relative;
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    padding: 10px 16px; /* Adjusted padding to be slightly more compact */
    color: var(--text-secondary);
    transition: all 0.3s ease;
    min-height: 42px; /* Ensure minimum height for all menu items */
    justify-content: flex-start; /* Force left alignment */
    text-align: left;
}

.sidebar-menu-link:hover {
    background-color: rgba(43, 57, 144, 0.1);
    color: var(--text-primary);
    text-decoration: none;
}

.sidebar-menu-link.active {
    background-color: var(--primary-blue);
    color: white;
}

.sidebar-menu-icon {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* Dropdown Menu */
.sidebar-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-submenu.show {
    max-height: 500px; /* Adjust as needed to accommodate all submenu items */
}

.sidebar-submenu-item {
    margin-bottom: 0;
}

.sidebar-submenu-link {
    display: flex;
    align-items: center;
    padding: 8px 16px 8px 46px; /* Indented submenu items */
    color: var(--text-secondary);
    transition: all 0.3s ease;
    min-height: 36px; /* Slightly smaller than main menu items */
    justify-content: flex-start; /* Force left alignment */
    text-align: left;
}

.sidebar-submenu-link:hover {
    background-color: rgba(43, 57, 144, 0.1);
    color: var(--text-primary);
    text-decoration: none;
}

.sidebar-submenu-link.active {
    background-color: rgba(43, 57, 144, 0.2);
    color: var(--text-primary);
}

.has-submenu {
    display: flex;
    justify-content: space-between;
    text-align: left;
}

.dropdown-icon {
    transition: transform 0.3s ease;
    margin-left: auto; /* Push the icon to the right */
}

.dropdown-icon.open {
    transform: rotate(90deg);
}

/* Ensure all menu text is left-justified */
.sidebar-menu-link span, 
.sidebar-submenu-link span {
    text-align: left;
}

.sidebar-footer {
    padding: 15px 10px;
    border-top: 1px solid var(--gray-800);
    position: fixed;
    bottom: 0;
    width: var(--sidebar-width);
    box-sizing: border-box;
    background-color: var(--dark-surface);
    z-index: 1001; /* Higher than sidebar to ensure it's on top */
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 20px;
    margin-left: var(--sidebar-width);
    padding-top: var(--header-height);
    min-height: 100vh;
    box-sizing: border-box;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background-color: var(--dark-surface);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 900;
}

.header-title {
    font-size: 1.5rem;
    font-weight: 500;
    margin: 0;
    flex: 1;
    min-width: 0;
    margin-right: 15px;
}

.header-actions {
    display: flex;
    align-items: center;
}

.notifications-bell {
    position: relative;
    color: var(--text-primary);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.notifications-bell:hover {
    color: var(--primary-blue);
    text-decoration: none;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--danger);
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-dropdown {
    position: relative;
    display: inline-block;
}

.user-dropdown-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 5px 10px;
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--dark-card);
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    min-width: 180px;
    padding: 10px 0;
    display: none;
    z-index: 1000;
}

.user-dropdown-menu.show {
    display: block;
}

.user-dropdown-item {
    display: block;
    padding: 8px 20px;
    color: var(--text-secondary);
}

.user-dropdown-item:hover {
    background-color: rgba(43, 57, 144, 0.1);
    color: var(--text-primary);
    text-decoration: none;
}

/* Cards */
.card {
    background-color: var(--dark-card);
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
}

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

.card-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 500;
}

.card-body {
    padding: 0;
}

/* Alerts */
.alert {
    padding: 12px 20px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.1);
    color: #f8d7da;
    border-left: 4px solid var(--danger);
}

.alert-success {
    background-color: rgba(40, 167, 69, 0.1);
    color: #d4edda;
    border-left: 4px solid var(--success);
}

.alert-warning {
    background-color: rgba(255, 193, 7, 0.1);
    color: #fff3cd;
    border-left: 4px solid var(--warning);
}

.alert-info {
    background-color: rgba(23, 162, 184, 0.1);
    color: #d1ecf1;
    border-left: 4px solid var(--info);
}

/* Under Construction */
.under-construction {
    text-align: center;
    padding: 50px 20px;
}

.under-construction i {
    font-size: 5rem;
    color: var(--secondary-blue);
    margin-bottom: 20px;
}

.under-construction h2 {
    font-size: 2rem;
    margin-bottom: 20px;
}

.under-construction p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .header {
        left: 0;
        padding: 0 15px;
    }
    
    .header-title {
        margin-right: 10px;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .sidebar-footer {
        transform: translateX(-100%);
    }
    
    .sidebar.show .sidebar-footer {
        transform: translateX(0);
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 10px;
    }
    
    .header-title {
        margin-right: 8px;
    }
    
    .header-actions {
        gap: 10px;
    }
    
    .user-dropdown-toggle {
        padding: 5px 8px;
        font-size: 0.9rem;
    }
    
    .notifications-bell {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0 8px;
    }
    
    .header-title {
        margin-right: 5px;
    }
    
    .header-actions {
        gap: 8px;
    }
    
    .user-dropdown-toggle {
        padding: 4px 6px;
        font-size: 0.85rem;
    }
    
    .user-dropdown-toggle .fas {
        display: none;
    }
    
    .notifications-bell {
        font-size: 1rem;
        margin-right: 8px;
    }
}

@media (min-width: 993px) {
    .menu-toggle {
        display: none;
    }
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    margin-right: 15px;
    padding: 12px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Dashboard widgets */
.dashboard-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.widget {
    background-color: var(--dark-card);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

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

.widget-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
}

.widget-icon {
    font-size: 1.5rem;
    color: var(--secondary-blue);
}

.widget-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.widget-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Weekly Hours Summary */
.weekly-hours-summary {
    padding: 10px 0;
}

.weekly-hours-display {
    display: flex;
    align-items: center;
    background-color: var(--primary-blue);
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.hours-label {
    font-size: 1.2rem;
    font-weight: 500;
    margin-right: 15px;
    color: #ffffff;
}

.hours-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #ffffff;
}

/* Per Diem Warning */
.per-diem-warning {
    background-color: rgba(255, 193, 7, 0.15);
    font-size: 0.85rem;
    padding: 6px 10px !important;
    margin-bottom: 8px;
    border-radius: 4px;
}

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

/* Forms */
.form-row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -10px;
    margin-left: -10px;
}

.form-col {
    flex-basis: 0;
    flex-grow: 1;
    max-width: 100%;
    padding-right: 10px;
    padding-left: 10px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    /* Custom scrollbar for horizontal scrolling in tables */
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: var(--secondary-blue) rgba(30, 30, 30, 0.4);
}

.table-responsive::-webkit-scrollbar {
    height: 5px; /* Thinner horizontal scrollbar */
}

.table-responsive::-webkit-scrollbar-track {
    background-color: transparent;
}

.table-responsive::-webkit-scrollbar-thumb {
    background-color: rgba(28, 117, 188, 0.5); /* Semi-transparent blue */
    border-radius: 4px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--dark-card); /* Ensure dark background for the table */
}

.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--gray-800);
    color: var(--text-primary); /* Ensure all text is visible with primary text color */
}

.table th {
    font-weight: 500;
    color: var(--text-primary);
    background-color: rgba(43, 57, 144, 0.1);
}

.table tbody tr {
    background-color: var(--dark-card);
}

.table tbody tr:hover {
    background-color: rgba(43, 57, 144, 0.2);
}

.table .status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.table .status-active {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.table .status-inactive {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.table .status-pending {
    background-color: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

/* Inactive work order styling - darker gray background for better white text readability */
.table-inactive {
    background-color: var(--gray-800) !important; /* Dark gray background */
}

.table-inactive td {
    color: var(--text-primary) !important; /* Ensure white text is maintained */
}

.table-inactive:hover {
    background-color: rgba(52, 58, 64, 0.8) !important; /* Slightly lighter on hover */
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

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

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

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

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

.badge-warning {
    background-color: var(--warning);
    color: #212529;
}

.badge-info {
    background-color: var(--info);
    color: white;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
    background-color: transparent;
}

::-webkit-scrollbar-track {
    background-color: rgba(30, 30, 30, 0.4);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background-color: var(--secondary-blue);
    border-radius: 10px;
}

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

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--secondary-blue) rgba(30, 30, 30, 0.4);
}

/* Blinking effect for status icons */
@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

.blink-icon {
    animation: blink 1.5s ease-in-out infinite;
}

/* Global Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.loading-overlay.show {
    display: flex;
}

.loading-container {
    text-align: center;
    background-color: var(--dark-card);
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--gray-800);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--gray-800);
    border-top: 4px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px auto;
}

.loading-text {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
    font-family: 'Roboto', sans-serif;
}

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

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

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin-top: -10px;
    margin-left: -10px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
