/* UI Fixes for Leftover Labs */

/* Ensure dropdown items are left-aligned, especially when they have the btn class */
.dropdown-item,
.dropdown-item.btn,
.dropdown-item.btn-outline-leafy-green {
    text-align: left !important;
    justify-content: flex-start !important;
}

/* 0. Add spacing between icons and text, but only when followed by text */
/* Apply margin to icons inside buttons, links, and other elements that typically contain text */
button i.fas:not(:only-child),
button i.far:not(:only-child),
button i.fab:not(:only-child),
button i.bi:not(:only-child),
a i.fas:not(:only-child),
a i.far:not(:only-child),
a i.fab:not(:only-child),
a i.bi:not(:only-child),
span i.fas:not(:only-child),
span i.far:not(:only-child),
span i.fab:not(:only-child),
span i.bi:not(:only-child),
label i.fas:not(:only-child),
label i.far:not(:only-child),
label i.fab:not(:only-child),
label i.bi:not(:only-child),
h1 i.fas:not(:only-child),
h2 i.fas:not(:only-child),
h3 i.fas:not(:only-child),
h4 i.fas:not(:only-child),
h5 i.fas:not(:only-child),
h6 i.fas:not(:only-child),
h1 i.bi:not(:only-child),
h2 i.bi:not(:only-child),
h3 i.bi:not(:only-child),
h4 i.bi:not(:only-child),
h5 i.bi:not(:only-child),
h6 i.bi:not(:only-child),
th i.fas:not(:only-child) {
    margin-right: 0.5rem;
}

/* Remove margin from icons when the adjacent span is hidden */
button i.fas:not(:only-child) + .d-none,
button i.far:not(:only-child) + .d-none,
button i.fab:not(:only-child) + .d-none,
button i.bi:not(:only-child) + .d-none,
a i.fas:not(:only-child) + .d-none,
a i.far:not(:only-child) + .d-none,
a i.fab:not(:only-child) + .d-none,
a i.bi:not(:only-child) + .d-none {
    margin-left: 0;
}

/* Fix for icons in buttons on small screens when text is hidden */
@media (max-width: 576px) {
    button i.fas:not(:only-child),
    button i.far:not(:only-child),
    button i.fab:not(:only-child),
    button i.bi:not(:only-child),
    a i.fas:not(:only-child),
    a i.far:not(:only-child),
    a i.fab:not(:only-child),
    a i.bi:not(:only-child) {
        margin-right: 0;
    }
}

/* 1. Make footer stick to the bottom */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.page-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.page-body {
    flex: 1;
}

/* 2. Footer styling - remove gradient and use appropriate colors */
.footer {
    background: var(--card-bg, #ffffff) !important; /* Use card background color instead of gradient */
    border-top: 1px solid var(--border-color, #c9d6c2);
    color: var(--text-color, #2c3e50);
    margin-top: auto;
}

.footer-text {
    color: var(--text-color, #2c3e50) !important; /* Use main text color */
}

/* 3. Fix contrast issues with badges and add spacing when badges have text before them */
/* Add left margin to badges when they are not the first child (have something before them) */
.badge:not(:first-child) {
    margin-left: 0.5rem;
}

.badge-leafy-green {
    color: var(--btn-text, #ffffff);
    background-color: var(--primary-color, #4d7c5f);
}

.badge-leafy-green[href]:hover, .badge-leafy-green[href]:focus {
    color: var(--btn-text, #ffffff);
    background-color: var(--link-hover-color, #1e4d33);
}

/* 4. Replace blue color references with theme-appropriate colors */
a:visited:not(.btn) {
    color: var(--link-color, #2c6e49) !important; /* Use link color instead of blue */
}

.select2-dropdown--below {
    border-color: var(--primary-color, #4d7c5f) !important;
    box-shadow: 0 0 0 0.25rem rgba(77, 124, 95, 0.25) !important;
}

/* 5. Fix the line underneath the nav */
.navbar {
    border-bottom: none !important;
    box-shadow: none !important;
}

.navbar-shrink {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
    border-bottom: none !important;
    background-color: var(--navbar-bg, #ffffff) !important;
}

/* 6. Improve nav responsiveness on smaller devices */
@media (max-width: 767px) {
    .navbar-nav {
        margin-top: 1rem;
        width: 100%;
    }

    .navbar-nav .nav-item {
        margin-bottom: 0.5rem;
        width: 100%;
    }

    .navbar-nav .btn-group {
        width: 100%;
        display: flex;
    }

    .navbar-nav .btn {
        flex: 1;
    }

    .ms-auto.d-flex {
        flex-direction: column;
        width: 100%;
    }

    .navbar-nav.me-5 {
        margin-right: 0 !important;
    }

    .nav-item.me-3, .nav-item.me-5 {
        margin-right: 0 !important;
        margin-bottom: 0.5rem;
    }
}

/* Additional contrast fixes for card titles */
.card-title, .blog-card-caption {
    color: var(--text-color, #2c3e50) !important;
}

/* Task button group styling */
.task-btn-group {
    display: flex;
    gap: 5px;
    align-items: center;
}

.task-btn-group .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 31px;
    width: auto;
    padding: 0.25rem 0.5rem;
}

.task-btn-group form {
    margin-bottom: 0;
}

@media (max-width: 767px) {
    .task-btn-group {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
    }

    .task-btn-group form {
        display: inline-block;
    }
}

/* Task header styling */
.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.task-header .task-title {
    flex-grow: 1;
    margin-right: 1rem;
    margin-bottom: 0;
}

@media (max-width: 767px) {
    .task-header {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .task-header .task-title {
        margin-right: auto;
        margin-bottom: 0;
        width: 100%;
        order: 2; /* Title second */
    }

    .task-btn-group {
        order: 1; /* Buttons first */
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
        justify-content: flex-end;
        margin-left: auto;
    }

    .task-btn-group form {
        display: inline-block;
    }
}


[data-theme="dark"] .card-title,
[data-theme="dark"] .blog-card-caption {
    color: var(--text-color, #f5f7f4) !important;
}

.navbar-collapse {
    z-index: 9;
}

.navbar-collapse.collapse.show, .navbar-collapse.collapsing {
    background: rgb(255, 255, 255);
    border: 1px solid black;
    padding: 2em;
}

[data-theme="dark"] .navbar-collapse {
    z-index: 9;
}

[data-theme="dark"] .navbar-collapse.collapse.show, [data-theme="dark"] .navbar-collapse.collapsing {
    background: #1a2721;
    border: 1px solid #ffffff54;
    padding: 2em;
}

.btn.show {
    color: white;
    background-color: #3c605b;
    box-shadow: 0 0 0 0.2rem rgba(60, 96, 91, 0.5);
    border-color: #3c605b;
}

/* Additional styling for dropdowns in collapsed navbar on small screens */
@media (max-width: 767px) {
    /* Ensure dropdown items are properly styled */
    .dropdown-item {
        padding-left: 1rem !important;
        white-space: normal !important; /* Allow text to wrap */
    }
    
    /* Styling for dropdowns in collapsed navbar */
    .navbar-collapse .dropdown-menu {
        box-shadow: none !important;
        border: none !important;
        background-color: transparent !important;
    }
}

