/* ============================================
   Savory Bites — Public Homepage Stylesheet
   ============================================ */

:root {
    --color-bg: #0a0a14;
    --color-surface: #12121f;
    --color-surface-alt: #1a1a2e;
    --color-accent: #e8491d;
    --color-accent-light: #ff6b3d;
    --color-gold: #f0a500;
    --color-text: #f0f0f5;
    --color-text-muted: #8888a0;
    --color-card-border: #252540;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-card: 0 8px 32px rgba(0,0,0,0.5);
    --shadow-ar: 0 8px 40px rgba(232,73,29,0.3);
    --font-display: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;
    --transition: 0.3s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-body); background: var(--color-bg); color: var(--color-text); line-height:1.6; overflow-x:hidden; }
a { color: inherit; text-decoration: none; }

/* Global Role Colors */
.role-admin { color: var(--color-gold) !important; }
.role-support { color: #32cd32 !important; } /* Lime Green */
.role-user { color: #fff !important; }

/* --- Top Navigation --- */
.top-nav {
    position: fixed; top:0; left:0; width:100%; z-index:2000;
    background: rgba(10,10,20,0.85);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--color-card-border);
    transition: var(--transition);
}
.top-nav.scrolled { box-shadow: 0 4px 30px rgba(0,0,0,0.5); }
.top-nav-inner {
    max-width:1300px; margin:0 auto;
    display:flex; align-items:center; justify-content:space-between;
    padding:12px 24px;
}
.nav-brand {
    font-family: var(--font-display);
    font-size: 1.3rem; font-weight:700;
    background: linear-gradient(135deg,#fff,var(--color-accent-light),var(--color-gold));
    -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text;
}
.nav-links { display:flex; gap:28px; list-style:none; align-items:center; }
.nav-links a {
    font-size:0.9rem; font-weight:500; color:var(--color-text-muted);
    transition:var(--transition); padding:6px 0; position:relative;
}
.nav-links a:hover { color:var(--color-accent-light); }
.nav-links a::after {
    content:''; position:absolute; bottom:-2px; left:0; width:0; height:2px;
    background:var(--color-accent); transition:var(--transition);
}
.nav-links a:hover::after { width:100%; }
.nav-menu-toggle { display:none; background:none; border:none; color:var(--color-text); font-size:1.4rem; cursor:pointer; }

/* Register Button in Nav */
.btn-nav-register {
    padding: 8px 20px;
    background: var(--color-accent);
    color: #fff !important;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
    margin-left: 10px;
    display: inline-block;
}
.btn-nav-register:hover {
    background: var(--color-accent-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(232, 73, 29, 0.3);
}

/* Remove the hover underline for the register button */
.btn-nav-register::after { display: none !important; }

/* Hero Secondary Button */
.btn-secondary { background: transparent; border: 2px solid var(--color-accent) !important; color: #fff; }
.btn-secondary:hover { background: var(--color-accent); }

/* Language Switcher */
.lang-switcher { display: flex; gap: 8px; margin-left: 20px; }
.lang-btn {
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
    border: 1px solid var(--color-card-border);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}
.lang-btn.active, .lang-btn:hover {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
}

/* --- Hero --- */
.hero {
    position:relative; min-height:100vh; min-height:100dvh; display:flex; flex-direction:column;
    align-items:center; justify-content:center; text-align:center; padding:80px 24px 60px;
    background: linear-gradient(rgba(10, 10, 20, 0.8), rgba(10, 10, 20, 0.6)), 
                url('../assets/images/restaurant-background.jpg');
    background-size: cover;
    background-position: center;
    overflow:hidden;
}
.hero-overlay {
    position:absolute; top:0; left:0; width:100%; height:100%;
    background: rgba(0, 0, 0, 0.1);
    pointer-events:none;
}
.hero-content { position:relative; z-index:2; }
.restaurant-name {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 8vw, 5rem);
    background: linear-gradient(135deg,#fff 0%,var(--color-accent-light) 50%,var(--color-gold) 100%);
    -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text;
    margin-bottom:10px; letter-spacing:2px;
}
.tagline { font-size:clamp(1rem,3vw,1.4rem); color:var(--color-text-muted); font-weight:300; margin-bottom:24px; letter-spacing:4px; text-transform:uppercase; }
.ar-prompt { font-size:0.95rem; color:var(--color-accent-light); animation:pulse 2s ease-in-out infinite; }
.ar-icon { display:inline-block; animation:bounce 1.5s ease-in-out infinite; }
.hero-actions { display:flex; gap:16px; margin-top:30px; flex-wrap:wrap; justify-content:center; }
.btn-hero {
    padding:14px 32px; background:var(--color-accent); color:#fff; border-radius:30px;
    font-family:var(--font-body); font-size:1rem; font-weight:600; cursor:pointer;
    transition:var(--transition); border:none;
}
.btn-hero:hover { background:var(--color-accent-light); transform:translateY(-2px); box-shadow:var(--shadow-ar); }

@keyframes pulse { 0%,100%{opacity:.7} 50%{opacity:1} }
@keyframes bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-4px)} }

.scroll-indicator { position:absolute; bottom:30px; left:50%; transform:translateX(-50%); color:var(--color-text-muted); font-size:.8rem; letter-spacing:2px; z-index:2; }
.scroll-arrow { width:24px; height:24px; margin:10px auto 0; border-right:2px solid var(--color-text-muted); border-bottom:2px solid var(--color-text-muted); transform:rotate(45deg); animation:scrollBounce 2s ease-in-out infinite; }
@keyframes scrollBounce { 0%,100%{transform:rotate(45deg) translate(0,0);opacity:.5} 50%{transform:rotate(45deg) translate(5px,5px);opacity:1} }

/* --- Menu Section --- */
.menu-container { max-width:1300px; margin:0 auto; padding:60px 24px; }
.section-label {
    font-family:var(--font-display); font-size:clamp(1.5rem,4vw,2.2rem);
    text-align:center; margin-bottom:10px; color:var(--color-text);
}
.menu-filters { display:flex; justify-content:center; gap:10px; flex-wrap:wrap; margin-bottom:40px; }
.filter-btn {
    padding:8px 20px; border-radius:30px; border:1px solid var(--color-card-border);
    background:transparent; color:var(--color-text-muted); font-family:var(--font-body);
    font-size:.85rem; cursor:pointer; transition:var(--transition);
}
.filter-btn.active, .filter-btn:hover { background:var(--color-accent); color:#fff; border-color:var(--color-accent); }

/* --- Category Section --- */
.category { margin-bottom:60px; padding-top:20px; }
.category-header { text-align:center; margin-bottom:36px; }
.category-title { font-family:var(--font-display); font-size:clamp(1.5rem,3.5vw,2.2rem); margin-bottom:12px; }
.category-line { width:80px; height:3px; background:linear-gradient(90deg,var(--color-accent),var(--color-gold)); margin:0 auto; border-radius:2px; }

/* --- Dish Grid --- */
.dish-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(320px,1fr)); gap:28px; }
.dish-card {
    background:var(--color-surface); border:1px solid var(--color-card-border);
    border-radius:var(--radius-lg); overflow:hidden; transition:var(--transition);
    animation:fadeUp .6s ease forwards; opacity:0;
}
.dish-card:nth-child(2){animation-delay:.1s} .dish-card:nth-child(3){animation-delay:.2s}
.dish-card:nth-child(4){animation-delay:.3s} .dish-card:nth-child(5){animation-delay:.4s}
.dish-card:nth-child(6){animation-delay:.5s}
@keyframes fadeUp { from{opacity:0;transform:translateY(30px)} to{opacity:1;transform:translateY(0)} }

