/* ====================================================
   GLOBAL RESET & RESPONSIVE FOUNDATION
   ==================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box; /* أهم قاعدة لمنع خروج العناصر عن الشاشة */
    -webkit-tap-highlight-color: transparent !important; /* منع اللون الأزرق عند اللمس */
}

html, body {
    /* السلاح الأقوى: قفل الصفحة وجعلها كإطار تطبيق (App Frame) ثابت */
    position: fixed !important; 
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    max-width: 100vw; 
    height: 100%; 
    height: 100dvh;
    overflow: hidden !important; /* قفل أي تمرير خارجي لمنع تحرك الخلفية نهائياً */
    
    font-family: 'Montserrat', sans-serif;
    background-color: #1a1a1a; 
    touch-action: pan-y; /* السماح بالتمرير العمودي فقط ومنع الزووم */
    -webkit-text-size-adjust: 100% !important;
}

button:focus, a:focus, div:focus { outline: none !important; }

/* ====================================================
   BACKGROUNDS & LOADERS
   ==================================================== */
.main-bg {
    /* الخلفية أصبحت داخل الـ body الثابت ولن تتحرك أبداً */
    position: absolute !important; 
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: 100%; 
    background-image: url('others/one.jpeg'); background-size: cover; 
    background-position: 65% center; background-repeat: no-repeat;
    image-rendering: high-quality; z-index: 0;
    /* تفعيل تسريع الهاردوير لمنع ارتعاش الصورة أثناء التمرير */
    transform: translateZ(0); 
    will-change: transform;
}

.background-overlay {
    position: absolute !important; 
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.15); z-index: 1;
}

#loader-wrapper {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: #f6ecd9; display: flex; justify-content: center; align-items: center; z-index: 9999; transition: opacity 0.5s ease-out;
}
.coffee-animation-container { position: relative; width: 100px; height: 150px; }
.steam { position: absolute; width: 4px; height: 15px; background-color: #d4c4b2; border-radius: 10px; opacity: 0; bottom: 80px; animation: rise 1.5s infinite ease-in; }
.steam-1 { left: 35px; animation-delay: 0.1s; } .steam-2 { left: 50px; animation-delay: 0.5s; } .steam-3 { left: 65px; animation-delay: 0.3s; }
@keyframes rise { 0% { transform: translateY(0) scale(1); opacity: 0.8; } 100% { transform: translateY(-30px) scale(1.5); opacity: 0; } }
.pour-stream { position: absolute; top: 0; left: 48px; width: 4px; height: 70px; background-color: #3b2313; border-radius: 5px; z-index: 3; }
.coffee-mug { position: absolute; bottom: 0; left: 15px; width: 70px; height: 70px; border: 4px solid #3b2313; border-radius: 5px 5px 25px 25px; background-color: transparent; overflow: hidden; z-index: 2; }
.coffee-mug::after { content: ''; position: absolute; top: 10px; right: -18px; width: 14px; height: 30px; border: 4px solid #3b2313; border-left: none; border-radius: 0 15px 15px 0; }
.coffee-liquid { position: absolute; bottom: 0; left: 0; width: 100%; height: 0%; background-color: #3b2313; transition: height 0.05s linear; }

/* ====================================================
   WELCOME CONTENT
   ==================================================== */
#welcome-content {
    /* تغيير إلى absolute ليتوافق مع الإطار الجديد الثابت */
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 10; opacity: 0; transition: opacity 0.4s ease-in; 
}
.welcome-text { 
    position: absolute; top: 17dvh; left: 50%; transform: translateX(-50%); font-family: 'Montserrat', sans-serif; 
    font-weight: 200; color: #fff; font-size: 2rem; letter-spacing: 6px; white-space: nowrap; text-shadow: 0 4px 10px rgba(0,0,0,0.4); 
}
.bottom-actions {
    position: absolute; bottom: 8dvh; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 30px; width: 100%;
}
#enter-menu-btn { 
    padding: 24px 60px; color: #ffffff; font-size: 1.25rem; font-weight: 600; letter-spacing: 3px; cursor: pointer; 
    background: rgba(255, 255, 255, 0.15); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); 
    border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 18px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease; 
}
#enter-menu-btn:hover { background: rgba(255, 255, 255, 0.25); transform: translateY(-4px); box-shadow: 0 14px 32px rgba(0, 0, 0, 0.5); }
.hidden { display: none !important; }

.social-links { display: flex; gap: 20px; justify-content: center; align-items: center; }
.social-icon {
    color: #fff; background: rgba(255, 255, 255, 0.1); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 50%; width: 50px; height: 50px; 
    display: flex; justify-content: center; align-items: center;
    transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease; text-decoration: none; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.social-icon:hover, .social-icon:active { transform: translateY(-4px); background: rgba(255, 255, 255, 0.25); box-shadow: 0 8px 20px rgba(0,0,0,0.25); }

@media (max-width: 768px) {
    .welcome-text { font-size: 1.2rem; letter-spacing: 1px; top: 14.5dvh; }
    .bottom-actions { bottom: 6dvh; } 
}

/* ====================================================
   MAIN MENU CATEGORIES (100% RESPONSIVE)
   ==================================================== */
#categories-screen {
    position: absolute; top: 0; left: 0; 
    width: 100%; 
    height: 100%; 
    z-index: 20; opacity: 0; transition: opacity 0.6s ease;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}
.section-title {
    position: absolute; top: 20dvh; left: 50%; transform: translateX(-50%); font-family: 'Playfair Display', serif; font-style: normal; font-weight: 700; 
    color: #fdfdfd; font-size: 2.2rem; letter-spacing: 5px; text-shadow: 0 4px 10px rgba(0,0,0,0.4); text-transform: uppercase; white-space: nowrap;
}
.section-title::after {
    content: ''; position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); width: 35px; height: 2px; background-color: #d4c4b2; border-radius: 2px;
}
.categories-wrapper {
    position: absolute; top: 32dvh; left: 0; width: 100%; display: flex; flex-direction: column; gap: 18px; align-items: center; padding-bottom: 40px;
}

.category-card { 
    width: 90%; max-width: 320px; /* مقاسات مرنة تتناسب مع الجوال */
    height: 100px; min-height: 100px; 
    display: flex; align-items: center; padding: 0 15px; gap: 18px; 
    background: rgba(255, 255, 255, 0.05); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 20px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    cursor: pointer; position: relative; overflow: hidden; transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.4s ease, background 0.4s ease; 
}
.category-card:hover, .category-card:active { 
    transform: scale(1.02) translateY(-2px); background: rgba(255, 255, 255, 0.1); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25); border: 1px solid rgba(255, 255, 255, 0.3);
}

