/* File: css/style.css */
/* Revised for a more modern, functional, and sleek design */

/* 1. Base HTML and Body Styles */
html {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth; /* Smooth scrolling */
}
*, *::before, *::after {
    box-sizing: inherit;
}
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* Prevent accidental horizontal scroll */
}

/* Define CSS Variables for Light Theme */
:root {
    --text-color: #333333;
    --background-color: #F5F7F9;
    --header-bg: #FFFFFF;
    --sidebar-bg: #FFFFFF;
    --card-bg: #FFFFFF;
    --border-color: #dee2e6;
    --heading-color: #013F63; /* Dark Blue */
    --link-color: #0267A1; /* Primary Blue */
    --link-hover-color: #015486; /* Darker Primary Blue */
    --primary-blue: #0267A1;
    --dark-blue: #013F63;
    --accent-teal: #00A4CC;
    --light-gray: #F5F7F9;
    --white: #FFFFFF;
    --gradient-cta-start: #00C3FF;
    --gradient-cta-end: #0267A1;
    --gradient-cta-hover-start: #00a9e0;
    --gradient-cta-hover-end: #015486;
    --navbar-mobile-bg: #013F63; /* Dark Blue */
    --navbar-mobile-toggler-icon-color: rgba(255, 255, 255, 1);
    --offcanvas-bg: #FFFFFF;
    --offcanvas-link-color: #333333;
    --offcanvas-link-hover-bg: #e9ecef;
    --offcanvas-link-hover-color: #013F63;
    --offcanvas-link-active-bg: #0267A1;
    --offcanvas-link-active-color: #FFFFFF;
    --offcanvas-section-header-color: #6c757d;
    --offcanvas-logout-color: #dc3545;
    --offcanvas-logout-hover-color: #FFFFFF;
    --offcanvas-logout-hover-bg: #dc3545;
    --card-header-bg: #f8f9fa;
    --card-header-color: #013F63;
    --tab-link-color: #495057;
    --tab-link-hover-bg: #e9ecef;
    --tab-link-hover-border: #adb5bd;
    --tab-link-active-bg: #FFFFFF;
    --tab-link-active-color: #0267A1;
    --tab-link-active-border-bottom: #0267A1;
    --modal-header-bg: #013F63;
    --modal-header-color: #FFFFFF;
    --modal-close-button-filter: invert(1) grayscale(100%) brightness(200%);
    --modal-subheader-color: #0267A1;
    --modal-preview-bg: #f8f9fa;
    --modal-preview-border: #dee2e6;
    --modal-footer-bg: #f8f9fa;
    --alert-info-bg: #d1ecf1; /* Bootstrap default */
    --alert-info-color: #0c5460; /* Bootstrap default */
    --alert-success-bg: #d4edda;
    --alert-success-color: #155724;
    --alert-warning-bg: #fff3cd;
    --alert-warning-color: #856404;
    --alert-danger-bg: #f8d7da;
    --alert-danger-color: #721c24;
    --muted-text-color: #6c757d;

    /* RGB values for shadows (used in rgba()) */
    --primary-blue-rgb-shadow: 2, 103, 161;
    --offcanvas-section-header-rgb-shadow: 108, 117, 125;
    --accent-teal-rgb-shadow: 0, 164, 204;
    --link-color-rgb: 2, 103, 161;
}

