/* ==========================================================================
   Product search modal (header search icon → #exampleModalCenter).

   Styled as the same white card as the Product Inquiry modal
   (assets/css/product-inquiry.css): #111 headings with the red accent bar,
   the inquiry inputs' #111 focus border, and the product-card name / price
   colours from the Shop grid.

   Everything is scoped under .t27-search-modal. The theme's global rules
   (".woocommerce button", ".modal-dialog", ".modal-content", "h2" …) are
   either out-specified or, where they use !important, overridden with it.
   ========================================================================== */

/* --- Overlay + card ------------------------------------------------------ */

.t27-search-modal.modal {
    background-color: rgba(0, 0, 0, 0.65);
}

.t27-search-modal .modal-dialog {
    width: auto;
    max-width: 640px !important;
    margin: 88px auto 24px !important;
    padding: 0 16px;
}

.t27-search-modal .modal-content {
    position: relative;
    background-color: #fff !important;
    border: 0 !important;
    border-radius: 14px;
    box-shadow: 0 30px 80px -10px rgba(0, 0, 0, 0.45), 0 10px 30px -5px rgba(0, 0, 0, 0.15);
    color: #1a1a1a;
}

.t27-search-modal .modal-body {
    padding: 32px 32px 24px;
}

/* Close X — same neutral grey icon as the Product Inquiry modal. */
.t27-search-modal .t27-search-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    color: #9aa1ad;
    cursor: pointer;
}

.t27-search-modal .t27-search-modal__close:hover,
.t27-search-modal .t27-search-modal__close:focus {
    background: transparent;
    color: #6d7480;
}

.t27-search-modal .t27-search-modal__close:focus-visible {
    outline: 2px solid #111 !important;
    outline-offset: 2px;
}

/* --- Header -------------------------------------------------------------- */

.t27-search-modal .t27-search__header {
    padding-right: 28px;
    margin-bottom: 20px;
}

.t27-search-modal h2.t27-search__heading {
    margin: 0 0 12px !important;
    padding: 0 !important;
    font-family: 'NexaCustom', sans-serif !important;
    font-size: 1.6rem !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    letter-spacing: -0.01em !important;
    text-transform: none !important;
    color: #111 !important;
    background: transparent !important;
}

.t27-search-modal .t27-search__accent {
    display: block;
    width: 44px;
    height: 3px;
    background: #e01e26;
    border-radius: 2px;
}

/* --- Search field ----------------------------------------------------------
   One field: magnifier (submit) · input · Enter hint / spinner · clear.
   Soft grey at rest, white with the site's #111 focus border when active —
   the same focus treatment as the Product Inquiry inputs. */

.t27-search-modal .t27-search__box {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 54px;
    padding: 0 12px 0 6px;
    background: #f6f7f9;
    border: 1px solid #e3e5e9;
    border-radius: 10px;
    box-sizing: border-box;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.t27-search-modal .t27-search__box:hover {
    border-color: #d7dade;
}

.t27-search-modal .t27-search__box:focus-within {
    background: #fff;
    border-color: #111;
    box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}

/* Magnifier = submit button (click to search, like Enter). */
.t27-search-modal .t27-search__submit {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 8px;
    box-shadow: none;
    color: #6d7480;
    cursor: pointer;
    transition: color 0.15s ease;
}

.t27-search-modal .t27-search__submit:hover,
.t27-search-modal .t27-search__submit:focus {
    background: transparent;
    color: #111;
}

.t27-search-modal .t27-search__box:focus-within .t27-search__submit {
    color: #111;
}

.t27-search-modal .t27-search__submit:focus-visible {
    outline: 2px solid #111 !important;
    outline-offset: -2px;
}

.t27-search-modal .t27-search__input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    color: #111 !important;
    font-family: 'NexaCustom', sans-serif !important;
    font-size: 16px !important;
    line-height: normal !important;
    -webkit-appearance: none;
    appearance: none;
}

.t27-search-modal .t27-search__input::placeholder {
    color: #9aa1ad;
    opacity: 1;
}

/* The browser's own clear "x" — the field has its own. */
.t27-search-modal .t27-search__input::-webkit-search-cancel-button,
.t27-search-modal .t27-search__input::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
}

/* "Press [Enter] to search" — shown once the query can be searched. */
.t27-search-modal .t27-search__hint {
    display: none;
    flex: 0 0 auto;
    align-items: center;
    gap: 5px;
    color: #6d7480;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
    user-select: none;
}

.t27-search-modal .t27-search.has-query .t27-search__hint {
    display: inline-flex;
}

.t27-search-modal .t27-search.is-loading .t27-search__hint {
    display: none;
}

.t27-search-modal .t27-search__hint kbd {
    display: inline-block;
    padding: 3px 7px 2px;
    background: #fff;
    border: 1px solid #d7dade;
    border-bottom-width: 2px;
    border-radius: 5px;
    box-shadow: none;
    color: #111;
    font-family: 'NexaCustom', sans-serif;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}

