/* Search page — hero, results list/grid, filters, dark mode */

.search-page {
    --search-ink: #2C123D;
    --search-accent: #A54A7B;
    --search-muted: #5a5a6e;
    --search-bg: #f5f5f7;
    --search-card: #ffffff;
    --search-border: rgba(44, 18, 61, 0.08);
}

.search-page .list-hero {
    background: linear-gradient(135deg, #2C123D 0%, #7a3d62 50%, #A54A7B 100%);
    color: #fff;
    text-align: center;
    position: relative;
    z-index: 50;
    overflow: visible;
}

.search-page .search-hero-form,
.search-page .search-input-outer {
    position: relative;
    overflow: visible;
}

.search-page .list-hero-title,
.search-page .list-hero-subtitle,
.search-page .list-hero-title .lang-ar,
.search-page .list-hero-title .lang-en,
.search-page .list-hero-subtitle .lang-ar,
.search-page .list-hero-subtitle .lang-en {
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
}

.search-page .list-hero-title {
    font-size: clamp(1.85rem, 4vw, 2.5rem);
    font-weight: 800;
    margin-bottom: 12px;
    line-height: 1.2;
}

.search-page .list-hero-subtitle {
    font-size: 1.05rem;
    line-height: 1.65;
    opacity: 0.95;
    margin-bottom: 0;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

.search-page .list-hero-content.list-hero-toolbar {
    max-width: 920px;
    margin: 0 auto;
}

.search-page .catalog-toolbar-row {
    margin-top: 24px;
}

.search-page .search-hero-form {
    max-width: 720px;
    margin: 28px auto 0;
    width: 100%;
}

.search-page .search-input-outer {
    position: relative;
    width: 100%;
}

.search-page .search-input-wrapper {
    display: flex;
    align-items: stretch;
    gap: 0;
    background: rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    padding: 5px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.22);
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.search-page .search-input-wrapper:focus-within {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.45);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

.search-page .search-icon {
    display: flex;
    align-items: center;
    padding: 0 16px;
    color: rgba(255, 255, 255, 0.92);
    font-size: 1rem;
}

.search-page .search-input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    padding: 12px 8px;
    color: #fff;
    font-size: 1rem;
    outline: none;
    font-weight: 500;
}

.search-page .search-input::placeholder {
    color: rgba(255, 255, 255, 0.72);
}

.search-page .search-clear-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
}

.search-page .search-clear-btn.is-visible {
    display: flex;
}

.search-page .search-clear-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.search-page .search-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    color: var(--search-ink);
    border: none;
    padding: 0 22px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.search-page .search-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.search-page #searchLiveDropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 1000;
    margin-top: 10px;
    max-height: min(360px, 55vh);
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(44, 18, 61, 0.18), 0 0 0 1px rgba(44, 18, 61, 0.06);
    border: 1px solid rgba(165, 74, 123, 0.12);
    padding: 8px 0;
    background: #fff;
}

.search-page #searchLiveDropdown.is-open {
    display: block;
}

.search-page.search-dropdown-open .list-hero {
    padding-bottom: 24px;
}

.search-content {
    padding: 48px 20px 64px;
    min-height: 50vh;
}

.search-results-bar {
    max-width: 920px;
    margin: 0 auto 28px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.search-results-count {
    font-size: 1.05rem;
    color: var(--search-muted);
    margin: 0;
    line-height: 1.6;
    flex: 1 1 240px;
}

.search-results-count strong {
    color: var(--search-ink);
    font-weight: 700;
}

.search-results-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.search-view-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0;
    height: 40px;
    background: var(--search-card);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--search-border);
}

.search-view-switcher .search-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 32px;
    padding: 0 14px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--search-muted);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.search-view-switcher .search-view-btn.active {
    background: linear-gradient(135deg, #2C123D, #A54A7B);
    color: #fff;
}

.search-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 920px;
    margin: 0 auto 24px;
}

