/*
 * Color Palette
 * Blue:   #0046AB (primary)
 * Green:  #009A02 (accent)
 * Yellow: #FECD00 (reserved)
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #0a1628;
    color: #f0f4f8;
}

header {
    background: linear-gradient(to bottom, #0046AB 0%, #1e5fbb 100%);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 2.2rem;
}

h1 {
    font-size: 1.7rem;
    font-weight: 700;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

h1 span {
    font-weight: 300;
    opacity: 0.9;
}

/* Header search */
.header-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    height: 40px;
    padding: 0 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.header-btn:hover {
    background: rgba(255,255,255,0.25);
}

.header-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.header-btn .fa-chevron-down {
    font-size: 0.7rem;
    opacity: 0.7;
}

/* Language Toggle */
.lang-toggle {
    display: flex;
    background: rgba(255,255,255,0.15);
    border-radius: 20px;
    overflow: hidden;
}

.lang-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.7);
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-btn:hover {
    color: #fff;
}

.lang-btn.active {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

.header-select {
    position: relative;
}

.header-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    min-width: 180px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1001;
}

.header-select.open .header-dropdown {
    display: block;
}

.header-option {
    padding: 0.6rem 1rem;
    color: #0a1628;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.header-option:hover {
    background: #f0f4f8;
}

.header-option.selected {
    background: #0046AB;
    color: white;
}

.header-option-group {
    padding: 0.4rem 1rem 0.25rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: #666;
    background: #f8f9fa;
    border-top: 1px solid #e5e7eb;
    letter-spacing: 0.03em;
    cursor: default;
    pointer-events: none;
}

.header-search {
    display: flex;
    align-items: center;
    gap: 0;
}

.search-toggle {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-toggle:hover {
    background: rgba(255,255,255,0.25);
}

.header-search input {
    width: 0;
    padding: 0;
    border: none;
    border-radius: 20px;
    font-size: 0.95rem;
    background: white;
    color: #0a1628;
    opacity: 0;
    transition: all 0.3s ease;
}

.header-search.expanded .search-toggle {
    border-radius: 20px 0 0 20px;
}

.header-search.expanded input {
    width: 200px;
    padding: 0.6rem 1rem;
    opacity: 1;
    border-radius: 0 20px 20px 0;
}

.header-search input:focus {
    outline: none;
}

.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.utility-row {
    background: #0d2240;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.near-me-btn {
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    background: #fff;
    color: #0046AB;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.2s;
    font-weight: 500;
}

.near-me-btn:hover {
    background: #f0f4f8;
}

.near-me-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Custom dropdown */
.custom-select {
    position: relative;
    min-width: 160px;
}

.custom-select-trigger {
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    background: #fff;
    color: #0a1628;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.custom-select-trigger::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #0a1628;
    margin-left: 0.75rem;
}

.custom-select.open .custom-select-trigger::after {
    border-top: none;
    border-bottom: 6px solid #0a1628;
}

.custom-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
}

.custom-select.open .custom-options {
    display: block;
}

.custom-option {
    padding: 0.6rem 1rem;
    cursor: pointer;
    color: #0a1628;
}

.custom-option:hover {
    background: #e8f0fe;
}

.custom-option.selected {
    background: #0046AB;
    color: white;
}

#map {
    position: relative;
    width: 100%;
    height: calc(100vh - 55px);
}

.reset-map-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #0046AB;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s;
}

.reset-map-btn:hover {
    background: #f0f4f8;
    box-shadow: 0 2px 15px rgba(0,0,0,0.25);
}

/* Custom marker */
.pupusa-marker {
    background: #0046AB;
    border: 3px solid white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* Popup styles */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    background: #fff;
}

.leaflet-popup-content {
    margin: 0;
    min-width: 250px;
}

.popup-content {
    padding: 1rem;
}

