/* Refactored Online Ordering Styles */

/* Base styles */
:root {
    --primary: #c53030;
    --primary-light: #e05252;
    --primary-dark: #a52424;
    --text: #333;
    --text-light: #666;
    --bg-cream: #fdfbf6;
    --gray-light: #f5f5f5;
    --gray-border: #e0e0e0;
    --navbar-height: 76px;
    --header-height: 50px;
    --category-height: 58px;
}

body {
    background-color: var(--bg-cream);
    color: var(--text);
    font-family: 'Poppins', sans-serif;
}

.order-container {
    padding-bottom: 80px;
    margin-top: calc(var(--navbar-height) + var(--header-height) + var(--category-height) + 15px); /* Added extra padding */
    position: relative;
}

.order-container > .container {
    padding-top: 0; /* Reset padding for main container inside order-container */
}

/* Remove the general container padding we added earlier */
.container {
    padding-top: inherit; /* Remove the fixed padding */
}

/* Header styling */
.order-header {
    background-color: var(--primary);
    color: white;
    padding: 0;
    position: fixed;
    top: var(--navbar-height); /* Position below navbar using variable */
    left: 0;
    right: 0;
    z-index: 98;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    height: var(--header-height);
}

.order-header .container {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.order-header h1 {
    font-size: 1.8rem;
    margin: 0;
    font-weight: 600;
    line-height: 1;
    align-items: center;
}

.cart-button {
    background-color: white;
    color: var(--primary);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.cart-button:hover {
    background-color: #f8f8f8;
    transform: scale(1.05);
}

.cart-item-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--primary);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Category navigation */
.category-nav {
    background-color: rgb(221, 215, 215);
    padding: 10px 0;
    position: fixed;
    top: calc(var(--navbar-height) + var(--header-height)); /* Position below header using variables */
    left: 0;
    right: 0;
    z-index: 97;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    height: var(--category-height);
}

.category-scroll {
    display: flex;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: thin;
    -ms-overflow-style: none;
}

.category-scroll::-webkit-scrollbar {
    height: 2px;
}

.category-scroll::-webkit-scrollbar-thumb {
    background-color: var(--primary-light);
}

.category-item {
    flex: 0 0 auto;
    padding: 10px 20px;
    color: var(--text);
    text-decoration: none;
    border-radius: 25px;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.category-item:hover {
    background-color: #f5f5f5;
    color: var(--primary);
}

.category-item.active {
    background-color: var(--primary);
    color: white;
    font-weight: 500;
}

/* Menu sections */
.menu-section {
    padding: 30px 0;
    scroll-margin-top: calc(var(--navbar-height) + var(--header-height) + var(--category-height) + 15px);
}

/* Ensure section titles are visible */
.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text);
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
    clear: both;
}

.menu-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Menu item cards */
.menu-item-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.menu-item-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}

.menu-item-img {
    height: 180px;
    overflow: hidden;
}

.menu-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.menu-item-card:hover .menu-item-img img {
    transform: scale(1.05);
}

.menu-item-info {
    padding: 15px;
}

.menu-item-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text);
}

.menu-item-price {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.menu-item-desc {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Quantity and add to cart controls */
.menu-item-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-control {
    display: flex;
    align-items: center;
    border: 1px solid var(--gray-border);
    border-radius: 5px;
    overflow: hidden;
}

.qty-btn {
    width: 36px;
    height: 36px;
    border: none;
    background-color: var(--gray-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.qty-btn:hover {
    background-color: var(--gray-border);
}

.qty-input {
    width: 40px;
    height: 36px;
    border: none;
    text-align: center;
    font-weight: 500;
    -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.add-to-cart-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 0 16px;
    height: 36px;
    font-weight: 500;
    flex-grow: 1;
    transition: all 0.2s ease;
}

.add-to-cart-btn:hover {
    background-color: var(--primary-dark);
}

/* Toast notification */
.alert-toast {
    position: fixed;
    top: 100px;
    right: 20px;
    background-color: var(--primary);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 2000;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.alert-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Cart modal styling */
.modal-header {
    background-color: var(--primary);
    color: white;
}

.btn-close {
    filter: brightness(0) invert(1);
}

.modal-footer {
    border-top: 1px solid var(--gray-border);
}

#checkout-btn-modal {
    background-color: var(--primary);
    border: none;
    border-radius: 5px;
    padding: 12px;
    font-weight: 500;
}

#checkout-btn-modal:hover {
    background-color: var(--primary-dark);
}

/* Cart items */
.cart-item {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--gray-border);
}

.cart-item-details {
    flex-grow: 1;
}

.cart-item-price {
    font-weight: 600;
    color: var(--primary);
}

.remove-item {
    color: var(--primary);
    cursor: pointer;
    padding: 5px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    :root {
        --navbar-height: 76px; /* Keep consistent with desktop */
    }
    
    .menu-items {
        grid-template-columns: 1fr;
    }
    
    .menu-item-img {
        height: 150px;
    }
    
    .order-header {
        top: var(--navbar-height); /* For mobile navbar */
    }
    
    .category-nav {
        top: calc(var(--navbar-height) + var(--header-height)); /* For mobile navbar + header */
    }
    
    .order-container {
        margin-top: calc(var(--navbar-height) + var(--header-height) + var(--category-height) + 15px); /* Adjusted for mobile */
    }
    
    .menu-section {
        scroll-margin-top: calc(var(--navbar-height) + var(--header-height) + var(--category-height) + 15px);
    }
    
    .floating-cart-button {
        width: 50px;
        height: 50px;
        right: 20px;
        bottom: 20px;
    }
    
    .back-to-top {
        right: 20px;
        bottom: 80px;
    }
    
    /* Fix for mobile navbar dropdown */
    .navbar-collapse {
        position: absolute;
        top: var(--navbar-height);
        left: 0;
        right: 0;
        z-index: 1001;
    }
}

@media (min-width: 769px) and (max-width: 991px) {
    .menu-items {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Navbar and Cart Positioning Fix */


/* Body class for online-menu page */
body.online-menu-page {
    background-color: #2b4e72 !important; /* Change to blue background */
    opacity: 1 !important;
}

body.online-menu-page {
    padding-top: 0; /* Remove any default body padding */
}

/* Floating cart button for mobile/scroll */
.floating-cart-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 1000;
    transition: all 0.3s ease;
    display: none; /* Hidden by default, shown on scroll */
}

.floating-cart-button .cart-item-count {
    position: absolute;
    top: 0;
    right: 0;
    background-color: white;
    color: var(--primary);
    border: 2px solid var(--primary);
    width: 24px;
    height: 24px;
}

.floating-cart-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.4);
}

/* Back to top button positioning adjustment */
.back-to-top {
    bottom: 100px;
}

/* Apple Pay Button Styles */
.apple-pay-button {
    display: inline-block;
    -webkit-appearance: -apple-pay-button;
    -apple-pay-button-type: plain;
    -apple-pay-button-style: black;
    height: 48px;
    width: 100%;
    border-radius: 4px;
    margin-top: 10px;
    cursor: pointer;
}

.apple-pay-button-black {
    -apple-pay-button-style: black;
}

.apple-pay-button-white {
    -apple-pay-button-style: white;
}

/* Back to Top Button */
.back-to-top {
    bottom: 100px;
}