.dish-card:hover { border-color:var(--color-accent); transform:translateY(-6px); box-shadow:var(--shadow-card); }
.dish-image-wrapper { position:relative; width:100%; height:240px; overflow:hidden; background:var(--color-surface-alt); }
.dish-image-wrapper img { width:100%; height:100%; object-fit:cover; transition:var(--transition); }
.dish-card:hover .dish-image-wrapper img { transform:scale(1.05); }
.badge { position:absolute; top:14px; right:14px; padding:4px 12px; font-size:.72rem; font-weight:600; letter-spacing:1px; border-radius:20px; color:#fff; }
.badge-new { background:var(--color-accent); }
.badge-popular { background:var(--color-gold); color:var(--color-bg); }
.badge-spicy { background:#e74c3c; }
.badge-vegan { background:#2ecc71; }
.badge-gluten-free { background:#9b59b6; }

.vegan-badge { background:#2ecc71; }
.gluten-badge { background:#9b59b6; }

.dish-info { padding:22px; }
.dish-name { font-family:var(--font-display); font-size:1.25rem; margin-bottom:6px; }
.dish-desc { font-size:.88rem; color:var(--color-text-muted); margin-bottom:16px; line-height:1.5; }
.dish-footer { display:flex; align-items:center; justify-content:space-between; }
.dish-price { font-family:var(--font-display); font-size:1.3rem; font-weight:700; color:var(--color-gold); }
.ar-btn {
    display:flex; align-items:center; gap:8px; padding:10px 18px;
    background:linear-gradient(135deg,var(--color-accent),var(--color-accent-light));
    color:#fff; border:none; border-radius:30px; font-size:.82rem; font-weight:600;
    font-family:var(--font-body); cursor:pointer; transition:var(--transition); white-space:nowrap;
}
.ar-btn:hover { transform:scale(1.05); box-shadow:var(--shadow-ar); }
.ar-btn-icon { font-size:1.1rem; }

/* --- AR Modal --- */
.ar-modal { position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.93); z-index:10000; display:flex; align-items:center; justify-content:center; opacity:0; transition:opacity .4s ease; pointer-events:none; }
.ar-modal.active { opacity:1; pointer-events:all; }
.ar-modal-content { width:92%; max-width:820px; position:relative; text-align:center; display: flex; flex-direction: column; }
.ar-close-btn { position:absolute; top:-12px; right:-12px; width:44px; height:44px; border-radius:50%; background:var(--color-surface); color:var(--color-text); border:1px solid var(--color-card-border); font-size:1.4rem; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:var(--transition); z-index:10; }
.ar-close-btn:hover { background:var(--color-accent); border-color:var(--color-accent); color:#fff; }
.ar-modal-title { font-family:var(--font-display); font-size:1.4rem; margin-bottom:12px; }
.ar-actions { margin:12px 0; }
.ar-instructions { margin-top:14px; color:var(--color-text-muted); font-size:.88rem; }

/* --- AR Overlay & Carousel --- */
#ar-model-viewer {
    position: relative;
    z-index: 1;
}

/* WebXR DOM Overlay: This wrapper will be visible inside the AR camera */
.ar-overlay-wrapper {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000; /* Ensure it stays above model-viewer's default UI */
    pointer-events: none; 
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 70%, transparent 100%);
    padding: 20px 0 30px; /* Extra bottom padding for mobile navigation bars */
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

.ar-overlay-status {
    color: #fff;
    font-size: 0.8rem;
    text-align: center;
    margin-bottom: 8px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
    font-weight: 500;
}

.ar-carousel {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 10px 20px;
    width: 100%;
    -webkit-overflow-scrolling: touch;
    pointer-events: auto; /* Important: Allows clicking inside the camera view */
    scrollbar-width: none; 
    mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
}

.ar-carousel::-webkit-scrollbar { display: none; }

.ar-item {
    flex: 0 0 auto;
    width: 75px;
    cursor: pointer;
    transition: var(--transition);
    opacity: 0.6;
    text-align: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.ar-item.active { 
    opacity: 1; 
    transform: translateY(-5px); 
}

.ar-item:active { transform: scale(0.9); }

.ar-item-thumb {
    width: 60px; height: 60px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.15);
    /* Frosted Glass Effect */
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    object-fit: cover; transition: var(--transition);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.ar-item.active .ar-item-thumb { border-color: var(--color-accent); box-shadow: 0 0 15px var(--color-accent); border-width: 3px; }
.ar-item-label { display: block; font-size: 0.7rem; margin-top: 6px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; text-shadow: 0 1px 4px rgba(0,0,0,0.8); }

/* --- Footer --- */
.footer { text-align:center; padding:40px 24px; border-top:1px solid var(--color-card-border); background:var(--color-surface); }
.footer-content { max-width:600px; margin:0 auto; }
.footer-brand-section h3 { font-family:var(--font-display); font-size:1.1rem; margin-bottom:4px; }
.footer-brand-section p { color:var(--color-text-muted); font-size:.85rem; margin-bottom:12px; }
.footer-links { display:flex; justify-content:center; gap:24px; margin-bottom:10px; }
.footer-links a { font-size:.85rem; color:var(--color-text-muted); transition:var(--transition); }
.footer-links a:hover { color:var(--color-accent-light); }
.footer-note { font-size:.78rem; color:var(--color-text-muted); opacity:.5; }

/* --- Loading --- */
.loading-screen { text-align:center; padding:80px 20px; color:var(--color-text-muted); }
.loader { width:48px; height:48px; border:3px solid var(--color-card-border); border-top-color:var(--color-accent); border-radius:50%; animation:spin .8s linear infinite; margin:0 auto 16px; }
@keyframes spin { to{transform:rotate(360deg)} }

/* Admin Dashboard Mobile Header Tweak */
@media (max-width: 992px) {
    .admin-mobile-header {
        justify-content: flex-start !important;
        padding-left: 15px !important;
    }
}

.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1500; /* Moves overlay behind the navigation */
}
.nav-overlay.open { display: block; }

/* --- Responsive --- */
@media (max-width:768px) {
    .top-nav-inner { padding:10px 16px; }
    .nav-links { 
        position:fixed; top:0; left:0; width:280px; height:100vh; 
        background:var(--color-surface);
        flex-direction:column; align-items:flex-start; justify-content:flex-start; 
        padding: 10px 24px; /* Reduced top padding to move username higher */
        gap:5px; transform:translateX(-100%); 
        transition:var(--transition); z-index:2100; 
        border-right: 1px solid var(--color-card-border);
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    }
    .nav-links.open { transform:translateX(0); }

    .nav-links li { width: 100%; }

    /* Username styling in drawer */
    .nav-links #user-greeting {
        font-size: 1.1rem !important;
        margin-bottom: 15px;
        padding: 15px 0 !important;
        border-bottom: 1px solid var(--color-card-border) !important;
        text-align: left !important;
        display: block;
        width: 100%;
    }
    .nav-links a, .nav-links #user-greeting { 
        font-size: 1rem; 
        padding: 12px 0; 
        display: block; 
        border-bottom: 1px solid rgba(255,255,255,0.05);
        text-align: left;
    }
    .nav-links a::after { bottom: 8px; }
    .nav-links .lang-switcher { margin-left: 0; margin-top: 20px; justify-content: flex-start; width: 100%; }

    .mobile-nav-header { display: flex !important; }

    .nav-menu-toggle { display:block; z-index:2000; }
    .hero { min-height:100vh; min-height:100dvh; padding:60px 20px 40px; }
    .hero-locked .hero { display: none !important; }
    .hero-actions { flex-direction:column; align-items:center; }
    .menu-container { padding:60px 16px 40px; }
    
    .btn-nav-register { margin-left: 0; }

    /* Transform Grid into Horizontal Slider */
    .dish-grid { 
        display: flex; 
        overflow-x: auto; 
        scroll-snap-type: x mandatory; 
        gap: 20px; 
        padding: 10px 20px 30px; 
        margin: 0 -16px; /* Allows cards to touch screen edges while scrolling */
        scrollbar-width: none; /* Hide scrollbar Firefox */
        -ms-overflow-style: none; /* Hide scrollbar IE/Edge */
    }
    .dish-grid::-webkit-scrollbar { display: none; } /* Hide scrollbar Chrome/Safari */

    .dish-card { flex: 0 0 280px; scroll-snap-align: center; opacity: 1 !important; transform: none !important; animation: none; }
    .dish-image-wrapper { height:180px; }
    .ar-btn { padding:8px 14px; font-size:.78rem; }
    .dish-info { padding:16px; }
    .dish-name { font-size:1.1rem; }
}

@media (max-width:480px) {
    .dish-footer { flex-direction:column; gap:10px; align-items:flex-start; }
    .ar-btn { width:100%; justify-content:center; }
    .dish-image-wrapper { height:180px; }
}

/* Wishlist & Heart Button Styles */
.wishlist-toggle {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(0,0,0,0.5);
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wishlist-toggle.active {
    color: #e74c3c;
    background: white;
}

.nav-wishlist-link {
    position: relative;
    color: var(--color-gold) !important;
    font-size: 1.2rem !important;
}

.nav-badge {
    position: absolute;
    top: -5px;
    right: -8px;
    background: var(--color-accent);
    color: white;
    font-size: 0.65rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* Wishlist Floating Button */
.wishlist-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: var(--color-gold);
    color: var(--color-bg);
    border: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    cursor: pointer;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    transition: var(--transition);
}

.wishlist-fab:hover {
    transform: scale(1.1);
    background: var(--color-accent-light);
}

.wishlist-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--color-bg);
}

/* Wishlist Modal Items */
.wishlist-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--color-card-border);
}

