/* LLM4LLM Shared Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 0;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.breadcrumb {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.breadcrumb a {
    color: white;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.header p {
    opacity: 0.9;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.main-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.main-grid.equal {
    grid-template-columns: 1fr 1fr;
}

.main-grid.single {
    grid-template-columns: 1fr;
}

/* Panels and Cards */
.panel {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #333;
    display: flex;
    align-items: center;
}

.section-icon {
    margin-right: 0.5rem;
    font-size: 1.2rem;
}

/* Control Groups */
.control-group {
    margin-bottom: 2rem;
}

.control-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #555;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
    cursor: pointer;
    text-align: center;
}

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

.btn-primary:hover {
    background: #5a6fd8;
}

.btn-secondary {
    background: #f8f9fa;
    color: #667eea;
    border: 1px solid #e9ecef;
}

.btn-secondary:hover {
    background: #e9ecef;
}

.preset-btn {
    padding: 0.5rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    text-align: center;
}

.preset-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.demo-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.demo-btn:hover {
    background: #5a6fd8;
}

.demo-btn.secondary {
    background: #f8f9fa;
    color: #667eea;
    border: 1px solid #e9ecef;
}

.demo-btn.secondary:hover {
    background: #e9ecef;
}

.demo-btn.active {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

/* Button Groups */
.preset-buttons, .preset-layouts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin: 1rem 0;
}

.demo-controls, .flow-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

/* Toggle Controls */
.toggle-group {
    display: flex;
    background: #f8f9fa;
    border-radius: 6px;
    padding: 0.25rem;
}

.toggle-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

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

