/**
 * Immobilier - Sites Satellites
 * Styles personnalisés avec Bootstrap 5
 */

/* ===========================================
   Variables CSS
   =========================================== */
:root {
    --primary-color: #0d6efd;
    --primary-dark: #0a58ca;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --orange-color: #e67e22;
    --orange-dark: #d35400;
    --light-bg: #f8f9fa;
    --dark-bg: #2c3e50;
    --darker-bg: #1a252f;
    --border-color: #dee2e6;
    --text-muted: #6c757d;
    --shadow-sm: 0 .125rem .25rem rgba(0,0,0,.075);
    --shadow: 0 .5rem 1rem rgba(0,0,0,.15);
    --transition: all 0.3s ease;
}

/* ===========================================
   Base Styles
   =========================================== */
body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--light-bg);
    color: #333;
}

a {
    color: var(--primary-color);
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* ===========================================
   Top Bar & Header (cohérent avec homepage)
   =========================================== */
.top-bar {
    background: #1e293b;
    font-size: 0.85rem;
}

.top-bar .language-switcher {
    display: flex;
    gap: 0.5rem;
}

.top-bar .language-link {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.top-bar .language-link:hover,
.top-bar .language-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.top-bar .top-header-links a {
    text-decoration: none;
    transition: color 0.2s ease;
}

.top-bar .top-header-links a:hover {
    color: white !important;
}

.site-header {
    background: #1e293b;
    z-index: 1050;
    position: relative;
}

.site-header .navbar {
    background: transparent !important;
}

.site-header .logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.site-header .logo-main {
    font-weight: 700;
    font-size: 1.3rem;
    color: white;
    letter-spacing: -0.5px;
}

.site-header .logo-sub {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 6px;
}

.site-header .logo-immobilier {
    height: 22px !important;
    width: auto !important;
    max-width: 150px !important;
    vertical-align: middle;
    object-fit: contain;
}

.site-header .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
}

.site-header .nav-link:hover,
.site-header .nav-link.active {
    color: white !important;
}

/* ===========================================
   Header & Navigation (legacy)
   =========================================== */
.navbar {
    padding: 0.75rem 0;
}

.navbar-brand .logo-text {
    font-size: 1.4rem;
    letter-spacing: -0.5px;
}

.nav-link {
    padding: 0.75rem 1rem !important;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color) !important;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: var(--transition);
    transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 80%;
}

/* ===========================================
   Hero Section
   =========================================== */
.hero-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-left: 4px solid var(--primary-color);
}

.hero-section .lead {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #495057;
}

/* ===========================================
   Tabs (Onglets)
   =========================================== */
.nav-tabs {
    border-bottom: none;
}

.nav-tabs .nav-link {
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    color: var(--secondary-color);
    font-weight: 500;
    padding: 0.75rem 1.25rem !important;
}

.nav-tabs .nav-link:hover {
    border-color: transparent;
    border-bottom-color: var(--primary-color);
}

.nav-tabs .nav-link.active {
    border-color: transparent;
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

/* ===========================================
   Carte Annonce
   =========================================== */
.annonce-card {
    border: none;
    border-radius: 12px;
    overflow: hidden;
    transition: var(--transition);
}

.annonce-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow) !important;
}

.annonce-card .card-img-top {
    height: 200px;
    object-fit: cover;
}

