/* ─── NHS Custom Search v1.5 ──────────────────────────────────────────────── */

:root {
    --nhs-blue:      #005eb8;
    --nhs-blue-dk:   #003f7e;
    --nhs-blue-lt:   #e8f1fb;
    --nhs-green:     #007f3b;
    --nhs-text:      #1a1a2e;
    --nhs-muted:     #64748b;
    --nhs-border:    #e2e8f0;
    --nhs-radius:    10px;
    --nhs-shadow:    0 8px 30px rgba(0,0,0,0.14);
}

/* ─── Wrapper ─── */

.nhs-search-wrap { width: 100%; font-family: inherit; }

.nhs-search-bar-wrap {
    position: relative;
    max-width: 680px;
    margin: 0 auto;
}

/* ─── Input bar ─── */

.nhs-search-form { margin: 0; }

.nhs-search-input-wrap {
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid var(--nhs-blue);
    border-radius: 50px;
    box-shadow: 0 2px 12px rgba(0,94,184,0.18);
    transition: box-shadow .2s, border-color .2s;
    overflow: hidden;
}

.nhs-search-input-wrap:focus-within {
    box-shadow: 0 2px 20px rgba(0,94,184,0.32);
    border-color: var(--nhs-blue-dk);
}

.nhs-search-icon {
    width: 19px; height: 19px;
    margin: 0 8px 0 18px;
    color: var(--nhs-blue);
    flex-shrink: 0;
}

.nhs-search-input {
    flex: 1;
    border: none; outline: none;
    padding: 13px 6px;
    font-size: 15px;
    color: var(--nhs-text);
    background: transparent;
    min-width: 0;
}

.nhs-search-input::placeholder { color: #94a3b8; }

.nhs-search-clear {
    background: none; border: none;
    color: #94a3b8; font-size: 19px;
    padding: 0 6px; cursor: pointer; flex-shrink: 0;
    line-height: 1;
}
.nhs-search-clear:hover { color: var(--nhs-text); }

.nhs-search-btn {
    background: var(--nhs-blue);
    color: #fff; border: none;
    padding: 0 22px;
    min-height: 48px;
    font-size: 14px; font-weight: 700;
    cursor: pointer;
    border-radius: 0 50px 50px 0;
    transition: background .2s;
    white-space: nowrap; flex-shrink: 0;
}
.nhs-search-btn:hover { background: var(--nhs-blue-dk); }

/* ─── Dropdown ─── */

.nhs-search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0; right: 0;
    background: #fff;
    border: 1px solid var(--nhs-border);
    border-radius: var(--nhs-radius);
    box-shadow: var(--nhs-shadow);
    z-index: 99999;
    max-height: 480px;
    overflow-y: auto;
    animation: dd-in .13s ease;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 transparent;
}

