/* ==========================================
   Advanced BookMyCater Enhancements
   Next-Level User Experience
   ========================================== */

/* ==========================================
   Performance & Loading States
   ========================================== */

/* Loading Skeleton for Cards */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card {
    background: white;
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.skeleton-header {
    height: 20px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-text {
    height: 14px;
    width: 80%;
    margin-bottom: 8px;
}

.skeleton-text.short {
    width: 40%;
}

.skeleton-image {
    height: 200px;
    width: 100%;
    margin-bottom: 16px;
}

/* Progressive Image Loading */
.progressive-image {
    position: relative;
    overflow: hidden;
    background: var(--bg-light);
}

.progressive-image img {
    transition: opacity 0.3s ease, filter 0.3s ease;
}

.progressive-image img.loading {
    opacity: 0;
    filter: blur(10px);
}

.progressive-image img.loaded {
    opacity: 1;
    filter: blur(0);
}

.progressive-image::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.progressive-image.loading::before {
    opacity: 1;
}

/* ==========================================
   Advanced Interactive Components
   ========================================== */

/* Smart Search with Suggestions */
.smart-search {
    position: relative;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-suggestions.show {
    display: block;
    animation: slideDown 0.3s ease;
}

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

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: all 0.2s ease;
}

.suggestion-item:hover {
    background: var(--bg-light);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-icon {
    font-size: 1.1rem;
    opacity: 0.6;
}

.suggestion-text {
    flex: 1;
}

.suggestion-type {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-light);
    padding: 2px 8px;
    border-radius: 12px;
}

/* Interactive Price Range Slider */
.price-range-container {
    margin: 20px 0;
}

.price-range-slider {
    position: relative;
    width: 100%;
    height: 40px;
}

.price-range-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    transform: translateY(-50%);
}

.price-range-fill {
    position: absolute;
    height: 6px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 3px;
    top: 50%;
    transform: translateY(-50%);
}

.price-range-thumb {
    position: absolute;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
    transition: all 0.2s ease;
}

.price-range-thumb:hover {
    transform: translateY(-50%) scale(1.2);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

.price-range-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Advanced Filter Chips */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-chip:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.filter-chip.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-color: var(--primary);
}

.filter-chip .remove {
    font-size: 0.9rem;
    opacity: 0.7;
    cursor: pointer;
    margin-left: 4px;
}

.filter-chip .remove:hover {
    opacity: 1;
}

/* ==========================================
   Enhanced Accessibility Features
   ========================================== */

/* Focus Indicators */
.focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.3);
    border-color: var(--primary);
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --text: #000000;
        --bg: #ffffff;
        --border: #000000;
        --primary: #0066cc;
    }
}

/* Reduced Motion Support */
@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;
    }
}

/* Screen Reader Only Content */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ==========================================
   Modern Visual Enhancements
   ========================================== */

