/**
 * Nivo AJAX Search for WooCommerce - Styles
 * 
 * Professional CSS with scalable architecture and customization support
 * 
 * @package NivoSearch
 * @since 1.0.0
 */

/* CSS Custom Properties for easy customization */
:root {
    --nivo-search-primary-color: #0073aa;
    --nivo-search-border-color: #ddd;
    --nivo-search-border-radius: 4px;
    --nivo-search-box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --nivo-search-transition: all 0.3s ease;
    --nivo-search-font-size-base: 15px;
    --nivo-search-spacing-xs: 5px;
    --nivo-search-spacing-sm: 10px;
    --nivo-search-spacing-md: 15px;
    --nivo-search-spacing-lg: 20px;
    --nivo-search-z-index-dropdown: 1000;

    /* Theme inheritance - can be overridden by settings */
    --nivo-search-font-family: inherit;
    --nivo-search-text-color: inherit;
    --nivo-search-hover-color: inherit;
    --nivo-search-hover-bg: rgba(0, 0, 0, 0.05);
}

/* Main Container */
.nivo-ajax-search-container {
    position: relative;
}

.nivo-search-form-wrapper,
.nivo-search-results {
    max-width: 600px;
    margin: 0 auto;
}

.nivo-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.nivo-search-form {
    margin: 0;
    width: 100%;
}

.nivo-search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    pointer-events: none;
    z-index: 5;
}

.nivo-search-clear-search {
    position: absolute;
    right: 15px;
    top: 47%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 22px;
    color: #999;
    line-height: 1;
    padding: 5px;
    z-index: 10;
    background: none;
    border: none;
    transition: color 0.2s;
}

.nivo-search-clear-search:hover {
    color: #333;
}

button.nivosearch-search-submit {
    overflow: visible;
    position: absolute;
    border: 0;
    padding: 0 15px;
    margin: 0;
    cursor: pointer;
    height: 40px;
    min-width: 50px;
    width: auto;
    line-height: 100%;
    min-height: 100%;
    right: 0;
    left: auto;
    top: 0;
    bottom: auto;
    -webkit-transition: 250ms ease-in-out;
    -moz-transition: 251ms ease-in-out;
    -ms-transition: 250ms ease-in-out;
    -o-transition: 250ms ease-in-out;
    transition: 250ms ease-in-out;
    text-transform: uppercase;
    background-color: transparent;
    -webkit-appearance: none;
}

.nivo-search-loader-icons {
    position: absolute;
    right: 50px;
    top: auto;
    width: 30px;
    display: none;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    height: 100%;
}

.nivo-search-loader-icons.nivo-search-close {
    display: flex;
}








/* Search layout */
.nivo-search-search-icon-wrap {
    width: 50px;
    text-align: center;
    position: absolute;
    height: 100%;
    top: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    left: auto;
    right: 0;
}

/* Search Input */
.nivo-search-wrapper input[type=search].nivo-search-product-search {
    height: 50px;
    width: 100%;
    padding: 0 50px 0 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 15px;
    transition: var(--nivo-search-transition);
    box-sizing: border-box;
    outline: none;
}

.nivo-search-form .nivo-search-wrapper input[type=search].nivo-search-product-search:focus {
    outline: 0;
    box-shadow: 0 0 9px 1px rgba(0, 0, 0, .06);
    transition: var(--nivo-search-transition);
}

.nivo-search-wrapper .nivo-search-product-search::placeholder {
    color: #999;
}

.nivo-search-form .nivo-search-wrapper {
    margin: 0;
    padding: 0;
}

input.nivo-search-product-search.form-control {
    margin-bottom: 0;
}

