/* ===============================
    RichTea — Shared Menu / Ordering UI
    Used by: customer/menu.php AND cashier/walkin.php
===============================*/

:root {
    /* Use consistent variables from style.css */
    --primary: #1B1B1B;
    --secondary: #C89B5B;
    --accent: #E8D8C3;
    --success: #5E8B5A;
    --background: #F8F6F2;
    --surface: #FFFDF9;
    --text: #2D2118;
    --text-muted: #8A7B70;
    --border: #EFE8DC;

    /* Additional menu-specific aliases */
    --bg-warm: var(--background);
    --ac-coffee: var(--primary);
    --ac-coffee-dark: #141414;
    --ac-gold: var(--secondary);
    --ac-gold-dark: #a67c29;
    --text-slate: var(--text);
    --border-warm: var(--border);
    --danger: #D9534F;
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --shadow-soft: 0 2px 10px rgba(27, 27, 27, .05);
    --shadow-lift: 0 10px 24px rgba(27, 27, 27, .10);
}

/* ===============================
        AMBIENT BACKGROUND
===============================*/

body::before {
    content: "";
    position: fixed;
    width: 500px;
    height: 500px;
    background: rgba(200, 155, 91, .06);
    border-radius: 50%;
    top: -180px;
    right: -150px;
    filter: blur(50px);
    z-index: -2;
}

body::after {
    content: "";
    position: fixed;
    width: 380px;
    height: 380px;
    background: rgba(139, 94, 60, .06);
    border-radius: 50%;
    bottom: -120px;
    left: -100px;
    filter: blur(50px);
    z-index: -2;
}

/* ===============================
        MENU HERO BANNER
===============================*/

.menu-hero {
    position: relative;
    overflow: hidden;
    padding: 44px 8% 32px;
    text-align: center;
    background: var(--bg-warm);
    border-bottom: 1px solid var(--border-warm);
}

.menu-hero-tag {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 20px;
    background: rgba(200, 155, 91, .12);
    color: var(--ac-gold-dark);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
}

.menu-hero h1 {
    color: var(--text-slate);
    font-size: 2.3rem;
    font-weight: 700;
    margin: 10px 0 6px;
    letter-spacing: -.5px;
}

.menu-hero p {
    color: #6b5b51;
    font-size: .95rem;
    line-height: 1.5;
    max-width: 520px;
    margin: 0 auto;
}

/* ===============================
        PAGE HEADER (cashier-style pages)
===============================*/

.page-header {
    background: linear-gradient(135deg, var(--ac-coffee) 0%, var(--ac-coffee-dark) 100%);
    color: var(--bg-warm);
    padding: 22px 28px;
    margin-bottom: 20px;
    border-radius: 0 0 20px 20px;
    box-shadow: var(--shadow-lift);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.page-header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -.2px;
}

.page-header-eyebrow {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(250, 247, 242, .65);
    margin-bottom: 2px;
}

/* ===============================
        WRAPPER LAYOUT
===============================*/

.wrapper {
    max-width: 1400px;
    margin: 20px auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
    gap: 24px;
    padding: 0 16px;
    align-items: start;
}

/* ===============================
        ORDERING LAYOUT (POS-style two column)
===============================*/

.ordering-layout {
    max-width: 1400px;
    margin: 20px auto;
    display: grid;
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    gap: 24px;
    padding: 0 16px;
    align-items: start;
}

.left-order-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    min-width: 0;
    position: sticky;
    top: 20px;
    align-self: start;
}

.right-menu-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    min-width: 0;
}

.right-menu-panel .top-category-nav {
    margin-bottom: 0;
}

/* ===============================
        TOP CATEGORY NAVIGATION
===============================*/

.top-category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
    padding: 5px;
    background: #fff;
    border: 1px solid var(--border-warm);
    border-radius: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow-soft);
}

.top-category-nav a {
    flex: 0 0 auto;
    text-decoration: none;
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .3px;
    color: var(--text-slate);
    padding: 9px 16px;
    border-radius: 20px;
    background: transparent;
    border: 1px solid transparent;
    transition: .2s ease;
    white-space: nowrap;
}

.top-category-nav a:hover {
    color: var(--ac-gold-dark);
    background: rgba(200, 155, 91, .1);
}

