/* ========================================
   RESTAURANT MOBILE APP STYLES - V2
   محسن بالكامل مع شريط أصناف ثابت
======================================== */

:root {
    --primary: #F57C00;
    --primary-dark: #E65100;
    --primary-light: #FFB74D;
    --primary-soft: #FFF3E0;
    --accent: #FF9800;
    --success: #4CAF50;
    --warning: #FF9800;
    --danger: #F44336;
    --info: #29B6F6;
    --dark: #2E3B4E;
    --gray: #78909C;
    --gray-light: #ECEFF1;
    --white: #FFFFFF;
    
    --shadow-sm: 0 2px 8px rgba(245, 124, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(245, 124, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(245, 124, 0, 0.2);
    
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --radius-xl: 35px;
    --radius-round: 100px;
    
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    
    /* ارتفاع ثابت للعناصر */
    --navbar-height: 64px;
    --categories-height: 60px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #FFFFFF 0%, #FFF8F0 100%);
    color: var(--dark);
    line-height: 1.5;
    min-height: 100vh;
    padding-top: calc(var(--navbar-height) + var(--categories-height) + 10px);
    padding-left: var(--space-md);
    padding-right: var(--space-md);
    padding-bottom: var(--space-md);
    -webkit-font-smoothing: antialiased;
    position: relative;
}

/* ========================================
   النافبار العلوي الثابت
======================================== */
.main-navbar {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--navbar-height);
    padding: 0 var(--space-md);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--white);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-brand i {
    font-size: 1.5rem;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-round);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    cursor: pointer;
    position: relative;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.nav-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.3);
}

.badge-notification {
    position: absolute;
    top: -4px;
    left: -4px;
    background: var(--danger);
    color: white;
    font-size: 11px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--white);
    font-weight: bold;
}

/* ========================================
   شريط الأصناف الثابت (Sticky Categories)
======================================== */
.categories-container {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    z-index: 999;
    background: var(--white);
    padding: 10px var(--space-md);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border-bottom: 2px solid var(--primary-soft);
    height: var(--categories-height);
    display: flex;
    align-items: center;
}

.categories-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    white-space: nowrap;
    padding: 2px 0;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.categories-scroll::-webkit-scrollbar {
    display: none;
}

.category-btn {
    flex: 0 0 auto;
    padding: 8px 24px;
    background: var(--white);
    border: 2px solid var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-round);
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.category-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: var(--white);
    border-color: transparent;
    box-shadow: var(--shadow-sm);
}

.category-btn:active {
    transform: scale(0.95);
}

/* ========================================
   القائمة الجانبية (محسنة)
======================================== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    position: fixed;
    top: 0;
    right: -320px;
    width: 300px;
    max-width: 85%;
    height: 100vh;
    background: var(--white);
    z-index: 2001;
    transition: right 0.25s ease;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sidebar.active {
    right: 0;
}

.sidebar-header {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: var(--white);
    padding: 40px 20px 30px;
    position: relative;
}

.sidebar-close {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-close:active {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0.95);
}

.sidebar-user {
    text-align: center;
}

.sidebar-avatar {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin: 0 auto 15px;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.sidebar-name {
    font-weight: 800;
    font-size: 1.3rem;
    margin-bottom: 5px;
}

.sidebar-email {
    font-size: 0.9rem;
    opacity: 0.9;
}

.sidebar-menu {
    flex: 1;
    padding: 15px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    color: var(--dark);
    text-decoration: none;
    transition: background 0.15s ease;
    border-bottom: 1px solid var(--gray-light);
    cursor: pointer;
}

.menu-item:active {
    background: var(--primary-soft);
}

.menu-item i {
    width: 30px;
    color: var(--primary);
    font-size: 1.2rem;
}

.menu-item span {
    flex: 1;
    font-weight: 600;
    font-size: 1rem;
}

.menu-badge {
    background: var(--danger);
    color: white;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
}

.sidebar-footer {
    padding: 20px;
    text-align: center;
    border-top: 1px solid var(--gray-light);
    color: var(--gray);
    font-size: 0.9rem;
}

/* ========================================
   الكاروسيل (محسن)
======================================== */
.carousel-container {
    position: fixed;
    top: calc(var(--navbar-height) + var(--categories-height));
    left: 0;
    right: 0;
    height: 200px;
    z-index: 900;
    background: var(--white);
    overflow: hidden;
}

