/* FireSmart Map Plugin Frontend Styles */

/* Import Open Sans font for consistent typography */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,300;1,400;1,500;1,600;1,700;1,800&display=swap');

/* Set Open Sans as the default font family for the plugin */
.firesmart-map-container,
.firesmart-map-container * {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

.is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)){
    max-width: 100%;
}

.firesmart-map-container {
    display: grid;
    grid-template-columns: 440px 1fr;
    overflow: hidden;
    min-height: 600px;
}

.firesmart-search-container {
    padding: 25px;
    background: #fff;
    min-height: 600px;
}

.firesmart-search-container h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #212529;
    font-size: 1.3rem;
    line-height: 1.3;
    font-weight: 700;
}

.search-box {
    display: flex;
    margin-bottom: 20px;
    align-items: stretch;
    position: relative;
}

#firesmart-search-input {
    flex: 1;
    padding: 12px 16px;
    background-color: #F8FAFE;
    border: 2px solid #E8E9ED;
    border-right: none;
    border-radius: 30px 0 0 30px;
    font-size: 16px;
    outline: none;
    color: #212529;
    height: 48px;
    box-sizing: border-box;
}

#firesmart-search-input::placeholder {
    color: #A1A1A1;
}

#firesmart-search-button {
    padding: 12px 30px;
    background-color: #212529;
    color: #efca00;
    border-radius: 0 30px 30px 0;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s ease;
    height: 48px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    outline: none;
}

#firesmart-search-button:hover {
    background-color: #efca00;
    color: #212529;
}

#firesmart-map {
    height: 100%;
}

#firesmart-search-results {
    color: #212529;
    font-size: 1.1rem;
    line-height: 1.3;
    font-weight: 700;
    position: absolute;
    top: calc(100% + 15px);
    left: 0;
    right: 0;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#firesmart-search-results.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.results-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border-radius: 5px;
    overflow: hidden;
    background-color: #F8FAFE;
    box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
}

.result-item {
    padding: 12px 15px;
    border-bottom: 1px solid #E8E9ED;
    cursor: pointer;
    transition: background-color 0.2s;
}

.result-item:last-child {
    border-bottom: none;
}

.result-item:hover {
    background-color: #212a34;
}

.result-item:hover .result-name {
    color: #efca00;
}

.result-name {
    font-size: 14px;
    color: #212529;
    font-weight: 400;
}

.search-result-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}

.search-result-item:hover {
    background-color: #f9f9f9;
}

.search-result-item:last-child {
    border-bottom: none;
}

/* No results message styling */
.no-results-message {
    padding: 0;
    margin-top: 15px;
    color: #212529;
    font-size: 16px;
    font-weight: 400;
    text-align: left;
}

/* Loading message styling */
.loading-message {
    padding: 0;
    margin-top: 15px;
    color: #212529;
    font-size: 16px;
    font-weight: 400;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Location status styling */
#firesmart-location-status {
    margin-top: 10px;
}

.location-status {
    padding: 0;
}

.location-status h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.location-status-success h3 {
    color: #212529;
}

.location-status-warning h3 {
    color: #212529;
}

.location-status p {
    margin: 0;
    color: #212529;
    font-size: 14px;
    font-weight: 400;
}

.location-status .more-info-button {
    margin-top: 15px;
}

.location-status p a:hover {
    color: #efca00;
}

.location-status p a:hover {
    text-decoration: underline;
}

/* Catchment area info styling */
#firesmart-catchment-info {
    margin-top: 15px;
}

.catchment-card {
    padding: 20px;
    border-radius: 5px;
    background-color: #F8FAFE;
    border: 2px solid #E8E9ED;
    margin-bottom: 15px;
}

.catchment-card:last-child {
    margin-bottom: 0;
}

.catchment-card-primary {
    border-color: #efca00;
    box-shadow: 0 2px 8px rgba(239, 202, 0, 0.1);
}

/* Catchment card content styling */
.catchment-title {
    margin: 0;
    color: #212529;
    font-size: 1.1em;
    font-weight: 700;
}

.catchment-description {
    margin: 15px 0;
    color: #212529;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 400;
}

.more-info-button {
    padding: 10px 20px;
    background-color: #efca00;
    color: #212529;
    border-radius: 30px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-sizing: border-box;
    display: inline-block;
    border: none;
    outline: none;
    text-decoration: none;
    transition: background-color 0.2s;
}

.more-info-button:hover {
    background-color: #212529;
    color: #efca00;
}

/* Loading spinner */
.firesmart-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Map popup styling */
.maplibregl-popup {
    max-width: 300px;
}

.maplibregl-popup-content {
    padding: 20px;
    border-radius: 5px;
    background-color: #F8FAFE;
    min-width: 200px;
}

.maplibregl-popup-close-button{
    font-size: 1.2rem;
}

.maplibregl-popup-content h3 {
    margin: 0 0 8px 0;
    color: #212529;
    font-size: 1.2rem;
    font-weight: 700;
}

.maplibregl-popup-content p {
    margin: 15px 0;
    color: #212529;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 400;
}

/* Popup-specific styling for enhanced content */
.popup-description {
    color: #212529 !important;
    line-height: 1.4 !important;
    margin: 10px 0 15px!important;
}

.popup-link {
    padding: 10px 20px;
    background-color: #efca00;
    color: #212529 !important;
    border-radius: 30px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-sizing: border-box;
    display: inline-block;
    border: none;
    outline: none;
    text-decoration: none;
}

.popup-link:hover {
    background-color: #212529;
    color: #efca00 !important;
    text-decoration: none;
}

/* Responsive design */
@media (max-width: 1024px) {
    .firesmart-map-container {
        grid-template-columns: 375px 1fr;
    }
}

@media (max-width: 768px) {
    #firesmart-search-results {
        position: relative;
    }
    .firesmart-map-container {
        grid-template-columns: 1fr;
        grid-template-rows: 400px auto;
        min-height: 500px;
    }
    
    .firesmart-search-container {
        border-right: none;
        border-top: 1px solid #ddd;
        min-height: auto;
        order: 2;
    }
    
    #firesmart-map {
        height: 400px;
        order: 1;
    }
    
    .search-box {
        flex-direction: column;
        gap: 10px;
    }
    
    #firesmart-search-input {
        border-radius: 30px;
        border-right: 2px solid #E8E9ED;
    }
    
    #firesmart-search-button {
        border-radius: 30px;
    }
}

@media (max-width: 480px) {
    .firesmart-map-container {
        min-height: 400px;
    }
    
    .firesmart-search-container {
        padding: 15px;
    }
    
    #firesmart-search-input,
    #firesmart-search-button {
        padding: 10px 14px;
        font-size: 14px;
        height: 42px;
    }
}