.top-category-nav a.active {
    color: var(--bg-warm);
    background: var(--ac-coffee);
    box-shadow: 0 4px 10px rgba(139, 94, 60, .3);
}

.top-category-nav a .cat-icon {
    margin-right: 4px;
    font-size: 12px;
}

/* ===============================
        LEFT SIDE (SEARCH + PRODUCTS)
===============================*/

.left-side {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    min-width: 0;
}

.search-section {
    position: relative;
    overflow: visible;
    background: #fff;
    border: 1px solid var(--border-warm);
    border-radius: var(--radius-lg);
    padding: 12px;
    box-shadow: var(--shadow-soft);
}

.search-section form {
    position: relative;
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    opacity: .5;
    pointer-events: none;
}

.search-section input {
    flex: 1;
    height: 42px;
    border: 1px solid var(--border-warm);
    border-radius: 50px;
    padding: 0 14px 0 40px;
    outline: none;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    transition: .2s ease;
}

.search-section input:focus {
    border-color: var(--ac-gold);
    box-shadow: 0 0 0 3px rgba(200, 155, 91, .12);
}

.search-section button {
    background: linear-gradient(135deg, var(--ac-gold), var(--ac-gold-dark));
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 0 22px;
    font-weight: 600;
    cursor: pointer;
    transition: .2s ease;
    font-size: 13px;
    box-shadow: 0 6px 14px rgba(200, 155, 91, .25);
}

.search-section button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(200, 155, 91, .35);
}

/* ===============================
        PRODUCT GRID
===============================*/

.menuContainer h2 {
    position: relative;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-slate);
    margin: 0 0 14px;
    padding-bottom: 8px;
}

.menuContainer h2::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 30px;
    height: 3px;
    border-radius: 12px;
    background: var(--ac-gold);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 16px;
    align-items: stretch;
}

.product-card {
    background: #fff;
    border: 1px solid var(--border-warm);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: .25s ease;
    animation: menuFadeUp .4s ease both;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    height: 100%;
}

@keyframes menuFadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lift);
    border-color: var(--ac-gold);
}

.product-card .card-media {
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-warm);
    aspect-ratio: 4 / 3;
}

.product-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: .5s ease;
}

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

.no-image {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-warm);
    color: #8A7B70;
    font-size: 12px;
}

.product-card .card-body {
    padding: 12px 12px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card h3 {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-slate);
    line-height: 1.3;
}

.product-card p {
    margin: 0 0 8px;
    color: #8A7B70;
    font-size: 11.5px;
    line-height: 1.4;
    min-height: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card strong {
    display: inline-block;
    align-self: flex-start;
    margin-bottom: 8px;
    padding: 3px 10px;
    border-radius: 16px;
    background: rgba(200, 155, 91, .12);
    color: var(--ac-gold-dark);
    font-size: 12px;
    font-weight: 700;
}

.product-card .details-btn {
    width: 100%;
    height: 34px;
    border: none;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--ac-gold), var(--ac-gold-dark));
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: .2px;
    cursor: pointer;
    margin-top: auto;
    transition: .2s ease;
    box-shadow: 0 4px 10px rgba(200, 155, 91, .2);
}

.product-card .details-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(200, 155, 91, .3);
}

.product-card .details-btn:disabled {
    background: #b7aa9c;
    color: #fff;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* ===============================
        CART / YOUR ORDER PANEL
===============================*/

.cart-sidebar {
    position: sticky;
    top: 20px;
    height: fit-content;
    background: #fff;
    border: 1px solid var(--border-warm);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: var(--shadow-soft);
    flex-shrink: 0;
}

/* Inside the new left-order-panel, the panel itself is sticky, so the
   cart-sidebar just needs to scroll internally if it gets tall */
.left-order-panel .cart-sidebar {
    position: relative;
    top: 0;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-warm);
}

.cart-header h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-slate);
}

.cart-count-badge {
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    background: var(--ac-gold);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

#cartItems {
    max-height: 340px;
    overflow-y: auto;
    padding-right: 4px;
    margin-bottom: 4px;
}

#cartItems p {
    color: #8A7B70;
    font-size: 12.5px;
    padding: 10px 2px;
}