/* Loading State */
.nivo-ajax-search-container.nivo-search-loading .nivo-search-wrapper::after {
    content: '';
    position: absolute;
    right: 50px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #e0e0e0;
    border-top-color: var(--nivo-search-primary-color);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* Results Container */
.nivo-search-results {
    padding: 5px;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    max-height: 450px;
    overflow-y: auto;
    z-index: var(--nivo-search-z-index-dropdown);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: none;
}

.nivo-ajax-search-container.nivo-search-has-results .nivo-search-results,
.nivo-ajax-search-container.nivo-search-no-results .nivo-search-results {
    display: block;
}

/* Results List */
ul.nivo-search-results-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nivo-search-result-item {
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease;
}

.nivo-search-result-item:last-child {
    border-bottom: none;
}

.nivo-search-result-item:hover {
    background-color: var(--nivo-search-hover-bg);
}

/* Product Link */
.nivo-search-result-item a.nivo-search-product-link {
    display: flex;
    align-items: center;
    text-decoration: none !important;
    color: var(--nivo-search-text-color);
    transition: all 0.2s ease;
    gap: 10px;
    padding: 5px;
    border-radius: 4px;
}

.nivo-search-product-link .amount {
    color: var(--nivo-search-text-color);
}

/* Product Image */
.nivo-search-product-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
    background: #ddd;
}

/* Product Info */
.nivo-search-product-info {
    flex: 1;
    min-width: 0;
}

.nivo-search-product-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.nivo-search-product-title {
    font-size: 15px;
    line-height: 1.4;
    color: inherit;
    flex: 1;
    transition: color 0.2s ease;
}

.nivo-search-product-title strong {
    color: #999;
    font-size: 13px;
    font-weight: 600;
    margin-left: 4px;
}

.nivo-search-product-price {
    color: inherit;
    opacity: 0.8;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
}

.nivo-search-product-description {
    display: block;
    color: inherit;
    opacity: 0.7;
    font-size: 13px;
    line-height: 1.5;
    margin-top: 4px;
}

.nivo-search-product-categories,
.nivo-search-product-tags {
    display: inline-block;
    color: inherit;
    opacity: 0.6;
    font-size: 12px;
    margin-top: 4px;
}

/* Keyword Highlighting */
.nivo-search-highlight {
    background-color: #fff3cd;
    color: #856404;
    font-weight: 600;
    padding: 1px 2px;
    border-radius: 2px;
}

/* Category Results */
.nivo-search-categories-section,
.nivo-search-tags-section,
.nivo-search-products-section {
    margin-bottom: 10px;
}

.nivo-search-categories-section:last-child,
.nivo-search-tags-section:last-child,
.nivo-search-products-section:last-child {
    margin-bottom: 0;
}

.nivo-search-section-title {
    margin: 0 0 8px 0;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

ul.nivo-search-categories-list,
ul.nivo-search-tags-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nivo-search-category-item,
.nivo-search-tag-item {
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease;
}

.nivo-search-category-item:last-child,
.nivo-search-tag-item:last-child {
    border-bottom: none;
}

.nivo-search-category-item:hover,
.nivo-search-tag-item:hover {
    background-color: var(--nivo-search-hover-bg);
}

.nivo-search-category-link,
.nivo-search-tag-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-decoration: none !important;
    color: var(--nivo-search-text-color);
    transition: all 0.2s ease;
    padding: 5px;
    border-radius: 4px;
}

.nivo-search-category-title,
.nivo-search-tag-title {
    font-size: 14px;
    line-height: 1.4;
    color: inherit;
    flex: 1;
}

.nivo-search-category-count,
.nivo-search-tag-count {
    color: #999;
    font-size: 12px;
    font-weight: 500;
}

/* Messages */
.nivo-search-no-results-message,
.nivo-search-error-message {
    padding: 20px;
    margin: 0;
    text-align: center;
    color: #646970;
    font-size: 15px;
}

.nivo-search-no-results-message {
    background: #f8f9fa;
    border-radius: 4px;
}

.nivo-search-error-message {
    color: #d63638;
    background-color: #fef7f7;
    border-radius: 4px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nivo-ajax-search-container {
        max-width: 100%;
    }

    .nivo-search-results {
        max-height: 300px;
    }

    .nivo-search-product-image {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .nivo-search-product-link {
        padding: var(--nivo-search-spacing-xs);
    }

    .nivo-search-product-image {
        width: 35px;
        height: 35px;
    }

    .nivo-search-product-title {
        font-size: 0.9em;
    }

    .nivo-search-product-price {
        font-size: 0.8em;
    }
}