/* InstantSearch - Buscador Instantáneo */

/* Trigger button */
.instant-search-trigger {
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 8px 12px;
    color: #333;
    transition: color 0.2s;
}
.instant-search-trigger:hover {
    color: #2fb5d2;
}
.instant-search-trigger i {
    font-size: 24px;
}

/* Overlay */
.instant-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100000;
    display: flex;
    justify-content: center;
    padding-top: 60px;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: isearch-fadeIn 0.2s ease;
}
.instant-search-overlay.closing {
    animation: isearch-fadeOut 0.15s ease forwards;
}

@keyframes isearch-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes isearch-fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Container */
.instant-search-container {
    width: 90%;
    max-width: 720px;
    max-height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
    animation: isearch-slideDown 0.25s ease;
}

@keyframes isearch-slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header / Input */
.instant-search-header {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 12px 12px 0 0;
    padding: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}
.instant-search-header:only-child,
.instant-search-results[style*="display: none"] ~ .instant-search-header {
    border-radius: 12px;
}
.instant-search-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 16px 20px;
    position: relative;
}
.instant-search-icon {
    color: #999;
    font-size: 22px;
    margin-right: 12px;
}
.instant-search-input {
    border: none;
    outline: none;
    font-size: 18px;
    width: 100%;
    color: #333;
    font-family: inherit;
    background: transparent;
}
.instant-search-input::placeholder {
    color: #aaa;
}
.instant-search-clear {
    cursor: pointer;
    color: #999;
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}
.instant-search-clear:hover {
    color: #333;
}
.instant-search-clear i {
    font-size: 20px;
}
.instant-search-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 16px 20px;
    color: #999;
    transition: color 0.2s;
}
.instant-search-close-btn:hover {
    color: #333;
}
.instant-search-close-btn i {
    font-size: 22px;
}

/* Results */
.instant-search-results {
    background: #fff;
    border-radius: 0 0 12px 12px;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    border-top: 1px solid #eee;
}

/* Sections */
.instant-search-section {
    padding: 12px 0;
}
.instant-search-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #999;
    padding: 8px 24px;
    margin: 0;
}

/* Category list */
.instant-search-category-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.instant-search-category-list li {
    margin: 0;
}
.instant-search-category-list a {
    display: flex;
    align-items: center;
    padding: 10px 24px;
    color: #333;
    text-decoration: none;
    transition: background 0.15s;
    font-size: 14px;
}
.instant-search-category-list a:hover {
    background: #f5f7fa;
}
.instant-search-category-list a i {
    font-size: 18px;
    color: #2fb5d2;
    margin-right: 12px;
}
.instant-search-category-list .isearch-highlight {
    font-weight: 700;
    color: #2fb5d2;
}

/* Product list */
.instant-search-product-list {
    padding: 0;
}
.instant-search-product-item {
    display: flex;
    align-items: center;
    padding: 10px 24px;
    text-decoration: none;
    color: #333;
    transition: background 0.15s;
    gap: 16px;
}
.instant-search-product-item:hover {
    background: #f5f7fa;
    text-decoration: none;
    color: #333;
}

/* Product image */
.instant-search-product-img {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}
.instant-search-product-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Product info */
.instant-search-product-info {
    flex: 1;
    min-width: 0;
}
.instant-search-product-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.instant-search-product-name .isearch-highlight {
    background: #e8f7fa;
    color: #2fb5d2;
    padding: 0 2px;
    border-radius: 2px;
}
.instant-search-product-category {
    font-size: 12px;
    color: #999;
    margin: 0;
}
.instant-search-product-ref {
    font-size: 11px;
    color: #bbb;
}

/* Product price */
.instant-search-product-price {
    text-align: right;
    flex-shrink: 0;
}
.instant-search-product-price .current-price {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    white-space: nowrap;
}
.instant-search-product-price .old-price {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
    white-space: nowrap;
}
.instant-search-product-price .discount-badge {
    display: inline-block;
    background: #ff4c4c;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    margin-top: 2px;
}

/* No results */
.instant-search-no-results {
    text-align: center;
    padding: 40px 24px;
    color: #999;
}
.instant-search-no-results i {
    font-size: 48px;
    color: #ddd;
    margin-bottom: 12px;
}
.instant-search-no-results p {
    font-size: 15px;
    margin: 0;
}

/* Footer */
.instant-search-footer {
    padding: 12px 24px;
    border-top: 1px solid #eee;
    text-align: center;
}
.instant-search-view-all {
    display: inline-block;
    padding: 10px 28px;
    background: #2fb5d2;
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s, transform 0.1s;
}
.instant-search-view-all:hover {
    background: #28a0bb;
    transform: translateY(-1px);
}

/* Loading spinner */
.instant-search-loading {
    background: #fff;
    border-radius: 0 0 12px 12px;
    padding: 30px;
    text-align: center;
    border-top: 1px solid #eee;
}
.instant-search-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #eee;
    border-top-color: #2fb5d2;
    border-radius: 50%;
    animation: isearch-spin 0.6s linear infinite;
    margin: 0 auto;
}
@keyframes isearch-spin {
    to { transform: rotate(360deg); }
}

/* Mobile responsive */
@media (max-width: 767px) {
    .instant-search-overlay {
        padding-top: 0;
    }
    .instant-search-container {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        height: 100vh;
    }
    .instant-search-header {
        border-radius: 0;
    }
    .instant-search-results {
        border-radius: 0;
        max-height: calc(100vh - 64px);
        flex: 1;
    }
    .instant-search-input {
        font-size: 16px;
    }
    .instant-search-product-item {
        padding: 10px 16px;
    }
    .instant-search-section-title {
        padding: 8px 16px;
    }
    .instant-search-category-list a {
        padding: 10px 16px;
    }
    .instant-search-product-img {
        width: 48px;
        height: 48px;
    }
}

/* Scrollbar */
.instant-search-results::-webkit-scrollbar {
    width: 6px;
}
.instant-search-results::-webkit-scrollbar-track {
    background: transparent;
}
.instant-search-results::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}
.instant-search-results::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* Also override existing search widget if needed */
.instant-search-widget {
    display: inline-flex;
    align-items: center;
}
