/**
 * Mobile Map Carousel - Standalone CSS
 * Bottom slide-up popup for mobile map markers with horizontal scroll
 */

/* Backdrop overlay */
/* Backdrop disabled (no overlay/blur for marker open) */
.map-mobile-backdrop { display: none !important; }

/* Main carousel container */
.map-mobile-carousel {
    position: fixed;
    background: #ffffff;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    z-index: 10500; /* Increased from 9999 to be above modal header (usually 1050-1060) */
    padding-bottom: env(safe-area-inset-bottom, 0);
}

/* MOBILE LAYOUT (< 768px) - Bottom slide panel */
@media (max-width: 767px) {
    .map-mobile-carousel {
        /* Leave a 10px gap from the bottom edge on mobile, respecting safe-area insets */
        bottom: calc(10px + env(safe-area-inset-bottom, 0));
        left: 5px;
        right: 5px;
        /* Softer, smaller rounding as requested */
        border-radius: 12px 12px 0 0;
        /* Reduce the overall panel height */
        max-height: 25vh;
        animation: slideUpAnimation 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    @keyframes slideUpAnimation {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
}

/* DESKTOP LAYOUT (>= 768px) - Left slide-in modal with two panels */
/* Note: This rule applies ONLY when .desktop-mode is NOT present */
@media (min-width: 768px) {
    .map-mobile-carousel:not(.desktop-mode) {
        top: 15px;
        left: 0;
        bottom: 0;
        width: 850px; /* Wider to accommodate both panels */
        max-width: 95vw;
        border-radius: 0;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.15);
        animation: slideInFromLeft 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: transparent; /* Transparent to show panel backgrounds */
        display: flex;
        flex-direction: row;
        overflow: hidden;
    }

    @keyframes slideInFromLeft {
        from {
            transform: translateX(-100%);
            opacity: 0;
        }
        to {
            transform: translateX(0);
            opacity: 1;
        }
    }
}

/* Dark mode */
.dark .map-mobile-carousel {
    background: #1e293b;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.5);
}

/* Horizontal scroll wrapper */
.map-mobile-carousel-scroll-wrapper {
    display: flex;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.map-mobile-carousel-scroll-wrapper::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* MOBILE - Horizontal scroll */
@media (max-width: 767px) {
    .map-mobile-carousel-scroll-wrapper {
        flex-direction: row;
        gap: 16px;
        /* Reduce top spacing so the first image sits closer to the top */
        padding: 40px 24px 24px 24px;
        padding-bottom: calc(24px + env(safe-area-inset-bottom, 0));
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
    }
}

/* DESKTOP - Vertical scroll (in sidebar) */
@media (min-width: 768px) {
    .map-mobile-carousel-scroll-wrapper {
        flex-direction: column;
        flex: 1;
        gap: 8px;
        padding: 12px 12px 20px 12px; /* Reduced top padding from 65px to 12px */
        overflow-y: auto;
        overflow-x: hidden;
        scroll-snap-type: none;
        scroll-behavior: auto;
    }

    /* Custom scrollbar for desktop */
    .map-mobile-carousel-scroll-wrapper {
        scrollbar-width: thin;
        scrollbar-color: #cbd5e0 transparent;
    }

    .map-mobile-carousel-scroll-wrapper::-webkit-scrollbar {
        display: block;
        width: 6px;
    }

    .map-mobile-carousel-scroll-wrapper::-webkit-scrollbar-track {
        background: transparent;
    }

    .map-mobile-carousel-scroll-wrapper::-webkit-scrollbar-thumb {
        background: #cbd5e0;
        border-radius: 3px;
    }

    .map-mobile-carousel-scroll-wrapper::-webkit-scrollbar-thumb:hover {
        background: #a0aec0;
    }
}

/* Individual card wrapper */
.map-mobile-carousel-card {
    flex-shrink: 0;
}

/* MOBILE - Full width cards with snap */
@media (max-width: 767px) {
    .map-mobile-carousel-card {
        flex: 0 0 calc(100vw - 48px);
        max-width: calc(100vw - 48px);
        scroll-snap-align: center;
        scroll-snap-stop: always;
    }
}

/* DESKTOP - Stacked cards */
@media (min-width: 768px) {
    .map-mobile-carousel-card {
        width: 100%;
        scroll-snap-align: none;
    }
}

/* Counter - "1 of 5" */
.map-mobile-carousel-indicator {
    position: absolute;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* MOBILE - Center top */
@media (max-width: 767px) {
    .map-mobile-carousel-indicator {
        top: 16px;
        left: 50%;
        transform: translateX(-50%);
    }
}

/* DESKTOP - Top left as header title (in sidebar) */
@media (min-width: 768px) {
    .map-mobile-carousel-indicator {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        transform: none;
        background: #ffffff;
        color: #111827;
        font-size: 16px;
        font-weight: 700;
        padding: 20px 12px 15px 12px;
        box-shadow: none;
        border-bottom: 1px solid #e5e7eb;
        z-index: 100;
    }

    .dark .map-mobile-carousel-indicator {
        color: #e5e7eb;
        background: #1e293b;
        border-bottom-color: #334155;
    }
}

/* Close button */
.map-mobile-carousel-close {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    font-size: 16px;
    transition: all 0.2s ease;
    z-index: 10001;
}

/* MOBILE - Top right */
@media (max-width: 767px) {
    .map-mobile-carousel-close {
        top: 16px;
        right: 16px;
    }
}

/* DESKTOP - Top right inside sidebar header */
@media (min-width: 768px) {
    .map-mobile-carousel-close {
        top: 16px;
        right: 12px;
        z-index: 101;
    }
}

.dark .map-mobile-carousel-close {
    background: rgba(30, 41, 59, 0.95);
    color: #e2e8f0;
}

.map-mobile-carousel-close:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 1);
}

.dark .map-mobile-carousel-close:active {
    background: rgba(30, 41, 59, 1);
}
.map-mobile-carousel-body .leaflet-popup-content-wrapper,
.map-mobile-carousel-body .leaflet-popup-tip-container {
    display: none;
}

/* Professional card layout (image left, text right) */
.map-mobile-card {
    display: grid;
    grid-template-columns: 112px 1fr;
    gap: 14px;
    align-items: start;
    margin: 2px;
}

/* DESKTOP - Add card styling for better visual separation */
@media (min-width: 768px) {
    .map-mobile-card {
        background: #ffffff;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        padding: 12px;
        margin: 0;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .map-mobile-card:hover {
        background: #f9fafb;
        border-color: #d1d5db;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

    .map-mobile-card.active {
        background: #eff6ff;
        border-color: #0ea5e9;
        box-shadow: 0 4px 8px rgba(14, 165, 233, 0.15);
    }

    .dark .map-mobile-card {
        background: #1e293b;
        border-color: #334155;
    }

    .dark .map-mobile-card:hover {
        background: #334155;
        border-color: #475569;
    }

    .dark .map-mobile-card.active {
        background: #0f172a;
        border-color: #38bdf8;
        box-shadow: 0 4px 8px rgba(56, 189, 248, 0.2);
    }
}

.map-mobile-card.no-image {
    grid-template-columns: 1fr;
}

.map-mobile-card-image {
    display: block;
    width: 112px;
    height: 84px;
    border-radius: 12px;
    overflow: hidden;
    background: #f3f4f6;
}

.map-mobile-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.map-mobile-card-image.placeholder {
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, #22c55e, #10b981);
}

.map-mobile-card-initial { font-size: 28px; font-weight: 700; letter-spacing: 0.5px; }

.map-mobile-card-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.map-mobile-card-title {
    font-size: 16px;
    line-height: 1.25;
    margin: 0;
}

.map-mobile-card-title a {
    color: #111827;
    text-decoration: none;
}
.dark .map-mobile-card-title a { color: #e5e7eb; }
.map-mobile-card-title a:hover { text-decoration: underline; }

.map-mobile-card-meta {
    font-size: 12px;
    color: #6b7280;
}
.dark .map-mobile-card-meta { color: #94a3b8; }

/* Stats row: rating + views */
.map-mobile-card-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}
.map-mobile-card-stats .dot { color: #9ca3af; }
.map-mobile-card-stats .stat { color: #6b7280; display: inline-flex; align-items: center; gap: 6px; }
.map-mobile-card-stats .stat i { font-size: 14px; color: #9ca3af; }
.dark .map-mobile-card-stats .stat { color: #94a3b8; }
.dark .map-mobile-card-stats .stat i { color: #64748b; }

/* Rating stars (from buildStarRatingHtml) */
.rating-stars {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 12px;
}

.rating-stars i {
    font-size: 12px;
}

.rating-stars .rating-value {
    margin-left: 4px;
    font-weight: 600;
    color: #374151;
    font-size: 12px;
}

.dark .rating-stars .rating-value {
    color: #e5e7eb;
}

.rating-stars .rating-count {
    margin-left: 2px;
    font-size: 11px;
    color: #6b7280;
}

.dark .rating-stars .rating-count {
    color: #94a3b8;
}

/* Rating bubbles (legacy - keeping for compatibility) */
.map-mobile-card-rating {
    display: flex;
    align-items: center;
    gap: 8px;
}
.rating-bubbles { display: inline-flex; gap: 4px; }
.rating-bubbles .bubble {
    width: 11px;
    height: 11px;
    border-radius: 999px;
    background: #d1d5db;
}
.rating-bubbles .bubble.filled { background: #34d399; }
.map-mobile-card-rating .rating-value { font-weight: 600; font-size: 13px; }
.map-mobile-card-rating .rating-count { font-size: 12px; color: #6b7280; }
.dark .map-mobile-card-rating .rating-count { color: #94a3b8; }

/* Actions */
.map-mobile-card-actions {
    margin-top: 2px;
}

.map-mobile-nav-link {
    color: #0ea5e9;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.map-mobile-nav-link:hover {
    text-decoration: underline;
    background: rgba(14, 165, 233, 0.1);
}

.dark .map-mobile-nav-link {
    color: #38bdf8;
}

.dark .map-mobile-nav-link:hover {
    background: rgba(56, 189, 248, 0.1);
}

/* Article excerpt */
.map-mobile-card-excerpt {
    font-size: 12px;
    color: #4b5563;
}
.dark .map-mobile-card-excerpt { color: #cbd5e1; }

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
    .map-mobile-backdrop { animation: none; }
    .map-mobile-carousel { animation: none; }
}

/* DESKTOP TWO-PANEL LAYOUT */
@media (min-width: 768px) {
    .map-mobile-carousel.desktop-mode {
        position: absolute !important;
        top: 10px !important;
        left: 10px !important;
        right: auto !important;
        bottom: 10px !important;
        width: 850px !important; /* Restore original width */
        max-width: 95vw !important;
        display: flex;
        background: #ffffff;
        border-radius: 8px;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
        z-index: 10500; /* Increased from 1000 to be above modal elements */
        overflow: hidden;
    }

    .dark .map-mobile-carousel.desktop-mode {
        background: #0f172a;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    }

    /* Left sidebar - Location list (narrow) */
    .map-carousel-sidebar {
        width: 320px;
        flex-shrink: 0;
        background: #f9fafb;
        border-right: 1px solid #e5e7eb;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .dark .map-carousel-sidebar {
        background: #0f172a;
        border-right-color: #334155;
    }

    /* Right panel - Details with tabs (wider) */
    .map-carousel-details {
        flex: 1;
        background: #ffffff;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .dark .map-carousel-details {
        background: #1e293b;
    }

    /* Hide details panel initially (show when location selected) */
    .map-carousel-details.hidden {
        display: none;
    }

    /* Adjust sidebar width when details panel is visible */
    .map-mobile-carousel.has-details .map-carousel-sidebar {
        width: 280px;
    }

    /* Sidebar Filter Tabs */
    .map-sidebar-filter-tabs {
        display: flex;
        gap: 0;
        padding: 12px;
        background: #ffffff;
        border-bottom: 1px solid #e5e7eb;
    }

    .dark .map-sidebar-filter-tabs {
        background: #1e293b;
        border-bottom-color: #334155;
    }

    .map-sidebar-filter-tab {
        flex: 1;
        padding: 10px 16px;
        font-size: 14px;
        font-weight: 500;
        color: #6b7280;
        background: transparent;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }

    .map-sidebar-filter-tab:hover {
        background: #f3f4f6;
        color: #374151;
        border-color: #d1d5db;
    }

    .map-sidebar-filter-tab.active {
        background: #3b82f6;
        color: #ffffff;
        border-color: #3b82f6;
        box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    }

    .dark .map-sidebar-filter-tab {
        color: #9ca3af;
        border-color: #334155;
    }

    .dark .map-sidebar-filter-tab:hover {
        background: #334155;
        color: #e5e7eb;
        border-color: #475569;
    }

    .dark .map-sidebar-filter-tab.active {
        background: #3b82f6;
        color: #ffffff;
        border-color: #3b82f6;
    }

    /* Empty state for filtered results */
    .map-carousel-empty-state {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 60px 20px;
        color: #9ca3af;
        text-align: center;
        width: 100%;
    }

    .map-carousel-empty-state i {
        font-size: 48px;
        margin-bottom: 16px;
        opacity: 0.5;
    }

    .map-carousel-empty-state p {
        font-size: 16px;
        margin: 0;
    }

    .dark .map-carousel-empty-state {
        color: #6b7280;
    }

    /* Details Panel Tabs */
    .map-details-tabs {
        display: flex;
        gap: 8px;
        padding: 16px 20px 0;
        border-bottom: 2px solid #e5e7eb;
        background: #ffffff;
    }

    .dark .map-details-tabs {
        background: #1e293b;
        border-bottom-color: #334155;
    }

    .map-details-tab {
        padding: 10px 20px;
        font-size: 14px;
        font-weight: 500;
        color: #6b7280;
        background: transparent;
        border: none;
        border-bottom: 3px solid transparent;
        cursor: pointer;
        transition: all 0.2s ease;
        position: relative;
        bottom: -2px;
    }

    .map-details-tab:hover {
        color: #374151;
        border-bottom-color: #d1d5db;
    }

    .map-details-tab.active {
        color: #3b82f6;
        border-bottom-color: #3b82f6;
        font-weight: 600;
    }

    .dark .map-details-tab {
        color: #9ca3af;
    }

    .dark .map-details-tab:hover {
        color: #e5e7eb;
        border-bottom-color: #475569;
    }

    .dark .map-details-tab.active {
        color: #3b82f6;
        border-bottom-color: #3b82f6;
    }

    /* Details Content */
    .map-details-content {
        flex: 1;
        overflow-y: auto;
        background: #ffffff;
    }

    .dark .map-details-content {
        background: #1e293b;
    }

    .map-details-tab-panel {
        display: none;
        padding: 20px;
    }

    .map-details-tab-panel.active {
        display: block;
    }

    /* Overview content styles */
    .map-overview-image {
        width: 100%;
        height: 200px;
        object-fit: cover;
        border-radius: 8px;
        margin-bottom: 16px;
    }

    .map-overview-section h2 {
        font-size: 20px;
        font-weight: 700;
        color: #111827;
        margin-bottom: 8px;
        line-height: 1.4;
    }

    .dark .map-overview-section h2 {
        color: #f3f4f6;
    }

    .map-overview-meta {
        display: flex;
        align-items: center;
        gap: 12px;
        font-size: 14px;
        flex-wrap: wrap;
    }

    .map-overview-meta .rating-stars {
        display: inline-flex;
        align-items: center;
        gap: 4px;
    }

    .map-overview-meta .rating-stars i {
        font-size: 14px;
    }

    .map-overview-meta .rating-value {
        font-weight: 600;
        color: #111827;
        margin-left: 4px;
    }

    .dark .map-overview-meta .rating-value {
        color: #f3f4f6;
    }

    .map-overview-meta .rating-count {
        color: #6b7280;
        font-size: 13px;
    }

    .dark .map-overview-meta .rating-count {
        color: #9ca3af;
    }

    .map-overview-section {
        margin-bottom: 20px;
    }

    .map-overview-section:last-child {
        margin-bottom: 0;
    }

    .map-overview-section h3 {
        font-size: 16px;
        font-weight: 600;
        color: #111827;
        margin-bottom: 12px;
    }

    .dark .map-overview-section h3 {
        color: #f3f4f6;
    }

    .map-overview-section p {
        font-size: 14px;
        color: #4b5563;
        line-height: 1.6;
        margin: 0;
    }

    .dark .map-overview-section p {
        color: #d1d5db;
    }

    .map-overview-section .description-content {
        font-size: 14px;
        color: #4b5563;
        line-height: 1.6;
        white-space: pre-wrap;
    }

    .dark .map-overview-section .description-content {
        color: #d1d5db;
    }

    .map-overview-section a {
        color: #3b82f6;
        text-decoration: none;
    }

    .map-overview-section a:hover {
        text-decoration: underline;
    }

    .amenities-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 10px;
    }

    .amenity-item {
        display: flex;
        align-items: center;
        font-size: 14px;
        color: #4b5563;
        padding: 8px;
        background: #f9fafb;
        border-radius: 6px;
    }

    .dark .amenity-item {
        color: #d1d5db;
        background: #0f172a;
    }

    .amenity-item i {
        color: #3b82f6;
        margin-right: 8px;
    }
}

 
 
