/* =========================================
   Zamalek Menus - Main Stylesheet
   Mobile-first, RTL
   ========================================= */

:root {
    --primary: #d81e1e;
    --primary-dark: #a31515;
    --primary-light: #ffeaea;
    --black: #111;
    --gray-900: #1a1a1a;
    --gray-700: #4a4a4a;
    --gray-500: #777;
    --gray-300: #d0d0d0;
    --gray-200: #e5e5e5;
    --gray-100: #f5f5f5;
    --gray-50: #fafafa;
    --white: #ffffff;
    --success: #2e7d32;
    --warning: #f9b300;
    --offer-yellow: #d6ff3a;
    --pro-purple: #7b3ff2;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Tajawal', 'Cairo', 'Tahoma', 'Segoe UI', sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    direction: rtl;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

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

/* =========================================
   Preloader
   ========================================= */
#preloader {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #ffffff 0%, #fff5f5 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.preloader-shield {
    width: 120px;
    height: 145px;
    animation: shield-pulse 1.8s ease-in-out infinite;
    filter: drop-shadow(0 8px 20px rgba(216, 30, 30, 0.3));
}

.preloader-text {
    margin-top: 24px;
    font-size: 18px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 1px;
    opacity: 0;
    animation: fade-in-text 0.8s ease 0.4s forwards;
}

.preloader-dots {
    display: flex;
    gap: 8px;
    margin-top: 20px;
}

.preloader-dots span {
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    animation: dot-bounce 1.4s ease-in-out infinite;
}

.preloader-dots span:nth-child(2) { animation-delay: 0.2s; }
.preloader-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes shield-pulse {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.08) rotate(-2deg); }
}

@keyframes fade-in-text {
    to { opacity: 1; }
}

@keyframes dot-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-12px); opacity: 1; }
}

/* =========================================
   Header
   ========================================= */
.site-header {
    background: var(--white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--gray-200);
}

.site-header-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    max-width: 1200px;
    margin: 0 auto;
}

.site-header .back-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-900);
    flex-shrink: 0;
}

.site-header .back-btn svg { width: 20px; height: 20px; }

.site-header .header-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--gray-900);
    flex: 1;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-header .header-actions {
    display: flex;
    gap: 8px;
}

.site-header .header-actions button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
}

.site-header .header-actions svg { width: 20px; height: 20px; color: var(--gray-900); }

/* Home header (with logo) */
.home-header .header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.home-header .header-logo img {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.home-header .header-logo .brand-name {
    font-size: 16px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}

.home-header .header-logo .brand-sub {
    font-size: 11px;
    color: var(--gray-500);
}

/* =========================================
   Hero / Banner section
   ========================================= */
.hero-banner {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 24px 16px 32px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(255,255,255,0.08) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(255,255,255,0.06) 0%, transparent 40%);
    pointer-events: none;
}

.hero-banner h1 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 6px;
    position: relative;
}

.hero-banner p {
    font-size: 13px;
    opacity: 0.95;
    position: relative;
}

/* =========================================
   Main Container
   ========================================= */
.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px;
}

/* =========================================
   Main Category Tabs (Food / Drinks / All)
   ========================================= */
.category-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: var(--white);
    overflow-x: auto;
    scrollbar-width: none;
    position: sticky;
    top: 64px;
    z-index: 90;
    border-bottom: 1px solid var(--gray-200);
}

.category-tabs::-webkit-scrollbar { display: none; }

.category-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--gray-100);
    border-radius: 24px;
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-700);
    white-space: nowrap;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.category-tab.active {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(216, 30, 30, 0.3);
}

.category-tab svg { width: 16px; height: 16px; }

/* =========================================
   Subcategories (food types)
   ========================================= */
.section-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--gray-900);
    margin: 20px 0 12px;
    padding: 0 4px;
}

.section-subtitle {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: -8px;
    margin-bottom: 14px;
    padding: 0 4px;
}

.subcategories-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 4px 0 8px;
    margin: 0 -16px;
    padding-right: 16px;
    padding-left: 16px;
}

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

.subcategory-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 76px;
    cursor: pointer;
    transition: transform 0.15s;
}

.subcategory-chip:active { transform: scale(0.95); }

.subcategory-chip .chip-img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--gray-100);
    object-fit: cover;
    border: 2.5px solid transparent;
    transition: border-color 0.2s, transform 0.2s;
}

.subcategory-chip.active .chip-img {
    border-color: var(--primary);
    transform: scale(1.05);
}

.subcategory-chip .chip-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-700);
    text-align: center;
    line-height: 1.3;
}

.subcategory-chip.active .chip-label {
    color: var(--primary);
    font-weight: 800;
}

/* =========================================
   Restaurant Cards
   ========================================= */
.restaurants-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.restaurant-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    display: flex;
    gap: 12px;
    padding: 12px;
    align-items: center;
    border: 1px solid var(--gray-200);
}

.restaurant-card:active {
    transform: scale(0.98);
}

.restaurant-card:hover {
    box-shadow: var(--shadow-lg);
}

.restaurant-card .rest-logo {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: cover;
    background: var(--gray-100);
    flex-shrink: 0;
}

.restaurant-card .rest-info {
    flex: 1;
    min-width: 0;
}

.restaurant-card .rest-name {
    font-size: 16px;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.restaurant-card .rest-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--gray-500);
    flex-wrap: wrap;
}

