* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Cairo', sans-serif;
    background: #fef9e8;
    scroll-behavior: smooth;
    position: relative;
}
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('https://tse4.mm.bing.net/th/id/OIP.BYqFECFRyjAn7eA6S48cVwHaEK?rs=1&pid=ImgDetMain&o=7&rm=3');
    background-size: cover;
    background-position: center;
    opacity: 0.05;
    pointer-events: none;
    z-index: -1;
}
.hero-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('https://c8.alamy.com/comp/FJY538/fresh-dairy-products-on-an-old-wooden-board-FJY538.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.85;
    pointer-events: none;
    z-index: 0;
}
.hero-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,240,0.1) 0%, rgba(245,250,235,0.15) 100%);
    pointer-events: none;
    z-index: 0;
}

/* أنيميشنات */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes gentleGlow {
    0% { box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
    50% { box-shadow: 0 8px 24px rgba(34,197,94,0.15); }
    100% { box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
}
@keyframes shimmer {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

/* تحسينات التجاوب والأنيميشن */
:root {
    --primary-green: #16a34a;
    --secondary-green: #22c55e;
    --dark-green: #15803d;
    --accent-orange: #f97316;
    --bg-light: #fef9e8;
    --transition-smooth: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* شريط التمرير العام للمتصفح */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-light); }
::-webkit-scrollbar-thumb { 
    background: linear-gradient(to bottom, var(--primary-green), var(--secondary-green));
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: var(--dark-green); }

/* تأثيرات حركية احترافية للبطاقات */
.product-card {
    transition: var(--transition-smooth);
    animation: slideInRight 0.6s ease-out forwards;
}

.product-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 25px 50px -12px rgba(22, 163, 74, 0.25);
}

.category-card {
    transition: var(--transition-smooth);
    animation: fadeIn 0.8s ease-out;
}

.category-card:hover {
    transform: scale(1.05);
    background: linear-gradient(135deg, #ffffff, #f0fdf4);
}

/* تحسين الأزرار */
.whatsapp-btn, .confirm-btn {
    animation: pulse-soft 2s infinite;
}

/* تحسين المودال */
.wishlist-content, .tracking-content, .product-details-content, .cart-content {
    animation: zoomIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* شريط العروض - حركة دورانية لا نهائية وسلسة جداً */
@keyframes scrollLoop {
    0% { transform: translateX(0); }
    100% { transform: translateX(50%); } /* التحريك لليمين في وضع RTL يكشف النص القادم من اليسار */
}

.marquee-container {
    background: linear-gradient(90deg, #15803d, #16a34a);
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    z-index: 100;
    height: 40px;
    display: flex;
    align-items: center;
    overflow: hidden;
    position: relative;
    width: 100%;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.marquee {
    display: flex;
    width: max-content;
    animation: scrollLoop 30s linear infinite; /* سرعة مريحة وتكرار لا نهائي */
    will-change: transform;
    flex-direction: row-reverse; /* لضمان الترتيب الصحيح في RTL */
}

.marquee span {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-left: 10rem; /* مسافة ثابتة بين الجمل لضمان التكرار السلس */
    font-size: 1.05rem;
    font-weight: 800;
    color: white;
    white-space: nowrap;
    line-height: 40px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* تحسين الأقسام للموبايل */
@media (max-width: 768px) {
    .main-title { 
        font-size: clamp(3rem, 15vw, 4rem) !important; 
        margin-top: 1.5rem !important;
        margin-bottom: 0.5rem !important;
        line-height: 1.1;
        letter-spacing: -1px;
    }
    .header-subtitle { 
        font-size: 0.95rem !important; 
        padding: 0.5rem 1.2rem !important;
        margin-top: 1.2rem !important;
        line-height: 1.6 !important;
        max-width: 90%;
        margin-left: auto;
        margin-right: auto;
    }
    
    .whatsapp-btn {
        padding: 1rem 2rem !important;
        font-size: 1.1rem !important;
    }

    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 0.8rem;
    }
    
    .filter-price-btn {
        padding: 0.6rem 1rem !important;
        font-size: 0.85rem !important;
        margin-bottom: 0.5rem;
    }

    .category-card .img-box { height: 90px; }
    .cat-name { font-size: 0.85rem; }
    
    .product-card {
        width: 160px;
        padding: 0.6rem;
    }
    
    .product-card .img-box { height: 100px; }
}

/* تنسيق الايموجي */
.emoji {
    display: inline-block;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    vertical-align: middle;
    line-height: 1;
    margin: 0 0.2rem;
    transition: transform 0.3s ease;
}

.product-card:hover .emoji { transform: scale(1.2) rotate(10deg); }

/* تحسين الأزرار التفاعلية */
.admin-action-btn, .whatsapp-btn, .carousel-btn, .heart-btn {
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.admin-action-btn:active { transform: scale(0.9); }

/* تحسين عرض السلة للموبايل */
.cart-content {
    width: 95% !important;
    margin: 1rem auto !important;
    border-radius: 2rem !important;
}

/* تحسين شريط البحث للموبايل */
#search-input {
    transition: var(--transition-smooth);
}
#search-input:focus {
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.15);
    border-color: var(--primary-green);
}

/* أزرار جانبية */
.heart-btn {
    background: linear-gradient(135deg, #ffe4e6, #ffe0e3);
    color: #e11d48;
    transition: all 0.3s ease;
    border: 1px solid rgba(225, 29, 72, 0.2);
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    animation: gentleGlow 3s infinite;
}
.heart-btn:hover {
    transform: scale(1.1);
    background: linear-gradient(135deg, #fecdd3, #ffc0cb);
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.2);
}
.dark-toggle {
    background: #f1f5f9;
    transition: all 0.3s ease;
    border-radius: 2rem;
    padding: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.dark-toggle:hover {
    transform: scale(1.05);
    background: #e2e8f0;
}
#cartButton {
    transition: all 0.3s ease;
}
#cartButton:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 20px rgba(34,197,94,0.3);
}
#cartButton:active {
    transform: scale(0.98);
}

/* بطاقات المنتجات */
.product-card {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    background: white;
    border-radius: 1rem;
    padding: 0.8rem;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    animation: fadeInUp 0.5s ease-out forwards;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    flex: 0 0 auto;
    width: 200px;
    scroll-snap-align: start;
}
.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #15803d, #22c55e, #4ade80, #22c55e, #15803d);
    background-size: 200% 100%;
    transform: translateX(-100%);
    transition: transform 0.4s ease;
    z-index: 10;
    border-radius: 4px 4px 0 0;
}
.product-card:hover::before {
    transform: translateX(0);
    animation: shimmer 0.6s ease;
}
.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 35px -12px rgba(34,197,94,0.2);
    border-color: #22c55e;
    background: white;
}
.product-card .img-box {
    background: #fafafa;
    border-radius: 0.8rem;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.8rem;
    overflow: hidden;
}
.product-card .img-box img {
    max-height: 85%;
    max-width: 85%;
    object-fit: contain;
    transition: transform 0.4s ease;
}
.product-card:hover .img-box img {
    transform: scale(1.08);
}