.flow-btn {
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.flow-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.flow-btn.active {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

/* Form Elements */
.text-input {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.9rem;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.text-input:focus {
    outline: none;
    border-color: #667eea;
}

.search-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.context-input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-family: monospace;
}

/* Sliders */
.slider-container {
    margin: 1rem 0;
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e9ecef;
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.slider-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #667eea;
    margin-top: 0.5rem;
    text-align: center;
}

/* Statistics and Data Display */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    border-left: 4px solid #667eea;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.25rem;
}

/* Charts and Visualizations */
.chart-container {
    width: 100%;
    height: 300px;
    margin-bottom: 1rem;
}

.chart-container.large {
    height: 400px;
}

.chart-container.small {
    height: 200px;
}

.chart-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.chart-controls label {
    font-size: 0.9rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-controls input[type="checkbox"] {
    margin-right: 0.5rem;
}

/* Canvas */
.canvas {
    width: 100%;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: #fafafa;
    cursor: move;
    position: relative;
}

.canvas.interactive {
    cursor: pointer;
}

/* Progress and Probability Bars */
.probability-bar, .prob-bar {
    width: 100%;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.prob-bar {
    height: 8px;
    width: 100px;
    border-radius: 4px;
}

.probability-fill, .prob-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
}

.prob-fill {
    background: #28a745;
    font-size: 0.7rem;
}

/* Lists and Items */
.item-list {
    display: grid;
    gap: 0.5rem;
}

.item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: white;
    border-radius: 4px;
    border-left: 3px solid #667eea;
    transition: all 0.2s ease;
}

.item:hover {
    border-color: #5a6fd8;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.item-text {
    font-family: monospace;
    font-weight: 500;
}

.item-count, .item-badge {
    background: #667eea;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
}

/* Word and Token Elements */
.word-point {
    position: absolute;
    background: #667eea;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.word-point:hover {
    background: #5a6fd8;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.word-point.selected {
    background: #28a745;
    transform: scale(1.1);
}

.word-point.neighbor {
    background: #ffc107;
    color: #333;
}

.word-tag {
    background: #e9ecef;
    color: #495057;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    margin: 0.1rem;
}

.word-tag:hover {
    background: #667eea;
    color: white;
}

.word-option {
    padding: 0.5rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    text-align: center;
    transition: all 0.2s ease;
}

.word-option:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.word-option.selected {
    background: #667eea;
    color: white;
    border-color: #5a6fd8;
}

/* Display Areas */
.display-area {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.display-area.scrollable {
    max-height: 400px;
    overflow-y: auto;
}

.text-sequence {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    line-height: 1.8;
}

/* Special Text Styles */
.predicted-word {
    background: #667eea;
    color: white;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-weight: bold;
    animation: pulse 2s infinite;
}

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

.context-words {
    color: #666;
}

.human-text {
    color: #dc3545;
    font-weight: 500;
}

.ai-text {
    color: #28a745;
    font-weight: 500;
}

.seen-ngram {
    background: #d4edda;
    color: #155724;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    margin: 0.1rem;
    display: inline-block;
}

.unseen-ngram {
    background: #f8d7da;
    color: #721c24;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    margin: 0.1rem;
    display: inline-block;
}

/* Info Panels */
.insights-panel {
    background: #e8f2ff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    border-left: 4px solid #667eea;
}

.insights-panel h4 {
    color: #333;
    margin-bottom: 1rem;
}

.insights-panel ul {
    list-style: none;
}

.insights-panel li {
    margin-bottom: 0.5rem;
    padding-left: 1rem;
    position: relative;
}

.insights-panel li:before {
    content: "💡";
    position: absolute;
    left: 0;
}

.problem-demo {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.problem-demo h4 {
    color: #856404;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.problem-demo h4:before {
    content: "⚠️";
    margin-right: 0.5rem;
}

.instructions {
    background: #e8f2ff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid #667eea;
}

.instructions h4 {
    color: #333;
    margin-bottom: 1rem;
}

.instructions ul {
    list-style: none;
}

.instructions li {
    margin-bottom: 0.5rem;
    padding-left: 1rem;
    position: relative;
}

.instructions li:before {
    content: "👆";
    position: absolute;
    left: 0;
}

/* Comparison and Demo Cards */
.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.comparison-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
}

.comparison-card.traditional {
    border-color: #dc3545;
}

.comparison-card.llm {
    border-color: #28a745;
}

.comparison-card h4 {
    margin-bottom: 1rem;
}

.comparison-card.traditional h4 {
    color: #dc3545;
}

.comparison-card.llm h4 {
    color: #28a745;
}

.demo-column {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    border-left: 4px solid #667eea;
}

.demo-column h3 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* Categories and Groups */
.category-group {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    border-left: 4px solid #667eea;
    margin-bottom: 1rem;
}

.category-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.category-words {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Selectors and Options */
.word-selector {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-tag {
    background: #f8f9fa;
    color: #667eea;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    border: 1px solid #e9ecef;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-tag:hover,
.filter-tag.active {
    background: #667eea;
    color: white;
}

/* Special Effects and States */
.similarity-line {
    position: absolute;
    background: rgba(102, 126, 234, 0.3);
    height: 2px;
    pointer-events: none;
    z-index: 1;
}

.exponential-warning {
    background: #dc3545;
    color: white;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    text-align: center;
    font-weight: 500;
}

/* Flow and Step Displays */
.instruction-flow {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.flow-step {
    display: flex;
    align-items: center;
    margin: 1rem 0;
    padding: 1rem;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.step-number {
    background: #667eea;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 1rem;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.step-description {
    color: #666;
    font-size: 0.9rem;
}

/* Similarity and Analysis Displays */
.similarity-display {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.similarity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e9ecef;
}

.similarity-item:last-child {
    border-bottom: none;
}

.similarity-words {
    font-weight: 500;
}

.similarity-score {
    color: #667eea;
    font-weight: 600;
}

/* Pattern and Prediction Displays */
.pattern-examples {
    display: grid;
    gap: 1rem;
}

.pattern-item {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 1rem;
    transition: all 0.2s ease;
}

.pattern-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.pattern-instruction {
    color: #dc3545;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.pattern-response {
    color: #28a745;
    font-weight: 500;
}

.pattern-type {
    background: #f8f9fa;
    color: #667eea;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    display: inline-block;
}

.pattern-probability {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.5rem;
}

.prediction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #28a745;
}

.prediction-word {
    font-family: monospace;
    font-weight: 600;
    font-size: 1.1rem;
}

.prediction-prob {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.prob-text {
    font-size: 0.9rem;
    color: #666;
    min-width: 40px;
}

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

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .demo-controls, .flow-controls {
        flex-direction: column;
    }
    
    .preset-buttons, .preset-layouts {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .chart-container {
        height: 250px;
    }
    
    .chart-container.large {
        height: 300px;
    }
    
    .word-selector {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .word-selector {
        grid-template-columns: 1fr;
    }
    
    .chart-controls {
        flex-direction: column;
        align-items: flex-start;
    }
}
