/* --- Global Styles --- */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f1f5f9;
}

/* --- General Button Styles --- */
.control-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.control-button.active {
    background-color: #0369a1; /* sky-700 */
    color: white;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.control-button.inactive {
    background-color: #f1f5f9; /* slate-100 */
    color: #0369a1; /* sky-700 */
    border-color: #e2e8f0; /* slate-200 */
}

.control-button.reset-button {
    background-color: #fee2e2; /* red-100 */
    color: #b91c1c; /* red-800 */
    border-color: #fca5a5; /* red-300 */
}

.control-button:hover {
    transform: translateY(-2px);
}

.jump-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    margin-top: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e3a8a;
    background-color: #dbeafe;
    border: 1px solid #93c5fd;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.jump-button:hover {
    background-color: #bfdbfe;
    color: #1e40af;
}

/* --- Network Graph Styles --- */
.node {
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    position: absolute;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.node:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    z-index: 15;
    filter: none !important; /* On hover, always show full color */
}

.node.active {
    box-shadow: 0 0 0 4px #38bdf8;
    border-color: #0284c7;
    transform: scale(1.05);
    z-index: 20;
    filter: none !important;
}

.node.related {
    outline: 2px dashed #22d3ee;
    /*outline-offset: 4px;*/
    filter: none !important;
}

/* Use filter to wash out colors instead of using opacity */
.node.faded {
    filter: saturate(30%);
}

.node.faded .node-title,
.node.faded .node-keywords {
    color: #9ca3af !important; /* A neutral, lighter grey to override specific text colors */
}

.node-content {
    text-align: center;
}

.node-title {
    font-weight: 600;
}

.node-keywords {
    font-size: 0.8rem;
    line-height: 1.2;
    color: #475569;
}

/* Quiz Mode Styles */
.node.locked {
    background-color: #e2e8f0 !important;
    border-color: #94a3b8 !important;
    filter: none; /* Do not apply faded filter to locked nodes */
}

.node.locked .node-content {
    display: none;
}

.node-locked-icon {
    display: none;
    font-size: 2.5rem;
    font-weight: 700;
    color: #64748b;
}

.node.locked .node-locked-icon {
    display: block;
}

/* --- Layout and Panel Styles --- */
.tier-title {
    text-align: center;
    font-weight: 700;
    color: #475569;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 2rem;
    border-bottom: 2px solid #cbd5e1;
    padding-bottom: 0.5rem;
    position: relative;
    z-index: 2;
    background-color: #f1f5f9;
}

#detail-content {
    transition: opacity 0.15s ease-in-out;
}

#detail-content.content-hiding {
    opacity: 0;
}

/* Mobile-first: Panel slides up from the bottom */
@media (max-width: 1023px) {
    #detail-view {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 75%;
        z-index: 40;
        transform: translateY(105%);
        border-top-left-radius: 1.5rem;
        border-top-right-radius: 1.5rem;
        transition: transform 0.3s ease-in-out;
        will-change: transform;
    }
    #detail-view:not(.hidden-panel) {
        transform: translateY(0);
    }
}

/* Desktop: Permanent 2-column grid layout */
@media (min-width: 1024px) {
    #main-container {
        display: grid;
        grid-template-columns: 2fr 1fr;
        gap: 2rem;
        align-items: start;
    }
    #detail-view {
        position: sticky;
        top: 2rem;
        max-height: calc(100vh - 4rem); /* Panel never taller than viewport */
        overflow-y: hidden; /* Hide parent scrollbar */
    }
    #detail-content {
        height: 100%;
        overflow-y: auto; /* Enable scrolling for the content itself */
    }
    #detail-view.hidden-panel {
        /* On desktop, detail panel is always shown, so hidden-panel class should not hide it */
        display: block;
        opacity: 1;
        transform: none;
        pointer-events: auto;
    }
    /* Hide close button on desktop */
    #close-panel {
        display: none;
    }
}

/* --- Connector & Arrow Styles --- */
#connector-canvas, #timeline-arrow-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}
#connector-canvas {
    z-index: 1;
}
.connector-line {
    stroke: #64748b;
    stroke-width: 2;
    stroke-opacity: 0.5;
    transition: all 0.3s;
}
.connector-line.highlighted {
    stroke: #0ea5e9;
    stroke-width: 3.5;
    stroke-opacity: 1;
}