#cartItems::-webkit-scrollbar {
    width: 4px;
}

#cartItems::-webkit-scrollbar-thumb {
    background: var(--ac-gold);
    border-radius: 8px;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-warm);
    border: 1px solid var(--border-warm);
    border-radius: 12px;
    padding: 8px;
    margin-bottom: 8px;
    transition: .2s ease;
}

.cart-item:hover {
    border-color: var(--ac-gold);
}

.cart-image {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--border-warm);
    flex-shrink: 0;
}

.cart-details {
    flex: 1;
    min-width: 0;
}

.cart-details h4 {
    margin: 0 0 2px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-slate);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-options {
    color: #8A7B70 !important;
    font-size: 10.5px !important;
    margin: 0 0 2px !important;
}

.cart-details p {
    margin: 0 0 4px;
    color: var(--ac-gold-dark);
    font-size: 12px;
    font-weight: 600;
}

.cart-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cart-controls button {
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: .15s ease;
}

.minus {
    background: #F2E7D7;
    color: var(--text-slate);
}

.minus:hover {
    background: #e6c89b;
}

.plus {
    background: var(--ac-gold);
    color: #fff;
}

.plus:hover {
    background: var(--ac-gold-dark);
}

.cart-controls span {
    min-width: 20px;
    height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
    border: 1px solid var(--border-warm);
    border-radius: 6px;
    font-weight: 600;
    font-size: 11px;
}

.remove-item {
    background: transparent;
    margin-left: 2px;
    font-size: 11px !important;
}

.remove-item:hover {
    transform: scale(1.1);
}

.cart-summary {
    margin-top: 4px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-warm);
    border: 1px solid var(--border-warm);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cart-summary h3 {
    margin: 0;
    font-size: 10px;
    color: #8A7B70;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 600;
}

.cart-summary h2 {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    color: var(--ac-coffee);
}

.cart-link-btn {
    display: block;
    width: 100%;
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
    margin-top: 12px;
    padding: 12px;
    border: none;
    border-radius: 20px;
    background: var(--ac-coffee);
    color: var(--bg-warm);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: .2s ease;
}

.cart-link-btn:hover {
    background: var(--ac-coffee-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(139, 94, 60, .25);
}

/* ===============================
        MOBILE RESPONSIVE
===============================*/

@media (max-width: 1000px) {
    .wrapper {
        grid-template-columns: 1fr;
    }

    .cart-sidebar {
        position: relative;
        top: 0;
        order: -1;
    }

    .top-category-nav {
        justify-content: center;
    }

    /* Ordering layout: switch to a single column, search + categories +
       products first, order summary last */
    .ordering-layout {
        grid-template-columns: 1fr;
    }

    .left-order-panel {
        position: relative;
        top: 0;
        order: 2;
    }

    .right-menu-panel {
        order: 1;
    }

    .cart-sidebar {
        max-height: none;
    }
}

@media (min-width: 1001px) and (max-width: 1200px) {
    /* Tablet: keep two columns but narrow the left panel */
    .ordering-layout {
        grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
    }
}

@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .cart-summary h2 {
        font-size: 17px;
    }

    .cart-link-btn {
        padding: 10px;
        font-size: 12.5px;
    }
}

@media (max-width: 600px) {
    .wrapper {
        padding: 8px;
        gap: 16px;
    }

    .ordering-layout {
        padding: 8px;
        gap: 16px;
    }

    .cart-sidebar {
        padding: 12px;
    }

    .search-section input {
        height: 38px;
        font-size: 12px;
        padding-left: 36px;
    }

    .search-section button {
        padding: 0 14px;
        font-size: 11px;
    }

    .cart-image {
        width: 32px;
        height: 32px;
    }

    .cart-controls button {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }

    .cart-summary h2 {
        font-size: 15px;
    }

    .cart-link-btn {
        padding: 10px;
        font-size: 11.5px;
    }
}

/* ===============================
        UNAVAILABLE PRODUCTS
===============================*/

.product-card.unavailable {
    opacity: .6;
}

.badge-unavailable {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--danger);
    color: white;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 3px 8px;
    border-radius: 30px;
}

.add-cart:disabled {
    background: #b7aa9c !important;
    cursor: not-allowed;
    box-shadow: none !important;
}

