/* Forschungs-Bereich */
.research-section {
    position: fixed;
    top: 162px; /* Story-Log (120px) + Tabs (42px) */
    left: 0;
    right: 0;
    bottom: 0;
    background: #1a1a1a;
    overflow: hidden;
    z-index: 1; /* Unter Tabs (85) und Story-Log */
}

/* Wenn kein Tab aktiv ist, höher positionieren */
.research-section:not(.with-tabs) {
    top: 120px; /* Nur Story-Log */
}

.tech-tree-container {
    width: 100%;
    height: 100%;
    background: #1a1a1a;
    overflow: hidden;
}

/* Node Styling (überschreibt Default) */
.tech-tree-container .node {
    cursor: pointer;
}

.tech-tree-container .node:hover rect.node-bg {
    stroke-width: 3;
}

.tech-tree-container .node rect.node-bg {
    fill: #2a2a2a;
    stroke: #4a4a4a;
    stroke-width: 2;
    rx: 5;
    ry: 5;
    pointer-events: none; /* Events gehen durch zum Overlay */
}

.tech-tree-container .node image {
    pointer-events: none; /* Events gehen durch zum Overlay */
}

.tech-tree-container .node rect.node-event-overlay {
    pointer-events: all; /* Nur Overlay empfängt Events */
}

.tech-tree-container .node.start rect.node-bg {
    stroke: #4CAF50;
    stroke-width: 3;
}

.tech-tree-container .node-label {
    fill: #ffffff;
    font-size: 12px;
    text-anchor: middle;
    pointer-events: none;
}

/* Edge Styling */
.tech-tree-container .edge path {
    fill: none;
    opacity: 0.7;
}

.tech-tree-container .edge:hover path {
    opacity: 1;
}

/* ===== NODE STATES ===== */

/* Completed research - Green, not clickable */
.tech-tree-container .node.completed rect.node-bg {
    fill: #1a4d2e;
    stroke: #4CAF50;
    stroke-width: 3px;
}

.tech-tree-container .node.completed text {
    fill: #4CAF50;
}

.tech-tree-container .node.completed {
    cursor: not-allowed;
    opacity: 0.7;
}

.tech-tree-container .node.completed:hover rect {
    stroke-width: 3px; /* Kein Hover-Effekt */
}

/* Completed with poor quality (Quality 2) - Orange, repeatable */
.tech-tree-container .node.completed_poor rect.node-bg {
    fill: #3d2a19;
    stroke: #FF9800;
    stroke-width: 3px;
}

.tech-tree-container .node.completed_poor text {
    fill: #FF9800;
}

.tech-tree-container .node.completed_poor {
    cursor: pointer; /* Wiederholbar! */
    opacity: 0.85;
}

.tech-tree-container .node.completed_poor:hover rect.node-bg {
    fill: #4d3a29;
    stroke: #FFB74D;
    stroke-width: 4px;
}

/* Available research - Blue, clickable */
.tech-tree-container .node.available rect.node-bg {
    fill: #1a2332;
    stroke: #2196F3;
    stroke-width: 2px;
}

.tech-tree-container .node.available text {
    fill: #ffffff;
}

.tech-tree-container .node.available {
    cursor: pointer;
}

.tech-tree-container .node.available:hover rect.node-bg {
    fill: #243447;
    stroke: #42A5F5;
    stroke-width: 3px;
}

/* Locked research - Gray, not visible (filtered out, but in case) */
.tech-tree-container .node.locked rect.node-bg {
    fill: #1a1a1a;
    stroke: #666;
    stroke-width: 1px;
}

.tech-tree-container .node.locked text {
    fill: #666;
}

.tech-tree-container .node.locked {
    cursor: not-allowed;
    opacity: 0.4;
}

/* In-progress research - Yellow, pulsing */
.tech-tree-container .node.in_progress rect.node-bg {
    fill: #3d3319;
    stroke: #FFC107;
    stroke-width: 3px;
    animation: pulse 2s infinite;
}

.tech-tree-container .node.in_progress text {
    fill: #FFC107;
}

.tech-tree-container .node.in_progress {
    cursor: not-allowed;
}

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

/* ===== TECH-TREE TOOLTIP ===== */

