/* ===== مشترك: هيدر + شريط جانبي + مبدّل اللغة ===== */

/* ===== Navbar ===== */
.site-navbar {
  position: sticky; top: 14px; z-index: 1500;
  max-width: 1160px; margin: 14px auto 0;
  padding: 10px 22px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid #e2e8f0; border-radius: 18px;
  box-shadow: 0 2px 10px rgba(15,23,42,0.06);
}
.logo { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.05rem; color: #0f172a; }
.logo img { border-radius: 12px; }
.nav-links { display: flex; gap: 6px; }
.nav-links a {
  padding: 8px 16px; border-radius: 12px;
  font-weight: 700; font-size: .92rem; color: #475569;
  transition: .2s;
}
.nav-links a:hover { background: #f0f4fa; color: #2563eb; }
.nav-actions { display: flex; align-items: center; gap: 10px; }

.lang-switch {
  background: #f0f4fa;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  padding: 8px 14px; border-radius: 12px;
  font-weight: 800; font-size: .82rem; cursor: pointer;
  transition: .2s;
}
.lang-switch:hover { border-color: #2563eb; color: #2563eb; }

.theme-btn { width: 42px; padding: 8px 0; justify-content: center; }
.theme-btn i { font-size: .95rem; }

.menu-btn {
  display: none;
  width: 44px; height: 44px; border-radius: 12px;
  background: #f0f4fa; border: 1px solid #e2e8f0;
  color: #0f172a; font-size: 1.15rem; cursor: pointer;
  align-items: center; justify-content: center;
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; transition: .3s;
}
.sidebar.open { opacity: 1; visibility: visible; }
.sidebar-inner {
  position: absolute; top: 0; right: 0; height: 100%; width: 290px;
  background: #ffffff;
  box-shadow: -16px 0 44px rgba(15,23,42,0.16);
  padding: 26px 20px;
  display: flex; flex-direction: column; gap: 6px;
  transform: translateX(110%); transition: transform .35s cubic-bezier(.2,.9,.3,1);
}
body.english .sidebar-inner { right: auto; left: 0; transform: translateX(-110%); }
.sidebar.open .sidebar-inner { transform: translateX(0); }
.close-sidebar {
  align-self: flex-start; width: 40px; height: 40px;
  border-radius: 12px; border: 1px solid #e2e8f0;
  background: #f0f4fa; color: #0f172a;
  font-size: 1.05rem; cursor: pointer; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-inner a {
  padding: 14px 18px; border-radius: 14px;
  font-weight: 700; color: #475569;
  transition: .2s;
}
.sidebar-inner a:hover { background: #f0f4fa; color: #2563eb; }

.mobile-lang {
  margin-top: 14px; text-align: center;
  background: #f0f4fa; border: 1px solid #e2e8f0;
  padding: 12px; border-radius: 14px; cursor: pointer;
  font-weight: 800; color: #0f172a; font-size: .9rem;
}

/* ===== Language toggle ===== */
.lang-ar, .lang-en { transition: .15s; }
.lang-en { display: none !important; }
body.english .lang-ar { display: none !important; }
body.english .lang-en { display: block !important; }
body.english { direction: ltr; }

/* ===== Footer موحّد ===== */
.footer-links {
  display: flex; justify-content: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px; padding: 0 16px;
}
.footer-links a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 14px;
  background: #f0f4fa; border: 1px solid #e2e8f0; color: #475569;
  font-size: 1.1rem; transition: .22s cubic-bezier(.2,.8,.3,1);
}
.footer-links a:hover {
  background: #2563eb; border-color: #2563eb; color: #fff;
  transform: translateY(-4px); box-shadow: 0 12px 24px rgba(37,99,235,.25);
}
.footer { text-align: center; color: #94a3b8; font-size: .9rem; line-height: 1.8; }
.footer > div:last-child { padding-bottom: 4px; }

/* ===== شريط مستوى المهارات/اللغات ===== */
.level-bar {
  height: 10px; border-radius: 999px; overflow: hidden;
  background: #e9edf6; border: 1px solid #e2e8f0; margin: 14px 0 8px;
}
.level-bar span {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #2563eb, #1d4ed8);
}
.language-card small { display: block; color: #64748b; font-size: .85rem; }
.skill-box .level-bar { margin: 12px 0 0; }
.skill-box .level-bar span.adv { background: linear-gradient(90deg, #2563eb, #1d4ed8); }
.skill-box .level-bar span.int { background: linear-gradient(90deg, #ff9800, #f59e0b); }

/* ===== أزرار التواصل ===== */
.contact-strip {
  margin-top: 36px; padding: 18px 0 8px; border-top: 1px solid #e2e8f0;
  display: flex; align-items: center; justify-content: center;
  gap: 10px; flex-wrap: wrap; text-align: center;
}
.contact-strip a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 12px;
  background: #f0f4fa; border: 1px solid #e2e8f0; color: #475569;
  font-weight: 700; font-size: .9rem; transition: .22s;
}
.contact-strip a:hover { border-color: #2563eb; color: #2563eb; transform: translateY(-3px); box-shadow: 0 10px 22px rgba(37,99,235,.15); }
.contact-strip .copy { width: 100%; color: #94a3b8; font-size: .88rem; margin-top: 6px; }

.contact-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 12px; padding: 10px 20px; border-radius: 12px;
  background: #2563eb; border: 1px solid #2563eb; color: #fff;
  font-weight: 800; font-size: .9rem; cursor: pointer;
  transition: .25s cubic-bezier(.2,.8,.3,1); box-shadow: 0 10px 22px rgba(37,99,235,.28);
}
.contact-btn:hover { transform: translateY(-3px); box-shadow: 0 16px 32px rgba(37,99,235,.38); }
.contact-btn.wa { background: linear-gradient(120deg,#25d366,#128c7e); border-color: #25d366; box-shadow: 0 10px 22px rgba(37,211,102,.30); }
.contact-btn.wa:hover { box-shadow: 0 16px 32px rgba(37,211,102,.42); }

/* ===== Back to top ===== */
.back-to-top {  position: fixed; bottom: 24px; left: 24px; z-index: 1500;
  width: 46px; height: 46px; border-radius: 14px;
  background: #2563eb; color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 12px 30px rgba(37,99,235,0.3);
  opacity: 0; visibility: hidden; transition: .25s;
}
.back-to-top:hover { transform: translateY(-4px); }

/* ===== Scroll progress bar (مشترك في كل الصفحات) ===== */
.scroll-progress {
  position: fixed; top: 0; left: 0; right: 0; z-index: 6000;
  height: 4px; width: 0%;
  background: linear-gradient(90deg, #2563eb, #ff9800);
  box-shadow: 0 2px 8px rgba(37,99,235,0.4);
  transition: width .08s linear;
}

/* ===== زر ثانوي شفاف ===== */
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: 12px;
  background: #f0f4fa; border: 1px solid #e2e8f0; color: #475569;
  font-weight: 800; font-size: .9rem; cursor: pointer;
  transition: .25s; font-family: inherit;
}
.btn-ghost:hover { border-color: #2563eb; color: #2563eb; transform: translateY(-3px); box-shadow: 0 10px 22px rgba(37,99,235,.15); }

/* ===== نافذة تفاصيل منبثقة (المشاريع/الشهادات) ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(15,23,42,0.55);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; opacity: 0; visibility: hidden; transition: .25s;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal-box {
  background: #fff; border-radius: 22px; max-width: 640px; width: 100%;
  max-height: 88vh; overflow-y: auto; padding: 26px 28px;
  box-shadow: 0 30px 70px rgba(15,23,42,0.28);
  transform: translateY(16px) scale(.98); transition: transform .28s cubic-bezier(.2,.9,.3,1);
}
.modal-overlay.open .modal-box { transform: translateY(0) scale(1); }
.modal-box img { width: 100%; border-radius: 14px; margin-bottom: 16px; max-height: 260px; object-fit: cover; }
.modal-box h3 { font-size: 1.35rem; margin: 0 0 8px; color: #0f172a; }
.modal-box .modal-tag { display: inline-block; padding: 5px 14px; border-radius: 999px; background: #f0f4fa; color: #2563eb; font-weight: 800; font-size: .8rem; margin-bottom: 12px; }
.modal-box p { color: #475569; line-height: 1.9; font-size: .98rem; }
.modal-close {
  position: sticky; top: 0; float: left; z-index: 2;
  width: 40px; height: 40px; margin-bottom: 12px; border: 0; border-radius: 12px;
  background: #f0f4fa; cursor: pointer; font-size: 1.1rem; color: #0f172a;
}
.modal-close:hover { background: #fee2e2; color: #dc2626; }
.modal-foot { margin-top: 20px; text-align: center; }

/* ===== نسخة الهاتف الاحترافية (مشترك) ===== */
html {
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
  overflow-x: hidden;
  overflow-x: clip;
}
body {
  overflow-x: hidden;
  overflow-x: clip;
  max-width: 100%;
  -webkit-tap-highlight-color: transparent;
}
html, body { margin: 0; padding: 0; }

/* تثبيت الهيدر ومنع التزحزح العمودي أثناء فتح الشريط الجانبي */
.site-navbar { will-change: transform; }

/* احتواء الشريط الجانبي المخفي حتى لا يسبب تمريراً جانبياً */
.sidebar { overflow: hidden; }

@media (max-width: 768px) {
  .nav-links { display: none; }
  .menu-btn { display: flex; }

  /* الهيدر الثابت على الشاشات الصغيرة: يمتد بعرض كامل ويلتصق بالأعلى */
  .site-navbar {
    position: sticky; top: 0; margin: 0;
    max-width: 100%; border-radius: 0;
    padding: 10px 16px; border-left: 0; border-right: 0; border-top: 0;
    background: rgba(255,255,255,0.94);
  }
  .site-navbar .logo { font-size: .95rem; gap: 9px; }
  .site-navbar .logo img { width: 36px; height: 36px; }
  .site-navbar .lang-switch:not(.theme-btn) { display: none; }
  .menu-btn { width: 42px; height: 42px; }

  /* قفل تمرير الخلفية عند فتح الشريط الجانبي */
  body.side-open { overflow: hidden; }

  .section-actions { width: 100%; }
  .section-actions .btn, .section-actions a { flex: 1 1 100%; }

  /* المحتوى */
  .page-wrapper { padding: 16px 14px 40px; }
  body.english .page-wrapper { padding-left: 14px; padding-right: 14px; }
  .topbar h1 { font-size: 1.6rem !important; }
  .topbar p { font-size: .95rem; }

  /* بطاقات المحتوى */
  .content-card, .contact-card, .exp-card, .edu-card, .language-card, .cert-large { border-radius: 20px; padding: 20px; }
  .cert-large .cert-summary { padding: 14px 16px 18px; }
  .cert-large h2 { padding: 18px 16px 0; font-size: 1.2rem; }
  .cert-large .cert-item-img { margin: 12px 16px 0; }

  /* أهداف لمس أكبر */
  .sidebar-inner a { padding: 15px 18px; min-height: 48px; display: flex; align-items: center; }
  .mobile-lang { min-height: 50px; display: flex; align-items: center; justify-content: center; }

  /* منع التمرير الأفقي */
  .page-wrapper, .container, .section, .topbar, section { max-width: 100%; }
}

@media (max-width: 480px) {
  /* حشوة آمنة لشاشات النوتش */
  .site-navbar { padding: 10px 12px; }
  .site-navbar .logo span, .site-navbar .logo strong { font-size: .8rem; }
  .sidebar-inner { width: 84vw; max-width: 300px; }
  .back-to-top { bottom: 16px; left: 16px; width: 42px; height: 42px; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .site-navbar { padding: 10px 18px; }
  .nav-links a { padding: 8px 12px; font-size: .9rem; }
}

/* ===== إتاحة الوصول (Accessibility) ===== */

/* حركات سلسة محترمة لتقليل الحركة في إعدادات النظام */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .scroll-progress { transition: none; }
}

/* تركيز واضح بالكيبورد */
:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
  border-radius: 8px;
}
body.dark :focus-visible { outline-color: #60a5fa; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline-width: 3px; }

/* رابط التنقل النشط */
.nav-links a.active { background: #f0f4fa; color: #2563eb; }
body.dark .nav-links a.active { background: #1f2a4a; color: #60a5fa; }

/* تلميح الرابط النشط في القائمة الجانبية */
.sidebar-inner a.active { background: #f0f4fa; color: #2563eb; }
body.dark .sidebar-inner a.active { background: #1f2a4a; color: #60a5fa; }