/* ═══════════════════════════════════════════════════════════════════
   ملك الطابون - Smart Menu - تصميم حديث ومريح
   ═══════════════════════════════════════════════════════════════════ */

:root {
    --primary: #c9510c;
    --primary-dark: #a04008;
    --primary-light: #e67e22;
    --secondary: #f39c12;
    --dark: #1a1a2e;
    --dark-soft: #2d2d44;
    --light: #fefefe;
    --light-warm: #faf8f5;
    --white: #ffffff;
    --gray: #6b7280;
    --gray-light: #9ca3af;
    --success: #10b981;
    --danger: #ef4444;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
    --radius: 16px;
    --radius-lg: 24px;
    --gradient: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    --gradient-dark: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--light-warm);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: 40px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ═══════════════════════════════════════════════════════════════════
   HEADER - الشريط العلوي
   ═══════════════════════════════════════════════════════════════════ */

.main-header {
    background: var(--gradient);
    padding: 18px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 30px rgba(201, 81, 12, 0.25);
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--white);
}

.logo i {
    font-size: 2rem;
    animation: flame 2s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

@keyframes flame {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.05) rotate(-3deg); }
    50% { transform: scale(1.1) rotate(0deg); }
    75% { transform: scale(1.05) rotate(3deg); }
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 800;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
    letter-spacing: -0.5px;
}

.cart-icon {
    position: relative;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--white);
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    padding: 12px;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid rgba(255,255,255,0.2);
}

.cart-icon:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.08);
    border-color: rgba(255,255,255,0.4);
}

.cart-icon:active {
    transform: scale(0.95);
}

.cart-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--success);
    color: white;
    font-size: 0.75rem;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 2px solid var(--white);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

/* ═══════════════════════════════════════════════════════════════════
   CATEGORIES - قائمة الفئات
   ═══════════════════════════════════════════════════════════════════ */

.categories-nav {
    background: var(--white);
    padding: 16px 0;
    position: sticky;
    top: 72px;
    z-index: 90;
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.categories-nav::-webkit-scrollbar {
    display: none;
}

.categories-nav .container {
    display: flex;
    gap: 10px;
    padding-bottom: 4px;
}

.category-item {
    padding: 10px 22px;
    background: var(--light-warm);
    border-radius: 25px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    border: 2px solid transparent;
    white-space: nowrap;
    flex-shrink: 0;
    color: var(--gray);
}

.category-item:hover {
    border-color: var(--primary);
    background: #fff5f0;
    color: var(--primary);
}

.category-item.active {
    background: var(--gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 16px rgba(201, 81, 12, 0.35);
    transform: scale(1.02);
}

/* ═══════════════════════════════════════════════════════════════════
   PRODUCTS SECTION - قسم المنتجات
   ═══════════════════════════════════════════════════════════════════ */

.products-section {
    padding: 24px 0;
}

.section-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 24px;
    position: relative;
    padding-right: 18px;
}

.section-title::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 60%;
    background: var(--gradient);
    border-radius: 3px;
}

/* ═══════════════════════════════════════════════════════════════════
   PRODUCTS GRID - شبكة المنتجات
   ═══════════════════════════════════════════════════════════════════ */

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

@media (max-width: 600px) {
    .products-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   PRODUCT CARD - بطاقة المنتج (صور كبيرة)
   ═══════════════════════════════════════════════════════════════════ */

.product-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0,0,0,0.04);
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

/* صورة المنتج - كبيرة */
.product-img-wrapper {
    position: relative;
    width: 100%;
    padding-top: 75%; /* Aspect ratio 4:3 */
    overflow: hidden;
    background: linear-gradient(135deg, #f8f8f8 0%, #efefef 100%);
}

.product-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card:hover .product-img {
    transform: scale(1.08);
}

/* Placeholder للصور */
.product-img-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0ebe5 0%, #e8e0d5 100%);
    color: var(--primary);
    font-size: 3rem;
    font-weight: 800;
}

