/* ═══════════════════════════════════════════════════════════════════
   ملك الطابون - Smart Menu - تصميم فاتح أنيق مع أنيميشن احترافية
   ═══════════════════════════════════════════════════════════════════ */

:root {
    /* الألوان الأساسية - تدرجات دافئة هادئة */
    --primary: #d97706;
    --primary-dark: #b45309;
    --primary-light: #f59e0b;
    --primary-soft: #fef3c7;
    --primary-glow: rgba(217, 119, 6, 0.15);

    /* خلفيات فاتحة أنيقة */
    --bg-main: #fafaf9;
    --bg-card: #ffffff;
    --bg-soft: #f5f5f4;

    /* نصوص - محسّنة للتباين (WCAG AA) */
    --text-primary: #1c1917;
    --text-secondary: #57534e;
    --text-muted: #78716c;

    /* ألوان إضافية */
    --success: #10b981;
    --success-soft: #d1fae5;
    --danger: #ef4444;
    --white: #ffffff;

    /* ظلال ناعمة */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 4px 20px rgba(217, 119, 6, 0.15);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);

    /* حواف */
    --radius: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;

    /* تدرجات */
    --gradient: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    --gradient-soft: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);

    /* Easing و Transitions */
    --easing-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --easing-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --easing-out: cubic-bezier(0, 0, 0.2, 1);
    --transition-fast: 0.15s;
    --transition-normal: 0.3s;
    --transition-slow: 0.5s;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: 100px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ═══════════════════════════════════════════════════════════════════
   HEADER - الشريط العلوي
   ═══════════════════════════════════════════════════════════════════ */

.main-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(217, 119, 6, 0.2);
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--white);
}

.logo i {
    font-size: 1.8rem;
    animation: flame 2s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

@keyframes flame {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    25% {
        transform: scale(1.05) rotate(-3deg);
    }

    50% {
        transform: scale(1.1) rotate(0deg);
    }

    75% {
        transform: scale(1.05) rotate(3deg);
    }
}

.logo h1 {
    font-size: 1.4rem;
    font-weight: 800;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    letter-spacing: -0.5px;
}

.cart-icon {
    position: relative;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--white);
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 14px;
    border-radius: 50%;
    transition: all var(--transition-normal) var(--easing-smooth);
    border: 2px solid rgba(255, 255, 255, 0.25);
    will-change: transform;
}

.cart-icon:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.08);
    border-color: rgba(255, 255, 255, 0.4);
}

.cart-icon:active {
    transform: scale(0.95);
}

.cart-icon.bounce {
    animation: cartBounce 0.5s var(--easing-bounce);
}

@keyframes cartBounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.25);
    }
}

.cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--success);
    color: white;
    font-size: 0.7rem;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 2px solid var(--white);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
    transition: transform var(--transition-fast) var(--easing-bounce);
}

.cart-count.pulse {
    animation: countPulse 0.3s var(--easing-bounce);
}

@keyframes countPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.4);
    }

    100% {
        transform: scale(1);
    }
}

/* ═══════════════════════════════════════════════════════════════════
   WELCOME MESSAGE - رسالة الترحيب
   ═══════════════════════════════════════════════════════════════════ */

.welcome-message {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    padding: 14px 0;
    text-align: center;
    transition: all var(--transition-normal) var(--easing-smooth);
}

.welcome-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.welcome-icon {
    font-size: 1.4rem;
    animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

.welcome-message h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}

.welcome-message p {
    font-size: 0.85rem;
    opacity: 0.9;
    margin: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   CATEGORIES - قائمة الفئات
   ═══════════════════════════════════════════════════════════════════ */

.categories-nav {
    background: var(--white);
    padding: 14px 0;
    position: sticky;
    top: 68px;
    z-index: 90;
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
    scroll-padding: 16px;
}

.categories-nav::-webkit-scrollbar {
    display: none;
}

.categories-nav .container {
    display: flex;
    gap: 10px;
    padding-bottom: 4px;
}

.category-item {
    padding: 10px 20px;
    background: var(--bg-soft);
    border-radius: 25px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition-normal) var(--easing-smooth);
    font-weight: 600;
    border: 2px solid transparent;
    white-space: nowrap;
    flex-shrink: 0;
    color: var(--text-secondary);
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
    will-change: transform;
}

