/* =========================================
   1. المتغيرات والأساسيات (Variables & Reset)
   ========================================= */
:root {
  --bg-color: #f8fafc;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --primary: #1e293b;       /* أزرق غامق */
  --accent: #d97706;        /* ذهبي/برتقالي */
  --accent-light: #fffbeb;
  --success: #22c55e;
  --danger: #ef4444;
  --line: #e2e8f0;
  --font-ar: 'Tajawal', sans-serif;
  --font-en: 'Poppins', sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background-color: var(--bg-color);
  color: var(--text-main);
  overflow-x: hidden;
  /* الخط الافتراضي */
  font-family: var(--font-ar); 
}

/* تغيير الخط حسب اللغة */
html[lang="en"] body { font-family: var(--font-en); }
html[lang="ar"] body { font-family: var(--font-ar); }

a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; padding: 0; margin: 0; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* =========================================
   2. الهيدر (Header)
   ========================================= */
.header {
  background: white;
  padding: 12px 0;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header__row { display: flex; justify-content: space-between; align-items: center; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand__logo-img { height: 45px; }
.brand__name { font-size: 22px; font-weight: 900; color: var(--primary); letter-spacing: -0.5px; }

.nav { display: flex; gap: 25px; }
.nav a { color: var(--text-muted); font-weight: 700; font-size: 15px; position: relative; }
.nav a:hover, .nav a.active-link { color: var(--accent); }

.header__actions { display: flex; align-items: center; gap: 15px; }

.lang-switch {
  display: flex; align-items: center; gap: 6px;
  font-weight: 700; color: var(--primary); font-size: 14px;
  padding: 6px 12px; border-radius: 20px;
}
.lang-switch:hover { background: #f1f5f9; }

.btn--primary {
  background: var(--primary); color: white;
  padding: 10px 24px; border-radius: 50px; font-weight: 700; font-size: 14px;
  box-shadow: 0 4px 10px rgba(30,41,59,0.2);
}
.btn--primary:hover { background: var(--accent); transform: translateY(-2px); }

.burger { display: none; background: none; border: none; font-size: 28px; color: var(--primary); }

/* =========================================
   3. القائمة الجانبية (Mobile Drawer - Fixed)
   ========================================= */
.drawer { 
    position: fixed; inset: 0; z-index: 10000; 
    visibility: hidden; transition: 0.3s; 
}
.drawer.active { visibility: visible; }

.drawer__backdrop {
  position: absolute; inset: 0; 
  background: rgba(0,0,0,0.6); /* لون الخلفية السوداء */
  opacity: 0; transition: 0.3s; backdrop-filter: blur(3px);
  z-index: 1; /* 🔥 التعديل: جعل الخلفية في الطبقة الخلفية */
}
.drawer.active .drawer__backdrop { opacity: 1; }

.drawer__panel {
  position: absolute; top: 0; bottom: 0; width: 280px;
  background: white; padding: 25px;
  box-shadow: 0 0 30px rgba(0,0,0,0.2);
  transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex; flex-direction: column;
  z-index: 2; /* 🔥 التعديل: جعل القائمة فوق الخلفية السوداء */
}

/* اتجاه الحركة حسب اللغة */
html[dir="rtl"] .drawer__panel { right: 0; transform: translateX(100%); }
html[dir="ltr"] .drawer__panel { left: 0; transform: translateX(-100%); }

.drawer.active .drawer__panel { transform: translateX(0); }

.drawer__header { 
    display: flex; justify-content: space-between; align-items: center; 
    margin-bottom: 20px; padding-bottom: 10px; border-bottom: 1px solid var(--line); 
}
.drawer__title { font-weight: 900; font-size: 20px; color: var(--primary); }

.drawer__links { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.drawer__links a {
  color: #334155; font-weight: 600; font-size: 16px;
  padding: 12px; border-radius: 10px;
}
.drawer__links a:hover, .drawer__links a.active-drawer { background: var(--accent-light); color: var(--accent); }
.iconBtn { background: none; border: none; font-size: 24px; color: var(--text-muted); cursor: pointer; }

/* =========================================
   4. الهيرو (Hero Section)
   ========================================= */
.hero-pro {
  position: relative; min-height: 90vh;
  background-color: var(--bg-color);
  background-image: radial-gradient(#e2e8f0 1px, transparent 1px);
  background-size: 30px 30px;
  display: flex; align-items: center;
  padding: 80px 0 60px; overflow: visible;
}

/* 🔄 دعم اتجاه النص في الهيرو */
.hero-pro__grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 50px; align-items: center; }
.hero-pro__content { z-index: 1; animation: fadeInUp 1s ease-out; }
html[dir="rtl"] .hero-pro__content { text-align: right; }
html[dir="ltr"] .hero-pro__content { text-align: left; }

.hero-pro__badge {
  display: inline-block; background: var(--accent-light); color: var(--accent);
  font-size: 14px; font-weight: 800; padding: 8px 16px; border-radius: 30px;
  margin-bottom: 20px; border: 1px solid #fcd34d;
}

.hero-pro__title { font-size: 3.5rem; font-weight: 900; line-height: 1.1; color: var(--text-main); margin-bottom: 20px; }
.text-highlight-gold { position: relative; color: var(--accent); z-index: 1; }
.text-highlight-gold::after {
  content: ''; position: absolute; bottom: 5px; width: 100%; height: 15px;
  background: #fcd34d; opacity: 0.4; z-index: -1; transform: skewX(-10deg);
}
html[dir="rtl"] .text-highlight-gold::after { right: 0; }
html[dir="ltr"] .text-highlight-gold::after { left: 0; }

.hero-pro__desc { font-size: 1.2rem; color: var(--text-muted); line-height: 1.7; margin-bottom: 30px; max-width: 600px; }

.hero-pro__features-list { display: flex; gap: 20px; padding-top: 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.h-pro-feat { display: flex; align-items: center; gap: 8px; font-weight: 700; color: #334155; font-size: 14px; }
.h-pro-feat i { color: var(--accent); background: var(--accent-light); padding: 6px; border-radius: 50%; }

/* Form Styles */
.hero-form-wrapper { position: relative; z-index: 10; animation: fadeInSide 1s ease-out 0.3s backwards; }
.hero-form-wrapper::before {
  content: ''; position: absolute; top: 20px; width: 100%; height: 100%;
  border: 3px solid #fbbf24; border-radius: 20px; z-index: -1;
}
html[dir="rtl"] .hero-form-wrapper::before { left: -20px; }
html[dir="ltr"] .hero-form-wrapper::before { right: -20px; }

.hero-form-container { background: white; padding: 30px; border-radius: 20px; box-shadow: 0 15px 35px rgba(0,0,0,0.1); }
.hero-form h3 { text-align: center; color: var(--primary); margin-bottom: 20px; font-weight: 800; font-size: 22px; }

.form-group { margin-bottom: 12px; }
.form-input {
  width: 100%; padding: 12px; border: 2px solid var(--line); border-radius: 10px;
  outline: none; transition: 0.3s; font-family: inherit; font-size: 14px; background: white;
  box-sizing: border-box;
}
.form-input:focus { border-color: var(--accent); background: var(--accent-light); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.form-submit-btn {
  width: 100%; padding: 14px; background: var(--primary); color: white;
  border: none; border-radius: 10px; font-weight: 800; font-size: 16px;
  cursor: pointer; transition: 0.3s; margin-top: 10px;
}
.form-submit-btn:hover { background: var(--accent); }

/* صفحات فرعية (Page Header) */
.page-header {
    background-size: cover; background-position: center;
    color: white; padding: 90px 0; text-align: center;
    border-bottom: 4px solid var(--accent); position: relative;
}
.page-title { font-size: 38px; font-weight: 900; margin: 0 0 10px; position: relative; z-index: 2; }
.page-desc { font-size: 16px; opacity: 0.9; max-width: 600px; margin: 0 auto; line-height: 1.6; position: relative; z-index: 2; }

/* =========================================
   5. شبكة الأقسام (Bento Grid - Fixed & Fluid)
   ========================================= */
.categories-section { padding: 60px 0; }

.cat-grid {
    display: grid;
    /* الكمبيوتر: 4 أعمدة وصفوف ثابتة */
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: 220px 220px; 
    gap: 20px; margin-top: 30px;
}

.cat-card {
    position: relative; border-radius: 24px; overflow: hidden;
    text-decoration: none; color: white; box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: 0.3s; width: 100%; height: 100%; display: block;
}
.cat-card--lg { grid-column: span 2; grid-row: span 2; }

.cat-card img {
    width: 100%; height: 100%; object-fit: cover; object-position: center top;
    transition: transform 0.6s ease;
}
.cat-card:hover { transform: translateY(-5px); }
.cat-card:hover img { transform: scale(1.1); }

.cat-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.2) 60%, rgba(0,0,0,0) 100%);
    display: flex; flex-direction: column; justify-content: flex-end; padding: 20px;
}
html[dir="rtl"] .cat-overlay { text-align: right; }
html[dir="ltr"] .cat-overlay { text-align: left; }

.cat-title { margin: 0; font-size: 18px; font-weight: 800; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.cat-card--lg .cat-title { font-size: 28px; }

/* 🔥 إصلاح الموبايل الجذري (Mobile Fix) 🔥 */
@media (max-width: 900px) {
    .cat-grid {
        grid-template-columns: 1fr 1fr; /* عمودين */
        grid-template-rows: unset;      /* إلغاء الارتفاع الثابت */
        grid-auto-rows: 160px;          /* ارتفاع موحد لأي صف جديد */
        gap: 12px; padding: 0 10px;
    }
    .cat-card--lg {
        grid-column: 1 / -1; /* يأخذ العرض كامل */
        grid-row: auto; 
        height: 220px !important; 
        margin-bottom: 5px;
    }
    .cat-card { height: 100% !important; }
    .cat-title { font-size: 14px; }
    .cat-card--lg .cat-title { font-size: 22px; }
}

/* =========================================
   6. كروت المنتجات (Product Cards)
   ========================================= */
.section { padding: 60px 0; }
.section--alt { background-color: #f1f5f9; }
.dflex-between { display: flex; justify-content: space-between; align-items: end; margin-bottom: 30px; }

.grid.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 30px; padding: 20px 0; }

.card {
  background: white; border-radius: 15px; overflow: hidden;
  border: 1px solid #f0f0f0; box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  transition: transform 0.3s ease; display: flex; flex-direction: column;
  opacity: 0; transform: translateY(20px);
}
.card.show { opacity: 1; transform: translateY(0); }
.card:hover { transform: translateY(-5px); box-shadow: 0 12px 25px rgba(0,0,0,0.15); }

.card__image-holder { position: relative; height: 200px; overflow: hidden; }
.card__img { width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.card:hover .card__img { transform: scale(1.05); }

.card__badge {
  position: absolute; top: 15px;
  background: #f59e0b; color: #000; padding: 5px 12px;
  border-radius: 20px; font-size: 11px; font-weight: 800; z-index: 2;
}
html[dir="rtl"] .card__badge { right: 15px; }
html[dir="ltr"] .card__badge { left: 15px; }

.card__badge.red { background: var(--danger); color: white; animation: pulse 2s infinite; }

.card__content { padding: 20px; display: flex; flex-direction: column; flex-grow: 1; }
.card__popular { font-size: 12px; color: #e11d48; font-weight: 800; margin-bottom: 8px; }
.card__title { font-size: 18px; font-weight: 800; margin: 0 0 8px; color: var(--primary); }
.card__desc { font-size: 13px; color: var(--text-muted); margin-bottom: 15px; line-height: 1.6; }

.card__footer {
  margin-top: auto; padding-top: 15px; border-top: 1px solid #f1f5f9;
  display: flex; justify-content: space-between; align-items: center;
}
.card__price span { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.card__price strong { font-size: 20px; color: #15803d; font-weight: 800; }

.btn-card {
  padding: 8px 20px; border: 2px solid #e2e8f0; border-radius: 8px;
  color: var(--primary); text-decoration: none; font-weight: 700; font-size: 14px; transition: 0.2s;
}
.btn-card:hover { background: var(--primary); color: white; border-color: var(--primary); }
.loading-text { text-align: center; width: 100%; padding: 20px; color: var(--text-muted); }

/* رسائل التسويق (Marketing Badges) */
.marketing-badge { position: absolute; bottom: 10px; background: rgba(0,0,0,0.7); color: white; padding: 4px 10px; border-radius: 15px; font-size: 10px; font-weight: bold; display: flex; align-items: center; gap: 5px; backdrop-filter: blur(2px); }
html[dir="rtl"] .marketing-badge { left: 10px; }
html[dir="ltr"] .marketing-badge { right: 10px; }
.live-dot { width: 6px; height: 6px; background: var(--success); border-radius: 50%; display: inline-block; animation: blink 1.5s infinite; }

/* =========================================
   7. الفوتر (Footer)
   ========================================= */
.footer { background: #0f172a; padding: 50px 0 20px; color: white; }
.footer__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 40px; margin-bottom: 40px; }
.footer__links a { display: block; color: #94a3b8; margin-bottom: 10px; transition: 0.2s; }
html[dir="rtl"] .footer__links a:hover { color: white; padding-right: 5px; }
html[dir="ltr"] .footer__links a:hover { color: white; padding-left: 5px; }
.footer__bottom { text-align: center; border-top: 1px solid #334155; padding-top: 20px; color: #64748b; font-size: 14px; }

/* =========================================
   8. أدوات مساعدة (Utilities)
   ========================================= */
/* واتساب */
.whatsapp-sticky {
  position: fixed; bottom: 25px; z-index: 9999;
  background-color: #25D366; color: white; width: 60px; height: 60px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3); transition: transform 0.3s;
  animation: pulse-green 2s infinite;
}
html[dir="rtl"] .whatsapp-sticky { left: 25px; }
html[dir="ltr"] .whatsapp-sticky { right: 25px; }
.whatsapp-sticky:hover { transform: scale(1.1); }
.whatsapp-sticky svg { width: 35px; height: 35px; fill: white; }

/* Reviews */
.reviews-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 30px; margin-top: 30px; }
.review-card { background: white; padding: 30px; border-radius: 15px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
.stars { color: #f59e0b; margin-bottom: 15px; letter-spacing: 2px; }
.reviewer { margin-top: 20px; border-top: 1px solid #f1f5f9; padding-top: 15px; display: flex; justify-content: space-between; }
.reviewer strong { color: var(--primary); display: block; }
.reviewer span { font-size: 12px; color: var(--text-muted); }

/* Animation Keyframes */
@keyframes fadeInUp { from { opacity:0; transform:translateY(30px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeInSide { from { opacity:0; transform:translateX(30px); } to { opacity:1; transform:translateX(0); } }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.7; } 100% { opacity: 1; } }
@keyframes pulse-green { 0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); } 70% { box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); } 100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); } }
@keyframes blink { 0% { opacity:1; } 50% { opacity:0.3; } 100% { opacity:1; } }

/* =========================================
   9. الموبايل (General Mobile)
   ========================================= */
@media (max-width: 992px) {
  .hero-pro__grid { grid-template-columns: 1fr; text-align: center; gap: 40px; }
  .hero-pro__content { order: 2; }
  .hero-form-wrapper { order: 1; max-width: 90%; margin: 0 auto; }
  .hero-pro__title { font-size: 2.5rem; }
  .hero-pro__features-list { justify-content: center; }
  
  .nav, .header__actions .btn--primary { display: none; }
  .burger { display: block; }
}

@media (max-width: 600px) {
    .grid.cards { grid-template-columns: 1fr; gap: 20px; }
    .card__image-holder { height: 180px; }
}