/* Hero Banner Styles */
.ngo-list-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.ngo-list-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.ngo-list-hero h1 {
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.ngo-list-hero .lead {
    position: relative;
    z-index: 1;
    opacity: 0.95;
}

.quick-stats {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: flex-end;
}

.stat-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    padding: 0.65rem 1.3rem;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    font-size: 0.95rem;
    font-weight: 500;
    height: 44px;
    min-width: 150px;
}

.stat-pill i {
    font-size: 1.2rem;
    line-height: 1;
    flex-shrink: 0;
}

.stat-pill span {
    white-space: nowrap;
}

/* Featured Section */
.featured-section {
    background: linear-gradient(135deg, #fff8dc 0%, #fffaed 100%);
    padding: 2rem;
    border-radius: 20px;
    border: 2px solid #ffc107;
    box-shadow: 0 10px 30px rgba(255, 193, 7, 0.1);
}

/* Results Header */
.results-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    border-left: 4px solid var(--btn-primary);
}

/* Empty State */
.empty-state {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 20px;
    padding: 3rem 1rem !important;
    border: 2px dashed #dee2e6;
}

.empty-state-icon i {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

/* Bottom CTA */
.bottom-cta {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.bottom-cta .btn {
    border-color: white;
}

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

.bottom-cta .btn-outline-primary,
.bottom-cta .btn-outline-success {
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
}

.bottom-cta .btn-outline-primary:hover,
.bottom-cta .btn-outline-success:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: white;
    color: white;
}

.search-section, .filter-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 10px var(--shadow);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    animation: slideDown 0.3s ease;
}

/* Enhanced search input styling */
.search-section .input-group {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    overflow: hidden;
}

.search-section .input-group-text {
    background: white;
    border: 1px solid #dee2e6;
    border-right: none;
    padding: 0.75rem 1rem;
}

[data-theme="dark"] .search-section .input-group-text {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.search-section .form-control {
    border-left: none;
    border-right: none;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border-top: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
}

[data-theme="dark"] .search-section .form-control {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.search-section .form-control:focus {
    box-shadow: none;
    border-color: var(--btn-primary);
}

.search-section .btn {
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    border: 1px solid var(--btn-primary);
}

.search-section .btn-outline-secondary {
    border-left: 1px solid #dee2e6;
}

[data-theme="dark"] .search-section .btn-outline-secondary {
    border-color: var(--border-color);
}

.search-section .form-control::placeholder,
.filter-section .form-control::placeholder {
    color: #6c757d;
}

[data-theme="dark"] .search-section .form-control::placeholder,
[data-theme="dark"] .filter-section .form-control::placeholder {
    color: var(--text-muted);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn-outline-primary {
    border-width: 1px;
    transition: all 0.2s ease;
}

.btn-outline-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.2);
}

/* Badge positioning */
.position-relative .badge {
    font-size: 0.65rem;
    padding: 0.2rem 0.35rem;
    min-width: 18px;
}

/* Make buttons same height as view toggle */
.btn-outline-primary, .btn-success {
    height: 38px;
    padding: 0.375rem 1rem;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.category-badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.category-badge:hover {
    transform: translateY(-2px);
    text-decoration: none;
}

.category-badge.active {
    background: var(--btn-primary);
    color: white;
    border-color: var(--btn-primary);
}

.ngo-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    animation: fadeInUp 0.5s ease-out;
    animation-fill-mode: both;
}

.ngo-card:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 12px 35px var(--shadow);
    border-color: var(--btn-primary);
}

