/* ==========================================================================
   Sankey Editor Stijlen — Geextraheerd uit EntranosFlux/flux/css/style.css
   Gescoped onder .sankey-section waar nodig om dashboard conflicts te voorkomen
   ========================================================================== */

/* --- Sankey Container — gebruikt nu contentContainer1300 uit app.css --- */

/* --- SVG Container --- */
.sankey-section #sankeyEditorContainer {
  width: 100%;
  min-height: 300px;
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  line-height: 0; /* voorkom whitespace gap onder SVG */
}

.sankey-section #sankeyEditorContainer svg {
  display: block; /* SVG is inline by default → veroorzaakt descender gap */
}

/* --- Control Panel --- */
.sankey-section .controls-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 12px;
  padding: 0;
}

.sankey-section .control-group-header {
  font-size: 12px;
  font-weight: 600;
  color: #333;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
  padding-bottom: 3px;
  border-bottom: 2px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sankey-section .control-row-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, 290px);
  gap: 4px;
  margin-bottom: 6px;
}

.sankey-section .control-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 6px;
  align-items: center;
  padding: 0;
  border-bottom: 1px solid #f5f5f5;
  padding-bottom: 3px;
  margin-bottom: 2px;
}

.sankey-section .control-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.sankey-section .control-row.full-width-button {
  grid-template-columns: 1fr;
  justify-content: flex-end;
}

.sankey-section .control-label {
  font-size: 11px;
  font-weight: 400;
  color: #777;
  text-align: left;
  margin: 0;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  height: 28px;
}

.sankey-section .control-input {
  padding: 4px 8px;
  font-size: 13px;
  border: 1px solid #e8e8e8;
  border-radius: 2px;
  background-color: white !important;
  color: #333;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
  max-width: 200px;
  font-weight: 300;
  height: 28px;
}

.sankey-section .control-input:focus {
  outline: none;
  border-color: #333;
  background-color: white !important;
  box-shadow: none;
}

.sankey-section .number-input {
  max-width: 120px;
}

.sankey-section .color-input {
  max-width: 60px;
  height: 28px;
  padding: 2px;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  cursor: pointer;
}

.sankey-section .color-input::-webkit-color-swatch-wrapper { padding: 0; }
.sankey-section .color-input::-webkit-color-swatch { border: none; border-radius: 2px; }

/* Spinner arrows verwijderen */
.sankey-section .number-input::-webkit-outer-spin-button,
.sankey-section .number-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.sankey-section .number-input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* --- Toggle Switch --- */
.sankey-section .toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}
.sankey-section .toggle-switch input { opacity: 0; width: 0; height: 0; }
.sankey-section .slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ddd;
  transition: 0.2s;
  border-radius: 24px;
}
.sankey-section .slider:before {
  position: absolute;
  content: "";
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.sankey-section .toggle-switch input:checked + .slider { background-color: #333; }
.sankey-section .toggle-switch input:checked + .slider:before { transform: translateX(20px); }

/* --- Info Button + Tooltip --- */
.sankey-section .info-button {
  background: none;
  border: none;
  color: #777;
  cursor: pointer;
  padding: 2px;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
}
.sankey-section .info-button:hover { background-color: #f0f0f0; color: #333; }
.sankey-section .info-button:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  top: -10px; right: 0;
  transform: translateY(-100%);
  background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
  color: #ffffff;
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  white-space: normal;
  z-index: 1000;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
  max-width: 320px;
  min-width: 200px;
  line-height: 1.5;
  animation: tooltipFadeIn 0.2s ease-out;
}
.sankey-section .info-button:hover::before {
  content: '';
  position: absolute;
  top: -2px; right: 18px;
  transform: translateY(-100%);
  width: 0; height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #2d3748;
  z-index: 999;
}

@keyframes tooltipFadeIn {
  from { opacity: 0; transform: translateY(-90%) scale(0.95); }
  to { opacity: 1; transform: translateY(-100%) scale(1); }
}

/* --- Edit Buttons --- */
.sankey-section .editing-controls {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.sankey-section .edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 16px;
  background-color: #333;
  color: white;
  border: none;
  border-radius: 0px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}
.sankey-section .edit-btn:hover {
  background-color: #555;
  transform: translateY(-1px);
}

/* --- Import/Export Buttons --- */
.sankey-section .button-group {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 8px 0;
}

/* --- Edit Popups --- */
.popup-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.edit-popup {
  background-color: #EEF5FA;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  width: 400px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
}

.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #D0E1F0;
  background-color: #444;
}
.popup-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: white;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: white;
  cursor: pointer;
  padding: 0;
  width: 30px; height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}
.close-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.popup-content { padding: 24px; }

.form-row { margin-bottom: 20px; }
.form-row label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: #333;
  font-size: 14px;
}
.form-row input,
.form-row select {
  width: 100%;
  padding: 10px 12px;
  height: 50px;
  border: 1px solid #CCC;
  border-radius: 6px;
  font-size: 14px;
  background-color: white;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}
.form-row input:focus,
.form-row select:focus {
  outline: none;
  border-color: #333;
  box-shadow: 0 0 0 3px rgba(51, 51, 51, 0.1);
}

.popup-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #D0E1F0;
}
.popup-buttons button {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 80px;
}
.btn-cancel { background-color: #F8F9FA; color: #666 !important; border: 1px solid #CCC; }
.btn-cancel:hover { background-color: #E9ECEF; color: #333 !important; }
.btn-delete { background-color: #dc3545; color: white !important; }
.btn-delete:hover { background-color: #c82333; }
.btn-save { background-color: #333; color: white !important; }
.btn-save:hover { background-color: #555; }

/* --- Node Balance --- */
.sankey-section .node-balance-section {
  margin: 20px 0;
  padding: 15px;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
}
.sankey-section .balance-status.balanced { color: #28a745; font-weight: 500; }
.sankey-section .unbalanced-node {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  margin: 4px 0;
  background-color: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 4px;
  font-size: 13px;
}
.sankey-section .unbalanced-node.critical {
  background-color: #f8d7da;
  border-color: #f5c6cb;
}
.sankey-section .node-name { font-weight: 600; color: #495057; }
.sankey-section .balance-difference { font-weight: 600; color: #dc3545; }

/* --- Sankey SVG Node/Link Styling --- */
.sankey-section .node {
  transition: opacity 0.2s ease;
  stroke-width: 8px !important;
  stroke: transparent !important;
}
.sankey-section .node:hover { opacity: 0.9 !important; }
.sankey-section .node.dragging { opacity: 0.7 !important; }
.sankey-section .link { pointer-events: visiblePainted; }
.sankey-section .link:hover { opacity: 0.7; }

/* --- Legend Colors --- */
.sankey-section #carrierColorControls {
  display: grid;
  grid-template-columns: repeat(auto-fill, 220px);
  column-gap: 24px;
  row-gap: 12px;
  padding: 8px 0;
}
.sankey-section #carrierColorControls .control-row {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
}
