/* --- FONT & BASE STYLES --- */
body {
    margin: 0;
    padding: 0;
    font-family: 'Oswald', 'Verdana', 'Arial', sans-serif;
    background: #eee;
    overflow-x: hidden;
}
#map {
    height: 100vh;
    width: 100%;
    z-index: 1;
    padding-top: 0;
    box-sizing: border-box;
}

/* ==================================== */
/* --- BLINKING MARKER ANIMATION --- */
/* ==================================== */
@keyframes blink {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(1.1); }
}

.blinking-marker-container {
    animation: blink 1.5s infinite;
}

/* ==================================== */
/* --- ON TOUR NOW LABEL STYLES --- */
/* ==================================== */
.on-tour-label {
    position: absolute;
    background-color: #03C0C1; /* Turquoise Surf */
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
    letter-spacing: 0.5px;
    top: -38px;
    left: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    pointer-events: none;
}

/* --- FLOATING HEADER (MAIN CARD) --- */
.header-card {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.98);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    max-width: 420px;
    border-left: 6px solid #C3002F;
    color: #111;
    transition: top 0.3s ease-in-out, border-radius 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px;
}

.navara-image {
    width: 150px;
    height: auto;
    object-fit: contain;
    margin-left: 10px;
}

.header-card h1 {
    margin: 0;
    font-size: 20px;
    text-transform: uppercase;
    font-weight: 700;
    line-height: 1.2;
    color: #C3002F;
}

.leaflet-container a.leaflet-popup-close-button{
    color: #ffffff;
    font-size: 2rem;
    right: 5px;
    top: 5px;
}

/* Style for descriptive text */
.header-card p.text-list {
    margin: 10px 0 15px 0;
    font-size: 13px;
    color: #555;
    line-height: 1.4;
    border-bottom: 1px dashed #ccc;
    padding-bottom: 10px;
}
.header-card p.text-list .text {   
    margin-bottom: 2px;
    display: block;
}
.header-card span.indent-item {
    display: block;
    padding-left: 15px;
}

/* --- ADDED STYLE FOR CLICKABLE NAVARA LINKS --- */
.navara-link {
    text-decoration: none; /* Removes default underline */
    color: inherit; /* Inherits color from parent <p> tag */
    display: block; /* Ensures the whole block is clickable */
}
.navara-link:hover {
    text-decoration: none; /* Adds a subtle hover effect */
    color: #C3002F; /* Optional: Highlights the text on hover */
}
/* --- END ADDED STYLE --- */

/* --- COLLAPSIBLE CONTENT (Filters & Info) --- */
.collapsible-content {
    max-height: 1000px;
    opacity: 1;
    transition: max-height 0.4s ease-in-out, opacity 0.3s ease-in, padding-top 0.4s ease-in-out;
    overflow: hidden;
}

/* --- MOBILE TOGGLE BUTTONS (Repurposed as Main Control) --- */
.mobile-toggle-btn {
    display: none;
    width: 100%;
    padding: 12px 15px;
    margin-top: 10px;
    background: #111;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    text-transform: uppercase;
    transition: background 0.2s;
    font-family: 'Oswald', sans-serif;
    font-size: 14px;
}
.mobile-toggle-btn:hover {
    background: #333;
}

/* --- FILTERS STYLING --- */
.filters .select2-container {
    width: 100% !important;
}


.filters {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}
.filters > div {
    min-width: 100px;
    flex-grow: 1;
}

.filters > div {
    flex: 0 0 calc(50% - 5px);
}

.filters > div:nth-child(3) {
    flex: 0 0 100%;
}

.filters label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 3px;
    color: #C3002F;
    text-transform: uppercase;
}

/* === UPDATED STYLING FOR LARGER FILTERS === */
.filters select {
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
    box-sizing: border-box;
    height: 44px;
    -webkit-appearance: none;
    appearance: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23333' width='18px' height='18px'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 10px center;
    background-size: 14px;
}
.filters select:focus {
    border-color: #C3002F;
}

/* Disable styling for disabled select */
.filters select:disabled {
    background-color: #f0f0f0;
    color: #aaa;
    cursor: not-allowed;
    background-image: none; /* Remove custom arrow when disabled */
}


/* --- CONTROL BUTTONS STYLING --- */
.filter-controls {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap; /* Allows wrapping on smaller screens */
}
.filter-controls > .filters {
    margin-top: 0;
    flex-grow: 1;
}

.action-buttons { /* New container for action buttons */
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* Shared button style for actions */
.action-btn {
    padding: 8px 10px;
    background: #111;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    text-transform: uppercase;
    transition: background 0.2s;
    font-family: 'Oswald', sans-serif;
    font-size: 13px;   
    white-space: nowrap;
    flex-grow: 1;
    min-width: 100px;
    gap: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.action-btn:hover {
    background: #C3002F;
}



.action-btn i{
    font-size: 16px;
}

/* Clear button specific styling */
#clear-filters-btn {
    background: #C3002F;
}
#clear-filters-btn:hover {
    background: #a30027;
}

/* --- POPUP STYLING (Mobile Focus) --- */
.leaflet-popup-content-wrapper { border-radius: 8px; padding: 0; overflow: hidden; box-shadow: 0 5px 25px rgba(0,0,0,0.3); }

