/* --- Header Flex Fix --- */
#page-header {
    display: flex;
    flex-wrap: nowrap; /* Default (desktop) */
}

@media (max-width: 767.98px) {
    #page-header {
        flex-wrap: wrap !important; /* Mobile */
    }
}
/* --- End Header Flex Fix --- */


/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    padding: 48px 0 0;
    width: 230px;
    /* --- DESKTOP DEFAULT: VISIBLE --- */
    margin-left: 0;
    transition: margin-left 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
    background-color: #212529;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, .1);
}

/* --- Main Content --- */
main#main-content {
    /* --- DESKTOP DEFAULT: PUSHED --- */
    margin-left: 230px;
    padding-top: 48px;
    padding-bottom: 1.5rem;
    transition: margin-left 0.2s ease-in-out;
}

/* --- Footer --- */
.footer {
    /* --- DESKTOP DEFAULT: PUSHED --- */
    margin-left: 230px;
    text-align: right;
    font-size: 0.875em;
    transition: margin-left 0.2s ease-in-out;
}
[data-bs-theme="light"] .footer {
    background-color: #f8f9fa;
    color: #6c757d;
    border-top: 1px solid #dee2e6;
}
[data-bs-theme="dark"] .footer {
    background-color: var(--bs-dark-bg-subtle);
    color: var(--bs-tertiary-color);
    border-top: 1px solid var(--bs-border-color-translucent);
}


/* --- This is the scrolling part --- */
.sidebar .position-sticky {
    position: relative;
    top: 0;
    flex-grow: 1; /* This makes it fill the space */
    padding-top: .5rem;
    overflow-x: hidden;
    overflow-y: auto;
    padding-bottom: 1rem;
}

/* Navbar */
.navbar {
    z-index: 1030;
}
.navbar-brand {
    padding-top: .75rem;
    padding-bottom: .75rem;
    font-size: 1rem;
    background-color: rgba(0, 0, 0, .25);
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, .25);
    width: 230px;
    transition: width 0.2s ease-in-out;
}
@media (max-width: 767.98px) {
    .navbar-brand {
        width: auto;
    }
}

/* --- Brand Color Overrides --- */
.btn-primary {
    background-color: #a92244;
    border-color: #a92244;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: #8a1c37;
    border-color: #8a1c37;
}
.btn-primary:focus {
    box-shadow: 0 0 0 0.25rem rgba(169, 34, 68, 0.5);
}
.bg-primary {
     background-color: #a92244 !important;
     border-color: #a92244 !important;
}
/* --- End Brand Color Overrides --- */

/* --- Login Icon Styles --- */
.form-floating-icon {
    position: relative;
}
.form-floating-icon .bi {
    position: absolute;
    top: 50%;
    left: 1rem;
    transform: translateY(-50%);
    z-index: 10;
    color: var(--bs-secondary-color);
}
.form-floating-icon .form-control {
    padding-left: 3rem;
}
.form-floating-icon .form-floating > label {
    padding-left: 3rem;
}
.form-floating-icon .form-control:focus + label + .bi {
    color: #a92244;
}

/* --- Dark Theme for Sidebar --- */
.sidebar .nav-link {
    font-weight: 500;
    color: rgba(255, 255, 255, .65);
}
.sidebar .nav-link .bi {
    color: rgba(255, 255, 255, .5);
}
.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: #fff;
}
.sidebar .nav-link.active .bi {
	color: #fff;
}
.sidebar-heading {
    color: rgba(255, 255, 255, .4);
}
[data-bs-theme="dark"] .sidebar {
    background-color: var(--bs-dark-bg-subtle);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, .1);
}


/* --- STATE: Sidebar COLLAPSED (HIDDEN) --- */
body.sidebar-collapsed .sidebar {
    margin-left: -230px;
}
body.sidebar-collapsed main#main-content {
    margin-left: 0;
}
body.sidebar-collapsed .footer {
    margin-left: 0;
}
body.sidebar-collapsed .navbar-brand {
    width: 0;
    padding-left: 0;
    padding-right: 0;
    overflow: hidden;
}

/* --- Toggle Button Rotation --- */
#sidebarToggle {
    transition: transform 0.2s ease-in-out;
}
body.sidebar-collapsed #sidebarToggle {
    transform: rotate(180deg);
}