/* Dark Mode Overrides */
body.dark-mode {
    --text-color: #ECECEC;
    --background-color: #121212;
    --header-bg: #181818;
    --sidebar-bg: #181818;
    --card-bg: #202020;
    --border-color: #333333;
    --heading-color: #FFFFFF;
    --link-color: #81D4FA;
    --link-hover-color: #B3E5FC;
    --primary-blue: #42A5F5;
    --dark-blue: #1E88E5;
    --accent-teal: #26C6DA;
    --light-gray: #2C2C2C; /* This is now a dark grey for light-gray equivalent */
    --white: #1F1F1F; /* This is now a very dark grey for white equivalent */

    --gradient-cta-start: #29B6F6;
    --gradient-cta-end: #0277BD;
    --gradient-cta-hover-start: #039BE5;
    --gradient-cta-hover-end: #01579B;

    --navbar-mobile-bg: #181818;
    --navbar-mobile-toggler-icon-color: rgba(255, 255, 255, 1);
    --offcanvas-bg: #181818;
    --offcanvas-link-color: #ECECEC; /* Pure white for menu links */
    --offcanvas-link-hover-bg: #2C2C2C;
    --offcanvas-link-hover-color: #81D4FA;
    --offcanvas-link-active-bg: #42A5F5;
    --offcanvas-link-active-color: #FFFFFF;
    --offcanvas-section-header-color: #BDBDBD; /* Lighter grey for section headers */
    --offcanvas-logout-color: #FF8A65; /* Brighter red for logout */
    --offcanvas-logout-hover-color: #FFFFFF;
    --offcanvas-logout-hover-bg: #E64A19;

    --card-header-bg: #2C2C2C;
    --card-header-color: #FFFFFF;
    --tab-link-color: #BDBDBD;
    --tab-link-hover-bg: #2C2C2C;
    --tab-link-hover-border: #444444;
    --tab-link-active-bg: #202020;
    --tab-link-active-color: #81D4FA;
    --tab-link-active-border-bottom: #81D4FA;

    --modal-header-bg: #181818;
    --modal-header-color: #FFFFFF;
    --modal-close-button-filter: invert(1) brightness(200%); /* Adjusted filter for dark background */
    --modal-subheader-color: #81D4FA;
    --modal-preview-bg: #2C2C2C;
    --modal-preview-border: #444444;
    --modal-footer-bg: #2C2C2C;

    --alert-info-bg: #263238;
    --alert-info-color: #80DEEA;
    --alert-success-bg: #1B5E20;
    --alert-success-color: #81C784;
    --alert-warning-bg: #FF6F00;
    --alert-warning-color: #FFD54F;
    --alert-danger-bg: #B71C1C;
    --alert-danger-color: #EF9A9A;

    --muted-text-color: #D7D7D7; /* Lighter for descriptions/muted text */

    /* RGB values for shadows (used in rgba()) - Adjusted for new dark mode colors */
    --primary-blue-rgb-shadow: 66, 165, 245; /* Corresponds to --primary-blue */
    --offcanvas-section-header-rgb-shadow: 189, 189, 189; /* Corresponds to --offcanvas-section-header-color */
    --accent-teal-rgb-shadow: 38, 198, 218; /* Corresponds to --accent-teal */
    --link-color-rgb: 129, 212, 250; /* Corresponds to --link-color */

    /* General form control styling for dark mode */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    select,
    textarea,
    .form-control,
    .form-select {
        background-color: var(--card-bg);
        color: var(--text-color);
        border-color: var(--border-color);
        transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    }

    /* Placeholder color for dark mode */
    input::placeholder,
    textarea::placeholder {
        color: var(--muted-text-color);
        transition: color 0.3s ease;
    }

    /* Specific Bootstrap overrides for focus states in dark mode */
    .form-control:focus,
    .form-select:focus {
        background-color: var(--card-bg); /* Maintain background on focus */
        color: var(--text-color);
        border-color: var(--link-color); /* Highlight border on focus */
        box-shadow: 0 0 0 0.25rem rgba(var(--link-color-rgb), 0.3); /* Adjusted opacity for better visibility */
    }

    /* Ensure check-inputs are visible */
    .form-check-input {
        border-color: var(--border-color);
        background-color: var(--card-bg);
        transition: background-color 0.3s ease, border-color 0.3s ease;
    }
    .form-check-input:checked {
        background-color: var(--primary-blue);
        border-color: var(--primary-blue);
    }

    .btn-close {
        filter: var(--modal-close-button-filter);
    }

    /* Reinforce buttons and tabs to have white text */
    .btn-primary, .btn-secondary, .btn-accent, .btn-cta-gradient,
    .offcanvas.d-lg-none .nav-link.active, /* Active offcanvas link */
    #desktopSidebar .nav-link.active /* Active desktop sidebar link */
    {
        color: #FFFFFF !important; /* Ensure white text on these buttons/active links */
    }

    /* Make desktop sidebar links readable in dark mode */
    #desktopSidebar .nav-link:not(.active) {
        color: var(--offcanvas-link-color) !important; /* Use !important to override Bootstrap's .link-dark */
    }

    .nav-tabs .nav-link {
        color: var(--tab-link-color);
    }

    .nav-tabs .nav-link:hover,
    .nav-tabs .nav-link.active {
        color: var(--link-hover-color);
        border-bottom-color: var(--link-hover-color) !important;
    }

    /* General alert styling for dark mode */
    .alert {
        background-color: rgba(255,255,255,0.05); /* Slightly transparent background */
        color: var(--text-color); /* Use main text color */
        border-color: var(--border-color); /* Use general border color */
        transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    }

    a {
        color: var(--link-color);
    }

    a:hover {
        color: var(--link-hover-color);
    }

    /* ==== FIX START: Comprehensive Bootstrap Component & Utility Overrides ==== */

    /* Text Utilities */
    .text-dark,
    .text-body {
        color: var(--text-color) !important;
    }

    /* Background Utilities */
    .bg-light {
        background-color: var(--light-gray) !important;
    }
    .bg-white {
        background-color: var(--card-bg) !important;
    }

    /* List Groups */
    .list-group-item {
        background-color: var(--card-bg);
        border-color: var(--border-color);
        color: var(--text-color);
    }
    .list-group-item-action:hover, .list-group-item-action:focus {
        background-color: var(--light-gray);
        color: var(--link-hover-color);
    }
    .list-group-item.active {
        background-color: var(--primary-blue);
        border-color: var(--primary-blue);
        color: #FFFFFF;
    }

    /* Tables */
    .table {
        --bs-table-color: var(--text-color);
        --bs-table-bg: transparent;
        --bs-table-border-color: var(--border-color);
        --bs-table-striped-bg: var(--light-gray);
        --bs-table-striped-color: var(--text-color);
        --bs-table-hover-bg: var(--offcanvas-link-hover-bg);
        --bs-table-hover-color: var(--text-color);
    }
    .table-light {
        --bs-table-bg: var(--light-gray);
        --bs-table-color: var(--text-color);
        --bs-table-border-color: var(--border-color);
    }
    .table-dark {
        --bs-table-bg: var(--card-bg);
    }

    /* Accordion */
    .accordion-item {
        background-color: var(--card-bg);
        border-color: var(--border-color);
    }
    .accordion-button {
        background-color: var(--card-bg);
        color: var(--heading-color);
    }
    .accordion-button:not(.collapsed) {
        background-color: var(--light-gray);
        color: var(--link-color);
        box-shadow: inset 0 -1px 0 var(--border-color);
    }
    .accordion-button:focus {
        box-shadow: 0 0 0 0.25rem rgba(var(--link-color-rgb), 0.25);
        border-color: var(--link-color) !important;
    }
    .accordion-button::after {
        --bs-accordion-btn-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ECECEC'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
        --bs-accordion-btn-active-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%2381D4FA'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
    }

    /* Pagination */
    .page-link {
        background-color: var(--card-bg);
        border-color: var(--border-color);
        color: var(--link-color);
    }
    .page-link:hover {
        background-color: var(--light-gray);
        border-color: var(--border-color);
        color: var(--link-hover-color);
    }
    .page-item.active .page-link {
        background-color: var(--primary-blue);
        border-color: var(--primary-blue);
        color: #FFFFFF;
    }
    .page-item.disabled .page-link {
        background-color: var(--card-bg);
        border-color: var(--border-color);
        color: var(--muted-text-color);
    }

    /* Badges */
    .badge.bg-light {
        background-color: var(--light-gray) !important;
        color: var(--text-color) !important;
    }

    /* ==== END of Comprehensive Fixes ==== */


    /* SweetAlert2 Dark Mode Overrides */
    .swal2-popup {
        background-color: var(--card-bg) !important;
        color: var(--text-color) !important;
    }
    .swal2-title {
        color: var(--heading-color) !important;
    }
    .swal2-html-container, .swal2-content {
        color: var(--text-color) !important;
    }
    .swal2-input, .swal2-textarea, .swal2-select {
        background-color: var(--background-color) !important;
        color: var(--text-color) !important;
        border: 1px solid var(--border-color) !important;
    }
    .swal2-confirm {
        background-color: var(--primary-blue) !important;
        color: var(--white) !important;
    }
    .swal2-cancel {
        background-color: var(--offcanvas-section-header-color) !important;
        color: var(--white) !important;
    }
    .swal2-footer {
        border-top: 1px solid var(--border-color) !important;
        color: var(--text-color) !important;
    }
    
    /* Add Dark Mode styles for Flatpickr Calendar */
    .flatpickr-calendar {
        background: var(--card-bg);
        border-color: var(--border-color);
        box-shadow: 0 3px 15px rgba(0,0,0,0.2);
        color: var(--text-color);
    }
    .flatpickr-months .flatpickr-month,
    .flatpickr-time input,
    .flatpickr-time .flatpickr-am-pm {
        color: var(--text-color);
    }
    .flatpickr-months .flatpickr-prev-month svg,
    .flatpickr-months .flatpickr-next-month svg {
        fill: var(--text-color);
    }
    .flatpickr-months .flatpickr-prev-month:hover svg,
    .flatpickr-months .flatpickr-next-month:hover svg {
        fill: var(--link-color);
    }
    .flatpickr-current-month .flatpickr-monthDropdown-months {
        background: var(--card-bg);
        border-color: var(--border-color);
    }
    .flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month {
        color: var(--text-color);
        background: transparent;
    }
    .flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month:hover {
        background: var(--offcanvas-link-hover-bg);
        color: var(--link-color);
    }
    .numInputWrapper span:hover {
        background: var(--offcanvas-link-hover-bg);
    }
    .flatpickr-weekday {
        color: var(--offcanvas-section-header-color);
    }
    .flatpickr-day {
        color: var(--text-color);
    }
    .flatpickr-day:hover,
    .flatpickr-day:focus {
        background: var(--offcanvas-link-hover-bg);
        border-color: var(--offcanvas-link-hover-bg);
        color: var(--link-hover-color);
    }
    .flatpickr-day.today {
        border-color: var(--link-color);
    }
    .flatpickr-day.today:hover,
    .flatpickr-day.today:focus {
        background: var(--link-color);
        color: #FFFFFF;
        border-color: var(--link-color);
    }
    .flatpickr-day.selected,
    .flatpickr-day.startRange,
    .flatpickr-day.endRange {
        background: var(--primary-blue);
        border-color: var(--primary-blue);
        color: #FFFFFF;
    }
    .flatpickr-day.selected:focus, .flatpickr-day.startRange:focus, .flatpickr-day.endRange:focus,
    .flatpickr-day.selected:hover, .flatpickr-day.startRange:hover, .flatpickr-day.endRange:hover {
        background: var(--primary-blue);
        border-color: var(--primary-blue);
        color: #FFFFFF;
    }
    .flatpickr-day.inRange {
        background: var(--offcanvas-link-hover-bg);
        border-color: var(--offcanvas-link-hover-bg);
        box-shadow: -5px 0 0 var(--offcanvas-link-hover-bg), 5px 0 0 var(--offcanvas-link-hover-bg);
    }
    .flatpickr-day.disabled,
    .flatpickr-day.disabled:hover {
        color: var(--muted-text-color);
        opacity: 0.5;
        background: transparent;
    }
    .flatpickr-time {
        border-top-color: var(--border-color);
    }
    .flatpickr-time .numInputWrapper {
        background: transparent;
    }
    .flatpickr-time .numInputWrapper span {
        border-left-color: var(--border-color);
    }
    .flatpickr-time .numInputWrapper span.arrowUp:after {
        border-bottom-color: var(--text-color);
    }
    .flatpickr-time .numInputWrapper span.arrowDown:after {
        border-top-color: var(--text-color);
    }
}