.category-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--x, 50%) var(--y, 50%),
            rgba(217, 119, 6, 0.2) 0%,
            transparent 70%);
    opacity: 0;
    transition: opacity var(--transition-normal);
    pointer-events: none;
}

.category-item:active::after {
    opacity: 1;
}

.category-item:hover {
    border-color: var(--primary-light);
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.category-item.active {
    background: var(--gradient);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-glow);
    transform: scale(1.02);
}

.category-item.active::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════
   PRODUCTS SECTION - قسم المنتجات
   ═══════════════════════════════════════════════════════════════════ */

.products-section {
    padding: 24px 0;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 20px;
    position: relative;
    padding-right: 16px;
}

.section-title::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: var(--gradient);
    border-radius: 2px;
}

/* ═══════════════════════════════════════════════════════════════════
   PRODUCTS GRID - شبكة المنتجات
   ═══════════════════════════════════════════════════════════════════ */

.products-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    contain: content;
}

@media (min-width: 601px) {
    .products-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
        gap: 16px;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   PRODUCT CARD - بطاقة المنتج
   ═══════════════════════════════════════════════════════════════════ */

.product-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: row;
    transition:
        transform var(--transition-normal) var(--easing-smooth),
        box-shadow var(--transition-normal) var(--easing-smooth);
    border: 1px solid rgba(0, 0, 0, 0.03);
    will-change: transform;
    opacity: 0;
    transform: translateY(20px);
    min-height: 110px;
}

.product-card.visible {
    animation: revealCard 0.5s var(--easing-out) forwards;
    animation-delay: var(--delay, 0s);
}

@keyframes revealCard {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-soft);
}

@media (min-width: 601px) {
    .product-card:hover {
        transform: translateY(-4px);
    }
}

/* تأثير active للمس على الموبايل */
.product-card:active {
    transform: scale(0.98);
    box-shadow: var(--shadow-sm);
}

/* صورة المنتج */
.product-img-wrapper {
    position: relative;
    width: 110px;
    min-width: 110px;
    height: 110px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--bg-soft) 0%, #e7e5e4 100%);
    flex-shrink: 0;
}

.product-img-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top,
            rgba(0, 0, 0, 0.15) 0%,
            transparent 40%);
    opacity: 0;
    transition: opacity var(--transition-normal);
    pointer-events: none;
}

.product-card:hover .product-img-wrapper::after {
    opacity: 1;
}

.product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow) var(--easing-smooth);
    will-change: transform;
}

.product-card:hover .product-img {
    transform: scale(1.08);
}

/* تحسين زوايا الصورة للتصميم الأفقي */
.product-img-wrapper {
    border-radius: var(--radius) 0 0 var(--radius);
}

/* Placeholder للصور */
.product-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-soft) 0%, #fde68a 100%);
    color: var(--primary);
    font-size: 1.8rem;
    font-weight: 800;
}

/* معلومات المنتج */
.product-info {
    padding: 12px 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.product-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 2px;
    color: var(--text-primary);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    flex-grow: 0;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0;
    border-top: none;
    margin-top: auto;
}

.product-price {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--primary);
}

.product-price small {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* زر الإضافة - مدمج */
.add-btn {
    background: var(--gradient);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all var(--transition-normal) var(--easing-smooth);
    box-shadow:
        0 3px 12px rgba(217, 119, 6, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    will-change: transform;
    flex-shrink: 0;
}

.add-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center,
            rgba(255, 255, 255, 0.4) 0%,
            transparent 70%);
    transform: scale(0);
    transition: transform var(--transition-fast);
}

.add-btn:active::before {
    transform: scale(2);
}

