/* ============================================================
   رادار - الواجهة الأمامية العامة
   المتغيرات اللونية والخط تُحقن ديناميكياً من لوحة التحكم عبر <style> مضمّن
   متجاوب بالكامل: جوال / تابلت / آيباد / لابتوب / شاشات تلفزيون كبيرة
   ============================================================ */

/* ---------- إعادة ضبط أساسية لثبات العرض عبر كل المتصفحات ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
img, picture, video { max-width: 100%; height: auto; display: block; }
input, textarea, select, button { font: inherit; -webkit-appearance: none; appearance: none; }
button { cursor: pointer; }
a { -webkit-tap-highlight-color: transparent; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-family, 'Cairo'), 'IBM Plex Sans Arabic', sans-serif;
  background: #F7F8FC;
  color: #1F2140;
  direction: rtl;
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
ul { margin: 0; padding: 0; list-style: none; }

/* حاوية مرنة تتمدد بسلاسة من الجوال حتى شاشات التلفزيون الكبيرة (٤K) */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; width: 100%; }

/* ---------- Site Header ---------- */
.site-header {
  background: #fff; border-bottom: 1px solid #EDEEF6;
  position: sticky; top: 0; z-index: 100;
}
.site-header-static { position: static; }
.site-header-compact .header-inner { padding: 8px 20px; }
.site-header-compact .site-logo img { height: 28px; }
.site-header .header-inner { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; max-width: 1200px; margin: 0 auto; }
.site-logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: var(--primary-color); }
.site-logo img { height: 38px; }
.site-logo .mark { width: 38px; height: 38px; background: var(--secondary-color); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; }
.main-nav { display: flex; gap: 6px; align-items: center; }
.main-nav a { padding: 9px 16px; border-radius: 8px; font-weight: 600; font-size: 14.5px; color: #444; transition: background .15s; }
.main-nav a:hover { background: #F4F5FA; color: var(--primary-color); }
.header-actions { display: flex; gap: 10px; align-items: center; }
.header-actions .btn-login { padding: 9px 18px; border-radius: 8px; font-weight: 700; font-size: 14px; border: 1.5px solid #E5E7F0; }
.header-actions .btn-register { padding: 9px 18px; border-radius: 8px; font-weight: 700; font-size: 14px; background: var(--primary-color); color: #fff; }
.mobile-nav-toggle { display: none; background: none; border: none; font-size: 22px; color: var(--primary-color); cursor: pointer; padding: 6px; }

/* ---------- FAQ ---------- */
.faq-item { border-block-end: 1px solid #EDEEF6; padding-block: 16px; }
.faq-item summary { cursor: pointer; font-weight: 700; font-size: 15px; }
.faq-item p { margin-block-start: 10px; color: #6B6E86; font-size: 14px; }

/* ---------- معرض الصور + Lightbox ---------- */
.site-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.site-gallery-item { display: block; border-radius: 12px; overflow: hidden; aspect-ratio: 1/1; }
.site-gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.site-gallery-item:hover img { transform: scale(1.05); }
.lightbox-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 500; display: none; align-items: center; justify-content: center; }
.lightbox-overlay.open { display: flex; }
.lightbox-overlay img { max-width: 90vw; max-height: 85vh; border-radius: 8px; }
.lightbox-close, .lightbox-prev, .lightbox-next { position: absolute; background: rgba(255,255,255,.15); color: #fff; border: none; border-radius: 50%; width: 46px; height: 46px; font-size: 20px; cursor: pointer; }
.lightbox-close { inset-block-start: 20px; inset-inline-end: 20px; }
.lightbox-prev { inset-inline-start: 20px; inset-block-start: 50%; transform: translateY(-50%); }
.lightbox-next { inset-inline-end: 20px; inset-block-start: 50%; transform: translateY(-50%); }

/* ---------- مبدّل اللغة ---------- */
.lang-switcher { position: relative; }
.lang-switcher-btn { background: none; border: 1.5px solid #E5E7F0; border-radius: 8px; padding: 8px 14px; font-size: 13.5px; font-weight: 700; cursor: pointer; font-family: inherit; color: inherit; }
.lang-switcher-menu { display: none; position: absolute; inset-block-start: 100%; inset-inline-end: 0; background: #fff; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 6px; min-width: 140px; z-index: 150; margin-block-start: 6px; }
.lang-switcher-menu.open { display: block; }
.lang-switcher-menu a { display: block; padding: 9px 12px; border-radius: 7px; font-size: 13.5px; }
.lang-switcher-menu a:hover { background: #F4F5FA; }
.lang-switcher-menu a.active { background: var(--secondary-color); color: #fff; font-weight: 700; }

/* ---------- Hero ---------- */
.hero-section { padding: 70px 20px; text-align: center; background: linear-gradient(180deg, #fff 0%, #F7F8FC 100%); }
.hero-section h1 { font-size: 38px; font-weight: 800; color: var(--primary-color); max-width: 780px; margin: 0 auto 18px; }
.hero-section p { font-size: 17px; color: #6B6E86; max-width: 600px; margin: 0 auto 30px; }
.btn-hero { display: inline-block; padding: 15px 36px; border-radius: 12px; background: var(--secondary-color); color: #fff; font-weight: 800; font-size: 16px; }

/* ---------- Slider ---------- */
.slider-section { padding: 10px 20px 40px; }
.slider-track { display: flex; gap: 18px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
.slide-card { flex: 0 0 320px; scroll-snap-align: start; border-radius: 16px; overflow: hidden; background: #fff; box-shadow: 0 4px 18px rgba(38,35,103,.08); }
.slide-card img { height: 170px; object-fit: cover; width: 100%; }
.slide-card .slide-body { padding: 16px; }
.slide-card h3 { font-size: 15.5px; margin: 0 0 6px; }
.slide-card p { font-size: 13px; color: #7B7E96; margin: 0 0 12px; }

/* ---------- Section titles ---------- */
.section-title { font-size: 26px; font-weight: 800; text-align: center; margin: 0 0 34px; color: var(--primary-color); }

/* ---------- Entity types grid ---------- */
.types-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; padding: 0 20px 50px; max-width: 1200px; margin: 0 auto; }
.type-card { background: #fff; border-radius: 16px; padding: 26px 18px; text-align: center; box-shadow: 0 2px 10px rgba(38,35,103,.06); transition: transform .15s, box-shadow .15s; border: 1px solid #EDEEF6; }
.type-card:hover { transform: translateY(-4px); box-shadow: 0 10px 24px rgba(38,35,103,.12); }
.type-card .icon-circle { width: 54px; height: 54px; border-radius: 50%; background: #EAF9F1; color: var(--secondary-color); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; font-size: 22px; }
.type-card h3 { font-size: 15px; margin: 0; }

/* ---------- Entity cards (top rated / listing) ---------- */
.entities-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; padding: 0 20px 50px; max-width: 1200px; margin: 0 auto; }
.entity-card { background: #fff; border-radius: 16px; padding: 20px; box-shadow: 0 2px 10px rgba(38,35,103,.06); border: 1px solid #EDEEF6; }
.entity-card .entity-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.entity-card .entity-logo { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; background: #F4F5FA; }
.entity-card h3 { font-size: 16px; margin: 0 0 4px; }
.entity-card .entity-type-tag { font-size: 11.5px; color: var(--primary-color); background: #E6E5F5; padding: 2px 10px; border-radius: 20px; }
.entity-card .entity-score { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.score-badge { font-size: 22px; font-weight: 800; color: var(--secondary-color); }
.score-bar-bg { flex: 1; height: 8px; background: #EEEFF5; border-radius: 4px; overflow: hidden; }
.score-bar-fill { height: 100%; background: var(--secondary-color); border-radius: 4px; }
.entity-card .entity-desc { font-size: 13px; color: #7B7E96; margin: 10px 0 0; }

/* ---------- Stats ---------- */
.stats-section { background: var(--primary-color); padding: 50px 20px; }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 20px; max-width: 1000px; margin: 0 auto; text-align: center; }
.stats-row .stat { color: #fff; }
.stats-row .stat .num { font-size: 34px; font-weight: 800; color: var(--secondary-color); }
.stats-row .stat .label { font-size: 13.5px; opacity: .85; margin-top: 4px; }

/* ---------- CTA ---------- */
.cta-section { text-align: center; padding: 60px 20px; }
.cta-section h2 { font-size: 26px; margin: 0 0 10px; color: var(--primary-color); }
.cta-section p { color: #7B7E96; margin: 0 0 26px; }

/* ---------- Buttons general ---------- */
.btn-primary-fe { display: inline-block; padding: 13px 30px; border-radius: 10px; background: var(--primary-color); color: #fff; font-weight: 700; }
.btn-secondary-fe { display: inline-block; padding: 13px 30px; border-radius: 10px; background: var(--secondary-color); color: #fff; font-weight: 700; }

/* ---------- Footer ---------- */
.site-footer { background: #1a1849; color: rgba(255,255,255,.75); padding: 50px 20px 24px; margin-top: 60px; }
.site-footer .footer-inner { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 30px; }
.site-footer h4 { color: #fff; font-size: 15px; margin: 0 0 14px; }
.site-footer a { display: block; padding: 5px 0; font-size: 13.5px; color: rgba(255,255,255,.65); }
.footer-bottom { text-align: center; font-size: 12.5px; color: rgba(255,255,255,.4); margin-top: 34px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.1); }

/* ---------- Entity single page ---------- */
.entity-header { background: #fff; padding: 40px 20px; border-bottom: 1px solid #EDEEF6; }
.entity-header-inner { max-width: 900px; margin: 0 auto; display: flex; gap: 20px; align-items: center; }
.entity-header .entity-logo-lg { width: 84px; height: 84px; border-radius: 18px; object-fit: cover; background: #F4F5FA; }
.rating-breakdown { max-width: 900px; margin: 30px auto; padding: 0 20px; }
.criteria-category { background: #fff; border-radius: 14px; padding: 20px; margin-bottom: 16px; border: 1px solid #EDEEF6; }
.criterion-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; border-bottom: 1px dashed #EEEFF5; }
.criterion-row:last-child { border-bottom: none; }

.comments-section { max-width: 900px; margin: 30px auto; padding: 0 20px; }
.comment-item { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid #EDEEF6; }
.comment-item img { width: 40px; height: 40px; border-radius: 50%; }
.comment-item .comment-name { font-weight: 700; font-size: 14px; }
.comment-item .comment-date { font-size: 11.5px; color: #9698AC; }
.comment-item .comment-text { margin-top: 6px; font-size: 14px; }

/* ---------- Rating form ---------- */
.rating-form-box { max-width: 900px; margin: 30px auto; padding: 24px; background: #fff; border-radius: 16px; border: 1px solid #EDEEF6; }
.criterion-slider-row { margin-bottom: 18px; }
.criterion-slider-row label { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.criterion-slider-row input[type=range] { width: 100%; accent-color: var(--secondary-color); }

/* ---------- Chatbot widget ---------- */
.chatbot-toggle { position: fixed; bottom: 24px; left: 24px; width: 58px; height: 58px; border-radius: 50%; background: var(--secondary-color); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; box-shadow: 0 6px 20px rgba(0,0,0,.2); cursor: pointer; z-index: 200; border: none; }
.chatbot-window { position: fixed; bottom: 92px; left: 24px; width: 340px; max-width: 90vw; height: 440px; background: #fff; border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,.25); display: none; flex-direction: column; overflow: hidden; z-index: 200; }
.chatbot-window.open { display: flex; }
.chatbot-header { background: var(--primary-color); color: #fff; padding: 14px 16px; font-weight: 700; font-size: 14.5px; }
.chatbot-messages { flex: 1; overflow-y: auto; padding: 14px; font-size: 13.5px; }
.chatbot-msg { margin-bottom: 10px; padding: 9px 12px; border-radius: 10px; max-width: 85%; }
.chatbot-msg.bot { background: #F4F5FA; }
.chatbot-msg.user { background: var(--secondary-color); color: #fff; margin-inline-start: auto; margin-inline-end: 0; }
.chatbot-input-row { display: flex; border-top: 1px solid #EDEEF6; }
.chatbot-input-row input { flex: 1; border: none; padding: 12px 14px; font-family: inherit; font-size: 13.5px; }
.chatbot-input-row button { border: none; background: var(--secondary-color); color: #fff; padding: 0 18px; font-weight: 700; cursor: pointer; }

@media (max-width: 800px) {
  .main-nav { display: none; }
  .mobile-nav-toggle { display: inline-flex; }
  .main-nav.open {
    display: flex; flex-direction: column; position: absolute; top: 100%; right: 0; left: 0;
    background: #fff; box-shadow: 0 8px 20px rgba(0,0,0,.1); padding: 10px; z-index: 99; gap: 2px;
  }
  .main-nav.open a { padding: 12px 16px; border-radius: 8px; }
  .site-header { position: sticky; }
  .header-inner { position: relative; }
  .hero-section h1 { font-size: 27px; }
  .entity-header-inner { flex-direction: column; text-align: center; }
}

/* ============================================================
   نظام تجاوب شامل — جوال / تابلت / آيباد / لابتوب / شاشات تلفزيون
   ============================================================ */

/* عناوين مرنة تتكيف تلقائياً بين أصغر وأكبر مقاس دون الحاجة لعدة استعلامات */
.hero-section h1 { font-size: clamp(24px, 4.5vw, 38px); }
.hero-section p { font-size: clamp(14px, 2vw, 17px); }
.section-title { font-size: clamp(20px, 3vw, 26px); }
.score-badge { font-size: clamp(18px, 2.5vw, 22px); }

/* ---------- الجوالات الصغيرة جداً (≤ 380px) ---------- */
@media (max-width: 380px) {
  .container { padding: 0 14px; }
  .hero-section { padding: 40px 14px; }
  .header-inner { padding: 12px 14px; }
  .site-logo { font-size: 17px; }
  .btn-hero, .btn-primary-fe, .btn-secondary-fe { padding: 12px 22px; font-size: 14px; }
  .chatbot-window { width: calc(100vw - 24px); left: 12px; bottom: 82px; }
}

/* ---------- الجوالات (≤ 600px) ---------- */
@media (max-width: 600px) {
  .header-actions .btn-login { display: none; } /* نُبقي زر "إنشاء حساب" فقط لتوفير المساحة */
  .types-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .entities-grid { grid-template-columns: 1fr; gap: 14px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .slide-card { flex: 0 0 260px; }
  .footer-inner { flex-direction: column; gap: 24px; text-align: center; }
  .footer-inner > div { display: flex; flex-direction: column; align-items: center; }
  table.data-table { font-size: 12.5px; }
}

/* ---------- التابلت العمودي / الآيباد ميني (601px – 900px) ---------- */
@media (min-width: 601px) and (max-width: 900px) {
  .main-nav { display: none; } /* نستخدم قائمة مبسّطة على الشاشات المتوسطة */
  .types-grid { grid-template-columns: repeat(3, 1fr); }
  .entities-grid { grid-template-columns: repeat(2, 1fr); }
  .entity-header-inner { flex-direction: column; text-align: center; }
}

/* ---------- الآيباد الأفقي / التابلت الكبير (901px – 1100px) ---------- */
@media (min-width: 901px) and (max-width: 1100px) {
  .main-nav a { padding: 8px 11px; font-size: 13.5px; }
  .types-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- الأجهزة اللمسية: أهداف نقر أكبر لتفادي الضغط الخاطئ ---------- */
@media (hover: none) and (pointer: coarse) {
  .main-nav a, .header-actions a, .btn-hero, .btn-primary-fe, .btn-secondary-fe,
  .type-card, .chatbot-toggle, .chatbot-input-row button { min-height: 44px; }
  input, textarea, select, button { min-height: 44px; }
}

/* ---------- الشاشات الكبيرة جداً وشاشات التلفزيون (≥ 1600px) ---------- */
@media (min-width: 1600px) {
  .container, .header-inner, .footer-inner { max-width: 1500px; }
  body { font-size: 18px; }
  .hero-section h1 { font-size: 46px; }
  .hero-section p { font-size: 19px; }
  .section-title { font-size: 32px; }
  .types-grid, .entities-grid { max-width: 1500px; }
  .entity-card, .type-card { padding-top: 24px; padding-bottom: 24px; }
}

/* ---------- الاتجاه الأفقي على الجوال (شاشة قصيرة عريضة) ---------- */
@media (max-height: 480px) and (orientation: landscape) {
  .hero-section { padding: 30px 20px; }
  .chatbot-window { height: 70vh; }
}

/* ---------- دعم الوضع الداكن على مستوى النظام (اختياري، يحافظ على العلامة التجارية) ---------- */
@media (prefers-color-scheme: dark) {
  .chatbot-window, .entity-card, .type-card, .slide-card { border-color: rgba(255,255,255,.08); }
}

/* ---------- تفضيل تقليل الحركة لأسباب الوصولية ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---------- طباعة نظيفة ---------- */
@media print {
  .site-header, .site-footer, .chatbot-toggle, .chatbot-window, .header-actions { display: none !important; }
}
