/* ===========================
   Hero section
   =========================== */

.search-header {
    background: #e4f0ff;
    background-image: url('../images/hero-banner.webp');
    background-size: cover;
    background-position: center;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.search-hero-inner {
    max-width: 1180px;
    margin: 0 auto;
    min-height: 180px;
    padding: 28px 20px 32px;
    display: flex;
    align-items: center; /* وسط رأسي */
}

.search-hero-text {
    max-width: 620px;
    text-align: left;
}

.search-hero-text .page-title {
    margin: 0 0 6px;
    font-size: 2.1rem;
    font-weight: 700;
    color: #111827;
}

.search-hero-text .page-subtitle {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #4b5563;
}

/* ===========================
   General layout
   =========================== */

.search-page {
    background: #f3f4f6;
    padding: 24px 0 40px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #111827;
}

.search-container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 20px;
}

.search-filters-form {
    margin: 0;
}

/* ===========================
   Find + Search bar + related tags
   =========================== */

.search-main-controls {
    background: transparent;
}

/* صف من عمودين: 260px (نفس عرض السايدبار) + النتائج */
.search-controls-row {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    column-gap: 24px;
    row-gap: 8px;
    align-items: center;
}

/* العمود الأيسر (Find + select) بنفس عرض السايدبار بالضبط */
.search-scope-col {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 8px;
    align-items: center;
    max-width: 260px;
}

.search-hero-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
}

.search-scope-select {
    width: 100%;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    padding: 0.55rem 2.2rem 0.55rem 0.9rem;
    font-size: 0.95rem;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 2l4 4 4-4' stroke='%239CA3AF' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
    background-size: 12px 8px;
}

.search-scope-select:focus {
    border-color: #0f70b7;
    box-shadow: 0 0 0 1px rgba(15, 112, 183, 0.18);
}

/* العمود الأيمن (حقل البحث) */
.search-query-col {
    width: 100%;
    min-width: 0; /* مهم لمنع الـ overflow الأفقي */
}

.search-query-inner {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-input {
    flex: 1 1 auto;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    padding: 0.55rem 0.9rem;
    font-size: 0.95rem;
    outline: none;
    background: #ffffff;
}

.search-input:focus {
    border-color: #0f70b7;
    box-shadow: 0 0 0 1px rgba(15, 112, 183, 0.18);
}

.search-btn {
    flex: 0 0 auto;
    border: none;
    border-radius: 999px;
    padding: 0.6rem 1.6rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    background: linear-gradient(135deg, #0f70b7, #0a8adf);
    color: #ffffff;
    box-shadow: 0 8px 22px rgba(15, 112, 183, 0.3);
    white-space: nowrap;
}

.search-btn:hover {
    background: linear-gradient(135deg, #0d63a1, #0a7aca);
    box-shadow: 0 10px 26px rgba(15, 112, 183, 0.36);
}

/* related tags slider */

.related-tags-bar {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #4b5563;
}

.related-tags-label {
    font-weight: 600;
    white-space: nowrap;
    color: #6b7280;
}

.related-tags-slider {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0; /* مهم لمنع تمدد العنصر فوق مساحة الصفحة */
}

.related-tags-track {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    padding: 2px 4px;
    scroll-behavior: smooth;
}

.related-tags-track::-webkit-scrollbar {
    height: 4px;
}
.related-tags-track::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.related-tag-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.25rem 0.9rem;
    font-size: 0.8rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #374151;
    text-decoration: none;
    white-space: nowrap;
}

.related-tag-chip:hover {
    border-color: #0f70b7;
    color: #0f70b7;
}

.related-arrow {
    flex: 0 0 auto;
    border-radius: 999px;
    width: 26px;
    height: 26px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    cursor: pointer;
    color: #6b7280;
}

.related-arrow:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
}

/* ===========================
   Layout: sidebar + results
   =========================== */

.search-layout {
    margin-top: 22px;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    column-gap: 24px;
    align-items: flex-start;
}

.search-sidebar {
    align-self: flex-start;
}

.search-results {
    min-width: 0;
}

/* ===========================
   Sidebar filters - collapsible
   =========================== */

.filters-panel {
    background: #ffffff;
    border-radius: 18px;
    padding: 14px 14px 16px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.filters-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 10px;
}

.filters-header-icon {
    width: 18px;
    height: 18px;
}

/* block container (details أو div) */

.filter-block {
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    margin-bottom: 8px;
    overflow: hidden;
}

/* بلوك ثابت بدون collapse */
.filter-block-static .filter-block-header {
    cursor: default;
}

/* summary header */
.filter-block-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 9px;
    font-size: 0.86rem;
    font-weight: 600;
    color: #111827;
    list-style: none;
}

