/**
 * Custom Styles for Leaflet Map
 * Add these styles to your main CSS or create separate file
 */

/* ====================
   Map Container Styles
   ==================== */

   #contact-map {
    width: 100%;
    height: 100%;
    min-height: 215px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Match contact-us.css height */
.contact-us-info-map {
    height: 215px;
    min-height: 215px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    #contact-map {
        min-height: 215px;
        border-radius: 6px;
    }

    .contact-us-info-map {
        height: 215px;
        min-height: 215px;
    }
}

@media (max-width: 480px) {
    #contact-map {
        min-height: 215px;
    }

    .contact-us-info-map {
        height: 215px;
        min-height: 215px;
    }
}

/* ====================
   Custom Marker Styles
   ==================== */

.custom-marker-icon {
    background: transparent;
    border: none;
    transition: transform 0.3s ease;
}

.custom-marker-icon:hover {
    transform: scale(1.1);
    z-index: 1000 !important;
}

.custom-marker-icon.active {
    animation: markerBounce 0.6s ease;
    z-index: 1001 !important;
}

.custom-marker-icon svg {
    width: 40px;
    height: 40px;
}

.custom-marker-icon svg path {
    fill: #1181D0;
}

.custom-marker-icon.active svg path {
    fill: #1181D0;
}

/* Marker bounce animation */
@keyframes markerBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    25% {
        transform: translateY(-10px);
    }

    50% {
        transform: translateY(-5px);
    }

    75% {
        transform: translateY(-8px);
    }
}

/* ====================
   Popup Styles - Matching Address Card Design
   ==================== */

.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border: 1px solid #E8F5FF;
    background: white;
    padding: 0;
}

.leaflet-popup-content {
    margin: 0;
    padding: 16px;
    font-family: 'Sharp Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-width: 250px;
}

/* Popup heading with icon - matching card style */
.marker-popup {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.marker-popup-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
}

.marker-popup-heading svg {
    flex-shrink: 0;
}

.marker-popup h4 {
    margin: 0;
    color: #1181D0;
    font-size: 20px;
    font-weight: 500;
    line-height: 24px;
    letter-spacing: -0.2px;
}

.marker-popup p {
    margin: 0;
    font-size: 16px;
    font-weight: 400;
    line-height: 22px;
    letter-spacing: 0;
    color: #112954;
}

.leaflet-popup-tip {
    background: white;
    border: 1px solid #E8F5FF;
}

/* Close button styling */
.leaflet-popup-close-button {
    color: #112954 !important;
    font-size: 20px !important;
    padding: 4px 8px !important;
    transition: color 0.2s ease;
    right: 8px !important;
    top: 8px !important;
}

.leaflet-popup-close-button:hover {
    color: #1181D0 !important;
}

/* ====================
   Address Card Interactions
   ==================== */

.contact-us-info-address-card {
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px;
    padding: 20px;
    background: #fff;
    height: 100%;
}
/* 
.contact-us-info-address-card:hover {
    transform: translateY(-4px);
}

.contact-us-info-address-card:active {
    transform: translateY(-2px);
} */

/* Active card state - when clicked and marker is shown */
.contact-us-info-address-card.active {
    background-color: #f0f8ff;
    border: 2px solid #1181D0;
    animation: cardHighlight 0.5s ease;
}

/* Legacy highlighted class for backwards compatibility */
.contact-us-info-address-card.highlighted {
    background-color: #f0f8ff;
    border: 2px solid #1181D0;
    animation: cardHighlight 0.5s ease;
}

@keyframes cardHighlight {
    0% {
        background-color: #fff;
    }

    50% {
        background-color: #e6f4ff;
    }

    100% {
        background-color: #f0f8ff;
    }
}

/* ====================
   Zoom Controls
   ==================== */

.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

.leaflet-control-zoom a {
    border-radius: 4px !important;
    color: #112954 !important;
    transition: all 0.2s ease;
}

.leaflet-control-zoom a:hover {
    background-color: #1181D0 !important;
    color: white !important;
}

/* ====================
   Attribution
   ==================== */

.leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.9) !important;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
}

.leaflet-control-attribution a {
    color: #1181D0;
}

/* ====================
   Loading State
   ==================== */

#contact-map.loading {
    position: relative;
    background: #f5f5f5;
}

#contact-map.loading::before {
    content: 'Loading map...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
    font-size: 16px;
    z-index: 1000;
}

#contact-map.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #1181D0;
    border-radius: 50%;
    animation: mapSpinner 1s linear infinite;
    z-index: 1001;
}

@keyframes mapSpinner {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ====================
   Marker Clustering (if enabled)
   ==================== */

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background-color: rgba(17, 129, 208, 0.6);
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background-color: rgba(17, 129, 208, 0.8);
    color: white;
    font-weight: 600;
}

.marker-cluster:hover {
    transform: scale(1.1);
}

/* ====================
   Dark Mode Support (Optional)
   ==================== */

@media (prefers-color-scheme: dark) {
    /* #contact-map {
        filter: invert(1) hue-rotate(180deg);
    } */

    /*   .custom-marker-icon,
    .leaflet-popup-content-wrapper,
    .leaflet-control-zoom {
        filter: invert(1) hue-rotate(180deg);
    } */
}

/* Force light mode if dark mode not desired */
body:not(.dark-mode) #contact-map {
    filter: none;
}

/* ====================
   Print Styles
   ==================== */

@media print {
    #contact-map {
        height: 400px;
        page-break-inside: avoid;
    }

    .leaflet-control-zoom,
    .leaflet-control-attribution {
        display: none !important;
    }
}

/* ====================
   Accessibility
   ==================== */

/* Focus states for keyboard navigation */
.contact-us-info-address-card:focus {
    outline: 3px solid #1181D0;
    outline-offset: 2px;
}

.leaflet-control-zoom a:focus {
    outline: 2px solid #1181D0;
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ====================
   Tablet Specific
   ==================== */

@media (min-width: 768px) and (max-width: 1024px) {
    #contact-map {
        height: 400px;
    }

    .contact-us-info-address-card {
        margin-bottom: 20px;
    }
}

/* ====================
   High Resolution Screens
   ==================== */

@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    .custom-marker-icon svg {
        image-rendering: crisp-edges;
    }
}

/* ====================
   Map Container in Sidebar
   ==================== */

.contact-us-info-map {
    margin: 20px 0;
    border-radius: 8px;
    overflow: hidden;
}

/* ====================
   Error State
   ==================== */

#contact-map.error {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff3cd;
    border: 2px solid #ffc107;
}

#contact-map.error::before {
    content: '⚠️ Map failed to load. Please refresh the page.';
    color: #856404;
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

/* ====================
   Custom Tooltip Styles
   ==================== */

.leaflet-tooltip {
    background: rgba(17, 41, 84, 0.9);
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 12px;
    padding: 6px 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.leaflet-tooltip-top:before,
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before {
    border-top-color: rgba(17, 41, 84, 0.9);
}

/* ====================
   Mobile Touch Improvements
   ==================== */

@media (hover: none) and (pointer: coarse) {
    .contact-us-info-address-card {
        -webkit-tap-highlight-color: rgba(17, 129, 208, 0.1);
    }

    .custom-marker-icon {
        transform: scale(1.2);
    }

    .leaflet-control-zoom a {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ====================
   Animation Preferences
   ==================== */

@media (prefers-reduced-motion: reduce) {

    .custom-marker-icon,
    .contact-us-info-address-card,
    .leaflet-control-zoom a,
    .leaflet-popup-content-wrapper {
        transition: none !important;
        animation: none !important;
    }
}