.add-btn:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow:
        0 6px 24px rgba(217, 119, 6, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.add-btn:active {
    transform: scale(0.95);
}

.add-btn.success {
    background: var(--success);
    transform: scale(1.1) rotate(0deg);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.add-btn.success i {
    animation: checkPop 0.4s var(--easing-bounce);
}

@keyframes checkPop {
    0% {
        transform: scale(0) rotate(-45deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* ═══════════════════════════════════════════════════════════════════
   SKELETON LOADING - تحميل الهيكل
   ═══════════════════════════════════════════════════════════════════ */

.skeleton {
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg,
            var(--bg-soft) 0%,
            #e7e5e4 20%,
            var(--bg-soft) 40%,
            var(--bg-soft) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.product-card.skeleton {
    opacity: 1;
    transform: none;
}

.product-card.skeleton .product-img-wrapper {
    background: var(--bg-soft);
}

.skeleton-title {
    height: 16px;
    width: 70%;
    border-radius: 6px;
    margin-bottom: 6px;
}

.skeleton-desc {
    height: 14px;
    width: 90%;
    border-radius: 6px;
    margin-bottom: 8px;
}

.skeleton-price {
    height: 18px;
    width: 50px;
    border-radius: 6px;
}

.skeleton-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

/* حالات التحميل والخطأ */
.loading,
.error,
.no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 1rem;
}

.loading::before {
    content: '';
    display: block;
    width: 36px;
    height: 36px;
    border: 3px solid var(--bg-soft);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ═══════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS - الإشعارات المنبثقة
   ═══════════════════════════════════════════════════════════════════ */

.toast-container {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    pointer-events: none;
    width: 90%;
    max-width: 320px;
}

.toast {
    background: var(--text-primary);
    color: white;
    padding: 12px 18px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    animation: toastIn 0.3s var(--easing-smooth);
    pointer-events: auto;
    font-size: 0.9rem;
    font-weight: 600;
}

.toast.success {
    background: linear-gradient(135deg, #1c1917 0%, #292524 100%);
    border-right: 3px solid var(--success);
}

.toast.error {
    background: linear-gradient(135deg, #1c1917 0%, #292524 100%);
    border-right: 3px solid var(--danger);
}

.toast i {
    font-size: 1rem;
    flex-shrink: 0;
}

.toast.success i {
    color: var(--success);
}

.toast.error i {
    color: var(--danger);
}

.toast.hiding {
    animation: toastOut 0.3s var(--easing-smooth) forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
}

/* ═══════════════════════════════════════════════════════════════════
   FLYING ITEM - العنصر الطائر
   ═══════════════════════════════════════════════════════════════════ */

.flying-item {
    position: fixed;
    z-index: 9999;
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.4);
}

/* ═══════════════════════════════════════════════════════════════════
   FLOATING CART BAR - شريط السلة العائم
   ═══════════════════════════════════════════════════════════════════ */

.floating-cart-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    padding: 14px 20px;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transform: translateY(100%);
    transition: transform var(--transition-normal) var(--easing-smooth);
    z-index: 999;
    border-top: 1px solid var(--bg-soft);
}

.floating-cart-bar.visible {
    transform: translateY(0);
}

.floating-cart-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.floating-cart-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.floating-cart-total {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.floating-cart-btn {
    background: var(--gradient);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-normal) var(--easing-smooth);
    box-shadow: var(--shadow-glow);
}

.floating-cart-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 24px rgba(217, 119, 6, 0.3);
}

.floating-cart-btn:active {
    transform: scale(0.98);
}

/* ═══════════════════════════════════════════════════════════════════
   MODALS - النوافذ المنبثقة
   ═══════════════════════════════════════════════════════════════════ */

.cart-modal,
.checkout-modal,
.success-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition:
        opacity var(--transition-normal) var(--easing-smooth),
        visibility var(--transition-normal);
}

.cart-modal.active,
.checkout-modal.active,
.success-modal.active {
    opacity: 1;
    visibility: visible;
}

.cart-content,
.checkout-content {
    background: var(--white);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 24px;
    padding-top: 32px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform var(--transition-slow) var(--easing-bounce);
    position: relative;
}

.cart-modal.active .cart-content,
.checkout-modal.active .checkout-content {
    transform: translateY(0);
}

/* Handle للسحب */
.cart-content::before,
.checkout-content::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: var(--bg-soft);
    border-radius: 2px;
}

.success-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 40px 28px;
    text-align: center;
    width: 90%;
    max-width: 380px;
    margin: auto;
    transform: scale(0.9);
    opacity: 0;
    transition:
        transform var(--transition-normal) var(--easing-bounce),
        opacity var(--transition-normal);
}

.success-modal.active .success-content {
    transform: scale(1);
    opacity: 1;
}

/* Header للـ Modal */
.cart-header,
.checkout-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--bg-soft);
}

