/**
 * Embeddings Comparison Lab - Styles
 * Uses CSS variables from ../shared/css/demo-styles.css for theming
 */

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

.container {
    max-width: 1800px;
    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: 600px;
    margin: 0 auto;
}

/* Main Layout */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    align-items: start;
}

/* Model Selection */
.model-selection-section {
    grid-column: 1 / -1;
    background: var(--surface-color);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--comparison-shadow);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.model-selection-section h2 {
    margin: 0 0 20px 0;
    color: var(--primary-color);
}

.model-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.model-card {
    position: relative;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    background: var(--bg-secondary);
    transition: var(--comparison-transition);
}

.model-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--comparison-shadow-lg);
    border-color: var(--primary-color);
}

.model-card input[type="checkbox"] {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.model-card input[type="checkbox"]:checked + label {
    color: var(--primary-color);
}

.model-card label {
    cursor: pointer;
    display: block;
    padding-right: 40px;
}

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

.model-specs {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.spec {
    display: inline-block;
    padding: 4px 10px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
    color: var(--text-secondary);
}

.model-desc {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin: 0;
}

.status-text {
    display: inline-block;
    margin-left: 15px;
    font-size: 0.95em;
    color: var(--success-color);
    font-weight: 500;
}

/* Tasks Section */
.tasks-section {
    grid-column: 1;
    background: var(--surface-color);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--comparison-shadow);
    border: 1px solid var(--border-color);
}

.tasks-section h2 {
    margin: 0 0 20px 0;
    color: var(--primary-color);
}

.task-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.task-tab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--comparison-transition);
}

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

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

.task-panel {
    display: none;
}

.task-panel.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

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

.task-panel h3 {
    margin: 0 0 10px 0;
    color: var(--text-primary);
}

.task-panel > p {
    color: var(--text-secondary);
    margin: 0 0 25px 0;
}

.test-inputs {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
}

.input-group {
    margin-bottom: 20px;
}

.input-group:last-child {
    margin-bottom: 0;
}

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

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

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.analogy-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.analogy-inputs input {
    flex: 1;
    min-width: 100px;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface-color);
    color: var(--text-primary);
}

.analogy-inputs input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.analogy-inputs input:disabled {
    opacity: 0.5;
    background: var(--bg-secondary);
}

.analogy-label {
    font-weight: 600;
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    padding: 12px 25px;
    font-size: 0.95em;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--comparison-transition);
}

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

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

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

.btn-secondary:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* Results Area */
.results-area {
    min-height: 200px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.results-area:empty::before {
    content: 'Results will appear here after running a test';
    color: var(--text-secondary);
    font-style: italic;
    display: block;
    text-align: center;
    padding: 40px 20px;
}

.result-card {
    background: var(--surface-color);
    border-left: 4px solid var(--primary-color);
    padding: 15px;
    margin-bottom: 12px;
    border-radius: 8px;
    box-shadow: var(--comparison-shadow);
    border: 1px solid var(--border-color);
}

.result-model {
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-score {
    display: inline-block;
    padding: 4px 12px;
    background: var(--success-color);
    color: white;
    border-radius: 12px;
    font-size: 0.85em;
}

.result-time {
    font-size: 0.85em;
    color: var(--text-secondary);
}

/* Preset Tests */
.preset-tests {
    margin-top: 20px;
}

.preset-tests h4 {
    margin: 0 0 10px 0;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.preset-btn {
    padding: 8px 15px;
    margin: 0 8px 8px 0;
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    transition: var(--comparison-transition);
    color: var(--text-primary);
}

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

/* Example Select Dropdown */
.example-select {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95em;
    background: var(--surface-color);
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.3s;
}

.example-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.example-select optgroup {
    font-weight: 600;
    color: var(--text-primary);
}

/* Category Preset Buttons */
.category-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.cat-preset-btn {
    padding: 6px 12px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    transition: var(--comparison-transition);
    color: var(--text-primary);
}

.cat-preset-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-small {
    padding: 4px 10px;
    margin-top: 8px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    color: var(--text-secondary);
}

.btn-small:hover {
    background: var(--bg-secondary);
}

/* Results Sidebar */
.results-sidebar {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.panel {
    background: var(--surface-color);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--comparison-shadow);
    border: 1px solid var(--border-color);
}

.panel h3 {
    margin: 0 0 15px 0;
    font-size: 1.1em;
    color: var(--primary-color);
}

/* Leaderboard */
.leaderboard-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    margin-bottom: 8px;
    background: var(--bg-secondary);
    border-radius: 8px;
    transition: var(--comparison-transition);
    border: 1px solid var(--border-color);
}

.leaderboard-item:hover {
    transform: translateX(5px);
    box-shadow: var(--comparison-shadow);
    border-color: var(--primary-color);
}

.leaderboard-rank {
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.9em;
    margin-right: 12px;
}

.leaderboard-rank.gold {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #333;
}

.leaderboard-rank.silver {
    background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
    color: #333;
}

.leaderboard-rank.bronze {
    background: linear-gradient(135deg, #cd7f32, #e6a857);
    color: #333;
}

.leaderboard-name {
    flex: 1;
    font-weight: 600;
    font-size: 0.9em;
    color: var(--text-primary);
}

.leaderboard-score {
    font-weight: 700;
    color: var(--success-color);
}

/* Charts */
#radar-chart,
#tradeoff-chart {
    width: 100%;
    height: 300px;
}

/* Info Panel */
.info-text {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin: 0 0 12px 0;
    line-height: 1.6;
}

.info-list {
    margin: 8px 0;
    padding-left: 20px;
    font-size: 0.85em;
}

.info-list li {
    margin: 6px 0;
    color: var(--text-secondary);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-label {
    font-size: 0.8em;
    color: var(--text-secondary);
    font-weight: 500;
}

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

/* Loading */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.97);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

[data-theme="light"] .loading {
    background: rgba(255, 255, 255, 0.97);
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading p {
    margin-top: 20px;
    font-size: 1.1em;
    color: var(--text-primary);
    font-weight: 500;
}

#loading-progress {
    width: 300px;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    margin-top: 15px;
    overflow: hidden;
}

#loading-bar {
    height: 100%;
    background: var(--gradient-primary);
    width: 0%;
    transition: width 0.3s;
}

/* Comparison Table */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.comparison-table th,
.comparison-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.comparison-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
}