/* === FIX 1: Increased max-width for the popup content to fit 3 buttons === */
.leaflet-popup-content { margin: 0; width: 320px !important; } 

.popup-header { background: #111; color: #fff; padding: 15px; }
.popup-header h3 { margin: 0; font-size: 18px; font-weight: 700; }
.vehicle-badge { display: inline-block; color: white; font-size: 11px; padding: 4px 8px; border-radius: 4px; margin-top: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.vehicle-badge-small { display: inline-block; color: white; font-size: 10px; padding: 2px 6px; border-radius: 3px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; }
.popup-body { padding: 15px; background: #fff; }
.popup-body h4 { margin-top: 0; margin-bottom: 10px; font-size: 14px; font-weight: 700; color: #333; }
.info-row { font-size: 14px; color: #333; display: flex; align-items: center; justify-content: space-between; }

/* === POPUP ACTION BUTTONS STYLING === */
.popup-actions { 
    display: flex; 
    gap: 8px;
    padding: 10px 15px 15px; 
    background: #fff; 
}
.popup-btn { 
    flex: 1;
    padding: 10px 5px; 
    text-align: center; 
    text-decoration: none; 
    font-size: 11px;
    font-weight: 700 !important;
    color: #fff !important;
    background: #111; 
    transition: background 0.2s; 
    border-radius: 4px; 
    text-transform: uppercase;
    white-space: nowrap;
}

/* Specific styling for the three new buttons */
.popup-btn.directions { 
    background: #C3002F; 
}
.popup-btn.directions:hover { 
    background: #a30027; 
}
.popup-btn.keep-informed {
    background: #007bff; 
}
.popup-btn.keep-informed:hover {
    background: #0056b3;
}
.popup-btn.rsvp { 
    background: #28a745; 
}
.popup-btn.rsvp:hover {
    background: #1e7e34;
}

/* --- LEGEND (Desktop Style) --- */
.legend {
    position: absolute; bottom: 30px; left: 20px; z-index: 1000;
    background: white; padding: 15px; border-radius: 8px;
    font-size: 13px; box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease-in-out;
    opacity: 0;

}
.legend.visible {   
    opacity: 1;
}
.legend-item { display: flex; align-items: center; margin-bottom: 8px; font-weight: 700; }
.legend-item svg{margin-right: 8px;}
.dot { width: 12px; height: 3px; display: inline-block; margin-right: 10px; }

/* --- Footer Note Style --- */
.footer-note {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 5px 0;
    background: #111;
    color: #ddd;
    text-align: center;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 1001;
}
.footer-note a {
    color: inherit; /* Inherit the #ddd color */
    text-decoration: none;
    transition: color 0.2s;
}
.footer-note a:hover {
    color: #C3002F; /* Highlight color on hover */
    text-decoration: underline;
}
/* --- End Footer Note Style --- */

/* IMPROVEMENT 7: Consistent box-sizing for all elements */
*, *::before, *::after {
    box-sizing: border-box;
}

/* --- Media Query for Smaller Screens (Mobile) --- */
@media (max-width: 600px) {

    #legend-internal-toggle:hover{
        background: #111 !important;
    }

    .legend-item-wrap{
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }

    #map {
        padding-top: 75px;
        /* Adjust map height to account for the fixed footer on mobile */
        height: calc(100vh - 25px); 
    }
    .footer-note {
        padding: 3px 0;
    }

    .header-card {
        top: 0;
        left: 0;
        right: 0;
        max-width: none;
        border-radius: 0 0 12px 12px;
        border-left: none;
        border-top: 6px solid #C3002F;
        
    }

    .header-card.collapsed {
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    }

    .mobile-toggle-btn {
        display: block;
    }

    .header-card h1 {
        font-size: 18px;
        max-width: 60% !important;
    }

    /* HIDE FILTERS AND INFO BY DEFAULT ON MOBILE */
    .collapsible-content {
        max-height: 0;
        opacity: 0;
        padding-top: 0;
        margin-top: 0;
        overflow: hidden;
    }

    /* SHOW FILTERS AND INFO WHEN TOGGLED */
    .collapsible-content.visible {
        max-height: 500px;
        opacity: 1;
        padding-top: 10px;
        margin-top: 0;
    }

    /* Filters arrangement on mobile */
    .filters {
        flex-direction: column;
        gap: 15px;
    }
    .filters > div {
        min-width: 100%;
        flex-grow: 1;
    }



    /* Clear button and Legend Toggle below filters on mobile */
    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .action-buttons {
        margin-top: 10px;
    }

    /* Hide the separate legend toggle button on mobile (now inside the dialog) */
    .legend-toggle-btn {
        display: none;
    }

    /* Mobile Legend Positioning (Off-screen by default) */
    .legend {
        bottom: -200px;
        left: 0;
        right: 0;
        padding: 0 15px;
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        border-radius: 8px 8px 0 0;
        border-bottom: none;
    }

    /* Mobile Legend Visible State */
    .legend.visible {
        bottom: 25px; /* Push up by the footer height */
        max-height: 300px;
        padding: 15px;
        opacity: 1;
    }

    /* Ensure leaflet controls are not covered by the button/legend */
    .leaflet-bottom.leaflet-right {
        bottom: 25px !important; /* Push up by the footer height */
    }

    .on-tour-label {
        top: -30px;
        left: 18px;
    }
}

