/* Interactive Map Plugin - Main Styles */

/* Container Styles */
#mapbox-container {
    position: relative;
    height: 90vh;
    width: 100%;
}

#map {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
}

/* Loading Message */
#loading-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

/* Town Labels - Always visible */
.town-label {
    color: #333;
    font-size: 12px;
    font-weight: 600;
    text-shadow: 1px 1px 2px white, -1px -1px 2px white, 1px -1px 2px white, -1px 1px 2px white;
    pointer-events: none;
    white-space: nowrap;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Note: Using default Mapbox markers - no custom marker CSS needed */

/* ============================================ */
/* NAVIGATION DESIGN: 
   Desktop: Traditional bottom menu bar
   Mobile: Compact side overlay links (right side)
/* ============================================ */

/* Bottom Menu Styles */
#bottom-menu {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: transparent!important;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    max-height: 120px;
    overflow-y: auto;
    z-index: 10;
}

/* Gradient overlay for better contrast */
#bottom-menu::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 150px;
    background: linear-gradient(to bottom, 
        rgba(0, 0, 0, 0) 5%, 
        rgba(0, 0, 0, 0.3) 30%, 
        rgba(0, 0, 0, 0.6) 70%, 
        rgba(0, 0, 0, 0.9) 100%);
    pointer-events: none;
    z-index: -1;
}

#menu-items {
    display: flex;
    flex-wrap: wrap;
    padding: 10px;
    gap: 10px;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.menu-item {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    cursor: pointer;
    font-size: 17px;
    white-space: nowrap;
    color: #fff!important;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: inherit;
    font-family: 'Oswald';
    transition: all 0.2s ease;
}

.menu-item:hover {
    background: #007CBF;
    color: white;
    border-color: #007CBF;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 191, 0.3);
}

.menu-item.active {
    background: #007CBF;
    color: white;
    border-color: #007CBF;
    box-shadow: 0 2px 4px rgba(0, 123, 191, 0.3);
}

.menu-item.active:hover {
    background: #0056b3;
    border-color: #0056b3;
}

/* Menu Separator */
.menu-separator {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.3);
    margin: 0 5px;
}

/* View All Button Styles */
.view-all-button {
    padding: 15px 30px;
    background: #007CBF;
    color: white;
    border-radius: 0px;
    cursor: pointer;
    font-size: 17px;
    border: 2px solid #007CBF;
    font-family: 'Oswald';
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.view-all-button:hover {
    background: #0056b3;
    border-color: #0056b3;
    box-shadow: 0 4px 8px rgba(0, 123, 191, 0.3);
    transform: translateY(-2px);
}

/* Custom Popup Styles */
.custom-popup {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    border-radius: 0px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    padding: 0px;
    width: 300px;
    z-index: 1000;
    display: none;
    max-height: 80vh;
    overflow-y: auto;
    text-align: center;
}

/* Popup animation */
.custom-popup.active {
    display: block;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

.popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid white;
    color: white;
    padding: 0;
    transition: all 0.2s ease;
}

.popup-close:hover {
    background: #000;
    transform: scale(1.1);
    color: white;
}

.popup-close svg {
    width: 20px;
    height: 20px;
}

.popup-close:hover {
    background: #f0f0f0;
    color: #333;
}

.popup-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 15px;
    color: #ffffff;
    padding-right: 0px;
    position: absolute;
    top: 155px;
    text-align: center;
    font-family: 'Oswald';
    left: 0;
    right: 0;
    overflow: hidden;
    z-index: 999;
}

.popup-title:before {
    position: absolute;
    top: 58%;
    overflow: hidden;
    width: 48%;
    height: 0.8px;
    content: '\a0';
    background-color: #ffffff99;
    margin-left: -50%;
    text-align: right;
}

.popup-title:after {
    position: absolute;
    top: 58%;
    overflow: hidden;
    width: 48%;
    height: 0.8px;
    content: '\a0';
    background-color: #ffffff99;
    margin-left: 2%;
}

.popup-image {
    width: 100%;
    height: 200px;
    background: #ddd;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    border-radius: 0px;
    overflow: hidden;
}

.popup-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.grid_column_content img {
    margin-bottom: 0px!important;
}

.popup-description {
    font-size: 14px;
    line-height: 1.6;
    color: #666;
    margin-bottom: 0px;
    text-align: center;
    padding: 10px 15px;
}

.popup-button {
    display: inline-block;
    padding: 6px;
    color: #007CBF;
    text-decoration: none;
    border-radius: 4px;
    margin-bottom: 15px;
}

.popup-button:hover {
    background: #fff;
    text-decoration: none;
    color: #007cbf;
}

/* Mapbox GL Controls Override */
.mapboxgl-ctrl-top-right {
    top: 10px;
    right: 10px;
}

.mapboxgl-ctrl-group {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Scrollbar Styling */
#bottom-menu::-webkit-scrollbar {
    height: 6px;
}

#bottom-menu::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#bottom-menu::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

#bottom-menu::-webkit-scrollbar-thumb:hover {
    background: #555;
}