.popup-content h3 {
    color: #0046AB;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.popup-content .address {
    color: #222222;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.popup-content .meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.popup-content .meta-item {
    font-size: 0.8rem;
    color: #222222;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.popup-content .meta-item a {
    color: #222222;
    text-decoration: none;
}

.popup-content .meta-item a:hover {
    color: #0046AB;
}

.popup-content .rating {
    background: #f0f0f0;
    color: #222222;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
}

.popup-content .rating i {
    color: #FECD00;
}

.popup-content .links {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.popup-content .links a {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: opacity 0.2s;
}

.popup-content .links a:hover {
    opacity: 0.85;
}

.popup-content .links .directions {
    background: #0046AB;
    color: white;
    border: none;
}

.popup-content .links .directions:hover {
    background: #003d94;
    color: white;
}

.popup-content .links .website {
    background: #009A02;
    color: white;
    border: none;
}

.popup-content .links .website:hover {
    background: #007a02;
    color: white;
}

/* Food truck schedule in popup */
.food-truck-info {
    border-top: 1px solid #e5e7eb;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
}

.ft-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #b45309;
    margin-bottom: 0.25rem;
}

.ft-status {
    font-size: 0.8rem;
    color: #4b5563;
    margin-bottom: 0.5rem;
}

.ft-schedule {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ft-slot {
    display: flex;
    flex-direction: column;
    font-size: 0.75rem;
    padding: 4px 6px;
    border-radius: 5px;
    color: #6b7280;
}

.ft-slot-active {
    background: #fef3c7;
    color: #374151;
}

.ft-time {
    font-weight: 600;
}

.ft-addr {
    color: #9ca3af;
    font-size: 0.7rem;
}

.ft-slot-active .ft-addr {
    color: #6b7280;
}

/* Cluster styles */
.marker-cluster-small {
    background-color: rgba(13, 148, 136, 0.6);
}
.marker-cluster-small div {
    background-color: rgba(13, 148, 136, 0.9);
}
.marker-cluster-medium {
    background-color: rgba(0, 70, 171, 0.6);
}
.marker-cluster-medium div {
    background-color: rgba(0, 70, 171, 0.9);
}
.marker-cluster-large {
    background-color: rgba(0, 154, 2, 0.6);
}
.marker-cluster-large div {
    background-color: rgba(0, 154, 2, 0.9);
}

.location-meta {
    color: #777;
    font-size: 0.75rem;
    text-transform: capitalize;
}

.marker-cluster {
    background-clip: padding-box;
    border-radius: 50%;
}
.marker-cluster div {
    width: 30px;
    height: 30px;
    margin-left: 5px;
    margin-top: 5px;
    text-align: center;
    border-radius: 50%;
    font: 12px "Helvetica Neue", Arial, Helvetica, sans-serif;
    color: white;
    font-weight: 700;
    line-height: 30px;
}

/* Loading state */
.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    text-align: center;
    color: #0a1628;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e8f0fe;
    border-top-color: #0046AB;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mobile Search Overlay */
.mobile-search-overlay {
    display: none;
}

@media (max-width: 768px) {
    .mobile-search-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        background: linear-gradient(to bottom, #0046AB 0%, #1e5fbb 100%);
        padding: 0.5rem 0.75rem;
        z-index: 1002;
        transform: translateY(-100%);
        transition: transform 0.3s ease;
        box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    }
    
    .mobile-search-overlay.open {
        transform: translateY(0);
    }
    
    .mobile-search-inner {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        background: white;
        border-radius: 20px;
        padding: 0.5rem 1rem;
    }
    
    .mobile-search-inner i.fa-magnifying-glass {
        color: #666;
        font-size: 0.9rem;
    }
    
    .mobile-search-inner input {
        flex: 1;
        border: none;
        font-size: 1rem;
        color: #0a1628;
        background: transparent;
        outline: none;
    }
    
    .mobile-search-inner input::placeholder {
        color: #999;
    }
    
    .mobile-search-close {
        background: none;
        border: none;
        color: #666;
        font-size: 1.1rem;
        cursor: pointer;
        padding: 0.25rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .mobile-search-close:hover {
        color: #333;
    }

    header {
        padding: 0.4rem 0.75rem;
    }
    
    h1 {
        font-size: 1.3rem;
    }
    
    .logo-icon {
        font-size: 1.8rem;
    }
    
    .header-controls {
        gap: 0.3rem;
    }
    
    .header-btn {
        height: 36px;
        padding: 0 0.6rem;
        font-size: 0.8rem;
    }
    
    .header-btn span {
        display: none;
    }
    
    .search-toggle {
        width: 36px;
        height: 36px;
    }
    
    /* Hide inline search expansion on mobile - use overlay instead */
    .header-search.expanded input {
        width: 0;
        padding: 0;
        opacity: 0;
    }
    
    .header-search.expanded .search-toggle {
        border-radius: 20px;
    }
    
    .lang-toggle {
        border-radius: 18px;
    }
    
    .lang-btn {
        padding: 0.4rem 0.5rem;
        font-size: 0.7rem;
    }
    
    #map {
        height: calc(100vh - 50px);
    }
}

/* Footer */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #0046AB;
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    font-size: 0.8rem;
    color: #fff;
    z-index: 1000;
}

