body {
    font-family: 'Cairo', sans-serif;
    scroll-behavior: smooth;
    overflow-x: hidden;
    width: 100%;
    position: relative;
    max-width: 100vw;
}

/* Dark Mode Transitions */
body,
div,
nav,
a,
button,
section,
header,
footer {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.dark body {
    background-color: #0f172a;
    color: #f1f5f9;
}

/* Mega Menu Logic */
.mega-menu {
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    max-width: 95vw;
    right: 50% !important;
    transform: translateX(50%) translateY(10px);
}

.group:hover .mega-menu {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(50%) translateY(0);
}

.menu-col h4 {
    color: #1e293b;
    font-weight: 900;
    border-right: 4px solid #eab308;
    padding-right: 12px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    font-style: italic;
}

.dark .menu-col h4 {
    color: #f1f5f9;
}

.menu-col ul li a {
    display: block;
    padding: 4px 0;
    font-size: 0.75rem;
    color: #64748b;
    transition: all 0.2s;
    font-weight: 700;
}

.dark .menu-col ul li a {
    color: #94a3b8;
}

.menu-col ul li a:hover {
    color: #eab308;
    transform: translateX(-5px);
}

/* حركة لا نهائية سلسة للشركاء والأقسام المتخصصة - RTL */
@keyframes scroll-infinite-rtl {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(calc(100% / 3));
    }
}

/* حركة لا نهائية سلسة للشركاء والأقسام المتخصصة - LTR */
@keyframes scroll-infinite-ltr {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(calc(-100% / 3));
    }
}

.animate-scroll-infinite {
    display: flex;
    width: max-content;
    animation: scroll-infinite-rtl 30s linear infinite;
}

/* LTR specific animation */
[dir="ltr"] .animate-scroll-infinite {
    animation: scroll-infinite-ltr 30s linear infinite;
}

.animate-scroll-infinite:hover {
    animation-play-state: paused;
}

/* تحسين شارة الخصم الإبداعية */
.discount-badge {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
    transform: rotate(-5deg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-weight: 900;
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

.animate-marquee {
    display: flex;
    white-space: nowrap;
    animation: marquee 120s linear infinite;
    width: max-content;
}

/* Pause animation when the parent group is hovered */
.group:hover .animate-marquee,
.animate-marquee:hover {
    animation-play-state: paused;
}

/* Layout & Components */
h1 {
    font-weight: 900;
    font-size: clamp(1.75rem, 8vw, 4rem);
    line-height: 1.1;
}

h2 {
    font-weight: 800;
    font-size: clamp(1.5rem, 6vw, 2.5rem);
    line-height: 1.2;
}

p {
    color: #64748b;
}

.dark p {
    color: #94a3b8;
}

.product-card {
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    border-radius: 1.5rem;
    overflow: hidden;
    background: white;
    border: 1px solid #f1f5f9;
}

@media (min-width: 768px) {
    .product-card {
        border-radius: 2.5rem;
    }
}

.dark .product-card {
    background: #1e293b;
    border-color: #334155;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.1);
    border-color: #eab308;
}

@media (min-width: 768px) {
    .product-card:hover {
        transform: translateY(-12px);
        box-shadow: 0 30px 40px -10px rgba(0, 0, 0, 0.1);
    }
}

/* تنسيقات واجهة عرض الأقسام والمنتجات */
.category-strip {
    border-right: 5px solid #eab308;
    padding-right: 1.5rem;
    margin-bottom: 2rem;
}

.product-mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

@media (min-width: 640px) {
    .product-mini-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 1.5rem;
    }
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.dark ::-webkit-scrollbar-thumb {
    background: #475569;
}

.dark ::-webkit-scrollbar-track {
    background: #0f172a;
}

/* Dark Mode Global Overrides */
.dark input,
.dark select,
.dark textarea {
    background-color: #1e293b;
    /* Slightly lighter than body for depth */
    border-color: #475569;
    /* Visible slate border */
    color: #f1f5f9;
}

.dark .bg-white {
    background-color: #0f172a !important;
    /* أغمق بقليل لتوفير تباين أفضل مع العناصر العائمة */
}

.dark .bg-slate-50,
.dark .bg-slate-100 {
    background-color: #1e293b !important;
    /* جعل الطبقات الثانوية أفتح قليلاً من الخلفية الأساسية */
}

.dark .text-slate-900,
.dark .text-slate-800,
.dark h1,
.dark h2,
.dark h3,
.dark h4 {
    color: #f8fafc !important;
    /* لون أبيض مائل للزرقة مريح للعين */
}

.dark .text-slate-600,
.dark .text-slate-500,
.dark .text-slate-400 {
    color: #94a3b8 !important;
    /* لون رمادي فاتح للنصوص الثانوية */
}

.dark .border-slate-50,
.dark .border-slate-100,
.dark .border-slate-200 {
    border-color: #1e293b !important;
}

/* تحسين شكل البطاقات في الوضع الداكن */
.dark .product-card,
.dark .bg-white.rounded-2xl,
.dark .bg-white.rounded-3xl {
    background-color: #1e293b;
    border-color: #334155;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

/* تحسين القوائم المنسدلة */
.dark .mega-menu,
.dark .group-hover\:visible {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

.dark .hover\:bg-yellow-50:hover {
    background-color: #334155 !important;
}

/* تنسيق عام ومريح للعين */
.dark body {
    background-color: #0f172a;
    color: #cbd5e1;
}

/* ===== Contact Page Light Mode Text Fix ===== */
/* إصلاح لون الخط في صفحة تواصل معنا - الوضع الفاتح فقط */
#contact-view h2,
#contact-view h3,
#contact-view h4,
#contact-view label {
    color: #0f172a;
}

.dark #contact-view h2,
.dark #contact-view h3,
.dark #contact-view h4,
.dark #contact-view label {
    color: #f8fafc;
}

/* ===== Mobile-Only Product Card Fix ===== */
/* إصلاح اسم المنتج والسعر على الموبايل فقط */
@media (max-width: 767px) {

    /* إظهار اسم المنتج كاملاً بدون قص */
    .product-card h4 {
        -webkit-line-clamp: unset !important;
        line-clamp: unset !important;
        display: block !important;
        overflow: visible !important;
        text-overflow: unset !important;
        -webkit-box-orient: unset !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        white-space: normal !important;
        word-break: break-word !important;
        overflow-wrap: break-word !important;
    }

    /* إظهار السعر كاملاً بدون قص */
    .product-card .font-black[class*="text-indigo"],
    .product-card .font-black[class*="text-yellow"] {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: unset !important;
        word-break: keep-all !important;
    }

    /* ضمان أن حاوية السعر تتسع للمحتوى */
    .product-card .flex-col.px-2 {
        min-width: 0;
        overflow: visible !important;
    }

    /* السعر المشطوب وشارة الخصم */
    .product-card .line-through,
    .product-card .bg-red-100,
    .product-card .dark\:bg-red-900\/40 {
        white-space: normal !important;
        overflow: visible !important;
    }
}

/* No Scrollbar Utility */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}