/* --- Quiz Panel Styles --- */
.quiz-answer-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    background-color: white;
    font-weight: 500;
    transition: all 0.2s ease;
}

.quiz-answer-btn:not([disabled]):hover {
    border-color: #38bdf8;
    background-color: #f0f9ff;
}

.quiz-answer-btn.correct {
    background-color: #dcfce7;
    border-color: #4ade80;
    color: #15803d;
}

.quiz-answer-btn.incorrect {
    background-color: #fee2e2;
    border-color: #f87171;
    color: #b91c1c;
}

.quiz-answer-btn:disabled {
    cursor: not-allowed;
}

/* --- Quiz Feedback & Timer Styles --- */
#quiz-status-display {
    transition: opacity 0.3s;
}

#quiz-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.95);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    padding: 2rem;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
}

#quiz-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

#overlay-title.feedback-correct {
    color: #16a34a;
}

#overlay-title.feedback-incorrect {
    color: #dc2626;
}

.timer-modal {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.timer-modal.visible {
    opacity: 1;
    pointer-events: auto;
}

/* --- Styles for Timeline --- */
#timeline-section {
    margin-top: 4rem;
}

/* Neuer äußerer Container für Labels und scrollbaren Grid-Inhalt */
#timeline-outer-container {
    display: flex; /* Nutzt Flexbox, um Labels und Grid nebeneinander zu legen */
    align-items: flex-start; /* Labels oben ausrichten */
    gap: 1rem; /* Abstand zwischen Labels und Grid */
    user-select: none;
    width: 100%; /* Wichtig, damit Flexbox funktioniert */
    position: relative; /* Für absolute Positionierung des Markers innerhalb */
    overflow: hidden; /* Verhindert, dass Kinder überlaufen */
    padding-bottom: 1rem; /* Platz für Scrollbar */
}

#timeline-labels-container {
    width: 160px; /* Feste Breite für die Label-Spalte aus config */
    flex-shrink: 0; /* Verhindert, dass es schrumpft */
    /* Die Höhe wird dynamisch angepasst, um mit dem Grid übereinzustimmen */
}

.timeline-row-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: #334155;
    text-align: left;
    padding-left: 0.5rem;
    height: 36px; /* Gleiche Höhe wie timeline-row-track */
    display: flex; /* Zentriert den Text vertikal im Label-Feld */
    align-items: center;
    cursor: pointer;
    transition: color 0.2s ease;
}

.timeline-row-label:hover {
    color: #0369a1; /* sky-700 */
}

#timeline-grid-container {
    position: relative; /* Für absolute Kinder wie Marker */
    display: grid;
    /* grid-template-columns wird dynamisch durch JS gesetzt */
    gap: 0.25rem 1rem; /* Vertikaler und horizontaler Abstand */
    overflow-x: auto; /* Horizontal scrollbar */
    flex-grow: 1; /* Nimmt den restlichen Platz im Flex-Container ein */
    min-width: 0; /* Wichtig für Flexbox, um Überläufe zu vermeiden */
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

#timeline-grid-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera*/
}

/* Diese Elemente sind jetzt direkt im timeline-grid-container und starten bei Spalte 1 */
.timeline-header, .timeline-row-track {
    display: grid;
    /* grid-template-columns defined dynamically by JS */
    /* Kein grid-column: 1 / -1 mehr hier, da dies dynamisch in JS gesetzt wird für die Spalten */
}

