/* Huffman Coding Visualizer Styles */

.subtitle {
    text-align: center;
    color: #666;
    margin-top: -10px;
    margin-bottom: 30px;
}

/* Input Section */
#inputText {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    resize: vertical;
    margin-bottom: 15px;
    box-sizing: border-box;
}

#inputText:focus {
    outline: none;
    border-color: #4CAF50;
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-primary, .btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

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

/* Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-radius: 10px;
    border: 2px solid #667eea30;
}

.stat-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

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

/* Table Styles */
.table-container {
    overflow-x: auto;
    margin-top: 15px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    font-weight: 600;
}

tbody tr:hover {
    background-color: #f5f5f5;
}

.char-display {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 16px;
    padding: 4px 8px;
    background: #f0f0f0;
    border-radius: 4px;
}

.code-display {
    font-family: 'Courier New', monospace;
    color: #667eea;
    font-weight: bold;
}

/* Tree Visualization */
.tree-container {
    width: 100%;
    overflow-x: auto;
    margin-top: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    box-sizing: border-box;
}

#treeSvg {
    width: 100%;
    min-height: 400px;
}

.tree-node {
    cursor: pointer;
}

.tree-node circle {
    fill: white;
    stroke: #667eea;
    stroke-width: 2;
    transition: all 0.3s ease;
}

.tree-node.leaf circle {
    fill: #667eea;
}

.tree-node:hover circle {
    fill: #764ba2;
    stroke: #764ba2;
}

.tree-node.leaf:hover circle {
    fill: #8860d0;
}

.tree-node text {
    fill: #333;
    font-size: 12px;
    font-weight: 500;
    pointer-events: none;
}

.tree-node.leaf text {
    fill: white;
}

.tree-link {
    fill: none;
    stroke: #999;
    stroke-width: 2;
}

.tree-edge-label {
    font-size: 14px;
    font-weight: bold;
    fill: #667eea;
}

/* Output Section */
.output-group {
    margin-bottom: 20px;
}

.output-group h3 {
    margin-bottom: 10px;
    color: #333;
    font-size: 16px;
}

.output-box {
    background: #f9f9f9;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
    line-height: 1.6;
}

/* Info Section */
.info-text {
    background: #fffbea;
    border-left: 4px solid #f59e0b;
    padding: 12px;
    margin: 15px 0;
    border-radius: 4px;
    color: #92400e;
}

.info-card {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #fbbf24;
}

.info-content {
    line-height: 1.8;
}

.info-content h3 {
    color: #92400e;
    margin-top: 20px;
    margin-bottom: 10px;
}

.info-content ul, .info-content ol {
    margin-left: 20px;
}

.info-content li {
    margin-bottom: 8px;
}

.info-content strong {
    color: #78350f;
}

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

    .button-group {
        flex-direction: column;
    }

    .btn-primary, .btn-secondary {
        width: 100%;
    }
}
