/**
 * ATLAS Mobile Property Browser CSS - Phase 3 Day 3
 * Enhanced mobile property browsing styles with swipe gestures
 * 
 * @author Tunahan Bağcacıer
 * @version 1.0.0
 */

/* Mobile Enhanced Property Cards */
.property-card.mobile-enhanced {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform-origin: center center;
}

.property-card.mobile-enhanced:not(.touch-active) {
    transform: scale(1);
}

.property-card.mobile-enhanced.touch-active {
    transform: scale(0.98);
    box-shadow: var(--shadow-sm);
}

/* Favorite Button */
.favorite-btn {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    z-index: 2;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border: none;
    border-radius: 50%;
    width: var(--touch-target);
    height: var(--touch-target);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: var(--text-lg);
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.favorite-btn:hover,
.favorite-btn:focus {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.favorite-btn.favorited {
    background: var(--primary-color);
    color: white;
    animation: favoriteAdded 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.favorite-btn .favorite-ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    transition: all 0.6s ease;
}

.favorite-btn .favorite-ripple.animate {
    opacity: 1;
    transform: translate(-50%, -50%) scale(2);
}

.favorite-btn.favorite-adding {
    animation: favoriteAdding 0.3s ease;
}

.favorite-btn.favorite-removing {
    animation: favoriteRemoving 0.3s ease;
}

/* Swipe Indicators */
.swipe-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    z-index: 3;
    color: white;
    text-align: center;
    font-weight: 600;
    font-size: var(--text-sm);
    pointer-events: none;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.swipe-indicator.favorite {
    color: #ef4444;
}

.swipe-indicator.contact {
    color: #10b981;
}

.swipe-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    backdrop-filter: blur(8px);
    border: 2px solid currentColor;
}

.swipe-indicator.favorite .swipe-icon {
    background: rgba(239, 68, 68, 0.2);
}

.swipe-indicator.contact .swipe-icon {
    background: rgba(16, 185, 129, 0.2);
}

/* Swipe Feedback */
.swipe-feedback {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    color: white;
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    z-index: 4;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: none;
}

.swipe-feedback.show {
    transform: translate(-50%, -50%) scale(1);
}

.swipe-feedback i {
    font-size: 2rem;
    margin-bottom: var(--space-sm);
}

.swipe-feedback.favorite i {
    color: #ef4444;
}

.swipe-feedback.contact i {
    color: #10b981;
}

/* Quick Actions Overlay */
.mobile-quick-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    padding: var(--space-md);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 2;
}

.property-card:hover .mobile-quick-actions,
.property-card.touch-active .mobile-quick-actions {
    transform: translateY(0);
}

.quick-actions-overlay {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
}

.quick-action-btn {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: var(--touch-target);
    height: var(--touch-target);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--text-md);
    cursor: pointer;
    transition: all 0.3s ease;
}

.quick-action-btn:hover,
.quick-action-btn:focus {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.quick-action-btn:active {
    transform: scale(0.95);
}

/* Infinite Scroll Loading */
.infinite-scroll-trigger {
    padding: var(--space-xl);
    text-align: center;
    margin-top: var(--space-lg);
}

.loading-more-properties {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.infinite-scroll-trigger:not(.loading) .loading-more-properties {
    opacity: 0;
    pointer-events: none;
}

.infinite-scroll-trigger.loading .loading-more-properties {
    opacity: 1;
}

/* Load Error State */
.load-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    color: var(--text-secondary);
    text-align: center;
}

.load-error i {
    font-size: 2rem;
    color: var(--warning-color);
}

.retry-load {
    margin-top: var(--space-sm);
}

/* Property Card Animations */
.property-card:not(.animated-in) {
    opacity: 0;
    transform: translateY(20px);
}

.property-card.animated-in {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Touch Feedback Enhancements */
.property-card.mobile-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.05);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 1;
}

.property-card.mobile-enhanced.touch-active::before {
    opacity: 1;
}

/* Enhanced Property Features for Mobile */
.property-card.mobile-enhanced .property-features {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
}

.property-card.mobile-enhanced .property-features span {
    background: var(--background-secondary);
    color: var(--text-secondary);
    font-size: var(--text-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.property-card.mobile-enhanced .property-features i {
    font-size: var(--text-xs);
    opacity: 0.7;
}

/* Property Type Badge Enhancement */
.property-card.mobile-enhanced .property-type {
    position: absolute;
    top: var(--space-md);
    left: var(--space-md);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    color: white;
    font-size: var(--text-xs);
    font-weight: 600;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    z-index: 2;
}

/* Mobile Grid Enhancements */
@media (max-width: 767px) {
    .properties-grid {
        gap: var(--space-md);
        padding: var(--space-md);
    }

    .property-card {
        margin-bottom: var(--space-md);
    }

    /* Single column layout for very small screens */
    @media (max-width: 480px) {
        .properties-grid {
            grid-template-columns: 1fr;
        }
    }

    /* Two column layout for medium mobile screens */
    @media (min-width: 481px) and (max-width: 767px) {
        .properties-grid {
            grid-template-columns: repeat(2, 1fr);
        }
    }
}

/* Animations */
@keyframes favoriteAdded {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes favoriteAdding {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes favoriteRemoving {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.8);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
    .property-card.mobile-enhanced,
    .favorite-btn,
    .swipe-feedback,
    .mobile-quick-actions {
        transition: none;
        animation: none;
    }
    
    .loading-spinner {
        animation: none;
        border-top-color: var(--primary-color);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .favorite-btn {
        background: white;
        border: 2px solid var(--text-primary);
    }
    
    .favorite-btn.favorited {
        background: var(--primary-color);
        border-color: var(--primary-color);
    }
    
    .swipe-indicator {
        background: rgba(0, 0, 0, 0.9);
        border: 2px solid white;
        border-radius: var(--radius-md);
        padding: var(--space-md);
    }
}

/* Focus styles for keyboard navigation */
.favorite-btn:focus,
.quick-action-btn:focus,
.retry-load:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Toast notification styles */
.atlas-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    z-index: var(--z-tooltip);
    opacity: 0;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.atlas-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
