/* Global nav search — icon button in .nav-right + command-palette modal.
 * The trigger button mirrors .theme-toggle; the modal is theme-aware and
 * reuses the profile-search type-badge palette for cross-profile results. */

/* ------------------------------------------------------------------ */
/* Trigger button (mirrors .theme-toggle)                              */
/* ------------------------------------------------------------------ */
.nav-search-toggle {
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border-light, rgba(255, 255, 255, 0.1));
    border-radius: 999px;
    color: var(--text-light, rgba(255, 255, 255, 0.72));
    background: rgba(255, 255, 255, 0.035);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.nav-search-toggle:hover,
.nav-search-toggle:focus-visible {
    color: var(--white, #fff);
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-mid, rgba(255, 255, 255, 0.2));
    outline: none;
}

.nav-search-toggle:active {
    transform: scale(0.97);
}

.nav-search-toggle svg {
    width: 1rem;
    height: 1rem;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

html[data-theme="light"] .nav-search-toggle {
    color: rgba(16, 24, 40, 0.72);
    background: rgba(16, 24, 40, 0.035);
    border-color: rgba(16, 24, 40, 0.12);
}

html[data-theme="light"] .nav-search-toggle:hover,
html[data-theme="light"] .nav-search-toggle:focus-visible {
    color: #101828;
    background: rgba(16, 24, 40, 0.075);
    border-color: rgba(16, 24, 40, 0.18);
}

/* The search icon lives in .nav-right, which mobile-nav.css keeps visible on
 * mobile (alongside the theme toggle and a compact "Demo" button). So show the
 * icon on wide desktop (>1100px) AND on mobile/tablet (<=1024px, sitting next
 * to the theme toggle). Hide it only in the narrow 1025-1100px band, where the
 * full desktop nav (6 links + Login + Book a demo) would otherwise be crowded. */
@media (min-width: 1025px) and (max-width: 1100px) {
    .nav-search-toggle {
        display: none;
    }
}

/* Match the theme toggle's smaller size on phones. */
@media (max-width: 768px) {
    .nav-search-toggle {
        width: 2rem;
        height: 2rem;
    }
}

/* ------------------------------------------------------------------ */
/* Command-palette modal                                              */
/* ------------------------------------------------------------------ */
.nav-search-modal {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 12vh 16px 16px;
    background: rgba(8, 11, 30, 0.55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.nav-search-modal.is-open {
    display: flex;
}

.nav-search-panel {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    max-height: 70vh;
    background: #0e1230;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    box-shadow: 0 32px 64px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: nav-search-pop 0.16s ease;
}

@keyframes nav-search-pop {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .nav-search-panel { animation: none; }
}

.nav-search-field {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-search-field .ns-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    color: rgba(255, 255, 255, 0.5);
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-search-input {
    flex: 1 1 auto;
    min-width: 0;
    border: none;
    background: transparent;
    color: var(--white, #fff);
    font: 500 1.0625rem/1.4 'DM Sans', system-ui, sans-serif;
    outline: none;
}

.nav-search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
    font-weight: 400;
}

.nav-search-esc {
    flex: 0 0 auto;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 6px;
    padding: 3px 7px;
    cursor: pointer;
    background: transparent;
}

.nav-search-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-search-filter {
    font: 600 0.75rem/1 'DM Sans', system-ui, sans-serif;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    padding: 5px 11px;
    cursor: pointer;
    transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.nav-search-filter:hover {
    color: var(--white, #fff);
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.18);
}

.nav-search-filter.is-active {
    color: #fff;
    background: #8b5cf6;
    border-color: #8b5cf6;
}

html[data-theme="light"] .nav-search-filters {
    border-bottom-color: rgba(16, 24, 40, 0.08);
}

html[data-theme="light"] .nav-search-filter {
    color: rgba(16, 24, 40, 0.6);
    background: rgba(16, 24, 40, 0.04);
    border-color: rgba(16, 24, 40, 0.1);
}

html[data-theme="light"] .nav-search-filter:hover {
    color: #101828;
    background: rgba(16, 24, 40, 0.07);
    border-color: rgba(16, 24, 40, 0.16);
}

html[data-theme="light"] .nav-search-filter.is-active {
    color: #fff;
    background: #8b5cf6;
    border-color: #8b5cf6;
}

.nav-search-results {
    overflow-y: auto;
    padding: 6px;
}

.nav-search-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--white, #fff);
    text-decoration: none;
    font-size: 0.9375rem;
    line-height: 1.3;
}

.nav-search-row:hover,
.nav-search-row.is-active {
    background: rgba(139, 92, 246, 0.16);
}

.nav-search-row .name {
    font-weight: 500;
    flex: 0 0 auto;
    max-width: 55%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-search-row .sub {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8125rem;
    flex: 1 1 0;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-search-row .type {
    flex-shrink: 0;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
}

.nav-search-row .type.t-investor   { background: rgba(245, 158, 11, 0.15);  color: #f59e0b; }
.nav-search-row .type.t-university { background: rgba(139, 92, 246, 0.15);  color: #a78bfa; }
.nav-search-row .type.t-sector     { background: rgba(59, 130, 246, 0.15);  color: #60a5fa; }
.nav-search-row .type.t-company    { background: rgba(59, 130, 246, 0.15);  color: #60a5fa; }
.nav-search-row .type.t-city       { background: rgba(16, 185, 129, 0.15);  color: #34d399; }
.nav-search-row .type.t-country    { background: rgba(236, 72, 153, 0.15);  color: #f472b6; }
.nav-search-row .type.t-region     { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }
.nav-search-row .type.t-person     { background: rgba(34, 211, 238, 0.15);  color: #67e8f9; }

.nav-search-empty {
    padding: 28px 16px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
    text-align: center;
}

.nav-search-cta {
    padding: 26px 20px 28px;
    text-align: center;
}

.ns-cta-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--white, #fff);
    margin-bottom: 6px;
}

.ns-cta-text {
    font-size: 0.85rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.55);
    max-width: 380px;
    margin: 0 auto 16px;
}

.ns-cta-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font: 600 0.85rem/1 'DM Sans', system-ui, sans-serif;
    color: #fff;
    background: #8b5cf6;
    border-radius: 999px;
    padding: 9px 18px;
    text-decoration: none;
    transition: background 0.15s ease, transform 0.15s ease;
}

.ns-cta-link:hover {
    background: #7c3aed;
    transform: translateY(-1px);
}

html[data-theme="light"] .ns-cta-title {
    color: #101828;
}

html[data-theme="light"] .ns-cta-text {
    color: rgba(16, 24, 40, 0.6);
}

.nav-search-hint {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.75rem;
}

.nav-search-hint kbd {
    font: 600 0.6875rem/1 'DM Sans', system-ui, sans-serif;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 5px;
    padding: 2px 5px;
    margin: 0 2px;
}

/* ------------------------------------------------------------------ */
/* Light-theme overrides                                             */
/* ------------------------------------------------------------------ */
html[data-theme="light"] .nav-search-modal {
    background: rgba(16, 24, 40, 0.32);
}

html[data-theme="light"] .nav-search-panel {
    background: #ffffff;
    border-color: rgba(16, 24, 40, 0.1);
    box-shadow: 0 32px 64px rgba(16, 24, 40, 0.18), 0 8px 24px rgba(16, 24, 40, 0.1);
}

html[data-theme="light"] .nav-search-field {
    border-bottom-color: rgba(16, 24, 40, 0.08);
}

html[data-theme="light"] .nav-search-field .ns-icon {
    color: rgba(16, 24, 40, 0.45);
}

html[data-theme="light"] .nav-search-input {
    color: #101828;
}

html[data-theme="light"] .nav-search-input::placeholder {
    color: rgba(16, 24, 40, 0.4);
}

html[data-theme="light"] .nav-search-esc {
    color: rgba(16, 24, 40, 0.55);
    border-color: rgba(16, 24, 40, 0.16);
}

html[data-theme="light"] .nav-search-row {
    color: #101828;
}

html[data-theme="light"] .nav-search-row:hover,
html[data-theme="light"] .nav-search-row.is-active {
    background: rgba(139, 92, 246, 0.1);
}

html[data-theme="light"] .nav-search-row .sub {
    color: rgba(16, 24, 40, 0.5);
}

html[data-theme="light"] .nav-search-row .type {
    background: rgba(16, 24, 40, 0.06);
    color: rgba(16, 24, 40, 0.6);
}

html[data-theme="light"] .nav-search-empty {
    color: rgba(16, 24, 40, 0.5);
}

html[data-theme="light"] .nav-search-hint {
    border-top-color: rgba(16, 24, 40, 0.08);
    color: rgba(16, 24, 40, 0.45);
}

html[data-theme="light"] .nav-search-hint kbd {
    color: rgba(16, 24, 40, 0.6);
    background: rgba(16, 24, 40, 0.05);
    border-color: rgba(16, 24, 40, 0.14);
}

/* On small viewports the modal still works if opened (e.g. via shortcut). */
@media (max-width: 600px) {
    .nav-search-modal { padding: 8vh 12px 12px; }
    .nav-search-row .sub { display: none; }
}
