/* ================= المتغيرات والأساسيات ================= */
:root {
    --navy-dark: #0F172A;
    --navy-light: #1E293B;
    --navy-bg: #0B1120;
    --orange-cta: #F97316;
    --orange-hover: #EA580C;
    --bg-light: #F8FAFC;
    --text-main: #334155;
    --text-muted: #64748B;
    --gray-text: #475569;
    --white: #FFFFFF;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

html { 
    scroll-behavior: smooth; 
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    line-height: 1.7;
    overflow-x: hidden;
}

h1, h2, h3 { 
    font-family: 'Cairo', sans-serif; 
}

.container { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 0 20px; 
}

/* ================= الهيدر (شريط التنقل) ================= */
.site-header {
    background-color: var(--navy-dark);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
}

.header-flex { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.logo { 
    font-size: 28px; 
    font-weight: 800; 
    color: var(--white); 
}

.logo span { 
    color: var(--orange-cta); 
}

.main-nav ul { 
    list-style: none; 
    display: flex; 
    gap: 25px; 
}

.main-nav a {
    color: var(--white);
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    transition: var(--transition);
}

.main-nav a:hover { 
    color: var(--orange-cta); 
}

.main-nav a.active {
    color: var(--orange-cta);
    position: relative;
}

.main-nav a.active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--orange-cta);
    border-radius: 2px;
}

/* ================= تصميم زر الهمبرغر (للموبايل) ================= */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 1001;
}

.menu-toggle span {
    width: 30px;
    height: 3px;
    background-color: var(--white);
    border-radius: 3px;
    transition: var(--transition);
}

.menu-toggle.active span:nth-child(1) { transform: translateY(9px) rotate(45deg); background-color: var(--orange-cta); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); background-color: var(--orange-cta); }

/* ================= قسم البطل (Hero) ================= */
.hero {
    background: linear-gradient(135deg, rgba(15,23,42,0.95) 0%, rgba(30,41,59,0.85) 100%), 
                url('/photos/hero_image.webp') center/cover;
    padding: 120px 0;
    text-align: center;
    color: var(--white);
}

.hero-content { max-width: 800px; margin: 0 auto; }
.hero h1 { font-size: clamp(32px, 5vw, 56px); font-weight: 800; margin-bottom: 20px; line-height: 1.2; }
.hero p { font-size: clamp(16px, 2vw, 20px); color: #cbd5e1; margin-bottom: 40px; }

.btn-primary {
    display: inline-block;
    background-color: var(--orange-cta);
    color: var(--white);
    padding: 16px 36px;
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
    border-radius: 8px;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(249, 115, 22, 0.4);
}

.btn-primary:hover {
    background-color: var(--orange-hover);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.6);
}

/* ================= الأقسام العامة والتخطيط الشبكي ================= */
.reviews-section { padding: 80px 0; }
.blog-section { padding: 80px 0; background-color: var(--bg-light); }

.section-header { text-align: center; margin-bottom: 50px; }
.section-header h2 { font-size: 36px; color: var(--navy-dark); position: relative; display: inline-block; padding-bottom: 10px; }

.subtitle { font-size: 18px; color: var(--text-muted); margin-top: 15px; }

.filter-buttons { display: flex; justify-content: center; flex-wrap: wrap; gap: 15px; margin-bottom: 40px; }
.filter-btn {
    background: var(--white); border: 2px solid #e2e8f0; padding: 10px 24px; border-radius: 30px;
    font-family: 'Cairo', sans-serif; font-weight: 600; font-size: 16px; color: var(--text-main);
    cursor: pointer; transition: var(--transition);
}
.filter-btn:hover, .filter-btn.active { background: var(--navy-dark); color: var(--white); border-color: var(--navy-dark); }

/* توحيد الجريد (الشبكة) لكل الأقسام */
.reviews-grid, .blog-grid, .related-grid, .review-grid { 
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); /* تصغير طفيف للتابلت */
    gap: 30px;
    margin-top: 40px;
    min-height: 400px;
}

/* ================= تصميم البطاقات الموحد (DRY) ================= */
.card, .blog-card, .review-card, .related-card {
    background-color: var(--bg-light);
    border: 1px solid var(--navy-light);
    border-radius: 12px;
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%; /* مهم جداً لتساوي الكاردات */
    color: var(--navy-dark);
    text-decoration: none;
}

.card:hover, .blog-card:hover, .review-card:hover, .related-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.2); 
    border-color: var(--orange-cta);
}