.annonce-card .card-title {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.annonce-card .card-footer {
    border-top: 1px solid var(--border-color);
}

.hover-shadow:hover {
    box-shadow: var(--shadow) !important;
}

/* ===========================================
   Sidebar Sticky
   =========================================== */
.sidebar-sticky {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

/* Scrollbar personnalisee pour sidebar */
.sidebar-sticky::-webkit-scrollbar {
    width: 4px;
}

.sidebar-sticky::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-sticky::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.sidebar-sticky::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* ===========================================
   Sidebar Quartiers
   =========================================== */
.sidebar-quartiers {
    border-radius: 12px;
}

.quartier-list li a {
    transition: var(--transition);
}

.quartier-list li a:hover {
    background-color: var(--light-bg);
}

.quartier-bullet {
    color: var(--primary-color);
    font-weight: bold;
}

/* ===========================================
   Badges & Buttons
   =========================================== */
.badge {
    font-weight: 500;
}

.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-success:hover {
    transform: translateY(-2px);
}

/* ===========================================
   Cards
   =========================================== */
.card {
    border-radius: 12px;
    border: none;
}

.card-header {
    border-radius: 12px 12px 0 0 !important;
}

/* ===========================================
   Detail Page
   =========================================== */
.carousel-control-prev,
.carousel-control-next {
    width: 50px;
    height: 50px;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0,0,0,0.5);
    border-radius: 50%;
    margin: 0 10px;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    width: 20px;
    height: 20px;
}

.img-thumbnail {
    cursor: pointer;
    transition: var(--transition);
}

.img-thumbnail:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.description-content {
    line-height: 1.8;
    color: #495057;
}

/* ===========================================
   Pagination
   =========================================== */
.pagination .page-link {
    border-radius: 8px;
    margin: 0 3px;
    border: none;
    color: var(--secondary-color);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    color: white;
}

.pagination .page-link:hover {
    background-color: var(--light-bg);
    color: var(--primary-color);
}

/* ===========================================
   Orange Color Classes
   =========================================== */
.text-orange {
    color: var(--orange-color) !important;
}

.bg-orange {
    background-color: var(--orange-color) !important;
}

.btn-orange {
    background-color: var(--orange-color);
    border-color: var(--orange-color);
    color: white;
}

.btn-orange:hover {
    background-color: var(--orange-dark);
    border-color: var(--orange-dark);
    color: white;
}

.btn-outline-orange {
    border-color: var(--orange-color);
    color: var(--orange-color);
}

.btn-outline-orange:hover {
    background-color: var(--orange-color);
    color: white;
}

/* ===========================================
   Footer
   =========================================== */
.bg-darker {
    background-color: var(--darker-bg) !important;
}

footer {
    border-top: 4px solid var(--orange-color);
}

footer a:hover {
    color: var(--orange-color) !important;
}

.footer-links a {
    color: #95a5a6;
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--orange-color) !important;
    padding-left: 5px;
}

.social-links a:hover {
    color: var(--orange-color) !important;
    transform: translateY(-3px);
    display: inline-block;
}

/* ===========================================
   Bannières publicitaires
   =========================================== */
.banner-placeholder {
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.banner-header {
    background-color: #f1f3f4;
}

/* ===========================================
   Utilitaires
   =========================================== */
.cursor-pointer {
    cursor: pointer;
}

.hover-bg-light:hover {
    background-color: var(--light-bg) !important;
}

/* ===========================================
   Mobile Bottom Navigation Bar
   =========================================== */
.mobile-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1040;
    border-top: 1px solid var(--border-color);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--secondary-color);
    font-size: 0.7rem;
    padding: 4px 12px;
    transition: var(--transition);
    border-radius: 8px;
}

.mobile-nav-item i {
    font-size: 1.3rem;
    margin-bottom: 2px;
}

.mobile-nav-item.active,
.mobile-nav-item:hover {
    color: var(--primary-color);
}

.mobile-nav-item.active {
    background: rgba(13, 110, 253, 0.1);
}

/* Bouton recherche central plus visible */
.mobile-nav-search {
    background: var(--primary-color);
    color: #fff !important;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    margin-top: -20px;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.4);
}

.mobile-nav-search i {
    font-size: 1.5rem;
}

.mobile-nav-search span {
    display: none;
}

.mobile-nav-search:hover {
    background: var(--primary-dark);
    color: #fff !important;
    transform: scale(1.05);
}

/* ===========================================
   Mobile Contact Sticky Bar (Page Détail)
   =========================================== */
.mobile-contact-bar {
    position: fixed;
    bottom: 70px;
    left: 0;
    right: 0;
    background: #fff;
    padding: 10px 15px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.15);
    z-index: 1035;
    display: flex;
    gap: 10px;
}

.mobile-contact-bar .btn {
    flex: 1;
    padding: 12px;
    font-size: 0.9rem;
}

/* ===========================================
   Back to Top Button
   =========================================== */
.back-to-top {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 1030;
    cursor: pointer;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
}

@media (min-width: 992px) {
    .back-to-top {
        bottom: 30px;
    }
}

/* ===========================================
   Responsive
   =========================================== */