/* --- MOBILE STYLES (max-width: 767.98px) --- */
@media (max-width: 767.98px) {
    .sidebar {
        /* --- UPDATED: Taller mobile header height --- */
        top: 110px;
        width: 100%;
        padding-top: 0;
        /* --- MOBILE OPEN STATE --- */
        margin-left: 0;
    }

    main#main-content {
        margin-left: 0; /* Always full-width on mobile */
        /* --- UPDATED: Taller mobile header height --- */
        padding-top: 110px;
    }

    .footer {
        margin-left: 0; /* Always full-width on mobile */
    }

    /* --- STATE: Sidebar COLLAPSED (on mobile) --- */
    body.sidebar-collapsed .sidebar {
        margin-left: -100%; /* Slide off-screen */
    }

    /* These rules are just to be safe */
    body.sidebar-collapsed main#main-content {
        margin-left: 0;
    }
    body.sidebar-collapsed .footer {
        margin-left: 0;
    }
}

/* --- Dashboard Dark Mode Card Styles --- */
[data-bs-theme="dark"] .card {
    background-color: var(--bs-dark-bg-subtle);
    border-color: var(--bs-border-color-translucent);
}
[data-bs-theme="dark"] .list-group-item {
    background-color: var(--bs-dark-bg-subtle);
}
[data-bs-theme="dark"] .card-header {
    border-color: var(--bs-border-color-translucent);
}

/* --- Print Styles --- */
@media print {
    body {
        background-color: #fff !important;
    }
    #sidebarMenu, #page-header, #page-footer, .btn-toolbar, #incidentTab, .footer {
        display: none !important;
    }
    main, #main-content {
        width: 100% !important;
        margin-left: 0 !important;
        padding-top: 0 !important;
    }
    [data-bs-theme="dark"] body, [data-bs-theme="dark"] .card, [data-bs-theme="dark"] .badge {
        color: #000 !important;
        background-color: #fff !important;
    }
    .card {
        border: none !important;
        box-shadow: none !importanT;
    }
    .badge {
        border: 1px solid #ccc;
    }
    .tab-pane {
        display: block !important;
        opacity: 1 !important;
    }
}

/* --- Style for active theme in dropdown --- */
.dropdown-item[data-bs-theme-value].active {
    font-weight: bold;
    color: var(--bs-dropdown-link-active-color);
    background-color: var(--bs-dropdown-link-active-bg);
}

/* --- Fix for Dropdown Menu Theme --- */
[data-bs-theme="light"] .navbar .dropdown-menu {
    --bs-dropdown-bg: var(--bs-body-bg);
    --bs-dropdown-link-color: var(--bs-body-color);
    --bs-dropdown-link-hover-color: var(--bs-body-color);
    --bs-dropdown-link-hover-bg: var(--bs-tertiary-bg);
    --bs-dropdown-link-active-color: #fff;
    --bs-dropdown-link-active-bg: #a92244;
    --bs-dropdown-header-color: #a92244;
    --bs-dropdown-border-color: var(--bs-border-color-translucent);
}
[data-bs-theme="dark"] .navbar .dropdown-menu {
    --bs-dropdown-bg: var(--bs-dark-bg-subtle);
    --bs-dropdown-border-color: var(--bs-border-color-translucent);
    --bs-dropdown-link-active-bg: #a92244;
    --bs-dropdown-header-color: #a92244;
}

/* --- Search Bar: Default (Dark Mode) --- */
/* This keeps the "Dark Mode" look you liked */
.form-control-dark {
    background-color: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .2);
    color: #fff;
}
.form-control-dark:focus {
    background-color: rgba(255, 255, 255, .2);
    border-color: rgba(255, 255, 255, .5);
    color: #fff;
    box-shadow: none;
}
.form-control-dark::placeholder {
    color: rgba(255, 255, 255, .5);
}

/* --- Search Bar: Light Mode Override --- */
/* This forces the box to be White ONLY when in Light Mode */
[data-bs-theme="light"] .form-control-dark {
    background-color: #ffffff;
    border: 1px solid #ced4da;
    color: #212529; /* Dark text */
}

[data-bs-theme="light"] .form-control-dark:focus {
    background-color: #ffffff;
    border-color: #a92244; /* Brand Red Border */
    color: #212529;
    box-shadow: 0 0 0 0.25rem rgba(169, 34, 68, 0.25); /* Red Glow */
}

[data-bs-theme="light"] .form-control-dark::placeholder {
    color: #6c757d; /* Standard Grey Placeholder */
    opacity: 1;
}

/* --- Notification Bell --- */
.notification-dropdown .nav-link {
    font-size: 1.1rem;
}
.notification-dropdown .dropdown-menu {
    min-width: 280px;
    max-width: 300px;
}
.notification-dropdown .dropdown-item {
    white-space: normal;
    font-size: 0.9rem;
}

/* --- UPDATED: Footer Link Style --- */
.footer .footer-link {
    color: inherit;
    text-decoration: none;
    font-weight: 500;
}
.footer .footer-link:hover {
    color: inherit;
    text-decoration: underline;
}

/* --- Fix for "New Report" button wrapping --- */
#new-report-btn {
    white-space: nowrap;
}