/* ===============================
        CATEGORY LIST (Fallback)
===============================*/

.category-list {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-list a {
    text-decoration: none;
    color: var(--text-slate);
    background: #fff;
    border: 1px solid var(--border-warm);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 500;
    transition: .2s ease;
}

.category-list a:hover {
    background: var(--ac-gold);
    color: #fff;
}

/* ===============================
        MODAL BASE (overlay + card)
===============================*/

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(27, 27, 27, .65);
    backdrop-filter: blur(5px);

    display: flex;
    justify-content: center;
    align-items: center;

    z-index: 9999;

    animation: fadeIn .25s ease;
}

.modal-card {
    background: var(--bg-warm);
    width: 92%;
    max-width: 420px;

    padding: 24px;
    border-radius: var(--radius-lg);
    text-align: center;

    border: 1px solid var(--ac-gold);
    box-shadow: 0 20px 40px rgba(0, 0, 0, .18);

    animation: popup .3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes popup {
    from { opacity: 0; transform: scale(.94); }
    to { opacity: 1; transform: scale(1); }
}

/* ===============================
        PRODUCT DETAILS MODAL
===============================*/

.product-modal-overlay {
    z-index: 10000;
}

.product-modal-card {
    max-width: 480px;
    width: 92%;
    max-height: 88vh;
    overflow-y: auto;
    text-align: left;
    padding: 26px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .05);
    border: none;
    font-size: 20px;
    line-height: 1;
    color: var(--text-slate);
    cursor: pointer;
    transition: .2s ease;
}

.modal-close:hover {
    background: rgba(0, 0, 0, .1);
    color: var(--danger);
}

.product-modal-image {
    width: 100%;
    height: 190px;
    object-fit: cover;
    background: var(--bg-warm);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.product-modal-card h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-slate);
    margin-bottom: 6px;
}

.product-modal-description {
    color: #8A7B70;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 16px;
}

.modal-unavailable {
    display: inline-block;
    position: static;
    margin-bottom: 12px;
}

.option-group {
    margin-bottom: 16px;
}

.option-group h4 {
    font-size: 12.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: var(--text-slate);
    margin-bottom: 8px;
}

.option-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.option-pill {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    background: #fff;
    border: 1px solid var(--border-warm);
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: .2s ease;
}

.option-pill:hover {
    border-color: var(--ac-gold);
}

.option-pill:has(input:checked) {
    border-color: var(--ac-gold);
    background: rgba(200, 155, 91, .1);
    font-weight: 600;
}

.option-pill input {
    accent-color: var(--ac-gold);
}

.option-subtitle {
    color: #8A7B70;
    font-size: 10px;
}

.option-group textarea {
    width: 100%;
    min-height: 60px;
    padding: 10px 12px;
    border: 1px solid var(--border-warm);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
    background: #fff;
}

.option-group textarea:focus {
    outline: none;
    border-color: var(--ac-gold);
    box-shadow: 0 0 0 3px rgba(200, 155, 91, .12);
}

/* Quantity stepper inside the product modal */
.qty-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 4px 0 16px;
    padding: 8px;
    background: var(--bg-warm);
    border: 1px solid var(--border-warm);
    border-radius: 40px;
    width: fit-content;
}

.qty-box button {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--ac-gold);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: .2s ease;
}

.qty-box button:hover {
    background: var(--ac-gold-dark);
}

.qty-box .qty-value {
    width: 40px;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-slate);
    -moz-appearance: textfield;
}

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

.modal-total {
    text-align: right;
    font-size: 17px;
    font-weight: 700;
    color: var(--ac-coffee);
    margin-bottom: 14px;
}

/* "Add To Cart" submit button inside the product modal */
.add-cart {
    width: 100%;
    height: 46px;
    border: none;
    border-radius: 24px;
    background: linear-gradient(135deg, var(--ac-coffee), var(--ac-coffee-dark));
    color: var(--bg-warm);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .2px;
    cursor: pointer;
    transition: .2s ease;
    box-shadow: 0 8px 18px rgba(139, 94, 60, .3);
}

.add-cart:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(139, 94, 60, .38);
}

@media (max-width: 600px) {
    .product-modal-card {
        padding: 18px;
    }
}