@media (max-width: 991.98px) {
    /* Espace pour la bottom bar */
    body {
        padding-bottom: 70px;
    }

    /* Header plus compact */
    .navbar {
        padding: 0.5rem 0;
    }

    .navbar-brand .logo-text {
        font-size: 1rem;
    }

    /* Masquer le toggle bootstrap par défaut (on utilise bottom bar) */
    .navbar-toggler {
        display: none !important;
    }

    .navbar-collapse {
        display: none !important;
    }

    /* Hero section plus compact */
    .hero-section {
        padding: 1rem !important;
    }

    .hero-section .lead {
        font-size: 0.9rem;
        line-height: 1.6;
    }

    /* Masquer les pubs header/footer sur petit mobile */
    .nav-tabs .nav-link {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.8rem;
    }

    /* Prix plus visible */
    .prix-detail .badge {
        font-size: 1.2rem !important;
        padding: 0.6rem 1rem !important;
    }

    /* Carousel touches gestuelles */
    .carousel-control-prev,
    .carousel-control-next {
        width: 40px;
        height: 40px;
    }

    /* Footer compact sur mobile */
    footer .row > div {
        margin-bottom: 1.5rem !important;
    }

    footer h6 {
        font-size: 0.9rem;
    }

    footer .footer-links li {
        margin-bottom: 0.3rem !important;
    }

    /* Cards plus compactes */
    .annonce-card .card-body {
        padding: 0.75rem;
    }

    .annonce-card .card-title {
        font-size: 0.9rem;
    }

    .annonce-card .card-footer {
        padding: 0.5rem;
    }

    /* Page détail mobile */
    .carousel-inner img {
        max-height: 300px !important;
    }
}

@media (max-width: 767.98px) {
    /* Grille annonces ajustée */
    .annonce-card .card-img-top {
        height: 160px;
    }

    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nav-tabs .nav-link {
        white-space: nowrap;
    }

    /* Titre/prix sur colonnes sur détail */
    .d-flex.justify-content-between.align-items-start {
        flex-direction: column;
        gap: 1rem;
    }

    .prix-detail {
        width: 100%;
        text-align: left !important;
    }

    .prix-detail .badge {
        display: inline-block !important;
    }

    /* Miniatures photos */
    .img-thumbnail {
        width: 60px !important;
        height: 45px !important;
    }

    /* Sidebar cachée - contenu en dessous */
    .col-lg-4 .card {
        margin-bottom: 1rem !important;
    }
}

@media (max-width: 575.98px) {
    /* Logo encore plus compact */
    .navbar-brand .logo-text {
        font-size: 0.85rem;
    }

    /* Buttons pleine largeur */
    .btn-lg {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    /* Fil d'ariane tronqué */
    .breadcrumb {
        font-size: 0.75rem;
    }

    .breadcrumb-item {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Masquer pubs sur très petit écran */
    #div-gpt-ad-header,
    #div-gpt-ad-footer {
        display: none;
    }
}

/* ===========================================
   Touch Friendly Improvements
   =========================================== */
@media (hover: none) and (pointer: coarse) {
    /* Plus gros boutons pour touch */
    .btn {
        min-height: 44px;
        padding: 0.6rem 1rem;
    }

    .btn-sm {
        min-height: 38px;
    }

    /* Links plus espacés */
    .footer-links li {
        padding: 8px 0;
    }

    .quartier-list li a {
        padding: 10px;
    }

    /* Pagination plus grande */
    .pagination .page-link {
        min-width: 40px;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Form inputs plus grands */
    .form-control,
    .form-select {
        min-height: 48px;
        font-size: 16px; /* Empêche zoom iOS */
    }
}

/* ===========================================
   Newsletter Cities Scrollable
   =========================================== */
.newsletter-cities {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    background: var(--light-bg);
}

.newsletter-cities .form-check {
    padding: 5px 0 5px 1.5rem;
}

.newsletter-cities .form-check:hover {
    background: #fff;
    border-radius: 4px;
}

/* ===========================================
   Print Styles
   =========================================== */
@media print {
    .navbar,
    footer,
    .sidebar-quartiers,
    .sidebar-sticky,
    .btn,
    .modal,
    .mobile-bottom-bar,
    .mobile-contact-bar,
    .back-to-top {
        display: none !important;
    }

    .col-lg-8 {
        width: 100% !important;
    }

    body {
        padding-bottom: 0 !important;
    }
}

/* ===========================================
   Split View Map Layout
   =========================================== */

/* Body class when in map view */
body.view-map {
    overflow: hidden;
}

body.view-map .mobile-bottom-bar {
    display: none;
}

/* Filter Bar */
.filter-bar {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
}

.filter-bar .dropdown-menu {
    min-width: 200px;
}

.filter-bar .form-control,
.filter-bar .form-select {
    font-size: 0.875rem;
}

/* Filter buttons - larger and more prominent */
.filter-btn {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
}

.filter-btn i {
    font-size: 1rem;
}

/* Mobile filter actions bar */
.mobile-filter-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    padding: 12px 16px;
    display: flex;
    gap: 10px;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.15);
    z-index: 1050;
}

