/* Refactored Online Ordering Styles */

/* Base styles */
:root {
    /* Bridge to global theme variables for brand consistency */
    --primary: var(--color-secondary);
    --primary-light: var(--primary-light);
    --primary-dark: var(--color-secondary);
    --text: var(--color-primary);
    --text-light: var(--text-light);
    --bg-cream: var(--secondary);
    --gray-light: var(--gray-light);
    --gray-border: var(--gray-border);
    --navbar-height: 76px;
    --header-height: 60px;
    --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: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    color: var(--text);
    padding: 0;
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    z-index: 998;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    height: var(--header-height);
    border-bottom: 1px solid #e9ecef;
}

.order-header .container {
    height: 100%;
    padding-top: 0;
    padding-bottom: 0;
}

.header-content {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-left i {
    font-size: 1.2rem;
    color: var(--primary);
}

.header-subtitle {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-light);
}

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

.cart-button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
}

.cart-item-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #ff4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Category navigation */
.category-nav {
    background-color: white;
    padding: 10px 0;
    position: fixed;
    top: calc(var(--navbar-height) + var(--header-height));
    left: 0;
    right: 0;
    z-index: 997;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    height: var(--category-height);
    border-bottom: 1px solid #f0f0f0;
}

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

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

.category-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.category-scroll::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 10px;
}

.category-item {
    flex: 0 0 auto;
    padding: 8px 18px;
    color: var(--text);
    text-decoration: none;
    border-radius: 20px;
    white-space: nowrap;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
    background-color: #f8f9fa;
    border: 1px solid transparent;
}

.category-item:hover {
    background-color: #e9ecef;
    color: var(--primary);
    transform: translateY(-1px);
}

.category-item.active {
    background-color: var(--primary);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

/* 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 */
/* Make section titles clearly visible with brand green chip */
.menu-section .section-title {
    display: inline-block;
    margin-bottom: 20px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--light);
    background: var(--primary);
    border: 1px solid var(--primary);
    padding: 6px 12px;
    border-radius: 999px;
}

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

/* Menu item cards */
.menu-item-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
}

.menu-item-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    border-color: var(--primary-light);
}

.menu-item-img {
    height: 200px;
    overflow: hidden;
    background-color: #f8f9fa;
}

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

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

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

.menu-item-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
    line-height: 1.3;
}

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

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

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

.quantity-control {
    display: flex;
    align-items: center;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    background-color: #f8f9fa;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border: none;
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text);
    font-weight: 600;
}

.qty-btn:hover {
    background-color: #e9ecef;
    color: var(--primary);
}

.qty-btn:active {
    transform: scale(0.95);
}

.qty-input {
    width: 36px;
    height: 32px;
    border: none;
    text-align: center;
    font-weight: 600;
    background-color: transparent;
    color: var(--text);
    font-size: 0.95rem;
    -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-light);
    color: var(--color-primary);
    border: 1px solid var(--gray-border);
    border-radius: 10px;
    padding: 0 18px;
    height: 38px;
    font-weight: 600;
    flex-grow: 1;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    box-shadow: 0 2px 6px rgba(1, 38, 64, 0.08);
}

.add-to-cart-btn:hover {
    background-color: var(--primary-light);
    border-color: var(--primary);
    color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(1, 38, 64, 0.12);
}

.add-to-cart-btn:active {
    transform: translateY(0);
    background-color: #d5ebe5;
}

/* 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;
    color: var(--light);
    border-radius: 5px;
    padding: 12px;
    font-weight: 500;
}

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

#checkout-btn-modal i { color: var(--light); }

/* 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: 60px;
        --header-height: 50px;
    }

    .menu-items {
        grid-template-columns: 1fr;
        gap: 1px;
    }

    .menu-item-card {
        border-radius: 0;
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        box-shadow: none;
        border: none;
        border-bottom: 1px solid #f0f0f0;
        padding: 12px 0;
    }

    .menu-item-card:hover {
        transform: none;
        box-shadow: none;
    }

    .menu-item-img {
        width: 100px;
        height: 100px;
        flex-shrink: 0;
        order: 2;
        margin-left: 12px;
        border-radius: 8px;
    }

    .menu-item-img img {
        border-radius: 8px;
    }

    .menu-item-card:hover .menu-item-img img {
        transform: none;
    }

    .menu-item-info {
        padding: 0;
        flex: 1;
        order: 1;
        display: flex;
        flex-direction: column;
    }

    /* Name and price row */
    .menu-item-header {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 8px;
        margin-bottom: 6px;
    }

    .menu-item-name {
        font-size: 0.95rem;
        margin: 0;
        font-weight: 600;
        line-height: 1.3;
        flex: 1;
    }

    .menu-item-price {
        font-size: 0.95rem;
        margin: 0;
        font-weight: 700;
        white-space: nowrap;
    }

    .menu-item-desc {
        font-size: 0.75rem;
        margin-bottom: 10px;
        margin-top: 0;
        -webkit-line-clamp: 2;
        color: #999;
        line-height: 1.4;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .menu-item-actions {
        margin-top: auto;
        width: 100%;
    }

    .quantity-control {
        border: 1px solid #e0e0e0;
        background-color: white;
    }

    .qty-btn {
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }

    .qty-input {
        width: 32px;
        height: 28px;
        font-size: 0.85rem;
    }

    .add-to-cart-btn {
        padding: 0 12px;
        height: 32px;
        font-size: 0.8rem;
        font-weight: 600;
        background-color: #f1faee;
        border: 1px solid #e0e0e0;
        color: #1d3557;
    }

    .add-to-cart-btn:hover {
        background-color: #e3f2ed;
        border-color: #a8dadc;
        color: #1d3557;
        box-shadow: 0 2px 6px rgba(168, 218, 220, 0.3);
    }

    .add-to-cart-btn:active {
        background-color: #d5ebe5;
    }

    .section-title {
        font-size: 1.1rem;
        margin-bottom: 12px;
        padding-bottom: 6px;
    }

    .order-header {
        top: var(--navbar-height);
        height: var(--header-height);
    }

    .header-content {
        padding: 0 12px;
        height: 100%;
    }

    .header-subtitle {
        font-size: 0.8rem;
    }

    .header-left i {
        font-size: 1rem;
    }

    .cart-button {
        width: 44px;
        height: 34px;
        font-size: 1.1rem;
        position: relative;
        z-index: 1000;
        pointer-events: auto;
    }

    .header-content {
        position: relative;
        z-index: 1000;
    }

    .category-nav {
        top: calc(var(--navbar-height) + var(--header-height));
    }

    .category-item {
        font-size: 0.85rem;
        padding: 7px 16px;
    }

    .order-container {
        margin-top: calc(var(--navbar-height) + var(--header-height) + var(--category-height) + 15px);
        padding-bottom: 20px;
    }

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

    .menu-section .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    /* Hide floating buttons on mobile */
    .floating-cart-button {
        display: none !important;
    }

    .back-to-top {
        display: none !important;
    }

    /* 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: var(--dark) !important; /* Theme: Navy 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;
}
