/* Container width reset 
 * Replicate BS4 width behaviour so we don't freak everyone out
 */
@media (min-width: 1200px) { .container { max-width: 1140px; } }
@media (min-width: 1400px) { .container { max-width: 1140px; } }

/* Fix full-width buttons in forms if needed */
.d-grid-form .btn { width: 100%; margin-bottom: 0.5rem; }



/* Restore the old form-group spacing */
.form-group, .mb-3 {
    margin-bottom: 1.5rem !important;
}

/* Add padding back to containers if they feel too tight to the screen edge */
.container {
    padding-right: 15px;
    padding-left: 15px;
}

/* Ensure Rows have vertical spacing (BS5 rows often need 'gy' for vertical gutters) */
.row {
    --bs-gutter-y: 0.8rem; /* Adds vertical spacing between columns that wrap */
}

/* Fix legacy Labels (BS5 labels need specific margin) */
label {
    display: inline-block;
    margin-bottom: 0.5rem;
    font-weight: 400;
}

h3 {
    margin-top: 0.5rem;
}

/* .card {
    margin-right: 1em;
} */

.alert {
    margin-top: 0.5em;
    padding: 0.5rem 1rem; /* Top/Bottom 8px, Left/Right 16px */
    margin-bottom: 1rem;
    font-size: 0.9rem;    /* Optional: slightly smaller text looks better in tight alerts */
}

/* If you have buttons inside your alertbar (like your 'float-end' buttons) */
.alert .btn-sm {
    padding: 0.1rem 0.5rem;
    margin-top: -2px;     /* Nudge it up if it looks off-center in a thinner alert */
}

/* Ensure table buttons have a consistent footprint */
.btn-fixed-width-125 {
    width: 125px;
    text-align: center;
    white-space: nowrap;
}
.btn-fixed-width-80 {
    width: 80px;
    text-align: center;
    white-space: nowrap;
}

/* Tighten the actual input height */
.form-control-sm, .form-select-sm {
    font-size: 0.75rem !important;
    padding-top: 0.15rem;
    padding-bottom: 0.15rem;
    /*min-height: calc(1.5em + 0.5rem + 2px); /* Specifically targets Bootstrap 5 heights */
    height: 31px;
}

/* Remove default card body padding that wastes vertical space */
.card-body.bg-light {
    padding-top: 0.5rem !important;
    padding-bottom: 0.70rem !important;
}

/* Ensure labels aren't pushing too far up */
.form-label {
    margin-bottom: 2px !important;
}

/* If you want the text the user types to be even tighter */
input.form-control-sm::placeholder {
    font-size: 0.70rem;
}

/* Specific fix for dropdown text/arrow alignment */
.form-select-sm {
    background-position: right 0.5rem center;
    background-size: 10px 10px;
}

/* Target the elements directly for maximum priority */
form select.form-select-sm, 
form input.form-control-sm {
    font-size: 0.85rem !important; /* Slightly smaller to see the change */
    height: 31px !important;       /* Standard height for btn-sm */
    line-height: 1 !important;
    padding-top: 2px !important;
    padding-bottom: 2px !important;
}

/* Ensure the dropdown options also inherit the smaller font */
form select.form-select-sm option {
    font-size: 0.85rem;
}

/* 
 * HTMX related stuff 
 */

/* The base state: standard border with a transition ready */
.form-control-sm.text-center {
    border: 1px solid #ced4da; /* Standard Bootstrap border */
    transition: box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out;
}

/* The flash state: no extra border width, just a glow */
.border-flash-success {
    /*border-color: #198754 !important; /* Turn the border green */
    box-shadow: 0 0 0 0.25rem rgba(11, 156, 30, 0.25); /* Bootstrap success glow */
}

.htmx-indicator {
    display:none;
}
.htmx-request .htmx-indicator {
    display: inline-flex !important;
    align-items: center;
}
/* Expenses specific kill - global will probably need to change */
#spinner, .loading-spinner, #indicator {
    display: none !important;
}
/* Explicitly handle the timesheet indicator regardless of above global rule */
.htmx-request#ts-indicator, 
.htmx-request #ts-indicator {
    display: inline-flex !important;
    align-items: center;
} 
.transition-opacity {
    transition: opacity 0.4s ease-in-out;
}