/* معلومات المنتج */
.product-info {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--dark);
    line-height: 1.4;
}

.product-desc {
    font-size: 0.9rem;
    color: var(--gray);
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.6;
    flex-grow: 1;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
}

.product-price {
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--primary);
}

.product-price small {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray-light);
}

.add-btn {
    background: var(--gradient);
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(201, 81, 12, 0.3);
}

.add-btn:hover {
    transform: scale(1.12) rotate(90deg);
    box-shadow: 0 6px 24px rgba(201, 81, 12, 0.45);
}

.add-btn:active {
    transform: scale(0.95);
}

/* حالات التحميل والخطأ */
.loading, .error, .no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
    font-size: 1.1rem;
}

.loading::before {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════════════
   MODALS - النوافذ المنبثقة
   ═══════════════════════════════════════════════════════════════════ */

.cart-modal, .checkout-modal, .success-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cart-modal.active, .checkout-modal.active, .success-modal.active {
    display: flex;
    opacity: 1;
}

.cart-content, .checkout-content {
    background: var(--white);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 24px;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.success-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 40px 30px;
    text-align: center;
    width: 90%;
    max-width: 400px;
    margin: auto;
    animation: popIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes popIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Header للـ Modal */
.cart-header, .checkout-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f0f0f0;
}

.cart-header h3, .checkout-header h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--dark);
}

.close-cart, .close-checkout {
    background: #f5f5f5;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray);
    transition: all 0.3s ease;
}

.close-cart:hover, .close-checkout:hover {
    background: #eee;
    color: var(--dark);
}

/* عناصر السلة */
.cart-items {
    min-height: 100px;
}

.empty-cart {
    text-align: center;
    padding: 40px;
    color: var(--gray-light);
    font-size: 1rem;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid #f5f5f5;
}

.item-details h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.item-details p {
    font-size: 0.85rem;
    color: var(--gray);
}

.item-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #e0e0e0;
    background: white;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.qty-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.item-qty {
    font-weight: 700;
    min-width: 24px;
    text-align: center;
}

/* Footer السلة */
.cart-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.total-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 20px;
    color: var(--dark);
}

.checkout-btn, .confirm-btn {
    width: 100%;
    padding: 16px;
    background: var(--gradient);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(201, 81, 12, 0.35);
    font-family: inherit;
}

.checkout-btn:hover, .confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(201, 81, 12, 0.45);
}

.checkout-btn:active, .confirm-btn:active {
    transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════════════════
   FORM STYLES - النماذج
   ═══════════════════════════════════════════════════════════════════ */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.95rem;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fafafa;
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(201, 81, 12, 0.1);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

/* أنواع الطلبات */
.order-types {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.type-option {
    position: relative;
    cursor: pointer;
}

.type-option input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.type-option span {
    display: block;
    padding: 12px 8px;
    text-align: center;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    background: #fafafa;
}

.type-option:hover span {
    border-color: var(--primary-light);
}

.type-option input:checked + span {
    background: var(--gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(201, 81, 12, 0.3);
}

.hidden {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════
   SUCCESS MODAL - نافذة النجاح
   ═══════════════════════════════════════════════════════════════════ */

.success-icon {
    font-size: 4rem;
    color: var(--success);
    margin-bottom: 20px;
}

.success-content h3 {
    font-size: 1.4rem;
    margin-bottom: 12px;
    color: var(--dark);
}

.success-content p {
    color: var(--gray);
    margin-bottom: 8px;
}

.success-content #orderId {
    font-weight: 800;
    color: var(--primary);
    font-size: 1.2rem;
}

.close-success {
    margin-top: 24px;
    padding: 12px 40px;
    background: var(--dark);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.close-success:hover {
    background: var(--dark-soft);
    transform: scale(1.05);
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE - التجاوب
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.2rem;
    }

    .section-title {
        font-size: 1.3rem;
    }

    .order-types {
        grid-template-columns: 1fr;
    }

    .type-option span {
        padding: 14px;
    }
}