.category-img-container {
    width: 65px; height: 65px; min-width: 65px; min-height: 65px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.6); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); display: flex; justify-content: center; align-items: center; background-color: #fff; 
}
.category-img { width: 100%; height: 100%; object-fit: cover; display: block; transform: scale(1.05); }
.category-title { 
    flex: 1; text-align: left; color: #fff; font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 1.2rem; 
    letter-spacing: 3px; text-shadow: 0 2px 5px rgba(0,0,0,0.5); text-transform: uppercase; z-index: 2; 
}

/* ====================================================
   MENU ITEMS, TABS & CARDS (100% RESPONSIVE)
   ==================================================== */
#menu-items-screen {
    position: absolute; top: 0; left: 0; 
    width: 100%; 
    height: 100%;
    z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; 
    padding-top: 70px; opacity: 0; transition: opacity 0.6s ease; 
    
    overflow-x: hidden !important; 
    overflow-y: auto !important; 
    -webkit-overflow-scrolling: touch;
}

#back-btn, #return-home-btn {
    position: absolute; top: 30px; left: 15px; background: transparent; color: #ffffff; border: none; font-family: 'Montserrat', sans-serif; font-weight: 700; letter-spacing: 1.5px; font-size: 0.9rem; cursor: pointer; z-index: 30; padding: 10px; text-shadow: 0 2px 6px rgba(0,0,0,0.8); 
}

/* إصلاح عرض التبويبات لتكون متناسقة */
.sub-category-tabs {
    display: flex; gap: 10px; width: 100%; max-width: 100vw; overflow-x: auto; 
    padding: 10px 15px; margin: 0 0 20px 0; scrollbar-width: none; scroll-behavior: smooth; flex-shrink: 0;
}
.sub-category-tabs::-webkit-scrollbar { display: none; }
.tab-btn {
    background: rgba(0, 0, 0, 0.35); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid rgba(255, 255, 255, 0.15); color: rgba(255, 255, 255, 0.9);
    font-family: 'Montserrat', sans-serif; font-size: 0.9rem; font-weight: 600; letter-spacing: 1px; cursor: pointer; white-space: nowrap; padding: 10px 20px; border-radius: 25px; transition: all 0.3s ease; box-shadow: 0 4px 10px rgba(0,0,0,0.1); flex-shrink: 0; 
}
.tab-btn.active { background: #fdfaf6; color: #3b2313; border: 1px solid #fff; box-shadow: 0 6px 18px rgba(0,0,0,0.25); transform: scale(1.05); }

.luxury-switcher-container {
    display: flex; width: 85%; max-width: 300px; background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(10px);
    border-radius: 40px; padding: 5px; margin-bottom: 15px; box-shadow: 0 8px 20px rgba(0,0,0,0.15); flex-shrink: 0;
}
.switcher-btn {
    flex: 1; padding: 10px 5px; border-radius: 30px; border: none; background: transparent;
    font-family: 'Montserrat', sans-serif; font-size: 0.85rem; font-weight: 700; letter-spacing: 1px; color: #888; cursor: pointer; transition: all 0.3s ease; text-transform: uppercase;
}
.switcher-btn.active { background: #3b2313; color: #fff; box-shadow: 0 4px 12px rgba(59, 35, 19, 0.4); }

.dynamic-section-title {
    font-family: 'Playfair Display', serif; font-size: 1.2rem; color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    margin-bottom: 15px; letter-spacing: 1px; text-transform: uppercase; display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.dynamic-section-title::before, .dynamic-section-title::after { content: ''; display: block; width: 25px; height: 1px; background-color: rgba(255,255,255,0.6); }

/* ====================================================
   PREMIUM GRID CARDS (شبكة متجاوبة وآمنة 100%)
   ==================================================== */
#menu-list-container {
    width: 100%; 
    max-width: 600px; /* تحديد العرض الأقصى لضمان عدم التمدد المزعج */
    display: grid; 
    grid-template-columns: repeat(2, 1fr); /* وحدات مرنة بدلاً من الثابتة */
    gap: 12px; /* تقليل المسافة لمحاكاة الزووم القديم */
    padding: 0 15px 120px 15px; 
    align-content: start; 
}
.menu-item-card { 
    width: 100%; /* يجب أن يعبئ الكرت خليته في الـ Grid فقط */
    display: flex; flex-direction: column; height: 100%; background: #ffffff; 
    border-radius: 0px; overflow: hidden; 
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08); border: 1px solid rgba(212, 196, 178, 0.4); 
    contain: paint; transition: box-shadow 0.3s ease; 
}
.menu-item-card:hover, .menu-item-card:active { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15); }

