* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding-bottom: env(safe-area-inset-bottom);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

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

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@keyframes heartbeat {
    0% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.3);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.3);
    }
    70% {
        transform: scale(1);
    }
}

/* Search Input Animations */
.search-container {
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-container.focused {
    transform: scale(1.02);
}

.search-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    z-index: -1;
}

.search-container.focused::before {
    width: 120%;
    height: 120%;
}

.search-input {
    transition: all 0.3s ease;
    font-size: 14px;
    background: transparent !important;
    color: #333;
}

.search-input:focus {
    background: transparent !important;
    outline: none !important;
    box-shadow: none !important;
    padding-left: 25px !important;
}

/* Mobile Search Focus Overlay */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 997;
}

.search-overlay.active {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    pointer-events: all;
}

/* Search Suggestions */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 15px;
    margin-top: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

.search-suggestions.active {
    max-height: 300px;
    opacity: 1;
    animation: slideInDown 0.3s ease;
}

@keyframes slideInDown {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Product Card Animations */
.product-card {
    animation: fadeInUp 0.5s ease backwards;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    overflow: hidden;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.product-card:nth-child(odd) {
    animation-delay: 0.1s;
}

.product-card:nth-child(even) {
    animation-delay: 0.2s;
}

.product-card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* Favorite Button Animation */
.btn-favorite {
    transition: all 0.3s ease;
}

.btn-favorite:active {
    animation: heartbeat 0.8s ease;
}

.btn-favorite i {
    transition: all 0.3s ease;
}

.btn-favorite.liked i {
    animation: heartbeat 0.8s ease;
    color: #ef4444;
}

/* Category Pills Scroll Animation */
.category-pill {
    animation: slideInRight 0.4s ease backwards;
    transition: all 0.3s ease;
    cursor: pointer;
    white-space: nowrap;
    touch-action: manipulation;
}

.category-pill:nth-child(1) { animation-delay: 0.05s; }
.category-pill:nth-child(2) { animation-delay: 0.1s; }
.category-pill:nth-child(3) { animation-delay: 0.15s; }
.category-pill:nth-child(4) { animation-delay: 0.2s; }
.category-pill:nth-child(5) { animation-delay: 0.25s; }
.category-pill:nth-child(6) { animation-delay: 0.3s; }

.category-pill:active {
    transform: scale(0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Bottom Navigation Animation */
.bottom-nav {
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.bottom-nav a {
    transition: all 0.3s ease;
    position: relative;
}

.bottom-nav a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    width: 0;
    height: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: translateX(-50%);
    transition: width 0.3s ease;
}

.bottom-nav a.active::after {
    width: 30px;
}

.bottom-nav a:active {
    transform: scale(0.9);
}

/* Modal Animations */
.modal.fade .modal-dialog {
    transform: scale(0.7) translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.show .modal-dialog {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Loading Skeleton Animation */
.skeleton-loader {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* Touch Ripple Effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.ripple:active::before {
    animation: ripple 0.6s ease-out;
}

/* Modern Filter Styles */
.form-check-input:checked {
    background-color: #667eea;
    border-color: #667eea;
}

.form-switch .form-check-input {
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.form-switch .form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(102, 126, 234, 0.25);
}

.btn-check:checked + .btn-outline-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
}

.btn-outline-primary {
    border-color: rgba(102, 126, 234, 0.3);
    color: #667eea;
    transition: all 0.3s ease;
}

.btn-outline-primary:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
}

/* Modern Select */
.modern-select {
    background: rgba(102, 126, 234, 0.05);
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    padding: 10px 15px;
    font-size: 14px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.modern-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.25rem rgba(102, 126, 234, 0.15);
    background: white;
}

/* Dual Range Slider */
.range-slider-container {
    position: relative;
    margin: 20px 0;
}

.range-slider-container input[type="range"] {
    position: absolute;
    width: 100%;
    pointer-events: none;
    -webkit-appearance: none;
    background: transparent;
}

.range-slider-container input[type="range"]::-webkit-slider-thumb {
    pointer-events: all;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    -webkit-appearance: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}

.range-slider-container input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.range-slider-container input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.3);
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.5);
}

.range-slider-container input[type="range"]::-moz-range-thumb {
    pointer-events: all;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.range-slider-container input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 3px;
}

.range-slider-container input[type="range"]::-moz-range-track {
    width: 100%;
    height: 6px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 3px;
}

#rangeMin {
    z-index: 2;
}

#rangeMax {
    z-index: 1;
}

