/* Group Anagrams - Algorithm-specific styles */

/* Word list display */
.word-list {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.word-box {
    padding: 10px 18px;
    background: #2a2a4a;
    border: 2px solid #444;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    transition: all 0.3s ease;
    color: #fff;
}

.word-box.current {
    border-color: #ffaa00;
    background: #3a3a2a;
    box-shadow: 0 0 15px rgba(255, 170, 0, 0.5);
}

.word-box.visited {
    border-color: #666;
    color: #999;
}

/* Group color classes */
.word-box.group-0 { border-color: #4ecdc4; background: rgba(78, 205, 196, 0.15); color: #4ecdc4; }
.word-box.group-1 { border-color: #ff6b6b; background: rgba(255, 107, 107, 0.15); color: #ff6b6b; }
.word-box.group-2 { border-color: #ffd700; background: rgba(255, 215, 0, 0.15); color: #ffd700; }
.word-box.group-3 { border-color: #9b59b6; background: rgba(155, 89, 182, 0.15); color: #9b59b6; }
.word-box.group-4 { border-color: #2ecc71; background: rgba(46, 204, 113, 0.15); color: #2ecc71; }
.word-box.group-5 { border-color: #e67e22; background: rgba(230, 126, 34, 0.15); color: #e67e22; }
.word-box.group-6 { border-color: #3498db; background: rgba(52, 152, 219, 0.15); color: #3498db; }
.word-box.group-7 { border-color: #e74c3c; background: rgba(231, 76, 60, 0.15); color: #e74c3c; }

/* Processing section */
.processing-section {
    text-align: center;
    margin: 15px 0;
}

.current-word-display {
    display: flex;
    justify-content: center;
    gap: 4px;
    min-height: 50px;
    align-items: center;
    font-size: 18px;
    color: #888;
}

.current-word-char {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2a2a4a;
    border: 2px solid #444;
    border-radius: 6px;
    font-size: 18px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    transition: all 0.3s ease;
    color: #fff;
}

.current-word-char.current {
    border-color: #ffaa00;
    background: #3a3a2a;
    box-shadow: 0 0 10px rgba(255, 170, 0, 0.4);
    color: #ffaa00;
}

.current-word-char.scanned {
    border-color: #00d9ff;
    background: #1a2a3a;
    color: #00d9ff;
}

/* Frequency grid */
.freq-section {
    margin: 20px 0;
}

.freq-grid {
    display: flex;
    justify-content: center;
    gap: 1px;
    flex-wrap: nowrap;
    margin-bottom: 2px;
}

.freq-cell {
    width: 22px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2a2a4a;
    border: 1px solid #444;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    transition: all 0.3s ease;
    color: #555;
    flex-shrink: 0;
}

.freq-cell.nonzero {
    color: #00ff88;
    border-color: #00ff88;
    background: #1a3a2a;
}

.freq-cell.current {
    border-color: #ffaa00;
    background: #3a3a2a;
    box-shadow: 0 0 8px rgba(255, 170, 0, 0.5);
    color: #ffaa00;
    animation: freqPulse 0.3s ease;
}

.freq-labels {
    display: flex;
    justify-content: center;
    gap: 1px;
}

.freq-label {
    width: 22px;
    text-align: center;
    font-size: 9px;
    color: #666;
    font-family: 'Courier New', monospace;
    flex-shrink: 0;
}

/* Hash key display */
.hashkey-section {
    margin: 15px 0;
    text-align: center;
}

.hashkey-display {
    display: inline-block;
    padding: 10px 20px;
    background: #2a2a4a;
    border: 1px solid #444;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #888;
    max-width: 100%;
    overflow-x: auto;
    word-break: break-all;
    transition: all 0.3s ease;
}

.hashkey-display.active {
    border-color: #00d9ff;
    color: #00d9ff;
    box-shadow: 0 0 10px rgba(0, 217, 255, 0.3);
}

/* HashMap overrides for vertical stacking */
.hashmap-container .hashmap {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
}

.hashmap-container .hashmap-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    padding: 10px 15px;
    width: auto;
}

.hashmap-entry .hashmap-key-label {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #00d9ff;
    white-space: nowrap;
}

.hashmap-entry .hashmap-arrow {
    color: #666;
}

.hashmap-entry .hashmap-words {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.hashmap-entry .hashmap-word {
    background: #1a2a3a;
    padding: 4px 10px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #fff;
}

.hashmap-entry .hashmap-word.new-word {
    animation: fadeIn 0.4s ease;
    border: 1px solid #ffaa00;
}

/* Group-colored hashmap entries */
.hashmap-entry.group-0 { border-left: 3px solid #4ecdc4; }
.hashmap-entry.group-1 { border-left: 3px solid #ff6b6b; }
.hashmap-entry.group-2 { border-left: 3px solid #ffd700; }
.hashmap-entry.group-3 { border-left: 3px solid #9b59b6; }
.hashmap-entry.group-4 { border-left: 3px solid #2ecc71; }
.hashmap-entry.group-5 { border-left: 3px solid #e67e22; }
.hashmap-entry.group-6 { border-left: 3px solid #3498db; }
.hashmap-entry.group-7 { border-left: 3px solid #e74c3c; }

/* Section titles */
.section-title {
    font-size: 14px;
    color: #888;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.empty-text {
    color: #666;
}

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

/* Frequency pulse animation */
@keyframes freqPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

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

/* Wider input for word list */
.controls .input-group input[type="text"] {
    min-width: 280px;
}

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

    .freq-cell {
        width: 18px;
        height: 22px;
        font-size: 10px;
    }

    .freq-label {
        width: 18px;
        font-size: 7px;
    }

    .word-box {
        font-size: 14px;
        padding: 8px 12px;
    }

    .controls .input-group input[type="text"] {
        min-width: 180px;
    }
}