.search-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--search-border);
    background: var(--search-card);
    color: var(--search-ink);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-filter-chip:hover {
    border-color: var(--search-accent);
}

.search-filter-chip.active {
    background: linear-gradient(135deg, #2C123D, #A54A7B);
    color: #fff;
    border-color: transparent;
}

.search-filter-chip .chip-count {
    background: rgba(0, 0, 0, 0.08);
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 0.75rem;
}

.search-filter-chip.active .chip-count {
    background: rgba(255, 255, 255, 0.22);
}

.search-view {
    max-width: 920px;
    margin: 0 auto;
    animation: searchFadeIn 0.35s ease;
}

@keyframes searchFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.search-group {
    margin-bottom: 32px;
}

.search-group.is-hidden {
    display: none;
}

.search-group-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--search-ink);
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--search-accent);
}

.search-group-title i {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2C123D, #A54A7B);
    color: #fff;
    font-size: 0.9rem;
}

.search-result-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.search-result-item {
    display: block;
}

.search-result-item.is-hidden {
    display: none;
}

.search-result-link {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    background: var(--search-card);
    border: 1px solid var(--search-border);
    border-radius: 14px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
}

.search-result-link:hover {
    border-color: var(--search-accent);
    box-shadow: 0 8px 28px rgba(165, 74, 123, 0.14);
    transform: translateY(-2px);
    text-decoration: none;
    color: inherit;
}

.search-result-icon {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2C123D, #A54A7B);
    color: #fff;
    font-size: 1.25rem;
}

.search-result-body {
    flex: 1;
    min-width: 0;
}

.search-result-link .search-result-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.search-result-link .search-result-title,
.search-result-link .search-result-excerpt {
    display: block;
}

.search-result-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.search-result-type {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--search-accent);
}

.search-result-category {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(165, 74, 123, 0.1);
    color: var(--search-accent);
}

.search-result-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--search-ink);
    margin: 0 0 6px;
    line-height: 1.35;
}

.search-result-excerpt {
    font-size: 0.9rem;
    color: var(--search-muted);
    margin: 0;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-result-chevron {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(165, 74, 123, 0.08);
    color: var(--search-accent);
    transition: background 0.2s, transform 0.2s;
}

.search-result-link:hover .search-result-chevron {
    background: var(--search-accent);
    color: #fff;
}

html[dir="ltr"] .search-result-link:hover .search-result-chevron {
    transform: translateX(3px);
}

html[dir="rtl"] .search-result-link:hover .search-result-chevron {
    transform: translateX(-3px);
}

.search-highlight {
    background: rgba(165, 74, 123, 0.18);
    color: inherit;
    padding: 0 2px;
    border-radius: 3px;
    font-weight: 700;
}

/* Grid view */
.search-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.search-grid-card {
    background: var(--search-card);
    border: 1px solid var(--search-border);
    border-radius: 16px;
    padding: 22px;
    transition: border-color 0.22s, box-shadow 0.22s, transform 0.22s;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.search-grid-card.is-hidden {
    display: none;
}

.search-grid-card:hover {
    border-color: var(--search-accent);
    box-shadow: 0 12px 32px rgba(165, 74, 123, 0.15);
    transform: translateY(-4px);
}

.search-grid-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.search-grid-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2C123D, #A54A7B);
    color: #fff;
    font-size: 1.1rem;
}

.search-grid-card .search-result-title {
    font-size: 1rem;
    margin-bottom: 10px;
}

.search-grid-card .search-result-title a {
    color: inherit;
    text-decoration: none;
}

.search-grid-card .search-result-title a:hover {
    color: var(--search-accent);
}

.search-grid-card .search-result-excerpt {
    flex: 1;
    margin-bottom: 16px;
    -webkit-line-clamp: 3;
}

.search-grid-card-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--search-accent);
    text-decoration: none;
}

