/* ==========================================================================
   SMART MENU - PREMIUM LIGHT THEME (RTL Friendly)
   Inspired by premium Middle-Eastern food delivery apps (e.g., Orderly, Jahez)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&display=swap');

/* ---- CSS Variables ---- */
:root {
    --brand:            #0F4C5C;       /* Deep Teal */
    --brand-hover:      #0b3742;       /* Darker Deep Teal */
    --brand-soft:       #f4f8f9;       /* Extremely light Teal tint for active backgrounds */
    --brand-glow:       rgba(15, 76, 92, 0.12);
    
    --sand:             #C9B79C;       /* Muted Sand */
    --sand-hover:       #bfa987;
    --sand-soft:        #fcfbf8;       /* Very warm sand background tint */
    --sand-glow:        rgba(201, 183, 156, 0.15);

    --success:          #2ecc71;       /* Premium Success Green */
    --success-hover:    #27ae60;
    --success-soft:     #e8f8f0;

    --bg-base:          #f7f5f0;       /* Soft warm sand-toned background */
    --bg-surface:       #ffffff;       /* Pure white for containers & cards */
    --bg-raised:        #ffffff;
    --bg-card:          #ffffff;
    --bg-elevated:      #fbfaf7;       /* Very light warm cream background */

    --text-primary:     #112229;       /* Rich dark blue-teal/black for premium feel */
    --text-secondary:   #4a5c63;       /* Balanced medium grey-teal for readability */
    --text-muted:       #8ba0a8;       /* Calm muted grey-teal */

    --border:           #e6e2da;       /* Premium thin warm border */
    --border-light:     #f2efe9;       /* Very subtle warm border */
    --border-focus:     #0F4C5C;       /* Deep Teal for inputs focus */

    --radius-xs:        8px;
    --radius-sm:        12px;
    --radius-md:        18px;
    --radius-lg:        24px;
    --radius-xl:        32px;
    --radius-full:      999px;

    --shadow-card:      0 8px 30px rgba(0, 0, 0, 0.04);
    --shadow-deep:      0 20px 60px rgba(0, 0, 0, 0.08);

    --transition-fast:  0.2s ease;
    --transition-med:   0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    padding-bottom: 100px;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    direction: rtl; /* Set default to RTL */
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.menu-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.brand-title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--brand);
}

.table-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--sand-soft);
    border: 1px solid rgba(201, 183, 156, 0.3);
    color: var(--brand);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 700;
}

.table-badge::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--sand);
    box-shadow: 0 0 6px var(--sand);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.7); }
}

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Cart Icon Button */
#cartToggleBtn {
    position: relative;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: var(--transition-med);
    color: var(--text-primary);
}

#cartToggleBtn:hover {
    background: var(--bg-elevated);
    border-color: var(--brand);
    color: var(--brand);
}

#cartBadge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--brand);
    color: white;
    border-radius: 50%;
    font-size: 10px;
    width: 18px;
    height: 18px;
    display: flex !important;
    justify-content: center;
    align-items: center;
    font-weight: 800;
    border: 2px solid var(--bg-surface);
    box-shadow: 0 4px 10px var(--brand-glow);
}

/* ==========================================================================
   HERO BANNER & COVER
   ========================================================================== */
.hero-banner {
    position: relative;
    padding-bottom: 25px;
    margin-bottom: 12px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
}

/* Cover Image container */
.cover-wrapper {
    height: 160px;
    width: 100%;
    overflow: hidden;
    position: relative;
}

.cover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cover-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.1), rgba(0,0,0,0.4));
}

/* Restaurant Info Container */
.restaurant-info {
    position: relative;
    padding: 0 20px;
    margin-top: -30px; /* pull content up over cover */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    z-index: 10;
}

/* Rounded Floating Logo */
.restaurant-logo {
    width: 76px;
    height: 76px;
    border-radius: var(--radius-sm);
    border: 3px solid var(--bg-surface);
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 12px;
}

