/* Import fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap');

/* --- Global Reset & Variables --- */
:root {
    --bg-color: #f8f9fa;
    --primary-color: #333; 
    --accent-color: #27ae60; 
    --text-main: #1a1a1a;
    --text-muted: #737373;
    --border-light: #e5e5e5;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.02);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
    
    --radius-lg: 16px;
    --radius-xl: 24px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    background-color: var(--bg-color);
    font-family: 'Inter', sans-serif;
    margin: 0; padding: 0;
    color: var(--text-main);
    padding-bottom: 100px;
    overflow-x: hidden;
}

/* =========================================
   1. NAVBAR (SLIM & MINIMAL)
   ========================================= */
.main-nav {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    position: sticky; top: 0; z-index: 4000;
    height: 60px; 
    display: flex; align-items: center;
}

.nav-container {
    width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px;
    display: flex; justify-content: space-between; align-items: center;
}

/* LOGO */
.nav-logo {
    font-size: 1.4rem; 
    font-weight: 800; color: var(--text-main);
    text-decoration: none; letter-spacing: -0.5px;
    z-index: 4002; display: flex; align-items: center;
}
.nav-logo span { color: var(--accent-color); }

/* --- RIGHT SIDE GROUP (Links + Buttons) --- */
.nav-right {
    display: flex; align-items: center; gap: 25px;
}

/* --- NAV LINKS (Desktop Defaults) --- */
.nav-links {
    display: flex; 
    /* INCREASED GAP: 10px -> 30px */
    gap: 30px; 
    align-items: center; margin: 0; padding: 0;
}

.nav-item {
    text-decoration: none; 
    color: var(--text-muted); 
    font-weight: 500; 
    font-size: 0.9rem;
    transition: color 0.2s; 
    white-space: nowrap;
    position: relative;
}

/* HOVER & ACTIVE STATE */
.nav-item:hover, .nav-item.active { 
    color: var(--text-main); 
    font-weight: 700;        
}

/* Clean Login Button */
.login-pill {
    background: var(--text-main); color: white !important;
    padding: 6px 18px; 
    border-radius: 50px; transition: transform 0.2s;
    font-weight: 600;
}
.login-pill:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }

/* Logged In State */
.user-logged-in {
    background-color: #f4f4f4 !important;
    color: #333 !important;
    border: 1px solid #ddd;
}

/* --- CONTROLS (Lang + Hamburger) --- */
.nav-controls {
    display: flex; align-items: center; gap: 10px;
}

.lang-btn {
    background: transparent; border: 1px solid #eee; padding: 4px 12px;
    border-radius: 20px; font-size: 0.8rem; font-weight: 700;
    cursor: pointer; color: var(--text-main); transition: all 0.2s; white-space: nowrap;
}
.lang-btn:hover { background: #f9f9f9; border-color: #ddd; }

/* --- HAMBURGER --- */
.hamburger-btn {
    display: none; 
    background: none; border: none; cursor: pointer;
    flex-direction: column; justify-content: center; gap: 4px;
    width: 32px; height: 32px; 
    z-index: 4002; 
    padding: 0;
}
.bar {
    width: 24px; height: 2px; 
    background-color: var(--text-main);
    border-radius: 5px; transition: all 0.3s ease;
    align-self: flex-end; 
}
.hamburger-btn.active .bar:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger-btn.active .bar:nth-child(2) { opacity: 0; }
.hamburger-btn.active .bar:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* --- MOBILE RESPONSIVE: Slim & Connected Dropdown --- */
@media (max-width: 900px) {
    .hamburger-btn { display: flex; }

    /* The Dropdown Container */
    .nav-links {
        display: flex; 
        flex-direction: column;
        align-items: center; 
        justify-content: flex-start;
        
        position: absolute;
        top: 60px; 
        left: 0;
        width: 100%;
        height: auto;
        
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(12px); 
        -webkit-backdrop-filter: blur(12px);
        
        padding: 10px 24px 20px 24px;
        
        border-bottom: 1px solid rgba(0,0,0,0.05);
        box-shadow: 0 10px 20px rgba(0,0,0,0.05);
        border-radius: 0 0 20px 20px;
        
        /* Reset gap for mobile since we use padding */
        gap: 0; 
        
        opacity: 0;
        transform: translateY(-10px);
        visibility: hidden;
        transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        z-index: 3900; 
        pointer-events: none;
    }

    .nav-links.open { 
        opacity: 1;
        transform: translateY(0);
        visibility: visible;
        pointer-events: all;
    }

    .nav-item { 
        width: 100%; 
        max-width: 400px;
        font-size: 1rem; 
        font-weight: 600;
        padding: 12px 0; 
        border-bottom: 1px solid #f5f5f5; 
        text-align: center;
        color: var(--text-main);
    }
    .nav-item:last-of-type { border-bottom: none; }

    .login-pill {
        margin-top: 15px; 
        width: 100%; 
        max-width: 400px;
        justify-content: center; 
        flex-shrink: 0;
        padding: 10px; 
        font-size: 0.95rem;
        box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    }
    
    .mobile-drawer-header { display: none !important; }
    
    #mobile-menu-overlay {
        top: 60px; 
        backdrop-filter: blur(2px);
    }
}

