/* Basic Reset & Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* Using a more neutral background */
    background-color: #f4f4f5; /* Light Gray */
    color: #1f2937; /* Dark Gray Text */
}

/* Header Styles */
header {
    /* Using a neutral dark header */
    background-color: #1f2937; /* Dark Gray */
    color: white;
    padding: 0.5rem 1rem;
    display: flex;
    flex-direction: column; /* Stack title and controls on small screens */
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 1.3rem; /* Slightly smaller */
    margin-bottom: 0;
    display: flex; /* Align icon and text */
    align-items: center;
    gap: 0.5rem; /* Space between icon and text */
    text-align: center;
}
header h1 i {
    /* Styles for the icon within the h1 if needed (handled by inline style in JS now) */
    /* margin-right: 0.5rem; */
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9em; /* Make icon slightly smaller than text */
}

.controls {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.controls label {
    font-weight: bold;
    color: #e5e7eb; /* Light gray text */
}

.controls select {
    padding: 0.4rem 0.6rem;
    border: 1px solid #9ca3af; /* Medium Gray border */
    border-radius: 4px;
    background-color: #f9fafb; /* Very light gray */
    color: #1f2937; /* Dark gray text */
    font-size: 0.9rem;
    cursor: pointer;
}
.controls select:focus {
    outline: 2px solid #3b82f6; /* Blue focus ring */
    outline-offset: 1px;
}


/* Main Content Area */
main {
    flex-grow: 1; /* Takes up available space */
    display: flex;
    flex-direction: column;
    position: relative; /* Needed if status overlays */
}

/* Status Indicator */
#status {
    padding: 0.75rem 1rem;
    background-color: #e0e7ff; /* Light Indigo */
    border-bottom: 1px solid #c7d2fe; /* Indigo border */
    color: #3730a3; /* Dark Indigo */
    text-align: center;
    font-weight: bold;
    font-size: 0.9rem;
}

#status.error {
    background-color: #fecaca; /* Light Red */
    color: #b91c1c; /* Dark Red */
    border-bottom: 1px solid #f87171;
}

/* Map Container */
#map {
    flex-grow: 1; /* Map fills the remaining space in main */
    min-height: 400px; /* Ensure map has a minimum height */
    background-color: #e5e7eb; /* Placeholder background */
    position: relative;
}

/* Style for the Create Safety Card button */
.create-card-button {
    display: block;
    width: calc(100% - 2rem);
    margin: 1rem auto;
    padding: 0.75rem;
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.create-card-button:hover {
    background-color: #1d4ed8;
}

.create-card-button:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
}

/* Footer Styles */
footer {
    background-color: #374151; /* Medium-Dark Gray */
    color: #d1d5db; /* Gray text */
    padding: 1rem;
    font-size: 0.8rem;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
}

#results-summary {
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #4b5563; /* Darker Gray border */
}

#results-summary h2 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: white;
}

#facility-list {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1rem;
}

@media (min-width: 768px) {
    #facility-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

#facility-list li {
    padding: 0;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    opacity: 0.8;
}

#facility-list li:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    opacity: 0.9;
}

#facility-list li.selected {
    opacity: 1;
    border-color: #ffffff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5), 0 4px 8px rgba(0, 0, 0, 0.15);
    animation: selectedPulse 1s ease-in-out;
}

@keyframes selectedPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.4),
                    0 0 0 20px rgba(255, 255, 255, 0.2),
                    0 0 0 30px rgba(255, 255, 255, 0.1);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

#facility-list li.selected::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background-color: rgba(255, 255, 255, 0.9);
    color: #1f2937;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2em;
    animation: checkmarkAppear 0.5s ease-out;
}

@keyframes checkmarkAppear {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    100% {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

#facility-list li .card-content {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

#facility-list li.selected .card-content {
    transform: scale(1.02);
}

#facility-list li .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

#facility-list li .logo {
    width: 100%;
    height: 100px;
    object-fit: contain;
    margin-bottom: 0.5rem;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

#facility-list li .card-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

#facility-list li span {
    display: block;
}