div#bottom-menu {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 80px;
    background: transparent;
    display: flex;
    align-items: center;
    padding: 0 20px;
    box-sizing: border-box;
    overflow-x: auto;
    gap: 10px;
    z-index: 1000;
    justify-content: center;
}

div#bottom-menu {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 80px;
    background: rgb(255 255 255 / 2%);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    padding: 0 20px;
    box-sizing: border-box;
    overflow-x: auto;
    gap: 10px;
    z-index: 1000;
    justify-content: center;
}

/* Popup Backdrop - Hidden on Desktop, Used on Mobile */
.popup-backdrop {
    display: none;
}

/* Mobile menu overlay - hidden by default */
#mobile-menu-overlay {
    display: none;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    /* Hide desktop bottom menu on mobile */
    #bottom-menu {
        display: none;
    }
    
    /* Mobile side overlay menu */
    #mobile-menu-overlay {
        display: block;
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 100;
        max-height: 70vh;
        overflow-y: auto;
        padding-right: 5px;
    }
    
    #mobile-menu-overlay .menu-link {
        display: block;
        padding: 8px 12px;
        margin-bottom: 8px;
        background: rgba(0, 0, 0, 0.7);
        color: white;
        font-size: 12px;
        text-decoration: none;
        border-radius: 20px;
        border: 1px solid rgba(255, 255, 255, 0.3);
        backdrop-filter: blur(10px);
        transition: all 0.2s ease;
        white-space: nowrap;
        text-align: center;
        cursor: pointer;
        min-width: 80px;
    }
    
    #mobile-menu-overlay .menu-link:hover,
    #mobile-menu-overlay .menu-link.active {
        background: #007CBF;
        border-color: #007CBF;
        transform: translateX(-5px);
        box-shadow: 0 2px 8px rgba(0, 123, 191, 0.4);
    }
    
    #mobile-menu-overlay .view-all-link {
        background: rgba(40, 167, 69, 0.8);
        border-color: rgba(40, 167, 69, 0.5);
        font-weight: 600;
    }
    
    #mobile-menu-overlay .view-all-link:hover {
        background: #28a745;
        transform: translateX(-5px);
    }
    
    /* Thin custom scrollbar for mobile menu */
    #mobile-menu-overlay::-webkit-scrollbar {
        width: 3px;
    }
    
    #mobile-menu-overlay::-webkit-scrollbar-track {
        background: transparent;
    }
    
    #mobile-menu-overlay::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 3px;
    }
    
    /* Dark overlay backdrop for mobile popup */
    .popup-backdrop {
        display: none;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .popup-backdrop.active {
        display: block;
        opacity: 1;
    }
    
    .custom-popup {
        /* Mobile: Slide up from bottom */
        position: absolute;
        left: 0;
        right: 0;
        top: auto;
        bottom: 0;
        transform: translateY(100%);
        width: 100%;
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 70vh;
        padding-top: 30px;
        padding-bottom: env(safe-area-inset-bottom, 20px);
    }
    
    /* Add drag handle indicator */
    .custom-popup::before {
        content: '';
        position: absolute;
        top: 12px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: #ccc;
        border-radius: 2px;
    }
    
    /* Mobile slide up animation */
    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
    
    .custom-popup.active {
        transform: translateY(0);
        animation: slideUp 0.3s ease-out;
    }
    
    /* Enhanced close button for mobile */
    .popup-close {
        width: 44px;
        height: 44px;
    }
    
    .popup-title {
        font-size: 18px;
        top: 145px;
    }
    
    .popup-description {
        font-size: 14px;
        padding: 12px 20px;
    }
    
    .popup-button {
        padding: 10px 20px;
        font-size: 14px;
        font-weight: 600;
    }
}

/* Hide mobile menu on desktop */
@media (min-width: 769px) {
    #mobile-menu-overlay {
        display: none !important;
    }
}

/* Small Mobile Adjustments */
@media (max-width: 480px) {
    /* Adjust mobile overlay for small screens */
    #mobile-menu-overlay {
        right: 5px;
        max-height: 60vh;
    }
    
    #mobile-menu-overlay .menu-link {
        font-size: 11px;
        padding: 6px 10px;
        min-width: 70px;
        margin-bottom: 6px;
    }
    
    /* Keep close button in top-right corner on small screens */
    .popup-close {
        position: absolute;
        top: 10px;
        right: 10px;
        width: 42px;
        height: 42px;
    }
    
    /* Adjust popup for small screens */
    .custom-popup {
        max-height: 75vh;
    }
    
    .popup-title {
        font-size: 17px;
        padding-right: 50px;
    }
    
    .popup-description {
        font-size: 13px;
        padding: 10px 15px;
    }
}

/* Popup Backdrop - Hidden on Desktop, Used on Mobile */
.popup-backdrop {
    display: none;
}

/* Print Styles */
@media print {
    #bottom-menu,
    .custom-popup,
    .mapboxgl-ctrl-group {
        display: none !important;
    }
}