/**
 * AI Product Assistant Frontend CSS - Cleaned Version
 */

/* Modal Styles */
.aipa-search-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
}

.aipa-search-modal-content {
    position: relative;
    background-color: #fff;
    margin: auto;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    animation: aipaFadeIn 0.3s;
}

@keyframes aipaFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.aipa-close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.aipa-close:hover {
    color: #333;
}

/* Search Form Styles */
.aipa-search-form,
.aipa-shortcode-search-form {
    margin: 20px 0;
}

.aipa-search-input,
.aipa-shortcode-search-input,
#aipa-search-input {
    width: 100%;
    padding: 15px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    min-height: 100px;
    resize: vertical;
}

.aipa-search-buttons,
.aipa-shortcode-search-buttons {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.aipa-search-btn,
.aipa-shortcode-search-btn,
.aipa-voice-btn,
.aipa-shortcode-voice-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s;
}

.aipa-search-btn,
.aipa-shortcode-search-btn {
    background-color: #4CAF50;
    color: white;
    flex-grow: 1;
    max-width: 200px;
}

.aipa-search-btn:hover,
.aipa-shortcode-search-btn:hover {
    background-color: #45a049;
}

.aipa-voice-btn,
.aipa-shortcode-voice-btn {
    background-color: #2196F3;
    color: white;
}

.aipa-voice-btn:hover,
.aipa-shortcode-voice-btn:hover {
    background-color: #0b7dda;
}

.aipa-voice-btn.recording,
.aipa-shortcode-voice-btn.recording {
    background-color: #f44336;
    animation: aipaPulse 1.5s infinite;
}

/* Floating Search Button Styles */
body .aipa-floating-search-btn {
    position: fixed !important;
    bottom: 200px !important;
    right: 20px !important;
    background-color: #4CAF50 !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    width: 60px !important;
    height: 60px !important;
    text-align: center !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important;
    cursor: pointer !important;
    z-index: 999999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 24px !important;
    transition: all 0.3s ease !important;
}

@media (max-width: 767px) {
    body .aipa-floating-search-btn {
        width: 50px !important;
        height: 50px !important;
        font-size: 20px !important;
    }
}

@keyframes aipaPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.aipa-voice-icon {
    margin-right: 5px;
}

/* Spinner Styles */
.aipa-spinner {
    display: none;
    width: 18px;
    height: 18px;
    margin-right: 8px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: aipaSpin 1s infinite ease-in-out;
}

@keyframes aipaSpin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.aipa-search-btn.searching .aipa-spinner,
.aipa-shortcode-search-btn.searching .aipa-spinner {
    display: inline-block;
}

/* Error Message Styles */
.aipa-search-error,
.aipa-shortcode-search-error {
    background-color: #ffebee;
    color: #f44336;
    padding: 10px 15px;
    border-radius: 4px;
    margin: 15px 0;
    display: none;
}

/* Loading Styles */
.aipa-results-loading,
.aipa-shortcode-results-loading {
    display: none;
    text-align: center;
    padding: 30px 0;
}

.aipa-loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(76, 175, 80, 0.3);
    border-radius: 50%;
    border-top-color: #4CAF50;
    animation: aipaSpin 1s infinite ease-in-out;
    margin-bottom: 10px;
}

/* Search Results Styles */
.aipa-search-results,
.aipa-shortcode-search-results {
    margin-top: 30px;
}

/* Native WooCommerce Template Styles */
.aipa-products.woocommerce {
    margin-top: 20px;
}

.aipa-product-explanation {
    padding: 10px;
    margin: 10px 0;
    background-color: #f9f9f9;
    border-left: 3px solid #4CAF50;
    font-size: 14px;
    line-height: 1.5;
}