.carousel {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.carousel-inner {
    position: relative;
    width: 100%;
    height: 100%;
}

.carousel-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.carousel-item.active {
    opacity: 1;
    visibility: visible;
}

.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.carousel-indicators {
    position: absolute;
    bottom: 15px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    z-index: 10;
}

.carousel-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.carousel-indicator.active {
    background: white;
    width: 24px;
    border-radius: 12px;
}

.carousel-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
}

.carousel-control:active {
    transform: translateY(-50%) scale(0.95);
    background: rgba(255, 255, 255, 0.5);
}

.carousel-control.prev {
    right: 15px;
}

.carousel-control.next {
    left: 15px;
}

/* ========================================
   المحتوى الرئيسي (مع مساحة للعناصر الثابتة)
======================================== */
.main-content {
    margin-top: calc(200px + 20px); /* ارتفاع الكاروسيل + مسافة */
    padding-bottom: 20px;
}

/* ========================================
   شبكة المنتجات
======================================== */
.meals-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 20px;
}

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

@media (min-width: 500px) {
    .meals-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.meal-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(245, 124, 0, 0.1);
    transition: transform 0.15s ease;
}

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

.meal-image {
    width: 100%;
    height: 130px;
    object-fit: cover;
    background: var(--gray-light);
}

.meal-content {
    padding: 12px;
}

.meal-title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 4px;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meal-category {
    font-size: 11px;
    color: var(--gray);
    margin-bottom: 8px;
}

.meal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.meal-price {
    font-weight: 800;
    font-size: 16px;
    color: var(--primary);
}

.meal-price small {
    font-size: 11px;
    color: var(--gray);
    font-weight: 400;
}

.add-to-cart-btn {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    border-radius: var(--radius-round);
    padding: 8px 12px;
    color: var(--white);
    font-weight: 600;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

.add-to-cart-btn i {
    font-size: 13px;
}

.add-to-cart-btn:active {
    transform: scale(0.95);
}

/* ========================================
   شريط البحث
======================================== */
.search-wrapper {
    margin: 15px 0;
    position: relative;
    z-index: 10;
}

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

.search-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    font-size: 1.2rem;
    pointer-events: none;
}

#instant-search {
    width: 100%;
    padding: 14px 50px 14px 20px;
    border: 2px solid var(--primary-light);
    border-radius: var(--radius-round);
    font-family: 'Tajawal', sans-serif;
    font-size: 16px;
    background: var(--white);
    box-shadow: var(--shadow-sm);
}

#instant-search:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(245, 124, 0, 0.15);
}

.clear-search {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--gray-light);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: var(--gray);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.clear-search.visible {
    opacity: 1;
}

/* ========================================
   رسائل التوست المنبثقة
======================================== */
.toast-container {
    position: fixed;
    top: calc(var(--navbar-height) + 10px);
    left: 16px;
    right: 16px;
    z-index: 3000;
    pointer-events: none;
}

.toast-message {
    background: white;
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateY(-20px);
    opacity: 0;
    animation: slideDown 0.25s ease forwards;
    border-right: 5px solid var(--success);
    pointer-events: auto;
}

.toast-message.success { border-right-color: var(--success); }
.toast-message.error { border-right-color: var(--danger); }
.toast-message.warning { border-right-color: var(--warning); }

.toast-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.toast-icon.success {
    background: rgba(76, 175, 80, 0.1);
    color: var(--success);
}

.toast-icon.error {
    background: rgba(244, 67, 54, 0.1);
    color: var(--danger);
}

.toast-icon.warning {
    background: rgba(255, 152, 0, 0.1);
    color: var(--warning);
}

.toast-content {
    flex: 1;
    font-weight: 600;
}

@keyframes slideDown {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ========================================
   الحالة الفارغة
======================================== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    grid-column: 1 / -1;
}

.empty-icon {
    font-size: 4rem;
    color: var(--primary-light);
    margin-bottom: 16px;
}

.empty-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.empty-text {
    color: var(--gray);
    margin-bottom: 24px;
}

/* ========================================
   أزرار عامة
======================================== */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: var(--white);
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-round);
    font-weight: 700;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.btn-primary:active {
    transform: scale(0.97);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 10px 20px;
    border-radius: var(--radius-round);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    cursor: pointer;
}

.btn-outline:active {
    background: var(--primary-soft);
}