/* Project Heartbeat Map Styles - Updated Color Scheme */
/* File: /wp-content/themes/ph/assets/css/heartbeat-map.css */

.heartbeat-map-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
    margin: 40px 0;
    font-family: 'Open Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.heartbeat-map-wrapper {
    position: relative;
}

.map-header {
    background: linear-gradient(135deg, #465975 0%, #1d2639 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

.map-header h2 {
    margin: 0 0 15px 0;
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    font-family: 'Open Sans', 'Segoe UI', sans-serif;
    letter-spacing: -0.5px;
    color: white !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.map-header p {
    margin: 0;
    opacity: 0.95;
    font-size: 1.2rem;
    font-weight: 400;
    line-height: 1.4;
    color: white !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.map-selector {
    padding: 20px 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e1dd;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.map-type-btn {
    padding: 10px 20px;
    border: 2px solid #e0e1dd;
    border-radius: 25px;
    background: white;
    color: #465975;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 14px;
    outline: none;
}

.map-type-btn:hover {
    border-color: #547748;
    color: #547748;
    transform: translateY(-1px);
}

.map-type-btn.active {
    background: #547748;
    color: white;
    border-color: #547748;
}

.map-filters {
    padding: 20px 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e1dd;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.map-filters select {
    padding: 10px 15px;
    border: 2px solid #e0e1dd;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    color: #465975;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 150px;
    outline: none;
}

.map-filters select:focus {
    border-color: #547748;
    box-shadow: 0 0 0 3px rgba(84, 119, 72, 0.1);
}

#clear-filters {
    background: #7b8ca6;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    margin-left: auto;
    outline: none;
}

#clear-filters:hover {
    background: #465975;
    transform: translateY(-2px);
}

#heartbeat-map {
    position: relative !important;
    z-index: 1 !important;
    background: #f8f9fa !important;
    min-height: 600px !important;
    height: 600px !important;
    width: 100% !important;
    display: block !important;
    visibility: visible !important;
    overflow: visible !important;
}

/* Google Maps Tiles Fix - Remove any overrides that break map display */
#heartbeat-map {
    position: relative !important;
    z-index: 1 !important;
    background: #f8f9fa !important;
    min-height: 600px !important;
    height: 600px !important;
    width: 100% !important;
    display: block !important;
    visibility: visible !important;
    overflow: visible !important;
    box-sizing: border-box !important;
}

/* Fix for map container */
.heartbeat-map-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden; /* Keep container contained */
    margin: 40px 0;
    font-family: 'Open Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: relative;
}

.heartbeat-map-wrapper {
    position: relative;
    overflow: hidden; /* Contain the map properly */
}

/* Minimal Google Maps overrides - only what's necessary */
#heartbeat-map img {
    max-width: none !important;
    height: auto !important;
}

.gm-style {
    height: 100% !important;
    width: 100% !important;
}

/* Remove problematic overrides that can break map tiles */
#heartbeat-map .gm-style > div {
    /* Remove height/width overrides that can break tiles */
}

/* Avada theme overrides - ensure proper containment */
.fusion-fullwidth #heartbeat-map,
.fusion-builder-column #heartbeat-map {
    height: 600px !important;
    min-height: 600px !important;
    max-width: 100% !important;
    overflow: hidden !important;
}

.fusion-fullwidth .heartbeat-map-container {
    margin: 0;
    border-radius: 0;
    overflow: hidden !important;
}

.fusion-builder-column .heartbeat-map-container {
    margin: 20px 0;
    overflow: hidden !important;
}

.fusion-builder-element .heartbeat-map-container {
    width: 100%;
    max-width: 100%;
    overflow: hidden !important;
}

.fusion-column-wrapper .heartbeat-map-container {
    margin-left: 0;
    margin-right: 0;
    overflow: hidden !important;
}

.location-stats {
    padding: 20px 30px;
    background: #f8f9fa;
    display: flex;
    justify-content: space-around;
    text-align: center;
    border-top: 1px solid #e0e1dd;
}

.stat-item {
    color: #465975;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #547748;
    line-height: 1;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 5px;
}

/* Info Window Styling - Updated with Brand Colors */
.info-window {
    max-width: 280px;
    font-family: 'Open Sans', 'Segoe UI', sans-serif;
    line-height: 1.5;
}

