/**
 * RAG System Demo - Styles
 * Uses CSS variables from ../shared/css/demo-styles.css for theming
 */

/* Demo-specific variables that don't conflict with theming */
:root {
    --rag-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --rag-shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
    --rag-transition: all 0.3s ease;
}

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

/* Hero Header - matches ELIZA demo styling */
.hero-header {
    padding: 3rem 0 2rem;
    margin-bottom: 30px;
    text-align: center;
    background: linear-gradient(180deg, var(--surface-color) 0%, var(--bg-color) 100%);
}

.hero-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    margin-bottom: 1rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
}

/* Cards */
.card {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--rag-shadow);
    border: 1px solid var(--border-color);
    transition: var(--rag-transition);
}

.card h2 {
    font-size: 1.5em;
    margin-bottom: 16px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card h3 {
    font-size: 1.2em;
    margin-bottom: 12px;
    color: var(--text-primary);
}

/* Grid Layout */
.grid {
    display: grid;
    gap: 24px;
    margin-bottom: 24px;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #6d28d9;
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

input[type="text"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    transition: var(--rag-transition);
    font-family: inherit;
    background: var(--surface-color);
    color: var(--text-primary);
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* File Upload */
.file-upload {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: var(--rag-transition);
    background: var(--bg-secondary);
}

.file-upload:hover {
    border-color: var(--primary-color);
    background: var(--surface-hover);
}

.file-upload input[type="file"] {
    display: none;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 24px;
    background: var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin: 16px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.85em;
    font-weight: 600;
}

/* Status Messages */
.status {
    padding: 12px 16px;
    border-radius: 8px;
    margin: 16px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info-color);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.status-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning-color);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Retrieved Chunks */
.chunk-list {
    max-height: 500px;
    overflow-y: auto;
    padding: 10px;
}

.chunk-item {
    background: var(--bg-secondary);
    border-left: 4px solid var(--primary-color);
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 8px;
    transition: var(--rag-transition);
}

.chunk-item:hover {
    transform: translateX(5px);
    box-shadow: var(--rag-shadow);
}

.chunk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.chunk-title {
    font-weight: 600;
    color: var(--primary-color);
}

.similarity-score {
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

.chunk-text {
    color: var(--text-secondary);
    line-height: 1.6;
}

.chunk-metadata {
    margin-top: 10px;
    font-size: 0.85em;
    color: var(--text-muted);
}

/* Answer Display */
.answer-box {
    background: var(--bg-secondary);
    border-left: 4px solid var(--success-color);
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    border: 1px solid var(--border-color);
}

.answer-box h4 {
    color: var(--success-color);
    margin-bottom: 12px;
}

.answer-text {
    font-size: 1.1em;
    line-height: 1.8;
    color: var(--text-primary);
}

/* Comparison View */
.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 20px;
}

.comparison-item {
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
}

.comparison-item.with-rag {
    border-color: var(--success-color);
}

.comparison-item.without-rag {
    border-color: var(--warning-color);
}

/* Statistics */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-value {
    font-size: 2em;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.9em;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Visualization Canvas */
.visualization-container {
    width: 100%;
    height: 500px;
    background: var(--card-bg);
    border-radius: 8px;
    border: 2px solid var(--border-color);
    position: relative;
}

#embedding-canvas {
    width: 100%;
    height: 100%;
}

.viz-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.tab {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.tab:hover {
    color: var(--primary-color);
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Loading Spinner */
.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Timing Info */
.timing-info {
    display: flex;
    gap: 20px;
    margin-top: 16px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 8px;
}

.timing-item {
    flex: 1;
    text-align: center;
}

.timing-value {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--primary-color);
}

.timing-label {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Document List */
.document-list {
    max-height: 400px;
    overflow-y: auto;
}

.document-item {
    background: var(--bg-color);
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.document-title {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.document-meta {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.document-preview {
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Responsive */
@media (max-width: 768px) {
    .grid-2,
    .grid-3,
    .comparison-grid {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 1.8em;
    }

    .visualization-container {
        height: 300px;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Highlight */
.highlight {
    background: #fef3c7;
    padding: 2px 4px;
    border-radius: 3px;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

.badge-primary {
    background: #dbeafe;
    color: #1e40af;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}