.t27-search-modal .t27-search__clear {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin: 0;
    padding: 0;
    background: #e3e5e9;
    border: 0;
    border-radius: 50%;
    box-shadow: none;
    color: #4a4f57;
    line-height: 1;
    cursor: pointer;
}

.t27-search-modal .t27-search__clear:hover,
.t27-search-modal .t27-search__clear:focus {
    background: #d7dade;
    color: #111;
}

.t27-search-modal .t27-search__clear[hidden] {
    display: none;
}

/* Shown while a request is in flight (takes the hint's place). */
.t27-search-modal .t27-search__spinner {
    display: none;
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 0, 0, 0.12);
    border-top-color: #111;
    border-radius: 50%;
    animation: t27-search-spin 0.7s linear infinite;
}

.t27-search-modal .t27-search.is-loading .t27-search__spinner {
    display: inline-block;
}

@keyframes t27-search-spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- Results ------------------------------------------------------------- */

.t27-search-modal .t27-search__results {
    margin-top: 18px;
    padding-top: 8px;
    border-top: 1px solid #eceef1;
}

.t27-search-modal .t27-search__results[hidden] {
    display: none;
}

.t27-search-modal .t27-search__list {
    max-height: min(360px, 50vh);
    margin: 0 -8px;
    padding: 0;
    list-style: none;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.t27-search-modal .t27-search__item {
    margin: 0;
    padding: 0;
}

.t27-search-modal .t27-search__item + .t27-search__item {
    border-top: 1px solid #f1f2f4;
}

.t27-search-modal .t27-search__link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 8px;
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
    transition: background-color 0.15s ease !important;
}

.t27-search-modal .t27-search__link:hover,
.t27-search-modal .t27-search__link:focus {
    background-color: #f6f7f9;
    color: inherit;
    text-decoration: none;
}

.t27-search-modal .t27-search__link:focus-visible {
    box-shadow: inset 0 0 0 2px #111;
}

.t27-search-modal .t27-search__thumb {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    overflow: hidden;
    background: #f6f7f9;
    border: 1px solid #eceef1;
    border-radius: 8px;
}

.t27-search-modal .t27-search__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.t27-search-modal .t27-search__body {
    flex: 1 1 auto;
    min-width: 0;
}

.t27-search-modal .t27-search__title {
    display: block;
    overflow: hidden;
    color: #262626;
    font-family: 'NexaCustom', sans-serif;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.t27-search-modal .t27-search__desc {
    display: -webkit-box;
    margin-top: 3px;
    overflow: hidden;
    color: #666;
    font-size: 13px;
    line-height: 1.45;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.t27-search-modal .t27-search__price {
    flex: 0 0 auto;
    color: rgba(178, 33, 36, 0.9);
    font-family: 'NexaCustom', sans-serif;
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
}

.t27-search-modal .t27-search__highlight {
    padding: 0 1px;
    background: rgba(249, 215, 30, 0.45);
    border-radius: 2px;
    color: inherit;
}

.t27-search-modal .t27-search__nores {
    margin: 0;
    padding: 22px 8px 14px;
    color: #555;
    font-size: 14px;
    text-align: center;
}

/* --- Mobile -------------------------------------------------------------- */

@media (max-width: 575px) {
    .t27-search-modal .modal-dialog {
        margin: 16px auto !important;
        padding: 0 12px;
    }

    .t27-search-modal .modal-body {
        padding: 26px 18px 18px;
    }

    .t27-search-modal h2.t27-search__heading {
        font-size: 1.35rem !important;
    }

    .t27-search-modal .t27-search__box {
        height: 50px;
        padding: 0 10px 0 4px;
        gap: 6px;
    }

    /* Narrow screens: just the key cap. */
    .t27-search-modal .t27-search__hint {
        font-size: 0;
        gap: 0;
    }

    .t27-search-modal .t27-search__list {
        max-height: 55vh;
    }

    .t27-search-modal .t27-search__link {
        gap: 12px;
    }

    .t27-search-modal .t27-search__thumb {
        flex-basis: 48px;
        width: 48px;
        height: 48px;
    }

    .t27-search-modal .t27-search__desc {
        -webkit-line-clamp: 1;
    }

    .t27-search-modal .t27-search__price {
        font-size: 14px;
    }
}

/* Touch keyboards have no "Enter" key cap — they show a Search key instead
   (enterkeyhint="search"), so the hint would only confuse. */
@media (hover: none) and (pointer: coarse) {
    .t27-search-modal .t27-search.has-query .t27-search__hint {
        display: none;
    }
}

/* Known empty result: Enter only repeats "No results!", so drop the hint. */
.t27-search-modal .t27-search.no-results .t27-search__hint {
    display: none;
}

/* --- Mobile header search icon (header.php, next to the hamburger) ------- */

/* 40px tap target; the desktop icon's padding-top offset isn't needed. The
   icon only renders below 1025px — its column is .hide-on-desktop. */
.mobile-header-icons .mobile-search-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0 10px 0 0;
    padding: 0;
    cursor: pointer;
}

.mobile-header-icons .mobile-search-trigger:focus-visible {
    outline: 2px solid #fff !important;
    outline-offset: 2px;
    border-radius: 6px;
}
