/* ==========================================
   Chapter Geocoder - Map Styles
   ========================================== */

/* Map Container */
.chapter-map-wrapper {
    position: relative;
    width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.chapter-map {
    width: 100%;
    height: 500px;
    border-radius: 4px;
    z-index: 1;
}

/* Loading State */
.chapter-map-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 500px;
    background: #f0f0f1;
    border-radius: 4px;
    color: #646970;
}

.chapter-map-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #c3c4c7;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: chapter-geocoder-spin 1s linear infinite;
    margin-bottom: 12px;
}

@keyframes chapter-geocoder-spin {
    to { transform: rotate(360deg); }
}

/* No Data State */
.chapter-map-no-data {
    padding: 30px;
    background: #f0f0f1;
    border-radius: 4px;
    color: #646970;
    text-align: center;
    font-size: 14px;
}

/* Legend / List Panel */
.chapter-map-legend {
    margin-top: 16px;
    padding: 16px;
    background: #ffffff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
}

.chapter-map-legend h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1d2327;
}

.chapter-map-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
}

.chapter-map-list-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f1;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.chapter-map-list-item:last-child {
    border-bottom: none;
}

.chapter-map-list-item:hover {
    background: #f6f7f7;
}

.chapter-map-list-item.active {
    background: #e9f2fe;
}

.chapter-map-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    margin-right: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.chapter-map-list-name {
    font-weight: 500;
    color: #1d2327;
    font-size: 14px;
}

.chapter-map-list-extended {
    color: #646970;
    font-size: 12px;
    margin-left: 8px;
}

/* Custom Map Pins */
.chapter-map-custom-pin {
    background: none;
    border: none;
}

.chapter-map-pin {
    width: 25px;
    height: 41px;
    background: #2271b1;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    position: relative;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.chapter-map-pin::after {
    content: '';
    width: 10px;
    height: 10px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.chapter-map-pin-with-logo {
    width: 36px;
    height: 36px;
    background: #fff;
    border: 2px solid #2271b1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    position: relative;
}

.chapter-map-pin-with-logo img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 2px;
}

/* Popups */
.leaflet-popup-content-wrapper {
    border-radius: 6px;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.15);
    padding: 0;
}

.leaflet-popup-content {
    margin: 0;
    padding: 0;
}

.chapter-map-popup {
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.chapter-map-popup-content {
    padding: 14px 16px;
    min-width: 200px;
    max-width: 280px;
}

.chapter-map-popup-name {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 600;
    color: #1d2327;
    line-height: 1.3;
}

.chapter-map-popup-extended {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #646970;
    font-style: italic;
}

.chapter-map-popup-description {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #3c434a;
    line-height: 1.4;
}

.chapter-map-popup-actions {
    padding-top: 8px;
    border-top: 1px solid #f0f0f1;
}

.chapter-map-read-more {
    display: inline-block;
    padding: 6px 14px;
    background: #2271b1;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.15s ease;
}

.chapter-map-read-more:hover {
    background: #135e96;
    color: #fff;
    text-decoration: none;
}

/* Responsive Adjustments */
@media screen and (max-width: 782px) {
    .chapter-map {
        height: 400px;
    }
    
    .chapter-map-loading {
        height: 400px;
    }
}

@media screen and (max-width: 600px) {
    .chapter-map {
        height: 350px;
    }
    
    .chapter-map-loading {
        height: 350px;
    }
    
    .chapter-map-popup-content {
        min-width: 160px;
        padding: 10px 12px;
    }
}

/* Admin Meta Box Styles */
#chapter-geocoder-meta-box-content {
    padding: 4px 0;
}