/* Power Tree Visualizer - Chapter 4 Styles */

.power-tree-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 20px;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    font-family: 'Poppins', sans-serif;
    user-select: none;
}

.power-tree-header {
    text-align: center;
    flex-shrink: 0;
    margin-bottom: 10px;
}

.power-tree-header h2 {
    font-size: 1.6rem;
    color: #2b2d42;
    margin: 0 0 5px 0;
    font-weight: 700;
}

.equation-display {
    font-size: 2.2rem;
    font-weight: 700;
    color: #4361ee;
    margin-bottom: 2px;
    letter-spacing: 1px;
}

.equation-display .superscript {
    font-size: 1.2rem;
    vertical-align: super;
    margin-left: 2px;
}

.leaf-value-display {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 0.92rem;
    font-weight: 500;
}

.lv-base {
    background: rgba(67, 97, 238, 0.1);
    color: #4361ee;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
}

.lv-arrow {
    color: #adb5bd;
    font-size: 1rem;
}

.lv-msg {
    background: rgba(0, 200, 100, 0.1);
    color: #1a8a4a;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 20px;
}

.power-tree-stage {
    flex: 1;
    width: 100%;
    background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 4px 15px rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
    min-height: 0; /* Important for flex child */
}

#tree-svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* SVG Line Transitions */
.tree-branch {
    stroke-linecap: round;
    transition: x1 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), 
                y1 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), 
                x2 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), 
                y2 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), 
                stroke-width 0.5s ease, 
                stroke 0.5s ease, 
                opacity 0.4s ease;
}

.tree-leaf {
    fill: #00f576;
    filter: drop-shadow(0 0 6px rgba(0, 245, 118, 0.8));
    transition: cx 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), 
                cy 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), 
                r 0.5s ease, 
                opacity 0.4s ease;
}

/* Controls Section */
.power-tree-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    width: 100%;
    background: #f8f9fa;
    padding: 15px 30px;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    flex-shrink: 0;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    width: 200px;
}

.control-group label {
    font-weight: 600;
    color: #34495e;
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.control-group span {
    color: #4361ee;
    font-weight: 700;
    background: rgba(67, 97, 238, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
}

/* Custom Tailwind-style Sliders */
input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
    margin: 0;
}

input[type=range]:focus {
    outline: none;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    background: #cbd5e1; /* Tailwind slate-300 */
    border-radius: 4px;
    transition: background 0.2s;
}

input[type=range]::-webkit-slider-thumb {
    height: 22px;
    width: 22px;
    border-radius: 50%;
    background: #4f46e5; /* Tailwind indigo-600 */
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -7px;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.4);
    transition: transform 0.1s;
    border: 2px solid white;
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    background: #4338ca; /* Tailwind indigo-700 */
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .power-tree-controls {
        flex-direction: column;
        gap: 20px;
    }
    .equation-display {
        font-size: 1.8rem;
    }
}

/* ===== Gonit Ongon 2.0 de-slop (tokens from design-system.css) ===== */
.power-tree-container {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    font-family: var(--font-sans);
}
.power-tree-header h2 { color: var(--color-ink); }
.power-tree-container .equation-display { color: var(--color-accent); }
.lv-base { background: var(--color-accent-soft); color: var(--color-accent-active); border-radius: var(--radius-full); }
.lv-msg { background: var(--color-success-soft); color: var(--emerald-700); border-radius: var(--radius-full); }
.power-tree-stage { background: var(--color-surface-2); border: 1px solid var(--color-border); box-shadow: none; }
.power-tree-controls { background: var(--color-surface-2); border: 1px solid var(--color-border); }
.control-group label { color: var(--color-ink-2); }
.control-group span { color: var(--color-accent-active); background: var(--color-accent-soft); border-radius: var(--radius-sm); }
.tree-leaf { fill: var(--color-accent); filter: none; }
input[type=range]::-webkit-slider-runnable-track { background: var(--color-surface-2); }
input[type=range]::-webkit-slider-thumb { background: var(--color-accent); border: 2px solid var(--color-surface); box-shadow: 0 1px 4px rgba(5,150,105,0.5); }
input[type=range]::-webkit-slider-thumb:hover { background: var(--color-accent-hover); }
