/* =========================================
   Marker Drop Animation
   ========================================= */
@keyframes markerDrop {
    0% {
        transform: translateY(-20px);
        opacity: 0;
    }

    60% {
        transform: translateY(3px);
        opacity: 1;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 0 6px rgba(0, 0, 0, 0.15);
    }

    50% {
        box-shadow: 0 0 14px rgba(0, 0, 0, 0.3);
    }
}

/* =========================================
   Base Marker Styles
   ========================================= */
.custom-marker {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 38px;
    height: 44px;
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease;
    animation: markerDrop 0.4s ease-out;
}

.custom-marker:hover {
    transform: scale(1.15);
    z-index: 1000 !important;
    filter: brightness(1.1);
}

/* SVG inside marker */
.custom-marker .marker-icon {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}

/* =========================================
   Base Popup Styles (.custom-popup)
   ========================================= */
.custom-popup {
    min-width: 220px;
    max-width: 280px;
    font-size: 0.82rem;
    line-height: 1.4;
}

.custom-popup .popup-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.custom-popup .popup-price {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.3px;
}

.custom-popup .popup-type {
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.06);
}

.custom-popup .popup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px 12px;
    margin-bottom: 8px;
}

.custom-popup .popup-grid dt {
    font-size: 0.72rem;
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin: 0;
}

.custom-popup .popup-grid dd {
    font-weight: 600;
    margin: 0 0 4px 0;
    font-size: 0.82rem;
}

.custom-popup .popup-features {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}

.custom-popup .popup-badge {
    font-size: 0.68rem;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.06);
    white-space: nowrap;
}

.custom-popup .popup-badge.yes {
    background: rgba(46, 160, 67, 0.12);
    color: #1a7f37;
}

.custom-popup .popup-badge.no {
    background: rgba(200, 60, 60, 0.08);
    color: #b44;
    opacity: 0.6;
}

.custom-popup .popup-links {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 8px;
}

.custom-popup .popup-link {
    display: block;
    text-align: center;
    padding: 6px 12px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.78rem;
    border-radius: 4px;
    transition: all 0.15s ease;
    background: #333;
    color: #fff;
}

.custom-popup .popup-link:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

/* =========================================
   Base Cluster Styles
   ========================================= */
.custom-cluster {
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    font-weight: 700;
    color: white;
    background-color: #333;
    border: 2px solid white;
    transition: transform 0.2s ease;
}

.custom-cluster:hover {
    transform: scale(1.1);
}

.custom-cluster span {
    line-height: 1;
}

.cluster-small {
    font-size: 0.75rem;
}

.cluster-medium {
    font-size: 0.85rem;
    animation: pulseGlow 2.5s ease-in-out infinite;
}

.cluster-large {
    font-size: 0.95rem;
    animation: pulseGlow 2s ease-in-out infinite;
}


/* =========================================
   Theme: Glassmorphism
   ========================================= */
body.theme-glass .custom-marker .marker-icon .marker-body {
    fill: rgba(255, 255, 255, 0.9);
    stroke: #000000;
    stroke-width: 1.5;
}

body.theme-glass .custom-marker .marker-icon .marker-detail {
    fill: rgba(44, 62, 80, 0.9);
}

body.theme-glass .custom-marker .marker-icon {
    filter: drop-shadow(0 4px 10px rgba(31, 38, 135, 0.45)) drop-shadow(0 0 6px rgba(255, 255, 255, 0.7));
}

body.theme-glass .custom-marker:hover .marker-icon {
    filter: drop-shadow(0 6px 14px rgba(31, 38, 135, 0.6)) drop-shadow(0 0 10px rgba(255, 255, 255, 0.8));
}

/* Popup Glass */
body.theme-glass .leaflet-popup-content-wrapper,
body.theme-glass .leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: #2c3e50;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.18);
    border-radius: 12px;
}

body.theme-glass .custom-popup .popup-header {
    border-bottom-color: rgba(44, 62, 80, 0.15);
}

body.theme-glass .custom-popup .popup-price {
    color: #2c3e50;
}

body.theme-glass .custom-popup .popup-type {
    background: rgba(44, 62, 80, 0.1);
    color: #2c3e50;
}

body.theme-glass .custom-popup .popup-link {
    background: rgba(44, 62, 80, 0.75);
    backdrop-filter: blur(4px);
    color: #fff;
    border-radius: 8px;
}

body.theme-glass .custom-popup .popup-badge {
    background: rgba(44, 62, 80, 0.08);
    backdrop-filter: blur(2px);
}

body.theme-glass .custom-popup .popup-badge.yes {
    background: rgba(46, 160, 67, 0.15);
    color: #1a7f37;
}

/* Glass Cluster */
body.theme-glass .custom-cluster {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px solid #000000;
    color: #1a252f;
    box-shadow: 0 6px 24px rgba(31, 38, 135, 0.25);
    font-weight: 800;
}


/* =========================================
   Leaflet Popup Overrides (all themes)
   ========================================= */
.leaflet-popup-content-wrapper {
    padding: 0;
}

.leaflet-popup-content {
    margin: 12px 14px;
    line-height: 1.4;
}

/* Hide default close button since we use cleaner popups */
.leaflet-popup-close-button {
    display: none;
}

/* =========================================
   Table View Loading Spinner
   ========================================= */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top: 4px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

body.theme-glass .spinner {
    border-color: rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
}

body.theme-glass #table-loading {
    color: #fff;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}