/* ===================================
   WC Powerhouse Search Styles
   =================================== */

:root {
    --search-panel-width: 100%;
    --search-panel-max-width: 1200px;
    --search-animation-duration: 0.3s;
}

/* Search Trigger Button */
.wc-powerhouse-search-trigger {
    display: inline-block;
}

.wc-powerhouse-search-trigger .wc-powerhouse-search-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    color: var(--wcp-primary, #007cba);
    font-family: inherit;
}

.wc-powerhouse-search-trigger .wc-powerhouse-search-btn:hover,
.wc-powerhouse-search-trigger .wc-powerhouse-search-btn:focus {
    border: none;
    background: transparent;
    color: var(--wcp-secondary, #007cba);
}

.wc-powerhouse-search-trigger .wc-powerhouse-search-btn .search-icon {
    flex-shrink: 0;
}

.wc-powerhouse-search-trigger .wc-powerhouse-search-btn .search-text {
    font-weight: 500;
}

@media (max-width: 767px) {
    .wc-powerhouse-search-trigger .wc-powerhouse-search-btn {
        padding: 8px;
    }
}

/* Search Panel */
.wc-powerhouse-search-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s var(--search-animation-duration), opacity var(--search-animation-duration) ease;
}

.wc-powerhouse-search-panel.active {
    visibility: visible;
    opacity: 1;
    transition: visibility 0s, opacity var(--search-animation-duration) ease;
}

/* Overlay */
.search-panel-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

/* Panel Content */
.search-panel-content {
    position: absolute;
    /* top: 0;
    left: 50%;
    transform: translate(-50%, -100%); */
    width: var(--search-panel-width);
    max-width: var(--search-panel-max-width);
    background: white;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transition: transform var(--search-animation-duration) ease;
    max-height: 100vh;
    height: 100vh;
    display: flex;
    flex-direction: column;
    border-radius: 0 0 8px 8px;
}

.wc-powerhouse-search-panel.active .search-panel-content {
    transform: translate(-50%, 0);
}

/* Panel Header */
.search-panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    border-bottom: 1px solid #e5e5e5;
}

.wc-powerhouse-search-panel .search-panel-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease;
    color: #666;
    flex-shrink: 0;
}

.wc-powerhouse-search-panel .search-panel-close:hover,
.wc-powerhouse-search-panel .search-panel-close:focus {
    background: #f5f5f5;
    color: #333;
}

/* Panel Body */
.search-panel-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Search Input */
.search-input-wrapper {
    position: relative;
    flex: 1;
}

.search-input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

.wc-powerhouse-search-panel .search-panel-input {
    width: 100%;
    padding: 16px 48px 16px 48px;
    font-size: 18px;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.wc-powerhouse-search-panel .search-panel-input:focus {
    outline: none;
    border-color: var(--wcp-accent, #007cba);
}

.wc-powerhouse-search-panel .search-clear-btn {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    transition: color 0.2s ease;
}

.wc-powerhouse-search-panel .search-clear-btn:hover,
.wc-powerhouse-search-panel .search-clear-btn:focus {
    color: #333;
    background: transparent;
}

/* Section Title */
.search-section-title {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    margin: 0 0 16px;
}

/* Suggested Categories */
.search-suggested-categories {
    margin: 32px 0;
}

.category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-chip {
    display: inline-block;
    padding: 8px 16px;
    background: #f5f5f5;
    border: 1px solid #e5e5e5;
    border-radius: 20px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
}

.category-chip:hover {
    background: #e5e5e5;
    border-color: #999;
    color: #000;
}

/* Search Results */
.search-results-container {
    margin-bottom: 24px;
}

.search-results-grid {
    display: grid;
    grid-template-columns: repeat(var(--columns, 4), 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

/* Product Item */
.search-product-item {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.search-product-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #999;
    transform: translateY(-2px);
}

.search-product-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.search-product-image {
    position: relative;
    width: 100%;
    aspect-ratio: 4/6;
    background: #f5f5f5;
    overflow: hidden;
}

.search-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.search-product-item:hover .search-product-image img {
    transform: scale(1.05);
}

.search-product-info {
    padding: 12px;
}

.search-product-name {
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 8px;
    line-height: 1.4;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-product-colors {
    display: inline-block;
    font-size: 11px;
    color: #666;
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 4px;
    font-weight: 400;
}

.search-product-price {
    font-size: 16px;
    font-weight: 600;
    color: #000;
}

.search-product-price del {
    font-size: 14px;
    color: #999;
    font-weight: normal;
    margin-right: 4px;
}

.search-product-price ins {
    text-decoration: none;
    color: #e74c3c;
}

/* View All Button */
.search-view-all {
    text-align: center;
    margin-top: 24px;
}

.search-view-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--wcp-button-bg-color, #007cba);
    color: var(--wcp-button-text-color, white);
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.search-view-all-btn:hover {
    background: var(--wcp-button-bg-hover-color, #005f8a);
    color: var(--wcp-button-text-hover-color, white);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Loading State */
.search-loading {
    text-align: center;
    padding: 40px 20px;
}

.search-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--wcp-accent, #007cba);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.search-loading p {
    color: #666;
    font-size: 14px;
}

/* No Results State */
.search-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.search-no-results svg {
    margin-bottom: 16px;
    opacity: 0.3;
}

.search-no-results p {
    font-size: 16px;
    margin: 0;
}

/* Body scroll lock */
body.search-panel-open {
    overflow: hidden;
}

/* Responsive */
@media (max-width: 1024px) {
    .search-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .search-panel-content {
        max-width: 100%;
        width: 100%;
        border-radius: 0;
    }

    .search-panel-body {
        padding: 16px;
    }

    .search-results-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .search-panel-input {
        font-size: 16px;
        padding: 14px 44px 14px 44px;
    }

    .search-suggested-categories {
        margin-bottom: 24px;
    }
}

@media (max-width: 480px) {
    .wc-powerhouse-search-btn .search-text {
        display: none;
    }

    .wc-powerhouse-search-btn {
        padding: 8px 12px;
    }

    .search-panel-header {
        padding: 12px 16px;
    }

    .search-results-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .search-product-info {
        padding: 8px;
    }

    .search-product-name {
        font-size: 13px;
        -webkit-line-clamp: 2;
    }

    .search-product-price {
        font-size: 14px;
    }
}