.card-img-wrapper, .card-image-wrapper {
    position: relative;
    overflow: hidden;
    height: 220px;
    width: 100%;
    border-bottom: 3px solid var(--orange-cta);
    flex-shrink: 0; /* يمنع الصورة تنضغط بالشاشات الصغيرة */
}

.card-img, .blog-card-img, .review-card-img, .card-img-wrapper img, .card-image-wrapper img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.card-img-wrapper img, .card-image-wrapper img { height: 100%; }
.blog-card-img, .review-card-img { border-bottom: 3px solid var(--orange-cta); flex-shrink: 0; }

.card:hover .card-img, 
.card:hover .card-img-wrapper img, 
.blog-card:hover .blog-card-img, 
.review-card:hover .review-card-img, 
.related-card:hover .card-image-wrapper img {
    transform: scale(1.08);
}

.card-body, .blog-card-content, .review-card-content, .related-content {
    padding: 25px;
    flex-grow: 1; /* يدفع العناصر للأسفل */
    display: flex;
    flex-direction: column;
}

.blog-date, .review-date { font-size: 14px; color: #94a3b8; margin-bottom: 10px; display: block; }

.card-title, .blog-card-content h3, .review-card-content h3, .related-content h3 {
    font-size: 20px;
    color: var(--navy-dark);
    margin-bottom: 12px;
    line-height: 1.4;
    font-family: 'Cairo', sans-serif;
}

/* 🌟 هنا الحل الجذري للزر المخفي والبطاقات المخربطة */
.card-desc, .blog-card-content p, .review-card-content p, .related-content p {
    font-size: 15px;
    color: var(--gray-text);
    margin-bottom: 20px;
    line-height: 1.6;
    flex-grow: 1;
    /* هذا الكود يقص النص الزايد بعد 3 أسطر ويخلي الكاردات كلها نفس الطول */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.btn-card {
    text-align: center;
    background: var(--orange-cta);
    color: var(--white);
    padding: 12px;
    border-radius: 6px;
    font-weight: 700;
    text-decoration: none;
    transition: var(--transition);
    border: 2px solid transparent;
    margin-top: auto; /* يثبت الزر بالأسفل دائماً */
    white-space: nowrap; /* يمنع الزر يصير سطرين بالموبايل */
}

.btn-card:hover {
    background: transparent;
    color: var(--orange-cta);
    border-color: var(--orange-cta);
}

.blog-read-more, .review-read-more {
    display: inline-block;
    color: var(--orange-cta);
    font-weight: 600;
    font-size: 16px;
    transition: var(--transition);
    margin-top: auto; /* يثبت الرابط بالأسفل */
    white-space: nowrap;
}

.blog-read-more:hover, .review-read-more:hover {
    color: var(--orange-hover);
    transform: translateX(-5px);
}

.underlineless::after { display: none !important; }

/* ================= تصميم الصورة البارزة للصفحات (المقالات/المراجعات) ================= */
.page-image-wrapper {
    width: 100%;
    max-width: 900px;
    max-height: 450px; /* 🌟 منع الصورة تصير عملاقة */
    margin: 30px auto; 
    border-radius: 16px; 
    overflow: hidden; 
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08); 
    display: block; /* للتوسيط */
}

.page-image-wrapper img {
    width: 100%;
    height: 100%;
    max-height: 450px;
    object-fit: cover; /* يمنع تمطط الصورة */
    display: block;
}

/* ================= الصفحات الداخلية (المقالات والمراجعات) ================= */
.page-header { background-color: var(--navy-dark); color: var(--white); padding: 60px 0; text-align: center; border-bottom: 4px solid var(--orange-cta); }
.page-header h1 { font-size: 36px; margin-bottom: 15px; }

.review-page { padding: 50px 0; }
.review-layout { display: grid; grid-template-columns: 2.5fr 1fr; gap: 40px; }
.review-content, .page-content { background: var(--white); padding: 40px; border-radius: 12px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
.review-content h1 { font-size: 32px; color: var(--navy-dark); margin-bottom: 15px; line-height: 1.4; }
.review-content h2 { font-size: 24px; color: var(--navy-dark); margin: 30px 0 15px; border-bottom: 2px solid #e2e8f0; padding-bottom: 10px; }
.review-content p { font-size: 18px; margin-bottom: 20px; color: var(--gray-text); }

/* دعم للصور العادية داخل المقال */
.main-review-img { width: 100%; max-height: 400px; object-fit: cover; border-radius: 8px; margin-bottom: 30px; border: 1px solid #e2e8f0; }

.pros-cons-box { display: grid; grid-template-columns: 1fr; gap: 20px; margin: 30px 0; }
.pros, .cons { padding: 20px; border-radius: 8px; }
.pros { background-color: #f0fdf4; border: 1px solid #bbf7d0; }
.cons { background-color: #fef2f2; border: 1px solid #fecaca; }
.pros h3 { color: #166534; margin-bottom: 15px; }
.cons h3 { color: #991b1b; margin-bottom: 15px; }
.pros li, .cons li { margin-bottom: 10px; font-size: 16px; position: relative; padding-right: 25px; list-style: none; }
.pros li::before { content: "✅"; position: absolute; right: 0; top: 0; }
.cons li::before { content: "❌"; position: absolute; right: 0; top: 0; }

.sidebar-widget { background: var(--white); padding: 25px; border-radius: 12px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); margin-bottom: 30px; border-top: 4px solid var(--navy-dark); }
.sidebar-widget h3 { font-size: 18px; margin-bottom: 15px; color: var(--navy-dark); }

/* ================= صفحة اتصل بنا ================= */
.contact-hero { background: linear-gradient(135deg, var(--navy-dark) 0%, #1e293b 100%); padding: 80px 0; text-align: center; color: var(--white); border-bottom: 4px solid var(--orange-cta); }
.contact-hero h1 { font-size: 40px; margin-bottom: 15px; }
.contact-hero p { font-size: 18px; color: #cbd5e1; max-width: 600px; margin: 0 auto; }
.contact-page-modern { padding: 60px 0; background-color: var(--bg-light); }
.contact-grid-modern { display: grid; grid-template-columns: 1fr 1.5fr; gap: 40px; margin-top: -80px; position: relative; z-index: 10; margin-bottom: 50px; }

.contact-info-premium { background: var(--navy-dark); color: var(--white); padding: 40px; border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); }
.contact-info-premium h2 { font-size: 26px; margin-bottom: 15px; color: var(--white); }
.premium-info-item { display: flex; align-items: flex-start; gap: 20px; margin-bottom: 30px; }
.icon-box { background: rgba(249, 115, 22, 0.1); color: var(--orange-cta); width: 50px; height: 50px; border-radius: 10px; display: flex; justify-content: center; align-items: center; flex-shrink: 0; }
.item-details h3 { font-size: 18px; margin-bottom: 5px; color: var(--white); }
.item-details p { font-size: 16px; margin-bottom: 2px; color: #e2e8f0; font-weight: 600; }

.contact-form-premium { background: var(--white); padding: 40px; border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.05); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group-modern { margin-bottom: 25px; }
.form-group-modern label { display: block; font-weight: 700; color: var(--navy-dark); margin-bottom: 10px; font-size: 15px; }
.form-group-modern input, .form-group-modern textarea { width: 100%; padding: 15px; background-color: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; font-family: 'Tajawal', sans-serif; font-size: 15px; color: var(--text-main); transition: var(--transition); }
.form-group-modern input:focus, .form-group-modern textarea:focus { outline: none; background-color: var(--white); border-color: var(--orange-cta); box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.1); }
.btn-submit-modern { background: var(--orange-cta); color: var(--white); border: none; width: 100%; padding: 18px; font-size: 18px; font-weight: 700; border-radius: 8px; cursor: pointer; transition: var(--transition); font-family: 'Cairo', sans-serif; box-shadow: 0 4px 15px rgba(249, 115, 22, 0.3); }
.btn-submit-modern:hover { background: var(--orange-hover); transform: translateY(-3px); box-shadow: 0 6px 20px rgba(249, 115, 22, 0.5); }

/* ================= الفوتر ================= */
.site-footer { background: var(--navy-dark); color: #cbd5e1; padding: 60px 0 20px; border-top: 4px solid var(--orange-cta); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px; margin-bottom: 40px; }
.footer-widget h3 { color: var(--white); font-size: 20px; margin-bottom: 20px; padding-bottom: 10px; border-bottom: 2px solid var(--navy-light); display: inline-block; }
.footer-widget ul { list-style: none; }
.footer-widget ul li { margin-bottom: 12px; }
.footer-widget ul a { color: #cbd5e1; text-decoration: none; transition: var(--transition); }
.footer-widget ul a:hover { color: var(--orange-cta); padding-right: 5px; }
.footer-bottom { text-align: center; padding-top: 20px; border-top: 1px solid var(--navy-light); font-size: 14px; }

/* ================= محرك البحث (الدائرة المتمددة) ================= */
.inline-search-container {
    position: relative;
    width: 45px;
    height: 45px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0 10px;
    border-radius: 45px;
}
.inline-search-container.active { width: 250px; }

.inline-search-input {
    width: 100%;
    height: 100%;
    border-radius: 45px;
    border: 2px solid transparent;
    padding: 0 45px 0 0; 
    font-family: 'Cairo', sans-serif;
    font-size: 0.95rem;
    background-color: #f0f0f0;
    outline: none;
    color: transparent;
    transition: all 0.4s ease;
    cursor: pointer;
}

.inline-search-input::placeholder { color: transparent; }

.inline-search-container.active .inline-search-input {
    border-color: var(--orange-cta, #ff6b00);
    background-color: #ffffff;
    padding: 0 45px 0 15px;
    color: #2c3e50;
    cursor: text;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.inline-search-container.active .inline-search-input::placeholder { color: #aaa; }

.inline-search-btn {
    position: absolute;
    right: 0;
    top: 0;
    width: 45px;
    height: 45px;
    background: transparent;
    border: none;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.3s ease;
    z-index: 2;
}

.inline-search-container.active .inline-search-btn { color: var(--orange-cta, #ff6b00); }

.inline-results-box {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 250px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    z-index: 1000;
    display: none; 
    overflow: hidden;
    border: 1px solid #eee;
}

a { color: var(--orange-cta); }

/* حجز مساحة للأقسام لمنع الاهتزاز CLS */
#latest-posts-container, #latest-reviews-container { min-height: 350px; }

/* ================= الردسبونسف (شاشات الموبايل والتابلت) ================= */
/* 🌟 التابلت والشاشات المتوسطة */
@media (max-width: 992px) {
    .review-layout { grid-template-columns: 1fr; } 
    .contact-grid-modern { grid-template-columns: 1fr; margin-top: 0; }
    .contact-info-premium { order: 2; }
    .contact-form-premium { order: 1; padding: 25px; }
    .reviews-grid, .blog-grid, .related-grid, .review-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); /* ترتيب البطاقات بالتابلت */
        gap: 20px;
    }
}

/* 🌟 الموبايل والتابلت الصغير */
@media (max-width: 768px) {
    .header-flex { flex-direction: row !important; justify-content: space-between !important; align-items: center !important; }
    .menu-toggle { display: flex; }
    
    .main-nav {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--navy-dark);
        border-top: 1px solid var(--navy-light);
        display: none;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    }
    
    .main-nav.show { display: block !important; }
    .main-nav ul { flex-direction: column !important; gap: 0 !important; padding: 0; }
    .main-nav ul li { width: 100%; text-align: center; }
    .main-nav a { display: block; padding: 15px; font-size: 16px; border-bottom: 1px solid var(--navy-light); }
    .main-nav ul li:last-child a { border-bottom: none; }
    .main-nav a.active::after { display: none; }

    .hero { padding: 60px 0; }
    .btn-primary { width: 100%; max-width: 300px; display: block; margin: 0 auto; }
    .filter-buttons { flex-direction: column; align-items: center; }
    .filter-btn { width: 100%; max-width: 300px; }
    
    .reviews-grid, .blog-grid, .related-grid, .review-grid { grid-template-columns: 1fr; gap: 20px; }
    
    .footer-grid { text-align: center; grid-template-columns: 1fr; gap: 30px; }
    .footer-widget h3::after { left: 50%; transform: translateX(-50%); }

    /* تعديلات محرك البحث بالموبايل */
    .inline-search-container.active { width: 100%; margin: 15px 0 0 0; order: 3; }
    .inline-results-box { width: 100%; }

    /* تعديلات الصورة بالموبايل */
    .page-image-wrapper { margin: 20px auto; border-radius: 12px; }
    .page-image-wrapper img { max-height: 250px; }
}

/* 🌟 الشاشات الصغيرة جداً */
@media (max-width: 480px) {
    .container { padding: 0 15px; }
    .section-header h2 { font-size: 28px; }
    .hero h1 { font-size: 32px; }
    .review-content, .page-content, .contact-form-premium, .contact-info-premium { padding: 20px; }
    .form-row { grid-template-columns: 1fr; gap: 15px; }
    .card-img-wrapper, .card-image-wrapper { height: 180px; }
    .card-img, .blog-card-img, .review-card-img { height: 180px; }
    .page-image-wrapper img { max-height: 200px; }
}       