.search-grid-card-action:hover {
    color: var(--search-ink);
}

/* Empty / prompt states */
.search-empty-state,
.search-prompt-state {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
    padding: 48px 20px;
}

.search-empty-icon,
.search-prompt-icon {
    width: 88px;
    height: 88px;
    margin: 0 auto 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(165, 74, 123, 0.1);
    color: var(--search-accent);
    font-size: 2rem;
}

.search-empty-state h2,
.search-prompt-state h2 {
    font-size: clamp(1.4rem, 3vw, 1.85rem);
    font-weight: 800;
    color: var(--search-ink);
    margin: 0 0 12px;
}

.search-empty-state p,
.search-prompt-state > p {
    color: var(--search-muted);
    font-size: 1rem;
    line-height: 1.7;
    margin: 0 0 12px;
}

.search-suggestions,
.search-popular-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 24px;
}

.search-suggestion-link,
.search-popular-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid var(--search-border);
    background: var(--search-card);
    color: var(--search-ink);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.search-suggestion-link:hover,
.search-popular-tag:hover {
    background: linear-gradient(135deg, #2C123D, #A54A7B);
    color: #fff;
    border-color: transparent;
    text-decoration: none;
}

.search-browse-categories {
    max-width: 920px;
    margin: 40px auto 0;
}

.search-browse-categories h3 {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--search-ink);
    margin-bottom: 18px;
}

.search-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.search-category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px 12px;
    background: var(--search-card);
    border: 1px solid var(--search-border);
    border-radius: 14px;
    text-decoration: none;
    color: var(--search-ink);
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    transition: all 0.22s ease;
}

.search-category-card i {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2C123D, #A54A7B);
    color: #fff;
    font-size: 1rem;
}

.search-category-card:hover {
    border-color: var(--search-accent);
    box-shadow: 0 8px 24px rgba(165, 74, 123, 0.12);
    transform: translateY(-3px);
    color: var(--search-ink);
    text-decoration: none;
}

/* Dark mode */
html[data-theme="dark"] .search-page {
    --search-ink: #f0f0f0;
    --search-muted: #b0b0b0;
    --search-bg: #1a1a1e;
    --search-card: #252529;
    --search-border: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .search-page .list-hero {
    background: linear-gradient(135deg, #1a0a26 0%, #4a1a3d 50%, #5c2d4a 100%) !important;
}

html[data-theme="dark"] .search-page .list-hero-title,
html[data-theme="dark"] .search-page .list-hero-subtitle,
html[data-theme="dark"] .search-page .list-hero-title .lang-ar,
html[data-theme="dark"] .search-page .list-hero-title .lang-en,
html[data-theme="dark"] .search-page .list-hero-subtitle .lang-ar,
html[data-theme="dark"] .search-page .list-hero-subtitle .lang-en {
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
}

html[data-theme="dark"] .search-page #searchLiveDropdown {
    background: linear-gradient(180deg, #252529 0%, #1e1e22 100%);
    border-color: rgba(165, 74, 123, 0.25);
}

html[data-theme="dark"] .search-highlight {
    background: rgba(165, 74, 123, 0.35);
    color: #fff;
}

html[data-theme="dark"] .search-view-switcher {
    background: #252529;
}

html[data-theme="dark"] .search-result-link:hover,
html[data-theme="dark"] .search-grid-card:hover,
html[data-theme="dark"] .search-category-card:hover {
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
}

@media (max-width: 768px) {
    .search-content {
        padding: 32px 16px 48px;
    }

    .search-page .search-input-wrapper {
        flex-wrap: wrap;
        border-radius: 12px;
    }

    .search-page .search-submit-btn {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
        border-radius: 10px;
    }

    .search-result-link {
        padding: 14px;
        gap: 12px;
    }

    .search-result-icon {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }

    .search-result-chevron {
        display: none;
    }

    .search-results-grid {
        grid-template-columns: 1fr;
    }
}
