/* ==========================================================================
   1. GRUNDLAYOUT & RESET
   ========================================================================== */
body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    margin: 0; 
    background: #f4f6f9; 
    color: #333; 
    display: flex; 
    height: 100vh; 
    overflow: hidden; 
}

#main-area { 
    flex: 1; 
    position: relative; 
    display: flex; 
    flex-direction: column; 
}

/* ==========================================================================
   2. SCHICHTEN-ARCHITEKTUR 
   ========================================================================== */
#map-wrapper {
    flex: 1; 
    position: relative; 
    overflow: hidden; 
    background: #f4f6f9;
}

/* Schicht 1: Das SVG (für Linien und Hintergrund-Klicks) */
#map-container { 
    position: absolute; 
    top: 0; left: 0; 
    width: 100%; height: 100%; 
    z-index: 1;
    background-color: #f8f9fa;
    cursor: default;
}

/* Schicht 2: Das HTML (für die Textboxen) */
#html-nodes {
    position: absolute; 
    top: 0; left: 0; 
    width: 100%; height: 100%; 
    z-index: 2;
    transform-origin: 0 0; /* Wichtig für den synchronen Zoom */
    pointer-events: none;  /* Magie: Klicks fallen hier durch aufs SVG! */
}

/* ==========================================================================
   3. ARGUMENT-BOXEN (HTML Layer)
   ========================================================================== */
.node-wrapper {
    position: absolute;
    width: 220px;
    min-height: 80px; 
      
    pointer-events: auto; 
    cursor: grab;
    transition: opacity 0.3s;
}

.node-wrapper:active { cursor: grabbing; }

.node-box { 
    display: flex;
    flex-direction: column;
    min-height: 80px; /* Passt sich dem Inhalt an */
    padding: 12px 12px 20px 12px; /* Unten 20px, damit die ID Platz hat und nicht überlappt */
    box-sizing: border-box; 
    border-radius: 8px; 
    border-width: 2px; 
    border-style: solid; 
    background: white; 
}

.node-text-content { 
    display: block;
    text-align: center;
    margin: 0; padding: 0; /* unerwünschte Ränder löschen */
    font-size: 13px; 
    line-height: 1.4; 
    cursor: inherit !important; 
    user-select: none;
    
    /* WICHTIG: Damit lange Wörter umbrechen und Zeilenumbrüche erkannt werden */
    white-space: pre-wrap; 
    word-wrap: break-word; 
}