/* Glassmorphism Cards */
.glass-card {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

/* Neumorphism Elements */
.neomorphism {
    background: #e0e5ec;
    border-radius: 20px;
    box-shadow: 
        9px 9px 16px #a3b1c6,
        -9px -9px 16px #ffffff;
}

.neomorphism.inset {
    box-shadow: 
        inset 9px 9px 16px #a3b1c6,
        inset -9px -9px 16px #ffffff;
}

/* Advanced Gradient Backgrounds */
.gradient-bg-1 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.gradient-bg-2 {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.gradient-bg-3 {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.mesh-gradient {
    background: radial-gradient(at 40% 20%, hsla(28,100%,74%,1) 0px, transparent 50%),
                radial-gradient(at 80% 0%, hsla(189,100%,56%,1) 0px, transparent 50%),
                radial-gradient(at 0% 50%, hsla(355,100%,93%,1) 0px, transparent 50%),
                radial-gradient(at 80% 50%, hsla(340,100%,76%,1) 0px, transparent 50%),
                radial-gradient(at 0% 100%, hsla(22,100%,77%,1) 0px, transparent 50%),
                radial-gradient(at 80% 100%, hsla(242,100%,70%,1) 0px, transparent 50%),
                radial-gradient(at 0% 0%, hsla(343,100%,76%,1) 0px, transparent 50%);
}

/* ==========================================
   Smart Interaction States
   ========================================== */

/* Micro-interactions */
.micro-bounce:hover {
    animation: microBounce 0.6s ease;
}

@keyframes microBounce {
    0%, 20%, 53%, 80%, 100% { transform: translateY(0); }
    40%, 43% { transform: translateY(-4px); }
    70% { transform: translateY(-2px); }
}

.micro-pulse:hover {
    animation: microPulse 1s ease;
}

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

.micro-shake.error {
    animation: microShake 0.5s ease-in-out;
}

@keyframes microShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

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

.ripple-effect::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.ripple-effect:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 1;
    }
    20% {
        transform: scale(25, 25);
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: scale(40, 40);
    }
}

/* ==========================================
   Advanced Layout Enhancements
   ========================================== */

/* Smart Grid System */
.smart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: clamp(1rem, 4vw, 2rem);
}

.smart-grid.dense {
    grid-auto-flow: dense;
}

.smart-grid-item.featured {
    grid-column: span 2;
    grid-row: span 2;
}

/* Fluid Typography */
.fluid-text {
    font-size: clamp(1rem, 2.5vw, 1.5rem);
}

.fluid-heading {
    font-size: clamp(1.5rem, 4vw, 3rem);
}

/* Container Queries (when supported) */
@container (min-width: 300px) {
    .container-responsive {
        display: grid;
        grid-template-columns: 1fr 2fr;
    }
}

/* ==========================================
   Performance Optimizations
   ========================================== */

/* Optimized Animations */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

.gpu-accelerated:hover {
    will-change: auto;
}

/* Efficient Scrolling */
.smooth-scroll {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Image Optimization */
.optimized-img {
    content-visibility: auto;
    contain-intrinsic-size: 300px 200px;
}

/* ==========================================
   Dark Mode Support
   ========================================== */

@media (prefers-color-scheme: dark) {
    :root {
        --text: #ffffff;
        --text-light: #b0b0b0;
        --text-muted: #808080;
        --bg: #1a1a1a;
        --bg-light: #2a2a2a;
        --border: #404040;
        --shadow: rgba(0, 0, 0, 0.3);
    }
    
    .caterer-card,
    .step-card,
    .feature-card,
    .testimonial-card {
        background: var(--bg-light);
        color: var(--text);
    }
    
    .search-box,
    .filters-sidebar {
        background: var(--bg-light);
        border-color: var(--border);
    }
}

/* Manual Dark Mode Toggle */
[data-theme="dark"] {
    --text: #ffffff;
    --text-light: #b0b0b0;
    --text-muted: #808080;
    --bg: #1a1a1a;
    --bg-light: #2a2a2a;
    --border: #404040;
    --shadow: rgba(0, 0, 0, 0.3);
}

/* ==========================================
   Mobile-First Enhancements
   ========================================== */

/* Touch-Friendly Interactions */
@media (hover: none) and (pointer: coarse) {
    .btn, .caterer-card, .step-card {
        min-height: 44px;
        min-width: 44px;
    }
    
    .hover-effects:hover {
        transform: none;
    }
}

/* Safe Area Insets for Modern Phones */
@supports (padding: max(0px)) {
    .container {
        padding-left: max(24px, env(safe-area-inset-left));
        padding-right: max(24px, env(safe-area-inset-right));
    }
    
    .navbar {
        padding-top: max(16px, env(safe-area-inset-top));
    }
}

/* ==========================================
   Print Styles
   ========================================== */

@media print {
    .navbar, .floating-actions, .footer, .btn {
        display: none !important;
    }
    
    .caterer-card, .step-card {
        break-inside: avoid;
        margin-bottom: 20px;
    }
    
    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}