/* Custom Products Template Styles */
.aipa-custom-products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.aipa-product {
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.aipa-product:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.aipa-product-image {
    text-align: center;
    padding: 20px;
    background-color: #f9f9f9;
}

.aipa-product-image img {
    max-width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: contain;
}

.aipa-product-details {
    padding: 15px;
}

.aipa-product-title {
    margin: 0 0 10px;
    font-size: 18px;
}

.aipa-product-title a {
    color: #333;
    text-decoration: none;
}

.aipa-product-title a:hover {
    color: #4CAF50;
}

.aipa-product-price {
    margin-bottom: 10px;
    font-weight: bold;
    color: #4CAF50;
}

.aipa-product-short-description {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

.aipa-product-add-to-cart {
    margin-top: 15px;
}

.aipa-add-to-cart-button {
    display: inline-block;
    background-color: #4CAF50;
    color: white;
    padding: 8px 15px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 15px;
    transition: background-color 0.3s;
}

.aipa-add-to-cart-button:hover {
    background-color: #45a049;
    color: white;
}

.aipa-out-of-stock {
    display: inline-block;
    background-color: #f44336;
    color: white;
    padding: 8px 15px;
    border-radius: 4px;
    font-size: 15px;
}

/* Shortcode Styles */
.aipa-search-form-container {
    margin: 30px 0;
    padding: 20px;
    border-radius: 8px;
    background-color: #f9f9f9;
}

/* Responsive Styles */
@media (max-width: 767px) {
    .aipa-search-modal-content {
        width: 95%;
        padding: 20px;
    }
    
    .aipa-search-buttons,
    .aipa-shortcode-search-buttons {
        flex-direction: column;
    }
    
    .aipa-search-btn,
    .aipa-shortcode-search-btn,
    .aipa-voice-btn,
    .aipa-shortcode-voice-btn {
        width: 100%;
        max-width: 100%;
        margin-bottom: 10px;
    }
    
    .aipa-custom-products {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* Deep Search Styles */
.aipa-deep-search-container {
    margin: 20px 0;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 5px;
    border: 1px solid #eee;
}

.aipa-search-progress {
    margin-bottom: 15px;
}

.aipa-progress-bar {
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.aipa-progress-fill {
    height: 100%;
    background-color: #4CAF50;
    transition: width 0.5s ease;
}

/* Progress Info Text Styles - Merged duplicate */
.aipa-progress-info {
    font-size: 14px;
    color: #555;
    margin-top: 5px;
    line-height: 1.4;
}

/* Search Button Style Optimization */
.aipa-deep-search-btn {
    display: inline-block;
    background-color: #2196F3;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.aipa-deep-search-btn:hover {
    background-color: #0b7dda;
}

.aipa-deep-search-btn.searching {
    background-color: #9e9e9e;
    cursor: not-allowed;
}

.aipa-deep-search-icon {
    margin-right: 8px;
    font-size: 18px;
}

/* No More Products Notice Styles */
.aipa-no-more-products {
    padding: 15px;
    margin: 15px 0;
    background-color: #fff8e1;
    border-left: 3px solid #ffc107;
    border-radius: 4px;
}

.aipa-no-more-products p {
    margin: 0;
    color: #856404;
}

/* Search Button Styles */
.aipa-search-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.aipa-search-button:hover {
    background-color: #45a049;
    transform: scale(1.05);
}

.aipa-search-button img {
    max-width: 24px;
    max-height: 24px;
}

@media (max-width: 767px) {
    .aipa-search-button {
        padding: 6px 12px;
        font-size: 14px;
    }
    
    .aipa-search-button img {
        max-width: 20px;
        max-height: 20px;
    }
}

/* Product Explanation Tooltip Styles */
.aipa-explanation-icon {
    display: inline-block;
    cursor: help;
    margin-left: 5px;
    font-size: 16px;
    color: #2196F3;
}

.aipa-tooltip {
    position: relative;
    display: inline-block;
}

.aipa-tooltip .aipa-tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #555 transparent transparent transparent;
}

.aipa-tooltip:hover .aipa-tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Global Tooltip Style Enhancement */
.aipa-tooltip .aipa-tooltip-text {
    z-index: 99999 !important;
}

/* Fix Tooltip in Custom Product Template */
.aipa-custom-products .aipa-tooltip {
    position: static;
}

/* Direct Display Explanation Styles */
.aipa-explanation-text {
    margin-top: 8px;
    padding: 8px 12px;
    background-color: #f0f8ff;
    border-left: 3px solid #2196F3;
    border-radius: 0 4px 4px 0;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

.aipa-explanation-text .aipa-explanation-icon {
    display: inline;
    margin: 0 4px 0 0;
    cursor: default;
    font-size: 16px;
    color: #2196F3;
}

.aipa-explanation-text .aipa-explanation-content {
    color: #555;
}

/* For WooCommerce native template */
.woocommerce ul.products li.product .aipa-explanation-text {
    margin: 10px 0;
    clear: both;
}

/* For custom template */
.aipa-custom-products .aipa-explanation-text {
    margin: 10px 0 15px 0;
}

/* Mobile responsive */
@media (max-width: 767px) {
    .aipa-explanation-text {
        font-size: 13px;
        padding: 6px 10px;
    }
    
    .aipa-explanation-text .aipa-explanation-icon {
        font-size: 14px;
    }
}