/* =========================================
   🏗️ 7. تصميم صفحة أرشيف الخدمات (Services Archive)
   ========================================= */

/* --- 1. الهيدر الخاص بالصفحة --- */
.services-header {
    background: var(--bg-light);
    padding: 60px 0 40px;
    text-align: center;
    margin-bottom: 50px;
    border-bottom: 1px solid #eee;
}

.services-title {
    color: var(--primary-dark);
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 15px;
}

/* --- 2. شبكة الخدمات (Grid) --- */
.services-archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    padding-bottom: 60px;
}

/* --- 3. تصميم الكارت الاحترافي (Pro Card) --- */
.service-pro-card {
    background: #fff;
    border-radius: 15px;
    overflow: hidden; /* لحماية الصورة من الخروج عن الإطار */
    position: relative;
    border: 1px solid #f0f0f0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.03);
}

.service-pro-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 74, 153, 0.15);
    border-color: transparent;
}

/* خط ذهبي علوي */
.service-pro-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--secondary-color);
    transform: scaleX(0);
    transform-origin: left;
    transition: 0.4s;
    z-index: 5;
}

.service-pro-card:hover::before {
    transform: scaleX(1);
}

/* --- 🖼️ 4. تنسيق صورة الخدمة --- */
.service-card-img {
    height: 200px;
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid #f0f0f0;
}

.service-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.service-pro-card:hover .service-card-img img {
    transform: scale(1.1);
}

/* --- 5. الأيقونة والمحتوى --- */
.card-top {
    padding: 20px 30px 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.service-icon-wrapper {
    width: 50px;
    height: 50px;
    background: var(--bg-light);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--primary-color);
    transition: 0.4s;
}

.service-pro-card:hover .service-icon-wrapper {
    background: var(--primary-color);
    color: #fff;
    border-radius: 50%;
}

.service-number {
    font-size: 40px;
    font-weight: 900;
    color: #f0f0f0;
    line-height: 1;
    transition: 0.4s;
}

.service-pro-card:hover .service-number {
    color: var(--secondary-color);
    opacity: 0.2;
}

.card-body {
    padding: 15px 30px 25px;
    flex-grow: 1;
}

.card-body h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--primary-dark);
}

.card-body p {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 0;
}

/* --- 6. الفوتر والزرار --- */
.card-footer {
    padding: 15px 30px;
    background: #fafafa;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.3s;
}

.service-pro-card:hover .card-footer {
    background: #fff;
}

.btn-details {
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
}

.btn-details i {
    font-size: 12px;
    transition: 0.3s;
}

.service-pro-card:hover .btn-details {
    color: var(--secondary-color);
}

.service-pro-card:hover .btn-details i {
    transform: translateX(-5px);
}

/* =========================================
   📱 7. تجاوب الموبايل الشامل (Responsive & Fixes)
   ========================================= */

@media (max-width: 768px) {
    
    /* 🛡️ إغلاق محكم لمنع التمدد العرضي (Horizontal Scroll) */
    body, html, .site-main, .services-section {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    /* ضمان عدم خروج الحاوية عن الشاشة */
    .services-section .container {
        padding-right: 15px !important;
        padding-left: 15px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    /* 🗂️ تحويل الشبكة إلى عمود واحد وتوسيط الكروت */
    .services-grid, 
    .services-archive-grid { /* أضفنا كلاس الأرشيف لضمان نفس السلوك */
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important; /* توسيط الكروت بالمنتصف */
        justify-content: center !important;
        gap: 20px !important;
        padding: 15px 10px !important;
        margin-right: 0 !important;
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* 📐 تظبيط وتوسيط الكارت نفسه */
    .service-card,
    .service-pro-card {
        padding: 25px 20px !important;
        margin: 0 auto !important; /* تأكيد التوسيط */
        width: 100% !important;
        max-width: 380px !important; /* حجم محكوم لا يلتصق بالشاشة */
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    /* ✂️ كسر النصوص المتصلة الطويلة */
    .service-card h3, .service-pro-card h3,
    .service-card p,  .service-pro-card p,
    .service-card a,  .service-pro-card a,
    .service-card span, .service-pro-card span {
        word-wrap: break-word !important;
        overflow-wrap: anywhere !important;
        white-space: normal !important;
        max-width: 100% !important;
    }

    /* 🔠 تظبيط أحجام الخطوط في الكارت الأساسي */
    .service-card h3 {
        font-size: 20px !important;
        line-height: 1.4 !important;
    }

    .service-card p {
        font-size: 14px !important;
        line-height: 1.7 !important;
    }

    /* 🔢 تظبيط الرقم الخلفي */
    .service-card .step-number, 
    .service-card .bg-number {
        font-size: 3.5rem !important;
        top: 10px !important;
        left: 10px !important;
    }
}