/* karamba3d web replica — Grasshopper + Rhino chrome */

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: "Segoe UI", Tahoma, Verdana, sans-serif;
  font-size: 12px;
  background: #2b2b2e;
  user-select: none;
}

body { display: flex; flex-direction: column; }

/* ---------------- title bar ---------------- */

#titlebar {
  display: flex;
  align-items: center;
  height: 34px;
  background: linear-gradient(#3a3a3e, #2e2e32);
  border-bottom: 1px solid #1c1c1e;
  padding: 0 10px;
  gap: 14px;
}

#brand { display: flex; align-items: baseline; gap: 8px; }

#brand-badge {
  background: #d0021b;                 /* karamba red */
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 2px 9px;
  border-radius: 3px;
  letter-spacing: 0.3px;
}

#brand-sub { color: #8f949a; font-size: 10px; }

#menubar { display: flex; gap: 2px; }

.menu {
  position: relative;
  color: #d6d8da;
  padding: 4px 10px;
  border-radius: 3px;
  cursor: default;
}
.menu:hover { background: #4a4a50; }

.menu-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 230px;
  background: #f4f4f6;
  border: 1px solid #9a9aa0;
  box-shadow: 3px 4px 10px rgba(0,0,0,0.4);
  z-index: 100;
  padding: 3px 0;
}
.menu-dropdown hr { border: none; border-top: 1px solid #d5d5da; margin: 3px 6px; }
.menu-item { padding: 5px 14px; color: #222; white-space: nowrap; }
.menu-item:hover { background: #3875d7; color: #fff; }

#title-doc { margin-left: auto; color: #8f949a; font-size: 11px; }

/* ---------------- ribbon ---------------- */

#ribbon { background: #d4d0c8; border-bottom: 1px solid #8a877e; }

#ribbon-tabs {
  display: flex;
  gap: 1px;
  padding: 4px 8px 0;
  background: #c8c4bc;
}

.ribbon-tab {
  padding: 3px 12px 4px;
  background: #bdb9b1;
  border: 1px solid #8a877e;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  color: #3c3a35;
  cursor: default;
  font-size: 11.5px;
}
.ribbon-tab:hover { background: #d9d5cd; }
.ribbon-tab.active {
  background: #ece9e2;
  font-weight: 600;
  position: relative;
  top: 1px;
}

#ribbon-groups {
  display: flex;
  align-items: stretch;
  gap: 6px;
  background: #ece9e2;
  padding: 5px 8px 2px;
  min-height: 64px;
  overflow-x: auto;
}

.ribbon-group {
  display: flex;
  flex-direction: column;
  border-right: 1px solid #c9c5bc;
  padding-right: 6px;
}

.ribbon-items {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  max-height: 44px;
  align-content: flex-start;
  flex: 1;
}

.ribbon-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 46px;
  padding: 2px 1px;
  border-radius: 3px;
  color: #35332e;
  font-size: 8.5px;
  cursor: default;
  text-align: center;
  line-height: 1.15;
}
.ribbon-item:hover { background: #d8e4f2; outline: 1px solid #9db8d6; }
.ri-icon { font-size: 15px; line-height: 17px; }

.ribbon-group-label {
  font-size: 9px;
  color: #6b675e;
  text-align: center;
  padding: 1px 4px;
  border-top: 1px solid #d6d2c9;
  margin-top: 2px;
  cursor: default;
}
.ribbon-group-label:hover { background: #ddd9d0; }

/* ---------------- workspace split ---------------- */

#workspace {
  display: flex;
  flex: 1;
  min-height: 0;
}

#gh-pane {
  position: relative;
  width: 50%;
  height: 100%;
  border-right: 1px solid #1c1c1e;
  overflow: hidden;
}

#gh-canvas { display: block; width: 100%; height: 100%; }

#gh-hint {
  position: absolute;
  bottom: 6px;
  left: 10px;
  color: rgba(0,0,0,0.38);
  font-size: 10px;
  pointer-events: none;
}

#splitter {
  width: 5px;
  background: #2e2e32;
  cursor: col-resize;
  flex-shrink: 0;
}
#splitter:hover { background: #4a90d9; }

