@import url('https://fonts.googleapis.com/css2?family=Lato&display=swap');

/*--------------------------------------------------------------
  CSS Variables & Theme
--------------------------------------------------------------*/
:root {
    --font-family: "Lato", sans-serif;
    /* Use more neutral defaults that work with most themes to reduce flash */
    --primary-color: #002d62;
    --secondary-color: #404040;
    --tertiary-color: #c4122f;
    --title-text-color: #fff;
    --button-bg-color: #c4122f;
    --button-text-color: white;
    --background-color: #fff;
    
    /* Add transition for smoother color changes */
    --color-transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

/*--------------------------------------------------------------
  Global Resets
--------------------------------------------------------------*/

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font: 400 16px/1.6 var(--font-family);
    background-color: var(--background-color);
    color: var(--secondary-color);
    transition: var(--color-transition);
}

body.loading {
    cursor: wait;
}

/*--------------------------------------------------------------
  Input & Custom Scrollbar
--------------------------------------------------------------*/
#locationSearch {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: none;
    border-bottom: 2px solid var(--primary-color);
    outline: none;
    margin-bottom: 20px;
    transition: var(--color-transition);
}

#locationSearch:focus {
    border-bottom-color: var(--tertiary-color);
}

::-webkit-scrollbar {
    width: 8px;
}

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

/*--------------------------------------------------------------
  Images & Links
--------------------------------------------------------------*/
img {
    height: 103px;
    width: 133px;
    padding: 10px;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--tertiary-color);
    text-decoration: underline;
}

/*--------------------------------------------------------------
  Layout - Map & Overlay Sidebar
--------------------------------------------------------------*/
/* The map now fills the entire viewport */
.map {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 0;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease-in;
}

.map.visible {
    opacity: 1;
}

/* The sidebar overlays the map with fixed margins */
.sidebar {
    position: fixed;
    top: 20px;
    bottom: 20px;
    left: 20px;
    width: 320px;
    max-width: 90%;
    background-color: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    z-index: 100;
    -webkit-overflow-scrolling: touch;
}

.sidebar::-webkit-scrollbar {
    display: none;
}

/*--------------------------------------------------------------
  Headings & Listings
--------------------------------------------------------------*/
.heading {
    background: var(--primary-color);
    padding: 15px;
    border-radius: 5px;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    z-index: 101;
    top: 0;
    transition: var(--color-transition);
}

.heading h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--title-text-color);
    cursor: pointer;
    transition: var(--color-transition);
}

/* Mobile toggle button */
.mobile-toggle {
    display: none;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border: 2px solid var(--title-text-color);
    cursor: pointer;
    transition: background 0.3s, transform 0.3s;
}

.mobile-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.mobile-toggle::after {
    content: '\f078'; /* Font Awesome down arrow */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--title-text-color);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    transition: transform 0.3s;
}

.mobile-toggle.active::after {
    transform: translate(-50%, -50%) rotate(180deg);
}

/* Content wrapper for search and listings */
.sidebar-content {
    transition: max-height 0.4s ease-out, opacity 0.3s ease-out;
    overflow: hidden;
}

.listings {
    margin: 0;
    padding: 0 15px;
    list-style: none;
}

.listings .item {
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 10px;
    margin-bottom: 10px;
    transition: background 0.3s, transform 0.3s;
    cursor: pointer;
}

.listings .item:hover {
    background: #f9f9f9;
    transform: translateX(2px);
}

.listings .item .title {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 5px;
    transition: var(--color-transition);
}

.listings .item .title small {
    font-weight: 400;
    color: var(--secondary-color);
    transition: var(--color-transition);
}

.listings .item.active {
    background-color: #f8f8f8;
    transition: var(--color-transition);
}

.listings .item.active .title,
.listings .item .title:hover {
    color: var(--tertiary-color);
    transition: var(--color-transition);
}

/*--------------------------------------------------------------
  Buttons & Custom Elements
--------------------------------------------------------------*/
.button {
    background-color: var(--button-bg-color);
    color: var(--button-text-color);
    padding: 5px;
    text-align: center;
    font-size: 12px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    border-radius: 3px;
    transition: var(--color-transition);
}

.button:hover {
    opacity: 0.8;
    transition: var(--color-transition);
}

.custom-marker {
    background-size: cover;
    width: 30px;
    height: 40px;
    cursor: pointer;
    border-radius: 5px;
}

/*--------------------------------------------------------------
  Popup Styles (Map Popups)
--------------------------------------------------------------*/
.maplibregl-popup-close-button {
    display: none;
}

.maplibregl-popup-content {
    font: 400 15px/22px var(--font-family);
    padding: 0;
    width: 365px;
    height: 150px;
}

