﻿/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    height: 100%;
}

body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    color: #333;
    direction: rtl;
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============= أنيميشن الأقسام ============= */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

.category-section {
    animation-duration: 0.5s;
    animation-fill-mode: both;
}

    .category-section.fade-in {
        animation-name: fadeIn;
    }

    .category-section.fade-out {
        animation-name: fadeOut;
    }

/* أنيميشن للبطاقات - تبدأ صغيرة وتكبر */
@keyframes itemSlideIn {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.3);
    }

    50% {
        opacity: 0.5;
        transform: translateY(15px) scale(0.7);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.fade-in .item-card {
    animation: itemSlideIn 0.5s ease-out backwards;
}

    .fade-in .item-card:nth-child(1) {
        animation-delay: 0.05s;
    }

    .fade-in .item-card:nth-child(2) {
        animation-delay: 0.1s;
    }

    .fade-in .item-card:nth-child(3) {
        animation-delay: 0.15s;
    }

    .fade-in .item-card:nth-child(4) {
        animation-delay: 0.2s;
    }

    .fade-in .item-card:nth-child(5) {
        animation-delay: 0.25s;
    }

    .fade-in .item-card:nth-child(6) {
        animation-delay: 0.3s;
    }

    .fade-in .item-card:nth-child(7) {
        animation-delay: 0.35s;
    }

    .fade-in .item-card:nth-child(8) {
        animation-delay: 0.4s;
    }

    .fade-in .item-card:nth-child(9) {
        animation-delay: 0.45s;
    }

    .fade-in .item-card:nth-child(10) {
        animation-delay: 0.5s;
    }

    .fade-in .item-card:nth-child(11) {
        animation-delay: 0.55s;
    }

    .fade-in .item-card:nth-child(12) {
        animation-delay: 0.6s;
    }

/* Top Bar */
.top-bar {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.top-bar-content {
    width: 100%;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.restaurant-logo {
    width: 75px;
    height: 75px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

    .restaurant-logo img {
        width: 100%;
        height: 100%;
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid #e0e0e0;
    }

.logo-placeholder {
    font-size: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.restaurant-title {
    font-size: 1.5em;
    font-weight: 700;
    color: #333;
}

/* Action Bar */
.action-bar {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 10px 0;
    position: sticky;
    top: 81px;
    z-index: 99;
}

.action-bar-content {
    width: 100%;
    padding: 0 20px;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

.action-btn {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 10px; /* تصغير العرض */
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 14px;
    font-weight: 600;
    min-width: 35px; /* تصغير العرض الأدنى */
    position: relative;
}

    .action-btn:hover {
        background: #e9ecef;
        border-color: #999;
        transform: translateY(-2px);
    }

    .action-btn:active {
        transform: translateY(0);
    }

.lang-btn {
    min-width: 35px; /* تصغير العرض */
}

/* Cart Button & Badge */
.cart-btn {
    position: relative;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    border: 2px solid white;
    animation: badgePulse 0.5s ease;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #28a745;
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
}

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

/* Categories Navigation */
.categories-nav {
    background: white;
    padding: 20px 0;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 131px;
    z-index: 98;
}

.categories-scroll {
    width: 100%;
    padding: 0 20px;
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #f7fafc;
}

    .categories-scroll::-webkit-scrollbar {
        height: 6px;
    }

    .categories-scroll::-webkit-scrollbar-track {
        background: #f7fafc;
    }

    .categories-scroll::-webkit-scrollbar-thumb {
        background: #cbd5e0;
        border-radius: 3px;
    }

.category-btn {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 8px 15px; /* تصغير الارتفاع */
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px; /* تقليل المسافة */
    min-width: 120px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

    /* تصميم الزر النشط */
    .category-btn.active {
        border-color: #667eea;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
        transform: translateY(-3px);
    }

        .category-btn.active .category-icon {
            background: transparent; /* إلغاء الخلفية */
            border: none; /* إلغاء البوردر */
        }

    .category-btn:hover:not(.active) {
        border-color: #667eea;
        background: #f8f9ff;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    }

.category-icon {
    width: 120px; /* تكبير الصورة */
    height: 120px; /* تكبير الصورة */
    border-radius: 0; /* إلغاء الدائرة */
    background: transparent; /* إلغاء الخلفية */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible; /* السماح بظهور الأيقونة */
    position: relative;
    transition: all 0.3s ease;
}

    .category-icon img {
        width: 100%;
        height: 100%;
        object-fit: contain; /* للحفاظ على النسبة */
        border-radius: 0; /* إلغاء الدائرة */
    }

    .category-icon span {
        font-size: 60px !important; /* تكبير الإيموجي */
    }

/* Main Container */
.main-container {
    width: 100%;
    padding: 30px 20px;
}

.category-section {
    margin-bottom: 50px;
}

.section-title {
    display: none; /* إخفاء عنوان القسم */
}

/* Items Grid */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.item-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

    .item-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    }

.card-image {
    width: 100%;
    height: 300px; /* زيادة من 250px */
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

    .card-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.3s ease;
    }

.item-card:hover .card-image img {
    transform: scale(1.05);
}

.no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.6);
}

.card-content {
    padding: 20px;
    position: relative;
    min-height: 120px;
    display: flex;
    flex-direction: column;
}

/* صف العنوان والسعر */
.item-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.item-title {
    font-size: 1.2em;
    font-weight: 700;
    color: #333;
    line-height: 1.4;
    flex: 1;
    margin-bottom: 0; /* إلغاء المسافة السفلية */
}

.item-description {
    font-size: 0.9em;
    color: #666;
    line-height: 1.5;
    margin-bottom: 15px;
    flex-grow: 1;
}

.item-price-badge {
    background: #667eea;
    color: white;
    padding: 6px 14px; /* تصغير قليلاً */
    border-radius: 25px;
    font-size: 1em;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap; /* منع الكسر */
    flex-shrink: 0; /* منع التقليص */
}

    .item-price-badge .price {
        font-size: 1.2em;
    }

    .item-price-badge .currency {
        font-size: 0.8em;
    }

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 40px;
    height: 40px;
    background: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    color: #333;
}

    .modal-close:hover {
        background: #f8f9fa;
        transform: rotate(90deg);
    }

.modal-image {
    width: 100%;
    height: 300px;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

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

.modal-title {
    font-size: 1.6em;
    font-weight: 700;
    color: #333;
    padding: 20px 20px 10px;
}

.modal-description {
    color: #666;
    padding: 0 20px 20px;
    line-height: 1.6;
}

.modal-note {
    padding: 0 20px 20px;
}

    .modal-note textarea {
        width: 100%;
        padding: 15px;
        border: 2px solid #e0e0e0;
        border-radius: 12px;
        font-family: 'Cairo', sans-serif;
        font-size: 14px;
        resize: none;
        transition: all 0.3s ease;
    }

        .modal-note textarea:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
        }

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 15px;
    align-items: center;
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 10px 15px;
}

    .quantity-control button {
        width: 35px;
        height: 35px;
        background: white;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        cursor: pointer;
        font-size: 20px;
        font-weight: 700;
        color: #667eea;
        transition: all 0.3s ease;
    }

        .quantity-control button:hover {
            background: #667eea;
            color: white;
            border-color: #667eea;
            transform: scale(1.1);
        }

        .quantity-control button:active {
            transform: scale(0.95);
        }

    .quantity-control span {
        font-size: 18px;
        font-weight: 700;
        min-width: 30px;
        text-align: center;
    }

.add-btn {
    flex: 1;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 15px 20px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
}

    .add-btn:hover {
        background: #5568d3;
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
    }

    .add-btn:active {
        transform: translateY(0);
    }

/* Cart Modal */
.cart-modal-content {
    max-width: 600px;
}

.cart-header {
    padding: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.cart-items {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.cart-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 15px;
    position: relative;
}

.cart-item-details h3 {
    font-size: 1.1em;
    color: #333;
    margin-bottom: 5px;
}

.cart-item-note {
    font-size: 0.85em;
    color: #666;
    margin: 5px 0;
    font-style: italic;
}

.cart-item-price {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

.cart-item-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.cart-quantity-control {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    border-radius: 8px;
    padding: 5px 10px;
}

    .cart-quantity-control button {
        width: 28px;
        height: 28px;
        background: #667eea;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        font-size: 16px;
        font-weight: 700;
        color: white;
        transition: all 0.2s ease;
    }

        .cart-quantity-control button:hover {
            background: #5568d3;
            transform: scale(1.1);
        }

    .cart-quantity-control span {
        font-size: 16px;
        font-weight: 700;
        min-width: 25px;
        text-align: center;
    }

.remove-btn {
    background: #dc3545;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
}

    .remove-btn:hover {
        background: #c82333;
        transform: scale(1.1);
    }

.cart-item-total {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 1.1em;
    font-weight: 700;
    color: #667eea;
    padding-top: 10px;
    border-top: 2px dashed #dee2e6;
    margin-top: 10px;
}

.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #999;
}

    .cart-empty svg {
        margin-bottom: 20px;
        opacity: 0.3;
    }

    .cart-empty p {
        font-size: 1.2em;
        font-weight: 600;
    }

.cart-footer {
    padding: 20px;
    border-top: 2px solid #e0e0e0;
    background: #f8f9fa;
}

.cart-total {
    background: white;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    font-size: 1.3em;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

    .cart-total strong {
        color: #667eea;
        font-size: 1.4em;
    }

.checkout-btn {
    width: 100%;
    background: #25D366;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 18px 20px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 10px;
}

    .checkout-btn:hover {
        background: #1fbd58;
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(37, 211, 102, 0.3);
    }

.payment-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 18px 20px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 10px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

    .payment-btn:hover {
        background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
    }

.clear-cart-btn {
    width: 100%;
    background: white;
    color: #dc3545;
    border: 2px solid #dc3545;
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

    .clear-cart-btn:hover {
        background: #dc3545;
        color: white;
    }

/* Responsive Design */
@media (max-width: 768px) {
    .items-grid {
        grid-template-columns: 1fr;
    }

    .restaurant-title {
        font-size: 1.2em;
    }

    .section-title {
        font-size: 1.4em;
    }

    .category-btn {
        min-width: 100px;
        padding: 6px 12px; /* تصغير الارتفاع */
    }

    .category-icon {
        width: 80px; /* تكبير للموبايل */
        height: 80px;
    }

        .category-icon span {
            font-size: 40px !important; /* تكبير الإيموجي للموبايل */
        }

    .card-image {
        height: 250px; /* زيادة من 200px */
    }

    .action-bar {
        top: 71px;
    }

    .categories-nav {
        top: 121px;
    }

    .action-bar-content {
        flex-wrap: wrap;
        justify-content: center;
    }

    .cart-item {
        grid-template-columns: 1fr;
    }

    .cart-item-actions {
        flex-direction: row;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .main-container {
        padding: 20px 10px;
    }

    .modal-content {
        margin: 0;
        border-radius: 20px 20px 0 0;
        max-height: 95vh;
    }

    .modal-image {
        height: 220px;
    }

    .item-title {
        font-size: 1em;
    }

    .item-description {
        font-size: 0.85em;
    }

    .item-price-badge {
        font-size: 0.95em;
    }

    .modal-footer {
        flex-direction: column;
        gap: 10px;
    }

    .quantity-control {
        width: 100%;
        justify-content: center;
    }

    .add-btn {
        width: 100%;
    }

    .cart-modal-content {
        max-width: 100%;
        border-radius: 20px 20px 0 0;
    }
}

/* RTL/LTR Support */
[dir="ltr"] .modal-close {
    left: auto;
    right: 15px;
}

[dir="ltr"] .action-bar-content {
    flex-direction: row-reverse;
}

[dir="ltr"] .cart-badge {
    right: auto;
    left: -8px;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Large Screens */
@media (min-width: 1920px) {
    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (min-width: 2560px) {
    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

/* Text display control */
.ar-text {
    display: inline;
}

.en-text {
    display: none;
}

[dir="ltr"] .ar-text {
    display: none;
}

[dir="ltr"] .en-text {
    display: inline;
}