.timeline-header {
    border-bottom: 2px solid #cbd5e1;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

.timeline-year {
    text-align: center;
    font-weight: 600;
    color: #475569;
    font-size: 0.875rem;
    cursor: pointer; /* clickable */
    transition: color 0.2s ease;
}

.timeline-year:hover {
    color: #0369a1;
}


.timeline-row-track {
    height: 36px;
}

.timeline-spacer {
    height: 0.75rem; /* Höhe des Spacers */
    /* grid-column: 1 / -1; -- Dies ist nun der Standard in einem single-column grid */
}

.timeline-item {
    position: relative;
    height: 24px;
    align-self: center;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0 0.5rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    color: white;
    border: 1px solid rgba(0,0,0,0.05);
    width: calc(100% - 4px); /* Ensures it fits within its grid cell with padding */
    margin: 0 auto; /* Centers the item within its grid cell */
    z-index: 2; /* Ensure items are above arrows */
    cursor: pointer;
}

.timeline-item.is-process {
    color: #1e293b;
}

.timeline-item.is-highlighted {
    opacity: 1 !important;
    filter: saturate(1) !important;
}

.timeline-item.not-highlighted {
    opacity: 0.5;
    filter: saturate(0.5);
}

.timeline-item.category-highlighted {
    opacity: 1 !important;
    filter: saturate(1) !important;
    outline: 2px solid #334155;
    outline-offset: 2px;
}

.timeline-item.category-faded {
    opacity: 0.3 !important;
    filter: saturate(0) !important;
}

#now-marker {
    position: absolute;
    top: -28px;
    bottom: 0;
    background-color: rgba(239, 68, 68, 0.15);
    border: 2px solid #ef4444;
    border-bottom: none;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    z-index: 3; /* Ensure marker is above items */
    pointer-events: auto;
    cursor: ew-resize;
    /* Initial opacity and transform for fade-in animation on scroll */
    opacity: 0;
    transform: translateY(20px);
}

#now-marker.fade-in {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out, left 0.2s ease-out; /* Hinzugefügte left transition */
}

/* Neue Animation für "Einladen zur Interaktion" */
@keyframes horizontal-slide-invite-animation {
    0% { transform: translateX(0); }
    25% { transform: translateX(40px); }
    75% { transform: translateX(-40px); }
    100% { transform: translateX(0); }
}

#now-marker.horizontal-slide-invite {
    animation: horizontal-slide-invite-animation 1.5s ease-in-out forwards;
}

#now-marker::before {
    content: 'JETZT';
    position: absolute;
    top: 3px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #ef4444;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
}

#timeline-arrow-svg {
    z-index: 1;
    /* Muss relativ zum scrollbaren Container positioniert sein */
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    overflow: visible;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1.05);
        box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.5);
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 0 0 7px rgba(239, 68, 68, 0.7);
    }
}

.is-pulsing {
    animation: pulse 1.5s infinite ease-in-out;
}

/* --- Special Node States (for network graph) --- */

/* Spezieller Stil für den Knoten, dessen Quiz gerade aktiv ist */
.node.quiz-active {
    background-color: #fee2e2 !important; /* red-100 */
    border-color: #f87171 !important; /* red-400 */
    animation: pulse 1.5s infinite ease-in-out;
}

/* Stelle sicher, dass das Fragezeichen-Icon auch im aktiven Quiz-Zustand sichtbar und hervorgehoben ist */
.node.quiz-active .node-locked-icon {
    display: block;
    color: #b91c1c; /* red-800 */
}

/* Verhindere, dass der Hover-Effekt die Animation stört */
.node.quiz-active:hover {
    transform: none; /* Deaktiviere Skalierung/Bewegung bei Hover */
}

/* Eigene Animation für absolut positionierte Knoten, um die Zentrierung beizubehalten */
@keyframes pulse-with-translate {
    0%, 100% {
        transform: translateX(-50%) scale(1.05);
        box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.5);
    }
    50% {
        transform: translateX(-50%) scale(1.15);
        box-shadow: 0 0 0 7px rgba(239, 68, 68, 0.7);
    }
}

/* --- Spezifische Korrekturen für zentrierte Knoten --- */

/* 1. Stellt die Basis-Zentrierung für die beiden Knoten wieder her */
#node-fti-strategie,
#node-hs2040 {
    transform: translateX(-50%);
}

/* 2. Definiert einen kombinierten Hover-Effekt (Zentrierung + Skalierung + Verschiebung) */
#node-fti-strategie:hover,
#node-hs2040:hover {
    transform: translateX(-50%) translateY(-4px) scale(1.03);
}

/* 3. Definiert einen kombinierten Aktiv-Effekt (Zentrierung + Skalierung) */
#node-fti-strategie.active,
#node-hs2040.active {
    transform: translateX(-50%) scale(1.05);
}

/* 4. Kombinierter Quiz-Active-Effekt (Zentrierung + Animation) */
#node-fti-strategie.quiz-active,
#node-hs2040.quiz-active {
    animation-name: pulse-with-translate;
    /* Wichtig: Setzen Sie auch den Basis-Transform-Wert, da die Animation
       die Standard-Regel überschreibt. */
    transform: translateX(-50%);
}

