/* ── Site Search Modal ─────────────────────────────────────────────────── */

/* Search trigger button in nav */
.nav-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text, #1e293b);
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
    flex-shrink: 0;
    padding: 0;
}
.nav-search-btn:hover {
    background: rgba(99, 102, 241, 0.10);
    color: #6161ff;
}
.main-nav.scrolled .nav-search-btn {
    color: #1e293b;
}
.main-nav:not(.scrolled) .nav-search-btn {
    color: #1a1a2e;
}
.nav-search-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: block;
}

/* ── Overlay backdrop ──────────────────────────────────────────────────── */
.search-overlay {
    position: fixed;
    inset: 0;
    background: rgba(7, 7, 26, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: clamp(60px, 12vh, 140px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}
.search-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* ── Search box container ──────────────────────────────────────────────── */
.search-box {
    width: 100%;
    max-width: 640px;
    margin: 0 16px;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 32px 80px rgba(7, 7, 26, 0.28), 0 0 0 1px rgba(99, 102, 241, 0.12);
    overflow: hidden;
    transform: translateY(-16px) scale(0.97);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.search-overlay.open .search-box {
    transform: translateY(0) scale(1);
}

/* ── Input row ─────────────────────────────────────────────────────────── */
.search-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(0,0,0,0.07);
}
.search-input-icon {
    flex-shrink: 0;
    color: #94a3b8;
}
.search-input-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: block;
}
#search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.08rem;
    font-family: 'DM Sans', sans-serif;
    color: #0f172a;
    background: transparent;
    line-height: 1.4;
}
#search-input::placeholder {
    color: #b0bec5;
}
.search-close-btn {
    flex-shrink: 0;
    background: rgba(0,0,0,0.05);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: #64748b;
    font-size: 0.8rem;
    font-family: 'DM Sans', monospace;
    padding: 4px 8px;
    transition: background 0.15s;
    line-height: 1;
}
.search-close-btn:hover {
    background: rgba(0,0,0,0.10);
}

/* ── Results list ──────────────────────────────────────────────────────── */
.search-results {
    max-height: 420px;
    overflow-y: auto;
    padding: 8px 0;
}
.search-results:empty + .search-empty { display: flex; }

.search-result-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 18px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    border-radius: 0;
    transition: background 0.12s;
}
.search-result-item:hover,
.search-result-item.active {
    background: rgba(99, 102, 241, 0.06);
}
.search-result-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}
.search-result-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: block;
}
/* Category color coding */
.sri-home    { background: rgba(99,102,241,0.10); color: #6161ff; }
.sri-product { background: rgba(16,185,129,0.10); color: #059669; }
.sri-services{ background: rgba(245,158,11,0.10); color: #d97706; }
.sri-case    { background: rgba(236,72,153,0.10); color: #db2777; }
.sri-company { background: rgba(14,165,233,0.10); color: #0284c7; }
.sri-contact { background: rgba(99,102,241,0.10); color: #6161ff; }
.sri-projects{ background: rgba(168,85,247,0.10); color: #9333ea; }

.search-result-body { flex: 1; min-width: 0; }
.search-result-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}
.search-result-desc {
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.search-result-cat {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #94a3b8;
    margin-top: 4px;
}

/* Highlighted match */
.search-result-title mark,
.search-result-desc mark {
    background: rgba(99,102,241,0.15);
    color: #4338ca;
    border-radius: 3px;
    padding: 0 2px;
}

/* ── Empty / no results ────────────────────────────────────────────────── */
.search-empty {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 36px 20px;
    color: #94a3b8;
    font-size: 0.92rem;
    gap: 8px;
}
.search-empty svg {
    width: 36px;
    height: 36px;
    stroke: #cbd5e1;
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    margin-bottom: 4px;
}

/* ── Footer hint ───────────────────────────────────────────────────────── */
.search-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    border-top: 1px solid rgba(0,0,0,0.06);
    background: #f8fafc;
}
.search-hint {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    color: #94a3b8;
}
.search-hint kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 0.7rem;
    font-family: 'DM Sans', sans-serif;
    color: #475569;
    line-height: 1.4;
}

/* ── Mobile adjustments ────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .search-overlay {
        padding-top: 0;
        align-items: flex-end;
    }
    .search-box {
        border-radius: 20px 20px 0 0;
        margin: 0;
        max-width: 100%;
        transform: translateY(20px);
    }
    .search-overlay.open .search-box {
        transform: translateY(0);
    }
    .search-results {
        max-height: 55vh;
    }
}

@media (max-width: 992px) {
    .nav-search-btn {
        display: flex;
    }
}
