/* Site içi arama: header autocomplete (.c-suggest) + /search sayfası (.c-search-*)
   Tasarım dili: filter.css (.c-filter) ile aynı renk/radius/gölge token'ları.
   Davranış: wwwroot/assets/scripts/search.js */

.c-suggest,
.c-search-page {
    --cs-ink: #17202b;
    --cs-muted: #6b7785;
    --cs-line: #e6eaef;
    --cs-soft: #f4f7fa;
    --cs-tint: #eaf2f9;
    --cs-brand: #005596;
    --cs-brand-dark: #003c6b;
    --cs-mark: #fff1b8;
}

.c-suggest mark,
.c-search-page mark {
    padding: 0 1px;
    border-radius: 3px;
    background: var(--cs-mark);
    color: inherit;
}

/* ===============================================================
   1) AUTOCOMPLETE
   =============================================================== */

/* ---------------------------------------------------------------
   Header input'u (.c-search-input.has-suggest: search.js ekler)
   Odakta filtre çubuğundaki gibi yumuşak halka; panel açıkken input
   ve panel tek bir kutu gibi birleşir (aradaki boşluk yok).
   --------------------------------------------------------------- */
.c-search-input.has-suggest {
    --cs-frame: #d9e4ee;
    --cs-brand: #005596;
    position: relative;
    z-index: 2;
}

.c-search-input.has-suggest .c-custom-input {
    border-color: #dedede;
    transition: border-color 0.2s, border-radius 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.c-search-input.has-suggest .c-custom-input:hover {
    border-color: #c9d6e2;
}

/* main.css odakta alt köşeleri sıfırlıyor; panel yokken input hap biçiminde kalsın */
.c-search-input.has-suggest .c-custom-input:focus {
    border-color: var(--cs-frame);
    border-radius: 28px;
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(0, 85, 150, 0.08);
}

.c-search-input.has-suggest.is-open .c-custom-input {
    border-color: var(--cs-frame);
    border-bottom-color: transparent;
    border-radius: 24px 24px 0 0;
    background-color: #fff;
    box-shadow: 0 -6px 24px -18px rgba(0, 60, 107, 0.35);
}

.c-search-input.has-suggest .c-search-input__button path {
    transition: stroke 0.2s;
}

.c-search-input.has-suggest:focus-within .c-search-input__button path,
.c-search-input.has-suggest.is-open .c-search-input__button path {
    stroke: var(--cs-brand);
}

/* Panel: input'un hemen altına, aynı genişlikte yapışık */
.c-search-bar.c-suggest-panel {
    left: 0;
    right: 0;
    top: 100%;
    z-index: 1000;
    width: auto;
    max-height: none;
    margin-top: -1px;
    overflow: visible;
    background: transparent;
    border-radius: 0;
    filter: none;
    transform-origin: top center;
}

.c-search-bar.c-suggest-panel.is-open {
    animation: c-suggest-in 0.18s ease-out;
}

@keyframes c-suggest-in {
    from { opacity: 0; transform: translateY(-6px) scaleY(0.98); }
    to { opacity: 1; transform: none; }
}

.c-suggest {
    position: relative;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--cs-frame, #d9e4ee);
    border-top: 0;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 28px 48px -24px rgba(0, 60, 107, 0.4);
    color: var(--cs-ink);
    text-align: left;
}

/* Input ile panel arasındaki ince ayraç (kenarlara değmez) */
.c-suggest::before {
    content: "";
    display: block;
    height: 1px;
    margin: 0 18px;
    background: var(--cs-line);
}

.c-suggest p {
    margin: 0;
}

/* Sekme çipleri: tek satır, yatay kayar. Taşan yönde kenar fade + ok (filter.css .c-alpha__nav ile aynı dil) */
.c-suggest__tabs-wrap {
    position: relative;
    border-bottom: 1px solid var(--cs-line);
}

.c-suggest__tabs {
    display: flex;
    gap: 6px;
    padding: 10px 10px 8px;
    overflow-x: auto;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
}

.c-suggest__tabs-wrap::before,
.c-suggest__tabs-wrap::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 1;
    width: 56px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.c-suggest__tabs-wrap::before {
    left: 0;
    background: linear-gradient(90deg, #fff 40%, rgba(255, 255, 255, 0));
}

.c-suggest__tabs-wrap::after {
    right: 0;
    background: linear-gradient(270deg, #fff 40%, rgba(255, 255, 255, 0));
}

.c-suggest__tabs-wrap.can-prev::before,
.c-suggest__tabs-wrap.can-next::after {
    opacity: 1;
}

.c-suggest__nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--cs-line);
    border-radius: 50%;
    background: #fff;
    color: var(--cs-brand);
    cursor: pointer;
    box-shadow: 0 4px 12px -4px rgba(23, 32, 43, 0.3);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) scale(0.85);
    transition: opacity 0.2s, transform 0.2s, background 0.15s;
}

