/* -------------------------------------------------------------
 * WooCommerce Premium Product Search Stylesheet
 * ------------------------------------------------------------- */

/* Root Variables for Premium Aesthetics */
:root {
    --pps-primary-color: var(--wp--preset--color--primary, #008da8);
    --pps-accent-color: var(--wp--preset--color--secondary, #00a8cc);
    --pps-text-dark: #2d3748;
    --pps-text-muted: #718096;
    --pps-border-color: rgba(226, 232, 240, 0.8);
    --pps-bg-dropdown: rgba(255, 255, 255, 0.92);
    --pps-hover-bg: rgba(247, 250, 252, 0.85);
    --pps-card-shadow: 0 12px 36px rgba(0, 0, 0, 0.08);
}

.wc-premium-product-search-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Search Wrapper & Input Box */
.wc-premium-product-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    border: 1.5px solid #cbd5e0;
    border-radius: 50px;
    background: #fff;
    transition: all 0.3s ease;
    padding: 2px 6px;
}

.wc-premium-product-search-wrapper:focus-within {
    border-color: var(--pps-primary-color);
    box-shadow: 0 0 0 3px rgba(0, 141, 168, 0.15);
}

#wc-premium-product-search-input,
.wc-premium-product-search-input {
    width: 100% !important;
    height: 44px !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    padding: 0 10px 0 45px !important;
    font-size: 16px !important;
    color: var(--pps-text-dark) !important;
    box-shadow: none !important;
    margin: 0 !important;
}

/* Search Icon (SVG) */
.wc-premium-product-search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--pps-text-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wc-premium-product-search-icon svg {
    width: 100%;
    height: 100%;
}

/* Clear Icon (SVG) */
.wc-premium-product-search-clear {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--pps-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    outline: none;
}

.wc-premium-product-search-clear:hover {
    color: #e53e3e;
}

.wc-premium-product-search-clear svg {
    width: 16px;
    height: 16px;
}

/* Spinner Loader (SVG) */
.wc-premium-product-search-spinner {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
}

.wc-pps-spinner-svg {
    animation: rotate 2s linear infinite;
    width: 100%;
    height: 100%;
}

.wc-pps-spinner-svg .path {
    stroke: var(--pps-primary-color);
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% { transform: rotate(360deg); }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* Results Dropdown Box with Glassmorphism */
.wc-premium-product-search-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    margin-top: 8px;
    width: 540px;
    max-width: calc(100vw - 32px);
    background: var(--pps-bg-dropdown);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--pps-border-color);
    border-radius: 12px;
    box-shadow: var(--pps-card-shadow);
    z-index: 9999;
    max-height: 480px;
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.wc-premium-product-search-dropdown.open {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Matches Markup Highlighting */
.wc-premium-product-search-dropdown mark {
    background: rgba(0, 141, 168, 0.1);
    color: var(--pps-primary-color);
    font-weight: 600;
    padding: 0;
    border-radius: 3px;
}

/* Section Header (e.g., Categories vs Products) */
.wc-pps-section-title {
    padding: 12px 16px 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--pps-text-muted);
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--pps-border-color);
    margin: 0;
}

/* Taxonomy/Category/Tag Match List */
.wc-pps-categories-list,
.wc-pps-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--pps-border-color);
}

.wc-pps-category-pill,
.wc-pps-tag-pill {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    font-size: 13px;
    color: var(--pps-text-dark);
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
}

.wc-pps-category-pill:hover,
.wc-pps-category-pill.selected,
.wc-pps-tag-pill:hover,
.wc-pps-tag-pill.selected {
    background: color-mix(in srgb, var(--pps-primary-color) 8%, transparent);
    border-color: color-mix(in srgb, var(--pps-primary-color) 25%, transparent);
    color: var(--pps-primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--pps-primary-color) 12%, transparent);
}

/* Product Result Row Items */
.wc-pps-product-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--pps-border-color);
    text-decoration: none;
    color: inherit;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.wc-pps-product-item:last-child {
    border-bottom: none;
}

.wc-pps-product-item:hover,
.wc-pps-product-item.selected {
    background: var(--pps-hover-bg);
    box-shadow: inset 4px 0 0 0 var(--pps-primary-color);
}

/* Product Image thumbnail */
.wc-pps-product-image {
    width: 54px;
    height: 54px;
    flex-shrink: 0;
    border-radius: 8px;
    border: 1px solid var(--pps-border-color);
    overflow: hidden;
    margin-right: 14px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wc-pps-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.wc-pps-product-item:hover .wc-pps-product-image img,
.wc-pps-product-item.selected .wc-pps-product-image img {
    transform: scale(1.08);
}
/* Product details */
.wc-pps-product-info {
    flex-grow: 1;
    min-width: 0;
    padding: 0 14px;
}

.wc-pps-product-title {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #2d3748 !important;
    margin: 0 0 4px 0 !important;
    white-space: normal !important;
    word-break: break-word !important;
    text-decoration: none !important;
    line-height: 1.3 !important;
}

.wc-pps-product-meta {
    font-size: 12px;
    color: var(--pps-text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.wc-pps-badge-sale {
    background: #e53e3e;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.wc-pps-sku-label {
    font-family: monospace;
    background: #f7fafc;
    padding: 1px 4px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
}

/* Pricing block inside details */
.wc-pps-product-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--pps-text-dark);
    margin-bottom: 2px;
}

.wc-pps-product-price del {
    color: var(--pps-text-muted);
    font-size: 12px;
    margin-right: 6px;
    font-weight: 400;
}

.wc-pps-product-price ins {
    text-decoration: none;
    color: #e53e3e;
}

/* Instant Purchase / Add to Cart Action */
.wc-pps-action-block {
    margin-left: 16px;
    flex-shrink: 0;
}

body .wc-premium-product-search-container button.wc-pps-add-to-cart-btn,
.wc-pps-add-to-cart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    background: var(--pps-primary-color);
    color: #fff !important;
    font-size: 12px;
    font-weight: 700;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none !important;
}

