* { box-sizing: border-box; }

:root {
  --aws-navy: #232f3e;
  --aws-navy-2: #2c3a4d;
  --aws-orange: #ec7211;
  --aws-orange-d: #d85f0a;
  --border: #d5dbdb;
  --bg: #f2f3f3;
  --panel: #ffffff;
  --text: #16191f;
  --muted: #687078;
  --danger: #d13212;
}

html, body {
  margin: 0;
  height: 100%;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

/* ---------- Toolbar ---------- */
#toolbar {
  height: 52px;
  background: var(--aws-navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
  z-index: 20;
  position: relative;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  height: 34px;
  width: auto;
  display: block;
  /* Logo hat weißen Hintergrund -> auf dunkler Toolbar in eine helle Pille setzen */
  background: #fff;
  padding: 4px 10px;
  border-radius: 8px;
}
.brand-aws {
  background: var(--aws-orange);
  color: #fff;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 1px;
  font-size: 14px;
}
.brand-title { font-weight: 600; font-size: 16px; }
.toolbar-actions { display: flex; gap: 8px; }

.btn {
  border: 1px solid rgba(255,255,255,.25);
  background: #37475a;
  color: #fff;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: background .15s, transform .05s;
}
.btn:hover { background: #45566b; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--aws-orange); border-color: var(--aws-orange-d); }
.btn-primary:hover { background: var(--aws-orange-d); }
.btn-danger { background: #6b2016; border-color: #8a2a1d; }
.btn-danger:hover { background: #842519; }
.btn-ghost { background: transparent; border-color: transparent; font-size: 16px; }
.btn-ghost:hover { background: rgba(0,0,0,.1); }

/* ---------- Layout ---------- */
#app {
  display: grid;
  grid-template-columns: 240px 1fr 300px;
  height: calc(100% - 52px);
}

#palette, #properties {
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 14px;
}
#properties { border-right: none; border-left: 1px solid var(--border); }

#palette h2, #properties h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin: 0 0 8px;
}
.hint { color: var(--muted); font-size: 12px; margin: 4px 0 12px; line-height: 1.4; }

.palette-group { margin-bottom: 16px; }
.palette-group::before {
  content: attr(data-group);
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}
.palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: grab;
  background: #fbfbfb;
  font-size: 13px;
  user-select: none;
  transition: border-color .15s, box-shadow .15s;
}
.palette-item:hover { border-color: var(--aws-orange); box-shadow: 0 1px 4px rgba(236,114,17,.2); }
.palette-item:active { cursor: grabbing; }
.palette-item.active-tool { border-color: var(--aws-orange); background: #fff3e8; }
.pi-icon {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--c, #666);
  color: #fff;
  border-radius: 6px;
  font-size: 15px;
  flex: 0 0 auto;
}

/* ---------- Canvas ---------- */
#canvas-wrap {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(0,0,0,.04) 1px, transparent 1px),
    linear-gradient(rgba(0,0,0,.04) 1px, transparent 1px);
  background-size: 24px 24px;
  background-color: #fafbfc;
}
#canvas { width: 100%; height: 100%; display: block; }
#canvas.connect-mode { cursor: crosshair; }

#canvas-help {
  position: absolute;
  bottom: 12px; left: 12px; right: 12px;
  background: rgba(35,47,62,.9);
  color: #fff;
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  pointer-events: none;
  max-width: 560px;
}

/* ---------- Node styling (SVG) ---------- */
.node { cursor: move; }
.node .node-rect {
  fill: #fff;
  stroke: var(--border);
  stroke-width: 1.5;
}
.node.selected .node-rect { stroke: var(--aws-orange); stroke-width: 2.5; }
.node .node-label { font-size: 12px; fill: var(--text); font-weight: 600; user-select: none; }
.node .node-sub { font-size: 10px; fill: var(--muted); user-select: none; }

