/* ============================================
   ماركيتا منيو - صفحات الفئات
   Category Pages Styles
   ============================================ */

/* Variables */
:root {
    --primary: #e22323;
    --primary-dark: #c01e1e;
    --primary-light: #ffb510;
    --secondary: #262626;
    --success: #4CAF50;
    --warning: #FFC107;
    --danger: #F44336;
    --paypal-blue: #003087;
    --bank-green: #00A651;
    
    --bg-main: #FFFFFF;
    --bg-card: #F5F5F5;
    --bg-elevated: #EEEEEE;
    --text-primary: #262626;
    --text-secondary: #555555;
    --text-muted: #999999;
    --border-color: rgba(0, 0, 0, 0.1);
    
    --font-arabic: 'IBM Plex Sans Arabic', sans-serif;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 50px;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
}

html[data-theme="dark"] {
    --bg-main: #101418;
    --bg-card: #171d23;
    --bg-elevated: #202831;
    --text-primary: #f5f7fa;
    --text-secondary: #c6cdd5;
    --text-muted: #8d99a6;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.28);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.34);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.42);
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-arabic);
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
    background: none;
}

img {
    max-width: 100%;
    display: block;
}

/* App Container */
.app-container {
    max-width: 500px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg-main);
}

/* ============================================
   Header
   ============================================ */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-main);
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.back-btn {
    width: 44px;
    height: 44px;
    background: var(--bg-card);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: 0.3s;
}

.back-btn:hover {
    background: var(--primary);
    color: white;
}

.page-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.title-icon {
    font-size: 1.8rem;
}

.page-title h1 {
    font-size: 1.3rem;
    font-weight: 700;
}

.cart-btn {
    position: relative;
    width: 44px;
    height: 44px;
    background: var(--bg-card);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: 0.3s;
}

.cart-btn:hover {
    background: var(--primary);
    color: white;
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Search */
.search-container {
    margin-top: 10px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    background: var(--bg-card);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    transition: 0.3s;
}

.search-box:focus-within {
    border-color: var(--primary);
}

.search-box i {
    color: var(--text-muted);
}

.search-box input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box input:focus {
    outline: none;
}

.search-clear {
    width: 28px;
    height: 28px;
    background: var(--bg-elevated);
    border-radius: 50%;
    color: var(--text-muted);
    display: none;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.search-clear.visible {
    display: flex;
}

.search-clear:hover {
    background: var(--danger);
    color: white;
}

/* ============================================
   Ad Banner - Compact
   ============================================ */
.ad-banner {
    margin: 12px 15px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
}

.ad-content {
    display: flex;
    align-items: center;
    padding: 15px;
    gap: 12px;
}

.ad-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--warning);
    color: var(--secondary);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.65rem;
    font-weight: 700;
}

.ad-text {
    flex: 1;
}

.ad-text h2 {
    font-size: 1rem;
    font-weight: 700;
    color: white;
    margin-bottom: 3px;
}

.ad-text p {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 6px;
}

.ad-price {
    display: flex;
    align-items: center;
    gap: 8px;
}

.old-price {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: line-through;
    font-size: 0.8rem;
}

.new-price {
    font-size: 1.2rem;
    font-weight: 800;
    color: white;
}

.ad-image {
    width: 75px;
    height: 75px;
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.ad-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
    padding: 0 15px 20px;
}

/* Meals Grid */
.meals-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

/* Meal Card - Vertical Box */
.meal-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(16px);
    animation: mealFadeIn 0.45s ease forwards;
    cursor: pointer;
}

.meal-card:nth-child(1) { animation-delay: 0.05s; }
.meal-card:nth-child(2) { animation-delay: 0.1s; }
.meal-card:nth-child(3) { animation-delay: 0.15s; }
.meal-card:nth-child(4) { animation-delay: 0.2s; }
.meal-card:nth-child(5) { animation-delay: 0.25s; }
.meal-card:nth-child(6) { animation-delay: 0.3s; }
.meal-card:nth-child(7) { animation-delay: 0.35s; }
.meal-card:nth-child(8) { animation-delay: 0.4s; }

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

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

/* Meal Image - Big Square */
.meal-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.meal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.meal-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 0.6rem;
    font-weight: 700;
}

.meal-badge.popular {
    background: var(--primary);
    color: white;
}

.meal-badge.new {
    background: var(--warning);
    color: var(--secondary);
}

.meal-price-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 20px;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
}

/* Meal Content */
.meal-content {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meal-header {
    margin-bottom: 0;
}

.meal-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.meal-price {
    display: none;
}

.meal-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.meal-prep {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
    font-size: 0.68rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.meal-prep i {
    color: var(--primary);
    font-size: 0.65rem;
}

.meal-modal .modal-prep-wrap {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.meal-modal .modal-prep-wrap[hidden] {
    display: none !important;
}

.meal-modal .modal-prep-label {
    font-weight: 600;
    color: var(--text-primary);
}

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

.meal-info {
    display: flex;
    gap: 8px;
    font-size: 0.68rem;
    color: var(--text-secondary);
}

.meal-info span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.meal-info i {
    color: var(--primary);
    font-size: 0.65rem;
}

.add-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    transition: 0.3s;
}

.add-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 87, 34, 0.3);
}

.add-btn.added {
    background: var(--success);
}

/* ============================================
   Pagination
   ============================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 25px;
    padding: 15px 0;
}

.page-btn {
    min-width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.page-btn.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.page-dots {
    color: var(--text-muted);
    padding: 0 5px;
}

/* ============================================
   Payment Section
   ============================================ */