.restaurant-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.restaurant-details {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.restaurant-name {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.restaurant-slogan {
    font-size: 0.88rem;
    color: var(--brand);
    font-weight: 600;
    margin-top: 4px;
}

/* Search bar inside menu */
.search-wrapper {
    padding: 12px 16px 4px;
    max-width: 900px;
    margin: 0 auto;
}

.search-container {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 12px 46px 12px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    outline: none;
    transition: var(--transition-med);
    box-shadow: var(--shadow-card);
}

.search-input:focus {
    border-color: var(--brand);
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(15, 76, 92, 0.06);
}

.search-icon {
    position: absolute;
    top: 50%;
    right: 18px;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    width: 20px;
    height: 20px;
}

/* ==========================================================================
   FLASH MESSAGES
   ========================================================================== */
.flash-success, .flash-error {
    margin: 12px 16px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.flash-success {
    background: var(--success-soft);
    border: 1px solid rgba(46, 204, 113, 0.2);
    color: #1b5e20;
}

.flash-error {
    background: var(--brand-soft);
    border: 1px solid rgba(15, 76, 92, 0.2);
    color: #9c2222;
}

/* ==========================================================================
   CATEGORY NAVIGATION
   ========================================================================== */
.category-nav {
    display: flex;
    gap: 10px;
    padding: 12px 16px 16px;
    overflow-x: auto;
    scrollbar-width: none;
    position: sticky;
    top: 70px;
    z-index: 90;
    background: linear-gradient(to bottom, var(--bg-base) 80%, transparent);
}
.category-nav::-webkit-scrollbar { display: none; }

.category-pill {
    flex-shrink: 0;
    padding: 9px 22px;
    border-radius: var(--radius-full);
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    transition: var(--transition-med);
}

.category-pill.active {
    background: var(--brand);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 14px var(--brand-glow);
}

.category-pill:hover:not(.active) {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

/* ==========================================================================
   SPECIAL OFFERS
   ========================================================================== */
.special-offers-section {
    padding: 0 16px;
    max-width: 900px;
    margin: 8px auto 20px;
}

.special-offers-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.special-offers-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
}

.special-offers-badge {
    background: var(--sand-soft);
    color: var(--brand);
    border: 1px solid var(--sand);
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
}

.offer-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: var(--transition-med);
    margin-bottom: 14px;
}

.offer-banner {
    position: relative;
    height: 180px;
    overflow: hidden;
    cursor: pointer;
}

.offer-banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.offer-card:hover .offer-banner-img {
    transform: scale(1.04);
}

.offer-banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 10%, rgba(0,0,0,0.2) 60%, transparent);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 16px 20px;
    color: white;
}

.offer-meta {
    display: flex;
    flex-direction: column;
}

.offer-name {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.offer-expiry {
    font-size: 0.78rem;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 4px;
}

.offer-pricing {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.offer-price {
    font-size: 1.4rem;
    font-weight: 900;
    color: #fff;
}

.offer-old-price {
    font-size: 0.9rem;
    text-decoration: line-through;
    opacity: 0.7;
}

/* Accordion Details Panel */
.offer-details-panel {
    background: var(--brand);
    color: white;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.offer-details-panel.open {
    max-height: 300px;
}

.offer-details-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.offer-includes-title {
    font-size: 0.9rem;
    font-weight: 700;
    opacity: 0.9;
}

.offer-items-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.offer-item-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.offer-item-qty {
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: var(--radius-xs);
    font-size: 0.78rem;
    font-weight: 700;
}

.offer-bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255,255,255,0.15);
    padding-top: 14px;
    margin-top: 6px;
}

.saving-badge {
    background: var(--success);
    color: white;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 800;
}

.offer-add-btn {
    background: #ffffff;
    color: var(--brand);
    border: none;
    padding: 8px 18px;
    border-radius: var(--radius-full);
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: var(--transition-med);
}

.offer-add-btn:hover {
    background: var(--brand-soft);
    transform: translateY(-1px);
}

/* ==========================================================================
   MENU GRID & CARDS (RTL Optimized)
   ========================================================================= */
.menu-container {
    padding: 0 16px;
    max-width: 900px;
    margin: 0 auto;
}

.category-section {
    margin-bottom: 36px;
    scroll-margin-top: 150px;
}

.category-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-title::after {
    content: '';
    flex: 1;
    height: 1.5px;
    background: var(--border);
}

.product-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 768px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); }
}

/* PRODUCT CARD - Horizontal Layout (RTL) */
.product-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: row; /* RTL: Image (right-most) -> Details -> Button (left-most) */
    overflow: hidden;
    transition: var(--transition-med);
    position: relative;
    cursor: pointer;
    box-shadow: var(--shadow-card);
    height: 130px;
    align-items: center;
}

.product-card:hover {
    transform: translateY(-2px);
    border-color: rgba(15, 76, 92, 0.15);
    box-shadow: 0 10px 24px rgba(0,0,0,0.06);
}

/* Image wrapper on the right */
.product-image-wrap {
    width: 110px;
    height: 110px;
    min-width: 110px;
    overflow: hidden;
    position: relative;
    border-radius: var(--radius-sm);
    margin: 10px;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.product-image-placeholder {
    width: 110px;
    height: 110px;
    min-width: 110px;
    border-radius: var(--radius-sm);
    margin: 10px;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
}

/* Info in the middle & Action on the left */
.product-info {
    flex: 1;
    padding: 12px 14px 12px 14px;
    height: 100%;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    min-width: 0;
}

.product-details-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding-left: 8px; /* space before button */
}

