/* BPE Tokenizer - Algorithm-specific styles */

/* Controls - keep buttons from stretching with textarea */
.controls {
    align-items: flex-start;
}

.controls button,
.controls .speed-control {
    margin-top: 6px;
}

/* Controls - wider textarea */
.controls .input-group textarea {
    min-width: 350px;
    min-height: 50px;
    max-height: 120px;
    font-size: 14px;
}

.controls .input-group input[type="number"] {
    width: 80px;
}

/* Token IDs display */
.ids-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    margin-bottom: 20px;
    min-height: 40px;
    align-items: center;
}

.token-box {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2a2a4a;
    border: 2px solid #444;
    border-radius: 6px;
    font-size: 11px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    transition: all 0.3s ease;
    color: #ccc;
    flex-shrink: 0;
}

.token-box.pair-highlight {
    border-color: #ffaa00;
    background: #3a3a2a;
    box-shadow: 0 0 10px rgba(255, 170, 0, 0.5);
    color: #ffaa00;
}

.token-box.just-merged {
    border-color: #00ff88;
    background: #1a3a2a;
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.5);
    color: #00ff88;
    animation: mergePulse 0.4s ease;
}

@keyframes mergePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Pair statistics */
.pair-stats-container {
    margin-bottom: 20px;
}

.pair-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
    align-items: center;
}

.pair-entry {
    background: #2a2a4a;
    padding: 6px 12px;
    border-radius: 5px;
    border: 1px solid #444;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #ccc;
    transition: all 0.3s ease;
    animation: fadeIn 0.3s ease;
}

.pair-entry.pair-best {
    border-color: #00ff88;
    background: #1a3a2a;
    color: #00ff88;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.pair-key {
    color: #00d9ff;
    font-weight: bold;
}

.pair-count {
    color: #aaa;
    margin-left: 4px;
}

/* Merge table */
.merge-table-container {
    margin-bottom: 20px;
}

.merge-table {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 30px;
    max-height: 200px;
    overflow-y: auto;
}

.merge-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #2a2a4a;
    padding: 6px 12px;
    border-radius: 5px;
    border: 1px solid #444;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    animation: fadeIn 0.3s ease;
}

.merge-entry.latest {
    border-color: #ffaa00;
    background: #3a3a2a;
}

.merge-pair {
    color: #00d9ff;
}

.merge-arrow {
    color: #666;
}

.merge-new-id {
    color: #00ff88;
    font-weight: bold;
}

.merge-decoded {
    color: #ff79c6;
    margin-left: 4px;
    font-size: 11px;
}

/* Right panel - Tiktokenizer-style output */

/* Token count header */
.token-count-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #3a3a5a;
}

.token-count-label {
    color: #aaa;
    font-size: 14px;
}

.token-count-value {
    font-size: 24px;
    font-weight: bold;
    color: #00d9ff;
    font-family: 'Courier New', monospace;
}

/* Colorized inline text display */
.colorized-text-box {
    background: #1a1a2e;
    border: 1px solid #3a3a5a;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    min-height: 60px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    line-height: 2;
    word-wrap: break-word;
}

.colorized-text-box .token-span {
    padding: 2px 0;
    border-radius: 3px;
    white-space: pre-wrap;
    transition: all 0.3s ease;
    cursor: default;
}

.colorized-text-box .token-span:hover {
    filter: brightness(1.3);
}

/* Token IDs display box */
.token-ids-box {
    background: #1a1a2e;
    border: 1px solid #3a3a5a;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    min-height: 40px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #aaa;
    line-height: 1.8;
    word-wrap: break-word;
}

/* Phase indicator */
.phase-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.phase-badge.train {
    background: rgba(0, 217, 255, 0.2);
    color: #00d9ff;
    border: 1px solid #00d9ff;
}

.phase-badge.encode {
    background: rgba(255, 121, 198, 0.2);
    color: #ff79c6;
    border: 1px solid #ff79c6;
}

.phase-badge.done {
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
    border: 1px solid #00ff88;
}

/* Empty state text */
.empty-text {
    color: #555;
    font-style: italic;
    font-size: 13px;
}

/* Info panel layout */
.info-panel {
    grid-template-columns: repeat(4, 1fr);
}

/* Complexity section - allow scrolling for longer content */
.complexity-content {
    max-height: none;
    overflow: visible;
}

.complexity-toggle-input:not(:checked) ~ .complexity-content {
    max-height: 0;
    overflow: hidden;
}

/* Section divider */
.phase-divider {
    text-align: center;
    padding: 10px;
    color: #666;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-top: 1px solid #3a3a5a;
    border-bottom: 1px solid #3a3a5a;
    margin: 15px 0;
}

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

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

    .controls .input-group textarea {
        min-width: 200px;
    }

    .token-box {
        width: 30px;
        height: 30px;
        font-size: 10px;
    }

    .pair-entry {
        font-size: 11px;
        padding: 4px 8px;
    }

    .merge-entry {
        font-size: 11px;
        padding: 4px 8px;
    }

    .token-output-text {
        font-size: 12px;
        padding: 4px 8px;
    }
}