.text-placeholder { color: #ccc; font-style: italic; }

.node-badge {
    position: absolute;
    bottom: 4px; right: 8px;
    font-size: 11px; font-family: monospace; font-weight: 800;
    opacity: 0.7; /* Leicht erhöht für bessere Lesbarkeit */
    user-select: none; pointer-events: auto;
}

/* Zustände und Farben (inklusive farbiger IDs!) */
.node-active .node-box { box-shadow: 0 0 0 4px rgba(0,0,0,0.1); border-color: #333 !important; }

.node-these { background: #e3f2fd; border-color: #1e88e5; color: #0d47a1; font-weight: bold; }
.node-these .node-badge { color: #1e88e5; } /* ID in Blau */

.node-praemisse { background: #e8f5e9; border-color: #4caf50; color: #1b5e20; }
.node-praemisse .node-badge { color: #4caf50; } /* ID in Grün */

.node-einwand { background: #ffebee; border-color: #f44336; color: #b71c1c; }
.node-einwand .node-badge { color: #f44336; } /* ID in Rot */

.node-implicit { border-style: dashed !important; }

.node-focused .node-box {
    border-width: 4px !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

/* ==========================================================================
   4. VEKTOR-GRAFIKEN (SVG Layer)
   ========================================================================== */
.edge { 
    fill: none; 
    stroke-linejoin: round; 
    stroke-linecap: round; 
    transition: opacity 0.3s; 
    cursor: grab;             /* Macht die Greifhand sichtbar */
    pointer-events: stroke;   /* Erlaubt Klicks und Drag auf der SVG-Linie */
}

.edge:active { 
    cursor: grabbing; 
}

/* Linienstärken und Farben (werden vom JS gesetzt) */
.focus-off { stroke-width: 2.5px; }
.focus-on { stroke-width: 5.5px; }
.stroke-stuetzt { stroke: #4caf50; }
.stroke-schwaecht { stroke: #f44336; }

/* Der kleine Knotenpunkt in der Mitte */
.joint { 
    fill: #333; 
    stroke: #fff; 
    stroke-width: 2px; 
    transition: r 0.2s; 
    pointer-events: auto; /* Erlaubt Klicks! */
    cursor: grab;         /* Greifhand */
}

.joint-text { 
    font-size: 13px; fill: #111; font-weight: bold; pointer-events: none;
    paint-order: stroke fill; stroke: #f4f6f9; stroke-width: 4px; stroke-linecap: round; stroke-linejoin: round;
    pointer-events: auto; /* Erlaubt Klicks! */
    cursor: pointer;      /* Normale Hand, signalisiert "Editierbar" */
}
/* ==========================================================================
   5. UI, MENÜS & SIDEBAR
   ========================================================================== */
#hud-bar { 
    width: 100%; padding: 6px 15px; font-size: 13px; text-align: center; 
    box-sizing: border-box; z-index: 150; box-shadow: 0 2px 5px rgba(0,0,0,0.1); 
    color: white; transition: background 0.3s; 
}
.hud-key { background: rgba(255,255,255,0.2); padding: 2px 6px; border-radius: 4px; font-family: monospace; font-weight: bold; margin: 0 2px; }

#floating-menu {
    position: absolute; 
    display: none; /* Wird per JS auf 'flex' gesetzt, wenn es eingeblendet wird */
    background: white; 
    border: 1px solid #ccc; 
    border-radius: 30px;
    padding: 5px 10px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); 
    transform: translate(-50%, -100%); /* Zentriert über der Klick-Position */
    align-items: center; 
    z-index: 300;
}

/* Container für die einzelnen Button-Gruppen */
.menu-section {
    display: flex;
    gap: 5px;
    align-items: center;
}

/* Der feine vertikale Trennstrich */
.menu-divider {
    width: 1px;
    height: 24px;
    background-color: #e0e0e0;
    margin: 0 8px;
}

.action-btn { 
    transition: transform 0.1s ease; 
    cursor: pointer; 
    /* display: none; <- HIER GELÖSCHT, damit sie standardmässig sichtbar sind */
}

.action-btn:hover { 
    transform: scale(1.15); 
}



/* Inline-Editing für die Linien/Kanten (fliegendes Input-Feld) */
.edge-inline-input {
    position: fixed;
    z-index: 1000;
    padding: 4px 8px;
    border: 1px solid #ccc; /* Kleines Extra für bessere Sichtbarkeit */
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Inline-Editing innerhalb der Boxen (Textarea) */
.node-inline-textarea {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    border: 2px solid #1976d2;
    border-radius: 4px;
    padding: 4px;
    outline: none;
    resize: none;
    font-family: inherit; /* Übernimmt die Schriftart der Box */
    font-size: inherit;
}


#sidebar { 
    width: 340px; background: #fff; border-left: 1px solid #ddd; 
    display: flex; flex-direction: column; z-index: 200; overflow-y: auto; box-shadow: -2px 0 10px rgba(0,0,0,0.05); 
}
.sidebar-header { padding: 15px 20px; background: #2c3e50; color: white; }
.sidebar-header h2 { margin: 0; font-size: 18px; }

details { border-bottom: 1px solid #eee; }
summary { padding: 12px 20px; font-size: 14px; font-weight: bold; cursor: pointer; background: #fafafa; outline: none; user-select: none; }
summary:hover { background: #f0f0f0; }
.section-content { padding: 15px 20px; display: flex; flex-direction: column; gap: 12px; }

/* Formulare */
label { font-size: 12px; font-weight: bold; color: #666; display: block; margin-bottom: 5px; }
textarea { width: 100%; height: 80px; padding: 10px; box-sizing: border-box; border: 1px solid #ccc; border-radius: 6px; font-family: inherit; font-size: 14px; resize: vertical; }
.control-group { display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
.radio-group { display: flex; flex-direction: column; gap: 6px; }
.radio-label { display: flex; align-items: center; gap: 6px; font-weight: normal; margin: 0; cursor: pointer; font-size: 13px; }

/* Buttons */
.btn { 
    padding: 8px 12px; border: none; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: bold; 
    display: flex; align-items: center; justify-content: center; gap: 8px; transition: background 0.2s; 
}
.btn-export { background: #e3f2fd; color: #0d47a1; }
.btn-export:hover { background: #bbdefb; }
.btn-import { background: #e8f5e9; color: #1b5e20; margin: 0; cursor: pointer; }
.btn-import:hover { background: #c8e6c9; }
input[type="file"] { display: none; }

.empty-state { color: #999; font-style: italic; font-size: 13px; text-align: center; padding: 20px 0; }
.shortcut-hint { font-size: 11px; color: #666; background: #eee; padding: 3px 6px; border-radius: 4px; border: 1px solid #ddd; font-family: monospace; }
.help-text { font-size: 12px; color: #444; line-height: 1.4; margin-bottom: 5px; }