footer a {
    color: #fff;
    text-decoration: none;
}

footer a:hover {
    color: #FECD00;
}

.footer-about-btn {
    background: rgba(255,255,255,0.15);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    border: none;
    color: #fff;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: background 0.2s, color 0.2s;
}

.footer-about-btn:hover {
    background: rgba(255,255,255,0.25);
    color: #FECD00;
}

/* Info Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: #fff;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.modal-close:hover {
    background: #0046AB;
    color: #fff;
}

.modal-header {
    background: linear-gradient(135deg, #0046AB 0%, #003380 100%);
    color: #fff;
    padding: 1.5rem;
    text-align: center;
    border-radius: 16px 16px 0 0;
}

.modal-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.modal-tagline {
    margin: 0.5rem 0 0;
    font-size: 1rem;
    opacity: 0.9;
    font-style: italic;
}

.modal-body {
    padding: 1.5rem;
}

.modal-body p {
    margin: 0 0 1rem;
    line-height: 1.6;
    color: #333;
}

.modal-body h3 {
    font-size: 1.1rem;
    color: #0046AB;
    margin: 1.5rem 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-body h3 i.icon-map {
    color: #FECD00;
}

.modal-body h3 i.icon-heart {
    color: #e53935;
}

.modal-body ul {
    margin: 0 0 1rem;
    padding-left: 1.25rem;
}

.modal-body li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
    color: #444;
}

.modal-footer-text {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

.modal-footer-text a {
    color: #0046AB;
    font-weight: 600;
}

.modal-footer-text a:hover {
    color: #009A02;
}

.modal-coffee-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: #009A02;
    color: #fff;
    padding: 0.75rem 1.25rem;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 600;
    margin: 1rem auto 0;
    transition: background 0.2s, transform 0.2s;
}

.modal-coffee-btn:hover {
    background: #007a01;
    transform: translateY(-2px);
}

.modal-coffee-btn i {
    font-size: 1.1rem;
}

/* Sociologists Mode */
.sociologists-badge {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: rgba(10, 22, 40, 0.9);
    color: #FECD00;
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border: 1px solid rgba(254, 205, 0, 0.6);
    pointer-events: none;
    white-space: nowrap;
}

.choropleth-legend {
    position: absolute;
    bottom: 50px;
    left: 10px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    min-width: 165px;
}

.legend-title {
    font-weight: 700;
    color: #0a1628;
    margin-bottom: 0.5rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.legend-scale {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: #333;
    font-size: 0.75rem;
}

.legend-item span {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 2px;
    border: 1px solid rgba(0,0,0,0.15);
    flex-shrink: 0;
}