body {
    font-family: 'Inter', sans-serif; /* Body Copy from README */
    font-size: 16px; /* Base Font Size from README */
    line-height: 1.7; /* Slightly increased for better readability */
    color: var(--text-color);
    background-color: var(--background-color);
    position: relative; /* For stacking context */
    transition: background-color 0.3s ease, color 0.3s ease; /* Smooth transition */
}
h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif; /* Headings font from README */
    font-weight: 600; /* Headings weight from README */
    color: var(--heading-color);
    letter-spacing: 0.02em; /* Headings letter-spacing from README */
    margin-top: 0;
    margin-bottom: 0.75rem; /* Consistent heading bottom margin */
    transition: color 0.3s ease; /* Smooth transition */
}
/* Font size scale from README, slightly adjusted for modern feel */
h1 { font-size: 2.75rem; line-height: 1.2; }
h2 { font-size: 2rem; line-height: 1.3; }
h3 { font-size: 1.5rem; line-height: 1.4; }
h4 { font-size: 1.25rem; line-height: 1.5; }
h5 { font-size: 1.1rem; line-height: 1.5; }
h6 { font-size: 1rem; line-height: 1.5; }

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}
a:hover {
    color: var(--link-hover-color);
    text-decoration: underline;
}

/* 2. Mobile Navigation (Visible on <992px) */
.navbar.fixed-top.d-lg-none {
    background-color: var(--navbar-mobile-bg) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    height: 56px;
    padding: 0 0.75rem;
    transition: background-color 0.3s ease;
}
.navbar.fixed-top.d-lg-none .navbar-brand {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: var(--white) !important;
    font-size: 1.25rem;
    transition: color 0.3s ease;
}
.navbar.fixed-top.d-lg-none .navbar-toggler {
    border-color: rgba(255,255,255,0.25);
    padding: 0.25rem 0.5rem;
}
.navbar.fixed-top.d-lg-none .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}
.navbar-brand.mx-auto {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

/* Mobile Offcanvas Menu */
.offcanvas.offcanvas-start.d-lg-none {
    background-color: var(--offcanvas-bg);
    border-right: none;
    box-shadow: 2px 0 15px rgba(0,0,0,0.1);
    z-index: 1045;
    width: 280px;
    transition: background-color 0.3s ease;
}
.offcanvas.d-lg-none .offcanvas-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    transition: border-color 0.3s ease;
}
.offcanvas.d-lg-none .offcanvas-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: var(--heading-color);
    font-size: 1.25rem;
    transition: color 0.3s ease;
}
.offcanvas.d-lg-none .nav-link {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--offcanvas-link-color);
    padding: 0.8rem 1.25rem;
    border-radius: 0.375rem;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}
