/* ========================================
   CHEF'S RESTAURANT STORE - FUTURISTIC THEME
   Dark Theme with Orange Accents
   ======================================== */

/* ----------------------------------------
   CSS CUSTOM PROPERTIES (Variables)
   ---------------------------------------- */
:root {
    /* Primary Colors */
    --bg-primary: #0a0a0a;
    --bg-secondary: #0f0f0f;
    --bg-tertiary: #1a1a1a;
    --bg-card: #141414;

    /* Orange Accent Palette */
    --accent-primary: #ff6d00;
    --accent-secondary: #ff8c00;
    --accent-glow: rgba(255, 109, 0, 0.4);
    --accent-subtle: rgba(255, 109, 0, 0.1);

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #666666;

    /* Borders & Shadows */
    --border-color: #2a2a2a;
    --border-hover: #3a3a3a;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px var(--accent-glow);

    /* Spacing */
    --header-height: 70px;
    --search-bar-height: 70px;
    --container-padding: 20px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;

    /* Typography */
    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

/* ----------------------------------------
   RESET & BASE STYLES
   ---------------------------------------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    /* Account for fixed elements */
    padding-top: var(--header-height);
    padding-bottom: calc(var(--search-bar-height) + 20px);
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-fast);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* ----------------------------------------
   STICKY NAVIGATION HEADER
   ---------------------------------------- */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
}

.nav-container {
    max-width: 1400px;
    height: 100%;
    margin: 0 auto;
    padding: 0 var(--container-padding);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
}

/* Logo Styles */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 1px;
    white-space: nowrap;
}

.logo-icon {
    color: var(--accent-primary);
    font-size: 1.5rem;
    animation: pulse 2s ease-in-out infinite;
}

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

.logo-text .accent {
    color: var(--accent-primary);
}

/* Navigation Menu */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--accent-subtle);
}

.dropdown-arrow {
    transition: transform var(--transition-fast);
}

/* Categories Dropdown */
.has-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    padding: 10px 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--transition-normal);
}

.has-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(5px);
}

.dropdown-menu li a {
    display: block;
    padding: 12px 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.dropdown-menu li a:hover {
    color: var(--accent-primary);
    background: var(--accent-subtle);
    padding-left: 26px;
}

/* Navigation Actions (Right side) */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.auth-link {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.auth-link:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Shopping Cart Icon */
.cart-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.cart-icon:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.cart-count {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--bg-primary);
    background: var(--accent-primary);
    border-radius: 10px;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
}

.hamburger {
    position: relative;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform var(--transition-fast);
}

.hamburger::before { top: -8px; }
.hamburger::after { bottom: -8px; }

/* ----------------------------------------
   HERO BANNER
   ---------------------------------------- */
.hero-banner {
    position: relative;
    padding: 80px var(--container-padding);
    text-align: center;
    overflow: hidden;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: 3px;
    line-height: 1.2;
    margin-bottom: 20px;
}

.hero-title .accent {
    color: var(--accent-primary);
    text-shadow: 0 0 40px var(--accent-glow);
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.hero-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    opacity: 0.3;
    pointer-events: none;
}

/* ----------------------------------------
   MAIN CONTENT & PRODUCTS SECTION
   ---------------------------------------- */
.main-content {
    min-height: 100vh;
}

.products-section {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px var(--container-padding);
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
}

.section-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ----------------------------------------
   MASONRY PRODUCT GRID
   ---------------------------------------- */
.product-grid {
    position: relative;
}

/* Grid Sizer - used by Masonry for consistent column widths */
.grid-sizer,
.product-card {
    width: calc(25% - 15px);
}

/* Product Card */
.product-card {
    margin-bottom: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    /* Smooth positioning transitions for masonry */
    transition: transform 0.3s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent-primary);
    box-shadow:
        var(--shadow-lg),
        0 0 30px var(--accent-glow),
        inset 0 0 20px var(--accent-subtle);
}

/* Product Image Container */
.product-image-container {
    display: block;
    position: relative;
    overflow: hidden;
    background: var(--bg-tertiary);
    /* Fixed aspect ratio to prevent layout shift */
    aspect-ratio: 4 / 3;
    cursor: pointer;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.4s ease, opacity 0.3s ease;
    background: #fff;
    padding: 10px;
}

/* Smooth image loading transitions */
.product-image.loading {
    opacity: 0.5;
}

.product-image.loaded {
    opacity: 1;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

/* Lazy Loading Placeholder */
.product-image[data-src] {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 0%,
        var(--bg-secondary) 50%,
        var(--bg-tertiary) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

/* Quick View Badge */
.quick-view-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--bg-primary);
    background: var(--accent-primary);
    border-radius: var(--radius-sm);
    opacity: 0;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
}

