/**
 * Bruo Product Search Styles
 */

/* Search Container */
.bps-search-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

/* Search Wrapper */
.bps-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

/* Search Input */
.bps-search-input {
    width: 100%;
    padding: 12px 48px 12px 16px;
    font-size: 14px;
    font-weight: 400;
    color: #1a1a1a;
    border: 1px solid #e4e4e7;
    border-radius: 4px;
    outline: none;
    transition: border-color 0.2s ease;
    background-color: #ffffff;
}

.bps-search-input::placeholder {
    color: #a1a1aa;
    font-weight: 400;
}

.bps-search-input:hover {
    border: 1px solid #003450 !important;
}

.bps-search-input:focus {
    border: 1px solid #003450 !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Search Icon */
.bps-search-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #a1a1aa;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    cursor: pointer;
    transition: color 0.2s ease;
}

.bps-search-input:focus ~ .bps-search-icon {
    color: #003450;
}

.bps-search-icon img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* Loading Spinner */
.bps-loading {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
}

.bps-spinner {
    animation: bps-spin 1s linear infinite;
}

.bps-spinner circle {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: 0;
    stroke-linecap: round;
    animation: bps-dash 1.5s ease-in-out infinite;
}

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

@keyframes bps-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 Container */
.bps-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e4e4e7;
    border-radius: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    max-height: 460px;
    overflow-y: auto;
    z-index: 9999;
    animation: bps-fadeIn 0.2s ease;
}

@keyframes bps-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Results Header */
.bps-results-header {
    padding: 10px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 11px;
    color: #a1a1aa;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Product Item */
.bps-product-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #f4f4f5;
    transition: background-color 0.15s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

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

.bps-product-item:hover {
    background-color: #fafafa;
}

/* Product Image */
.bps-product-image {
    width: 48px;
    height: 48px;
    margin-right: 12px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background-color: #fafafa;
}

.bps-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Product Info */
.bps-product-info {
    flex: 1;
    min-width: 0;
}

.bps-product-title {
    font-size: 13px;
    font-weight: 500;
    color: #1a1a1a;
    margin: 0 0 3px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bps-product-item:hover .bps-product-title {
    color: #003450;
}

.bps-product-meta {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.bps-results .bps-product-price,
.bps-results .bps-product-price ins,
.bps-results .bps-product-price ins span,
.bps-results .bps-product-price ins .woocommerce-Price-amount,
.bps-results .bps-product-price ins .woocommerce-Price-amount bdi,
.bps-results .bps-product-price > .woocommerce-Price-amount,
.bps-results .bps-product-price > .woocommerce-Price-amount bdi {
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    color: #e74c3c !important;
}

.bps-results .bps-product-price del,
.bps-results .bps-product-price del span,
.bps-results .bps-product-price del .woocommerce-Price-amount,
.bps-results .bps-product-price del .woocommerce-Price-amount bdi {
    font-size: 12px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    color: #999 !important;
    text-decoration: line-through;
    margin-right: 5px;
}

.bps-product-stock {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    background-color: #e8f5e9;
    color: #2e7d32;
    margin-left: auto;
}

.bps-product-stock.out-of-stock {
    background-color: #ffebee;
    color: #c62828;
}

.bps-results .bruo-price-brutto {
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #1f2937 !important;
    display: block !important;
    margin-bottom: 4px !important;
}

.bps-results .bruo-price-netto {
    font-size: 13px !important;
}

.bps-results.bps-desktop-results {
    font-size: 18px !important;
    margin-bottom: 4px !important;
}

/* No Results */
.bps-no-results {
    padding: 30px 15px;
    text-align: center;
    color: #999;
}

.bps-no-results-icon {
    margin-bottom: 10px;
    opacity: 0.3;
}

.bps-no-results-icon svg {
    width: 48px;
    height: 48px;
    color: #999;
}

.bps-no-results-text {
    font-size: 14px;
}

/* View All Link */
.bps-view-all {
    display: block;
    padding: 10px 16px;
    text-align: center;
    color: #003450;
    font-weight: 600;
    font-size: 12px;
    border-top: 1px solid #f0f0f0;
    transition: background-color 0.15s ease;
    text-decoration: none;
    letter-spacing: 0.02em;
}

.bps-view-all:hover {
    background-color: #fafafa;
}

/* Scrollbar */
.bps-results::-webkit-scrollbar {
    width: 4px;
}

.bps-results::-webkit-scrollbar-track {
    background: transparent;
}

.bps-results::-webkit-scrollbar-thumb {
    background: #d4d4d8;
    border-radius: 4px;
}

/* ========================================
   Mobile Icon Mode
======================================== */

/* Mobile Icon Button */
.bps-mobile-icon {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: #333;
    transition: all 0.3s ease;
    border-radius: 50%;
}

.bps-mobile-icon:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.bps-mobile-icon:active {
    transform: scale(0.95);
}

.bps-mobile-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
}

/* Desktop - always show normal search, hide mobile icon */
.bps-desktop-search {
    display: block;
}

.bps-mobile-icon {
    display: none;
}

/* Mobile/Tablet - when mobile icon mode is enabled */
@media screen and (max-width: 1024px) {
    .bps-mobile-icon-mode .bps-desktop-search {
        display: none !important;
    }

    .bps-mobile-icon-mode .bps-desktop-results {
        display: none !important;
    }

    .bps-mobile-icon-mode .bps-mobile-icon {
        display: flex !important;
    }
}

/* Mobile Overlay */
.bps-mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999999;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.bps-mobile-overlay.active {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.bps-mobile-overlay-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: #fff;
    padding: 20px;
    max-height: 100vh;
    overflow-y: auto;
    transform: translateY(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bps-mobile-overlay.active .bps-mobile-overlay-content {
    transform: translateY(0);
}

/* Mobile Header */
.bps-mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin-bottom: 15px;
}

.bps-mobile-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
    flex: 1;
}

.bps-mobile-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    color: #333;
    transition: all 0.2s ease;
    border-radius: 50%;
    flex-shrink: 0;
    margin-left: 15px;
}

.bps-mobile-close:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.bps-mobile-close:active {
    transform: scale(0.95);
}

/* Mobile Overlay Search */
.bps-mobile-overlay .bps-search-wrapper {
    margin-bottom: 20px;
}

.bps-mobile-overlay .bps-search-input {
    font-size: 16px;
    padding: 14px 50px 14px 15px;
}

.bps-mobile-overlay .bps-results {
    position: relative;
    top: 0;
    box-shadow: none;
    border: 1px solid #e0e0e0;
    max-height: calc(100vh - 180px);
}

/* Prevent body scroll when overlay is open */
body.bps-overlay-open {
    overflow: hidden;
}


/* Responsive Design */
@media screen and (max-width: 768px) {
    .bps-search-container {
        max-width: 100%;
    }

    .bps-search-input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 10px 40px 10px 12px;
    }

    .bps-product-image {
        width: 50px;
        height: 50px;
        margin-right: 12px;
    }

    .bps-product-title {
        font-size: 14px;
    }

    .bps-product-price {
        font-size: 13px;
    }

    .bps-results {
        max-height: 400px;
    }
}

@media screen and (max-width: 480px) {
    .bps-product-item {
        padding: 10px 12px;
    }

    .bps-product-image {
        width: 45px;
        height: 45px;
        margin-right: 10px;
    }

    .bps-product-title {
        font-size: 13px;
    }

    .bps-product-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

