/* Global search modal (all templates) */
.np-search-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.np-search-modal {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: none;
    background: rgba(8, 14, 25, 0.56);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.np-search-modal.is-open {
    display: block;
}

.np-search-panel {
    position: absolute;
    inset: 0;
    overflow: auto;
    background:
        radial-gradient(1200px 420px at 50% -140px, color-mix(in srgb, var(--primary-color) 24%, transparent), transparent 70%),
        linear-gradient(180deg, #fbfcff 0%, #f4f6fb 100%);
    color: #0f172a;
}

.np-search-shell {
    width: min(1120px, 96vw);
    margin: 0 auto;
    min-height: 100dvh;
    padding: 26px 0 48px;
    display: flex;
    flex-direction: column;
}

.np-search-head {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-height: 36px;
}

.np-search-close {
    border: 1px solid color-mix(in srgb, var(--primary-dark) 25%, transparent);
    background: #fff;
    color: var(--primary-darker);
    border-radius: 999px;
    min-width: 38px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.np-search-close:hover {
    background: color-mix(in srgb, var(--primary-color) 10%, #fff);
}

.np-search-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.np-search-form-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: flex .35s ease, padding .35s ease, transform .35s ease;
}

.np-search-form {
    width: min(760px, 100%);
}

.np-search-input-wrap {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
}

.np-search-input {
    height: 56px;
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, var(--primary-dark) 18%, transparent);
    background: #fff;
    color: #111827;
    font-size: 1.05rem;
    padding: 0 18px;
    outline: none;
}

.np-search-input:focus {
    border-color: color-mix(in srgb, var(--primary-color) 65%, #ffffff);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 16%, transparent);
}

.np-search-submit {
    height: 56px;
    min-width: 56px;
    border-radius: 14px;
    border: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark-medium) 55%, var(--primary-medium) 100%);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.np-search-submit:hover {
    filter: brightness(1.04);
}

.np-search-meta {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transform: translateY(10px);
    transition: opacity .24s ease, max-height .24s ease, transform .24s ease, margin .24s ease;
    margin-top: 0;
}

.np-search-modal.is-submitted .np-search-form-wrap {
    flex: 0;
    align-items: flex-start;
    justify-content: stretch;
    padding-top: 12px;
}

.np-search-modal.is-submitted .np-search-meta {
    opacity: 1;
    max-height: 60px;
    transform: translateY(0);
    margin-top: 10px;
}

.np-search-meta-line {
    color: #334155;
    font-weight: 700;
    font-size: .96rem;
}

.np-search-filters {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.np-search-filter {
    border: 1px solid color-mix(in srgb, var(--primary-dark) 20%, transparent);
    background: #ffffff;
    color: #334155;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: .82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s ease;
}

.np-search-filter:hover {
    background: color-mix(in srgb, var(--primary-color) 8%, #fff);
    color: var(--primary-darker);
}

.np-search-filter.is-active {
    border-color: transparent;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark-medium) 55%, var(--primary-medium) 100%);
    color: #fff;
    box-shadow: 0 8px 18px color-mix(in srgb, var(--primary-darker) 24%, transparent);
}

.np-search-results {
    padding-top: 18px;
}

.np-search-state {
    margin-top: 8px;
    color: #64748b;
    font-weight: 600;
}

.np-search-grid {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.np-search-card {
    border: 1px solid color-mix(in srgb, var(--primary-dark) 10%, transparent);
    background:
        linear-gradient(180deg, #ffffff 0%, #fdfefe 100%);
    border-radius: 14px;
    padding: 14px 14px 13px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.np-search-card:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--primary-color) 32%, transparent);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
}

.np-search-card-type {
    display: inline-flex;
    align-self: flex-start;
    font-size: .74rem;
    font-weight: 700;
    color: var(--primary-darker);
    border: 1px solid color-mix(in srgb, var(--primary-color) 26%, transparent);
    background: color-mix(in srgb, var(--primary-color) 10%, #ffffff);
    border-radius: 999px;
    padding: 4px 9px;
}

.np-search-card-title {
    margin: 0;
    font-size: 1rem;
    line-height: 1.35;
    color: #0f172a;
}

.np-search-card-snippet {
    margin: 0;
    color: #475569;
    line-height: 1.45;
}

.np-search-card-meta {
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #64748b;
    font-size: .8rem;
    font-weight: 600;
}

.np-search-card-meta-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 22px;
    border-radius: 999px;
    padding: 0 8px;
    border: 1px solid color-mix(in srgb, var(--primary-color) 25%, transparent);
    background: color-mix(in srgb, var(--primary-color) 8%, #fff);
    color: var(--primary-darker);
    text-transform: uppercase;
    font-size: .72rem;
}

.np-search-card-link {
    margin-top: auto;
    align-self: flex-start;
    text-decoration: none;
    font-weight: 700;
    color: var(--primary-dark);
    border-bottom: 1px dashed color-mix(in srgb, var(--primary-color) 46%, transparent);
}

.np-search-more {
    margin: 16px auto 0;
    border: 1px solid color-mix(in srgb, var(--primary-dark) 25%, transparent);
    background: #fff;
    color: var(--primary-darker);
    border-radius: 999px;
    padding: 10px 18px;
    cursor: pointer;
    font-weight: 700;
}

.np-search-more:hover {
    background: color-mix(in srgb, var(--primary-color) 10%, #fff);
}

body.np-search-open {
    overflow: hidden;
}

body.np-dir-rtl .np-search-shell,
body[dir="rtl"] .np-search-shell {
    direction: rtl;
}

body.np-dir-rtl .np-search-head,
body[dir="rtl"] .np-search-head {
    justify-content: flex-start;
}

@media (max-width: 980px) {
    .np-search-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .np-search-shell {
        width: min(640px, 94vw);
    }
    .np-search-grid {
        grid-template-columns: 1fr;
    }
    .np-search-input-wrap {
        grid-template-columns: 1fr;
    }
    .np-search-submit {
        width: 100%;
    }
}