.restaurant-card .rest-rating {
    display: flex;
    align-items: center;
    gap: 3px;
    color: var(--gray-900);
    font-weight: 700;
}

.restaurant-card .rest-rating svg {
    width: 14px;
    height: 14px;
    fill: var(--warning);
}

.restaurant-card .rest-desc {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

.restaurant-card .offer-tag {
    display: inline-block;
    background: var(--offer-yellow);
    color: var(--black);
    font-size: 11px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    margin-top: 6px;
}

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

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--gray-300);
    margin: 0 auto 16px;
}

.empty-state h3 {
    font-size: 16px;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.empty-state p { font-size: 13px; }

/* =========================================
   Restaurant Detail Page
   ========================================= */
.restaurant-cover {
    width: 100%;
    height: 220px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.restaurant-header-info {
    background: var(--white);
    margin: -40px 16px 0;
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    position: relative;
    z-index: 5;
    display: flex;
    gap: 14px;
    align-items: center;
}

.restaurant-header-info .rest-logo-lg {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    object-fit: cover;
    background: var(--gray-100);
    border: 3px solid var(--white);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.restaurant-header-info .info-text { flex: 1; min-width: 0; }

.restaurant-header-info h1 {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 4px;
}

.restaurant-meta-row {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 12px;
    color: var(--gray-500);
    flex-wrap: wrap;
    margin-top: 6px;
}

.restaurant-meta-row .meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.restaurant-meta-row svg { width: 14px; height: 14px; }

/* Offers strip */
.offers-section {
    margin-top: 20px;
}

.offers-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 0 16px 8px;
    margin: 0 -16px;
}

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

.offer-card {
    min-width: 200px;
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: transform 0.15s;
}

.offer-card:active { transform: scale(0.97); }

.offer-card .offer-img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--gray-100);
}

.offer-card .offer-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.offer-card .save-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--offer-yellow);
    color: var(--black);
    font-size: 11px;
    font-weight: 800;
    padding: 5px 10px;
    border-radius: 6px;
}

.offer-card .offer-body {
    padding: 10px 12px 12px;
}

.offer-card .offer-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.offer-card .offer-prices {
    display: flex;
    align-items: center;
    gap: 8px;
}

.offer-card .offer-price-now {
    color: var(--gray-900);
    font-weight: 800;
    font-size: 14px;
    background: linear-gradient(transparent 60%, var(--offer-yellow) 60%);
    padding: 0 2px;
}

.offer-card .offer-price-old {
    color: var(--gray-500);
    text-decoration: line-through;
    font-size: 12px;
}

/* Menu sections */
.menu-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 14px 16px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 64px;
    z-index: 80;
    margin-top: 16px;
}

.menu-tabs::-webkit-scrollbar { display: none; }

.menu-tab {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-500);
    white-space: nowrap;
    border-bottom: 2.5px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    cursor: pointer;
}

.menu-tab.active {
    color: var(--gray-900);
    border-bottom-color: var(--primary);
}

.menu-category {
    margin-bottom: 20px;
}

.menu-category h2 {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 4px;
    padding: 0 4px;
}

/* Product card */
.product-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
    display: flex;
    gap: 12px;
    align-items: center;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.product-card .prod-info { flex: 1; min-width: 0; }

.product-card .top-rated-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fff4e6;
    color: #d97706;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    margin-bottom: 6px;
}

.product-card .top-rated-badge svg {
    width: 12px;
    height: 12px;
    fill: var(--warning);
}

.product-card .prod-name {
    font-size: 15px;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.product-card .prod-desc {
    font-size: 12px;
    color: var(--gray-500);
    line-height: 1.5;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card .prod-price {
    font-size: 14px;
    font-weight: 800;
    color: var(--gray-900);
}

.product-card .prod-price.has-discount {
    background: linear-gradient(transparent 60%, var(--offer-yellow) 60%);
    padding: 0 2px;
}

.product-card .prod-price-old {
    color: var(--gray-500);
    text-decoration: line-through;
    font-size: 12px;
    margin-right: 6px;
}

.product-card .prod-img {
    width: 90px;
    height: 90px;
    border-radius: 12px;
    object-fit: cover;
    background: var(--gray-100);
    flex-shrink: 0;
}

/* Search / filter button */
.search-bar {
    margin: 12px 16px;
    background: var(--gray-100);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--gray-500);
    font-size: 14px;
}

.search-bar svg { width: 18px; height: 18px; }

.search-bar input {
    border: none;
    background: none;
    flex: 1;
    font-size: 14px;
    font-family: inherit;
    color: var(--gray-900);
    outline: none;
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 24px 16px;
    color: var(--gray-500);
    font-size: 12px;
    margin-top: 30px;
    border-top: 1px solid var(--gray-200);
    background: var(--white);
}

.site-footer .logo-small {
    width: 36px;
    margin: 0 auto 8px;
    opacity: 0.85;
}

/* =========================================
   Responsive: Tablet and up
   ========================================= */
@media (min-width: 768px) {
    .container { padding: 24px; }
    .hero-banner { padding: 40px 24px 50px; }
    .hero-banner h1 { font-size: 28px; }
    .restaurants-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

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

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 0%, var(--gray-200) 50%, var(--gray-100) 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.4s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