.mobile-filter-actions .btn {
    padding: 12px 16px;
    font-weight: 600;
    border-radius: 8px;
}

body.view-map .mobile-filter-actions {
    display: flex;
}

/* Active filter indicator */
.filter-active {
    position: relative;
    border-color: var(--primary-color) !important;
    color: var(--primary-color) !important;
}

.filter-active::after {
    content: '';
    position: absolute;
    top: -3px;
    right: -3px;
    width: 8px;
    height: 8px;
    background: var(--danger-color);
    border-radius: 50%;
    border: 2px solid #fff;
}

/* Split View Container */
.split-view-container {
    display: flex;
    height: calc(100vh - 130px);
    overflow: hidden;
}

/* Listings Panel (Left) - wider to fit 3 columns */
.listings-panel {
    flex: 0 0 55%;
    max-width: 55%;
    overflow-y: auto;
    padding: 1rem;
    background: var(--light-bg);
}

/* Compact cards in map view */
.listings-panel .annonce-card .card-img-top {
    height: 140px;
}

.listings-panel .annonce-card .card-body {
    padding: 0.75rem;
}

.listings-panel .annonce-card .card-title {
    font-size: 0.85rem;
    -webkit-line-clamp: 1;
}

.listings-panel .annonce-card .card-footer {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
}

.listings-panel::-webkit-scrollbar {
    width: 6px;
}

.listings-panel::-webkit-scrollbar-track {
    background: transparent;
}

.listings-panel::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.listings-panel::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Map Panel (Right) */
.map-panel {
    flex: 1;
    position: relative;
    min-height: 400px;
}

#mapbox-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Map Loading Overlay */
.map-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.map-loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Listing Card Interactions in Split View */
.split-view-container .annonce-card {
    transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    cursor: pointer;
}

.split-view-container .annonce-card:hover {
    transform: translateY(-2px);
}

.split-view-container .annonce-card.map-highlight {
    box-shadow: 0 0 0 3px var(--primary-color) !important;
    border-color: var(--primary-color);
}

.split-view-container .annonce-card.map-active {
    box-shadow: 0 0 0 3px var(--success-color) !important;
    border-color: var(--success-color);
}

/* ===========================================
   Map Markers - Dot Style (like Realtor.com)
   =========================================== */
.map-marker {
    width: 14px;
    height: 14px;
    background: var(--danger-color);
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: transform 0.15s ease, background 0.15s ease, width 0.15s ease, height 0.15s ease;
    position: relative;
}

.map-marker:hover,
.map-marker.active {
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    transform: translate(-2px, -2px);
    z-index: 10 !important;
}

.map-marker.highlighted {
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border-width: 3px;
    transform: translate(-3px, -3px);
    z-index: 10 !important;
}

/* Exclusive marker */
.map-marker.exclusive {
    background: #b02a37;
}

.map-marker.exclusive:hover,
.map-marker.exclusive.active,
.map-marker.exclusive.highlighted {
    background: var(--danger-color);
}

/* ===========================================
   Map Popup
   =========================================== */
