.filters-sidebar {
    padding: 15px;
    height: fit-content;
    position: sticky;
    top: 20px;
    border-right: 1px solid #dee2e6;
}

.filter-header {
    border-bottom: 2px solid #28a745;
    padding-bottom: 6px;
    margin-bottom: 10px;
}

.filter-title {
    color: #495057;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.filter-section {
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 15px;
}

.filter-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* Location Tree Styles */
.location-tree, .category-tree {
    /* Removed max-height and overflow to eliminate separate scrolling */
}

/* Mobile-first responsive design */
@media (max-width: 767.98px) {
    .ad-item .row {
        display: flex !important;
        flex-wrap: nowrap !important;
        align-items: stretch !important;
        margin: 0 !important;
    }
    
    .ad-item .col-md-3,
    .ad-item .col-md-6 {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    .ad-item .col-md-3:first-child {
        flex: 0 0 120px !important;
        width: 120px !important;
        max-width: 120px !important;
        margin-right: 15px !important;
    }
    
    .ad-item .col-md-6 {
        flex: 1 !important;
        width: auto !important;
        min-width: 0 !important;
        margin-right: 10px !important;
    }
    
    .ad-item .col-md-3:last-child {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 60px !important;
    }
}

.location-item, .category-item {
    margin-bottom: 4px;
}

.location-main, .category-main {
    padding: 5px 8px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.location-main:hover, .category-main:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.location-sub, .category-sub {
    margin-top: 3px;
    padding-left: 15px;
}

.location-sub-item, .category-sub-item {
    padding: 3px 6px;
    margin: 1px 0;
    border-left: 2px solid #e9ecef;
    font-size: 0.85rem;
}

.location-sub-item:hover, .category-sub-item:hover {
    border-left-color: #28a745;
    background: #f8f9fa;
}

.toggle-icon {
    transition: transform 0.2s ease;
    font-size: 0.8rem;
}

.toggle-icon.rotated {
    transform: rotate(180deg);
}

.search-bar .form-control-lg {
    border: 2px solid #dee2e6;
    border-radius: 25px;
    padding: 12px 20px;
}

.btn {
    box-shadow: none !important;
    border-radius: 6px;
}

.btn:focus, .btn:active {
    box-shadow: none !important;
}

.ad-item {
    transition: all 0.2s ease;
    background: #fff;
}

.ad-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.featured-badge {
    z-index: 10;
}

.image-count-badge {
    position: absolute;
    bottom: 5px;
    right: 5px;
}

.ad-title a:hover {
    color: #007bff !important;
}

.member-badge {
    line-height: 1;
}

.active-filters .badge {
    font-size: 0.8rem;
    padding: 6px 10px;
}

.active-filters .badge a {
    text-decoration: none;
    font-weight: bold;
}

.active-filters .badge a:hover {
    opacity: 0.8;
}

/* Mobile Styles */
.mobile-header {
    padding: 15px;
    background: #50C878;
    margin: -15px -15px 20px -15px;
}

.mobile-search {
    position: relative;
}

.mobile-search-input {
    background: white;
    border: none;
    border-radius: 25px;
    padding: 12px 50px 12px 20px;
    font-size: 16px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.mobile-search-input:focus {
    outline: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.mobile-search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: #FFD700;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
}

.mobile-filters {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.mobile-filter-btn {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 14px;
    color: #333;
    flex: 1;
    text-align: center;
    transition: all 0.2s ease;
}

.mobile-filter-btn:hover {
    background: #f8f9fa;
    border-color: #28a745;
}

.mobile-filter-btn:last-child {
    flex: 0 0 auto;
    width: 50px;
    padding: 10px;
}

.mobile-title-section {
    padding: 0 15px;
}

/* Modal improvements */
.modal-body .location-tree,
.modal-body .category-tree {
    max-height: 400px;
    overflow-y: auto;
}

/* Container adjustments for better layout */
.container-fluid {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 15px;
}

@media (max-width: 768px) {
    .container-fluid {
        padding: 0;
    }
    
    .ad-item {
        margin: 0px;
        border-radius: 10px;
        padding: 15px !important;
    }
    
    /* Mobile layout: image left, content right */
    .ad-item .row {
        display: flex !important;
        align-items: stretch !important;
        margin: 0 !important;
    }
    
    .ad-item .col-md-3:first-child {
        flex: 0 0 120px !important;
        width: 120px !important;
        max-width: 120px !important;
        padding-right: 15px !important;
        padding-left: 0 !important;
    }
    
    .ad-item .col-md-6 {
        flex: 1 !important;
        width: auto !important;
        padding: 0 !important;
        min-width: 0 !important;
    }
    
    .ad-item .col-md-3:last-child {
        flex: 0 0 auto !important;
        width: auto !important;
        text-align: right !important;
        padding-left: 10px !important;
        padding-right: 0 !important;
    }
    
    /* Mobile image styling */
    .ad-item img {
        height: 100px !important;
        width: 100% !important;
        border-radius: 8px;
        object-fit: cover;
    }
    
    .ad-item .bg-light {
        height: 100px !important;
        width: 100% !important;
        border-radius: 8px;
    }
    
    /* Mobile content styling */
    .ad-item .ad-content {
        padding: 0;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        height: 100%;
    }
    
    .ad-item .ad-title {
        font-size: 0.95rem;
        margin-bottom: 6px;
        line-height: 1.2;
        font-weight: 600;
    }
    
    .ad-item .ad-details,
    .ad-item .ad-location {
        font-size: 0.75rem;
        margin-bottom: 3px;
        line-height: 1.1;
    }
    
    .ad-item .member-badge {
        margin-bottom: 6px;
    }
    
    .ad-item .member-badge .badge {
        font-size: 0.65rem;
        padding: 2px 5px;
    }
    
    /* Mobile price styling */
    .ad-item .ad-price {
        text-align: right !important;
        padding: 0;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        justify-content: flex-start;
        height: 100%;
    }
    
    .ad-item .ad-price h5 {
        font-size: 0.9rem;
        margin-bottom: 3px;
        white-space: nowrap;
        font-weight: 600;
    }
    
    .ad-item .ad-meta {
        font-size: 0.7rem;
        margin-bottom: 6px;
    }
    
    .ad-item .ad-actions {
        position: static;
        margin-top: auto;
    }
    
    .ad-item .ad-actions .btn {
        padding: 4px 6px;
        font-size: 0.8rem;
    }
    
    .pagination {
        margin: 0 15px;
    }
    
    /* Featured badge mobile positioning */
    .featured-badge {
        top: 10px;
        left: 10px;
    }
    
    /* Image count badge mobile positioning */
    .image-count-badge {
        bottom: 5px;
        right: 5px;
    }
}

/* Scrollbar styling for modals only */
.modal-body .location-tree::-webkit-scrollbar,
.modal-body .category-tree::-webkit-scrollbar {
    width: 6px;
}

.modal-body .location-tree::-webkit-scrollbar-track,
.modal-body .category-tree::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.modal-body .location-tree::-webkit-scrollbar-thumb,
.modal-body .category-tree::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.modal-body .location-tree::-webkit-scrollbar-thumb:hover,
.modal-body .category-tree::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Compact form elements */
.form-select-sm {
    font-size: 0.875rem;
}

.filter-section .btn-sm {
    font-size: 0.8rem;
    padding: 4px 8px;
}

/* Search Input with Inside Button */
.search-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-container .form-control {
    padding-right: 50px;
    border-radius: 25px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}

.search-input-container .form-control:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
    outline: none;
}

.search-btn-inside {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: #28a745;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.search-btn-inside:hover {
    background: #218838;
    transform: translateY(-50%) scale(1.05);
    color: white;
}

.search-btn-inside:focus {
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.5);
    outline: none;
}

/* Desktop search specific styles */
.search-btn-desktop {
    width: 45px;
    height: 45px;
}

.desktop-search-input {
    padding-right: 55px;
    font-size: 1.1rem;
    height: 55px;
}

/* Mobile search specific styles */
.mobile-search-input {
    height: 48px;
    font-size: 1rem;
}

/* Responsive adjustments */
@media (max-width: 767.98px) {
    .search-input-container .form-control {
        font-size: 0.9rem;
        height: 45px;
        padding-right: 45px;
    }
    
    .search-btn-inside {
        width: 35px;
        height: 35px;
        right: 5px;
    }
}

@media (max-width: 575.98px) {
    .search-input-container .form-control {
        font-size: 0.85rem;
        height: 42px;
    }
    
    .search-btn-inside {
        width: 32px;
        height: 32px;
    }
}