.maplibregl-popup-content h3 {
    background: var(--primary-color);
    color: var(--title-text-color);
    margin: 0;
    padding: 10px;
    border-radius: 3px 3px 0 0;
    font-weight: 700;
    margin-top: -15px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.maplibregl-popup-content h4 {
    margin: 0;
    padding: 10px 10px;
    font-weight: 400;
}

.maplibregl-popup-anchor-top>.maplibregl-popup-content {
    margin-top: 15px;
}

.maplibregl-popup-anchor-top>.maplibregl-popup-tip {
    border-bottom-color: var(--popup-border-color);
}

.popup-content {
    position: relative;
}

.popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #fff;
}

/*--------------------------------------------------------------
  Accordion & Panels (for Grouped Lists)
--------------------------------------------------------------*/
.accordion {
    background: #fff;
    border: none;
    border-radius: 5px;
    padding: 12px 15px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
    cursor: pointer;
    transition: var(--color-transition), box-shadow 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 5px;
}

.accordion.active,
.accordion:hover {
    background: #f2f2f2;
}

.school-count {
    background: var(--primary-color);
    color: var(--title-text-color);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

.panel {
    background: #fff;
    border-radius: 5px;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease-out;
    padding: 0 5px;
    margin-bottom: 10px;
}

.hidden {
    display: none !important;
}

/*-----------------------------------------------
  Responsive Toggle Sidebar Using CSS
-----------------------------------------------*/
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 20px;
        bottom: auto;
        left: 20px;
        right: 20px;
        width: auto;
        max-width: none;
        background-color: #fff;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        overflow: visible;
        z-index: 100;
        border-radius: 5px;
        transition: bottom 0.3s ease-out;
    }

    .heading {
        position: relative;
        margin-bottom: 0;
        border-radius: 5px;
        padding: 15px 60px 15px 15px; /* top right bottom left - keep normal left padding, add right padding for toggle */
    }

    .mobile-toggle {
        display: block;
    }

    /* Content wrapper for collapsible content */
    .sidebar-content {
        max-height: 0;
        opacity: 0;
        padding: 0 15px;
        overflow: hidden;
        transition: max-height 0.4s ease-out, opacity 0.3s ease-out, padding 0.3s ease-out;
    }

    .sidebar-content.expanded {
        max-height: calc(100vh - 200px);
        opacity: 1;
        padding: 20px 15px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    #locationSearch {
        margin-top: 0;
    }

    /* Hide the hamburger toggle label since we no longer need it */
    .sidebar-toggle-label {
        display: none;
    }

    /* Optionally, remove (or hide) the close button if it exists */
    .sidebar .sidebar-close-label {
        display: none;
    }

    /* Adjust the popup width if desired */
    .maplibregl-popup-content {
        width: 320px;
    }
}

/*--------------------------------------------------------------
  Loading States
--------------------------------------------------------------*/
.loading-spinner {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
}

body.loading .loading-spinner {
    display: block;
}

.loading-spinner::after {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    margin: 8px;
    border-radius: 50%;
    border: 6px solid var(--primary-color);
    border-color: var(--primary-color) transparent var(--primary-color) transparent;
    animation: loading-spin 1.2s linear infinite;
}

@keyframes loading-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/*--------------------------------------------------------------
  Additional Elements (Dropdowns & Detail Tables)
--------------------------------------------------------------*/
.dropdown-table {
    margin-top: 15px;
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #ccc;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dropdown-table td {
    padding: 8px;
    vertical-align: middle;
}

.dropdown-table a {
    transition: color 0.3s;
}

.dropdown-table a:hover {
    color: var(--tertiary-color);
}

.location-details {
    margin-top: 10px;
}

.location-details p {
    margin: 5px 0;
    font-size: 14px;
    color: var(--secondary-color);
}

.location-details .address {
    font-weight: 500;
}

.location-details .phone {
    color: var(--primary-color);
}

.location-links {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.location-links a {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    transition: background-color 0.3s;
}

.location-links a:hover {
    background-color: var(--tertiary-color);
    text-decoration: none;
}

/*--------------------------------------------------------------
  No Results Message
--------------------------------------------------------------*/
.no-results {
    padding: 40px 20px;
    text-align: center;
    color: var(--secondary-color);
}

.no-results-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.no-results-content i {
    font-size: 48px;
    color: var(--primary-color);
    opacity: 0.5;
}

.no-results-content p {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: var(--secondary-color);
}

/*--------------------------------------------------------------
  Marker Preview Error State
--------------------------------------------------------------*/
.marker-preview-error {
    border: 2px solid #ef4444 !important;
    border-radius: 4px;
    background-color: #fef2f2;
}

.marker-preview-error img {
    opacity: 0.7;
    filter: grayscale(20%);
}

.marker-preview-error .btn-danger {
    background-color: #ef4444;
    border-color: #ef4444;
    font-weight: 600;
    animation: pulse-danger 2s infinite;
}

@keyframes pulse-danger {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
} 