/* Helper Elements */
#mobile-menu-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 4000; opacity: 0; visibility: hidden;
    transition: opacity 0.3s;
}
#mobile-menu-overlay.active { opacity: 1; visibility: visible; }

/* User Dropdown */
#user-dropdown {
    display: none; position: absolute; top: 65px; 
    right: 20px; width: 240px;
    background: white; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 6000; flex-direction: column; overflow: hidden; border: 1px solid #eee;
    animation: fadeDown 0.2s ease-out;
}
[dir="rtl"] #user-dropdown { right: auto; left: 20px; }
.ud-header { padding: 15px; background: #f8f9fa; border-bottom: 1px solid #eee; }
.ud-name { font-weight: 800; } .ud-role { font-size: 0.8rem; color: #888; }
.ud-item { padding: 12px 15px; color: #333; text-decoration: none; display: flex; gap: 10px; font-weight: 600; }
.ud-danger { color: #e74c3c; border-top: 1px solid #eee; }
#dropdown-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 5999; }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================
   2. HERO SECTION
   ========================================= */
.hero-section {
    background-color: #2d3436;
    color: white;
    height: 450px;
    display: flex; align-items: center; justify-content: center;
    position: relative; margin-bottom: -60px;
    background-size: cover; background-position: center;
    transition: background 0.3s; overflow: hidden;
}
#hero-overlay {
    position: absolute; top:0; left:0; width:100%; height:100%; 
    background: linear-gradient(180deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.6) 100%);
    z-index: 1; pointer-events:none;
}
.hero-content-wrapper {
    position: relative; z-index: 2; text-align: center; max-width: 700px;
    padding: 0 20px; animation: fadeIn 0.8s ease-out;
}
.hero-title { font-size: 3.5rem; font-weight: 800; margin-bottom: 15px; line-height: 1.1; letter-spacing: -1px; }
.hero-sub { color: rgba(255,255,255,0.9); margin-bottom: 40px; font-size: 1.2rem; font-weight: 500; }
.search-container-hero { max-width: 550px; margin: 0 auto; position: relative; }
.hero-search-input {
    width: 100%; padding: 20px 25px 20px 60px; border-radius: 50px; 
    border: none; font-size: 1.1rem; box-shadow: 0 15px 40px rgba(0,0,0,0.2); 
    outline: none; transition: all 0.3s ease;
}
.hero-search-input:focus { transform: scale(1.02); box-shadow: 0 20px 50px rgba(0,0,0,0.3); }
.search-icon-hero { position: absolute; left: 25px; top: 50%; transform: translateY(-50%); color: #888; font-size: 1.4rem; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================
   3. CATEGORIES & GRID
   ========================================= */
.categories-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; position: relative; z-index: 10; margin-top: 20px; }
.categories-label { font-weight: 700; margin-bottom: 15px; margin-top: 60px; color: var(--text-muted); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 1px; }
.categories-scroll { display: flex; gap: 15px; overflow-x: auto; padding: 10px 5px; scroll-behavior: smooth; scrollbar-width: none; }
.categories-scroll::-webkit-scrollbar { display: none; }
.cat-item { display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer; min-width: 85px; transition: transform 0.2s; background: white; padding: 15px 10px; border-radius: 16px; box-shadow: var(--shadow-sm); border: 1px solid white; }
.cat-item:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); }
.cat-icon { width: 50px; height: 50px; border-radius: 50%; background: #f8f9fa; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; object-fit: cover; }
.cat-name { font-size: 0.85rem; color: var(--text-main); font-weight: 600; text-align: center; }
.cat-item.active { background: var(--text-main); color: white; border-color: var(--text-main); }
.cat-item.active .cat-name { color: white; }
.cat-item.active .cat-icon { background: rgba(255,255,255,0.2); }
.cat-skeleton { width: 50px; height: 50px; background: #eee; border-radius: 50%; }

.main-container { max-width: 1200px; margin: 40px auto; padding: 0 24px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.store-count-badge { background: #e5e7eb; color: #555; padding: 4px 12px; border-radius: 20px; font-weight: 600; font-size: 0.85rem; }
.restaurants-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 30px; }
.store-card { background: white; border-radius: var(--radius-xl); overflow: hidden; box-shadow: var(--shadow-sm); transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); text-decoration: none; color: inherit; display: flex; flex-direction: column; position: relative; border: 1px solid transparent; }
.store-card:hover { transform: translateY(-8px); box-shadow: var(--shadow-lg); }
.image-wrapper { position: relative; height: 180px; overflow: hidden; }
.card-cover { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
.store-card:hover .card-cover { transform: scale(1.05); }
.card-overlay { position: absolute; bottom: 0; left: 0; width: 100%; height: 50%; background: linear-gradient(to top, rgba(0,0,0,0.5), transparent); opacity: 0.6; }
.status-badge { position: absolute; top: 15px; right: 15px; padding: 6px 14px; border-radius: 50px; font-size: 0.75rem; font-weight: 800; backdrop-filter: blur(8px); z-index: 5; text-transform: uppercase; letter-spacing: 0.5px; }
.status-open { background: rgba(39, 174, 96, 0.9); color: white; box-shadow: 0 4px 10px rgba(39, 174, 96, 0.3); }
.status-closed { background: rgba(231, 76, 60, 0.9); color: white; }
.card-body { padding: 20px; position: relative; display: flex; gap: 15px; }
.card-logo { width: 60px; height: 60px; border-radius: 16px; object-fit: cover; border: 3px solid white; box-shadow: 0 4px 10px rgba(0,0,0,0.1); background: white; margin-top: -40px; z-index: 5; position: relative; }
.card-info { flex: 1; }
.store-name { font-size: 1.2rem; font-weight: 800; color: var(--text-main); margin: 0 0 6px 0; }
.store-meta { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--text-muted); font-weight: 500; }
.meta-tag { color: var(--accent-color); font-weight: 700; background: #e8f5e9; padding: 2px 6px; border-radius: 4px; font-size: 0.75rem; }
.meta-dot { font-size: 0.5rem; color: #ccc; }
.store-card.closed { opacity: 0.8; filter: grayscale(0.9); }
.store-card.closed:hover { filter: grayscale(0); opacity: 1; }

#maint-banner { display: none; justify-content: center; align-items: center; gap: 10px; background: #e74c3c; color: white; padding: 12px; font-size: 0.9rem; box-shadow: 0 4px 10px rgba(231, 76, 60, 0.2); }
.spinner { border: 3px solid rgba(0,0,0,0.1); border-top: 3px solid var(--primary-color); border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; margin: 0 auto 10px auto; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 80px 0; color: #999; grid-column: 1/-1; }

/* Mobile Adjustments */
@media (max-width: 600px) {
    .hero-section { height: 350px; padding-top: 60px; }
    .hero-title { font-size: 2.2rem; }
    .hero-search-input { padding: 16px 20px 16px 50px; font-size: 1rem; }
    .search-icon-hero { font-size: 1.2rem; left: 20px; }
    .categories-container { padding: 0 15px; }
    .main-container { padding: 0 15px; margin-top: 30px; }
    .restaurants-grid { grid-template-columns: 1fr; gap: 20px; }
}