.offcanvas.d-lg-none .nav-link:hover {
    background-color: var(--offcanvas-link-hover-bg);
    color: var(--offcanvas-link-hover-color);
}
.offcanvas.d-lg-none .nav-link.active {
    background-color: var(--offcanvas-link-active-bg);
    color: var(--offcanvas-link-active-color);
    font-weight: 600;
}
.offcanvas.d-lg-none .nav-link i.fa-fw {
    margin-right: 0.85rem;
    width: 1.25em;
    text-align: center;
    font-size: 1rem;
}
.offcanvas.d-lg-none .nav-link.disabled {
    color: var(--offcanvas-section-header-color);
    font-weight: 600;
    opacity: 1;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding-top: 1rem;
    padding-bottom: 0.25rem;
}
.offcanvas.d-lg-none .nav-link.text-danger {
    color: var(--offcanvas-logout-color) !important;
}
.offcanvas.d-lg-none .nav-link.text-danger:hover {
    color: var(--offcanvas-logout-hover-color) !important;
    background-color: var(--offcanvas-logout-hover-bg);
}

/* 3. Desktop Static Sidebar (Visible >=992px) */
#desktopSidebar {
    /* Styles applied via @media query below */
}

/* 4. Main Content Wrapper */
.main-content-wrapper {
    width: 100%;
    transition: margin-left .3s ease-in-out, padding-top .3s ease-in-out;
}
.main-content-inner {
    padding: 1.5rem; /* Default padding */
    min-height: calc(100vh - 56px - 73px); /* MobileNav - FooterHeight (adjusted footer) */
}

