/* =================================================================== */
/*  KNCAR - THE ULTIMATE INTEGRATED DESIGN SYSTEM (Version 4.1 Final)  */
/*  Final Polish by Manus AI - Dec 2025 - Mobile First                 */
/*  Fixed: Image distortion, button visibility, spacing               */
/*  Added: Blue text below category images (no duplicate text)        */
/* =================================================================== */

/* ---------- 1. ROOT & GLOBAL -------------------------------------- */
:root {
    --primary-blue: #0099e5;
    --primary-dark: #1a1a2e;
    --primary-light: #26bfff;
    --primary-gradient: linear-gradient(135deg, #0099e5 0%, #1a1a2e 100%);
    --secondary: #16213e;
    --accent: #0f3460;
    --accent-light: #e94560;
    --white: #ffffff;
    --light-bg: #f8fafc;
    --gray-light: #e2e8f0;
    --gray: #94a3b8;
    --gray-dark: #475569;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.07);
    --shadow-md: 0 5px 15px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 20px 50px rgba(0, 153, 229, 0.2);
    --shadow-blue: 0 8px 25px rgba(0, 153, 229, 0.25);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --radius-full: 50px;
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    --font-arabic: 'Amiri', serif;
    --font-heading: var(--font-arabic);
    --font-body: var(--font-arabic);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    line-height: 1.7;
    color: var(--gray-dark);
    background-color: var(--light-bg);
    overflow-x: hidden;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: radial-gradient(circle at 10% 20%, rgba(0, 153, 229, 0.04) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(26, 26, 46, 0.04) 0%, transparent 40%);
    z-index: -1; pointer-events: none; will-change: transform;
}
.s-block { animation: fadeInUp 0.8s ease-out; }
@media (prefers-reduced-motion: reduce) { .s-block { animation: none; } }

/* ---------- 2. IMAGE GLOBAL --------------------------------------- */
img { max-width: 100%; height: auto; display: block; }

/* ---------- 3. PRODUCT CARD - FIXED IMAGE & BUTTON --------------- */
.s-product-card-entry {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: visible !important;
    position: relative;
    margin-bottom: 20px;
    padding-bottom: 70px !important;
    transition: var(--transition-normal);
    border: 2px solid transparent;
}
.s-product-card-image {
    width: 100%;
    aspect-ratio: 1 / 1 !important;
    height: auto !important;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-bg);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.s-product-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover !important;
    object-position: center;
    padding: 6px;
    transition: transform var(--transition-normal);
}
.s-product-card-entry:hover .s-product-card-image img { transform: scale(1.05); }

.s-product-card-content { padding: 12px !important; text-align: center; }
.s-product-card-content-title {
    min-height: 45px !important;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 8px !important;
}
.s-product-card-content-title a {
    font-size: 0.85rem !important; font-weight: 700; color: var(--primary-dark);
    line-height: 1.3 !important;
    display: -webkit-box !important; -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important; overflow: hidden !important;
    text-overflow: ellipsis !important; text-decoration: none;
}
.s-product-card-content-subtitle {
    font-size: 0.8rem !important; color: var(--gray-dark);
    margin-bottom: 12px !important; min-height: 20px !important;
}
.s-product-card-sale-price {
    display: flex !important; align-items: center !important; justify-content: center !important;
    gap: 8px !important; margin-bottom: 50px !important; flex-wrap: wrap !important;
}
.s-product-card-sale-price h4 { font-size: 1.2rem !important; font-weight: 800 !important; color: var(--accent-light); margin: 0 !important; }
.s-product-card-sale-price span { font-size: 0.85rem !important; color: var(--gray); text-decoration: line-through; margin: 0 !important; }

.s-product-card-content-footer {
    position: absolute !important; bottom: 10px !important; left: 50% !important;
    transform: translateX(-50%) !important; width: 90% !important; z-index: 10 !important;
    margin: 0 !important; padding: 0 !important;
}
.s-product-card-content-footer .s-button-element {
    display: block !important; width: 100% !important; padding: 8px 10px !important;
    font-size: 0.8rem !important; font-weight: 700; border-radius: var(--radius-full) !important;
    background: var(--primary-blue) !important; color: var(--white) !important;
    border: 2px solid var(--primary-blue) !important; cursor: pointer; min-height: 36px !important;
    line-height: 1.2 !important; transition: all var(--transition-normal);
}
.s-product-card-content-footer .s-button-element:hover {
    background: var(--primary-dark) !important; border-color: var(--primary-dark) !important; transform: scale(1.02);
}
.s-product-card-content-footer .s-button-element:focus { outline: 2px solid var(--primary-dark); outline-offset: 2px; }

