/* search-modal.css — the header search icon and the search popup with its live
   results. Markup in header.php, behaviour in js/search-modal.js, settings and
   endpoint in inc/live-search.php. ADDED 2026-09-27, modelled on
   mimihospital.com's search popup, recoloured to this site's palette. */

.ah-search,
.ah-header .ah-tools {
    /* Brand values, repeated from the database CSS snippet (post 1061) and the
       page stylesheets so this file does not depend on a snippet that a
       files-only deploy never carries. */
    --ahs-teal: #17a99a;
    --ahs-teal-dark: #128a7e;
    --ahs-navy: #2c3d8f;
    --ahs-text: #2b3a3a;
    --ahs-muted: #6b7b7b;
    --ahs-border: #ebeeee;
    --ahs-tint: #f3faf9;
}

/* ---------- Header: icon + appointment + burger group ---------- */
.ah-header .ah-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.ah-header .ah-search-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--ahs-border);
    border-radius: 50%;
    background: #fff;
    color: var(--ahs-text);
    transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.ah-header .ah-search-toggle:hover,
.ah-header .ah-search-toggle:focus-visible {
    color: var(--ahs-teal);
    border-color: var(--ahs-teal);
    background: var(--ahs-tint);
}
.ah-header .ah-search-toggle svg,
.ah-search svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.ah-header .ah-search-toggle svg { width: 18px; height: 18px; }

/* Same height as the burger (42px, set in the database snippet) on the
   collapsed bar so the two line up. */
@media (max-width: 1199px) {
    .ah-header .ah-search-toggle { width: 42px; height: 42px; border-radius: 8px; }
}

/* ---------- Popup shell ---------- */
.ah-search {
    display: none;
    position: fixed;
    inset: 0;
    /* Above the sticky header (999) and the floating hotline button (99). */
    z-index: 100000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 90px 16px 40px;
}
/* :target is the no-JS route (the icon links to #ah-search); .is-open is
   the JS route, which never sets the hash. */
.ah-search.is-open,
.ah-search:target {
    display: block;
}

.ah-search__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(12, 28, 40, .62);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    cursor: default;
}

.ah-search__panel {
    position: relative;
    max-width: 680px;
    margin: 0 auto;
    padding: 40px 30px 30px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .22);
    animation: ahs-drop .25s ease;
}
@keyframes ahs-drop {
    from { transform: translateY(-30px); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

.ah-search__close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--ahs-muted);
    transition: color .2s ease, background .2s ease, transform .2s ease;
}
.ah-search__close:hover,
.ah-search__close:focus-visible {
    color: var(--ahs-navy);
    background: #f2f4f4;
    transform: rotate(90deg);
}
.ah-search__close svg { width: 20px; height: 20px; }