/* 5. Responsive Layout Adjustments */
@media (min-width: 992px) { /* Desktop and larger */
    body {
        padding-top: 0 !important;
    }

    #desktopSidebar {
        display: flex !important;
        flex-direction: column !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 280px !important;
        height: 100vh !important;
        background-color: var(--sidebar-bg) !important;
        border-right: 1px solid var(--border-color) !important;
        z-index: 1020;
        padding: 0 !important;
        overflow-y: auto;
        transition: background-color 0.3s ease, border-color 0.3s ease, width 0.3s ease-in-out;
    }
    /* Inner container for desktop sidebar for consistent padding */
    #desktopSidebar .sidebar-inner-content {
        padding: 1rem;
        display: flex;
        flex-direction: column;
        height: 100%;
    }
    #desktopSidebar .sidebar-header {
        padding: 0.5rem 0.75rem 1rem 0.75rem;
        border-bottom: 1px solid var(--border-color);
        margin-bottom: 1rem;
        transition: border-color 0.3s ease;
    }
    #desktopSidebar .sidebar-header .fs-4 {
        font-family: 'Poppins', sans-serif;
        font-weight: 600;
        color: var(--heading-color);
        font-size: 1.5rem;
        transition: color 0.3s ease;
    }
    #desktopSidebar .sidebar-header .text-primary {
        color: var(--primary-blue) !important;
        font-size: 1.75rem;
        transition: color 0.3s ease;
    }
    #desktopSidebar .nav-pills {
        flex-grow: 1;
    }
    #desktopSidebar .nav-link {
        font-family: 'Inter', sans-serif;
        font-weight: 500;
        font-size: 0.9rem;
        color: var(--text-color); /* Changed to use --text-color for general links */
        padding: 0.7rem 1rem;
        border-radius: 0.375rem;
        margin-bottom: 0.25rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        display: flex;
        align-items: center;
        transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
    }
    #desktopSidebar .nav-link:hover:not(.active) {
        background-color: var(--offcanvas-link-hover-bg); /* Reused offcanvas hover bg */
        color: var(--offcanvas-link-hover-color); /* Reused offcanvas hover color */
    }
    #desktopSidebar .nav-link.active {
        background-color: var(--primary-blue);
        color: var(--white) !important;
        font-weight: 600;
    }
    #desktopSidebar .nav-link i.fa-fw {
        margin-right: 0.85rem;
        width: 1.25em;
        text-align: center;
        font-size: 0.95rem;
    }
    #desktopSidebar .nav-link.disabled {
        color: var(--offcanvas-section-header-color) !important;
        font-weight: 600;
        opacity: 1;
        background-color: transparent !important;
        text-transform: uppercase;
        font-size: 0.7rem;
        letter-spacing: 0.05em;
        padding-left: 0.25rem !important;
        padding-top: 1rem;
        padding-bottom: 0.25rem;
        cursor: default;
    }
    #desktopSidebar .nav-link.link-dark.disabled {
        color: var(--text-color) !important; /* Changed to use --text-color */
        opacity: 1;
        font-weight: 500;
        background-color: transparent !important;
        text-transform: none;
        letter-spacing: normal;
        font-size: 0.9rem;
        padding: 0.5rem 0.25rem !important;
    }
    #desktopSidebar .sidebar-footer {
        padding: 1rem 0.75rem 0.5rem 0.75rem;
        border-top: 1px solid var(--border-color);
        transition: border-color 0.3s ease;
    }
    #desktopSidebar .sidebar-footer .nav-link.text-danger {
        padding: 0.7rem 1rem;
        color: var(--offcanvas-logout-color) !important; /* Ensure consistency */
    }
    #desktopSidebar .sidebar-footer .nav-link.text-danger:hover {
        background-color: var(--offcanvas-logout-hover-bg);
        color: var(--offcanvas-logout-hover-color) !important;
    }
    #desktopSidebar .border-top,
    #desktopSidebar .border-bottom {
        border-color: var(--border-color) !important;
        transition: border-color 0.3s ease;
    }
    #desktopSidebar hr {
        border-top-color: var(--border-color);
        margin: 0.75rem 0;
        transition: border-color 0.3s ease;
    }

    .main-content-wrapper {
        margin-left: 280px !important;
        padding-top: 0 !important;
        width: calc(100% - 280px);
    }
    .main-content-inner {
        padding: 2rem;
        min-height: calc(100vh - 73px);
    }
}

