/**
 * WC RBPV Custom Search Styles - Peptide Sciences Style
 */

.wc-rbpv-search-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    box-sizing: border-box;
}

.wc-rbpv-search-form {
    position: relative;
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0 15px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.wc-rbpv-search-form::before {
    content: "\f002";
    font-family: "woodmart-font", "Font Awesome 5 Free", "FontAwesome";
    font-weight: 400;
    position: relative;
    color: #999;
    font-size: 16px;
    margin-right: 10px;
    flex-shrink: 0;
}

.wc-rbpv-search-input {
    flex: 1;
    padding: 12px 0;
    font-size: 14px;
    border: none !important;
    background: transparent !important;
    color: #333;
    font-weight: 400;
    outline: none !important;
    box-shadow: none !important;
    width: 100%;
    box-sizing: border-box;
}

.wc-rbpv-search-input::placeholder {
    color: #999;
    font-weight: 400;
}

.wc-rbpv-search-input:focus {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

.wc-rbpv-search-button {
    display: none !important;
}

.wc-rbpv-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 10px;
    background: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-height: 500px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.wc-rbpv-search-results.active {
    display: block;
}

.wc-rbpv-search-result {
    display: flex;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid #cccccc;
    cursor: pointer;
    text-decoration: none;
    color: #333333;
}

.wc-rbpv-search-result:hover {
    background: #f5f5f5;
}

.wc-rbpv-search-result:last-child {
    border-bottom: none;
}

.wc-rbpv-search-result-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.wc-rbpv-search-result-content {
    flex: 1;
}

.wc-rbpv-search-result-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 5px 0;
}

.wc-rbpv-search-result-excerpt {
    font-size: 14px;
    color: #666;
    margin: 0 0 5px 0;
}

.wc-rbpv-search-result-price {
    font-size: 16px;
    font-weight: 700;
    color: #0073aa;
}

.wc-rbpv-search-notice {
    padding: 20px;
    background: #fff3cd;
    text-align: center;
    border-radius: 4px;
}

.wc-rbpv-search-notice-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 10px 0;
}

.wc-rbpv-search-notice-message {
    font-size: 14px;
    margin: 0 0 15px 0;
}

.wc-rbpv-search-notice-button {
    display: inline-block;
    padding: 10px 20px;
    background: #0073aa;
    color: #ffffff;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
}

.wc-rbpv-search-notice-button:hover {
    opacity: 0.9;
}

.wc-rbpv-search-no-results {
    padding: 20px;
    text-align: center;
    color: #666;
}

.wc-rbpv-search-loading {
    padding: 20px;
    text-align: center;
    color: #666;
}

/* Header integration */
.header-middle .wc-rbpv-search-container,
.whb-flex-row .wc-rbpv-search-container,
.whb-column .wc-rbpv-search-container {
    flex: 1;
    max-width: none;
    margin: 0;
}

.header-middle .wc-rbpv-search-form,
.whb-flex-row .wc-rbpv-search-form,
.whb-column .wc-rbpv-search-form {
    width: 100%;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 0 18px;
}

.header-middle .wc-rbpv-search-input,
.whb-flex-row .wc-rbpv-search-input,
.whb-column .wc-rbpv-search-input {
    width: 100%;
    padding: 13px 0;
    font-size: 14px;
}

.header-middle .wc-rbpv-search-form::before,
.whb-flex-row .wc-rbpv-search-form::before,
.whb-column .wc-rbpv-search-form::before {
    font-size: 16px;
    color: #666;
    margin-right: 12px;
}

/* ============================================================================
   MOBILE SEARCH ICON & OVERLAY
   ========================================================================= */

/* Search Icon Trigger Button */
.wc-rbpv-search-icon-trigger {
    display: none; /* Hidden on desktop by default */
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #333;
    transition: color 0.2s ease;
}

.wc-rbpv-search-icon-trigger:hover {
    color: #E84B19;
}

.wc-rbpv-search-icon-trigger svg {
    display: block;
    width: 24px;
    height: 24px;
}

/* Search Overlay */
.wc-rbpv-search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    z-index: 999999;
    flex-direction: column;
}

.wc-rbpv-search-overlay.active {
    display: flex;
}

.wc-rbpv-search-overlay-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
}

.wc-rbpv-search-overlay-close {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #333;
    transition: color 0.2s ease;
}

.wc-rbpv-search-overlay-close:hover {
    color: #E84B19;
}

.wc-rbpv-search-overlay-close svg {
    display: block;
    width: 28px;
    height: 28px;
}

.wc-rbpv-search-overlay-content {
    flex: 1;
    padding: 20px 16px;
    overflow-y: auto;
}

.wc-rbpv-search-overlay-container {
    max-width: 100%;
}

.wc-rbpv-search-overlay-container .wc-rbpv-search-form {
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 0 16px;
}

.wc-rbpv-search-overlay-container .wc-rbpv-search-form:focus-within {
    border-color: #E84B19;
}

.wc-rbpv-search-overlay-container .wc-rbpv-search-input {
    padding: 16px 0;
    font-size: 16px; /* Prevents zoom on iOS */
}

.wc-rbpv-search-overlay-container .wc-rbpv-search-results {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    margin-top: 16px;
    border: none;
    box-shadow: none;
    max-height: none;
    overflow-y: visible;
}

.wc-rbpv-search-overlay-container .wc-rbpv-search-results.active {
    display: block;
}

.wc-rbpv-search-overlay-container .wc-rbpv-search-result {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 12px;
    background: #fff;
}

.wc-rbpv-search-overlay-container .wc-rbpv-search-result:last-child {
    margin-bottom: 0;
}

/* Mobile responsive */
@media (max-width: 767px) {
    /* Hide desktop search in header on mobile */
    .header-middle .wc-rbpv-search-container,
    .whb-column .wc-rbpv-search-container:not(.wc-rbpv-search-overlay-container),
    .kb-search-bar .wc-rbpv-search-container:not(.wc-rbpv-search-overlay-container) {
        display: none !important;
    }

    /* Show mobile search icon */
    .wc-rbpv-search-icon-trigger {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .wc-rbpv-search-form {
        flex-direction: column;
    }

    .wc-rbpv-search-button {
        width: 100%;
    }
}

/* Ensure overlay works on all screen sizes when activated */
@media (max-width: 1024px) {
    .wc-rbpv-search-overlay-container .wc-rbpv-search-result-image {
        width: 70px;
        height: 70px;
    }

    .wc-rbpv-search-overlay-container .wc-rbpv-search-result-title {
        font-size: 14px;
    }

    .wc-rbpv-search-overlay-container .wc-rbpv-search-result-excerpt {
        font-size: 13px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}

/* Body scroll lock when overlay is open */
body.wc-rbpv-search-overlay-open {
    overflow: hidden;
}