.product-card:hover .quick-view-badge {
    opacity: 1;
    transform: translateY(0);
}

/* Product Info */
.product-info {
    padding: 18px;
}

.product-category {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-primary);
    margin-bottom: 8px;
}

.product-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-name a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.product-name a:hover {
    color: var(--accent);
}

/* Product Description */
.product-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Product SKU */
.product-sku {
    font-size: 0.7rem;
    font-family: var(--font-display);
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

/* Product Pricing */
.product-pricing {
    margin-bottom: 15px;
}

.price-case {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-bottom: 4px;
}

.price-amount {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.price-amount .currency {
    font-size: 0.9rem;
    color: var(--accent-primary);
}

.price-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.price-unit {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Product Actions - Quantity & Add to Cart */
.product-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Quantity Selector */
.quantity-selector {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qty-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.qty-select {
    width: 60px;
    height: 38px;
    padding: 0 8px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='%23666'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.qty-select:hover,
.qty-select:focus {
    border-color: var(--accent-primary);
    outline: none;
}

.qty-select option {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Add to Cart Button */
.add-to-cart-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--bg-primary);
    background: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.add-to-cart-btn:hover {
    background: var(--accent-secondary);
    border-color: var(--accent-secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.add-to-cart-btn.added {
    background: #22c55e;
    border-color: #22c55e;
}

.add-to-cart-btn svg {
    flex-shrink: 0;
}

/* ----------------------------------------
   LOADING INDICATOR
   ---------------------------------------- */
.loading-indicator {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    color: var(--text-muted);
}

.loading-indicator.visible {
    display: flex;
}

.loader {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.loader span {
    width: 10px;
    height: 10px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
}

.loader span:nth-child(1) { animation-delay: 0s; }
.loader span:nth-child(2) { animation-delay: 0.2s; }
.loader span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    40% {
        transform: translateY(-15px);
        opacity: 1;
    }
}

/* ----------------------------------------
   FIXED BOTTOM SEARCH BAR
   ---------------------------------------- */
.search-bar-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--search-bar-height);
    padding: 0 var(--container-padding);
    background: rgba(10, 10, 10, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.search-bar {
    position: relative;
    width: 100%;
    max-width: 800px;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 0 20px;
    height: 50px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.search-bar:focus-within {
    border-color: var(--accent-primary);
    box-shadow:
        0 0 0 3px var(--accent-subtle),
        var(--shadow-glow);
}

.search-icon {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.search-bar:focus-within .search-icon {
    color: var(--accent-primary);
}

.search-input {
    flex: 1;
    height: 100%;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-primary);
    background: transparent;
    border: none;
    outline: none;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-button {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: var(--bg-primary);
    background: var(--accent-primary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.search-button:hover {
    background: var(--accent-secondary);
    transform: translateX(3px);
}

/* Orange Glow Effect */
.search-glow {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 80px;
    background: radial-gradient(ellipse at bottom, var(--accent-glow) 0%, transparent 70%);
    opacity: 0.5;
    pointer-events: none;
}

/* ----------------------------------------
   RESPONSIVE DESIGN
   ---------------------------------------- */

/* Tablet & Small Desktop */
@media (max-width: 1200px) {
    .grid-sizer,
    .product-card {
        width: calc(33.333% - 14px);
    }
}

/* Tablet */
@media (max-width: 900px) {
    .grid-sizer,
    .product-card {
        width: calc(50% - 10px);
    }

    .nav-menu {
        display: none;
    }

    .auth-link .auth-text {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .hero-banner {
        padding: 60px var(--container-padding);
    }
}

/* Mobile */
@media (max-width: 600px) {
    :root {
        --header-height: 60px;
        --search-bar-height: 65px;
    }

    .logo {
        font-size: 1rem;
    }

    .logo-icon {
        font-size: 1.2rem;
    }

    .grid-sizer,
    .product-card {
        width: 100%;
        margin-bottom: 15px;
    }

    .hero-title {
        letter-spacing: 1px;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    .search-bar {
        height: 46px;
        padding: 0 15px;
    }

    .search-input {
        font-size: 0.9rem;
    }

    .section-header {
        margin-bottom: 30px;
    }

    .products-section {
        padding: 30px var(--container-padding);
    }
}

/* ----------------------------------------
   SCROLLBAR STYLING
   ---------------------------------------- */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 5px;
    border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* Firefox */
html {
    scrollbar-width: thin;
    scrollbar-color: var(--bg-tertiary) var(--bg-primary);
}

/* ----------------------------------------
   ACCESSIBILITY IMPROVEMENTS
   ---------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* ----------------------------------------
   UTILITY CLASSES
   ---------------------------------------- */
.accent {
    color: var(--accent-primary);
}

.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;
}
