/* Reset and base styles */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #1a5276;
    --secondary: #f39c12;
    --light: #f8f9fa;
    --dark: #2c3e50;
    --accent: #2980b9;

    /* theme tokens */
    --bg: #f5f7f9;
    --text: #333333;
    --card: #ffffff;
    --muted: #f8f9fa;
    --border: rgba(0,0,0,0.1);
    --header-bg: var(--primary);
    --header-bg-scrolled: rgba(26,82,118,0.95);
    --link: #ffffff;
    --link-active: var(--secondary);
    --icon: var(--primary);
    --footer-bg: var(--dark);
    --shadow: rgba(0,0,0,0.1);
}

body.dark-mode {
   --bg: #121a24;
   --text: #d1d5db;
   --card: #1c2530;
   --muted: #202b38;
   --border: rgba(255,255,255,0.08);
   --header-bg: #1a2230;
   --header-bg-scrolled: rgba(26,34,48,0.95);
   --link: #9bd1d9;
   --link-active: #b9a7f9;
   --icon: #8ab4f8;
   --footer-bg: #0f1620;
   --shadow: rgba(0,0,0,0.4);
   --card2: linear-gradient(135deg, #1a2230, #2b3544);
}


/* Manual dark mode override (highest priority) */
body.dark-mode {
    --bg: #121a24;                /* خلفية عامة: أزرق رمادي غامق */
    --text: #d1d5db;              /* النصوص: رمادي فاتح مائل للأزرق */
    --card: #1c2530;              /* صناديق أغمق شوي من الخلفية */
    --muted: #202b38;             /* خلفية ثانوية */
    --border: rgba(255,255,255,0.08);
              /* أزرق مشرق */
    --header-bg: #1a2230;         /* الهيدر هادئ */
    --header-bg-scrolled: rgba(26,34,48,0.95);

    --link: #9bd1d9;              /* روابط تركواز هادئ */
    --link-active: #b9a7f9;       /* لون نشط بنفسجي هادئ */
    --icon: #8ab4f8;              /* أيقونات أزرق هادئ */

    --footer-bg: #0f1620;         /* فوتر أغمق قليلاً */
    --shadow: rgba(0,0,0,0.4);

    --card2: linear-gradient(135deg, #1a2230, #2b3544); /* تدرج هادئ */
}


html, body {
    height: 100%;
    scroll-behavior: smooth;
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

.container { width: 90%; max-width: 1200px; margin: 0 auto; padding: 0 15px; }
section { padding: 5rem 0; }
p { margin-bottom: 1.5rem; }
h1, h2, h3, h4 { margin-bottom: 1rem; color: var(--dark); }
.hero .container h2 { margin-bottom: 1rem; color: #fff; }

.text-center { text-align: center; }

.btn {
    display: inline-block;
    background: var(--secondary);
    color: #fff;
    padding: 0.8rem 1.5rem;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}
.btn:hover { background: #e67e22; transform: translateY(-2px); box-shadow: 0 5px 15px var(--shadow); }

.section-title {
    text-align: center; font-size: 2.5rem; margin-bottom: 3rem; color: var(--primary); position: relative;
}
.section-title::after {
    content: ''; display: block; width: 80px; height: 4px; background: var(--secondary); margin: 10px auto;
}

/* Header */
header {
    background-color: var(--header-bg);
    color: #fff;
    padding: 1rem 0;
    position: fixed; width: 100%; top: 0; z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}
header.scrolled { padding: 0.5rem 0; background-color: var(--header-bg-scrolled); }
header .container { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.logo { display: flex; align-items: center; }
.logo h1 {
    font-size: 1.8rem;
    margin: 0;
    font-weight: 800;
    color: #047dee; /* أزرق متناسق مع الشعار */
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.logo span {
    color: #ffffff; /* أخضر مزرق مثل الشعار */
}


nav ul { display: flex; list-style: none; }
nav ul li { margin-left: 1.5rem; position: relative; }
nav ul li a {
    color: var(--link); text-decoration: none; font-weight: 500; transition: color 0.3s; position: relative; display: flex; align-items: center; padding: 0.5rem 0;
}
nav ul li a::after {
    content: ''; position: absolute; bottom: 0; left: 0; width: 0; height: 2px; background: var(--secondary); transition: width 0.3s;
}
nav ul li a:hover { color: var(--link-active); }
nav ul li a:hover::after { width: 100%; }
nav ul li a.active { color: var(--link-active); }
nav ul li a.active::after { width: 100%; }

/* Theme toggle */
.theme-toggle { display: flex; align-items: center; }
.theme-toggle button {
    background: none; border: 1px solid rgba(255,255,255,0.25);
    color: #fff; width: 40px; height: 40px; border-radius: 50%;
    display: grid; place-items: center; cursor: pointer; transition: transform .2s, background .2s, border-color .2s;
}
.theme-toggle button:hover { transform: translateY(-2px); border-color: var(--secondary); color: var(--secondary); }

/* Mobile menu button */
.mobile-menu-btn {
    display: none; flex-direction: column; cursor: pointer; padding: 6px; background: transparent; border: 0;
}
.mobile-menu-btn span { height: 3px; width: 25px; background: #fff; margin: 3px 0; border-radius: 2px; transition: all 0.3s; }
.mobile-menu-btn.active span:nth-child(1){ transform: rotate(-45deg) translate(-5px, 6px); }
.mobile-menu-btn.active span:nth-child(2){ opacity: 0; }
.mobile-menu-btn.active span:nth-child(3){ transform: rotate(45deg) translate(-5px, -6px); }

/* Hero */
.hero {
    background: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)),
        url('https://images.unsplash.com/photo-1504307651254-35680f356dfd?auto=format&fit=crop&w=1770&q=80') no-repeat center/cover;
    color: #fff; text-align: center; padding: 10rem 0 6rem; margin-top: 70px;
}
.hero h2 { font-size: 2.8rem; margin-bottom: 1.5rem; line-height: 1.3; }
.hero p { font-size: 1.3rem; margin-bottom: 2.5rem; max-width: 800px; margin-left: auto; margin-right: auto; }

/* Sections */
.about { background: var(--card); }
.about-content { max-width: 800px; margin: 0 auto; }
.about p { text-align: center; font-size: 1.1rem; color: var(--text); }

.md-message { background-color: #eaf2f8; }
body.dark-mode .md-message { background-color: #0f2d3b; }
.message-content {
    max-width: 800px; margin: 0 auto; background: var(--card);
    padding: 3rem; border-radius: 10px; box-shadow: 0 5px 20px var(--shadow); border: 1px solid var(--border);
}
.signature { margin-top: 2rem; text-align: right; border-top: 2px solid var(--secondary); padding-top: 1rem; }
.signature h3 { color: var(--primary); margin-bottom: 0.5rem; }

.process {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; margin-top: 2rem;
}
.step {
    background: var(--card); color: var(--text);
    padding: 2.5rem; border-radius: 10px; box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    text-align: center; transition: transform 0.3s, box-shadow 0.3s; border: 1px solid var(--border);
}
.step:hover { transform: translateY(-5px); box-shadow: 0 10px 20px var(--shadow); }
.step-number {
    display: inline-block; width: 50px; height: 50px; background: var(--primary); color: #fff;
    border-radius: 50%; line-height: 50px; font-size: 1.5rem; font-weight: bold; margin-bottom: 1.5rem;
}
.step h3 { color: var(--primary); margin-bottom: 1rem; }
.how-we-work { background: var(--card2); }
.services { background: var(--card); }
.service-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 2rem; }
.service {
    background: var(--muted); color: var(--text);
    padding: 2rem; border-radius: 10px; text-align: center; transition: all 0.3s;
    border-left: 4px solid var(--primary); border-right: 1px solid var(--border); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.service:hover { background: var(--primary); color: #fff; transform: translateY(-5px); }
.service:hover h3, .service:hover i { color: #fff; }
.service i { font-size: 3rem; color: var(--icon); margin-bottom: 1.5rem; }
.service h3 { color: var(--primary); margin-bottom: 1rem; }

.expertise { background: var(--card); }
.expertise-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 2rem; margin-bottom: 4rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); /* كان 350px */
  margin-left: auto;
  margin-right: auto; }
.expertise-item {
    background: var(--muted); color: var(--text);
    padding: 2.5rem; border-radius: 10px; box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s; position: relative; overflow: hidden; border-top: 5px solid var(--primary);
    border: 1px solid var(--border);
}
expertise-item h3,
.expertise-item p,
.expertise-details li {
  word-break: break-word;
  hyphens: auto;
}
.expertise-item:hover { transform: translateY(-5px); box-shadow: 0 10px 25px var(--shadow); }
.expertise-icon {
    width: 80px; height: 80px; background: var(--primary); color: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; margin: 0 auto 1.5rem; font-size: 2rem;
}
.expertise-item h3 { text-align: center; color: var(--primary); font-size: 1.5rem; margin-bottom: 1.5rem; }
.expertise-details { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.expertise-details h4 { color: var(--primary); margin-bottom: 1rem; }
.expertise-details ul { list-style: none; }
.expertise-details li { padding: 0.5rem 0 0.5rem 1.5rem; position: relative; }
.expertise-details li::before {
    content: "•"; color: var(--secondary); font-weight: bold; display: inline-block; width: 1em; margin-left: -1.5em; font-size: 1.2rem;
}

.partners {
    background: linear-gradient(to right, #2c3e50, #4ca1af);
    color: #fff;
}
.partners .section-title { color: #fff; }
.partner-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }
.partner {
    background: rgba(255,255,255,0.1); padding: 2rem; border-radius: 10px; text-align: center;
    backdrop-filter: blur(5px); border: 1px solid rgba(255,255,255,0.2);
}

.team { background: var(--card); }
.org-chart { margin-top: 3rem; overflow-x: auto; }
.chart-container { display: flex; flex-direction: column; align-items: center; min-width: 800px; }
.chart-level { display: flex; justify-content: center; margin-bottom: 2rem; gap: 1rem; }
.chart-node {
    background: var(--primary); color: #fff; padding: 1rem; border-radius: 5px; text-align: center; min-width: 150px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}
/* Organization Chart title in dark mode */
body.dark-mode .org-chart h3 {
    color: #9bd1d9;   /* تركواز هادئ */
    text-shadow: 1px 1px 3px rgba(0,0,0,0.6); /* لإبراز النص */
}


.values { background: var(--muted); }
.values-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }
.value {
    background: var(--card); color: var(--text);
    padding: 2rem; border-radius: 10px; box-shadow: 0 5px 15px rgba(0,0,0,0.08); text-align: center; transition: transform 0.3s;
    border: 1px solid var(--border);
}
.value:hover { transform: translateY(-5px); }
.value i { font-size: 2.5rem; color: var(--icon); margin-bottom: 1rem; }
.value h3 { color: var(--primary); margin-bottom: 1rem; }

.contact {
    background: linear-gradient(rgba(0,0,0,0.8), rgba(0,0,0,0.8)),
        url('https://images.unsplash.com/photo-1516156008625-3a9d6067fab5?auto=format&fit=crop&w=1770&q=80') no-repeat center/cover;
    color: #fff; text-align: center;
}
.contact .section-title { color: #fff; }
.contact-info {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 2rem; margin-top: 2rem;
}
.contact-item {
    background: rgba(255,255,255,0.1); padding: 2rem; border-radius: 10px; backdrop-filter: blur(5px); border: 1px solid rgba(255,255,255,0.2);
}
.contact-item i { font-size: 2rem; color: var(--secondary); margin-bottom: 1rem; }
.contact-item h3 { color: var(--secondary); margin-bottom: 0.5rem; }
 /* Logo image */
.site-logo {
    height: 60px;
    margin-right: 10px;
}

/* Contact form */
.contact-form {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.contact-form input,
.contact-form textarea {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--card);
    color: var(--text);
}
.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--secondary);
}
.contact-form button {
    align-self: center;
}

footer {
    background-color: var(--footer-bg); color: #fff; text-align: center; padding: 2rem 0; margin-top: 0;
}
.social-links { margin-bottom: 1rem; }
.social-links a { color: #fff; font-size: 1.5rem; margin: 0 0.5rem; transition: color 0.3s; }
.social-links a:hover { color: var(--secondary); }

/* Responsive */
@media (max-width: 768px) {
    .section-title { font-size: 2rem; }

    nav ul {
        display: none; flex-direction: column; position: absolute; top: 100%; left: 0; width: 100%;
        background-color: var(--header-bg); padding: 1rem 0; box-shadow: 0 5px 10px rgba(0,0,0,0.2); z-index: 999;
    }
    nav ul.show { display: flex; }
    nav ul li { margin: 0; width: 100%; }
    nav ul li a { padding: 1rem 1.5rem; width: 100%; justify-content: center; }

    .mobile-menu-btn { display: flex; }
    .hero h2 { font-size: 2rem; }
    .hero p { font-size: 1rem; }

    .chart-container { min-width: 100%; }
    .chart-level { flex-direction: column; align-items: center; }
}
/* تباين أفضل للعناوين في الوضع الليلي */
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4 {
  color: #e5e7eb; /* رمادي فاتح مريح */
}

/* تخفيف قتامة الخلفية على الموبايل */
@media (max-width: 768px) {
  body.dark-mode {
    --bg: #18222f;
    --card: #222c3a;
    --muted: #2a3442;
  }
  expertise-container {
    grid-template-columns: 1fr;   /* عمود واحد */
    gap: 1.25rem;                 /* مسافة أنسب */
    justify-items: stretch;       /* خَلّي الكرت يملى العرض */
  }

  .expertise-item {
    margin: 0;                    /* ألغِ أي انزياح جانبي */
    padding: 1.5rem;              /* تقليل الحشوة لتفادي الضغط */
  }

  .expertise-icon {
    margin: 0 auto 1rem;          /* توسيط الأيقونة */
  }
}