@media (max-width: 991.98px) {
    .main-content-wrapper {
        padding-top: 56px !important;
        margin-left: 0 !important;
        width: 100%;
    }
    .main-content-inner {
        padding: 1rem;
    }
}

/* 6. Footer Styling */
.footer {
    background-color: var(--header-bg) !important; /* Use header-bg for consistency */
    border-top: 1px solid var(--border-color) !important;
    color: var(--muted-text-color);
    padding: 1.5rem 0;
    font-size: 0.875rem;
    text-align: center;
    position: relative;
    z-index: 100;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* 7. General UI Elements (Buttons, Cards, etc.) */
.btn {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 0.375rem;
    padding: 0.65rem 1.3rem;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
}
.btn:active {
    transform: translateY(1px);
    box-shadow: none;
}
.btn-primary {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
    color: var(--white); /* Use --white, which becomes dark in dark mode */
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--link-hover-color); /* Use link-hover-color for darker shade */
    border-color: var(--link-hover-color);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(var(--primary-blue-rgb-shadow), 0.3); /* Adjusted for variable use */
}


.btn-secondary {
    background-color: var(--offcanvas-section-header-color); /* Reusing a grey variable */
    border-color: var(--offcanvas-section-header-color);
    color: var(--white);
}
.btn-secondary:hover, .btn-secondary:focus {
    background-color: var(--muted-text-color); /* Using muted text color for darker secondary */
    border-color: var(--muted-text-color);
    box-shadow: 0 2px 8px rgba(var(--offcanvas-section-header-rgb-shadow), 0.3);
}