#facility-list li span.rank {
    font-weight: bold;
    font-size: 1.2em;
    opacity: 0.9;
}

#facility-list li span.category {
    display: inline-block;
    padding: 2px 6px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-size: 0.8em;
}

#facility-list li span.name {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 0.25rem;
}

#facility-list li span.distance,
#facility-list li span.phone,
#facility-list li span.address {
    font-size: 0.9em;
    opacity: 0.9;
}

#facility-list li span.rating {
    color: #fbbf24; /* Amber color for stars */
    font-weight: bold;
}

#facility-list li .hours {
    font-size: 0.85em;
    opacity: 0.8;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

#facility-list li .hours strong {
    display: block;
    margin-bottom: 0.25rem;
}

#no-results {
    text-align: center;
    font-style: italic;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background-color: #4b5563;
    border-radius: 4px;
    color: #f9fafb;
}

.disclaimer {
    text-align: center;
    font-style: italic;
    color: #9ca3af; /* Medium Gray */
    margin-top: 0.5rem;
}

/* Utility Class */
.hidden {
    display: none;
}

/* Responsiveness */
@media (min-width: 600px) {
    header {
        flex-direction: row; /* Title and controls side-by-side */
        justify-content: space-between;
    }
    header h1 {
        font-size: 1.5rem;
        text-align: left;
    }
     .controls {
        align-items: center;
    }
}

@media (max-width: 400px) {
     header h1 {
        font-size: 1.1rem; /* Smaller title on very small screens */
    }
     .controls label {
         font-size: 0.85rem;
     }
     .controls select {
         font-size: 0.85rem;
     }
}


/* --- Style for Google Maps InfoWindow Content --- */
.info-window-content {
    font-family: sans-serif;
    line-height: 1.5;
    max-width: 280px; /* Prevent wide info windows */
}

.info-window-content h3 {
    margin: 0 0 5px 0;
    font-size: 1.1em;
    color: #111827; /* Very Dark Gray */
}

.info-window-content p {
    margin: 4px 0;
    font-size: 0.9em;
    color: #374151; /* Medium-Dark Gray */
}

.info-window-content strong {
    color: #1f2937; /* Dark Gray */
    margin-right: 4px;
}

.info-window-content a {
    color: #2563eb; /* Blue link */
    text-decoration: none;
}
.info-window-content a:hover {
    text-decoration: underline;
}

.info-window-content .rating {
    color: #f59e0b; /* Amber for rating stars */
    font-weight: bold;
}

.info-window-content small {
    font-size: 0.8em;
    color: #6b7280; /* Medium gray for hours */
    line-height: 1.3;
}

/* --- User Marker Style --- */
.user-marker {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #3b82f6; /* Blue */
    border: 2px solid white;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    /* Animation for pulsing effect */
    animation: pulse 1.5s infinite ease-in-out;
}

/* Keyframes for the pulse animation */
@keyframes pulse {
    0% {
        transform: scale(0.9);
        opacity: 0.9;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(0.9);
        opacity: 0.9;
    }
}

/* Add these styles */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    padding: 0.5rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.checkbox-item input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

.checkbox-item label {
    color: #e5e7eb;
    cursor: pointer;
    font-size: 0.9rem;
}

/* Add these styles at the end of the file */

.map-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    z-index: 1000;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    animation: sparkle 2s infinite;
}

@keyframes sparkle {
    0% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 255, 255, 0.6),
                    0 0 40px rgba(255, 255, 255, 0.4),
                    0 0 50px rgba(255, 255, 255, 0.2);
    }
    100% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    }
}

.map-overlay span {
    display: inline-block;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* Enhance marker highlighting */
.marker-highlight {
    animation: markerPulse 1.5s infinite;
    z-index: 1000 !important;
    opacity: 1 !important;
}

@keyframes markerPulse {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.8));
    }
    50% {
        transform: scale(1.3);
        filter: drop-shadow(0 0 15px rgba(255, 255, 255, 1));
    }
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.8));
    }
}

/* Add these styles at the end of the file */

.marker-transparent {
    opacity: 0.4;
    transition: opacity 0.3s ease;
}