/* تصغير الصور نسبياً لتتناسب مع تصميم الهاتف */
.card-img-wrapper { 
    width: 100%; 
    height: 140px; min-height: 140px; /* ارتفاع مرن وأقل قليلاً */
    overflow: hidden; position: relative; background-color: #f6ecd9; border-bottom: 1px solid #f2f2f2; flex-shrink: 0; 
}
.menu-item-image { 
    width: 100%; height: 100%; min-height: 100%; object-fit: cover; display: block; color: transparent; 
}

.card-temp-badge {
    position: absolute; top: 10px; right: 10px; padding: 4px 10px; border-radius: 6px; font-family: 'Montserrat', sans-serif; font-size: 0.65rem; font-weight: 800; letter-spacing: 1px; box-shadow: 0 4px 10px rgba(0,0,0,0.15); z-index: 2; text-transform: uppercase;
}
.badge-hot { background: #3b2313; color: #fff; } 
.badge-cold { background: #0077cc; color: #fff; } 

.menu-item-details { padding: 15px 10px; display: flex; flex-direction: column; align-items: center; text-align: center; flex: 1; background: #fff; }
.menu-item-title { font-family: 'Montserrat', sans-serif; font-size: 0.95rem; font-weight: 700; color: #222; letter-spacing: 0.5px; line-height: 1.3; margin: 0; }
.card-divider { width: 25px; height: 2px; background-color: #d4c4b2; border-radius: 2px; margin: 8px 0; }

.prices-wrapper { width: 100%; display: flex; justify-content: center; gap: 8px; margin-top: auto; padding-top: 5px; }
.price-row { 
    font-family: 'Playfair Display', serif; font-size: 1.25rem; font-weight: 800; color: #111111; 
    font-style: normal !important; display: flex; align-items: center; justify-content: center; gap: 4px; line-height: 1; 
}
.dirham-icon { height: 1.05rem; object-fit: contain; opacity: 1; margin-top: 0; transform: translateY(1px); }

#image-modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100dvh; background-color: rgba(0, 0, 0, 0.95); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 99999; display: flex; justify-content: center; align-items: center; opacity: 0; transition: opacity 0.3s ease; }
#close-modal-btn { position: absolute; top: 40px; left: 20px; background: transparent; color: #fff; border: none; font-family: 'Montserrat', sans-serif; font-weight: 700; letter-spacing: 2px; font-size: 1rem; cursor: pointer; z-index: 100000; padding: 10px; }
#fullscreen-img { max-width: 90%; max-height: 80vh; border-radius: 20px; box-shadow: 0 15px 50px rgba(0,0,0,0.5); object-fit: contain; border: 2px solid rgba(255,255,255,0.1); }

/* === تنسيق كلمة JANOV في شاشة التحميل === */
#loader-wrapper {
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 32px !important;
}

#loader-wrapper.hidden {
    display: none !important;
    pointer-events: none !important;
}

.loader-brand-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.4rem, 7vw, 3.8rem);
    font-weight: 600;
    color: #f6ecd9;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
    user-select: none;
}

.brand-letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(22px) scale(0.92);
    animation: janovReveal 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.brand-letter:nth-child(1) { animation-delay: 0.15s; }
.brand-letter:nth-child(2) { animation-delay: 0.35s; }
.brand-letter:nth-child(3) { animation-delay: 0.55s; }
.brand-letter:nth-child(4) { animation-delay: 0.75s; }
.brand-letter:nth-child(5) { animation-delay: 0.95s; }

@keyframes janovReveal {
    0% {
        opacity: 0;
        transform: translateY(22px) scale(0.92);
        filter: blur(4px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}