#viewport-pane {
  position: relative;
  flex: 1;
  height: 100%;
  overflow: hidden;
}

#viewport-container { width: 100%; height: 100%; }
#viewport-container canvas { display: block; }

#viewport-title {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #1e2124;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(0,0,0,0.25);
  padding: 1px 8px;
  border-radius: 2px;
  cursor: default;
}

#viewport-mode {
  position: absolute;
  top: 6px;
  left: 118px;
  font-size: 10.5px;
  color: #3a3f45;
  background: rgba(255,255,255,0.35);
  padding: 2px 7px;
  border-radius: 2px;
}

#btn-zoom-ext {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 26px;
  height: 24px;
  border: 1px solid rgba(0,0,0,0.3);
  background: rgba(255,255,255,0.55);
  border-radius: 3px;
  cursor: pointer;
  font-size: 13px;
  color: #222;
}
#btn-zoom-ext:hover { background: #fff; }

/* ---------------- Rhino layers panel ---------------- */

#layers-panel {
  position: absolute;
  top: 38px;
  right: 8px;
  display: none;
  width: 186px;
  background: rgba(248, 248, 250, 0.93);
  border: 1px solid rgba(0,0,0,0.35);
  border-radius: 3px;
  box-shadow: 2px 3px 8px rgba(0,0,0,0.25);
  font-size: 11px;
  overflow: hidden;
}

