/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}



/* Header and info banner */
.header {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1000;
}

.info-banner {
    background: #f0f9ff;
    border-bottom: 1px solid #e0f2fe;
    padding: 0.75rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: #0369a1;
}

.banner-emoji {
    font-size: 1.4em;
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
}

.search-container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    gap: 1rem;
    padding: 1rem;
    align-items: center;
}

.search-group {
    flex: 1;
    position: relative;
    min-width: 0;
}

.search-input {
    width: 100%;
    padding: 0.75rem;
    padding-left: 2.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    background: white;
    height: 48px;
}

.search-input:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0,102,204,0.1);
}

/* Buttons */
.button-group {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

button, .add-button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    font-size: 1rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s, transform 0.1s;
    height: 48px;
}

button:active, .add-button:active {
    transform: translateY(1px);
}

.location-button {
    background: #0066cc;
    color: white;
}

.location-button:hover {
    background: #0052a3;
}

.add-button {
    background: #28a745;
    color: white;
}

.add-button:hover {
    background: #218838;
}

/* Map container */
.map-container {
    flex: 1;
    position: relative;
    width: 100%;
    min-height: 0;
}

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

/* Map markers and popups */
.user-location-marker {
    color: #0066cc;
    font-size: 2rem;
    text-align: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}


.changing-table-marker {
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    text-align: center;
    width: 36px !important; /* Force width */
    height: 36px !important; /* Force height */
    display: flex !important; /* Force flex */
    align-items: center !important;
    justify-content: center !important;
}

.changing-table-marker i {
    color: #28a745;
    font-size: 1.5rem;
    display: flex !important; /* Force flex on the icon */
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
}

/* Popup close button */
.leaflet-popup-close-button {
    position: absolute;
    right: 8px !important;
    top: 8px !important;
    width: 32px !important;
    height: 32px !important;
    font-size: 24px !important;
    padding: 4px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    color: #666 !important;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.leaflet-popup-close-button:hover {
    background-color: #f5f5f5 !important;
    color: #333 !important;
    text-decoration: none;
}

/* Place popup styles */
.place-popup {
    min-width: 240px;
    padding: 0.75rem;
    padding-right: 1.5rem;
}

.place-popup h3 {
    margin: 0 0 1rem 0;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #333;
    padding-bottom: 0.75rem;
    padding-right: 1.5rem;
    border-bottom: 1px solid #eee;
}

.place-popup h3 i {
    font-size: 1.3em;
    color: #666;
}

.info-section {
    margin-bottom: 1rem;
}

.facility-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.5rem 0;
    color: #555;
}

.facility-info i {
    font-size: 1.2em;
    color: #666;
    width: 1.2em;
    text-align: center;
}

.actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin: 1rem 0;
}

.action-button {
    padding: 0.5rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: #f5f5f5;
    color: #333;
    transition: background-color 0.2s;
    border: 1px solid #e5e7eb;
}

.action-button:hover {
    background: #e5e5e5;
}

.action-button i {
    font-size: 1.1em;
}

.address {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.address-content {
    display: flex;
    gap: 0.75rem;
    color: #666;
}

.address-content i {
    font-size: 1.2em;
    margin-top: 0.2rem;
}

/* Search results */
.search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.search-results.active {
    display: block;
}

.search-result {
    padding: 0.75rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.search-result:hover {
    background: #f5f5f5;
}

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

.search-result i {
    color: #666;
    font-size: 1.2em;
}

.search-result-content {
    flex: 1;
}

.search-result small {
    color: #666;
    display: block;
    margin-top: 0.25rem;
}

/* MarkerCluster custom styles */
.marker-cluster {
    background-clip: padding-box;
    border-radius: 25px;
}

.marker-cluster div {
    width: 40px;
    height: 40px;
    margin-left: 5px;
    margin-top: 5px;
    text-align: center;
    border-radius: 20px;
    font: 14px "Helvetica Neue", Arial, Helvetica, sans-serif;
    background-color: white;
    border: 2px solid #28a745;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Loading state */
.search-input.loading {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .search-container {
        flex-direction: column;
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .search-group {
        width: 100%;
    }

    .button-group {
        width: 100%;
        display: flex;
    }

    .button-group button,
    .button-group .add-button {
        flex: 1;
        padding: 0.75rem;
        justify-content: center;
    }

    .place-popup {
        max-width: 280px;
    }
}

@media (max-width: 320px) {
    .actions {
        grid-template-columns: 1fr;
    }
}