.wc-pps-add-to-cart-btn:hover {
    background: var(--pps-accent-color);
    transform: scale(1.05) translateY(-1px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--pps-primary-color) 35%, transparent);
}

.wc-pps-add-to-cart-btn.loading {
    background: #cbd5e0;
    color: var(--pps-text-muted) !important;
    pointer-events: none;
    cursor: not-allowed;
}

.wc-pps-add-to-cart-btn.added {
    background: #48bb78;
}

.wc-pps-add-to-cart-btn.view-cart {
    background: var(--pps-text-dark);
}

/* No results state & empty notices */
.wc-pps-no-results {
    padding: 24px 16px;
    text-align: center;
    color: var(--pps-text-muted);
    font-size: 15px;
}

.wc-pps-no-results svg {
    width: 32px;
    height: 32px;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* See All Results Button Wrapper (Sticky Footer) */
.wc-pps-see-all-wrapper {
    position: sticky;
    bottom: 0;
    z-index: 10;
    padding: 14px 16px;
    text-align: center;
    background: var(--pps-bg-dropdown);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--pps-border-color);
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.wc-pps-see-all-btn {
    display: inline-block;
    padding: 8px 24px;
    font-size: 13px;
    font-weight: 600;
    color: var(--pps-primary-color) !important;
    background: transparent;
    border: 1px solid var(--pps-primary-color);
    border-radius: 20px;
    text-decoration: none !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.wc-pps-see-all-btn:hover {
    color: #fff !important;
    background: var(--pps-primary-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--pps-primary-color) 30%, transparent);
}

/* Pages Match Section styling */
.wc-pps-pages-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.wc-pps-page-item-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    color: var(--pps-text-dark);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.wc-pps-page-item-link:hover,
.wc-pps-page-item-link:focus,
.wc-pps-page-item-link.selected {
    background: color-mix(in srgb, var(--pps-primary-color) 8%, transparent);
    border-color: color-mix(in srgb, var(--pps-primary-color) 25%, transparent);
    color: var(--pps-primary-color);
    outline: none;
    transform: translateX(4px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--pps-primary-color) 12%, transparent);
}

.wc-pps-page-icon {
    width: 16px;
    height: 16px;
    color: var(--pps-text-muted);
    flex-shrink: 0;
}

.wc-pps-page-item-link:hover .wc-pps-page-icon,
.wc-pps-page-item-link:focus .wc-pps-page-icon,
.wc-pps-page-item-link.selected .wc-pps-page-icon {
    color: var(--pps-primary-color);
}

/* Mobile responsive adjustments */
@media (max-width: 767px) {
    .wc-premium-product-search-dropdown {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        box-shadow: none !important;
        border: none !important;
        background: transparent !important;
        transform: none !important;
        margin-top: 12px !important;
        padding: 0 !important;
        border-radius: 0 !important;
        max-height: none !important;
        overflow-y: visible !important;
    }

    .wc-premium-product-search-dropdown.open {
        transform: none !important;
    }
}

/* Autocomplete Shimmer Skeleton Loaders */
@keyframes pps-shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: 200px 0;
    }
}

.wc-pps-skeleton-section {
    opacity: 0.75;
}

.wc-pps-skeleton-pill,
.wc-pps-skeleton-line,
.wc-pps-skeleton-thumb,
.wc-pps-skeleton-title-line,
.wc-pps-skeleton-price-line {
    background: #f6f7f8;
    background-image: linear-gradient(to right, #f6f7f8 0%, #edeef1 20%, #f6f7f8 40%, #f6f7f8 100%);
    background-repeat: no-repeat;
    background-size: 800px 104px;
    display: inline-block;
    position: relative;
    animation: pps-shimmer 1.4s ease-in-out infinite;
}

/* Support dark mode presets */
@media (prefers-color-scheme: dark) {
    .wc-pps-skeleton-pill,
    .wc-pps-skeleton-line,
    .wc-pps-skeleton-thumb,
    .wc-pps-skeleton-title-line,
    .wc-pps-skeleton-price-line {
        background: #2a2f35;
        background-image: linear-gradient(to right, #2a2f35 0%, #3a3f45 20%, #2a2f35 40%, #2a2f35 100%);
    }
}

.wc-pps-skeleton-pill {
    width: 90px;
    height: 32px;
    border-radius: 20px;
    margin-right: 8px;
}

.wc-pps-skeleton-line {
    width: 100%;
    height: 18px;
    border-radius: 4px;
    margin-bottom: 12px;
}

.wc-pps-skeleton-card {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--pps-border-color);
}

.wc-pps-skeleton-thumb {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    margin-right: 16px;
    flex-shrink: 0;
}

.wc-pps-skeleton-text-block {
    flex-grow: 1;
}

.wc-pps-skeleton-title-line {
    width: 60%;
    height: 16px;
    border-radius: 4px;
    margin-bottom: 8px;
    display: block;
}

.wc-pps-skeleton-price-line {
    width: 30%;
    height: 14px;
    border-radius: 4px;
    display: block;
}
