/* ==========================================================================
   1. إعدادات عامة والخطوط الحرة (RTL & Global Reset)
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800&display=swap');

:root {
    --primary-color: #0f172a;    /* كحلي ملكي داكن */
    --accent-color: #c5a880;     /* ذهبي فاخر */
    --accent-hover: #b39369;     /* ذهبي غامق عند التحويم */
    --text-color: #334155;       /* لون نصوص مريح للعين */
    --bg-light: #f8fafc;         /* خلفية الأقسام الفاتحة */
    --white: #ffffff;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.08);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box; /* تمنع تداخل العناصر بسبب الحواف أو الحشو */
    font-family: 'Cairo', sans-serif;
    scroll-behavior: smooth;
}

body {
    direction: rtl;
    text-align: right;
    background-color: var(--white);
    color: var(--text-color);
    overflow-x: hidden; /* لمنع أي اهتزاز أو ظهور شريط تمرير أفقي */
    line-height: 1.6; /* مسافة أمان لمنع تداخل السطور */
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

section {
    padding: 80px 0; /* مسافة أمان رأسية بين الأقسام */
    width: 100%;
    position: relative;
    clear: both;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

/* ==========================================================================
   2. شاشة التحميل الآمنة (Preloader)
   ========================================================================== */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: var(--primary-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#preloader.hide-loader {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.loader {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(197, 168, 128, 0.2);
    border-top: 3px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   3. الهيدر وقائمة التنقل (Navbar)
   ========================================================================== */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    z-index: 999;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary-color);
    white-space: nowrap; /* يمنع انقسام اللوجو على سطرين */
}

.logo span {
    color: var(--accent-color);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 30px;
}

.nav-link {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
    position: relative;
    padding: 5px 0;
    white-space: nowrap;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    transition: var(--transition);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-link.active {
    color: var(--accent-color);
}

.btn-nav {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

.btn-nav:hover {
    background-color: var(--accent-color);
    transform: translateY(-2px);
}

.hamburger {
    display: none;
    cursor: pointer;
    flex-direction: column;
    gap: 6px;
    z-index: 1001;
}

.hamburger span {
    display: block;
    width: 28px;
    height: 3px;
    background-color: var(--primary-color);
    transition: var(--transition);
    border-radius: 2px;
}

/* ==========================================================================
   4. قسم الواجهة الرئيسية الفليكس المرن (Hero Section)
   ========================================================================== */
.hero {
    background-color: var(--bg-light);
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 100px; /* مسافة أمان لكي لا يختفي المحتوى تحت الهيدر الثابت */
}

.hero-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    flex-wrap: wrap; /* الحل السحري: إذا ضاقت الشاشة، تنزل الصورة تحت النص تلقائياً بدون تداخل */
    width: 100%;
}

.hero-content {
    flex: 1 1 500px; /* يتمدد بمرونة ولا يقل عرضه عن 500px، وإلا يلتف للسطر الجديد */
}

.hero-tag {
    display: inline-block;
    background-color: rgba(197, 168, 128, 0.15);
    color: var(--primary-color);
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 20px;
}

.hero-content h1 {
    font-size: clamp(32px, 4vw, 48px); /* حجم خط ديناميكي يصغر تلقائياً حسب حجم الشاشة */
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1.3;
    margin-bottom: 20px;
}

.hero-content h1 span {
    color: var(--accent-color);
}

.hero-content p {
    font-size: 17px;
    color: var(--text-color);
    margin-bottom: 30px;
    max-width: 550px;
}

.hero-btns {
    display: flex;
    gap: 15px;
    flex-wrap: wrap; /* يمنع تداخل الأزرار في الهواتف الصغيرة */
}

.btn-primary, .btn-secondary {
    padding: 12px 28px;
    border-radius: 50px;
    font-weight: 700;
    display: inline-block;
    text-align: center;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--accent-color);
    color: var(--white);
    box-shadow: 0 4px 14px rgba(197, 168, 128, 0.3);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-secondary:hover {
    background-color: var(--primary-color);
    color: var(--white);
    transform: translateY(-2px);
}

.hero-image {
    flex: 1 1 400px;
    display: flex;
    justify-content: center;
}

/* تم إلغاء الأبعاد الثابتة px لعلبة الصورة واستبدالها بأبعاد متجاوبة تماماً */
.img-box {
    position: relative;
    width: 100%;
    max-width: 400px; 
    aspect-ratio: 4 / 5; /* يحافظ على النسبة المثالية للطول والعرض دائماً وبدون تمدد */
    border-radius: 30px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* يضمن عدم تشوه الصورة داخل الصندوق */
}

/* ==========================================================================
   5. عناوين الأقسام وشبكات العرض الذكية (Services Grid)
   ========================================================================== */
.section-title {
    text-align: center;
    margin-bottom: 50px;
}

.section-title h2 {
    font-size: clamp(26px, 3vw, 36px);
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.section-title p {
    font-size: 15px;
    color: var(--accent-color);
    font-weight: 600;
}

/* شبكة عرض ذكية: تعيد ترتيب كروت الخدمات تلقائياً حسب مساحة الشاشة وبدون تداخل */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.service-card {
    background-color: var(--white);
    padding: 35px 25px;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(0,0,0,0.02);
    transition: var(--transition);
}

.service-card:hover {
    transform: translateY(-5px);
    border-color: rgba(197, 168, 128, 0.3);
}

.service-icon {
    width: 55px;
    height: 55px;
    background-color: var(--bg-light);
    color: var(--accent-color);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 22px;
    margin-bottom: 20px;
    transition: var(--transition);
}

.service-card:hover .service-icon {
    background-color: var(--accent-color);
    color: var(--white);
}

.service-card h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.service-card p {
    font-size: 14.5px;
    color: var(--text-color);
}

/* ==========================================================================
   6. قسم عن الشخصية والإحصائيات التلقائية (About Me)
   ========================================================================== */
.about {
    background-color: var(--bg-light);
}

.about-wrapper {
    display: flex;
    align-items: center;
    gap: 50px;
    flex-wrap: wrap; /* يمنع التداخل في الهواتف */
}

.about-image {
    flex: 1 1 350px;
}

.about-img-box {
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 6px solid var(--white);
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

.about-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.about-content {
    flex: 1.2 1 450px;
}

.about-content h3 {
    font-size: clamp(22px, 2.5vw, 28px);
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.about-content p {
    font-size: 16px;
    margin-bottom: 25px;
}

/* نظام الاحصائيات المتجاوب */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 15px;
}

.stat-item {
    background-color: var(--white);
    padding: 20px 15px;
    border-radius: 15px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-item h4 {
    font-size: 28px;
    font-weight: 800;
    color: var(--accent-color);
    margin-bottom: 5px;
}

.stat-item p {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--primary-color);
}

/* ==========================================================================
   7. قسم آراء العملاء (Testimonials)
   ========================================================================== */
.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 25px;
}

.testimonial-card {
    background-color: var(--white);
    padding: 30px;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
}

.stars {
    color: #ffbc00;
    margin-bottom: 12px;
}

.testimonial-card p {
    font-style: italic;
    font-size: 14.5px;
    margin-bottom: 20px;
}

.client-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.client-img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
}

.client-details h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary-color);
}