.btn-accent {
    background-color: var(--accent-teal);
    border-color: var(--accent-teal);
    color: var(--white);
}
.btn-accent:hover, .btn-accent:focus {
    background-color: var(--gradient-cta-hover-start); /* Reusing a darker teal-like color */
    border-color: var(--gradient-cta-hover-start);
    box-shadow: 0 2px 8px rgba(var(--accent-teal-rgb-shadow), 0.3);
}


.btn-cta-gradient {
    background-image: linear-gradient(90deg, var(--gradient-cta-start) 0%, var(--gradient-cta-end) 100%);
    border: none;
    color: var(--white);
}
.btn-cta-gradient:hover, .btn-cta-gradient:focus {
    background-image: linear-gradient(90deg, var(--gradient-cta-hover-start) 0%, var(--gradient-cta-hover-end) 100%);
    box-shadow: 0 2px 8px rgba(var(--primary-blue-rgb-shadow), 0.3);
}

.card {
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
    background-color: var(--card-bg);
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.card-header {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: var(--card-header-color);
    background-color: var(--card-header-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 1.25rem;
    font-size: 1.1rem;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.card-body {
    padding: 1.25rem;
}
.card-footer {
    background-color: var(--modal-footer-bg); /* Reusing modal footer bg */
    border-top: 1px solid var(--border-color);
    padding: 0.85rem 1.25rem;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Nav Tabs from README */
.nav-tabs {
    border-bottom: 1px solid var(--border-color);
    transition: border-color 0.3s ease;
}
.nav-tabs .nav-link {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    color: var(--tab-link-color);
    border: 1px solid transparent;
    border-bottom-width: 3px;
    border-bottom-color: transparent;
    margin-bottom: -1px;
    padding: 0.75rem 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.9rem;
    border-top-left-radius: 0.375rem;
    border-top-right-radius: 0.375rem;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, border-color 0.2s ease-in-out;
}
.nav-tabs .nav-link:hover:not(.active) {
    border-color: var(--tab-link-hover-bg) var(--tab-link-hover-bg) var(--tab-link-hover-border);
    color: var(--offcanvas-link-hover-color); /* Reusing dark blue hover color */
    background-color: var(--tab-link-hover-bg);
}
.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
    color: var(--tab-link-active-color);
    background-color: var(--tab-link-active-bg);
    border-color: var(--border-color) var(--border-color) var(--tab-link-active-border-bottom) !important;
    border-bottom-width: 3px !important;
    font-weight: 600;
}

/* Global Log Catch Modal */
#globalLogCatchModal .modal-content {
    border-radius: 0.5rem;
    border: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    background-color: var(--card-bg); /* Use card-bg for modal content */
    transition: background-color 0.3s ease;
}
#globalLogCatchModal .modal-header {
    background-color: var(--modal-header-bg);
    color: var(--modal-header-color);
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
    padding: 1rem 1.5rem;
    transition: background-color 0.3s ease, color 0.3s ease;
}
#globalLogCatchModal .modal-header .btn-close {
    filter: var(--modal-close-button-filter);
    opacity: 0.8;
    transition: opacity 0.2s ease-in-out, filter 0.3s ease;
}
#globalLogCatchModal .modal-header .btn-close:hover {
    opacity: 1;
}
#globalLogCatchModal .modal-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.25rem;
}
#globalLogCatchModal .modal-body {
    padding: 1.5rem;
}
#globalLogCatchModal .modal-body h6 {
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    color: var(--modal-subheader-color);
    margin-bottom: 0.75rem !important;
    transition: color 0.3s ease;
}
#globalLogCatchModal .form-label {
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.3rem;
    color: var(--text-color); /* Ensure form labels adapt */
    transition: color 0.3s ease;
}
#globalLogCatchModal .form-control,
#globalLogCatchModal .form-select,
#globalLogCatchModal .form-control-sm,
#globalLogCatchModal .form-select-sm {
    font-size: 0.875rem;
    border-radius: 0.375rem;
    background-color: var(--card-bg); /* Inputs should match card background */
    color: var(--text-color); /* Input text color */
    border-color: var(--border-color); /* Input border color */
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
#globalLogCatchModal .form-control:focus,
#globalLogCatchModal .form-select:focus {
    background-color: var(--card-bg); /* Maintain background on focus */
    color: var(--text-color);
    border-color: var(--link-color); /* Highlight border on focus */
    box-shadow: 0 0 0 0.25rem rgba(var(--link-color-rgb), 0.25); /* Adjusted for variable */
}