.wishlist-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.wishlist-item-info { flex: 1; text-align: left; }
.wishlist-item-info h4 { font-size: 1rem; margin-bottom: 4px; }
.wishlist-item-info span { color: var(--color-gold); font-weight: 600; }
.wishlist-remove { background: none; border: none; color: var(--color-text-muted); cursor: pointer; padding: 10px; }
.wishlist-remove:hover { color: #e74c3c; }
.wishlist-footer { margin-top: 20px; padding-top: 20px; border-top: 2px solid var(--color-card-border); }
.wishlist-total { font-size: 1.2rem; display: flex; justify-content: space-between; }

/* Wishlist Floating Button */
.wishlist-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: var(--color-gold);
    color: var(--color-bg);
    border: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    cursor: pointer;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    transition: var(--transition);
}

.wishlist-fab:hover {
    transform: scale(1.1);
    background: var(--color-accent-light);
}

.wishlist-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--color-bg);
}

/* Wishlist Modal Items */
.wishlist-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--color-card-border);
}

.wishlist-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.wishlist-item-info { flex: 1; text-align: left; }
.wishlist-item-info h4 { font-size: 1rem; margin-bottom: 4px; }
.wishlist-item-info span { color: var(--color-gold); font-weight: 600; }
.wishlist-remove { background: none; border: none; color: var(--color-text-muted); cursor: pointer; padding: 10px; }
.wishlist-remove:hover { color: #e74c3c; }
.wishlist-footer { margin-top: 20px; padding-top: 20px; border-top: 2px solid var(--color-card-border); }
.wishlist-total { font-size: 1.2rem; display: flex; justify-content: space-between; }

.out-of-stock-card img {
    filter: grayscale(1);
    opacity: 0.6;
}