/* Attention Demo Styles */

/* Demo container with visible styling */
.demo-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin: 28px 0;
}

.demo-container h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #a78bfa;
}

/* Foundation badge variant for Attention */
.lesson-badge.attention {
    color: #a78bfa;
    background: rgba(167, 139, 250, 0.1);
    border: 1px solid rgba(167, 139, 250, 0.3);
}

.progress-dot.attention {
    background: rgba(167, 139, 250, 0.3);
}

.progress-dot.active.attention {
    background: #a78bfa;
    box-shadow: 0 0 8px rgba(167, 139, 250, 0.5);
}

.progress-dot.completed.attention {
    background: #a78bfa;
}

/* Sentence display */
.sentence-display {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin: 16px 0;
    text-align: center;
}

.sentence-tokens {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    font-size: 1.2rem;
}

.token {
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-primary);
    border: 2px solid transparent;
}

.token:hover {
    background: rgba(167, 139, 250, 0.1);
    border-color: rgba(167, 139, 250, 0.3);
}

.token.selected {
    background: rgba(167, 139, 250, 0.2);
    border-color: #a78bfa;
    color: #a78bfa;
    font-weight: 600;
}

.token.focus-word {
    background: rgba(167, 139, 250, 0.15);
    border-color: rgba(167, 139, 250, 0.5);
}

/* Attention visualization container */
.attention-viz {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin: 16px 0;
    min-height: 200px;
}

.attention-canvas {
    width: 100%;
    height: 300px;
    display: block;
}

/* Attention lines visualization */
.attention-lines-container {
    position: relative;
    padding: 60px 20px;
}

.attention-lines-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.attention-line {
    stroke: #a78bfa;
    fill: none;
    transition: stroke-width 0.3s ease, opacity 0.3s ease;
}

/* Attention heatmap */
.heatmap-container {
    overflow-x: auto;
    margin: 16px 0;
}

.heatmap-grid {
    display: grid;
    gap: 2px;
    margin: 0 auto;
    width: fit-content;
}

.heatmap-cell {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    border-radius: 4px;
    transition: transform 0.2s ease;
}

.heatmap-cell:hover {
    transform: scale(1.1);
    z-index: 1;
}

.heatmap-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 8px;
    text-align: center;
    font-weight: 500;
}

.heatmap-label.row-label {
    text-align: right;
    padding-right: 12px;
}

/* Color scale for heatmap */
.heatmap-cell[data-intensity="0"] { background: rgba(167, 139, 250, 0.05); }
.heatmap-cell[data-intensity="1"] { background: rgba(167, 139, 250, 0.15); }
.heatmap-cell[data-intensity="2"] { background: rgba(167, 139, 250, 0.25); }
.heatmap-cell[data-intensity="3"] { background: rgba(167, 139, 250, 0.35); }
.heatmap-cell[data-intensity="4"] { background: rgba(167, 139, 250, 0.45); }
.heatmap-cell[data-intensity="5"] { background: rgba(167, 139, 250, 0.55); }
.heatmap-cell[data-intensity="6"] { background: rgba(167, 139, 250, 0.65); }
.heatmap-cell[data-intensity="7"] { background: rgba(167, 139, 250, 0.75); }
.heatmap-cell[data-intensity="8"] { background: rgba(167, 139, 250, 0.85); color: white; }
.heatmap-cell[data-intensity="9"] { background: rgba(167, 139, 250, 0.95); color: white; }
.heatmap-cell[data-intensity="10"] { background: #a78bfa; color: white; }

/* Step-by-step calculation */
.calc-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 16px 0;
    min-height: 180px;
}

.calc-step {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    display: none;
    transition: all 0.3s ease;
}

.calc-step.active {
    display: block;
    border-color: #a78bfa;
    box-shadow: 0 0 12px rgba(167, 139, 250, 0.2);
}

.calc-step.completed {
    display: none;
}

.calc-step h4 {
    color: #a78bfa;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.calc-step .formula {
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-primary);
    padding: 8px 12px;
    border-radius: 6px;
    margin: 8px 0;
    font-size: 0.85rem;
    overflow-x: auto;
}

.calc-step .result {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Comparison view */
.comparison-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin: 16px 0;
}

@media (max-width: 768px) {
    .comparison-container {
        grid-template-columns: 1fr;
    }
}

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

.comparison-panel h4 {
    text-align: center;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.comparison-panel .sentence-text {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: 8px;
}

.comparison-panel .focus-highlight {
    color: #a78bfa;
    font-weight: 600;
}

/* Attention weight bars */
.weight-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.weight-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.weight-bar-label {
    width: 80px;
    font-size: 0.85rem;
    text-align: right;
    color: var(--text-secondary);
}

.weight-bar-track {
    flex: 1;
    height: 24px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
}

.weight-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, rgba(167, 139, 250, 0.3), #a78bfa);
    border-radius: 4px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
}

.weight-bar-value {
    font-size: 0.75rem;
    color: white;
    font-weight: 600;
}

/* Interactive controls */
.sentence-selector {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.sentence-btn {
    padding: 10px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.sentence-btn:hover {
    border-color: rgba(167, 139, 250, 0.5);
}

.sentence-btn.active {
    background: rgba(167, 139, 250, 0.1);
    border-color: #a78bfa;
    color: #a78bfa;
}

/* Step navigation */
.step-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.step-progress {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 50px;
    text-align: center;
}

.step-btn {
    padding: 8px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.step-btn:hover:not(:disabled) {
    border-color: #a78bfa;
    color: #a78bfa;
}

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

.step-btn.primary {
    background: #a78bfa;
    border-color: #a78bfa;
    color: white;
}

.step-btn.primary:hover:not(:disabled) {
    background: #8b5cf6;
    border-color: #8b5cf6;
}

/* Context indicator */
.context-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(167, 139, 250, 0.1);
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 20px;
    font-size: 0.85rem;
    color: #a78bfa;
}

.context-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #a78bfa;
    border-radius: 50%;
}

/* Animation for attention flow */
@keyframes attentionPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.attention-animated {
    animation: attentionPulse 2s ease-in-out infinite;
}

/* Legend for attention visualization */
.attention-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.legend-scale {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-gradient {
    width: 100px;
    height: 12px;
    background: linear-gradient(90deg, rgba(167, 139, 250, 0.1), #a78bfa);
    border-radius: 4px;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .sentence-tokens {
        font-size: 1rem;
    }

    .token {
        padding: 6px 12px;
    }

    .heatmap-cell {
        width: 40px;
        height: 40px;
        font-size: 0.65rem;
    }

    .weight-bar-label {
        width: 60px;
        font-size: 0.75rem;
    }
}