.tech-tree-tooltip {
    position: fixed;
    z-index: 10000;
    min-width: 250px;
    max-width: 350px;
    background: #1a1a1a;
    border: 2px solid #4a4a4a;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    pointer-events: none; /* Tooltip blockiert keine Maus-Events */
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.tech-tree-tooltip.visible {
    opacity: 1;
}

/* Header */
.tech-tree-tooltip .tooltip-header {
    padding: 12px;
    border-bottom: 1px solid #4a4a4a;
    border-radius: 6px 6px 0 0;
}

.tech-tree-tooltip .tooltip-header.completed {
    background: linear-gradient(135deg, #1a4d2e, #2a5d3e);
    border-bottom-color: #4CAF50;
}

.tech-tree-tooltip .tooltip-header.completed_poor {
    background: linear-gradient(135deg, #3d2a19, #4d3a29);
    border-bottom-color: #FF9800;
}

.tech-tree-tooltip .tooltip-header.in-progress {
    background: linear-gradient(135deg, #3d3319, #4d4329);
    border-bottom-color: #FFC107;
}

.tech-tree-tooltip .tooltip-header.available {
    background: linear-gradient(135deg, #1a2332, #2a3342);
    border-bottom-color: #2196F3;
}

.tech-tree-tooltip .tooltip-header.locked {
    background: linear-gradient(135deg, #2a2a2a, #3a3a3a);
    border-bottom-color: #666;
}

.tech-tree-tooltip .tooltip-status {
    font-size: 11px;
    text-transform: uppercase;
    opacity: 0.8;
    margin-bottom: 4px;
}

.tech-tree-tooltip .tooltip-title {
    font-size: 16px;
    font-weight: bold;
    color: #ffffff;
}

/* Body */
.tech-tree-tooltip .tooltip-body {
    padding: 12px;
}

.tech-tree-tooltip .tooltip-body > div {
    margin-bottom: 8px;
}

.tech-tree-tooltip .tooltip-body > div:last-child {
    margin-bottom: 0;
}

.tech-tree-tooltip .label {
    font-size: 12px;
    color: #aaa;
    margin-right: 8px;
}

.tech-tree-tooltip .value {
    font-size: 13px;
    color: #fff;
}

/* Quality Display */
.tech-tree-tooltip .tooltip-quality {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tech-tree-tooltip .stars {
    color: #FFC107;
    font-size: 14px;
    letter-spacing: 2px;
}

.tech-tree-tooltip .number {
    font-size: 12px;
    color: #FFC107;
    font-weight: bold;
}

/* Result */
.tech-tree-tooltip .tooltip-result .value {
    color: #4CAF50;
    font-weight: bold;
}

/* Effect (kleinere Schrift, kursiv) */
.tech-tree-tooltip .tooltip-effect {
    font-size: 12px;
    color: #bbb;
    font-style: italic;
    padding: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

/* Comment (mit Anführungszeichen-Optik) */
.tech-tree-tooltip .tooltip-comment {
    font-size: 11px;
    color: #999;
    font-style: italic;
    padding: 6px;
    border-left: 3px solid #4a4a4a;
    margin-top: 6px;
}

/* Progress Bar */
.tech-tree-tooltip .progress-bar-container {
    position: relative;
    width: 100%;
    height: 24px;
    background: #2a2a2a;
    border: 1px solid #4a4a4a;
    border-radius: 4px;
    overflow: hidden;
}

.tech-tree-tooltip .progress-bar-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, #FFC107, #FFD54F);
    transition: width 0.3s ease-out;
}

.tech-tree-tooltip .progress-text {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: bold;
    color: #1a1a1a;
    text-shadow: 0 0 2px rgba(255, 255, 255, 0.5);
    z-index: 1;
}

/* Hint Text */
.tech-tree-tooltip .tooltip-hint {
    font-size: 11px;
    color: #888;
    font-style: italic;
    margin-top: 8px;
}

/* Prerequisite Warning */
.tech-tree-tooltip .tooltip-prerequisite {
    font-size: 12px;
    color: #e94560;
    padding: 8px;
    background: rgba(233, 69, 96, 0.1);
    border: 1px solid rgba(233, 69, 96, 0.3);
    border-radius: 4px;
}


