/* ──────────────────────────────────────────────────────────────────
   PRO PEPTIDE — HEADER SEARCH TRANSFORM
   File: assets/css/pp-header-search.css
   Companion to: assets/js/pp-header-search.js
   Enqueued in: functions.php pp_enqueue_assets()
   ────────────────────────────────────────────────────────────────── */

/* The trigger sits inside the parent theme's .header_bottom row, in the
   slot the old wrapper occupied (order/margin rules in style.css line ~3700). */
.pp-search-trigger {
    background: #fafafa;
    border: 1px solid #E5E7EB;
    cursor: pointer;
    color: #343434;
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    font-family: inherit;
    flex-shrink: 0;
}

.pp-search-trigger:hover {
    background: #E8F4FB;
    border-color: #0e6a99;
    color: #0e6a99;
}

.pp-search-trigger:focus-visible {
    outline: 3px solid #1f9edb;
    outline-offset: 2px;
}

.pp-search-trigger svg {
    width: 18px;
    height: 18px;
}

/* Hide the trigger while the search overlay is active so it doesn't peek
   through the white header overlay. */
body.pp-searching .pp-search-trigger {
    visibility: hidden;
}

/* ──────────────────────────────────────────────────────────────────
   SEARCH OVERLAY — fixed bar that slides over the header on activation
   ────────────────────────────────────────────────────────────────── */

.pp-header-search {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--pp-search-header-height, 78px);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 40px;
    background: #FFFFFF;
    border-bottom: 1px solid #E5E7EB;
    z-index: 10000;
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

body.pp-searching .pp-header-search {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.25s ease 0.1s, transform 0.25s ease 0.1s;
    pointer-events: auto;
}

.admin-bar .pp-header-search {
    top: 32px;
}

@media (max-width: 782px) {
    .admin-bar .pp-header-search {
        top: 46px;
    }
}

@media (max-width: 768px) {
    .pp-header-search {
        height: var(--pp-search-header-height-mobile, 64px);
        padding: 0 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pp-header-search {
        transition: none !important;
    }
}

/* Brand anchor (small accent on the left of the input row) */
.pp-search-anchor {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    color: #0e6a99;
}
.pp-search-anchor svg {
    width: 22px;
    height: 22px;
}

/* Input wrap — bordered pill with focus ring */
.pp-search-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fafafa;
    border-radius: 12px;
    padding: 0 18px;
    border: 2px solid #1f9edb;
    box-shadow: 0 0 0 4px rgba(31, 158, 219, 0.15);
    height: 48px;
    transition: box-shadow 0.2s ease;
    min-width: 0;
}
.pp-search-input-wrap:focus-within {
    box-shadow: 0 0 0 4px rgba(31, 158, 219, 0.25);
}
.pp-search-input-wrap .pp-search-icon {
    color: #0e6a99;
    flex-shrink: 0;
    display: flex;
}
.pp-search-input-wrap .pp-search-icon svg {
    width: 20px;
    height: 20px;
}

