/* AIA System Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px 0;
    margin-bottom: 30px;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header h1 {
    color: #333;
    font-size: 28px;
    margin: 0;
}

.version-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-large {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    font-weight: bold;
}

/* Login View */
.login-card {
    background: white;
    border-radius: 10px;
    padding: 50px;
    text-align: center;
    max-width: 500px;
    margin: 100px auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.login-card h2 {
    margin-bottom: 20px;
    color: #333;
}

.login-card p {
    margin-bottom: 30px;
    color: #666;
}

/* Main View */
.main-content {
    padding: 20px 0;
}

.workspace {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 20px;
}

.left-panel, .right-panel {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.section {
    margin-bottom: 25px;
}

.section h3 {
    margin-bottom: 15px;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

/* Form Elements */
input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 2px dashed #667eea;
    border-radius: 5px;
    margin-bottom: 10px;
}

/* Selected File Display */
.selected-file-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: #e7f1ff;
    border: 2px solid #667eea;
    border-radius: 5px;
    margin-bottom: 10px;
    animation: slideIn 0.3s ease;
}

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

.selected-file-display span {
    color: #333;
    font-weight: 500;
    flex: 1;
}

.btn-clear {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

.btn-clear:hover {
    background: #c82333;
    transform: scale(1.1);
}

.form-select, textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 10px;
    font-family: inherit;
}

textarea {
    resize: vertical;
}

/* File List */
.file-selection-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px 10px;
    background: #f8f9fa;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    color: #555;
}

.btn-link {
    background: none;
    border: none;
    color: #667eea;
    cursor: pointer;
    font-size: 13px;
    text-decoration: underline;
    padding: 0;
}

.btn-link:hover {
    color: #5568d3;
}

.help-text {
    font-size: 12px;
    color: #666;
    margin-top: 8px;
    font-style: italic;
}

.file-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 5px;
}

.file-item {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
    position: relative;
}

.file-item:hover {
    background: #f8f9fa;
    border-color: #667eea;
    box-shadow: 0 2px 5px rgba(102, 126, 234, 0.2);
}

.file-item.selected {
    background: #e7f1ff;
    border-color: #667eea;
    border-width: 3px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.file-item.selected::before {
    content: "✓";
    position: absolute;
    left: -8px;
    top: -8px;
    background: #667eea;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.file-item-info {
    flex: 1;
    cursor: pointer;
}

.file-item-name {
    font-weight: bold;
    color: #333;
}

.file-item-meta {
    font-size: 12px;
    color: #666;
}

.file-item-actions {
    display: flex;
    gap: 5px;
    margin-left: 10px;
}

.file-item-rename {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.file-item-rename:hover {
    background: #5568d3;
    transform: scale(1.1);
}

.file-item-delete {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 5px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.file-item-delete:hover {
    background: #c82333;
    transform: scale(1.1);
}

/* Result Viewer */
.result-viewer {
    min-height: 600px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 5px;
    overflow-y: auto;
}

.result-viewer h1, .result-viewer h2, .result-viewer h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: #333;
}

.result-viewer p {
    line-height: 1.6;
    color: #555;
    margin-bottom: 15px;
}

.result-viewer ul, .result-viewer ol {
    margin-left: 30px;
    margin-bottom: 15px;
}

.result-viewer code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
}

.result-viewer pre {
    background: #e9ecef;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
}

/* Empty State */
.empty-state {
    text-align: center;
    color: #999;
    padding: 40px;
}

/* Status Messages */
.status-message {
    margin-top: 10px;
    padding: 10px;
    border-radius: 5px;
    font-size: 14px;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
}

.status-message.info {
    background: #d1ecf1;
    color: #0c5460;
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Data Source Selector */
.data-source-selector {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 10px;
}

.data-source-option {
    position: relative;
    cursor: pointer;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    transition: all 0.3s;
    display: block;
}

.data-source-option:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.data-source-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.data-source-option input[type="radio"]:checked + .option-content {
    color: #667eea;
}

.data-source-option input[type="radio"]:checked ~ .option-content::before {
    content: '';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.data-source-option input[type="radio"]:checked ~ .option-content::after {
    content: '✓';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 20px;
    height: 20px;
    color: white;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.option-content {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.option-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.option-text strong {
    font-size: 15px;
    color: #333;
}

.option-text small {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

.data-source-option input[type="radio"]:checked + .option-content .option-text strong {
    color: #667eea;
    font-weight: 600;
}

/* RAG Mode Selector */
.rag-mode-selector {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rag-mode-option {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.rag-mode-option:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.rag-mode-option input[type="radio"] {
    display: none;
}

.rag-mode-option input[type="radio"]:checked + .option-content {
    color: #667eea;
}

.rag-mode-option input[type="radio"]:checked + .option-content .option-text strong {
    color: #667eea;
    font-weight: 600;
}

/* Vector DB Button */
.btn-vectordb {
    width: 100%;
    margin-top: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    border: none;
    transition: all 0.3s;
}

.btn-vectordb:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
}

/* Clear Vector DB Button */
.btn-danger {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    font-weight: 600;
    border: none;
    transition: all 0.3s;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
    background: linear-gradient(135deg, #e082ea 0%, #e4465b 100%);
}

.btn-clear-vectordb {
    width: 100%;
    margin-top: 8px;
}

.vectordb-buttons {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