.client-details span {
    font-size: 12.5px;
    color: var(--accent-color);
}

/* ==========================================================================
   8. قسم الأسئلة الشائعة المرن (FAQ Accordion)
   ========================================================================== */
.faq {
    background-color: var(--bg-light);
}

.faq-container {
    max-width: 750px;
    margin: 0 auto;
}

.faq-item {
    background-color: var(--white);
    margin-bottom: 12px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.01);
}

.faq-question {
    padding: 18px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 16px;
    gap: 15px;
}

.faq-icon {
    font-size: 16px;
    transition: var(--transition);
    color: var(--accent-color);
    flex-shrink: 0; /* لمنع أي تشوه في الأيقونة */
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease;
    padding: 0 25px;
    color: var(--text-color);
    font-size: 14.5px;
}

.faq-item.active {
    border: 1px solid rgba(197, 168, 128, 0.3);
}

.faq-item.active .faq-icon {
    transform: rotate(45deg);
}

.faq-item.active .faq-answer {
    max-height: 300px; /* حد أقصى مرن وواسع للنصوص الطويلة */
    padding-bottom: 18px;
    padding-top: 5px;
    border-top: 1px solid #f1f5f9;
}

/* ==========================================================================
   9. استمارة الاتصال الأنيقة (Contact Form)
   ========================================================================== */
.contact-wrapper {
    max-width: 650px;
    margin: 0 auto;
    background-color: var(--white);
    padding: 40px 30px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
}

.contact-form .form-group {
    margin-bottom: 18px;
}

.contact-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--primary-color);
    font-size: 14.5px;
}

.contact-form input,
.contact-form textarea,
.contact-form select {
    width: 100%;
    padding: 12px 18px;
    border: 1.5px solid #e2e8f0;
    background-color: var(--bg-light);
    border-radius: 10px;
    font-size: 14.5px;
    color: var(--primary-color);
    outline: none;
    transition: var(--transition);
}

.contact-form input:focus,
.contact-form textarea:focus,
.contact-form select:focus {
    border-color: var(--accent-color);
    background-color: var(--white);
    box-shadow: 0 0 0 3px rgba(197, 168, 128, 0.1);
}

.contact-form textarea {
    height: 130px;
    resize: none;
}

.btn-submit {
    width: 100%;
    border: none;
    cursor: pointer;
    background-color: var(--primary-color);
    color: var(--white);
    padding: 14px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    transition: var(--transition);
}

.btn-submit:hover {
    background-color: var(--accent-color);
}

/* ==========================================================================
   10. الفوتر المتجاوب (Footer)
   ========================================================================== */
footer {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 50px 0 25px;
    text-align: center;
}

.footer-logo {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 15px;
}

.footer-logo span {
    color: var(--accent-color);
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.social-icon {
    width: 40px;
    height: 40px;
    background-color: rgba(255,255,255,0.05);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    color: var(--white);
}

.social-icon:hover {
    background-color: var(--accent-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.copyright {
    font-size: 13.5px;
    color: #94a3b8;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 25px;
}

/* ==========================================================================
   11. إدارة شاشات الهواتف لمنع التداخل نهائياً (Responsive Design)
   ========================================================================== */
@media (max-width: 991px) {
    section { padding: 60px 0; }
    .hero-wrapper, .about-wrapper {
        flex-direction: column-reverse; /* يضع الصورة في الأسفل والنص فوقها لتفادي السحق الأفقي */
        text-align: center;
        gap: 35px;
    }
    .hero-content p { margin: 0 auto 25px; }
    .hero-btns { justify-content: center; }
}

@media (max-width: 768px) {
    .hamburger { display: flex; }
    
    /* تحويل المنيو العلوية لقائمة هاتف منبثقة ممتازة وبدون أي تداخل مع المحتوى */
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background-color: var(--white);
        box-shadow: -5px 0 15px rgba(0,0,0,0.08);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 30px;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        padding: 40px 20px;
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    .hamburger.active span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
    .hamburger.active span:nth-child(2) { opacity: 0; }
    .hamburger.active span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

    .contact-wrapper { padding: 30px 20px; }
  }
  