.price-range-display {
    font-weight: 600;
}

.price-range-display .badge {
    padding: 8px 12px;
    font-size: 13px;
    background: rgba(102, 126, 234, 0.1) !important;
    color: #667eea !important;
}

/* Interactive Star Rating */
.star-rating-selector {
    user-select: none;
    -webkit-user-select: none;
}

.star-clickable {
    transition: all 0.2s ease;
    transform-origin: center;
}

.star-clickable:hover {
    transform: scale(1.2);
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.6));
}

.star-clickable:active {
    transform: scale(0.95);
}

.star-clickable.active {
    animation: starPop 0.3s ease;
}

@keyframes starPop {
    0% {
        transform: scale(1) rotate(0deg);
    }
    50% {
        transform: scale(1.3) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

.star-rating-selector:hover .star-clickable {
    color: #fbbf24 !important;
    opacity: 0.5;
}

.star-rating-selector .star-clickable:hover,
.star-rating-selector .star-clickable:hover ~ .star-clickable {
    opacity: 0.3;
}

.star-rating-selector:not(:hover) .star-clickable.filled {
    color: #fbbf24 !important;
}

/* Active filter badge */
.filter-active-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    animation: scaleIn 0.3s ease;
}

/* Notification Dot Enhanced */
.notification-dot {
    animation: pulse 2s infinite, bounce 3s infinite 1s;
}

/* Pull to Refresh Enhanced */
.pull-to-refresh {
    position: fixed;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 998;
}

.pull-to-refresh.visible {
    top: 10px;
    animation: bounce 1s ease;
}

/* Smooth Page Transitions */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Micro-interactions */
button, a, .clickable {
    position: relative;
    transition: all 0.2s ease;
}

button:active, a:active, .clickable:active {
    transform: scale(0.97);
}

/* Loading State */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #667eea;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Floating Action Button Animation */
.fab-add {
    animation: scaleIn 0.5s ease 0.5s backwards, float 3s ease-in-out infinite 1s;
}

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

.glass-morphism {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

.hero-pattern {
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* Mobile-first bottom navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
    display: none;
}

@media (max-width: 768px) {
    .bottom-nav {
        display: block;
    }
    
    .desktop-only {
        display: none !important;
    }
    
    body {
        padding-bottom: calc(70px + env(safe-area-inset-bottom));
    }
    
    .mobile-header {
        position: sticky;
        top: 0;
        z-index: 999;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }
    
    .product-card {
        touch-action: manipulation;
    }
}

.category-pill {
    transition: all 0.3s ease;
    cursor: pointer;
    white-space: nowrap;
    touch-action: manipulation;
}

.category-pill:active {
    transform: scale(0.95);
}

.product-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    overflow: hidden;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

@media (hover: hover) {
    .product-card:hover {
        transform: translateY(-8px) scale(1.02);
        box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    }
}

.product-card:active {
    transform: scale(0.98);
}

.notification-dot {
    animation: pulse 2s infinite;
}

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

.search-input {
    transition: all 0.3s ease;
    font-size: 14px;
    background: transparent !important;
    color: #333;
}

.search-input:focus {
    background: transparent !important;
    outline: none !important;
    box-shadow: none !important;
}

.search-input::placeholder {
    color: #9ca3af;
    opacity: 1;
}

/* Remove all Bootstrap input styling */
.search-input.form-control,
.search-input.form-control:focus {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

@media (max-width: 768px) {
    .search-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* PWA Install Prompt */
.install-prompt {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    display: none;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from { transform: translateX(-50%) translateY(100px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* Touch optimizations */
button, a, .clickable {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
}

/* Filter sidebar mobile optimized */
@media (max-width: 768px) {
    .filter-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        height: 100vh;
        z-index: 1002;
        transition: left 0.3s ease;
        padding-top: 60px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .filter-sidebar.active {
        left: 0;
    }

    .mobile-filter-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1001;
    }

    .mobile-filter-overlay.active {
        display: block;
    }
}

/* Pull to refresh indicator */
.pull-to-refresh {
    position: fixed;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    transition: top 0.3s ease;
    z-index: 998;
}

.pull-to-refresh.visible {
    top: 10px;
}

/* Safe area handling for iOS */
@supports (padding: max(0px)) {
    .mobile-header {
        padding-top: max(12px, env(safe-area-inset-top));
    }
    
    .bottom-nav {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
}

/* Optimized images loading */
.lazy-image {
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
}

/* 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(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.touch-feedback:active::after {
    width: 200px;
    height: 200px;
}