@keyframes dd-in {
    from { opacity: 0; transform: translateY(-5px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Rows ─── */

.nhs-dd-row {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 10px 14px;
    text-decoration: none !important;
    color: var(--nhs-text) !important;
    border-bottom: 1px solid #f1f5f9;
    transition: background .1s;
}

.nhs-dd-row:last-child { border-bottom: none; }
.nhs-dd-row:hover { background: var(--nhs-blue-lt); }

/* Brand row — slightly highlighted */
.nhs-dd-brand {
    background: #f8faff;
    border-bottom: 2px solid var(--nhs-border) !important;
}
.nhs-dd-brand:hover { background: var(--nhs-blue-lt); }

/* ─── Logo ─── */

.nhs-dd-logo-wrap {
    width: 42px; height: 42px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: #f4f6f9;
    border-radius: 8px;
    border: 1px solid var(--nhs-border);
    overflow: hidden;
    margin-top: 2px; /* align with first line of wrapped text */
}

.nhs-dd-logo {
    max-width: 100%; max-height: 100%;
    object-fit: contain; display: block;
}

.nhs-dd-initial {
    font-size: 17px; font-weight: 800;
    color: var(--nhs-blue);
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: var(--nhs-blue-lt);
}

.nhs-dd-page-icon::before {
    content: '📄';
    font-size: 18px;
}

/* ─── Text body ─── */

.nhs-dd-body {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 3px;
}

.nhs-dd-title {
    font-size: 13px; font-weight: 600;
    color: var(--nhs-text);
    white-space: normal;
    word-break: break-word;
    display: block;
    line-height: 1.4;
}

.nhs-dd-brand .nhs-dd-title { font-size: 14px; }

.nhs-dd-sub {
    display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
    font-size: 11px; color: var(--nhs-muted);
}

/* ─── Badges ─── */

.nhs-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 20px;
    font-size: 10px; font-weight: 800;
    letter-spacing: .04em;
    flex-shrink: 0;
}

.nhs-badge-code  { background: #fef9c3; color: #854d0e; border: 1px solid #fcd34d; }
.nhs-badge-deal  { background: #dcfce7; color: #166534; border: 1px solid #86efac; }

/* ─── Code copy button ─── */

.nhs-copy-btn {
    background: var(--nhs-blue-lt);
    color: var(--nhs-blue-dk);
    border: 1px solid #bfdbfe;
    border-radius: 4px;
    padding: 1px 7px;
    font-size: 11px; font-weight: 700;
    cursor: pointer;
    font-family: monospace;
    letter-spacing: .04em;
    transition: background .15s, color .15s;
}
.nhs-copy-btn:hover,
.nhs-copy-btn.copied { background: var(--nhs-green); color: #fff; border-color: var(--nhs-green); }

/* ─── Expiry ─── */

.nhs-expiry { font-size: 11px; color: var(--nhs-muted); }

/* ─── Placeholder logo (no advertiser page yet) ─── */

.nhs-dd-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: #f1f5f9;
}
.nhs-dd-placeholder svg {
    width: 20px; height: 20px;
    color: #94a3b8;
}

/* ─── Direct affiliate offer (no page exists) ─── */

.nhs-dd-offer-direct {
    border-left: 3px solid #f59e0b;
}

/* ─── CTA label (replaces arrow for offers) ─── */

.nhs-dd-cta-label {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 700;
    color: var(--nhs-blue);
    white-space: nowrap;
    flex-shrink: 0;
    opacity: .7;
    transition: opacity .15s;
}
.nhs-dd-cta-label svg { width: 13px; height: 13px; }
.nhs-dd-row:hover .nhs-dd-cta-label { opacity: 1; }

/* ─── Arrow ─── */

.nhs-dd-arrow {
    flex-shrink: 0;
    color: var(--nhs-blue);
    opacity: .5;
    transition: opacity .15s, transform .15s;
}
.nhs-dd-arrow svg { width: 14px; height: 14px; display: block; }
.nhs-dd-row:hover .nhs-dd-arrow { opacity: 1; transform: translateX(2px); }

/* ─── Loading / empty ─── */

.nhs-dd-state {
    padding: 16px 18px;
    font-size: 13px;
    color: var(--nhs-muted);
    display: flex; align-items: center; gap: 10px;
}

.nhs-dd-empty { color: #64748b; }
.nhs-dd-empty strong { color: var(--nhs-text); }

.nhs-spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid var(--nhs-blue-lt);
    border-top-color: var(--nhs-blue);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Mobile ─── */

@media (max-width: 600px) {
    .nhs-search-input { font-size: 14px; padding: 11px 4px; }
    .nhs-search-icon  { margin: 0 6px 0 12px; width: 17px; height: 17px; }
    .nhs-search-btn   { padding: 0 14px; font-size: 13px; min-height: 44px; }
    .nhs-search-dropdown { max-height: 380px; }
    .nhs-dd-row { padding: 9px 12px; gap: 9px; }
    .nhs-dd-logo-wrap { width: 36px; height: 36px; }
    .nhs-dd-title { font-size: 12px; }
}