.c-suggest__nav--prev {
    left: 6px;
}

.c-suggest__nav--prev svg {
    transform: rotate(180deg);
}

.c-suggest__nav--next {
    right: 6px;
}

.c-suggest__tabs-wrap.can-prev .c-suggest__nav--prev,
.c-suggest__tabs-wrap.can-next .c-suggest__nav--next {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%);
}

.c-suggest__nav:hover {
    background: var(--cs-tint);
}

.c-suggest__tabs::-webkit-scrollbar {
    display: none;
}

.c-suggest__tab {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 10px 0 12px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: var(--cs-soft);
    color: var(--cs-muted);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.c-suggest__tab span {
    min-width: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
}

.c-suggest__tab:hover {
    color: var(--cs-ink);
}

.c-suggest__tab.is-active {
    border-color: #d5e4f1;
    background: var(--cs-tint);
    color: var(--cs-brand-dark);
}

.c-suggest__tab.is-active span {
    background: var(--cs-brand);
    color: #fff;
}

.c-suggest__body {
    max-height: min(420px, 60vh);
    padding: 6px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.c-suggest__group + .c-suggest__group {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid var(--cs-line);
}

.c-suggest__group-title {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--cs-muted);
}

.c-suggest__group-title span {
    color: #a3adb8;
}

.c-suggest__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 10px;
    color: var(--cs-ink);
    text-decoration: none;
}

.c-suggest__item:hover,
.c-suggest__item.is-active {
    background: var(--cs-soft);
    color: var(--cs-ink);
}

.c-suggest__item.is-active {
    box-shadow: 0 0 0 2px var(--cs-brand) inset;
}

.c-suggest__icon {
    flex: 0 0 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--cs-tint);
    color: var(--cs-brand);
}

.c-suggest__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.c-suggest__title {
    overflow: hidden;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.c-suggest__meta {
    overflow: hidden;
    font-size: 12px;
    line-height: 17px;
    color: var(--cs-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.c-suggest__match {
    overflow: hidden;
    font-size: 12px;
    line-height: 17px;
    color: var(--cs-brand);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.c-suggest__more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 4px 10px 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--cs-brand);
}

.c-suggest__more.is-active {
    text-decoration: underline;
}

.c-suggest__all {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--cs-line);
    background: var(--cs-soft);
    font-size: 13px;
    font-weight: 500;
    color: var(--cs-brand-dark);
    text-decoration: none;
}

.c-suggest__all span {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.c-suggest__all b {
    padding: 0 7px;
    border-radius: 999px;
    background: var(--cs-brand);
    color: #fff;
    font-size: 11px;
    line-height: 18px;
}

.c-suggest__all:hover,
.c-suggest__all.is-active {
    background: var(--cs-tint);
    color: var(--cs-brand-dark);
}

.c-suggest__state {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    font-size: 14px;
    color: var(--cs-muted);
}

.c-suggest__spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--cs-tint);
    border-top-color: var(--cs-brand);
    border-radius: 50%;
    animation: c-suggest-spin 0.7s linear infinite;
}

@keyframes c-suggest-spin {
    to { transform: rotate(360deg); }
}

/* ===============================================================
   2) /search SAYFASI
   =============================================================== */

/* Mobilde filtre paneli normalde kapalı başlar; arama sayfasında hep açık */
.c-filter--always .c-filter__panel {
    display: block !important;
    margin-top: 0 !important;
    animation: none !important;
}

.c-search-summary {
    margin: 18px 4px 0;
    font-size: 15px;
    color: var(--cs-muted);
}

.c-search-summary strong {
    color: var(--cs-ink);
    font-weight: 600;
}

/* Sayaçlı sekmeler: filter.css segmented control ile aynı dil */
.c-search-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 14px;
    padding: 5px;
    background: #e9eef3;
    border-radius: 14px;
}

.c-search-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px 0 16px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--cs-muted);
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.c-search-tab:hover {
    color: var(--cs-ink);
}

.c-search-tab__count {
    min-width: 24px;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(23, 32, 43, 0.07);
    font-size: 12px;
    font-weight: 600;
    line-height: 22px;
    text-align: center;
}

.c-search-tab.is-active {
    background: #fff;
    color: var(--cs-brand);
    box-shadow: 0 1px 2px rgba(23, 32, 43, 0.06), 0 4px 12px -4px rgba(23, 32, 43, 0.12);
}

.c-search-tab.is-active .c-search-tab__count {
    background: var(--cs-brand);
    color: #fff;
}

.c-search-tab:focus-visible,
.c-search-group__all:focus-visible,
.c-search-more:focus-visible {
    outline: 3px solid rgba(0, 85, 150, 0.35);
    outline-offset: 2px;
}

/* Sonuç grupları */
.c-search-results {
    padding: 0 0 40px;
}

.c-search-group {
    margin-top: 28px;
}