.payment-section {
    margin: 20px 15px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.payment-section h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.payment-section h3 i {
    color: var(--primary);
}

.payment-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.payment-buttons.four-cols {
    grid-template-columns: 1fr 1fr;
}

.payment-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 10px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    transition: 0.3s;
}

.bank-btn {
    background: #00A651;
    color: white;
}

.bank-btn:hover {
    background: #008f47;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 166, 81, 0.3);
}

.palpay-btn {
    background: #1E88E5;
    color: white;
}

.palpay-btn:hover {
    background: #1565C0;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(30, 136, 229, 0.3);
}

.visa-btn {
    background: #1A1F71;
    color: white;
}

.visa-btn:hover {
    background: #141850;
    transform: translateY(-2px);
}

.mastercard-btn {
    background: #EB001B;
    color: white;
}

.mastercard-btn:hover {
    background: #CC0000;
    transform: translateY(-2px);
}

.payment-btn i {
    font-size: 1.2rem;
}

/* ============================================
   Social Section
   ============================================ */
.social-section {
    text-align: center;
    padding: 20px 15px;
}

.social-section p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.social-link {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: 0.3s;
    background: transparent;
    border: 2px solid var(--text-muted);
    color: var(--text-secondary);
}

.social-link:hover {
    transform: translateY(-3px);
}

.social-link.facebook:hover {
    border-color: #1877F2;
    color: #1877F2;
}

.social-link.instagram:hover {
    border-color: #E4405F;
    color: #E4405F;
}

.social-link.twitter:hover {
    border-color: #1DA1F2;
    color: #1DA1F2;
}

.social-link.whatsapp:hover {
    border-color: #25D366;
    color: #25D366;
}

.social-link.tiktok:hover {
    border-color: #fff;
    color: #fff;
}

/* ============================================
   Footer
   ============================================ */
.app-footer {
    text-align: center;
    padding: 20px 15px;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   Cart Sidebar
   ============================================ */
.cart-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    background: var(--bg-card);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    transition: 0.3s;
    box-shadow: var(--shadow-lg);
}

.cart-sidebar.open {
    left: 0;
}

.cart-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-color);
}

.cart-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
}

.cart-header h3 i {
    color: var(--primary);
}

.close-cart {
    width: 40px;
    height: 40px;
    background: var(--bg-main);
    border-radius: 50%;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.close-cart:hover {
    background: var(--danger);
    color: white;
}

.cart-order-fields {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
}

.cart-field label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.cart-field input,
.cart-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
}

.cart-field textarea {
    resize: vertical;
    min-height: 56px;
}

.cart-items {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 15px;
    -webkit-overflow-scrolling: touch;
}

.cart-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
}

.cart-item-image {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

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

.cart-item-details {
    flex: 1;
}

.cart-item-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.cart-item-price {
    color: var(--primary);
    font-weight: 700;
    font-size: 0.9rem;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.cart-item-qty button {
    width: 26px;
    height: 26px;
    background: var(--bg-main);
    border-radius: 50%;
    color: white;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item-qty button:hover {
    background: var(--primary);
}

.cart-item-remove {
    align-self: flex-start;
    width: 30px;
    height: 30px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item-remove:hover {
    color: var(--danger);
}

.cart-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.cart-empty i {
    font-size: 3rem;
    opacity: 0.3;
    margin-bottom: 15px;
}

.cart-footer {
    flex-shrink: 0;
    padding: 10px 15px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    background: var(--bg-elevated);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.cart-total span:last-child {
    color: var(--primary);
}

.checkout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 700;
    transition: 0.3s;
}

@media (max-width: 640px) {
    .cart-header {
        padding: 10px 15px;
    }

    .cart-header h3 {
        font-size: 1rem;
    }

    .cart-total {
        margin-bottom: 8px;
        font-size: 0.95rem;
    }
}

.checkout-btn:hover {
    background: var(--primary-dark);
}

.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}

.cart-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   Meal Modal
   ============================================ */
.meal-modal {
    position: fixed;
    inset: 0;
    z-index: 1002;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}

.meal-modal.open {
    opacity: 1;
    visibility: visible;
}

.meal-modal .modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
}

.meal-modal .modal-content {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: 0.3s;
}

.meal-modal.open .modal-content {
    transform: scale(1) translateY(0);
}

.modal-close {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    color: white;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.modal-close:hover {
    background: var(--danger);
}

.modal-image {
    width: 100%;
    height: 200px;
    background-size: cover;
    background-position: center;
}

.modal-body {
    padding: 20px;
}

.modal-body h2 {
    font-size: 1.4rem;
    margin-bottom: 8px;
}

.modal-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 15px;
}

.modal-info {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.modal-info span {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.modal-info i {
    color: var(--primary);
}

.modal-price {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 20px;
}

.quantity-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    margin-bottom: 15px;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qty-btn {
    width: 38px;
    height: 38px;
    background: var(--bg-main);
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.qty-btn:hover {
    background: var(--primary);
}

#qtyValue {
    min-width: 30px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
}

.add-cart-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 700;
    transition: 0.3s;
}

.add-cart-btn:hover {
    background: var(--primary-dark);
}

.btn-total {
    margin-right: auto;
    padding-right: 12px;
    border-right: 2px solid rgba(255, 255, 255, 0.2);
}

/* ============================================
   Notification
   ============================================ */
.notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    border: 1px solid var(--primary);
    opacity: 0;
    transition: 0.3s;
}

.notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.notification i {
    color: var(--primary);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 400px) {
    .ad-content {
        flex-direction: column;
        text-align: center;
    }
    
    .ad-image {
        width: 80px;
        height: 80px;
    }
    
    .payment-buttons {
        grid-template-columns: 1fr;
    }
}
