/* saas/static/css/inventory/public_menu.css */

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-soft: #eef2ff;
    --dark: #0f172a;
    --gray: #64748b;
    --light-gray: #f1f5f9;
    --bg-body: #f8fafc;
    --card-bg: #ffffff;
    
    --radius-xl: 24px;
    --radius-lg: 16px;
    --radius-md: 12px;
    
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    --glass-blur: blur(12px);
    
    --container-width: 1200px;
}

body {
    background-color: var(--bg-body);
    font-family: 'Poppins', sans-serif;
    color: var(--dark);
    padding-bottom: 120px; /* Space for cart */
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* --- HERO SECTION --- */
.hero-section {
    position: relative;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 4rem 1.5rem 5rem;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    margin-bottom: -35px; /* Overlap effect */
    z-index: 1;
    overflow: hidden;
    text-align: center;
}

.hero-bg {
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    animation: rotateBg 20s linear infinite;
    pointer-events: none;
}

@keyframes rotateBg { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
}

/* --- STICKY NAV --- */
.sticky-nav-container {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(248, 250, 252, 0.9);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    margin-bottom: 2rem;
    padding: 0.5rem 0;
}

.nav-scroller {
    max-width: var(--container-width);
    margin: 0 auto;
    display: flex;
    overflow-x: auto;
    padding: 10px 1rem;
    gap: 10px;
    scrollbar-width: none; /* Hide scrollbar Firefox */
    -ms-overflow-style: none;  /* Hide scrollbar IE */
}
.nav-scroller::-webkit-scrollbar { display: none; } /* Hide Chrome */

.nav-pill {
    white-space: nowrap;
    padding: 10px 24px;
    border-radius: 50px;
    background: var(--card-bg);
    color: var(--gray);
    font-weight: 500;
    font-size: 0.9rem;
    border: 1px solid #e2e8f0;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-soft);
    flex-shrink: 0;
}

.nav-pill:hover {
    background: var(--light-gray);
    color: var(--dark);
    transform: translateY(-1px);
}

.nav-pill.active {
    background: var(--dark);
    color: white;
    border-color: var(--dark);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* --- MAIN LAYOUT --- */
.content-wrapper {
    max-width: var(--container-width);
    margin: 0 auto;
}

.section-title {
    font-weight: 800;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    padding-left: 1rem;
}

.section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 70%;
    width: 4px;
    background: var(--primary);
    border-radius: 4px;
}

/* --- MENU CARDS (Modern & Responsive) --- */
.menu-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    gap: 16px;
    box-shadow: var(--shadow-soft);
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    height: 100%;
    /* PC Optimization: Makes cards feel clickable */
    user-select: none; 
}

/* Desktop Hover Effect */
@media (min-width: 992px) {
    .menu-card:hover {
        transform: translateY(-5px);
        box-shadow: var(--shadow-hover);
        border-color: var(--primary-soft);
    }
    .menu-card:hover .card-img-wrapper img {
        transform: scale(1.1);
    }
    .menu-card:hover .add-btn-icon {
        background: var(--primary);
        transform: rotate(90deg);
    }
}

.menu-card:active {
    transform: scale(0.98);
}

/* Image Wrapper */
.card-img-wrapper {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--light-gray);
    position: relative;
}

.card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
}

/* Details Section (Flexbox Fix Applied Here) */
.card-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Spreads content vertically */
    min-width: 0; /* Prevents text overflow issues */
}

.item-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--dark);
    line-height: 1.3;
    margin-bottom: 4px;
}

.item-price {
    display: inline-block;
    font-weight: 700;
    color: var(--primary);
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.item-desc {
    font-size: 0.85rem;
    color: var(--gray);
    line-height: 1.5;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}
.item-desc.expanded {
    -webkit-line-clamp: unset;
    display: block;
    overflow: visible;
}

/* Add Button (Aligned to bottom-right) */
.add-btn-icon {
    position: relative; 
    align-self: flex-end;     /* Push to right */
    margin-top: auto;         /* Push to bottom */
    
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--dark);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

/* --- FLOATING CART (Responsive Dock) --- */
/* Legacy glass-cart — replaced by cart drawer */
.glass-cart {
    display: none !important;
}
.glass-cart-old {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-width: 500px;
    margin: 0 auto;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    
    border-radius: 100px; /* Pill shape */
    padding: 12px 24px;
    
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    z-index: 1000;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.1);
    
    transform: translateY(0);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s;
}