.col-md-4:nth-child(1) .ngo-card { animation-delay: 0.05s; }
.col-md-4:nth-child(2) .ngo-card { animation-delay: 0.1s; }
.col-md-4:nth-child(3) .ngo-card { animation-delay: 0.15s; }
.col-md-4:nth-child(4) .ngo-card { animation-delay: 0.2s; }
.col-md-4:nth-child(5) .ngo-card { animation-delay: 0.25s; }
.col-md-4:nth-child(6) .ngo-card { animation-delay: 0.3s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ngo-card-image {
    height: 180px;
    overflow: hidden;
    position: relative;
    background: linear-gradient(45deg, #f8f9fa, #e9ecef);
    border-radius: 11px 11px 0 0;
    margin: 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ngo-card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain !important;
    object-position: center !important;
}

/* Override Bootstrap card defaults */
.card.ngo-card {
    border-radius: 12px !important;
}

.card.ngo-card > :first-child {
    border-radius: 11px 11px 0 0 !important;
}

.card.ngo-card > :last-child {
    border-radius: 0 0 11px 11px !important;
}

/* Fix checkbox alignment */
.filter-section .form-check {
    padding-left: 0;
}

.filter-section .form-check-input {
    width: 1.1rem;
    height: 1.1rem;
    margin-right: 0;
    float: none;
    position: static;
}

.filter-section .form-check-input:checked {
    background-color: var(--btn-primary);
    border-color: var(--btn-primary);
}

.filter-section .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.filter-section .form-check-label {
    cursor: pointer;
}

.filter-section .form-check-label:hover {
    color: var(--btn-primary);
}

.ngo-card-content {
    padding: 1.25rem;
}

.list-view .col-md-4 {
    flex: 0 0 100%;
    max-width: 100%;
}

.list-view .ngo-card {
    display: flex;
    height: auto;
}

.list-view .ngo-card-image {
    width: 200px;
    height: 140px;
    flex-shrink: 0;
    border-radius: 11px 0 0 11px;
    margin: 0;
    border-right: 1px solid var(--border-color);
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.list-view .ngo-card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain !important;
    object-position: center !important;
}

.list-view .ngo-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    /* Ensure body and html allow overflow for dropdowns */
    body, html {
        overflow-x: hidden;
        overflow-y: auto;
    }

    /* Hero Section - More Compact */
    .ngo-list-hero {
        padding: 1rem 0 !important;
        margin-bottom: 1.5rem !important;
    }

    .ngo-list-hero h1 {
        font-size: 1.4rem;
        margin-bottom: 0.5rem !important;
    }

    .ngo-list-hero .lead {
        font-size: 0.9rem;
        line-height: 1.4;
    }

    .featured-section {
        padding: 1rem;
    }

    .results-header {
        padding: 0.75rem;
    }

    /* Center quick stats on mobile */
    .ngo-list-hero .col-lg-4 {
        text-align: center !important;
        margin-top: 0.75rem;
    }

    .quick-stats {
        gap: 0.5rem;
        justify-content: center !important;
        flex-wrap: wrap;
    }

    .stat-pill {
        font-size: 0.75rem;
        padding: 0.5rem 0.9rem;
        height: 38px;
        min-width: 120px;
    }

    .stat-pill i {
        font-size: 0.95rem;
    }

    /* Compact discover section */
    .container.my-5 {
        margin-top: 1.5rem !important;
        margin-bottom: 1.5rem !important;
    }

    /* Filter/Button header section */
    .d-flex.justify-content-between.align-items-center.mb-4 {
        margin-bottom: 1rem !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
        overflow: visible !important;
        position: relative;
    }

    /* Hide heading and description on mobile */
    .d-flex.justify-content-between.align-items-center.mb-4 > div:first-child {
        display: none !important;
    }

    .d-flex.justify-content-between.align-items-center.mb-4 > div:last-child {
        width: 100%;
    }

    /* Force list view on mobile for better UX */
    #ngoResults {
        display: block !important;
    }

    #ngoResults .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Compact list view cards for mobile */
    .ngo-card {
        display: flex !important;
        flex-direction: row !important;
        height: auto !important;
        margin-bottom: 0.75rem !important;
    }

    .ngo-card-image {
        width: 90px !important;
        min-width: 90px !important;
        height: 110px !important;
        border-radius: 11px 0 0 11px !important;
        border-right: 1px solid var(--border-color) !important;
        border-bottom: none !important;
    }

    .ngo-card-content {
        flex: 1;
        padding: 0.75rem !important;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    .ngo-card-content h5 {
        font-size: 0.95rem !important;
        margin-bottom: 0.4rem !important;
        line-height: 1.3;
        display: flex;
        align-items: center;
        flex-wrap: wrap;
    }

    .ngo-card-content .badge {
        font-size: 0.65rem !important;
        padding: 0.2rem 0.4rem !important;
        margin: 0.15rem 0.15rem 0.15rem 0;
    }

    .ngo-card-content .mb-2 {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
        align-items: center;
    }

    .ngo-card-content p {
        font-size: 0.8rem !important;
        margin-bottom: 0.35rem !important;
    }

    .ngo-card-content .text-muted.small {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
    }

    /* Hide less important info on mobile */
    .ngo-card-content .text-secondary.small,
    .impact-metrics {
        display: none !important;
    }

    /* Compact bottom info */
    .ngo-card-content .d-flex.justify-content-between {
        font-size: 0.75rem;
        margin-top: 0.5rem !important;
    }

    /* Hide view toggle on mobile (forced list view) */
    .view-toggle {
        display: none !important;
    }

    /* Button container - 3 column layout on mobile */
    .d-flex.gap-2.align-items-center.flex-wrap {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.4rem !important;
        width: 100%;
        position: relative;
        overflow: visible;
    }

    /* All buttons take one column each */
    .d-flex.gap-2.align-items-center.flex-wrap .btn-outline-primary,
    .d-flex.gap-2.align-items-center.flex-wrap .btn-group {
        width: 100%;
        min-width: 0;
    }

    /* Button group maintains position context */
    .d-flex.gap-2.align-items-center.flex-wrap .btn-group {
        position: relative;
        z-index: 1000;
    }

    /* Compact button styling for mobile */
    .btn-outline-primary, .btn-success, .btn-group .btn {
        padding: 0.5rem 0.35rem !important;
        font-size: 0.8rem !important;
        height: 40px !important;
        white-space: nowrap;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-weight: 500;
        border-radius: 6px !important;
        transition: all 0.2s ease;
        line-height: 1.2;
    }

    .btn-outline-primary {
        border-width: 1.5px !important;
    }

    .btn-outline-primary:active,
    .btn-outline-primary:focus {
        transform: scale(0.98);
    }

    .btn-outline-primary i, .btn-success i {
        font-size: 0.95rem;
        line-height: 1;
    }

    /* Show button text on mobile for better clarity */
    .btn .d-none.d-sm-inline,
    .btn-outline-primary .d-none.d-sm-inline,
    .btn-group .btn .d-none.d-sm-inline {
        display: inline !important;
    }

    /* Keep "Near Me" text hidden on mobile (d-none d-md-inline) */
    .btn-success .d-none.d-md-inline {
        display: none !important;
    }

    /* Show icon-only on mobile for Near Me button */
    .btn-success .d-inline.d-md-none {
        display: inline !important;
    }

    /* Icon spacing - more compact */
    .btn i {
        margin-right: 0.25rem;
    }

    /* Button group - dropdown functionality */
    .btn-group {
        display: flex !important;
        position: relative !important;
        border-radius: 6px !important;
        overflow: hidden;
    }

    .btn-group .btn:first-child {
        flex: 1;
        border-top-right-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
        border-radius: 6px 0 0 6px !important;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .btn-group .dropdown-toggle-split {
        flex: 0 0 auto;
        width: 36px;
        min-width: 36px;
        padding-left: 0.3rem !important;
        padding-right: 0.3rem !important;
        border-left: 1px solid rgba(255, 255, 255, 0.3) !important;
        border-top-left-radius: 0 !important;
        border-bottom-left-radius: 0 !important;
        border-radius: 0 6px 6px 0 !important;
        cursor: pointer;
        touch-action: manipulation;
    }

    .btn-group .dropdown-menu {
        position: absolute !important;
        top: 100% !important;
        left: auto !important;
        right: 0 !important;
        min-width: 200px;
        max-width: min(280px, calc(100vw - 2rem));
        width: auto !important;
        z-index: 9999 !important;
        margin-top: 0.25rem !important;
        transform: translateZ(0) !important;
        display: none !important;
    }

    /* Show dropdown when active */
    .btn-group .dropdown-menu.show {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Ensure container allows dropdown to overflow */
    .container {
        overflow: visible !important;
    }

    /* Parent wrapper needs proper stacking context */
    .d-flex.gap-2.align-items-center.flex-wrap {
        position: relative;
        z-index: 10;
    }

    /* Prevent dropdown from going off-screen */
    .btn-group .dropdown-menu.dropdown-menu-end {
        right: 0 !important;
        left: auto !important;
    }

    /* Ensure dropdown is clickable on mobile */
    .btn-group .dropdown-menu {
        pointer-events: auto !important;
    }

    .btn-group.show .dropdown-menu {
        display: block !important;
        visibility: visible !important;
    }

    /* Ensure dropdown items are visible and clickable */
    .btn-group .dropdown-menu .dropdown-item {
        display: block !important;
        padding: 0.5rem 1rem !important;
        cursor: pointer !important;
        touch-action: manipulation !important;
    }

    /* Improved search section on mobile */
    .search-section {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
        border-radius: 10px;
    }

    .search-section .input-group {
        flex-wrap: nowrap;
    }

    .search-section .input-group-text {
        padding: 0.65rem 0.75rem;
    }

    .search-section .form-control {
        font-size: 0.95rem;
        padding: 0.65rem 0.75rem;
    }

    .search-section .btn-primary {
        padding: 0.65rem 1rem !important;
        font-size: 0.9rem;
        white-space: nowrap;
    }

    .search-section .btn-outline-secondary {
        padding: 0.65rem 0.75rem !important;
        min-width: 44px;
    }

    .search-section .btn-outline-secondary i {
        font-size: 0.9rem;
    }

    /* Reduce margins between sections */
    .mb-3, .mb-4 {
        margin-bottom: 0.75rem !important;
    }

    /* Critical: Force dropdown to show on mobile when .show class is present */
    .btn-group.show > .dropdown-menu.show,
    .btn-group.show > .dropdown-menu {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: absolute !important;
        z-index: 99999 !important;
        background: white !important;
        border: 1px solid #dee2e6 !important;
        border-radius: 0.375rem !important;
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.175) !important;
        min-width: 200px !important;
        padding: 0.5rem 0 !important;
    }

    /* Dark theme support for dropdown */
    [data-theme="dark"] .btn-group.show > .dropdown-menu.show,
    [data-theme="dark"] .btn-group.show > .dropdown-menu {
        background: var(--bg-secondary) !important;
        border-color: var(--border-color) !important;
    }
}

@media (max-width: 576px) {
    /* Extra small screens */
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .ngo-list-hero {
        padding: 0.75rem 0 !important;
        margin-bottom: 1rem !important;
    }

    .ngo-list-hero h1 {
        font-size: 1.15rem;
        margin-bottom: 0.4rem !important;
    }

    .ngo-list-hero .lead {
        display: none;
    }

    .ngo-list-hero .row {
        margin: 0 !important;
    }

    .ngo-list-hero .col-lg-8,
    .ngo-list-hero .col-lg-4 {
        padding: 0 !important;
    }

    /* Extra small button adjustments - even more compact */
    .btn-outline-primary, .btn-success, .btn-group .btn {
        padding: 0.45rem 0.3rem !important;
        height: 38px !important;
        font-size: 0.78rem !important;
    }

    .btn-outline-primary i, .btn-success i {
        font-size: 0.9rem;
    }

    /* Dropdown menu proper sizing for small screens */
    .btn-group .dropdown-menu {
        min-width: 200px !important;
        max-width: calc(100vw - 1.5rem) !important;
        width: auto !important;
        display: none !important;
    }

    /* Ensure dropdown shows when active */
    .btn-group .dropdown-menu.show {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: absolute !important;
        z-index: 9999 !important;
    }

    /* Fix dropdown toggle width */
    .btn-group .dropdown-toggle-split {
        width: 34px !important;
        min-width: 34px !important;
    }

    /* Compact search on extra small screens */
    .search-section {
        padding: 0.75rem !important;
    }

    .search-section .form-control {
        font-size: 0.9rem;
        padding: 0.6rem 0.7rem;
    }

    .search-section .input-group-text {
        padding: 0.6rem 0.7rem;
    }

    .search-section .btn-primary {
        padding: 0.6rem 0.85rem !important;
        font-size: 0.85rem;
    }

    .search-section .btn-outline-secondary {
        padding: 0.6rem 0.7rem !important;
        min-width: 42px;
    }

    .search-section, .filter-section {
        padding: 0.75rem;
        border-radius: 8px;
        margin-bottom: 0.75rem !important;
    }

    .search-section {
        margin-bottom: 0.5rem !important;
    }

    .bottom-cta {
        padding: 1.5rem 0.75rem !important;
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }

    .bottom-cta h4 {
        font-size: 1.1rem;
    }

    .bottom-cta p {
        font-size: 0.85rem;
    }

    .bottom-cta .d-flex.justify-content-center {
        flex-direction: column;
        align-items: stretch;
    }

    .bottom-cta .btn {
        margin-bottom: 0.5rem;
        width: 100%;
        justify-content: center;
    }

    .empty-state {
        padding: 1.5rem 0.75rem !important;
    }

    .empty-state .d-flex.justify-content-center {
        flex-direction: column;
        align-items: stretch;
    }

    .empty-state .btn {
        margin-bottom: 0.5rem;
        width: 100%;
        justify-content: center;
    }

    /* Smaller heading - Discover Organizations */
    h2 {
        font-size: 1.1rem !important;
        margin-bottom: 0.25rem !important;
    }

    h2 i {
        font-size: 0.95rem;
    }

    /* Override tablet stats with smaller mobile stats */
    .stat-pill {
        height: 36px !important;
        min-width: 110px !important;
        max-width: 145px;
        font-size: 0.7rem !important;
        padding: 0.4rem 0.75rem !important;
    }

    .stat-pill i {
        font-size: 0.85rem !important;
    }

    .stat-pill span {
        text-align: center;
    }

    /* Smaller card images on very small screens */
    .ngo-card-image {
        width: 75px !important;
        min-width: 75px !important;
        height: 95px !important;
    }

    .ngo-card-content {
        padding: 0.6rem !important;
    }

    .ngo-card-content h5 {
        font-size: 0.9rem !important;
    }

    /* Category filters - reduce gap only */
    .category-filter {
        gap: 0.35rem;
    }

    .category-badge {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }

    /* Pagination - override tablet styles */
    .pagination {
        font-size: 0.85rem;
    }

    .page-item {
        margin: 0.15rem;
    }

    .page-link {
        padding: 0.35rem 0.6rem;
        min-width: 36px;
        text-align: center;
    }

    /* Featured badge */
    .featured-badge {
        font-size: 0.65rem !important;
        padding: 0.25rem 0.5rem !important;
    }


    /* Filter form on mobile */
    .filter-section .row {
        margin-left: 0;
        margin-right: 0;
    }

    .filter-section .row .col-lg-3,
    .filter-section .row .col-md-4,
    .filter-section .row .col-sm-6 {
        margin-bottom: 0.5rem !important;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .filter-section label {
        font-size: 0.85rem;
        margin-bottom: 0.25rem;
        display: block;
    }

    .filter-section .form-select,
    .filter-section .form-control {
        font-size: 0.85rem;
        padding: 0.5rem 0.7rem;
        width: 100%;
    }

    .filter-section .row.mt-3 {
        margin-top: 0.75rem !important;
    }

    .filter-section .row.mt-3 .col-md-6 {
        margin-bottom: 0.5rem;
        text-align: center;
    }

    .filter-section .row.mt-3 .col-md-6.text-end {
        text-align: center !important;
    }

    .filter-section .d-flex.justify-content-end {
        justify-content: center !important;
        flex-wrap: wrap;
    }

    /* Critical: Force dropdown to show on extra small mobile when .show class is present */
    .btn-group.show > .dropdown-menu.show,
    .btn-group.show > .dropdown-menu {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: absolute !important;
        z-index: 99999 !important;
        background: white !important;
        border: 1px solid #dee2e6 !important;
        border-radius: 0.375rem !important;
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.175) !important;
        min-width: 200px !important;
        max-width: calc(100vw - 1.5rem) !important;
        padding: 0.5rem 0 !important;
        right: 0 !important;
        left: auto !important;
    }

    /* Ensure dropdown items are visible and styled */
    .btn-group .dropdown-menu .dropdown-item {
        display: block !important;
        padding: 0.5rem 1rem !important;
        color: #212529 !important;
        white-space: nowrap !important;
    }

    .btn-group .dropdown-menu .dropdown-item:hover {
        background-color: #f8f9fa !important;
    }

    /* Dark theme support for dropdown */
    [data-theme="dark"] .btn-group.show > .dropdown-menu.show,
    [data-theme="dark"] .btn-group.show > .dropdown-menu {
        background: var(--bg-secondary) !important;
        border-color: var(--border-color) !important;
    }

    [data-theme="dark"] .btn-group .dropdown-menu .dropdown-item {
        color: var(--text-primary) !important;
    }

    [data-theme="dark"] .btn-group .dropdown-menu .dropdown-item:hover {
        background-color: var(--bg-tertiary) !important;
    }
}

/* Connected button group styling */
.btn-group > .btn-success.dropdown-toggle-split {
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}