/* Timesheet hours change - showing pending state*/
input[name="hours"].htmx-request {
    background-color: #db923e; 
    transition: background-color 0.3s ease;
}



/* Match the input width to your Task button (80px) */
.input-fixed-width-80 {
    width: 90px !important;
    height: 31px;
    text-align: center;
}

/* Force both navbars to be compact */
.navbar {
    padding-top: 0.25rem !important;
    padding-bottom: 0.25rem !important;
}

/* Specifically slim the sub-nav links */
.navbar-light .nav-link {
    padding-top: 0.3rem !important;
    padding-bottom: 0.3rem !important;
    font-size: 0.85rem;
}

/* Ensure the Search dropdown floats ABOVE the page content */
#search-results {
    z-index: 2050 !important;
}

/* Remove any default margins that might be pushing the navbars apart */
nav.navbar.static-top {
    margin-bottom: 0 !important;
}

/*
 * Global search bar 
 */
.navbar.static-top {
    margin-bottom: 0 !important;
}

#search-results {
    top: 100%;
    left: 0;
    z-index: 2000;
    max-height: 450px;
    overflow-y: auto;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15) !important;
    display: none; /* Hidden by default */
    margin-top: 0;
}

/* Show only when it has content */
#search-results:not(:empty) {
    display: block;
}

/* Prevent layout shift */
.search-wrapper {
    width: 100%;
    margin: 0;
    padding: 4px 0;
}
.search-wrapper .input-group {
    margin-bottom: 0 !important;
}
#global-search-input {
    background-color: #f8f9fa; /* Very subtle light grey */
    border: 1px solid #dee2e6;
}

#global-search-input:focus {
    background-color: #fff;
    box-shadow: none;
}

#search-results .list-group-item:hover {
    background-color: #f8f9fa;
    border-left: 4px solid #007bff; /* Subtle highlight on hover */
    padding-left: 12px;
    transition: all 0.15s ease-in-out;
}

/* Remove default focus from the input */
.input-group-lg .form-control:focus {
    box-shadow: none;
    border-color: #dee2e6; /* Match the rest of the borders */
}

/* Apply focus look to the whole group when the input is active */
.input-group-lg:focus-within {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25); /* Standard Bootstrap focus blue */
    border-radius: 0.5rem; /* Match the rounded corners */
    transition: box-shadow 0.15s ease-in-out;
}

/* Ensure the left span stays white and looks like part of the input */
.input-group-text {
    background-color: #fff !important;
}

/* Fix the 'cut off' look on the left side */
.input-group-lg:focus-within .input-group-text,
.input-group-lg:focus-within .form-control {
    border-color: #86b7fe; /* The blue border color */
}


/*
 * django-tables2 setup
 */
/* Tighten all data tables */
.table {
    font-size: 0.85rem; /* Slightly smaller than default 1rem */
}

/* Make headers distinct but compact */
.table thead th {
    font-size: 0.85rem;
    /* text-transform: uppercase; */
    letter-spacing: 0.03rem;
    font-weight: 700;
    color: #495057;
    background-color: #f8f9fa;
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    border-bottom: 2px solid #dee2e6;
}

/* Reduce vertical padding in cells */
.table td {
    padding-top: 0.4rem !important;
    padding-bottom: 0.4rem !important;
    vertical-align: middle;
}

/* Ensure our custom buttons and inputs inside tables stay aligned */
.table .btn-sm, 
.table .form-control-sm {
    font-size: 0.75rem !important;
    height: 28px !important; /* Slightly shorter than standard */
    padding: 0 0.5rem !important;
}
/* Fix vertical alignment for buttons inside tables */
.table .btn-sm {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important; /* Prevents text from pushing down */
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Ensure the 'Tasks' and 'Invoiced' buttons look uniform */
.btn-fixed-width-80, .btn-fixed-width-125 {
    height: 28px !important;
}


/* Custom scrollable dropdown menu */
.dropdown-menu-scrollable {
    max-height: 250px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Optional: Make the scrollbar look a bit sleeker */
.dropdown-menu-scrollable::-webkit-scrollbar {
    width: 6px;
}
.dropdown-menu-scrollable::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 10px;
}