/* بطاقات الأقسام */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1.2rem;
    margin: 1.5rem 0;
}
.category-card {
    background: white;
    border-radius: 1.2rem;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    border: 2px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
}
.category-card.active {
    background: #16a34a;
    color: white;
    border-color: #16a34a;
    transform: scale(1.02);
}
.category-card.active .cat-icon {
    filter: brightness(0) invert(1);
}
.category-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -12px rgba(34,197,94,0.25);
    border-color: #22c55e;
}
.category-card .img-box {
    width: 100%;
    height: 120px;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border-radius: 1rem;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.category-card .img-box::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(22,163,74,0.05), rgba(34,197,94,0.1));
    z-index: 1;
}
.category-card .img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    position: relative;
    z-index: 0;
}
.category-card:hover .img-box img {
    transform: scale(1.1);
}
.cat-name {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.3px;
    color: #1f2937;
}
.category-card.active .cat-name {
    color: white;
}

/* دعم الوضع الليلي للأقسام */
.dark-mode .category-card {
    background: #1e1e1e;
    border-color: #333;
}
.dark-mode .category-card .img-box {
    background: linear-gradient(135deg, #1a3a1a, #0d2a0d);
}
.dark-mode .category-card .cat-name {
    color: #ffffff;
}
.dark-mode .category-card:hover {
    border-color: #22c55e;
    box-shadow: 0 20px 40px -12px rgba(34,197,94,0.3);
}

/* شريط أخضر فوق البطاقة عند الـ hover */
.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #15803d, #22c55e, #4ade80);
    transform: scaleX(0);
    transition: transform 0.3s ease;
    border-radius: 1.2rem 1.2rem 0 0;
}
.category-card:hover::before {
    transform: scaleX(1);
}

