/* Advanced WooCommerce Search Styles */

/* Main Search Container */
.aws-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 Form */
.aws-search-form {
    position: relative;
    width: 100%;
}

.aws-search-input-wrapper {
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    padding: 4px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.aws-search-input-wrapper:focus-within {
    border-color: #007cba;
    box-shadow: 0 4px 12px rgba(0,124,186,0.15);
}

/* Search Input */
.aws-search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px 16px;
    font-size: 16px;
    background: transparent;
    color: #333;
}

.aws-search-input::placeholder {
    color: #666;
}

/* Category Filter */
.aws-category-filter {
    border: none;
    outline: none;
    padding: 12px 16px;
    background: transparent;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    border-left: 1px solid #e1e5e9;
    min-width: 120px;
}

.aws-category-filter:focus {
    background: #f8f9fa;
}

/* Search Button */
.aws-search-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #007cba;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-left: 8px;
}

.aws-search-button:hover {
    background: #005a87;
    transform: translateY(-1px);
}

.aws-search-button:active {
    transform: translateY(0);
}

.aws-search-button svg {
    width: 18px;
    height: 18px;
}

/* Search Results Dropdown */
.aws-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e1e5e9;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.aws-search-suggestions {
    padding: 8px 0;
}

/* Individual Search Result */
.aws-search-result {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f3f4;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.aws-search-result:hover {
    background: #f8f9fa;
}

.aws-search-result:last-child {
    border-bottom: none;
}

.aws-search-result-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 12px;
    flex-shrink: 0;
}

.aws-search-result-content {
    flex: 1;
    min-width: 0;
}

.aws-search-result-title {
    font-weight: 600;
    color: #333;
    margin: 0 0 4px 0;
    font-size: 14px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.aws-search-result-details {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: #666;
}

.aws-search-result-price {
    font-weight: 600;
    color: #007cba;
}

.aws-search-result-category {
    color: #666;
}

.aws-search-result-rating {
    display: flex;
    align-items: center;
    gap: 4px;
}

.aws-search-result-rating .stars {
    color: #ffa500;
    font-size: 14px;
}

/* No Results */
.aws-no-results {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* View All Results Link */
.aws-view-all {
    display: block;
    padding: 12px 16px;
    background: #f8f9fa;
    color: #007cba;
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    transition: background-color 0.2s ease;
}

.aws-view-all:hover {
    background: #e9ecef;
    color: #005a87;
}

/* Loading State */
.aws-loading {
    padding: 20px;
    text-align: center;
    color: #666;
}

.aws-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

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

/* Modal Styles */
.aws-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aws-modal-content {
    background: white;
    border-radius: 8px;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    position: relative;
}

.aws-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.aws-modal-close:hover {
    color: #333;
}

.aws-modal-body {
    padding: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .aws-search-container {
        max-width: 100%;
        margin: 0 10px;
    }
    
    .aws-search-input-wrapper {
        flex-direction: column;
        gap: 8px;
        padding: 8px;
    }
    
    .aws-category-filter {
        border-left: none;
        border-top: 1px solid #e1e5e9;
        min-width: 100%;
        order: 2;
    }
    
    .aws-search-button {
        margin-left: 0;
        width: 100%;
        justify-content: center;
        order: 3;
    }
    
    .aws-search-input {
        order: 1;
    }
    
    .aws-search-result {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .aws-search-result-image {
        width: 100%;
        height: 150px;
        margin-right: 0;
    }
    
    .aws-search-result-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

@media (max-width: 480px) {
    .aws-search-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .aws-search-button span {
        display: none;
    }
    
    .aws-search-button {
        padding: 12px;
    }
}

/* Theme Variants */
.aws-theme-minimal .aws-search-input-wrapper {
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: none;
}

.aws-theme-minimal .aws-search-button {
    background: #333;
    border-radius: 4px;
}

.aws-theme-minimal .aws-search-button:hover {
    background: #555;
}

.aws-theme-rounded .aws-search-input-wrapper {
    border-radius: 25px;
}

.aws-theme-rounded .aws-search-button {
    border-radius: 20px;
}

/* Stock Status */
.aws-out-of-stock {
    opacity: 0.6;
}

.aws-out-of-stock .aws-search-result-title::after {
    content: ' (Agotado)';
    color: #dc3545;
    font-size: 12px;
    font-weight: normal;
}

/* Similarity Indicator (for fuzzy search results) */
.aws-search-result-similarity {
    font-size: 11px;
    color: #28a745;
    font-weight: 600;
}

/* Highlight matched text */
.aws-highlight {
    background: #fff3cd;
    padding: 1px 2px;
    border-radius: 2px;
}