.info-header {
    background: linear-gradient(135deg, #465975, #1d2639);
    color: white;
    padding: 20px 30px;
    border-radius: 8px 8px 0 0;
    margin: -10px -15px 15px -15px;
}

.info-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 5px;
    line-height: 1.3;
    letter-spacing: -0.3px;
}

.info-type {
    font-size: 0.85rem;
    opacity: 0.9;
    background: rgba(255,255,255,0.25);
    padding: 4px 10px;
    border-radius: 12px;
    display: inline-block;
    font-weight: 500;
}

.info-content {
    padding: 0 5px;
    color: #333;
}

.info-address {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 12px;
    line-height: 1.4;
    font-weight: 400;
}

.info-courses {
    margin-bottom: 12px;
}

.info-courses strong {
    color: #547748;
    font-size: 0.9rem;
    font-weight: 600;
}

.course-list {
    font-size: 0.85rem;
    color: #666;
    margin-top: 6px;
    line-height: 1.4;
    font-weight: 400;
}

.amelia-services {
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.amelia-services strong {
    color: #547748;
    font-weight: 600;
}

.service-item {
    font-size: 0.85rem;
    color: #666;
}

.info-contact {
    font-size: 0.9rem;
    margin-bottom: 12px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    line-height: 1.6;
}

.info-actions {
    margin-top: 15px;
    text-align: center;
}

.view-courses-btn {
    display: inline-block;
    background: linear-gradient(135deg, #547748, #547748);
    color: white !important;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.view-courses-btn:hover {
    background: linear-gradient(135deg, #465975, #1d2639);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Loading State */
.heartbeat-map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
    background: #f8f9fa;
    color: #465975;
    font-size: 1.1rem;
}

.heartbeat-map-loading::before {
    content: "";
    width: 20px;
    height: 20px;
    border: 2px solid #e0e1dd;
    border-top: 2px solid #547748;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error State */
.heartbeat-map-error {
    background: #f8d7da;
    color: #721c24;
    padding: 20px;
    text-align: center;
    border: 1px solid #f5c6cb;
    border-radius: 5px;
    margin: 20px;
}

/* Avada Theme Compatibility */
.fusion-fullwidth .heartbeat-map-container {
    margin: 0;
    border-radius: 0;
}

.fusion-builder-column .heartbeat-map-container {
    margin: 20px 0;
}

.fusion-builder-element .heartbeat-map-container {
    width: 100%;
    max-width: 100%;
}

.fusion-column-wrapper .heartbeat-map-container {
    margin-left: 0;
    margin-right: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .map-header h2 {
        font-size: 1.5rem;
    }
    
    .map-header p {
        font-size: 1rem;
    }
    
    .map-selector,
    .map-filters {
        flex-direction: column;
        align-items: stretch;
        padding: 15px 20px;
    }
    
    .map-selector .map-type-btn {
        margin-bottom: 10px;
        width: 100%;
    }
    
    .map-filters select {
        margin-bottom: 10px;
        min-width: 100%;
    }
    
    #clear-filters {
        margin-left: 0;
        width: 100%;
    }
    
    .location-stats {
        flex-direction: column;
        gap: 20px;
        padding: 15px 20px;
    }
    
    .info-actions {
        flex-direction: column;
    }
    
    .action-btn {
        flex: none;
        width: 100%;
        margin-bottom: 5px;
    }
    
    .heartbeat-map-container {
        margin: 20px 0;
        border-radius: 5px;
    }
    
    .map-header {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .map-header h2 {
        font-size: 1.3rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .map-selector,
    .map-filters,
    .location-stats {
        padding: 10px 15px;
    }
    
    .info-window {
        max-width: 250px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .heartbeat-map-container {
        border: 2px solid #000;
    }
    
    .map-type-btn {
        border-color: #000;
    }
    
    .map-type-btn.active {
        background: #000;
        border-color: #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .map-type-btn,
    .action-btn,
    #clear-filters {
        transition: none;
    }
    
    .map-type-btn:hover,
    #clear-filters:hover {
        transform: none;
    }
    
    .heartbeat-map-loading::before {
        animation: none;
    }
}

/* Print styles */
@media print {
    .heartbeat-map-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .map-selector,
    .map-filters {
        display: none;
    }
    
    #heartbeat-map {
        height: 400px !important;
        background: #f5f5f5;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    #heartbeat-map::before {
        content: "Interactive map available online at " attr(data-url);
        color: #666;
        font-size: 14px;
    }
}