
/* Healthcare Practitioners Map - Frontend Styles */

.hpm-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Map Layer Switcher Buttons */
.hpm-layer-switcher {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.hpm-layer-btn {
    padding: 8px 16px;
    border: 2px solid #e1e5e9;
    background: #f6f7f7;
    color: #2c3338;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
}

.hpm-layer-btn:hover {
    background: #e1e5e9;
    border-color: #446463;
    color: #446463;
}

.hpm-layer-btn.active {
    background: #446463;
    color: white;
    border-color: #446463;
}

/* Collapsible Practitioner Cards */
.hpm-practitioner-card {
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.hpm-practitioner-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.hpm-practitioner-header {
    background: #f8f9fa;
    padding: 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e1e5e9;
    transition: background-color 0.3s ease;
}

.hpm-practitioner-header:hover {
    background: #e9ecef;
}

.hpm-practitioner-card.expanded .hpm-practitioner-header {
    border-bottom-color: #d1d5db;
}

.hpm-header-content h4,
.hpm-header-content h5 {
    margin: 0;
    line-height: 1.4;
}

.hpm-header-content h4 {
    font-size: 18px;
    color: #2c3e50;
    font-weight: 600;
}

.hpm-header-content h5 {
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
    margin-top: 2px;
}

.hpm-collapse-icon {
    font-size: 14px;
    color: #6c757d;
    transition: transform 0.3s ease, color 0.3s ease;
}

.hpm-practitioner-card.expanded .hpm-collapse-icon {
    transform: rotate(180deg);
    color: #446463;
}

.hpm-practitioner-details {
    padding: 20px;
    border-top: none;
}

.hpm-practitioner-card.expanded {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* Custom Cluster Icons */
.hpm-cluster-icon {
    background: transparent !important;
    border: none !important;
}

.hpm-cluster-icon div {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Enhanced Contact Info */
.hpm-contact-info {
    margin: 15px 0;
}

.hpm-contact-item {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hpm-contact-item a {
    color: #446463;
    text-decoration: none;
    transition: color 0.3s ease;
}

.hpm-contact-item a:hover {
    color: #354e4d;
    text-decoration: underline;
}

/* Leaflet Map Links */
.leaflet-container a {
    color: white;
}

/* Search Section */
.hpm-search-section {
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.hpm-search-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hpm-search-input-group {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.hpm-search-input-group input[type="text"] {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.hpm-search-input-group input[type="text"]:focus {
    outline: none;
    border-color: #446463;
    box-shadow: 0 0 0 3px rgba(68, 100, 99, 0.1);
}

.hpm-search-input-group select {
    min-width: 120px;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    cursor: pointer;
    height: auto;
}

.hpm-search-input-group select:focus {
    outline: none;
    border-color: #446463;
    box-shadow: 0 0 0 3px rgba(68, 100, 99, 0.1);
}

.hpm-radius-label {
    color: #646970;
    font-size: 14px;
    font-weight: 500;
}

.hpm-search-buttons {
    display: flex;
    gap: 12px;
}

.hpm-button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
}

.hpm-button.hpm-primary {
    background: #446463;
    color: white;
}

.hpm-button.hpm-primary:hover {
    background: #354e4d;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(68, 100, 99, 0.3);
}

.hpm-button.hpm-secondary {
    background: #f6f7f7;
    color: #2c3338;
    border: 2px solid #e1e5e9;
}

.hpm-button.hpm-secondary:hover {
    background: #e1e5e9;
    transform: translateY(-1px);
}

.hpm-button.hpm-small {
    padding: 8px 16px;
    font-size: 14px;
    min-height: 36px;
}

.hpm-search-status {
    padding: 12px;
    border-radius: 8px;
    margin-top: 16px;
    display: none;
    animation: slideIn 0.3s ease;
}

.hpm-status-success {
    background: #e6f7e6;
    color: #00a32a;
    border: 1px solid #00a32a;
}

.hpm-status-error {
    background: #fde7e7;
    color: #d63638;
    border: 1px solid #d63638;
}

.hpm-status-loading {
    background: #e6f3f1;
    color: #446463;
    border: 1px solid #446463;
}

/* Content Wrapper */
.hpm-content-wrapper {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

/* Map Section */
.hpm-map-section {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #e1e5e9;
}

.hpm-map-controls {
    background: #f6f7f7;
    padding: 16px;
    border-bottom: 1px solid #e1e5e9;
}



#hpm-map {
    width: 100%;
    height: 500px;
    position: relative;
}

/* List Section */
.hpm-list-section {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e1e5e9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    max-height: 600px;
    display: flex;
    flex-direction: column;
}

.hpm-list-header {
    padding: 20px;
    border-bottom: 1px solid #e1e5e9;
    background: #f6f7f7;
}

.hpm-list-header h3 {
    margin: 0 0 16px 0;
    color: #2c3338;
    font-size: 18px;
    font-weight: 600;
}

.hpm-list-search input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
}

.hpm-list-search input:focus {
    outline: none;
    border-color: #446463;
}

.hpm-practitioners-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.hpm-loading, .hpm-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #646970;
    font-size: 16px;
}

/* Practitioner Cards */
.hpm-practitioner-card {
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    background: #fff;
    max-width: 100%;
}

/* General card class - Fixed CSS specificity to override WordPress core */
.healthcare-practitioners-map .card,
.healthcare-practitioners-map div.card,
.hpm-container .card,
.hpm-container div.card,
body .card,
body div.card,
.card,
div.card,
.hpm-practitioner-card,
.wrap .card {
    max-width: 100% !important;
}

.hpm-practitioner-card:hover {
    border-color: #446463;
    box-shadow: 0 4px 16px rgba(68, 100, 99, 0.15);
    transform: translateY(-2px);
}

.hpm-practitioner-image {
    height: 120px;
    overflow: hidden;
    background: #f6f7f7;
}

.hpm-practitioner-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hpm-practitioner-info {
    padding: 16px;
}

.hpm-practitioner-header {
    margin-bottom: 12px;
}

.hpm-practice-name {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: #2c3338;
    line-height: 1.3;
}

.hpm-practitioner-name {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #646970;
    font-weight: 500;
}

.hpm-distance {
    display: inline-block;
    background: #e6f3f1;
    color: #446463;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.hpm-address {
    margin-bottom: 12px;
    color: #646970;
    font-size: 14px;
    line-height: 1.4;
}

.hpm-icon {
    margin-right: 4px;
}

.hpm-contact-info {
    margin-bottom: 12px;
}

.hpm-contact-item {
    margin-bottom: 4px;
    font-size: 14px;
}

.hpm-contact-item a {
    color: #446463;
    text-decoration: none;
}

.hpm-contact-item a:hover {
    text-decoration: underline;
}

.hpm-practitioner-excerpt {
    margin-bottom: 16px;
    color: #646970;
    font-size: 14px;
    line-height: 1.5;
}

.hpm-practitioner-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.hpm-practitioner-actions .hpm-button {
    flex: 1;
    min-width: 80px;
}

/* Custom Map Markers */
.hmp-marker {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #446463;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.hpm-marker:hover,
.hpm-marker-highlighted {
    background: #446463;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(68, 100, 99, 0.4);
}

.hpm-marker-inner {
    font-size: 16px;
    line-height: 1;
}

.hpm-marker-highlighted .hpm-marker-inner {
    filter: grayscale(1) brightness(2);
}

/* Map Popups */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.hpm-popup-content {
    padding: 4px;
}

.hpm-popup-title {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: #2c3338;
    line-height: 1.3;
}

.hpm-popup-subtitle {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #646970;
    font-weight: 500;
}

.hpm-popup-address,
.hpm-popup-distance {
    margin-bottom: 8px;
    font-size: 13px;
    color: #646970;
}

.hpm-popup-contact {
    margin-bottom: 12px;
}

.hpm-popup-contact div {
    margin-bottom: 4px;
    font-size: 13px;
}

.hpm-popup-contact a {
    color: #446463;
    text-decoration: none;
}

.hpm-popup-contact a:hover {
    text-decoration: underline;
}

.hpm-popup-actions {
    display: flex;
    gap: 8px;
}

.hpm-popup-btn {
    padding: 6px 12px;
    background: #446463;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.2s ease;
}

.hpm-popup-btn:hover {
    background: #354e4d;
    color: white;
}

/* Cluster styling */
.marker-cluster-small {
    background-color: rgba(0, 124, 186, 0.6);
}

.marker-cluster-small div {
    background-color: rgba(0, 124, 186, 0.4);
}

.marker-cluster-medium {
    background-color: rgba(255, 145, 73, 0.6);
}

.marker-cluster-medium div {
    background-color: rgba(255, 145, 73, 0.4);
}

.marker-cluster-large {
    background-color: rgba(214, 54, 56, 0.6);
}

.marker-cluster-large div {
    background-color: rgba(214, 54, 56, 0.4);
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.hpm-practitioner-card {
    animation: fadeIn 0.5s ease;
}

/* Responsive Design */
@media screen and (max-width: 1024px) {
    .hpm-content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .hpm-list-section {
        max-height: 800px;
    }
}

@media screen and (max-width: 768px) {
    .hpm-container {
        padding: 16px;
    }
    
    .hpm-search-section {
        padding: 16px;
    }
    
    .hpm-search-input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .hpm-search-input-group select {
        width: 100%;
    }
    
    .hpm-search-buttons {
        flex-direction: column;
    }
    
    .hpm-layer-switcher {
        justify-content: center;
    }
    
    .hpm-layer-btn {
        flex: 1;
        text-align: center;
    }
    
    #hpm-map {
        height: 400px;
    }
    
    .hpm-practitioner-actions {
        flex-direction: column;
    }
    
    .hpm-practitioner-actions .hpm-button {
        flex: none;
    }
    
    .hpm-popup-actions {
        flex-direction: column;
    }
}

@media screen and (max-width: 480px) {
    .hpm-container {
        padding: 12px;
    }
    
    .hpm-search-section,
    .hpm-map-section,
    .hpm-list-section {
        border-radius: 8px;
    }
    
    .hpm-practitioner-card {
        border-radius: 8px;
    }
    
    #hpm-map {
        height: 300px;
    }
    
    .hpm-list-section {
        max-height: 600px;
    }
}

/* Print Styles */
@media print {
    .hpm-search-section,
    .hpm-map-controls,
    .hpm-practitioner-actions {
        display: none;
    }
    
    .hpm-content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .hpm-practitioner-card {
        break-inside: avoid;
        margin-bottom: 20px;
        box-shadow: none;
        border: 2px solid #000;
    }
}

/* Accessibility improvements */
.hpm-button:focus,
.hpm-layer-btn:focus,
input:focus {
    outline: 2px solid #446463;
    outline-offset: 2px;
}

.hpm-practitioner-card:focus {
    outline: 2px solid #446463;
    outline-offset: 4px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .hpm-practitioner-card {
        border-width: 2px;
    }
    
    .hpm-button.hpm-primary {
        background: #000;
        color: #fff;
    }
    
    .hpm-marker {
        border-width: 3px;
        border-color: #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .hpm-practitioner-card,
    .hpm-button,
    .hpm-marker {
        transition: none;
    }
    
    .hpm-practitioner-card:hover {
        transform: none;
    }
}

/* Add this to ensure relative positioning for the dropdown */
#hpm-search-address {
    position: relative;
}

/* Parent container - make it the positioning reference */
.hpm-search-input-group {
    position: relative; /* Key fix: Now the absolute dropdown positions relative to THIS div */
    display: flex; /* If not already set - helps with alignment of input and select */
    align-items: center; /* Vertically center child elements if needed */
}

/* Dropdown styles - keep absolute, but ensure it's below and full-width */
.hpm-autocomplete-dropdown {  /* Note: Your original had .hpm-autocomplete-dropdown, but JS uses #hpm-autocomplete-suggestions - use the ID for specificity if needed */
    position: absolute;
    top: 100%; /* Places it right below the parent (input + select group) */
    left: 0;
    z-index: 1000; /* Ensures it's on top of other elements */
    background: white;
    border: 1px solid #ccc; /* Full border for better visibility */
    border-top: none; /* Remove top border to "connect" visually to the input - add back if you want separation */
    border-radius: 0 0 4px 4px; /* Rounded bottom corners */
    max-height: 200px;
    overflow-y: auto;
    width: 100%; /* Match the parent's width (input group) */
    max-width: calc(100vw - 20px); /* Prevent overflow on small screens */
    display: none; /* Hidden by default, shown via JS */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); /* Subtle shadow */
    margin-top: 2px; /* NEW: Tiny gap to prevent it from touching/overlapping the input */
}

/* For the suggestion items (from JS) - add some padding/hover for usability */
.hpm-autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee; /* Separator between suggestions */
}

.hpm-autocomplete-item:hover {
    background-color: #f5f5f5; /* Hover effect */
}

.hpm-autocomplete-item:last-child {
    border-bottom: none; /* No separator on last item */
}