.cart-header h3,
.checkout-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.close-cart,
.close-checkout {
    background: var(--bg-soft);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-normal) var(--easing-smooth);
}

.close-cart:hover,
.close-checkout:hover {
    background: var(--bg-main);
    color: var(--text-primary);
    transform: rotate(90deg);
}

/* عناصر السلة */
.cart-items {
    min-height: 80px;
}

.empty-cart {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--bg-soft);
    transition: all var(--transition-normal);
}

.cart-item.removing {
    opacity: 0;
    transform: translateX(100%);
}

.item-details h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.item-details p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.item-controls {
    display: flex;
    align-items: center;
    gap: 14px;
}

.qty-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid var(--bg-soft);
    background: white;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast) var(--easing-smooth);
    color: var(--text-secondary);
}

.qty-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

.qty-btn:active {
    transform: scale(0.9);
}

.item-qty {
    font-weight: 700;
    min-width: 28px;
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-primary);
}

/* Footer السلة */
.cart-footer {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--bg-soft);
}

.total-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.checkout-btn,
.confirm-btn {
    width: 100%;
    padding: 16px;
    background: var(--gradient);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-normal) var(--easing-smooth);
    box-shadow: var(--shadow-glow);
    font-family: inherit;
}

.checkout-btn:hover,
.confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(217, 119, 6, 0.35);
}

.checkout-btn:active,
.confirm-btn:active {
    transform: translateY(0);
}

.checkout-btn:disabled,
.confirm-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ═══════════════════════════════════════════════════════════════════
   FORM STYLES - النماذج
   ═══════════════════════════════════════════════════════════════════ */

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--bg-soft);
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    transition: all var(--transition-normal) var(--easing-smooth);
    background: var(--bg-main);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

/* أنواع الطلبات */
.order-types {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.type-option {
    position: relative;
    cursor: pointer;
}

.type-option input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.type-option span {
    display: block;
    padding: 14px 8px;
    text-align: center;
    border: 2px solid var(--bg-soft);
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all var(--transition-normal) var(--easing-smooth);
    background: var(--bg-main);
    color: var(--text-secondary);
}

.type-option:hover span {
    border-color: var(--primary-light);
    background: var(--primary-soft);
}

.type-option input:checked+span {
    background: var(--gradient);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-glow);
}