#globalLogCatchModal #globalModalMediaPreviewContainer {
    background-color: var(--modal-preview-bg);
    border: 1px dashed var(--modal-preview-border);
    padding: 0.75rem;
    border-radius: 0.375rem;
    min-height: 100px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
#globalLogCatchModal .media-preview-item {
    border: 1px solid var(--border-color); /* Use general border color */
    border-radius: 0.25rem;
    overflow: hidden;
    background-color: var(--modal-preview-bg); /* Use preview bg for items */
    transition: border-color 0.3s ease, background-color 0.3s ease;
}
#globalLogCatchModal .media-preview-item img,
#globalLogCatchModal .media-preview-item video {
    background-color: var(--modal-preview-bg); /* Ensure media background adapts */
    transition: background-color 0.3s ease;
}
#globalLogCatchModal .modal-footer {
    background-color: var(--modal-footer-bg);
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    border-bottom-left-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
#globalLogCatchModal #globalModalSubmitCatchBtn {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
    color: var(--white);
}
#globalLogCatchModal #globalModalSubmitCatchBtn:hover,
#globalLogCatchModal #globalModalSubmitCatchBtn:focus {
    background-color: var(--link-hover-color);
    border-color: var(--link-hover-color);
}
#globalLogCatchModal .alert {
    font-size: 0.9rem;
    color: var(--alert-info-color); /* Default to info color, overridden by specific alerts */
    background-color: var(--alert-info-bg);
    border-color: var(--alert-info-color);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
/* Specific alert styles */
.alert-success {
    color: var(--alert-success-color) !important;
    background-color: var(--alert-success-bg) !important;
    border-color: var(--alert-success-color) !important;
}
.alert-warning {
    color: var(--alert-warning-color) !important;
    background-color: var(--alert-warning-bg) !important;
    border-color: var(--alert-warning-color) !important;
}
.alert-danger {
    color: var(--alert-danger-color) !important;
    background-color: var(--alert-danger-bg) !important;
    border-color: var(--alert-danger-color) !important;
}
.text-muted {
    color: var(--muted-text-color) !important;
    transition: color 0.3s ease;
}


/* Letter spacing utilities from README */
.letter-spacing-sm { letter-spacing: 0.02em; }
.letter-spacing-md { letter-spacing: 0.05em; }

/* Utility Classes (Optional Additions) */
.shadow-soft {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.text-primary-blue {
    color: var(--primary-blue) !important;
}
.text-dark-blue {
    color: var(--dark-blue) !important;
}
.bg-light-gray {
    background-color: var(--light-gray) !important;
}