/* Animation and Enhancement Styles */

/* Smooth transitions for all interactive elements */
* {
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

/* Loading animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(52, 152, 219, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0);
    }
}

/* Spinner component */
.spinner {
    width: 2rem;
    height: 2rem;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #666;
}

.loading-text {
    margin-top: 1rem;
    font-weight: 500;
    color: #666;
}

/* Animation classes */
.animate-in {
    animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.feature-card.animate-in {
    animation: slideInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) var(--animation-delay, 0ms) both;
}

.value-card.animate-in {
    animation: fadeInScale 0.5s cubic-bezier(0.4, 0, 0.2, 1) var(--animation-delay, 0ms) both;
}

/* Enhanced button interactions */
.cta-button, .explore-button, .appeal-btn, .popup-btn {
    transform: translateY(0);
    transition: all 0.2s ease;
}

.cta-button:hover, .explore-button:hover, .appeal-btn:hover, .popup-btn:hover {
    transform: translateY(-2px);
}

.cta-button:active, .explore-button:active, .appeal-btn:active, .popup-btn:active {
    transform: translateY(0);
}

/* Modal animations */
.modal {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-content {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal:not(.hidden) .modal-content {
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Tab transitions */
.tab-pane {
    transition: opacity 0.2s ease;
}

.tab-pane.active {
    animation: fadeInUp 0.3s ease-out;
}

/* Toast notifications */
.toast {
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show {
    transform: translateX(0);
}

/* Search input focus effects */
.search-wrapper {
    transition: all 0.3s ease;
}

.search-wrapper:focus-within {
    transform: translateY(-2px);
}

/* Map marker animations */
.property-marker {
    transition: all 0.2s ease;
}

.selected-property {
    animation: pulse 1.5s infinite;
}

/* Card hover effects */
.feature-card, .value-card, .detail-item, .comp-card, .appeal-card {
    transition: all 0.2s ease;
}

.feature-card:hover, .comp-card:hover, .appeal-card:hover {
    transform: translateY(-3px);
}

.value-card:hover, .detail-item:hover {
    transform: translateY(-2px);
}

/* Progressive enhancement for reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .animate-in {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* Loading states for specific components */
.map-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.progress-bar-container {
    width: 200px;
    height: 4px;
    background-color: #f0f0f0;
    border-radius: 2px;
    margin-top: 1rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: #3498db;
    transition: width 0.3s ease;
    width: 0%;
}

/* Error states */
.error-message {
    background-color: rgba(231, 76, 60, 0.1);
    border: 1px solid #e74c3c;
    border-radius: 8px;
    padding: 1rem;
    color: #e74c3c;
    text-align: center;
    margin: 1rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.no-data-message {
    text-align: center;
    padding: 2rem;
    color: #666;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.no-data-message i {
    font-size: 2rem;
    opacity: 0.5;
}

/* Enhanced tooltips */
.leaflet-tooltip.enhanced-tooltip {
    background: rgba(255, 255, 255, 0.95);
    border: none !important;
    border-radius: 8px;
    padding: 8px 12px !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    font-size: 0.9rem;
}

.enhanced-tooltip strong {
    color: #2c3e50;
    display: block;
    margin-bottom: 4px;
}

/* Property popup enhancements */
.leaflet-popup-content-wrapper {
    border-radius: 12px !important;
    padding: 0 !important;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15) !important;
}

.popup-header {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 12px 15px;
    margin: 0;
}

.popup-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.popup-content {
    padding: 15px;
}

.popup-footer {
    padding: 12px 15px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

.popup-btn {
    background: #3498db;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    width: 100%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.popup-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .modal-content {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }
    
    .search-wrapper:focus-within {
        transform: none;
    }
    
    .feature-card:hover, .value-card:hover, .detail-item:hover {
        transform: none;
    }
}

/* Accessibility enhancements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus indicators */
*:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.nav-link:focus,
.cta-button:focus,
.search-button:focus,
.toggle-btn:focus,
.back-button:focus,
.close-modal-btn:focus,
.tab-btn:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .spinner {
        border-top-color: #000;
    }
    
    .error-message {
        border-color: #000;
        color: #000;
    }
}

/* Print styles */
@media print {
    .modal, .toast, .loading-container {
        display: none !important;
    }
    
    * {
        animation: none !important;
        transition: none !important;
    }
}