.hidden {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════
   SUCCESS MODAL - نافذة النجاح
   ═══════════════════════════════════════════════════════════════════ */

.success-icon {
    font-size: 3.5rem;
    color: var(--success);
    margin-bottom: 16px;
    animation: successPop 0.5s var(--easing-bounce);
}

@keyframes successPop {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.success-content h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.success-content p {
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-size: 0.95rem;
}

.success-content #orderId {
    font-weight: 800;
    color: var(--primary);
    font-size: 1.15rem;
}

.close-success {
    margin-top: 20px;
    padding: 14px 36px;
    background: var(--text-primary);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    transition: all var(--transition-normal) var(--easing-smooth);
}

.close-success:hover {
    background: var(--text-secondary);
    transform: scale(1.03);
}

/* ═══════════════════════════════════════════════════════════════════
   TOUCH FEEDBACK - تأثيرات اللمس للموبايل
   ═══════════════════════════════════════════════════════════════════ */

@media (hover: none) and (pointer: coarse) {
    .product-card:active {
        transform: scale(0.98);
    }

    .add-btn:active {
        transform: scale(0.9);
    }

    .category-item:active {
        transform: scale(0.95);
    }

    .qty-btn:active {
        background: var(--primary);
        color: white;
        border-color: var(--primary);
    }

    .floating-cart-btn:active {
        transform: scale(0.96);
    }
}

/* تعطيل hover effects على الموبايل */
@media (hover: none) {
    .product-card:hover {
        transform: none;
        box-shadow: var(--shadow-card);
    }

    .product-card:hover .product-img {
        transform: none;
    }

    .add-btn:hover {
        transform: none;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE - التجاوب
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.2rem;
    }

    .section-title {
        font-size: 1.3rem;
    }

    .order-types {
        grid-template-columns: 1fr;
    }

    .type-option span {
        padding: 14px;
    }

    .product-card {
        min-height: 95px;
    }

    .product-img-wrapper {
        width: 95px;
        min-width: 95px;
        height: 95px;
    }

    .product-info {
        padding: 10px 12px;
    }

    .product-title {
        font-size: 0.9rem;
    }

    .product-desc {
        font-size: 0.75rem;
        margin-bottom: 4px;
    }

    .product-price {
        font-size: 0.95rem;
    }

    .add-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .floating-cart-bar {
        padding: 12px 16px;
    }

    .floating-cart-btn {
        padding: 12px 24px;
        font-size: 0.95rem;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   PERFORMANCE - تحسينات الأداء
   ═══════════════════════════════════════════════════════════════════ */

.product-card,
.add-btn,
.category-item,
.cart-icon,
.floating-cart-btn {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.product-img {
    contain: layout style paint;
}

/* تحسين الـ Layout Shift */
.products-grid {
    contain: layout style;
}

.product-img-wrapper {
    contain: strict;
    content-visibility: auto;
    contain-intrinsic-size: 110px 110px;
}

/* ═══════════════════════════════════════════════════════════════════
   ACCESSIBILITY - إمكانية الوصول
   ═══════════════════════════════════════════════════════════════════ */

/* Skip Link */
.skip-link {
    position: absolute;
    top: -100%;
    right: 0;
    background: var(--primary);
    color: white;
    padding: 12px 24px;
    z-index: 9999;
    border-radius: 0 0 8px 8px;
    font-weight: 600;
    text-decoration: none;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid var(--primary-dark);
    outline-offset: 2px;
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus Styles - تحسين وضوح التركيز */
:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.add-btn:focus-visible,
.category-item:focus-visible,
.floating-cart-btn:focus-visible,
.checkout-btn:focus-visible,
.confirm-btn:focus-visible {
    outline: 3px solid var(--primary-dark);
    outline-offset: 3px;
    box-shadow: 0 0 0 6px var(--primary-glow);
}

/* تحسين النماذج للموبايل */
input,
textarea,
select,
button {
    font-size: 16px;
    /* يمنع zoom على iOS */
}

/* تحسين fieldset */
fieldset.form-group {
    border: none;
    padding: 0;
    margin: 0 0 18px 0;
}

fieldset.form-group legend {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    padding: 0;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
        --shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.2);
    }

    .product-card {
        border: 2px solid var(--text-primary);
    }

    .category-item {
        border: 2px solid var(--text-secondary);
    }

    .category-item.active {
        border-color: var(--primary);
    }
}

/* Reduced Motion - احترام تفضيلات المستخدم */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }

    .product-card {
        opacity: 1;
        transform: none;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   MOBILE OPTIMIZATIONS - تحسينات خاصة للجوال
   ═══════════════════════════════════════════════════════════════════ */

/* Safe Area for notched phones */
@supports (padding: max(0px)) {
    .main-header {
        padding-top: max(16px, env(safe-area-inset-top));
    }

    .floating-cart-bar {
        padding-bottom: max(14px, env(safe-area-inset-bottom));
    }

    body {
        padding-bottom: max(100px, calc(80px + env(safe-area-inset-bottom)));
    }
}

/* تحسين الأداء على الأجهزة الضعيفة */
@media (max-width: 600px) {
    .product-img-wrapper::after {
        display: none;
    }

    .cart-icon {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

/* تحسين touch targets للجوال */
@media (pointer: coarse) {
    .add-btn {
        min-width: 40px;
        min-height: 40px;
    }

    .qty-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .category-item {
        min-height: 44px;
        padding: 12px 20px;
    }

    .close-cart,
    .close-checkout {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Print Styles */
@media print {

    .main-header,
    .categories-nav,
    .floating-cart-bar,
    .cart-modal,
    .checkout-modal,
    .success-modal,
    .toast-container,
    .add-btn,
    .skip-link {
        display: none !important;
    }

    body {
        padding: 0;
        background: white;
    }

    .product-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   LAST ORDER - الطلب السابق
   ═══════════════════════════════════════════════════════════════════ */

/* أزرار السلة */
.cart-actions {
    display: flex;
    gap: 12px;
    flex-direction: column;
}

.last-order-btn {
    width: 100%;
    padding: 14px;
    background: var(--bg-soft);
    color: var(--text-primary);
    border: 2px solid var(--bg-soft);
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal) var(--easing-smooth);
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.last-order-btn:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary);
}

.last-order-btn:active {
    transform: scale(0.98);
}

.last-order-btn i {
    font-size: 1.1rem;
}

/* Modal الطلب السابق */
.last-order-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    border: none;
}

.last-order-modal.active {
    display: flex;
}

.last-order-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 450px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s var(--easing-smooth);
}

.last-order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--bg-soft);
}

.last-order-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.last-order-header h3 i {
    color: var(--primary);
}

.close-last-order {
    background: var(--bg-soft);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-normal) var(--easing-smooth);
}

.close-last-order:hover {
    background: var(--bg-main);
    color: var(--text-primary);
    transform: rotate(90deg);
}

.last-order-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.loading-last-order,
.no-last-order {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.no-last-order i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-last-order p {
    margin-top: 8px;
    font-size: 0.9rem;
}

/* عناصر الطلب السابق */
.last-order-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--bg-soft);
}

