/* Modal Styles */
.dm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dm-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.dm-modal-container {
    position: relative;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dm-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: auto;
    height: auto;
    background: transparent;
    border: none;
    color: #666;
    font-size: 16px;
    cursor: pointer;
    z-index: 999999999;
    transition: all 0.3s ease;
    padding: 5px 10px;
    font-weight: 500;
}

.dm-modal-close:hover {
    color: #333;
}

.dm-modal-header {
    padding: 20px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
    z-index: 999999999;
}

.dm-modal-header h2 {
    margin: 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    direction: rtl;
}

.dm-search-container {
    position: relative;
    margin-bottom: 10px;
    z-index: 999999999;
}

#dm-city-search {
    width: 100%;
    padding: 10px 20px 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: white;
    color: #333;
    font-size: 14px;
    direction: rtl;
    text-align: right;
    transition: all 0.3s ease;
}

#dm-city-search:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

#dm-city-search::placeholder {
    color: #999;
}

.dm-city-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 5px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    max-height: 250px;
    overflow-y: auto;
    z-index: 999999999;
    display: none;
}

.dm-city-results.active {
    display: block;
}

.dm-city-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    direction: rtl;
    text-align: right;
}

.dm-city-item:last-child {
    border-bottom: none;
}

.dm-city-item:hover {
    background: #f5f5f5;
}

.dm-city-item strong {
    display: block;
    font-size: 14px;
    margin-bottom: 2px;
    color: #333;
}

.dm-city-item small {
    color: #666;
    font-size: 12px;
}

.dm-location-status {
    text-align: right;
    padding: 8px 12px;
    border-radius: 5px;
    background: #f0f0f0;
    color: #333;
    font-size: 13px;
    direction: rtl;
    min-height: 20px;
}

.dm-location-status.success {
    background: #d4edda;
    color: #155724;
}

.dm-location-status.warning {
    background: #fff3cd;
    color: #856404;
}

.dm-location-status.error {
    background: #f8d7da;
    color: #721c24;
}

.dm-modal-body {
    padding: 0;
    background: white;
}

#dm-map-container {
    position: relative;
}

#dm-map {
    height: 600px;
    width: 100%;
    border: none;
}

/* Outside Saudi Popup */
.dm-outside-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    text-align: center;
    direction: rtl;
}

.dm-outside-popup h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
}

.dm-outside-popup p {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

.dm-outside-popup button {
    background: #0073aa;
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dm-outside-popup button:hover {
    background: #005177;
}

/* Popup Content Styles */
.dm-popup-content {
    direction: rtl;
    text-align: right;
    padding: 10px;
    min-width: 250px;
}

.dm-popup-content h3 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 16px;
    color: #333;
    font-weight: 600;
}

.dm-popup-content p {
    margin: 5px 0;
    color: #666;
    font-size: 13px;
}

.dm-popup-content button {
    background: #0073aa;
    color: white;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    margin-top: 10px;
    width: 100%;
    transition: all 0.3s ease;
}

.dm-popup-content button:hover {
    background: #005177;
}

/* RTL Popup adjustments for Mapbox GL JS */
.mapboxgl-popup-content {
    text-align: right;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Hide the close button on Mapbox popups */
.mapboxgl-popup-close-button {
    display: none !important;
}

/* Hide Mapbox logo and attribution */
a.mapboxgl-ctrl-logo {
    display: none !important;
}

.mapboxgl-ctrl-attrib a {
    display: none !important;
}

/* Cluster Styles */
.cluster-marker {
    background: #0073aa;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.cluster-marker:hover {
    background: #005177;
    transform: scale(1.1);
}

/* Single Mosque Marker - SVG Icon */
.mosque-marker {
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 50px;
    height: 50px;
}

.mosque-marker:hover {
    transform: scale(1.15);
}

.mosque-marker svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Loading Spinner */
.dm-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
}

.dm-loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .dm-modal-container {
        width: 95%;
        max-width: 95%;
        max-height: 90vh;
        border-radius: 8px;
    }

    #dm-map {
        height: 500px;
    }

    .dm-modal-header {
        padding: 15px;
    }

    .dm-modal-header h2 {
        font-size: 16px;
    }

    .dm-modal-close {
        top: 15px;
        right: 15px;
        font-size: 14px;
    }

    .dm-popup-content {
        min-width: 200px;
    }

    .mosque-marker {
        width: 45px;
        height: 45px;
    }

    .cluster-marker {
        width: 45px !important;
        height: 45px !important;
        line-height: 45px !important;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .dm-modal-container {
        width: 92%;
        max-width: 92%;
        max-height: 85vh;
        border-radius: 8px;
    }

    #dm-map {
        height: calc(85vh - 70px);
    }

    .dm-modal-header h2 {
        font-size: 15px;
    }
}