.product-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}

.product-price-label {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--brand);
}

/* The red action button on the far left */
.product-action-area {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.add-to-cart-btn-pill {
    background: var(--brand);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition-bounce);
    box-shadow: 0 4px 10px var(--brand-glow);
}

.add-to-cart-btn-pill:hover {
    background: var(--brand-hover);
    transform: scale(1.05);
}

.add-to-cart-btn-pill svg {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: currentColor;
    stroke-width: 3.5;
}

/* Empty State */
.empty-menu {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-secondary);
}
.empty-menu svg { width: 56px; height: 56px; margin: 0 auto 16px; display: block; color: var(--text-muted); }
.empty-menu h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 6px; }
.empty-menu p { font-size: 0.88rem; color: var(--text-muted); }

/* ==========================================================================
   MODAL LAYOUTS (Slide-up Bottom Sheets for Mobile)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: flex-end; /* Align bottom on mobile */
    justify-content: center;
}

@media (min-width: 600px) {
    .modal-overlay { align-items: center; } /* Centered on desktop */
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 520px;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 0; /* Changed to 0 so image goes edge-to-edge */
    position: relative;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: var(--shadow-deep);
    animation: slideUpSheet 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (min-width: 600px) {
    .modal-content {
        border-radius: var(--radius-lg);
        animation: scaleInModal 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
}

@keyframes slideUpSheet {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes scaleInModal {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px; /* Floating on top-right over image */
    width: 34px;
    height: 34px;
    border: none;
    background: rgba(255, 255, 255, 0.85); /* Semi-transparent white circle */
    backdrop-filter: blur(4px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    transition: var(--transition-fast);
    z-index: 20;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.modal-close:hover {
    background: #ffffff;
    color: var(--brand);
    transform: scale(1.05);
}

/* Modal banner image (Match Photo 3 layout) */
.modal-hero-image {
    width: 100%;
    height: 240px;
    object-fit: cover;
    display: block;
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
}

.modal-body {
    padding: 20px 24px;
}

/* Custom Modal Header Card */
.modal-product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.modal-product-img {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--bg-elevated);
}

.modal-product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Labels and Inputs inside Modal */
.modal-content label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.modal-content input[type="text"],
.modal-content select,
.modal-content textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    outline: none;
    transition: var(--transition-fast);
    text-align: right;
}

.modal-content input:focus,
.modal-content select:focus,
.modal-content textarea:focus {
    border-color: var(--brand);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(15, 76, 92, 0.08);
}

/* ==========================================================================
   PRODUCT CUSTOMIZATION OPTIONS (Pill Selection for Sizes - RTL)
   ========================================================================== */
.extras-group {
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-light);
}

.extras-group-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.required-badge {
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-xs);
}

/* Elegant selection pills row */
.options-pills-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.option-pill-label {
    position: relative;
    cursor: pointer;
    margin-bottom: 0 !important; /* reset default margin */
}

.option-pill-label input[type="radio"],
.option-pill-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.pill-text {
    display: inline-block;
    padding: 9px 20px;
    border-radius: var(--radius-full);
    border: 1.5px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.88rem;
    transition: all 0.2s ease;
    user-select: none;
}

/* Checked styling */
.option-pill-label input:checked + .pill-text {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand);
    box-shadow: 0 4px 10px rgba(15, 76, 92, 0.05);
}

