/******************************************************
 * 8. FRONTEND CSS FILES
 ******************************************************/

/*/ File: assets/css/avi-enhanced-search.css
/**
 * Ask Virtual Ian - Enhanced Search Styles
 */

/* Main container */
.avi-search-container {
    max-width: 100%;
    margin: 0 auto;
    font-family: inherit;
}

/* Search form */
.avi-search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.avi-search-input {
    flex: 1;
    min-width: 250px;
    padding: 12px 15px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.avi-search-button {
    padding: 12px 24px;
    background-color: #e60000;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.avi-search-button:hover {
    background-color: #cc0000;
}

/* Search results */
.avi-search-metadata {
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
}

.avi-search-result {
    margin-bottom: 25px;
    padding: 20px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.avi-search-result h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
    font-size: 18px;
}

.avi-search-result-meta {
    margin-bottom: 15px;
    font-size: 13px;
    color: #666;
}

.avi-search-result-text {
    margin-bottom: 15px;
    line-height: 1.5;
}

.avi-search-result-actions {
    margin-top: 15px;
}

.avi-search-result-actions .button {
    display: inline-block;
    padding: 8px 16px;
    background-color: #f0f0f0;
    color: #333;
    text-decoration: none;
    border-radius: 3px;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.avi-search-result-actions .button:hover {
    background-color: #e0e0e0;
}

/* AI Answer section */
.avi-search-answer {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f0f9ff;
    border-left: 4px solid #0073aa;
    border-radius: 6px;
}

.avi-search-answer h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #0073aa;
    font-size: 18px;
}

.avi-search-answer-content {
    line-height: 1.6;
}

.avi-search-answer-content p {
    margin-bottom: 15px;
}

.avi-search-answer-content strong {
    font-weight: 600;
}

.avi-search-answer-content ul, 
.avi-search-answer-content ol {
    margin-bottom: 15px;
    padding-left: 20px;
}

.avi-search-answer-content li {
    margin-bottom: 5px;
}

.source-citation {
    color: #0073aa;
    cursor: pointer;
    font-weight: 500;
    text-decoration: underline;
}

.source-citation:hover {
    color: #005a87;
    text-decoration: none;
}

/* Loading state */
.avi-search-loading {
    text-align: center;
    padding: 30px 0;
}
/* Virtual Ian image styles */
.avi-virtual-ian-image-container {
    flex: 0 0 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
}

.avi-virtual-ian-image {
    max-width: 80px;
    height: auto;
    border-radius: 50%;
}

/* Flex container for loading state */
.avi-search-loading-flex {
    display: flex;
    align-items: flex-start;
    padding: 15px 0;
}

.avi-search-loading-content {
    flex: 1;
}

/* Flex container for answer state */
.avi-search-answer-flex {
    display: flex;
    align-items: flex-start;
}

.avi-search-answer-content-wrapper {
    flex: 1;
}

/* Responsive styles for smaller screens */
@media (max-width: 576px) {
    .avi-virtual-ian-image-container {
        flex: 0 0 60px;
        margin-right: 10px;
    }
    
    .avi-virtual-ian-image {
        max-width: 60px;
    }
}

.avi-search-typing-container {
    margin-bottom: 20px;
}

.avi-search-typing {
    display: inline-block;
    font-size: 16px;
    font-weight: 500;
    padding: 10px 20px;
    background-color: #f0f0f0;
    border-radius: 20px;
    margin-bottom: 10px;
}

.avi-search-loading-message {
    font-size: 18px;
    color: #0073aa;
    font-weight: 500;
    animation: pulse 1.5s infinite;
}

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

/* Error state */
.avi-search-error {
    margin: 20px 0;
    padding: 15px;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
}

/* Modal styles */
.avi-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.4);
}

.avi-modal-content {
    position: relative;
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    width: 90%;
    max-width: 800px;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    animation: modal-appear 0.3s ease-out;
}

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

.avi-modal-close {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.avi-modal-close:hover,
.avi-modal-close:focus {
    color: #333;
    text-decoration: none;
    cursor: pointer;
}

.avi-modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

/* QA Pairs Modal Content */
.avi-modal-qa-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.avi-modal-qa-section {
    padding: 15px;
    border-radius: 6px;
}

.avi-modal-question {
    background-color: #f0f4fa;
}

.avi-modal-answer {
    background-color: #f0faf0;
}

.avi-modal-principles {
    background-color: #f8f0fa;
}

.avi-modal-explanation {
    background-color: #f0fafa;
}

.avi-modal-qa-section h3,
.avi-modal-qa-section h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.avi-modal-principles-list {
    margin: 0;
    padding-left: 20px;
}

/* Book Chapter Modal Content */
.avi-modal-book-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.avi-modal-book-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.avi-modal-book-header h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.avi-modal-book-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 14px;
    color: #666;
}

/* Duplicate Notice section */
.avi-duplicate-notice {
    margin-bottom: 20px;
    padding: 15px 20px;
    background-color: #fff9e6;
    border-left: 4px solid #ffb900;
    border-radius: 6px;
    font-size: 14px;
    color: #8a6914;
}

.avi-duplicate-notice p {
    margin: 0;
    font-weight: 500;
}

/* Result highlight when clicking source citation */
.avi-highlight-result {
    animation: highlight-pulse 1.5s;
}

@keyframes highlight-pulse {
    0% { background-color: #f9f9f9; }
    25% { background-color: #fffde7; }
    50% { background-color: #fff9c4; }
    75% { background-color: #fffde7; }
    100% { background-color: #f9f9f9; }
}

/* Responsive styles */
@media (max-width: 768px) {
    .avi-search-form {
        flex-direction: column;
    }
    
    .avi-search-input {
        min-width: 0;
    }
    
    .avi-modal-content {
        width: 95%;
        margin: 10% auto;
    }
}