#layers-head {
  background: linear-gradient(#e8e8ec, #d9d9df);
  border-bottom: 1px solid #b5b5bb;
  padding: 3px 8px;
  font-weight: 700;
  color: #33333a;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
#layers-doc { font-weight: 400; font-size: 9px; color: #74747c; }
#layers-panel.picking { top: 84px; }

#layers-list { max-height: 190px; overflow-y: auto; }

.layer-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  cursor: default;
  color: #26262c;
}
.layer-row:hover { background: #dce9f7; }
.layer-row.sel { background: #cfe0f5; }
.layer-eye { width: 13px; text-align: center; font-size: 10px; color: #555; }
.layer-eye.off { opacity: 0.28; }
.layer-swatch { width: 11px; height: 11px; border: 1px solid rgba(0,0,0,0.45); border-radius: 2px; flex: none; }
.layer-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-count { font-size: 9px; color: #74747c; }

/* ---------------- pick prompt (Rhino command line) ---------------- */

#pick-prompt {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: none;
  align-items: center;
  gap: 10px;
  background: rgba(28, 32, 38, 0.94);
  border-bottom: 1px solid #0d0f12;
  color: #e8ecf0;
  padding: 6px 12px;
  font-size: 12px;
  z-index: 30;
}
#pick-text { font-weight: 600; }
#pick-count { color: #ffe000; font-size: 11px; }
#pick-prompt button {
  margin-left: auto;
  background: #3d4a5a;
  color: #eef2f6;
  border: 1px solid #55647a;
  border-radius: 3px;
  padding: 3px 10px;
  font-size: 11px;
  cursor: pointer;
}
#pick-prompt button + button { margin-left: 4px; }
#pick-accept { background: #2f6b34; border-color: #3d8a44; }
#pick-cancel { background: #6b2f2f; border-color: #8a3d3d; }
#pick-prompt button:hover { filter: brightness(1.25); }

/* ---------------- legend (Karamba HUD) ---------------- */

#legend {
  position: absolute;
  right: 12px;
  bottom: 16px;
  display: none;
  background: rgba(250, 250, 250, 0.82);
  border: 1px solid rgba(0,0,0,0.3);
  border-radius: 3px;
  padding: 6px 8px;
  min-width: 118px;
}

.legend-title { font-size: 10px; font-weight: 700; color: #222; margin-bottom: 4px; }

.legend-body { display: flex; gap: 6px; }

.legend-bar {
  width: 16px;
  height: 150px;
  border: 1px solid rgba(0,0,0,0.4);
  background: linear-gradient(to top,
    #0000ff 0%, #00ffff 25%, #00ff00 50%, #ffff00 75%, #ff7f00 87.5%, #ff0000 100%);
}

.legend-ticks {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 150px;
}
.legend-tick { font-size: 9px; color: #222; font-family: Consolas, Menlo, monospace; }

/* ---------------- search popup ---------------- */

#search-popup {
  position: absolute;
  display: none;
  width: 235px;
  background: #fdfdfd;
  border: 1px solid #6a6a70;
  border-radius: 3px;
  box-shadow: 3px 5px 14px rgba(0,0,0,0.4);
  z-index: 50;
  overflow: hidden;
}

#search-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid #ccc;
  padding: 6px 9px;
  font-size: 12px;
  outline: none;
}

#search-list { max-height: 220px; overflow-y: auto; }

.search-item {
  padding: 4px 9px;
  font-size: 11px;
  color: #222;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: default;
}
.search-item:hover, .search-item.first { background: #dcE9f7; }
.search-cat { margin-left: auto; color: #999; font-size: 9px; }

/* ---------------- tooltip (GH-style) ---------------- */

#gh-tooltip {
  position: absolute;
  display: none;
  max-width: 280px;
  background: #fbfbf4;
  border: 1px solid #6a6a5a;
  border-radius: 3px;
  box-shadow: 2px 3px 9px rgba(0,0,0,0.35);
  padding: 6px 9px;
  font-size: 11px;
  color: #26241c;
  pointer-events: none;
  z-index: 60;
}
.tt-title { font-weight: 700; font-size: 11.5px; }
.tt-nick { font-weight: 400; color: #6a675c; }
.tt-sub { color: #6a675c; font-size: 10px; margin-top: 1px; }
.tt-desc { margin-top: 4px; line-height: 1.35; }
.tt-data { margin-top: 4px; color: #444; font-size: 10px; font-weight: 600; }
.tt-item { font-family: Consolas, Menlo, monospace; font-size: 9.5px; color: #333; }
.tt-set { margin-top: 4px; color: #2f6b34; font-weight: 600; font-size: 10.5px; }
.tt-error { margin-top: 4px; color: #a01212; font-weight: 600; }
.tt-warn { margin-top: 4px; color: #9c6207; font-weight: 600; }

/* ---------------- context menu (GH-style) ---------------- */

#ctx-menu {
  position: fixed;
  min-width: 200px;
  max-width: 300px;
  background: #f7f7f9;
  border: 1px solid #8a8a90;
  border-radius: 3px;
  box-shadow: 3px 4px 12px rgba(0,0,0,0.4);
  z-index: 200;
  padding: 3px 0;
  font-size: 11.5px;
}
#ctx-menu hr { border: none; border-top: 1px solid #d8d8dc; margin: 3px 4px; }
.ctx-item { padding: 4px 12px 4px 8px; color: #222; display: flex; align-items: baseline; gap: 4px; }
.ctx-item:hover { background: #3875d7; color: #fff; }
.ctx-header { font-weight: 700; background: #e4e4e8; color: #333; pointer-events: none; }
.ctx-check { display: inline-block; width: 14px; font-weight: 700; }
.ctx-danger:hover { background: #c0392b; }
.ctx-sub { color: #4a7a3a; font-size: 10px; font-style: italic; }
.ctx-item:hover .ctx-sub { color: #dff0d5; }
.ctx-err { color: #a01212; font-size: 10.5px; white-space: normal; }
.ctx-warntxt { color: #9c6207; font-size: 10.5px; white-space: normal; }
.ctx-item:hover .ctx-err, .ctx-item:hover .ctx-warntxt { color: #fff; }

/* ---------------- panel text editor ---------------- */

#panel-editor {
  position: absolute;
  z-index: 80;
  background: #fffbe0;
  border: 2px solid #3f6212;
  border-radius: 2px;
  font-family: Consolas, Menlo, monospace;
  color: #33301c;
  padding: 4px;
  resize: none;
  outline: none;
}

/* ---------------- status bar ---------------- */

#statusbar {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 24px;
  background: linear-gradient(#35353a, #2a2a2e);
  border-top: 1px solid #17171a;
  padding: 0 12px;
  font-size: 11px;
}

#status-karamba {
  color: #fff;
  background: #d0021b;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 2px;
}

#status-text { color: #9aa4ae; }