.mapboxgl-popup-content {
    padding: 0 !important;
    border-radius: 8px !important;
    overflow: hidden;
    min-width: 220px;
    max-width: 280px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

.mapboxgl-popup-close-button {
    font-size: 18px;
    padding: 4px 8px;
    color: #fff;
    background: rgba(0,0,0,0.3);
    border-radius: 0 8px 0 8px;
}

.mapboxgl-popup-close-button:hover {
    background: rgba(0,0,0,0.5);
}

.map-popup-card {
    display: block;
    text-decoration: none;
    color: inherit;
}

.map-popup-card:hover {
    text-decoration: none;
    color: inherit;
}

.map-popup-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.map-popup-card .popup-content {
    padding: 10px 12px;
}

.map-popup-card .popup-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-popup-card .popup-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 2px;
}

.map-popup-card .popup-details {
    font-size: 11px;
    color: var(--text-muted);
}

/* ===========================================
   Mobile View Toggle Button
   =========================================== */
.mobile-view-toggle {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1050;
    background: var(--primary-color);
    color: white !important;
    border: none;
    border-radius: 24px;
    padding: 12px 24px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    text-decoration: none;
    transition: var(--transition);
}

.mobile-view-toggle:hover {
    background: var(--primary-dark);
    color: white !important;
    transform: translateX(-50%) translateY(-2px);
}

/* ===========================================
   Map View Responsive
   =========================================== */

/* Large screens: 3 columns in list panel */
@media (min-width: 1400px) {
    .listings-panel {
        flex: 0 0 60%;
        max-width: 60%;
    }
}

