/* =============================================================
   SAHWA QR MENU — Customer-Facing Stylesheet
   Mobile-First | Premium Cafe Theme
   ============================================================= */

/* ── Google Fonts ────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800&family=Poppins:wght@300;400;500;600;700&display=swap');

/* ── CSS Custom Properties ───────────────────────────────────── */
:root {
    --primary:        #C8860A;
    --primary-dark:   #A06A06;
    --primary-light:  #F0C060;
    --dark:           #1C0A00;
    --dark-card:      #2C1406;
    --bg:             #FFF8F0;
    --bg-card:        #FFFFFF;
    --text:           #2C2416;
    --text-muted:     #8B7355;
    --text-light:     #B09070;
    --border:         #EDE0CC;
    --success:        #2ECC71;
    --danger:         #E74C3C;
    --shadow-sm:      0 2px 8px rgba(28,10,0,.08);
    --shadow-md:      0 4px 20px rgba(28,10,0,.12);
    --shadow-lg:      0 8px 40px rgba(28,10,0,.18);
    --radius:         16px;
    --radius-sm:      10px;
    --radius-pill:    50px;
    --transition:     all .22s ease;
    --font-en:        'Poppins', sans-serif;
    --font-ar:        'Cairo', sans-serif;
}

/* ── Reset & Base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-en);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 15px;
    line-height: 1.6;
}

body.lang-ar {
    font-family: var(--font-ar);
    direction: rtl;
}

img { max-width: 100%; height: auto; }
a  { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ── Header ──────────────────────────────────────────────────── */
.site-header {
    background: var(--dark);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(0,0,0,.35);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    max-width: 900px;
    margin: 0 auto;
    gap: 12px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.header-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}

.header-title {
    font-size: 18px;
    font-weight: 700;
    color: #FFFFFF;
    line-height: 1.2;
}

.header-tagline {
    font-size: 10px;
    color: var(--primary-light);
    font-weight: 400;
    display: block;
    letter-spacing: .5px;
}

/* Search bar in header */
.header-search {
    flex: 1;
    min-width: 0;
    position: relative;
}

.header-search input {
    width: 100%;
    background: rgba(255,255,255,.1);
    border: 1.5px solid rgba(255,255,255,.15);
    border-radius: var(--radius-pill);
    padding: 8px 14px 8px 36px;
    color: #fff;
    font-size: 13px;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.header-search input::placeholder { color: rgba(255,255,255,.45); }
.header-search input:focus {
    border-color: var(--primary);
    background: rgba(255,255,255,.15);
}

.header-search .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,.5);
    font-size: 14px;
    pointer-events: none;
}

body.lang-ar .header-search input { padding: 8px 36px 8px 14px; }
body.lang-ar .header-search .search-icon { left: auto; right: 12px; }

/* Header actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.lang-btn {
    background: rgba(255,255,255,.12);
    color: #fff;
    border-radius: var(--radius-pill);
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    transition: var(--transition);
    border: 1.5px solid rgba(255,255,255,.2);
    white-space: nowrap;
}
.lang-btn:hover { background: var(--primary); border-color: var(--primary); }

/* Cart button in header */
.cart-btn {
    position: relative;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius-pill);
    padding: 7px 14px 7px 10px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(200,134,10,.4);
}
.cart-btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
.cart-btn i { font-size: 16px; }

.cart-badge {
    background: #fff;
    color: var(--primary);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.cart-badge.hidden { display: none; }

/* ── Category Tabs ───────────────────────────────────────────── */
.categories-bar {
    background: var(--dark-card);
    position: sticky;
    top: 65px;
    z-index: 90;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.categories-scroll {
    display: flex;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0 8px;
    max-width: 900px;
    margin: 0 auto;
}
.categories-scroll::-webkit-scrollbar { display: none; }

.cat-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 14px;
    color: rgba(255,255,255,.55);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    transition: var(--transition);
    border-bottom: 2.5px solid transparent;
    letter-spacing: .3px;
    text-transform: uppercase;
    cursor: pointer;
    flex-shrink: 0;
}

.cat-tab i { font-size: 18px; margin-bottom: 1px; }
.cat-tab:hover { color: rgba(255,255,255,.85); }
.cat-tab.active {
    color: var(--primary-light);
    border-bottom-color: var(--primary);
}

/* ── Main Content ────────────────────────────────────────────── */
.main-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 12px 100px;
}