.filter-title-icon {
    width: 16px;
    height: 16px;
}

.filter-title-text {
    flex: 1 1 auto;
}

/* السهم الصغير في summary */
.filter-toggle-icon {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #6b7280;
}

.filter-toggle-icon::before {
    content: "▾";
}

/* body داخل البلوك */

.filter-block-body {
    padding: 4px 9px 8px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 2px;
    font-size: 0.84rem;
    color: #374151;
    cursor: pointer;
}

.filter-option input[type="radio"] {
    accent-color: #0f70b7;
    width: 14px;
    height: 14px;
}

.filter-option:hover {
    background: #eef2ff;
    border-radius: 8px;
}

/* details native arrow إخفاؤه */
.filter-block > summary {
    list-style: none;
}
.filter-block > summary::-webkit-details-marker {
    display: none;
}

/* زر apply */

.filter-apply-button {
    margin-top: 10px;
    width: 100%;
    border-radius: 999px;
    border: 1px solid #0f70b7;
    background: #0f70b7;
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #ffffff;
    cursor: pointer;
}

.filter-apply-button:hover {
    background: #0d63a1;
    border-color: #0d63a1;
}

/* ===========================
   Empty / no results messages
   =========================== */

.search-empty-message,
.search-no-results {
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid #e5e7eb;
    padding: 18px 18px;
    font-size: 0.92rem;
    color: #4b5563;
}

/* ===========================
   Results header + pagination
   =========================== */

.search-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.search-results-title {
    display: flex;
    align-items: center;
    gap: 6px;
}

.section-title-icon {
    width: 18px;
    height: 18px;
}

.search-section-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
}

.search-pagination-top {
    display: flex;
    justify-content: flex-end;
}

/* grid للأيقونات */

.icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 18px;
}

/* ===========================
   Pagination
   =========================== */

.pagination-nav {
    margin: 0;
}

.pagination-list {
    list-style: none;
    display: flex;
    gap: 4px;
    padding: 0;
    margin: 0;
}

.pagination-link,
.pagination-current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-size: 0.85rem;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #374151;
    text-decoration: none;
}

.pagination-current {
    background: #0f70b7;
    border-color: #0f70b7;
    color: #ffffff;
}

.pagination-link:hover {
    border-color: #0f70b7;
    color: #0f70b7;
}

.search-pagination-bottom {
    display: flex;
    justify-content: flex-end;
}

/* ===========================
   Next page row
   =========================== */

.search-next-row {
    margin-top: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.next-page-wrapper {
    flex: 0 0 auto;
}

.next-page-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.7rem;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    background: #2563eb;
    color: #ffffff;
    text-decoration: none;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.35);
}

.next-page-button:hover {
    filter: brightness(1.08);
}

/* ===========================
   Related packs / standalone
   =========================== */

.related-section {
    margin-top: 26px;
}

.related-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.related-title-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.related-view-all {
    font-size: 0.85rem;
    text-decoration: none;
    color: #2563eb;
}

.related-view-all:hover {
    text-decoration: underline;
}

.pack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.pack-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #ffffff;
    border-radius: 16px;
    padding: 12px 12px 14px;
    border: 1px solid #e5e7eb;
    text-decoration: none;
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.06);
}

.pack-card-title {
    margin: 0 0 4px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #111827;
}

.pack-card-excerpt {
    margin: 0;
    font-size: 0.84rem;
    line-height: 1.5;
    color: #4b5563;
}

.pack-card-meta {
    margin-top: 10px;
    font-size: 0.78rem;
    color: #6b7280;
}

/* ===========================
   Responsive
   =========================== */

@media (max-width: 992px) {
    .search-controls-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .search-scope-col {
        max-width: none;
        grid-template-columns: auto 1fr;
    }

    .search-layout {
        grid-template-columns: minmax(0, 1fr);
        row-gap: 18px;
    }

    .search-sidebar {
        order: 2;
    }

    .search-results {
        order: 1;
    }

    .search-pagination-top,
    .search-pagination-bottom {
        justify-content: center;
    }

    .search-next-row {
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .search-hero-inner {
        padding-inline: 16px;
        min-height: 160px;
    }

    .search-hero-text .page-title {
        font-size: 1.7rem;
    }

    .search-container {
        padding-inline: 14px;
    }

    .search-query-inner {
        flex-direction: column;
        align-items: stretch;
    }

    .search-btn {
        width: 100%;
        justify-content: center;
    }

    .related-tags-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-pagination-top,
    .search-pagination-bottom {
        justify-content: flex-start;
    }
}
