/* search-page.css — بوابة الوحدة العربية */

/* ── كارد النموذج ── */
.search-form {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #eee;
}

/* ── الصف الأول: input + زر بحث ── */
.sf-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.sf-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 46px !important;
    font-size: 15px;
    border-radius: 10px !important;
    border: 2px solid #e0e0e0 !important;
    box-shadow: none !important;
}
.sf-input:focus {
    border-color: #CC0000 !important;
    box-shadow: 0 0 0 3px rgba(204,0,0,0.08) !important;
}

.sf-btn-search {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    padding: 0;
    border-radius: 10px !important;
    background: #CC0000 !important;
    border-color: #CC0000 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
}
.sf-btn-search:hover { background: #960000 !important; border-color: #960000 !important; }

/* ── الصف الثاني: أزرار النوع ── */
.sf-type-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sf-type-btn {
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 25px;
    border: 2px solid #e0e0e0;
    background: #fff;
    color: #555;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    white-space: nowrap;
    text-align: center;
}
.sf-type-btn input[type="radio"] { display: none; }
.sf-type-btn:hover { border-color: #CC0000; color: #CC0000; }
.sf-type-btn.active {
    background: #CC0000;
    border-color: #CC0000;
    color: #fff;
    box-shadow: 0 3px 10px rgba(204,0,0,0.2);
}

/* ── ملخص النتائج ── */
.search-results-title { font-size: 20px; font-weight: 700; }
.search-term { color: #CC0000; font-style: italic; }

.related-searches {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}
.related-searches .badge-secondary {
    display: inline-block;
    padding: 5px 13px;
    border-radius: 20px;
    background: #f0f0f0;
    color: #444;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid #e0e0e0;
    white-space: nowrap;
    transition: all 0.2s;
}
.related-searches .badge-secondary:hover { background: #CC0000; color: #fff; }

/* ── التبويبات ── */
.search-results-tabs .nav-tabs {
    border-bottom: 2px solid #eee;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 2px;
}
.search-results-tabs .nav-tabs::-webkit-scrollbar { display: none; }
.search-results-tabs .nav-link {
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    color: #666;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 16px;
    white-space: nowrap;
    margin-bottom: -2px;
}
.search-results-tabs .nav-link:hover { color: #CC0000; background: transparent; }
.search-results-tabs .nav-link.active { color: #CC0000; border-bottom-color: #CC0000; background: transparent; }

/* ── بطاقات النتائج ── */
.search-result-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #eee;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    transition: all 0.3s;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}
.search-result-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); border-color: #CC0000; }

.search-result-img { position: relative; height: 200px; overflow: hidden; flex-shrink: 0; }
.search-result-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.search-result-card:hover .search-result-img img { transform: scale(1.05); }

.search-result-category {
    position: absolute; bottom: 10px; right: 10px;
    background: #CC0000; color: #fff;
    font-size: 11px; font-weight: 700;
    padding: 4px 12px; border-radius: 20px;
    /* مهم: لا تمتد بعرض البطاقة */
    width: auto !important;
    display: inline-block;
}

.search-result-content { padding: 15px; flex: 1; display: flex; flex-direction: column; }

.search-result-title {
    font-size: 15px; font-weight: 700; line-height: 1.5; margin-bottom: 8px;
    display: -webkit-box;
    display: box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    box-orient: vertical;
    overflow: hidden;
}
.search-result-title a { color: #111; text-decoration: none; }
.search-result-title a:hover { color: #CC0000; }
.search-result-title mark,
.search-result-excerpt mark { background: rgba(204,0,0,0.12); color: #CC0000; border-radius: 3px; padding: 0 2px; }

.search-result-excerpt {
    font-size: 13px; color: #666; line-height: 1.65; margin-bottom: 10px; flex: 1;
    display: -webkit-box;
    display: box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    box-orient: vertical;
    overflow: hidden;
}

.search-result-meta {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    font-size: 12px; color: #999;
    padding-top: 10px; border-top: 1px solid #f0f0f0; margin-top: auto;
}
.search-result-meta span { display: flex; align-items: center; gap: 4px; }
.search-result-meta i { color: #CC0000; font-size: 11px; }

/* ── ترقيم الصفحات ── */
.page-link { border-radius: 8px; font-weight: 600; color: #444; }
.page-link:hover { background: rgba(204,0,0,0.08); border-color: #CC0000; color: #CC0000; }
.page-item.active .page-link { background: #CC0000; border-color: #CC0000; }

/* قائمة النتائج الموحدة (لكل الشاشات) */

/* ====== موبايل: فلاتر البحث صفين ====== */
@media (max-width: 767px) {
    .search-form .row.g-3.align-items-end {
        display: flex;
        flex-wrap: wrap;
    }
    /* البحث وزر البحث في الصف الأول */
    .search-form .col-lg-4, .search-form .col-lg-2 {
        width: 100%;
        max-width: 100%;
        margin-bottom: 10px;
    }
    .search-form .col-lg-4 { order: 1; }
    .search-form .col-lg-2 { order: 2; }
    /* الدولة والفئة في الصف الثاني جنبًا إلى جنب */
    .search-form .col-lg-3 {
        width: 50%;
        max-width: 50%;
        margin-bottom: 0;
    }
    .search-form .col-lg-3:nth-of-type(2) { order: 3; }
    .search-form .col-lg-3:nth-of-type(3) { order: 3; }
    /* تباعد بسيط بين القائمتين */
    .search-form .col-lg-3:first-of-type { padding-right: 5px; }
    .search-form .col-lg-3:last-of-type { padding-left: 5px; }
}

.results-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border-radius: 9px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 16px 18px;
    margin-bottom: 14px;
    transition: box-shadow 0.2s, background 0.2s;
    border: 1px solid #f0f0f0;
    position: relative;
}
.result-item:hover {
    background: #f8f8fc;
    box-shadow: 0 4px 16px rgba(204,0,0,0.09);
}
.result-type-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 5px 13px;
    border-radius: 15px;
    color: #fff;
    margin-left: 5px;
    min-width: 56px;
    text-align: center;
    display: inline-block;
    letter-spacing: 0.3px;
}
.result-type-news     { background: #CC0000; }
.result-type-document { background: #007bff; }
.result-type-study    { background: #28a745; }
.result-title {
    font-size: 16px;
    font-weight: 700;
    color: #222;
    text-decoration: none;
    margin-right: 10px;
    flex: 1;
    transition: color 0.2s;
}
.result-title:hover { color: #CC0000; text-decoration: underline; }
.result-date {
    font-size: 12px;
    color: #888;
    margin-right: 10px;
    min-width: 70px;
    text-align: left;
    font-family: Tahoma, Arial, sans-serif;
}

/* ══════════════════════════════
   موبايل
   ══════════════════════════════ */
@media (max-width: 767px) {
    .sf-type-row { display: none !important; }

    .search-form { padding: 14px; }

    /* الصف الأول: صندوق البحث + زر العدسة */
    .sf-input-row {
        display: flex;
        gap: 8px;
        margin-bottom: 15px; /* مسافة فاصلة واضحة */
    }
    .sf-input { height: 42px !important; font-size: 14px; }
    .sf-btn-search { height: 42px; width: 42px; flex: 0 0 42px; font-size: 15px; }

    /* الصف الثاني: أزرار النوع الأربعة في صف واحد */
    .sf-type-row {
        display: flex;
        gap: 7px;
        margin-bottom: 10px;
    }
    .sf-type-btn {
        flex: 1 1 25%;
        min-width: 0;
        font-size: 13px;
        padding: 9px 0;
        text-align: center;
        border-radius: 20px;
    }

    /* بطاقات النتائج — عرض كامل */
    .search-results-cards .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* الوسم — لا يمتد */
    .search-result-category {
        max-width: 60%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

}