/* ========================================
   MOBILE UI ENHANCEMENTS - Dynamic & Modern
   ======================================== */

/* Smooth Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Mobile-First Responsive Enhancements */
@media (max-width: 768px) {
    
    /* Enhanced Navigation */
    .navbar {
        backdrop-filter: blur(10px);
        background: rgba(255, 255, 255, 0.95);
        transition: all 0.3s ease;
    }
    
    .navbar.scrolled {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    }
    
    .nav-container {
        padding: 0 16px;
        height: 64px;
    }
    
    .nav-brand {
        font-size: 20px;
        animation: fadeIn 0.5s ease;
    }
    
    .nav-search {
        display: none;
    }
    
    /* Mobile Search Bar */
    .mobile-search-toggle {
        display: block;
        background: var(--bg-light);
        border: none;
        padding: 10px 16px;
        border-radius: 8px;
        color: var(--text-medium);
        font-size: 14px;
        cursor: pointer;
        transition: all 0.3s ease;
        width: 100%;
        text-align: left;
    }
    
    .mobile-search-toggle:active {
        transform: scale(0.98);
        background: var(--bg-white);
    }
    
    /* Cart Button Enhancement */
    .nav-btn {
        position: relative;
        padding: 10px;
        transition: transform 0.2s ease;
    }
    
    .nav-btn:active {
        transform: scale(0.9);
    }
    
    .cart-badge {
        animation: pulse 2s infinite;
    }
    
    /* Hero Section - Mobile Optimized */
    .hero-modern {
        min-height: 60vh;
        background-attachment: scroll;
    }
    
    .hero-content-modern {
        padding: 40px 20px;
        animation: fadeInUp 0.8s ease;
    }
    
    .hero-title-modern {
        font-size: 28px;
        line-height: 1.2;
        margin-bottom: 12px;
    }
    
    .hero-subtitle-modern {
        font-size: 16px;
        margin-bottom: 24px;
    }
    
    /* Enhanced Search Bar */
    .hero-search-bar {
        flex-direction: column;
        gap: 12px;
        animation: fadeInUp 0.8s ease 0.2s both;
    }
    
    .search-input-group,
    .search-filter-group {
        width: 100%;
    }
    
    .hero-search-btn {
        width: 100%;
        padding: 16px;
        font-size: 16px;
        font-weight: 600;
        transition: all 0.3s ease;
        position: relative;
        overflow: hidden;
    }
    
    .hero-search-btn:active {
        transform: scale(0.98);
    }
    
    .hero-search-btn::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.3);
        transform: translate(-50%, -50%);
        transition: width 0.6s, height 0.6s;
    }
    
    .hero-search-btn:active::before {
        width: 300px;
        height: 300px;
    }
    
    /* Quick Filters - Swipeable */
    .quick-filters {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding: 16px 0;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        animation: fadeInUp 0.8s ease 0.4s both;
    }
    
    .quick-filters::-webkit-scrollbar {
        display: none;
    }
    
    .quick-filter-btn {
        flex-shrink: 0;
        scroll-snap-align: start;
        padding: 10px 20px;
        transition: all 0.3s ease;
        white-space: nowrap;
    }
    
    .quick-filter-btn:active {
        transform: scale(0.95);
    }
    
    /* Main Content - Stacked Layout */
    .main-content {
        flex-direction: column;
        padding: 16px;
    }
    
    /* Mobile Filter Toggle */
    .mobile-filter-toggle {
        position: fixed;
        bottom: 80px;
        right: 20px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--primary);
        color: white;
        border: none;
        box-shadow: 0 4px 20px rgba(45, 106, 79, 0.4);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        cursor: pointer;
        z-index: 999;
        transition: all 0.3s ease;
        animation: bounce 2s infinite;
    }
    
    .mobile-filter-toggle:active {
        transform: scale(0.9);
        animation: none;
    }
    
    /* Filters Sidebar - Slide In */
    .filters-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        background: white;
        z-index: 1001;
        transition: left 0.3s ease;
        overflow-y: auto;
        box-shadow: var(--shadow-lg);
    }
    
    .filters-sidebar.active {
        left: 0;
        animation: slideInLeft 0.3s ease;
    }
    
    .filter-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        backdrop-filter: blur(4px);
    }
    
    .filter-overlay.active {
        opacity: 1;
        pointer-events: all;
    }
    
    /* Plant Cards - Enhanced */
    .plants-grid-modern {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 16px;
    }
    
    .plant-card-modern {
        animation: fadeInUp 0.5s ease;
        transition: all 0.3s ease;
    }
    
    .plant-card-modern:active {
        transform: scale(0.98);
    }
    
    .plant-card-modern:nth-child(1) { animation-delay: 0.1s; }
    .plant-card-modern:nth-child(2) { animation-delay: 0.2s; }
    .plant-card-modern:nth-child(3) { animation-delay: 0.3s; }
    .plant-card-modern:nth-child(4) { animation-delay: 0.4s; }
    
    /* Skeleton Loading */
    .skeleton {
        background: linear-gradient(
            90deg,
            #f0f0f0 25%,
            #e0e0e0 50%,
            #f0f0f0 75%
        );
        background-size: 200% 100%;
        animation: shimmer 1.5s infinite;
        border-radius: 8px;
    }
    
    .skeleton-card {
        height: 280px;
        margin-bottom: 16px;
    }
    
    /* Cart Sidebar - Full Screen on Mobile */
    .cart-sidebar {
        width: 100%;
        animation: slideInRight 0.3s ease;
    }
    
    .cart-sidebar.active {
        right: 0;
    }
    
    /* Modal - Full Screen */
    .modal {
        padding: 0;
    }
    
    .modal-content {
        width: 100%;
        height: 100vh;
        max-width: 100%;
        border-radius: 0;
        animation: slideInRight 0.3s ease;
    }
    
    /* Bottom Navigation */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        display: flex;
        justify-content: space-around;
        padding: 12px 0;
        z-index: 998;
        border-top: 1px solid var(--border);
    }
    
    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        color: var(--text-light);
        text-decoration: none;
        font-size: 12px;
        transition: all 0.3s ease;
        padding: 8px 16px;
        border-radius: 8px;
    }
    
    .bottom-nav-item.active {
        color: var(--primary);
        background: var(--bg-light);
    }
    
    .bottom-nav-item i {
        font-size: 20px;
    }
    
    .bottom-nav-item:active {
        transform: scale(0.9);
    }
    
    /* Pull to Refresh */
    .pull-to-refresh {
        position: absolute;
        top: -60px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s ease;
    }
    
    .pull-to-refresh.active {
        top: 20px;
    }
    
    .pull-to-refresh i {
        font-size: 24px;
        color: var(--primary);
        animation: spin 1s linear infinite;
    }
    
    @keyframes spin {
        from { transform: rotate(0deg); }
        to { transform: rotate(360deg); }
    }
    
    /* Floating Action Buttons */
    .fab-container {
        position: fixed;
        bottom: 80px;
        right: 20px;
        z-index: 999;
    }
    
    .fab {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--primary);
        color: white;
        border: none;
        box-shadow: 0 4px 20px rgba(45, 106, 79, 0.4);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        cursor: pointer;
        transition: all 0.3s ease;
        margin-bottom: 12px;
    }
    
    .fab:active {
        transform: scale(0.9);
    }
    
    /* Touch Feedback */
    .touch-feedback {
        position: relative;
        overflow: hidden;
    }
    
    .touch-feedback::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(45, 106, 79, 0.2);
        transform: translate(-50%, -50%);
        transition: width 0.6s, height 0.6s;
    }
    
    .touch-feedback:active::after {
        width: 200px;
        height: 200px;
    }
    
    /* Swipe Indicators */
    .swipe-indicator {
        text-align: center;
        padding: 8px;
        color: var(--text-light);
        font-size: 12px;
        animation: fadeIn 0.5s ease;
    }
    
    .swipe-indicator i {
        animation: bounce 2s infinite;
    }
    
    /* Loading States */
    .loading-dots {
        display: inline-flex;
        gap: 4px;
    }
    
    .loading-dots span {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--primary);
        animation: bounce 1.4s infinite ease-in-out;
    }
    
    .loading-dots span:nth-child(1) {
        animation-delay: -0.32s;
    }
    
    .loading-dots span:nth-child(2) {
        animation-delay: -0.16s;
    }
    
    /* Smooth Scrolling */
    html {
        scroll-behavior: smooth;
    }
    
    /* Enhanced Buttons */
    button, .btn {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    /* Image Loading */
    img {
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    img.loaded {
        opacity: 1;
    }
    
    /* Footer Spacing for Bottom Nav */
    .footer-modern {
        padding-bottom: 80px;
    }
    
    /* Snackbar Notifications */
    .snackbar {
        position: fixed;
        bottom: 100px;
        left: 50%;
        transform: translateX(-50%) translateY(100px);
        background: var(--text-dark);
        color: white;
        padding: 16px 24px;
        border-radius: 8px;
        box-shadow: var(--shadow-lg);
        z-index: 9999;
        transition: transform 0.3s ease;
        max-width: 90%;
    }
    
    .snackbar.show {
        transform: translateX(-50%) translateY(0);
    }
    
    /* Category Pills */
    .category-pill {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 6px 12px;
        border-radius: 20px;
        background: var(--bg-light);
        font-size: 12px;
        transition: all 0.3s ease;
    }
    
    .category-pill:active {
        transform: scale(0.95);
        background: var(--accent);
    }
}

/* Tablet Optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .plants-grid-modern {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .hero-title-modern {
        font-size: 36px;
    }
}