/* Medium-large screens: 2 columns in list panel */
@media (max-width: 1399.98px) and (min-width: 1200px) {
    .listings-panel {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .listings-panel .listings-grid {
        --bs-gutter-x: 0.75rem;
    }

    .listings-panel .row-cols-xl-3 > * {
        flex: 0 0 auto;
        width: 50%;
    }
}

/* Medium screens: 2 columns in list panel */
@media (max-width: 1199.98px) and (min-width: 992px) {
    .listings-panel {
        flex: 0 0 45%;
        max-width: 45%;
    }

    .listings-panel .row-cols-xl-3 > *,
    .listings-panel .row-cols-md-2 > * {
        flex: 0 0 auto;
        width: 100%;
    }
}

@media (max-width: 991.98px) {
    body.view-map {
        overflow: auto;
        padding-bottom: 0;
    }

    .split-view-container {
        flex-direction: column;
        height: auto;
    }

    .listings-panel {
        flex: none;
        max-width: 100%;
        height: auto;
        max-height: none;
        overflow: visible;
    }

    .map-panel {
        display: none;
    }

    /* When in map mode on mobile, show map, hide list */
    body.view-map .listings-panel {
        display: none;
    }

    body.view-map .map-panel {
        display: block;
        height: calc(100vh - 130px);
        position: fixed;
        top: 130px;
        left: 0;
        right: 0;
        bottom: 0;
    }

    /* Filter bar horizontal scroll on mobile */
    .filter-bar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .filter-bar .d-flex {
        flex-wrap: nowrap;
        min-width: max-content;
        padding-right: 1rem;
    }

    .filter-bar .dropdown-menu {
        position: fixed !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        max-width: none !important;
    }

    /* Adjust mobile view toggle position */
    .mobile-view-toggle {
        bottom: 20px;
    }

    /* Hide desktop view toggle on mobile */
    .filter-bar .btn-group[aria-label="View mode"] {
        display: none !important;
    }
}

@media (max-width: 767.98px) {
    .split-view-container {
        height: auto;
    }

    .listings-panel {
        padding: 0.75rem;
    }

    body.view-map .map-panel {
        top: 110px;
    }

    .filter-bar .btn-sm {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
    }

    .filter-bar .gap-2 {
        gap: 0.35rem !important;
    }
}

/* ===========================================
   Results Count Badge
   =========================================== */
.results-count {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.results-count strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* ===========================================
   Auth Dropdown (Header) - realtor.com style
   =========================================== */

/* Guest/Logged out state button */
.btn-auth-guest {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    padding: 8px 16px;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-auth-guest:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

.btn-auth-guest::after {
    display: none;
}

/* Logged in state button */
.btn-auth-user {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    padding: 6px 16px 6px 8px;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-auth-user:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

.btn-auth-user::after {
    margin-left: 4px;
}

/* User avatar circle */
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.btn-auth-user .user-avatar {
    background: var(--primary-color);
}

/* Favorites/Heart button */
.btn-favorites-header {
    background: transparent;
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    position: relative;
    transition: all 0.2s ease;
}

.btn-favorites-header:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-favorites-header i {
    font-size: 1.25rem;
}

.btn-favorites-header .bi-heart-fill {
    color: #dc3545;
}

.favorites-count {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #dc3545;
    color: white;
    font-size: 0.65rem;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Dropdown menus */
.user-dropdown-menu,
.login-dropdown-menu {
    min-width: 280px;
    padding: 0;
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    margin-top: 10px;
    overflow: hidden;
    z-index: 1060 !important;
}

/* Auth dropdown container needs high z-index */
.auth-dropdown,
.auth-buttons {
    position: relative;
    z-index: 1055;
}

.user-dropdown-menu .dropdown-header,
.login-dropdown-menu .dropdown-header {
    background: #f8f9fa;
    padding: 15px 20px;
}

.user-dropdown-menu .user-info {
    display: flex;
    flex-direction: column;
}

.user-dropdown-menu .user-name {
    font-weight: 600;
    color: #333;
}

.user-dropdown-menu .user-email {
    font-size: 0.85rem;
    color: #6c757d;
}

.user-dropdown-menu .dropdown-item,
.login-dropdown-menu .dropdown-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    color: #333;
    transition: all 0.2s ease;
}

.user-dropdown-menu .dropdown-item:hover,
.login-dropdown-menu .dropdown-item:hover {
    background: #f8f9fa;
    color: var(--primary-color);
}

.user-dropdown-menu .dropdown-item i,
.login-dropdown-menu .dropdown-item i {
    width: 24px;
    text-align: center;
}

.user-dropdown-menu .dropdown-item .badge {
    margin-left: auto;
}

.user-dropdown-menu .dropdown-divider,
.login-dropdown-menu .dropdown-divider {
    margin: 0;
}

/* OAuth items in login dropdown */
.login-dropdown-menu .oauth-item {
    font-weight: 500;
}

.login-dropdown-menu .oauth-item img {
    border-radius: 4px;
}

/* Mobile responsive */
@media (max-width: 991.98px) {
    .auth-dropdown,
    .auth-buttons {
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .btn-auth-guest,
    .btn-auth-user {
        width: 100%;
        justify-content: center;
    }

    .btn-favorites-header {
        position: absolute;
        top: 10px;
        right: 60px;
    }

    .user-dropdown-menu,
    .login-dropdown-menu {
        position: static !important;
        transform: none !important;
        width: 100%;
        margin-top: 10px;
        box-shadow: none;
        border: 1px solid rgba(255, 255, 255, 0.1);
        background: #2c3e50;
    }

    .user-dropdown-menu .dropdown-header,
    .login-dropdown-menu .dropdown-header {
        background: rgba(255, 255, 255, 0.05);
        color: white;
    }

    .user-dropdown-menu .dropdown-item,
    .login-dropdown-menu .dropdown-item {
        color: rgba(255, 255, 255, 0.9);
    }

    .user-dropdown-menu .dropdown-item:hover,
    .login-dropdown-menu .dropdown-item:hover {
        background: rgba(255, 255, 255, 0.1);
        color: white;
    }

    .login-dropdown-menu .dropdown-header strong,
    .login-dropdown-menu .dropdown-header small {
        color: white !important;
    }
}

/* ===========================================
   Favorite Button on Listing Cards
   =========================================== */

/* Heart button on cards */
.btn-favorite {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.btn-favorite:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-favorite i {
    font-size: 1.1rem;
    color: #6c757d;
    transition: all 0.2s ease;
}

.btn-favorite:hover i {
    color: #dc3545;
}

/* Active/favorited state */
.btn-favorite.active {
    background: #dc3545;
}

.btn-favorite.active i {
    color: white;
}

.btn-favorite.active i::before {
    content: "\f415"; /* bi-heart-fill */
}

/* Animation on click */
.btn-favorite.animating {
    animation: heartPulse 0.3s ease;
}

@keyframes heartPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Toast notification for favorites */
.favorites-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1070;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.favorites-toast.show {
    opacity: 1;
    visibility: visible;
}

.favorites-toast i {
    color: #dc3545;
}

.favorites-toast a {
    color: #ffc107;
    text-decoration: none;
    margin-left: 10px;
}

.favorites-toast a:hover {
    text-decoration: underline;
}