/* ---------- 4. GRID & SWIPER LAYOUT FIXES ------------------------- */
.s-products-grid {
    display: grid !important; gap: 15px !important; padding: 0 10px !important;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
}
@media (max-width: 480px) {
    .s-products-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; padding: 0 8px !important; }
}
.swiper-slide .s-product-card-entry { margin: 0 5px !important; }

/* ---------- 5. HERO SLIDER - IMAGE FIT ---------------------------- */
.s-block--hero-slider .overlay-bg {
    background-size: cover !important; background-position: center center !important;
    width: 100%; height: 100%; object-fit: cover;
}
.s-block--hero-slider .swiper-slide { min-height: 350px; max-height: 400px; }
/* -----------------------------------------------------------
  6. CATEGORY CARDS – صورة واضحة ونظيفة
----------------------------------------------------------- */

.slide--cat-entry {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 20px 15px;
    border-radius: var(--radius-lg);
    overflow: visible !important;
    background: #f8fafc !important; /* خلفية ثابتة بدون تدرج */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    z-index: 1;
    min-height: 280px;
    box-sizing: border-box;
}

/* إزالة الخلفيات المتدرجة والمؤثرات الزجاجية */
.slide--cat-entry::before,
.slide--cat-entry::after {
    content: none !important;
}

/* حاوية بسيطة للصورة */
.cat-image-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    margin-bottom: 15px;
    flex: 0 0 auto;
}