.comparison-table tr:hover {
    background: var(--surface-hover);
}

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

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

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

/* How It Works Tab - Architecture Styles */
.architecture-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.architecture-diagram {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.architecture-diagram h4 {
    margin: 0 0 20px 0;
    color: var(--text-primary);
    text-align: center;
}

.arch-flow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.arch-block {
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 15px 25px;
    min-width: 280px;
    max-width: 400px;
    text-align: center;
    transition: var(--comparison-transition);
}

.arch-block:hover {
    transform: scale(1.02);
    border-color: var(--primary-color);
    box-shadow: var(--comparison-shadow-lg);
}

.arch-block.input-block {
    border-color: var(--success-color);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(34, 197, 94, 0.05));
}

.arch-block.encoder-block {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(99, 102, 241, 0.05));
}

.arch-block.output-block {
    border-color: var(--secondary-color);
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.1), rgba(168, 85, 247, 0.05));
}

.block-label {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 0.95em;
}

.block-content {
    font-size: 0.85em;
    color: var(--text-secondary);
    font-family: 'Monaco', 'Menlo', monospace;
}

.sub-block {
    background: var(--bg-secondary);
    padding: 8px 12px;
    margin: 6px 0;
    border-radius: 6px;
    font-size: 0.9em;
    border: 1px solid var(--border-color);
}

.arch-arrow {
    font-size: 1.5em;
    color: var(--primary-color);
    font-weight: bold;
}

.architecture-explanation h4 {
    margin: 0 0 15px 0;
    color: var(--text-primary);
}

.concept-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.concept-card {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    transition: var(--comparison-transition);
}

.concept-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--comparison-shadow-lg);
    border-color: var(--primary-color);
}

.concept-card h5 {
    margin: 0 0 10px 0;
    color: var(--primary-color);
    font-size: 1em;
}

.concept-card p {
    margin: 0;
    font-size: 0.9em;
    color: var(--text-secondary);
    line-height: 1.6;
}

.model-comparison-table {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.model-comparison-table h4 {
    margin: 0 0 15px 0;
    color: var(--text-primary);
}

.specs-table {
    width: 100%;
    border-collapse: collapse;
}

.specs-table th,
.specs-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.specs-table th {
    background: var(--surface-color);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.85em;
    text-transform: uppercase;
}

.specs-table td {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.specs-table tr:hover td {
    background: var(--surface-color);
}

.specs-table tr:last-child td {
    border-bottom: none;
}

.math-section {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.math-section h4 {
    margin: 0 0 20px 0;
    color: var(--text-primary);
}

.formula-box {
    background: var(--surface-color);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid var(--primary-color);
}

.formula-box:last-child {
    margin-bottom: 0;
}

.formula-box p {
    margin: 0 0 10px 0;
    color: var(--text-primary);
}

.formula-box p:first-child {
    font-weight: 600;
}

.formula {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 1.1em;
    color: var(--primary-color);
    background: var(--bg-secondary);
    padding: 12px 20px;
    border-radius: 6px;
    text-align: center;
    margin: 10px 0;
    border: 1px solid var(--border-color);
}

.formula-desc {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin: 10px 0 0 0 !important;
}

/* Responsive Design */
@media (max-width: 1400px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .results-sidebar {
        grid-column: 1;
    }

    .tasks-section {
        grid-column: 1;
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 1.8rem;
    }

    .hero-subtitle {
        font-size: 0.95em;
    }

    .model-grid {
        grid-template-columns: 1fr;
    }

    .task-tabs {
        flex-direction: column;
    }

    .analogy-inputs {
        flex-direction: column;
        align-items: stretch;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}