/* container nodes */
.node[data-kind="vpc"] .node-rect { fill: rgba(125,58,193,.04); stroke: #7d3ac1; stroke-width: 2; rx: 10; }
.node[data-kind="az"]  .node-rect { fill: rgba(224,142,11,.04); stroke: #e08e0b; stroke-width: 2; stroke-dasharray: 6 4; rx: 8; }
.node[data-kind="subnet"] .node-rect { fill: rgba(36,136,20,.05); stroke: #248814; stroke-width: 1.5; rx: 6; }

.node .icon-badge { font-size: 18px; }

.edge { stroke: var(--aws-navy); stroke-width: 2; fill: none; }
.edge.selected { stroke: var(--aws-orange); stroke-width: 3; }
.edge-hit { stroke: transparent; stroke-width: 12; fill: none; cursor: pointer; }

/* resize handle */
.resize-handle { fill: var(--aws-orange); cursor: nwse-resize; }

/* ---------- Properties form ---------- */
#prop-form { display: none; }
#prop-form.show { display: block; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.field input, .field select {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}
.field input:focus, .field select:focus { outline: 2px solid rgba(236,114,17,.4); border-color: var(--aws-orange); }
.field .row { display: flex; gap: 8px; }
.disk-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.disk-row input { flex: 1; }
.disk-row button { flex: 0 0 auto; }
.route-fixed { opacity: .8; }
.route-fixed input {
  background: #eef0f2; color: var(--muted); cursor: not-allowed; border-style: dashed;
}
.triple-row { display: flex; gap: 6px; }
.triple-row > * { flex: 1; }
.field-inline-note { font-size: 11px; color: var(--muted); margin-top: 4px; }
.prop-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  color: var(--muted); margin: 16px 0 8px; border-top: 1px solid var(--border); padding-top: 12px;
}
.mini-btn {
  border: 1px solid var(--border); background: #f7f7f7; border-radius: 6px;
  padding: 6px 8px; cursor: pointer; font-size: 12px;
}
.mini-btn:hover { border-color: var(--aws-orange); }
.mini-btn.danger { color: var(--danger); }
.prop-cost {
  background: #f0f7ff; border: 1px solid #cfe3ff; border-radius: 8px;
  padding: 10px; font-size: 12px; margin-top: 10px;
}
.prop-cost strong { font-size: 15px; color: #0a5cad; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal.hidden { display: none; }
.modal-box {
  background: #fff; width: min(760px, 92vw); max-height: 86vh;
  border-radius: 12px; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--aws-navy); color: #fff;
}
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head .btn-ghost { color: #fff; }
.modal-body { padding: 18px; overflow: auto; }
.modal-foot {
  padding: 12px 18px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end; background: #fafafa;
}
.modal-body pre {
  background: #1e1e1e; color: #dcdcdc; padding: 14px; border-radius: 8px;
  overflow: auto; font-family: Consolas, "Courier New", monospace; font-size: 12.5px; line-height: 1.5;
  margin: 0;
}
.hidden { display: none !important; }

/* Estimate table */
.cost-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cost-table th, .cost-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.cost-table th { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.cost-table td.num, .cost-table th.num { text-align: right; }
.cost-total td { font-weight: 800; font-size: 15px; border-top: 2px solid var(--aws-navy); border-bottom: none; }
.cost-note { font-size: 11px; color: var(--muted); margin-top: 12px; line-height: 1.5; }

/* ---------- In-App Hilfe ---------- */
.help { font-size: 13.5px; line-height: 1.55; color: var(--text); }
.help h4 {
  margin: 18px 0 6px; font-size: 14px; color: var(--aws-navy);
  border-bottom: 2px solid var(--aws-orange); padding-bottom: 4px; display: inline-block;
}
.help h4:first-child { margin-top: 0; }
.help p { margin: 6px 0; }
.help a { color: #0a5cad; }
.help-steps { margin: 6px 0 6px 18px; padding: 0; }
.help-steps li { margin-bottom: 8px; }
.help-list { margin: 6px 0 6px 18px; padding: 0; }
.help-list li { margin-bottom: 4px; }
.help code {
  background: #eef0f2; border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 5px; font-family: Consolas, monospace; font-size: 12px;
}
.kbd {
  display: inline-block; background: #f7f7f7; border: 1px solid #ccc;
  border-bottom-width: 2px; border-radius: 4px; padding: 0 6px; font-size: 12px;
  font-family: Consolas, monospace;
}
.help-services { width: 100%; border-collapse: collapse; margin: 8px 0; }
.help-services td { padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.help-services .hs-icon { width: 28px; font-size: 18px; text-align: center; }
.help-services .hs-name { width: 150px; font-weight: 700; color: var(--aws-navy); }
.help-services .hs-text { color: #333; }

/* ---------- Palette Footer (Legal/Disclaimer) ---------- */
#palette-footer {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
#palette-footer .disclaimer {
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.4;
  margin: 0 0 6px;
}
#palette-footer .legal-nav { font-size: 11px; }
#palette-footer .legal-nav a { color: var(--aws-orange); text-decoration: none; }
#palette-footer .legal-nav a:hover { text-decoration: underline; }
#palette-footer .legal-nav span { color: var(--muted); margin: 0 4px; }
