/* This file contains the CSS styles for the public-facing part of the plugin. */ 

body {
    font-family: Arial, sans-serif;
}

/**
 * Public-facing CSS for AI Search Integration
 */

/* Container */
.ai-search-container {
    margin: 20px 0;
    max-width: 800px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    position: relative;
}

/* Form layout */
.ai-search-form {
    display: flex;
    margin-bottom: 15px;
    position: relative;
}

.ai-search-input-wrapper {
    flex: 1;
    position: relative;
}

.ai-search-input {
    width: 100%;
    padding: 10px 12px;
    padding-right: 35px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 16px;
    line-height: 1.5;
    box-shadow: none;
    transition: border-color 0.2s ease;
}

.ai-search-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.ai-search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #757575;
    pointer-events: none;
}

/* Button styles */
.ai-search-button {
    padding: 0 16px;
    background-color: #0073aa;
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 16px;
    line-height: 1.5;
    transition: background-color 0.2s ease;
    min-width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-search-button:hover {
    background-color: #005177;
}

.ai-search-button:focus {
    outline: none;
    box-shadow: 0 0 0 2px #0073aa, 0 0 0 4px rgba(0, 115, 170, 0.3);
}

/* Voice search button */
.ai-search-voice {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23757575"><path d="M12,2A3,3,0,0,1,15,5V12a3,3,0,0,1-6,0V5A3,3,0,0,1,12,2M12,4A1,1,0,0,0,11,5V12a1,1,0,0,0,2,0V5A1,1,0,0,0,12,4M5,11H7v2H5a5,5,0,0,0,5,5v2H9v2h6V20H14V18h0a5,5,0,0,0,5-5H17V11h2a7,7,0,0,1-7,7A7,7,0,0,1,5,11Z"/></svg>') no-repeat center;
    cursor: pointer;
    border: none;
    background-color: transparent;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.ai-search-voice:hover {
    opacity: 1;
}

.ai-search-voice.listening {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Results area */
.ai-search-results-wrapper {
    position: relative;
    background-color: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
}

.ai-search-results {
    margin-top: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border-radius: 4px;
    overflow: hidden;
}

.ai-search-results-header {
    background-color: #f9f9f9;
    padding: 12px 15px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-search-results-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.ai-search-clear {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: #666;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.ai-search-clear:hover {
    background-color: #eee;
}

.ai-search-results-content {
    padding: 15px;
    line-height: 1.6;
    color: #333;
}

.ai-search-results-content p:first-child {
    margin-top: 0;
}

.ai-search-results-content p:last-child {
    margin-bottom: 0;
}

.ai-search-results-content a {
    color: #0073aa;
    text-decoration: none;
}

.ai-search-results-content a:hover {
    text-decoration: underline;
}

/* Loading indicator */
.ai-search-loading {
    text-align: center;
    padding: 20px;
    font-size: 14px;
    color: #666;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ai-search-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-bottom: 10px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #0073aa;
    animation: ai-search-spin 1s linear infinite;
}

@keyframes ai-search-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error styles */
.ai-search-error .ai-search-results-header {
    background-color: #fef0f0;
    border-color: #f5c6cb;
}

.ai-search-error .ai-search-results-header h3 {
    color: #721c24;
}

.ai-search-error .ai-search-results-content {
    color: #721c24;
    background-color: #fff;
}

/* Suggestions dropdown */
.ai-search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 10;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.ai-search-suggestions ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ai-search-suggestions li {
    margin: 0;
    padding: 0;
}

.ai-search-suggestions a {
    display: block;
    padding: 8px 12px;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.ai-search-suggestions a:hover,
.ai-search-suggestions a:focus {
    background-color: #f9f9f9;
    color: #0073aa;
    outline: none;
}

/* Adaptive styles for various container sizes */
@media (max-width: 480px) {
    .ai-search-form {
        flex-direction: column;
    }
    
    .ai-search-input {
        border-radius: 4px 4px 0 0;
    }
    
    .ai-search-button {
        border-radius: 0 0 4px 4px;
        width: 100%;
        padding: 10px;
    }
    
    .ai-search-results-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .ai-search-clear {
        position: absolute;
        top: 10px;
        right: 10px;
    }
}

/* Style variations */
/* Minimal style */
.ai-search-container.style-minimal .ai-search-input {
    border: none;
    border-bottom: 1px solid #ddd;
    border-radius: 0;
    padding-left: 0;
    background-color: transparent;
}

.ai-search-container.style-minimal .ai-search-button {
    border-radius: 0;
    background-color: transparent;
    color: #0073aa;
}

.ai-search-container.style-minimal .ai-search-results-wrapper {
    border: none;
    box-shadow: none;
}

.ai-search-container.style-minimal .ai-search-results-header {
    background-color: transparent;
    border-bottom: 1px solid #ddd;
    padding-left: 0;
    padding-right: 0;
}

/* Rounded style */
.ai-search-container.style-rounded .ai-search-input {
    border-radius: 20px 0 0 20px;
    padding-left: 20px;
}

.ai-search-container.style-rounded .ai-search-button {
    border-radius: 0 20px 20px 0;
}

.ai-search-container.style-rounded .ai-search-results-wrapper {
    border-radius: 20px;
}

/* Bordered style */
.ai-search-container.style-bordered .ai-search-form {
    border: 2px solid #0073aa;
    border-radius: 4px;
    overflow: hidden;
}

.ai-search-container.style-bordered .ai-search-input {
    border: none;
    border-radius: 0;
}

.ai-search-container.style-bordered .ai-search-button {
    border-radius: 0;
}

/* Loading state */
.ai-search-loading {
    text-align: center;
    padding: 30px;
    background-color: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #eee;
}

.ai-search-spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    margin-right: 10px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #0073aa;
    animation: ai-search-spin 1s linear infinite;
}

@keyframes ai-search-spin {
    to {
        transform: rotate(360deg);
    }
}

.ai-search-loading-text {
    display: block;
    margin-top: 10px;
    font-size: 14px;
    color: #555;
}

/* Error messages */
.ai-search-error {
    color: #d63638;
    background-color: #fde8e8;
    padding: 10px 15px;
    border-left: 4px solid #d63638;
    margin-bottom: 15px;
}

/* Footer */
.ai-search-footer {
    margin-top: 15px;
    text-align: right;
}

.ai-search-powered-by {
    font-size: 12px;
    color: #757575;
}

/* Responsive design */
@media (max-width: 600px) {
    .ai-search-form {
        flex-direction: column;
    }

    .ai-search-input {
        border-radius: 4px;
        margin-bottom: 10px;
    }

    .ai-search-button {
        border-radius: 4px;
        width: 100%;
    }
    
    .ai-search-results {
        padding: 15px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .ai-search-container {
        color: #f0f0f0;
    }
    
    .ai-search-input {
        background-color: #333;
        color: #f0f0f0;
        border-color: #555;
    }
    
    .ai-search-results,
    .ai-search-loading {
        background-color: #333;
        border-color: #555;
        color: #f0f0f0;
    }
    
    .ai-search-results h1,
    .ai-search-results h2,
    .ai-search-results h3 {
        color: #f0f0f0;
    }
    
    .ai-search-results code,
    .ai-search-results pre {
        background-color: #444;
    }
    
    .ai-search-results th {
        background-color: #444;
    }
    
    .ai-search-results th,
    .ai-search-results td {
        border-color: #555;
    }
}