/* ── Section Title ───────────────────────────────────────────── */
.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 22px;
    background: var(--primary);
    border-radius: 2px;
    flex-shrink: 0;
}

/* ── Product Grid ────────────────────────────────────────────── */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

@media (min-width: 600px) {
    .products-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 900px) {
    .products-grid { grid-template-columns: repeat(4, 1fr); gap: 18px; }
}

/* ── Product Card ────────────────────────────────────────────── */
.product-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .2s ease, box-shadow .2s ease;
    position: relative;
    border: 1px solid var(--border);
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.product-img-wrap {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: #F5EBD8;
}

.product-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s ease;
}

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

/* Badge labels */
.product-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
    letter-spacing: .5px;
}
body.lang-ar .product-badge { left: auto; right: 8px; }

.product-badge.popular-badge { background: #E74C3C; }
.product-badge.featured-badge { background: #8E44AD; }

.product-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 4px;
}

.product-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.product-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    padding-top: 8px;
}

.product-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
}

/* Quantity controls */
.qty-control {
    display: flex;
    align-items: center;
    width: 100%;
    background: var(--bg);
    border-radius: var(--radius-pill);
    border: 1.5px solid var(--primary);
    overflow: hidden;
}

.qty-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    transition: background .15s;
    flex-shrink: 0;
}
.qty-btn:hover { background: var(--primary); color: #fff; }

.qty-display {
    flex: 1;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.add-cart-btn {
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius-pill);
    padding: 9px 10px;
    font-size: 13px;
    font-weight: 700;
    transition: var(--transition);
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    box-shadow: 0 3px 10px rgba(200,134,10,.35);
    letter-spacing: .2px;
}
.add-cart-btn:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 5px 14px rgba(200,134,10,.45); }
.add-cart-btn:active { transform: translateY(0); }
.add-cart-btn.in-cart { background: var(--success); box-shadow: 0 3px 10px rgba(46,204,113,.35); }
.add-cart-btn i { font-size: 14px; }

/* Unavailable overlay */
.product-card.unavailable .product-img-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.4);
}

.unavailable-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.unavailable-label span {
    background: rgba(0,0,0,.7);
    color: #fff;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
}

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i { font-size: 56px; color: var(--border); margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* ── Cart Drawer ─────────────────────────────────────────────── */
.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s ease;
    backdrop-filter: blur(3px);
}

.cart-overlay.open { opacity: 1; visibility: visible; }

.cart-drawer {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(400px, 100vw);
    background: var(--bg-card);
    z-index: 201;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    box-shadow: -8px 0 40px rgba(0,0,0,.2);
}

.cart-drawer.open { transform: translateX(0); }

body.lang-ar .cart-drawer {
    right: auto;
    left: 0;
    transform: translateX(-100%);
}
body.lang-ar .cart-drawer.open { transform: translateX(0); }