/* ---------- Search field ---------- */
.ah-search__form {
    display: flex;
    align-items: stretch;
    margin: 0;
    border: 2px solid #e0e4e4;
    border-radius: 10px;
    overflow: hidden;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.ah-search__form:focus-within {
    border-color: var(--ahs-teal);
    box-shadow: 0 0 0 3px rgba(23, 169, 154, .15);
}
.ah-search__input {
    flex: 1;
    min-width: 0;
    height: auto;
    margin: 0;
    padding: 15px 18px;
    border: 0;
    border-radius: 0;
    background: #fff;
    color: var(--ahs-text);
    font-size: 16px; /* 16px stops iOS zooming the page on focus */
    outline: none;
    box-shadow: none;
}
.ah-search__input::placeholder { color: #9aa6a6; }
.ah-search__submit {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    border: 0;
    background: var(--ahs-teal);
    color: #fff;
    cursor: pointer;
    transition: background .2s ease;
}
.ah-search__submit:hover,
.ah-search__submit:focus-visible { background: var(--ahs-teal-dark); }
.ah-search__submit svg { width: 20px; height: 20px; }

.ah-search__hint {
    min-height: 1.4em;
    margin: 8px 2px 0;
    color: var(--ahs-muted);
    font-size: 13px;
    line-height: 1.4;
}

/* ---------- Intro (shown until results arrive) ---------- */
.ah-search__intro {
    padding-top: 14px;
    text-align: center;
}
.ah-search.has-results .ah-search__intro { display: none; }
.ah-search__intro-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 76px;
    height: 76px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: var(--ahs-tint);
    color: var(--ahs-teal);
}
.ah-search__intro-icon svg { width: 32px; height: 32px; }
.ah-search__title {
    margin: 0 0 10px;
    color: var(--ahs-navy);
    font-size: 22px;
    font-weight: 700;
}
.ah-search__desc {
    max-width: 440px;
    margin: 0 auto;
    color: var(--ahs-muted);
    font-size: 15px;
    line-height: 1.6;
    text-align: center;
}

/* ---------- Results ---------- */
.ah-search__results:empty { display: none; }
.ah-search__results { margin-top: 10px; }

.ah-search__status {
    padding: 34px 10px;
    color: var(--ahs-muted);
    font-size: 15px;
    text-align: center;
}
.ah-search__status--loading::before {
    content: "";
    display: block;
    width: 28px;
    height: 28px;
    margin: 0 auto 12px;
    border: 3px solid #e3eeec;
    border-top-color: var(--ahs-teal);
    border-radius: 50%;
    animation: ahs-spin .7s linear infinite;
}
@keyframes ahs-spin { to { transform: rotate(360deg); } }

.ah-search__group {
    padding: 18px 0;
    border-bottom: 1px solid var(--ahs-border);
}
.ah-search__group:last-child { border-bottom: 0; padding-bottom: 0; }
.ah-search__group-title {
    margin: 0 0 12px;
    color: var(--ahs-navy);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.ah-search__more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    color: var(--ahs-teal);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}
.ah-search__more:hover { color: var(--ahs-teal-dark); text-decoration: underline; }
.ah-search__more::after { content: "\2192"; }

/* Doctor rows */
.ah-search__doctor {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 10px;
    background: #f8fafa;
    color: inherit;
    text-decoration: none;
    transition: background .2s ease, transform .2s ease;
}
.ah-search__doctor:hover,
.ah-search__doctor:focus-visible {
    background: var(--ahs-tint);
    transform: translateX(4px);
    color: inherit;
    text-decoration: none;
}
.ah-search__doctor img {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    object-position: top center;
    background: #eef4f6;
}
.ah-search__doctor-name {
    display: block;
    margin-bottom: 3px;
    color: var(--ahs-text);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
}
.ah-search__doctor-meta {
    display: block;
    color: var(--ahs-muted);
    font-size: 13px;
    line-height: 1.4;
}
.ah-search__doctor-dept {
    display: block;
    color: var(--ahs-teal);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.4;
}

/* Service tiles */
.ah-search__services {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 10px;
}
.ah-search__service {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    background: #f8fafa;
    color: var(--ahs-text);
    text-decoration: none;
    transition: background .2s ease, color .2s ease;
}
.ah-search__service:hover,
.ah-search__service:focus-visible {
    background: var(--ahs-teal);
    color: #fff;
    text-decoration: none;
}
.ah-search__service-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #fff;
    color: var(--ahs-teal);
}
.ah-search__service-icon svg { width: 22px; height: 22px; }
.ah-search__service-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}
.ah-search__service-cat {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    opacity: .75;
}

/* Page links */
.ah-search__pages {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.ah-search__page {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border: 1px solid var(--ahs-border);
    border-radius: 999px;
    background: #fff;
    color: var(--ahs-navy);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: border-color .2s ease, color .2s ease, background .2s ease;
}
.ah-search__page::after { content: "\2192"; color: #b8c4d2; }
.ah-search__page:hover,
.ah-search__page:focus-visible {
    border-color: var(--ahs-teal);
    background: var(--ahs-tint);
    color: var(--ahs-teal-dark);
    text-decoration: none;
}

/* Blog cards */
.ah-search__blogs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}
.ah-search__blog {
    display: block;
    padding: 16px;
    border-radius: 10px;
    background: #f8fafa;
    color: inherit;
    text-decoration: none;
    transition: background .2s ease, box-shadow .2s ease;
}
.ah-search__blog:hover,
.ah-search__blog:focus-visible {
    background: #fff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .09);
    color: inherit;
    text-decoration: none;
}
.ah-search__blog-date {
    display: block;
    margin-bottom: 8px;
    color: #98a3a3;
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.ah-search__blog-title {
    display: block;
    margin-bottom: 10px;
    color: var(--ahs-text);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
}
.ah-search__blog-more {
    color: var(--ahs-teal);
    font-size: 13px;
    font-weight: 600;
}

/* ---------- Small screens ---------- */
@media (max-width: 767px) {
    .ah-search { padding: 20px 10px 30px; }
    .ah-search__panel { padding: 50px 16px 20px; }
    .ah-search__title { font-size: 19px; }
    .ah-search__desc { font-size: 14px; }
    .ah-search__intro-icon { width: 64px; height: 64px; }
    .ah-search__services,
    .ah-search__blogs { grid-template-columns: 1fr; }
}

/* Page behind the open popup does not scroll. */
html.ah-search-lock,
html.ah-search-lock body { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
    .ah-search__panel,
    .ah-search__status--loading::before { animation: none; }
    .ah-header .ah-search-toggle,
    .ah-search__close,
    .ah-search__doctor,
    .ah-search__service,
    .ah-search__blog { transition: none; }
    .ah-search__close:hover,
    .ah-search__doctor:hover { transform: none; }
}