.c-search-group__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--cs-line);
}

.c-search-group__head h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: var(--cs-ink);
}

.c-search-group__count {
    padding: 0 9px;
    border-radius: 999px;
    background: var(--cs-tint);
    color: var(--cs-brand);
    font-size: 13px;
    font-weight: 600;
    line-height: 24px;
}

.c-search-group__all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--cs-brand);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.c-search-group__all:hover svg {
    transform: translateX(2px);
}

.c-search-group__all svg {
    transition: transform 0.2s;
}

/* Hekim kartı: eşleşme nedeni kartın içinde, adın altında (_DoctorCard MatchPrefix/MatchLabel).
   main.css kart içeriğine sabit 262px yükseklik veriyor; ek satır taşmasın diye arama
   listesinde içerik esner ve aynı satırdaki kartlar eşit boyda kalır. */
.c-person-cards__match {
    display: -webkit-box;
    margin: 8px 0 0;
    overflow: hidden;
    font-size: 13px;
    line-height: 18px;
    color: #6b7785;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.c-person-cards__match > span:first-child {
    font-weight: 600;
    color: #005596;
}

.c-search-doctors .c-person-cards__item {
    display: flex;
    flex-direction: column;
}

.c-search-doctors .c-person-cards__content {
    flex: 1 1 auto;
    max-height: none;
}

.c-search-doctors .c-person-cards__actions {
    margin-top: 16px;
}

/* Liste tipi sonuçlar (birim, yazı, video, sayfa) */
.c-search-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.c-search-list__item {
    display: flex;
    align-items: center;
    gap: 14px;
    height: 100%;
    min-height: 72px;
    padding: 14px 16px;
    border: 1px solid var(--cs-line);
    border-radius: 14px;
    background: #fff;
    color: var(--cs-ink);
    text-decoration: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.c-search-list__item:hover {
    border-color: #cfdfee;
    box-shadow: 0 12px 28px -20px rgba(0, 60, 107, 0.45);
    color: var(--cs-ink);
}

.c-search-list__icon {
    flex: 0 0 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--cs-tint);
    color: var(--cs-brand);
}

.c-search-list__text {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.c-search-list__title {
    font-size: 15px;
    font-weight: 600;
    line-height: 21px;
}

.c-search-list__meta {
    font-size: 13px;
    line-height: 18px;
    color: var(--cs-muted);
}

.c-search-list__match {
    display: block;
    color: var(--cs-brand);
}

.c-search-list__arrow {
    flex: 0 0 18px;
    color: #a3adb8;
    transition: transform 0.2s, color 0.2s;
}

.c-search-list__item:hover .c-search-list__arrow {
    color: var(--cs-brand);
    transform: translateX(2px);
}

.c-search-group__more {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

.c-search-more {
    height: 48px;
    padding: 0 28px;
    border: 1px solid #d5e4f1;
    border-radius: 999px;
    background: var(--cs-tint);
    color: var(--cs-brand-dark);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.c-search-more:hover {
    background: #dcebf7;
    border-color: #bcd6ec;
}

/* Boş durum */
.c-search-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 32px 0 48px;
    padding: 48px 24px;
    border: 1px dashed #d5e4f1;
    border-radius: 20px;
    background: var(--cs-soft);
    text-align: center;
}

.c-search-empty__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 8px;
    border-radius: 16px;
    background: var(--cs-tint);
    color: var(--cs-brand);
}

.c-search-empty__title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--cs-ink);
}

.c-search-empty__text {
    max-width: 460px;
    margin: 0;
    font-size: 14px;
    color: var(--cs-muted);
}

.c-search-empty__links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

/* JS ile gizlenen öğeler (sekme / önizleme / sayfalama) */
.c-search-page .is-hidden {
    display: none !important;
}

/* Tablet */
@media (max-width: 991px) {
    .c-search-list {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Mobil: sekmeler tek satırda yatay kayar */
@media (max-width: 767px) {
    .c-search-tabs {
        flex-wrap: nowrap;
        margin: 14px -16px 0;
        padding: 4px 16px;
        border-radius: 0;
        background: transparent;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .c-search-tabs::-webkit-scrollbar {
        display: none;
    }

    .c-search-tab {
        flex: 0 0 auto;
        height: 38px;
        border: 1px solid var(--cs-line);
        background: #fff;
        font-size: 14px;
    }

    .c-search-tab.is-active {
        border-color: #cfdfee;
        background: var(--cs-tint);
        box-shadow: none;
    }

    .c-search-group {
        margin-top: 28px;
    }

    .c-search-group__head h2 {
        font-size: 18px;
    }

    .c-search-list__item {
        min-height: 64px;
        padding: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .c-search-bar.c-suggest-panel.is-open,
    .c-suggest__spinner {
        animation: none;
    }

    .c-search-input.has-suggest .c-custom-input {
        transition: none;
    }
}