.cart-header {
    padding: 16px 20px;
    background: var(--dark);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.cart-header h2 {
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-close {
    color: rgba(255,255,255,.7);
    font-size: 20px;
    padding: 4px;
    border-radius: 6px;
    transition: var(--transition);
}
.cart-close:hover { color: #fff; background: rgba(255,255,255,.1); }

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cart-empty-msg {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 40px 20px;
}
.cart-empty-msg i { font-size: 48px; color: var(--border); }
.cart-empty-msg h3 { font-size: 16px; font-weight: 600; color: var(--text); }
.cart-empty-msg p { font-size: 13px; }

/* Cart item row */
.cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 10px;
    border: 1px solid var(--border);
}

.cart-item-img {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: #F5EBD8;
}

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

.cart-item-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.cart-item-remove {
    color: var(--danger);
    font-size: 16px;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
}
.cart-item-remove:hover { background: #FEE2E2; }

/* Cart footer */
.cart-footer {
    padding: 16px 20px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    flex-shrink: 0;
}

.cart-totals {
    margin-bottom: 14px;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
    padding: 3px 0;
}

.cart-total-row.total-final {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    border-top: 1px solid var(--border);
    margin-top: 6px;
    padding-top: 10px;
}

.cart-total-row.total-final .amount { color: var(--primary); }

/* Customer info inputs */
.customer-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.customer-info input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    outline: none;
    transition: border-color .2s;
}

.customer-info input:focus { border-color: var(--primary); }
.customer-info input.error { border-color: var(--danger); }
.customer-info input::placeholder { color: var(--text-light); }

.whatsapp-btn {
    width: 100%;
    background: #25D366;
    color: #fff;
    border-radius: var(--radius-sm);
    padding: 13px;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: 0 3px 14px rgba(37,211,102,.4);
    border: none;
    font-family: inherit;
    cursor: pointer;
}
.whatsapp-btn:hover {
    background: #1DA851;
    transform: translateY(-1px);
    box-shadow: 0 5px 20px rgba(37,211,102,.5);
}
.whatsapp-btn i { font-size: 20px; }

.clear-cart-btn {
    width: 100%;
    margin-top: 8px;
    color: var(--danger);
    font-size: 12px;
    font-weight: 500;
    padding: 6px;
    text-align: center;
    border-radius: 6px;
    transition: var(--transition);
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 1px solid transparent;
}
.clear-cart-btn:hover { background: #FEE2E2; border-color: #FECACA; }

/* ── Toast notification ──────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast-msg {
    background: var(--dark);
    color: #fff;
    padding: 10px 18px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    animation: toastIn .3s ease, toastOut .3s ease 1.8s forwards;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.toast-msg.success { background: #1A7A3D; }
.toast-msg i { font-size: 16px; }

@keyframes toastIn  { from { opacity:0; transform:translateY(14px); } to { opacity:1; transform:translateY(0); } }
@keyframes toastOut { from { opacity:1; transform:translateY(0); } to { opacity:0; transform:translateY(-10px); } }

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
    background: var(--dark);
    color: rgba(255,255,255,.45);
    text-align: center;
    padding: 16px;
    font-size: 11px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
}

/* ── Loading skeleton ────────────────────────────────────────── */
@keyframes shimmer {
    0%  { background-position: -400px 0; }
    100%{ background-position:  400px 0; }
}

.skeleton {
    background: linear-gradient(90deg, #EDE0CC 25%, #F5EBD8 50%, #EDE0CC 75%);
    background-size: 800px 100%;
    animation: shimmer 1.4s infinite;
    border-radius: 8px;
}

.skeleton-card {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.skeleton-img { aspect-ratio: 1; }
.skeleton-line { height: 12px; margin: 8px 10px; }
.skeleton-line.short { width: 60%; }
.skeleton-line.price { width: 40%; background: linear-gradient(90deg, #F0C060 25%, #F8D888 50%, #F0C060 75%); background-size: 400px 100%; animation: shimmer 1.4s infinite; }

/* ── Scrollbar styling ───────────────────────────────────────── */
.cart-items::-webkit-scrollbar { width: 4px; }
.cart-items::-webkit-scrollbar-track { background: transparent; }
.cart-items::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── Search results highlight ────────────────────────────────── */
.search-active .section-title { display: none; }
.search-results-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
    padding: 8px 12px;
    background: rgba(200,134,10,.08);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}
body.lang-ar .search-results-label { border-left: none; border-right: 3px solid var(--primary); }

/* ── Responsive tweaks ───────────────────────────────────────── */
@media (max-width: 360px) {
    .products-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .product-price { font-size: 12px; }
    .header-title { font-size: 16px; }
}

@media (min-width: 900px) {
    .header-search { max-width: 300px; }
    .cart-btn-text { display: inline; }
}
