/* Loading Animation */
.properties-container.loading {
    @apply relative;
}

.loading-overlay {
    @apply absolute inset-0 bg-white bg-opacity-75 flex items-center justify-center z-10 rounded-lg;
}

.spinner {
    @apply w-8 h-8 border-4 border-primary border-t-transparent rounded-full animate-spin;
}

/* Mobile Filters */
#filters-sidebar.mobile-open {
    @apply block;
}

/* Smooth Transitions */
.properties-grid .property-card {
    @apply transition-all duration-300 hover:transform hover:scale-105;
}

/* View Toggle */
.view-toggle button.active {
    @apply bg-primary text-white;
}

/* Custom Checkbox and Radio Styles */
input[type="checkbox"]:checked,
input[type="radio"]:checked {
    @apply bg-primary border-primary;
}

input[type="checkbox"]:focus,
input[type="radio"]:focus {
    @apply ring-2 ring-primary ring-opacity-50;
}

/* Responsive Filters */
@media (max-width: 1024px) {
    #filters-sidebar {
        @apply max-h-96 overflow-y-auto;
    }
}

/* Pagination Styles */
.pagination-container {
    @apply flex justify-center mt-12;
}

.pagination-container nav {
    @apply flex items-center space-x-2;
}

.pagination-container a {
    @apply px-3 py-2 text-sm font-medium text-gray-500 hover:text-primary border border-gray-300 rounded-md hover:border-primary transition-colors cursor-pointer;
}

.pagination-container a:hover {
    @apply bg-primary/10;
}

.pagination-container span {
    @apply px-3 py-2 text-sm font-medium text-white bg-primary border border-primary rounded-md;
}

/* Ensure pagination is visible */
.pagination-container .disabled {
    @apply text-gray-400 cursor-not-allowed;
}

/* Map Container Z-Index Fix */
#properties-map {
    position: relative;
    z-index: 1 !important;
}

.leaflet-container {
    z-index: 1 !important;
}

.leaflet-map-pane {
    z-index: 1 !important;
}

.leaflet-tile-pane {
    z-index: 1 !important;
}

.leaflet-objects-pane {
    z-index: 2 !important;
}

.leaflet-marker-pane {
    z-index: 3 !important;
}

.leaflet-popup-pane {
    z-index: 4 !important;
}

.leaflet-control-container {
    z-index: 5 !important;
}

/* Custom Marker Styles */
.property-marker-wrapper {
    background: none !important;
    border: none !important;
}

.property-marker-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.2s ease;
}

.property-marker-container:hover {
    transform: scale(1.05);
}

.custom-marker {
    position: relative;
    transition: all 0.2s ease;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.custom-marker:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.custom-marker svg {
    display: block;
}

/* Enhanced Popup Styles */
.leaflet-popup-content-wrapper {
    border-radius: 12px !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15) !important;
    border: none !important;
    background: white !important;
    overflow: hidden !important;
    padding: 0 !important;
    max-width: 300px !important;
    width: 300px !important;
    max-height: 500px !important;
}

.leaflet-popup {
    margin-bottom: 20px !important;
}

/* Ensure popup stays within map bounds */
.leaflet-popup-close-button {
    color: #474B57 !important;
    font-size: 18px !important;
    font-weight: bold !important;
    padding: 4px 8px !important;
}

.leaflet-popup-content {
    margin: 0 !important;
    padding: 0 !important;
    width: 300px !important;
}

.leaflet-popup-tip {
    background: white !important;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.1) !important;
}

.property-popup {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    width: 300px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.popup-image-container {
    position: relative;
    width: 100%;
    height: 120px;
    overflow: hidden;
    background: linear-gradient(45deg, #f0f0f0, #e0e0e0);
}

.popup-image-link {
    display: block;
    height: 100%;
}

.popup-image-link:focus-visible {
    outline: 2px solid #F1B400;
    outline-offset: 2px;
}

.popup-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.3s ease;
}

.popup-image:hover {
    transform: scale(1.02);
}

.image-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    color: #474B57;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.image-carousel-nav:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-50%) scale(1.1);
    color: #F1B400;
}

.image-carousel-nav.prev {
    left: 8px;
}

.image-carousel-nav.next {
    right: 8px;
}

.image-indicators {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
}

.image-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
}

.image-indicator.active {
    background: #F1B400;
    box-shadow: 0 0 0 2px rgba(241, 180, 0, 0.3);
}

/* Content Area */
.popup-content {
    padding: 16px;
    background: white;
}

.popup-title {
    font-weight: 700;
    font-size: 16px;
    color: #474B57;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popup-price {
    color: #F1B400;
    font-weight: 800;
    font-size: 18px;
    margin-bottom: 12px;
    text-shadow: 0 1px 2px rgba(241, 180, 0, 0.1);
}

.popup-location {
    display: flex;
    align-items: center;
    color: #616677;
    font-size: 13px;
    margin-bottom: 12px;
}

.popup-location i {
    color: #F1B400;
    margin-right: 6px;
    font-size: 12px;
}

/* Property Details Grid */
.popup-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}

.popup-detail-item {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #616677;
    background: rgba(71, 75, 87, 0.05);
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid rgba(71, 75, 87, 0.1);
}

.popup-detail-item i {
    color: #F1B400;
    margin-right: 6px;
    font-size: 11px;
    min-width: 12px;
}

/* Agent Info */
.popup-agent {
    background: linear-gradient(135deg, #474B57 0%, #616677 100%);
    color: white;
    padding: 10px 16px;
    margin: -16px -16px 14px -16px;
    border-bottom: 3px solid #F1B400;
}

.popup-agent-name {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 2px;
}

.popup-agent-title {
    font-size: 11px;
    opacity: 0.8;
}

/* Action Buttons */
.popup-actions {
    display: flex;
    gap: 8px;
}

.popup-button {
    flex: 1;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.popup-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.popup-button:hover::before {
    left: 100%;
}

.popup-button-primary {
    background: linear-gradient(135deg, #474B57 0%, #616677 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(71, 75, 87, 0.3);
}

.popup-button-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(71, 75, 87, 0.4);
    color: white;
}

.popup-button-secondary {
    background: linear-gradient(135deg, #F1B400 0%, #e6a300 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(241, 180, 0, 0.3);
}

.popup-button-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(241, 180, 0, 0.4);
    color: white;
}

.popup-button-icon {
    background: rgba(241, 180, 0, 0.1);
    color: #F1B400;
    border: 2px solid rgba(241, 180, 0, 0.2);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.popup-button-icon:hover {
    background: #F1B400;
    color: white;
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 8px 25px rgba(241, 180, 0, 0.4);
}

/* Price Indicator Styles (like Booking.com) */
.price-indicator {
    position: relative;
    background: #10b981;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    margin-bottom: 2px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    border: 2px solid white;
    transition: all 0.2s ease;
}

.price-indicator:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.price-text {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.price-arrow {
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid inherit;
}

.price-arrow::before {
    content: '';
    position: absolute;
    bottom: 2px;
    left: -4px;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid white;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .price-indicator {
        font-size: 10px;
        padding: 3px 6px;
    }
    
    .price-text {
        font-size: 9px;
    }
}