/* Optional multi-select items styled as cards */
.optional-extras-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.optional-extra-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.optional-extra-item input {
    margin-left: 10px; /* spacing in RTL */
    accent-color: var(--brand);
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.optional-extra-item.selected {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.extra-price-tag {
    font-weight: 700;
    color: var(--brand);
    font-size: 0.88rem;
}

/* ==========================================================================
   QUANTITY SELECTOR & MODAL ACTIONS
   ========================================================================== */
.modal-bottom-bar {
    display: flex;
    flex-direction: row; /* Horizontal layout like Photo 3 */
    align-items: center;
    gap: 16px;
    margin-top: 24px;
    border-top: 1px solid var(--border-light);
    padding: 16px 24px;
    background: #ffffff;
    position: sticky;
    bottom: 0;
    z-index: 15;
}

.quantity-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f1f3f5; /* Light gray pill background */
    padding: 4px;
    border-radius: var(--radius-full);
    border: none;
    width: 120px;
    flex-shrink: 0;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: #ffffff;
    border-radius: 50%;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.qty-btn:hover {
    background: var(--brand);
    color: white;
}

#modalQuantity {
    font-size: 1.15rem;
    font-weight: 800;
    min-width: 32px;
    text-align: center;
}

.modal-add-btn {
    flex: 1; /* Takes up remaining space */
    padding: 12px 20px;
    background: var(--brand);
    color: white;
    border: none;
    border-radius: var(--radius-md); /* Matching slightly rounded button in Photo 3 */
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    transition: var(--transition-bounce);
    box-shadow: 0 4px 12px var(--brand-glow);
    text-align: center;
}

.modal-add-btn:hover {
    background: var(--brand-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 76, 92, 0.2);
}

/* ==========================================================================
   CART SIDEBAR & NOTES (Slide-up Sheet on Mobile, Slide-in on Desktop)
   ========================================================================== */
.cart-sidebar {
    position: fixed;
    top: auto;
    bottom: -100%; /* slides up from bottom */
    right: 0;
    width: 100%;
    max-width: 440px;
    height: 85vh; /* bottom sheet style */
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    z-index: 1500;
    transition: bottom 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
}

@media (min-width: 600px) {
    .cart-sidebar {
        top: 0;
        bottom: 0;
        right: -100%; /* slides in from right */
        height: 100vh;
        border-radius: 0;
        border-top: none;
        border-left: 1px solid var(--border);
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .cart-sidebar.open { right: 0; bottom: 0; }
}

.cart-sidebar.open { bottom: 0; }

.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1499;
    display: none;
}

.cart-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.cart-header h2 {
    font-size: 1.3rem;
    font-weight: 800;
}

.cart-close {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.cart-close:hover {
    background: var(--brand-soft);
    color: var(--brand);
}

.cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

/* Cart Item rows */
.cart-item {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
    align-items: center;
}

.cart-item-img {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-xs);
    object-fit: cover;
    background: var(--bg-elevated);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

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

.cart-item-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-extras {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.cart-item-price {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--brand);
}

.cart-item-remove-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    font-family: inherit;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: var(--radius-xs);
    transition: var(--transition-fast);
}

.cart-item-remove-btn:hover {
    background: var(--brand-soft);
    color: var(--brand);
}

/* Order Notes in Cart */
.cart-notes-wrapper {
    margin: 16px 0;
    background: var(--bg-elevated);
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
}

.cart-notes-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.cart-notes-textarea {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 10px 12px;
    font-family: inherit;
    font-size: 0.85rem;
    resize: none;
    outline: none;
    text-align: right;
    transition: var(--transition-fast);
}

.cart-notes-textarea:focus {
    border-color: var(--brand);
    background: #ffffff;
}

.char-counter {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: left;
    margin-top: 4px;
}

/* Cart Footer totals & checkout */
.cart-footer {
    padding: 16px 24px 24px;
    border-top: 1px solid var(--border);
    background: #ffffff;
    flex-shrink: 0;
}

.cart-totals {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.cart-total-row.final-total {
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--text-primary);
    border-top: 1px solid var(--border-light);
    padding-top: 8px;
    margin-top: 4px;
}

.cart-total-row.final-total span:last-child {
    color: var(--brand);
}

.checkout-btn {
    display: block;
    width: 100%;
    padding: 14px;
    background: var(--brand);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: var(--transition-bounce);
    box-shadow: 0 4px 14px var(--brand-glow);
    text-align: center;
}

.checkout-btn:hover:not(:disabled) {
    background: var(--brand-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(15, 76, 92, 0.25);
}

.checkout-btn:disabled {
    background: var(--bg-base);
    color: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
}

/* ==========================================================================
   CHECKOUT DETAILS (Order Type Selection Pills - RTL)
   ========================================================================== */
.checkout-section-card {
    background: var(--bg-elevated);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    margin-bottom: 14px;
}

.checkout-section-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 12px;
}

/* Horizontal two cards for Order Type ( استلام / توصيل ) */
.order-type-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.order-type-card-label {
    position: relative;
    cursor: pointer;
}

.order-type-card-label input {
    position: absolute;
    opacity: 0;
}

.order-type-card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border: 1.5px solid var(--border);
    background: #ffffff;
    border-radius: var(--radius-md);
    transition: var(--transition-bounce);
    gap: 8px;
    text-align: center;
}

.order-type-card-content svg {
    width: 24px;
    height: 24px;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.order-type-card-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Selected Active Card */
.order-type-card-label input:checked + .order-type-card-content {
    border-color: var(--brand);
    background: var(--brand-soft);
    box-shadow: 0 4px 12px rgba(15, 76, 92, 0.05);
}

.order-type-card-label input:checked + .order-type-card-content svg {
    color: var(--brand);
    transform: scale(1.1);
}

.order-type-card-label input:checked + .order-type-card-content .order-type-card-name {
    color: var(--brand);
}

/* Error hints inside form */
.form-error-hint {
    color: var(--brand);
    font-size: 0.78rem;
    font-weight: 600;
    margin-top: 4px;
}

.address-slide-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease-out;
}

.address-slide-container.open {
    max-height: 150px;
    margin-top: 12px;
}