.glass-cart.d-none {
    display: flex !important;
    transform: translateY(150%);
    opacity: 0;
    pointer-events: none;
}

.glass-cart:hover {
    transform: scale(1.02) translateY(-2px);
}

.cart-count-badge {
    background: var(--primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

/* --- MODAL POLISH --- */
.modal-content {
    border-radius: 24px;
    border: none;
}
.modal-header {
    border-bottom: none;
    padding-top: 1.5rem;
}
.modal-footer {
    border-top: none;
}
.btn-shine {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    transition: opacity 0.2s;
}
.btn-shine:hover {
    opacity: 0.9;
}

/* --- ANIMATIONS --- */
.scroll-reveal { opacity: 0; transform: translateY(20px); transition: 0.6s ease; }
.scroll-reveal.visible { opacity: 1; transform: translateY(0); }
.shake-anim { animation: shake 0.5s; }


/* ─────────────────────────────────────────────────────────────────
   Mobile category-landing layout
   ─────────────────────────────────────────────────────────────────
   On mobile (<= 768px), the menu defaults to a category grid: tap a
   card to drill into that category's products. The horizontal pill
   nav is hidden — the category cards do the same job at a tap-target
   size that's friendlier on phones. Desktop is untouched.
*/
.mobile-category-landing { display: none; }

.cat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: var(--container-width);
    margin: 0 auto;
}

.cat-card {
    position: relative;
    aspect-ratio: 4 / 3;
    border: 0;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    background: var(--cat-color, #6c757d);
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
    transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.18s;
    color: #fff;
    text-align: left;
    padding: 0;
}
.cat-card:active {
    transform: scale(0.97);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.cat-card-bg {
    position: absolute;
    inset: 0;
    background: var(--cat-color, #6c757d);
}
.cat-card-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.55;
    transition: opacity 0.25s;
}
.cat-card:active .cat-card-bg img { opacity: 0.4; }
.cat-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.55) 100%);
    pointer-events: none;
}
.cat-card-content {
    position: absolute;
    inset: auto 14px 12px 14px;
    z-index: 1;
}
.cat-card-name {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.15;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
    margin: 0 0 2px;
}
.cat-card-meta {
    font-size: 0.74rem;
    font-weight: 600;
    opacity: 0.92;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* Mobile back-arrow header — only shown when drilled into a category */
.mobile-cat-header {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 8px 14px 4px;
}
.mobile-cat-back {
    width: 36px; height: 36px;
    border: 0;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.08);
    color: var(--dark);
    font-size: 1.1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.mobile-cat-back:active { background: rgba(15, 23, 42, 0.18); }
.mobile-cat-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--dark);
}

/* Drilled-into-category state. Body class added by JS on mobile when a
   card is tapped. Hides every category section except the targeted one,
   shows the back arrow, demotes the horizontal pill nav. */
body.mobile-cat-active .menu-section {
    display: none;
}
body.mobile-cat-active .menu-section.is-active-cat {
    display: block;
}

@media (max-width: 768px) {
    /* Show landing by default on phones */
    .mobile-category-landing { display: block; }
    body.mobile-landing .content-wrapper > .menu-section { display: none; }
    body.mobile-landing .nav-scroller { display: none; }
    /* Mobile back arrow visible only when drilled in */
    body.mobile-cat-active .mobile-cat-header { display: flex; }
    body.mobile-cat-active .mobile-category-landing { display: none; }
    body.mobile-cat-active .nav-scroller { display: flex; }
    /* While searching, hide the landing — flat product results take over */
    body.mobile-search-active .mobile-category-landing { display: none; }
    body.mobile-search-active .content-wrapper > .menu-section { display: block; }
    body.mobile-search-active .mobile-cat-header { display: none; }
}
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }