/* ============================================================
   Cart Drawer + Options Modal + Sticky Category Nav
   ============================================================ */

/* ---------- Overlay (shared) ---------- */
.cd-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s ease;
}
.cd-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* ---------- Cart Drawer ---------- */
.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 400px;
    max-height: 100dvh;
    max-height: -webkit-fill-available;
    z-index: 10001;
    background: #1a1a2e;
    color: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    box-shadow: -4px 0 24px rgba(0,0,0,0.3);
}
.cart-drawer.is-open {
    transform: translateX(0);
}

/* Header */
.cart-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}
.cart-drawer-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
}
.cart-drawer-header .cd-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 50px;
    background: var(--theme-accent, #b08968);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    margin-left: 8px;
}
.cart-drawer-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.6rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity .2s;
}
.cart-drawer-close:hover { opacity: 1; }

/* Body (scrollable items) */
.cart-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    -webkit-overflow-scrolling: touch;
}

/* Empty state */
.cart-drawer-empty {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255,255,255,0.5);
}
.cart-drawer-empty i {
    font-size: 3rem;
    display: block;
    margin-bottom: 12px;
    color: var(--theme-accent, #b08968);
    opacity: 0.5;
}
.cart-drawer-empty p {
    font-size: 1rem;
    margin: 0;
}

/* Cart item row */
.cd-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    align-items: flex-start;
}
.cd-item:last-child { border-bottom: none; }

.cd-item-info {
    flex: 1;
    min-width: 0;
}
.cd-item-name {
    font-size: 0.92rem;
    font-weight: 600;
    margin: 0 0 2px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cd-item-options {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.5);
    margin: 0 0 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cd-item-price {
    font-size: 0.85rem;
    color: var(--theme-accent, #b08968);
    font-weight: 600;
}

/* Qty stepper */
.cd-qty {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
}
.cd-qty button {
    width: 30px;
    height: 30px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    line-height: 1;
    padding: 0;
}
.cd-qty button:hover {
    background: rgba(255,255,255,0.12);
}
.cd-qty button:first-child { border-radius: 6px 0 0 6px; }
.cd-qty button:last-child  { border-radius: 0 6px 6px 0; }
.cd-qty .cd-qty-val {
    width: 36px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    background: rgba(255,255,255,0.08);
    border-top: 1px solid rgba(255,255,255,0.15);
    border-bottom: 1px solid rgba(255,255,255,0.15);
    color: #fff;
}

/* Remove button */
.cd-remove {
    background: none;
    border: none;
    color: rgba(255,255,255,0.35);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
    transition: color .2s;
    line-height: 1;
}
.cd-remove:hover { color: #ef4444; }

/* Footer */
.cart-drawer-footer {
    border-top: 2px solid var(--theme-accent, #b08968);
    padding: 16px 20px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    flex-shrink: 0;
}
.cd-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.cd-total-label {
    font-size: 1rem;
    color: rgba(255,255,255,0.7);
}
.cd-total-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
}
.cd-checkout-btn {
    display: block;
    width: 100%;
    padding: 14px;
    background: var(--theme-accent, #b08968);
    color: #fff;
    text-align: center;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: filter .2s;
    margin-bottom: 8px;
}
.cd-checkout-btn:hover { filter: brightness(1.1); color: #fff; text-decoration: none; }
.cd-continue-btn {
    display: block;
    width: 100%;
    padding: 10px;
    background: transparent;
    color: rgba(255,255,255,0.6);
    text-align: center;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: color .2s, border-color .2s;
}
.cd-continue-btn:hover {
    color: #fff;
    border-color: rgba(255,255,255,0.35);
}

/* ---------- Options Modal ---------- */
.options-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    z-index: 10002;
    background: #fff;
    color: #222;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, transform .25s ease, visibility .25s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}
.options-modal.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.om-header {
    padding: 20px 24px 12px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}
.om-header h3 {
    margin: 0 0 4px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a1a2e;
}
.om-header .om-desc {
    font-size: 0.88rem;
    color: #666;
    margin: 0 0 6px;
}
.om-header .om-base-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--theme-accent, #b08968);
}
.om-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: #f3f4f6;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}
.om-close:hover { background: #e5e7eb; }

.om-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    -webkit-overflow-scrolling: touch;
}

/* Option groups */
.om-group {
    margin-bottom: 20px;
}
.om-group-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.om-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    display: inline-block;
}
.om-badge-required { background: #fee2e2; color: #991b1b; }
.om-badge-hint { background: #f3f4f6; color: #374151; }

.om-option {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.om-option:hover { border-color: #d1d5db; background: #fafafa; }
.om-option.is-selected {
    border-color: var(--theme-accent, #b08968);
    background: rgba(176,137,104,0.05);
}
.om-option input[type="radio"],
.om-option input[type="checkbox"] {
    margin-right: 10px;
    accent-color: var(--theme-accent, #b08968);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.om-option-label {
    flex: 1;
    font-size: 0.92rem;
    color: #333;
}
.om-option-delta {
    font-size: 0.85rem;
    color: #888;
    margin-left: 8px;
    flex-shrink: 0;
}

/* Footer */
.om-footer {
    padding: 16px 24px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Qty in modal */
.om-qty {
    display: flex;
    align-items: center;
    gap: 0;
    flex-shrink: 0;
}
.om-qty button {
    width: 36px;
    height: 36px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #333;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    padding: 0;
    line-height: 1;
}
.om-qty button:first-child { border-radius: 8px 0 0 8px; }
.om-qty button:last-child  { border-radius: 0 8px 8px 0; }
.om-qty button:hover { background: #f3f4f6; }
.om-qty .om-qty-val {
    width: 44px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    border-top: 1px solid #d1d5db;
    border-bottom: 1px solid #d1d5db;
    background: #fff;
}

.om-add-btn {
    flex: 1;
    padding: 12px;
    background: var(--theme-accent, #b08968);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter .2s;
    text-align: center;
}
.om-add-btn:hover { filter: brightness(1.1); }
.om-add-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.om-loading {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

/* ---------- Delivery Nudge ---------- */
.cd-nudge {
    padding: 12px 16px;
    font-size: 0.88rem;
    color: rgba(255,255,255,0.85);
    border-top: 1px solid rgba(255,255,255,0.08);
}
.cd-nudge strong {
    color: #fff;
}
.cd-nudge-bar {
    height: 5px;
    background: rgba(255,255,255,0.12);
    border-radius: 10px;
    margin-top: 8px;
    overflow: hidden;
}
.cd-nudge-fill {
    height: 100%;
    background: var(--theme-accent, #b08968);
    border-radius: 10px;
    transition: width .4s ease;
}
.cd-nudge-success {
    color: #4ade80;
    font-weight: 600;
    padding: 12px 16px;
    font-size: 0.88rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.cd-nudge-success i {
    margin-right: 6px;
}

/* ---------- Recommendations ---------- */
.cd-recs {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 12px 16px 8px;
}
.cd-recs-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.45);
    margin: 0 0 10px;
    font-weight: 700;
}
.cd-recs-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.cd-recs-scroll::-webkit-scrollbar { display: none; }
.cd-rec-card {
    flex: 0 0 120px;
    background: rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    position: relative;
}
.cd-rec-img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 6px;
}
.cd-rec-img-placeholder {
    width: 64px;
    height: 64px;
    margin: 0 auto 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.08);
    border-radius: 8px;
    color: rgba(255,255,255,0.3);
    font-size: 1.3rem;
}
.cd-rec-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: #fff;
    margin: 0 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cd-rec-price {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.55);
}
.cd-rec-add {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--theme-accent, #b08968);
    color: #fff;
    border: none;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: filter .2s, transform .15s;
    padding: 0;
}
.cd-rec-add:hover {
    filter: brightness(1.15);
    transform: scale(1.1);
}
.cd-rec-add:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ---------- Sticky Category Nav ---------- */
.sticky-cat-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: inherit;
    padding: 12px 0;
    transition: box-shadow .2s;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.sticky-cat-nav::-webkit-scrollbar { display: none; }
.sticky-cat-nav.is-stuck {
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

/* Category section headings */
.menu-category-heading {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 32px 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--theme-accent, #b08968);
    color: inherit;
    scroll-margin-top: 70px;
}
.menu-category-section:first-child .menu-category-heading {
    margin-top: 8px;
}

/* ---------- Add-to-cart feedback ---------- */
@keyframes cd-pulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.15); }
    100% { transform: scale(1); }
}
.cd-add-success {
    position: relative;
}
.cd-add-success::after {
    content: '\2713';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #22c55e;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: inherit;
    animation: cd-pulse .5s ease;
}
.cd-count-pulse {
    animation: cd-pulse .4s ease;
}

/* ---------- Mobile (<768px) ---------- */
@media (max-width: 767px) {
    .cart-drawer {
        width: 100%;
    }
    .options-modal {
        width: 100%;
        max-width: 100%;
        max-height: 100%;
        top: 0;
        left: 0;
        transform: translateY(100%);
        border-radius: 0;
        transition: opacity .25s ease, transform .3s ease, visibility .25s ease;
    }
    .options-modal.is-visible {
        transform: translateY(0);
    }
    .sticky-cat-nav {
        padding: 8px 0;
    }
    .menu-category-heading {
        font-size: 1.1rem;
        margin: 24px 0 12px;
    }
}