/* كاروسيل */
.carousel-container {
    position: relative;
    overflow: hidden;
    margin: 1rem 0;
}
.carousel-track {
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    gap: 1rem;
    padding: 0.5rem 0;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}
.carousel-track::-webkit-scrollbar {
    display: none;
}
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: 0.2s;
}
.carousel-btn:hover {
    background: #16a34a;
    color: white;
    border-color: #16a34a;
}
.carousel-btn-left {
    right: -10px;
}
.carousel-btn-right {
    left: -10px;
}

/* باقي العناصر */
.feature-card {
    animation: fadeInUp 0.6s ease-out forwards;
    transition: all 0.3s ease;
    background: white;
    border-radius: 0.75rem;
    padding: 0.75rem;
    text-align: center;
    border: 1px solid #e2e8f0;
}
.feature-card:hover {
    transform: translateY(-3px);
    background: linear-gradient(135deg, white, #fefce8);
}

.categories-dropdown {
    position: relative;
    display: inline-block;
}
.categories-btn {
    background: white;
    border: 2px solid #e2e8f0;
    padding: 0.5rem 1.2rem;
    border-radius: 100px;
    font-weight: 700;
    color: #16a34a;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}
.categories-btn:hover {
    background: #f0fdf4;
    border-color: #16a34a;
    transform: translateY(-2px);
}
.categories-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 20px 35px -10px rgba(0,0,0,0.1);
    min-width: 200px;
    z-index: 100;
    margin-top: 0.5rem;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    display: none;
    animation: fadeInUp 0.2s ease-out;
}
.categories-dropdown-menu.show { display: block; }
.category-item {
    padding: 0.75rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
}
.category-item:hover {
    background: #f0fdf4;
    color: #16a34a;
    font-weight: 600;
    padding-right: 1.5rem;
}

.gram-counter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border-radius: 0.75rem;
    padding: 0.25rem;
    border: 1px solid #e2e8f0;
    margin-bottom: 0.5rem;
}
.gram-btn {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}
.gram-btn.minus { background: #fee2e2; color: #ef4444; }
.gram-btn.minus:hover { background: #fecaca; transform: scale(1.05); }
.gram-btn.plus { background: #dcfce7; color: #22c55e; }
.gram-btn.plus:hover { background: #bbf7d0; transform: scale(1.05); }
.gram-value { font-weight: bold; font-size: 0.9rem; min-width: 3rem; text-align: center; }

.admin-action-btn {
    transition: all 0.2s ease;
}
.admin-action-btn:hover {
    transform: scale(1.1);
    filter: brightness(0.9);
}

.whatsapp-btn { 
    background: linear-gradient(135deg, #25d366, #128c7e); 
    transition: all 0.3s ease; 
    animation: whatsappPulse 2s infinite !important; 
}
.whatsapp-btn:hover { transform: scale(1.02); }
#scrollToTop { transition: all 0.3s ease; z-index: 1000; }
#scrollToTop:hover { transform: scale(1.1); background-color: #15803d; }

@keyframes whatsappPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

.main-title {
    animation: scaleIn 0.8s ease-out, lightPulse 4s ease-in-out infinite;
    text-shadow: 2px 2px 12px rgba(255,255,200,0.9), 0 0 25px rgba(255,255,200,0.8);
    color: #166534;
    font-weight: 900;
}

@keyframes lightPulse {
    0%, 100% { filter: brightness(1); text-shadow: 2px 2px 12px rgba(255,255,200,0.9), 0 0 25px rgba(255,255,200,0.8); }
    50% { filter: brightness(1.15); text-shadow: 2px 2px 15px rgba(255,255,255,0.8), 0 0 35px rgba(74,222,128,0.5); }
}
.header-subtitle {
    text-shadow: 1px 1px 10px rgba(255,255,220,0.9);
    font-weight: 800;
    color: #1e4620;
    background: rgba(255,255,240,0.2);
    display: inline-block;
    padding: 0 1rem;
    border-radius: 2rem;
}

.filter-price-btn.active { background: #16a34a !important; color: white !important; }

/* النوافذ المنبثقة */
.wishlist-modal, .tracking-modal, .product-details-modal, .cart-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
}
.wishlist-content, .tracking-content, .product-details-content, .cart-content {
    background: white;
    width: 90%;
    max-width: 800px;
    border-radius: 1.5rem;
    padding: 1.5rem;
    max-height: 80vh;
    overflow-y: auto;
    margin: 2rem auto;
    animation: scaleIn 0.3s ease-out;
}

@media (max-width: 640px) {
    .product-card { padding: 0.6rem; width: 170px; }
    .img-box { height: 100px; }
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.8rem;
    }
    .category-card {
        padding: 0.75rem;
    }
    .category-card .img-box {
        height: 90px;
    }
    .category-card .cat-name {
        font-size: 0.85rem;
    }
    .cat-icon { font-size: 2rem; }
    .carousel-btn { width: 28px; height: 28px; }
}

@media (max-width: 480px) {
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
        gap: 0.6rem;
    }
    .category-card .img-box {
        height: 75px;
    }
    .category-card {
        padding: 0.6rem;
        border-radius: 1rem;
    }
}

/* الوضع الليلي */
.dark-mode { background-color: #121212; }
.dark-mode .bg-white, .dark-mode .product-card, .dark-mode nav, .dark-mode footer, .dark-mode .feature-card, .dark-mode .category-card {
    background: #1e1e1e !important; border-color: #333 !important;
}
.dark-mode .text-slate-800, .dark-mode .text-slate-900, .dark-mode .main-title { color: #ffffff !important; text-shadow: 0 0 8px rgba(0,0,0,0.5); }
.dark-mode .text-slate-600, .dark-mode .text-slate-500 { color: #b0b0b0 !important; }
.dark-mode .img-box, .dark-mode .gram-counter { background: #2d2d2d; border-color: #444; }
.dark-mode .categories-btn { background: #2d2d2d; color: #22c55e; border-color: #444; }
.dark-mode .categories-dropdown-menu { background: #2d2d2d; border-color: #444; }
.dark-mode .heart-btn {
    background: #3d2a2e;
    color: #fda4af;
    border-color: #7f1a2c;
}
.dark-mode .dark-toggle {
    background: #334155;
    color: #facc15;
}
.dark-mode .dark-toggle:hover {
    background: #475569;
}

/* أنيميشن خاص باسم المطور */
.animated-dev-name {
    display: inline-block;
    background: linear-gradient(135deg, #15803d, #22c55e, #4ade80);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gradientShift 3s ease infinite, gentlePulse 2s ease-in-out infinite;
    font-weight: 900;
    letter-spacing: 0.5px;
    text-shadow: 0 0 8px rgba(34,197,94,0.3);
}
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes gentlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}
.animated-dev-name:hover {
    animation: gradientShift 1s ease infinite, gentlePulse 0.5s ease-in-out;
    cursor: default;
}