.last-order-item:last-child {
    border-bottom: none;
}

.last-order-item-details h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.last-order-item-details p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.last-order-item-price {
    font-weight: 700;
    color: var(--primary);
    font-size: 1rem;
}

/* Footer الطلب السابق */
.last-order-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--bg-soft);
    background: var(--bg-soft);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.last-order-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.submit-last-order-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-normal) var(--easing-smooth);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.submit-last-order-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(16, 185, 129, 0.4);
}

.submit-last-order-btn:active {
    transform: translateY(0);
}

.submit-last-order-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.submit-last-order-btn i {
    font-size: 1.2rem;
}

/* معلومات إضافية عن الطلب السابق */
.last-order-info {
    background: var(--primary-soft);
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--primary-dark);
}

.last-order-info i {
    font-size: 1.1rem;
}

/* تجاوب للموبايل */
@media (max-width: 480px) {
    .cart-actions {
        gap: 10px;
    }

    .last-order-btn {
        padding: 12px;
        font-size: 0.95rem;
    }

    .last-order-content {
        max-height: 90vh;
    }

    .last-order-header,
    .last-order-body,
    .last-order-footer {
        padding: 16px 20px;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   نافذة تنبيه أخطاء المخزون
   ═══════════════════════════════════════════════════════════════════ */

.stock-error-modal {
    max-width: 440px;
    border-top: 4px solid var(--danger);
}

.stock-error-modal .modal-header.error-header {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    padding: 20px 24px;
    border-bottom: 1px solid #fecaca;
}

.stock-error-modal .modal-header h3 {
    color: #dc2626;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.stock-error-modal .modal-header h3 i {
    font-size: 1.3rem;
}

.stock-error-modal .modal-body {
    padding: 20px 24px;
}

.stock-error-intro {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 16px;
    line-height: 1.5;
}

.stock-error-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.stock-error-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
}

.stock-error-item.warning {
    background: #fffbeb;
    border-right: 4px solid #f59e0b;
    color: #b45309;
}

.stock-error-item.warning i {
    color: #f59e0b;
    font-size: 1.1rem;
}

.stock-error-item.danger {
    background: #fef2f2;
    border-right: 4px solid #ef4444;
    color: #dc2626;
}

.stock-error-item.danger i {
    color: #ef4444;
    font-size: 1.1rem;
}

.stock-error-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 0;
}

.stock-error-modal .modal-footer {
    padding: 16px 24px 24px;
    background: var(--bg-soft);
    border-top: 1px solid var(--bg-soft);
}

.close-stock-error {
    width: 100%;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition-normal) var(--easing-smooth);
}

.close-stock-error:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

@media (max-width: 480px) {
    .stock-error-modal {
        max-width: 95%;
    }

    .stock-error-modal .modal-header,
    .stock-error-modal .modal-body,
    .stock-error-modal .modal-footer {
        padding: 16px 18px;
    }

    .stock-error-item {
        padding: 12px 14px;
        font-size: 0.9rem;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   نظام الطلبات المتكررة الذكي - Smart Quick Orders
   ═══════════════════════════════════════════════════════════════════ */

.quick-orders-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--gradient-soft);
    color: var(--primary-dark);
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-normal) var(--easing-smooth);
}

.quick-orders-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.quick-orders-btn i {
    color: var(--primary);
}