/* الصورة - واضحة ونظيفة بدون تأثيرات */
.slide--cat-entry img {
    width: 150px !important;
    height: 150px !important;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    object-fit: cover !important;
    object-position: center;
    transform: none !important;
    margin: 0 auto;
    display: block;
    opacity: 1 !important;
    visibility: visible !important;
    position: static !important;
    background: white; /* خلفية بيضاء للصورة */
    
    /* إزالة أي فلتر أو تأثيرات على الصورة */
    filter: none !important;
    -webkit-filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* إزالة أي تأثير هوفر معقد على الصورة */
.slide--cat-entry:hover img {
    transform: scale(1.02) !important;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

/* حاوية النص */
.cat-content {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    z-index: 3;
    margin-top: 0;
    flex: 0 0 auto;
}

/* النص - تصميم بسيط وواضح */
.slide--cat-entry h2 {
    background: white;
    padding: 12px 16px;
    margin: 0;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-blue) !important;
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 200px;
    transition: all 0.3s ease;
    overflow: visible !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    
    /* إزالة تأثيرات الزجاج */
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.slide--cat-entry h2::after {
    content: attr(data-year);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--primary-blue) !important;
    opacity: 0.9;
    padding-top: 4px;
    margin-top: 2px;
    border-top: 1px solid rgba(0, 153, 229, 0.15);
    width: 100%;
    max-width: 100px;
}

/* هوفر بسيط للنص */
.slide--cat-entry:hover h2 {
    background: #f8fafc;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
}

/* =========================== */
/* إصلاحات الهاتف - وضوح كامل */
/* =========================== */

/* هواتف صغيرة (أقل من 480px) */
@media (max-width: 480px) {
    .slide--cat-entry {
        padding: 15px 10px;
        min-height: 250px;
        background: #f8fafc !important; /* خلفية ثابتة */
    }
    
    .cat-image-wrapper {
        margin-bottom: 12px;
    }
    
    .slide--cat-entry img {
        width: 120px !important;
        height: 120px !important;
        border-width: 3px;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
    }
    
    .slide--cat-entry h2 {
        padding: 10px 12px;
        font-size: 0.85rem;
        max-width: 180px;
    }
    
    .slide--cat-entry h2::after {
        font-size: 0.75rem;
    }
}

/* هواتف متوسطة (481px - 600px) */
@media (min-width: 481px) and (max-width: 600px) {
    .slide--cat-entry {
        padding: 18px 15px;
        min-height: 270px;
    }
    
    .slide--cat-entry img {
        width: 130px !important;
        height: 130px !important;
    }
    
    .slide--cat-entry h2 {
        padding: 12px 15px;
        font-size: 0.9rem;
        max-width: 190px;
    }
}

/* أجهزة لوحية صغيرة (601px - 768px) */
@media (min-width: 601px) and (max-width: 768px) {
    .slide--cat-entry {
        padding: 20px 18px;
        min-height: 290px;
    }
    
    .slide--cat-entry img {
        width: 140px !important;
        height: 140px !important;
    }
    
    .slide--cat-entry h2 {
        padding: 14px 18px;
        font-size: 0.95rem;
        max-width: 210px;
    }
}

/* أجهزة أكبر (769px فما فوق) */
@media (min-width: 769px) {
    .slide--cat-entry {
        padding: 25px 20px;
        min-height: 320px;
    }
    
    .slide--cat-entry img {
        width: 160px !important;
        height: 160px !important;
        border-width: 4px;
    }
    
    .slide--cat-entry h2 {
        padding: 16px 20px;
        font-size: 1rem;
        max-width: 230px;
    }
}

/* =========================== */
/* إصلاحات إضافية للوضوح */
/* =========================== */

/* إزالة أي تأثيرات على جميع العناصر */
.slide--cat-entry * {
    transform: translateY(0) !important;
    filter: none !important;
    -webkit-filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* إزالة أي تدرجات لونية */
.slide--cat-entry {
    background-image: none !important;
    background: #f8fafc !important;
}

/* إزالة أي نص فوق الصورة */
.slide--cat-entry::before,
.slide--cat-entry::after {
    display: none !important;
}

/* إذا كان هناك أي parent elements تضيف تأثيرات */
.slide--cat-entry,
.cat-image-wrapper,
.slide--cat-entry img {
    -webkit-backface-visibility: visible !important;
    backface-visibility: visible !important;
    -webkit-transform-style: flat !important;
    transform-style: flat !important;
    perspective: none !important;
}

/* إصلاحات نهائية للوضوح */
.slide--cat-entry img {
    /* إزالة أي تأثيرات إضافية */
    mix-blend-mode: normal !important;
    isolation: auto !important;
    
    /* تحسين الجودة */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* إزالة أي ظلال داخلية أو خارجية معقدة */
.slide--cat-entry {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

.slide--cat-entry img {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1) !important;
}

/* التأكد من أن الصورة تظهر بوضوح */
.slide--cat-entry img {
    -webkit-mask-image: none !important;
    mask-image: none !important;
    clip-path: none !important;
}

/* ---------- 8. WHATSAPP FLOAT ------------------------------------ */
.kncar-whatsapp-float {
    position: fixed; width: 55px; height: 55px; bottom: 20px; right: 15px;
    background-color: #25D366; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; z-index: 9999;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3); transition: all 0.3s ease;
}
.kncar-whatsapp-float svg { width: 28px; height: 28px; fill: white; }

/* ---------- 9. ANIMATIONS & PRINT -------------------------------- */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@media print { .kncar-whatsapp-float { display: none !important; } }

/* ---------- 10. ACCESSIBILITY ------------------------------------- */
.s-product-card-content-footer .s-button-element:focus { outline: 2px solid var(--primary-dark); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* ---------- 11. HEADER & NAV (ORIGINAL) --------------------------- */
.store-header {
    background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm); position: sticky; top: 0; z-index: 1000;
}
.top-navbar { background: var(--primary-gradient); padding: 8px 0; }
.header-btn { width: 40px; height: 40px; border-radius: var(--radius-full); background: var(--white); border: 1px solid var(--gray-light); transition: var(--transition-normal); }
.header-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-blue); border-color: var(--primary-blue); }

/* ---------- 12. SECTION TITLES (ORIGINAL) ------------------------- */
.s-slider-block__title {
    background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 153, 229, 0.15); border-radius: 20px;
    margin-bottom: 25px; padding: 20px 30px !important;
    display: flex; align-items: center; justify-content: space-between;
    box-shadow: 0 10px 30px rgba(0, 153, 229, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.8);
}
.s-slider-block__title-right h2 {
    font-family: var(--font-heading); font-size: 2rem; font-weight: 800; color: var(--primary-dark);
    background: linear-gradient(45deg, var(--primary-blue) 0%, var(--primary-dark) 50%, var(--primary-blue) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.s-slider-block__display-all {
    background: var(--white); color: var(--primary-blue); font-weight: bold;
    padding: 8px 20px; border-radius: var(--radius-full); text-decoration: none; transition: all var(--transition-normal);
}
.s-slider-block__display-all:hover { background: var(--primary-dark); color: var(--white); transform: translateY(-2px) scale(1.05); box-shadow: var(--shadow-md); }

/* ---------- 13. BANNERS (ORIGINAL DESKTOP + MOBILE) --------------- */
@media (min-width: 769px) {
    a.banner-entry {
        display: flex !important; align-items: center !important; justify-content: space-between !important;
        height: 220px !important; position: relative !important; margin: 15px 0 !important;
        border-radius: var(--radius-lg) !important; background-color: var(--white) !important;
        box-shadow: var(--shadow-md) !important; transition: var(--transition-normal) !important; overflow: hidden !important;
    }
    a.banner-entry:hover { transform: translateY(-6px) !important; box-shadow: var(--shadow-lg) !important; }
    a.banner-entry .lazy__bg { width: 45% !important; max-width: 500px !important; position: absolute !important; right: 0 !important; top: 50% !important; transform: translateY(-50%) !important; }
    a.banner-entry h3.text-with-border { width: 55% !important; height: 100% !important; display: flex !important; align-items: center !important; justify-content: center !important; padding: 25px 35px !important; }
    a.banner-entry h3.text-with-border span { font-size: 2rem !important; font-weight: 900 !important; color: var(--accent-light) !important; line-height: 1.2 !important; }
}
@media (max-width: 768px) {
    a.banner-entry { display: block !important; position: relative !important; height: 180px !important; border-radius: var(--radius-lg) !important; overflow: hidden !important; box-shadow: var(--shadow-md) !important; margin: 10px 0 !important; }
    a.banner-entry .lazy__bg { width: 100% !important; height: 100% !important; background-size: cover !important; background-position: center !important; position: static !important; }
    a.banner-entry h3.text-with-border { width: auto !important; height: auto !important; position: absolute !important; bottom: 12px !important; right: 12px !important; background: rgba(0, 0, 0, 0.25) !important; backdrop-filter: blur(15px) !important; border: 1px solid rgba(255, 255, 255, 0.2) !important; border-radius: var(--radius-md) !important; padding: 8px 16px !important; }
    a.banner-entry h3.text-with-border span { font-size: 1rem !important; font-weight: 700 !important; color: var(--white) !important; text-shadow: 0 1px 3px rgba(0,0,0,0.3); line-height: 1.2 !important; }
}

/* ---------- 14. FOOTER (ORIGINAL) --------------------------------- */
.store-footer {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #1a1a2e 100%);
    color: var(--white); position: relative; overflow: hidden;
    padding-top: 40px; margin-top: 40px; border-top: 4px solid var(--primary-blue);
}

/* ---------- 15. RTL SUPPORT --------------------------------------- */
[dir="rtl"] .s-product-card-content-footer { left: 50% !important; right: auto !important; transform: translateX(-50%) !important; }
[dir="rtl"] .slide--cat-entry img { left: 50% !important; right: auto !important; transform: translate(-50%, -50%) !important; }

/* ---------- 16. HIGH DPI & TOUCH ---------------------------------- */
@media (max-width: 768px) and (-webkit-min-device-pixel-ratio: 2) {
    .home-slider__content h2 { font-weight: 700 !important; }
    .overlay-bg { image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges; }
}
@media (hover: none) and (pointer: coarse) {
    .kncar-whatsapp-float:hover { transform: none; }
    .kncar-whatsapp-float:active { transform: scale(0.9); }
    .slide--cat-entry:hover img { transform: translate(-50%, -50%) !important; }
    a.banner-entry:hover .lazy__bg { transform: none !important; }
    .s-product-card-entry:hover .s-product-card-image img { transform: none !important; }
    .s-product-card-entry:active { transform: scale(0.98); }
    .s-product-card-content-footer .s-button-element:active { transform: scale(0.95); }
}
/* -----------------------------------------------------------
  الحركة الزجاجية – تتحرك كل 5 ثواني + شكل جميل
----------------------------------------------------------- */

/* الشعاع الزجاجي */
a.banner-entry::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.4) 45%,
        rgba(255, 255, 255, 0.8) 50%,
        rgba(255, 255, 255, 0.4) 55%,
        transparent 100%
    );
    border-right: 1px solid rgba(255, 255, 255, 0.6);
    filter: blur(4px);
    transform: skewX(-25deg);
    z-index: 11;
    pointer-events: none;
    animation: glassy-shine 5s infinite linear;   // كل 5 ثواني
}

/* الحركة – تمرّر الشعاع من اليسار إلى اليمين */
@keyframes glassy-shine {
    0%   { left: -60%; }
    100% { left: 160%; }
}

/* هوفر – تسريع الحركة عند المرور (اختياري) */
a.banner-entry:hover::after {
    animation-duration: 1.5s;   // أسرع عند المرور
    filter: blur(3px) brightness(1.3);