/* RAG Frontend Styles */

.rag-search-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.rag-search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.rag-input {
    flex: 1;
    padding: 15px 20px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: border-color 0.3s;
    direction: rtl;
}

.rag-input:focus {
    outline: none;
    border-color: #2271b1;
}

.rag-button {
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #2271b1 0%, #135e96 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.rag-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.3);
}

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

.rag-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.rag-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
    direction: rtl;
}

.rag-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #e0e0e0;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: rag-spin 0.8s linear infinite;
}

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

.rag-error {
    padding: 15px 20px;
    background: #fee;
    color: #c00;
    border-radius: 8px;
    border-right: 4px solid #c00;
    margin-bottom: 20px;
    direction: rtl;
}

.rag-answer-container {
    animation: rag-fade-in 0.5s ease;
}

@keyframes rag-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rag-answer {
    display: flex;
    gap: 15px;
    padding: 25px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    direction: rtl;
}

.rag-answer-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.rag-answer-content {
    flex: 1;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
}

.rag-answer-content p {
    margin: 0 0 10px 0;
}

.rag-answer-content p:last-child {
    margin-bottom: 0;
}

.rag-answer-content b,
.rag-answer-content strong {
    font-weight: 600;
    color: #2271b1;
}

.rag-answer-content a {
    color: #2271b1;
    text-decoration: underline;
}

.rag-answer-content a:hover {
    color: #135e96;
}

.rag-answer-content img {
    max-width: 100px;
    height: auto;
    border-radius: 8px;
    margin: 10px 0;
}

.rag-answer-content ul,
.rag-answer-content ol {
    margin: 10px 0;
    padding-right: 20px;
}

.rag-answer-content li {
    margin: 5px 0;
}

.rag-sources {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    direction: rtl;
}

.rag-sources h4 {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rag-sources ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rag-sources li {
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
}

.rag-sources li:last-child {
    border-bottom: none;
}

.rag-source-link {
    color: #2271b1;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.rag-source-link:hover {
    color: #135e96;
    text-decoration: underline;
}

.rag-source-similarity {
    display: inline-block;
    margin-right: 10px;
    padding: 2px 8px;
    font-size: 12px;
    background: #2271b1;
    color: white;
    border-radius: 4px;
}

/* Thought Chain */
.rag-thought-chain {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
    direction: rtl;
    display: none;
}

.thought-chain-header {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 15px;
    color: #2271b1;
}

.thought-step {
    padding: 8px 12px;
    margin: 5px 0;
    background: white;
    border-radius: 4px;
    border-right: 3px solid #2271b1;
    font-size: 13px;
    animation: thought-fade-in 0.3s ease;
}

.thought-step-search {
    border-right-color: #0073aa;
}

.thought-step-analyze {
    border-right-color: #00a32a;
}

.thought-step-synthesize {
    border-right-color: #f0b849;
}

.step-icon {
    margin-left: 5px;
}

@keyframes thought-fade-in {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.rag-analysis-info {
    margin-top: 15px;
    padding: 10px;
    background: #e8f5e9;
    border-radius: 4px;
    color: #2e7d32;
    font-size: 12px;
}

/* Chain of Thought Logs */
.rag-cot-logs {
    margin: 20px 0;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    direction: rtl;
}

.rag-cot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.rag-cot-title {
    font-weight: bold;
    font-size: 16px;
    color: #2271b1;
}

.rag-cot-toggle {
    padding: 5px 15px;
    font-size: 12px;
    background: #2271b1;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.rag-cot-toggle:hover {
    background: #135e96;
}

.rag-cot-content {
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
}

.rag-cot-loading,
.rag-cot-empty,
.rag-cot-error {
    padding: 40px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.rag-cot-error {
    color: #c00;
}

.rag-cot-steps {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.rag-cot-step {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-right: 4px solid #2271b1;
    animation: cot-step-fade-in 0.3s ease;
}

.rag-cot-step-search {
    border-right-color: #0073aa;
}

.rag-cot-step-extract {
    border-right-color: #00a32a;
}

.rag-cot-step-synthesize {
    border-right-color: #f0b849;
}

.rag-cot-step-analyze {
    border-right-color: #8c43ff;
}

@keyframes cot-step-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rag-cot-step-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.rag-cot-step-icon {
    font-size: 20px;
}

.rag-cot-step-title {
    flex: 1;
    font-weight: bold;
    color: #333;
}

.rag-cot-step-time {
    font-size: 12px;
    color: #666;
}

.rag-cot-payload,
.rag-cot-response {
    margin-top: 10px;
}

.rag-cot-payload strong,
.rag-cot-response strong {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    color: #555;
}

.rag-cot-payload pre,
.rag-cot-response pre {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 10px;
    margin: 5px 0 0 0;
    font-size: 12px;
    overflow-x: auto;
    direction: ltr;
    text-align: left;
    max-height: 300px;
    overflow-y: auto;
}

.rag-cot-updating {
    padding: 15px;
    text-align: center;
    background: #e3f2fd;
    border-radius: 4px;
    margin-top: 15px;
    font-size: 13px;
    color: #1976d2;
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
    .rag-search-box {
        flex-direction: column;
    }
    
    .rag-button {
        width: 100%;
    }
    
    .rag-answer {
        flex-direction: column;
        text-align: center;
    }
    
    .rag-cot-content {
        max-height: 400px;
    }
    
    .rag-cot-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .rag-cot-toggle {
        width: 100%;
    }
}