.pp-search-input {
    flex: 1;
    height: 100%;
    background: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    font-family: 'Montserrat', system-ui, sans-serif;
    font-size: 16px;
    color: #343434 !important;
    min-width: 0;
    padding: 0 !important;
    margin: 0 !important;
}
.pp-search-input::placeholder { color: #6b7280; }

.pp-search-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    padding: 4px;
    display: flex;
    flex-shrink: 0;
    transition: color 0.15s ease;
}
.pp-search-clear:hover { color: #343434; }
.pp-search-clear svg { width: 16px; height: 16px; }
.pp-search-clear[hidden] { display: none; }

.pp-search-esc {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 6px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    font-size: 10px;
    color: #6B7280;
    font-weight: 600;
    flex-shrink: 0;
    font-family: inherit;
    letter-spacing: 0.04em;
}
@media (max-width: 768px) {
    .pp-search-esc { display: none; }
}

.pp-search-close {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #fafafa;
    border: 1.5px solid #E5E7EB;
    cursor: pointer;
    color: #343434;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    font-family: inherit;
    padding: 0;
}
.pp-search-close:hover {
    background: #FFFFFF;
    border-color: #343434;
}
.pp-search-close:focus-visible {
    outline: 3px solid #1f9edb;
    outline-offset: 2px;
}
.pp-search-close svg { width: 18px; height: 18px; }

/* ──────────────────────────────────────────────────────────────────
   RESULTS DROPDOWN
   ────────────────────────────────────────────────────────────────── */

.pp-search-dropdown {
    position: fixed;
    top: var(--pp-search-header-height, 78px);
    left: 0;
    right: 0;
    background: #FFFFFF;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
    z-index: 9999;
    max-height: calc(100vh - var(--pp-search-header-height, 78px) - 20px);
    overflow-y: auto;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.25s ease 0.05s, transform 0.25s ease 0.05s;
    border-bottom: 1px solid #E5E7EB;
}

body.pp-searching .pp-search-dropdown {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.admin-bar .pp-search-dropdown {
    top: calc(var(--pp-search-header-height, 78px) + 32px);
    max-height: calc(100vh - var(--pp-search-header-height, 78px) - 32px - 20px);
}
@media (max-width: 782px) {
    .admin-bar .pp-search-dropdown {
        top: calc(var(--pp-search-header-height, 78px) + 46px);
    }
}

@media (max-width: 768px) {
    .pp-search-dropdown {
        top: var(--pp-search-header-height-mobile, 64px);
        max-height: calc(100vh - var(--pp-search-header-height-mobile, 64px));
    }
}

.pp-search-dropdown-inner {
    padding: 24px 40px;
}
@media (max-width: 768px) {
    .pp-search-dropdown-inner { padding: 20px; }
}

/* ──────────────────────────────────────────────────────────────────
   BACKDROP
   ────────────────────────────────────────────────────────────────── */

.pp-search-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(52, 52, 52, 0.4);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
body.pp-searching .pp-search-backdrop {
    opacity: 1;
    pointer-events: auto;
}

/* ──────────────────────────────────────────────────────────────────
   EMPTY / WELCOME STATE
   ────────────────────────────────────────────────────────────────── */

.pp-search-section-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 14px;
    font-family: 'Montserrat', system-ui, sans-serif;
}
.pp-search-section-label svg { width: 14px; height: 14px; }

.pp-search-popular {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pp-search-popular-chip {
    padding: 8px 16px;
    border-radius: 9999px;
    border: 1px solid #E5E7EB;
    background: #FFFFFF;
    font-size: 13px;
    font-weight: 500;
    color: #343434;
    font-family: 'Montserrat', system-ui, sans-serif;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.pp-search-popular-chip:hover {
    background: #E8F4FB;
    border-color: #0e6a99;
    color: #0e6a99;
}

.pp-search-hint {
    margin-top: 20px;
    padding: 12px 16px;
    background: #fafafa;
    border-radius: 10px;
    font-size: 12px;
    color: #6B7280;
    line-height: 1.5;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Montserrat', system-ui, sans-serif;
}
.pp-search-hint-icon {
    color: #0e6a99;
    flex-shrink: 0;
    display: flex;
}
.pp-search-hint-icon svg { width: 14px; height: 14px; }
.pp-search-hint strong { color: #343434; }

/* ──────────────────────────────────────────────────────────────────
   RESULTS LIST
   ────────────────────────────────────────────────────────────────── */

.pp-search-results {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.pp-search-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.pp-search-group-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.pp-search-result {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    transition: background-color 0.15s ease;
    color: inherit;
}
.pp-search-result:hover,
.pp-search-result:focus {
    background: #fafafa;
    outline: none;
}
.pp-search-result-thumb {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #6b7280;
    overflow: hidden;
}
.pp-search-result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.pp-search-result-thumb svg {
    width: 24px;
    height: 32px;
}
.pp-search-result-info {
    flex: 1;
    min-width: 0;
}
.pp-search-result-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
    flex-wrap: wrap;
}
.pp-search-result-name {
    font-family: 'Montserrat', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #343434;
}
.pp-search-result-name mark {
    background: #E8F4FB;
    color: #0e6a99;
    padding: 0 2px;
    border-radius: 3px;
}
.pp-search-result-cat {
    border-radius: 9999px;
    padding: 1px 8px;
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border: 1px solid;
    font-family: 'Montserrat', system-ui, sans-serif;
}
.pp-search-result-cat--healing     { background: #F0FDF4; color: #15803d; border-color: #22c55e; }
.pp-search-result-cat--weight      { background: #FFF7ED; color: #c2410c; border-color: #ea580c; }
.pp-search-result-cat--brain       { background: #E8F4FB; color: #0e6a99; border-color: #0e6a99; }
.pp-search-result-cat--skin        { background: #FAF5FF; color: #7e22ce; border-color: #9333ea; }
.pp-search-result-cat--performance { background: #FEF2F2; color: #c0384a; border-color: #ef4444; }

.pp-search-result-subtitle {
    font-size: 12px;
    color: #6B7280;
    font-family: 'Montserrat', system-ui, sans-serif;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.pp-search-result-price {
    text-align: right;
    flex-shrink: 0;
    font-family: 'Montserrat', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #343434;
}
.pp-search-result-price .amount,
.pp-search-result-price .woocommerce-Price-amount { color: inherit; font-weight: inherit; }
.pp-search-result-price del { color: #6b7280; margin-right: 6px; font-weight: 400; }
.pp-search-result-price ins { text-decoration: none; }

/* "See all results" footer */
.pp-search-see-all-wrap {
    border-top: 1px solid #F3F4F6;
    padding-top: 16px;
    margin-top: 16px;
}
.pp-search-see-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 10px;
    background: #E8F4FB;
    color: #0e6a99;
    text-decoration: none;
    font-family: 'Montserrat', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 600;
    transition: background-color 0.15s ease;
}
.pp-search-see-all:hover { background: #D4EAF6; }
.pp-search-see-all svg { width: 14px; height: 14px; }

/* No-results state */
.pp-search-empty {
    text-align: center;
    padding: 32px 20px;
}
.pp-search-empty-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: #6b7280;
}
.pp-search-empty-icon svg { width: 24px; height: 24px; }
.pp-search-empty-title {
    font-family: 'Montserrat', system-ui, sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #343434;
    margin: 0 0 6px;
}
.pp-search-empty-text {
    font-family: 'Montserrat', system-ui, sans-serif;
    font-size: 13px;
    color: #6B7280;
    margin: 0;
    line-height: 1.5;
}
.pp-search-empty-text a {
    color: #0e6a99;
    text-decoration: none;
    font-weight: 600;
}

/* Lock the page scroll while searching */
body.pp-searching {
    overflow: hidden;
}
