/* SketchUp Clone — chrome styling (macOS-light, SketchUp-like) */

:root {
  --chrome-bg: #ececec;
  --chrome-bg2: #e2e2e2;
  --chrome-border: #c8c8c8;
  --chrome-text: #2b2b2b;
  --chrome-text-dim: #7a7a7a;
  --accent: #1a73e8;
  --accent-soft: #d6e6fb;
  --panel-bg: #f4f4f4;
  --panel-header: #e6e6e6;
  --input-bg: #ffffff;
  --input-border: #bfbfbf;
  --menu-bg: #f8f8f8;
  --menu-hover: #4a90e2;
  --sel-blue: #2c6fdc;
  font-size: 13px;
}

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

html, body { height: 100%; overflow: hidden; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 13px;
  color: var(--chrome-text);
  background: var(--chrome-bg);
  user-select: none;
  -webkit-user-select: none;
}

#app { display: flex; flex-direction: column; height: 100%; }

/* ---------- Menu bar ---------- */
#menubar {
  display: flex;
  align-items: stretch;
  height: 26px;
  background: linear-gradient(#f6f6f6, #ebebeb);
  border-bottom: 1px solid var(--chrome-border);
  padding: 0 6px;
  flex: none;
  z-index: 200;
}
.menu-title {
  display: flex; align-items: center;
  padding: 0 10px;
  cursor: default;
  border-radius: 4px;
  margin: 2px 0;
}
.menu-title:hover, .menu-title.open { background: var(--menu-hover); color: #fff; }
.menu-dropdown {
  position: fixed;
  min-width: 220px;
  background: var(--menu-bg);
  border: 1px solid #b5b5b5;
  border-radius: 6px;
  box-shadow: 0 6px 24px rgba(0,0,0,.22);
  padding: 4px 0;
  z-index: 300;
}
.menu-item {
  display: flex; align-items: center;
  padding: 3px 22px 3px 24px;
  white-space: nowrap;
  cursor: default;
  position: relative;
}
.menu-item .mi-label { flex: 1 1 auto; padding-right: 30px; }
.menu-item .mi-accel { color: var(--chrome-text-dim); font-size: 12px; }
.menu-item:hover:not(.disabled) { background: var(--menu-hover); color: #fff; }
.menu-item:hover:not(.disabled) .mi-accel { color: #dce8ff; }
.menu-item.disabled { color: #b0b0b0; }
.menu-item.checked::before {
  content: "✓"; position: absolute; left: 8px; font-size: 11px;
}
.menu-sep { height: 1px; background: #d8d8d8; margin: 4px 10px; }
.menu-item.submenu::after {
  content: "▸"; position: absolute; right: 8px; color: var(--chrome-text-dim);
}
.menu-item.submenu:hover::after { color: #fff; }
.menu-dropdown .menu-dropdown { /* nested submenu */ }

/* ---------- Toolbar ---------- */
#toolbar {
  display: flex;
  align-items: center;
  gap: 1px;
  height: 40px;
  background: linear-gradient(#f2f2f2, #e6e6e6);
  border-bottom: 1px solid var(--chrome-border);
  padding: 0 8px;
  flex: none;
  overflow-x: auto;
  overflow-y: hidden;
}
.tb-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 32px;
  border-radius: 5px;
  cursor: default;
  flex: none;
  position: relative;
}
.tb-btn svg { width: 24px; height: 24px; display: block; }
.tb-btn:hover { background: rgba(0,0,0,.07); }
.tb-btn.active { background: var(--accent-soft); box-shadow: inset 0 0 0 1px #9dbef0; }
.tb-btn.disabled { opacity: .3; pointer-events: none; }
.tb-sep { width: 1px; height: 24px; background: #cdcdcd; margin: 0 6px; flex: none; }

/* ---------- Main area ---------- */
#main { display: flex; flex: 1 1 auto; min-height: 0; }

#viewport { position: relative; flex: 1 1 auto; min-width: 0; background: #fff; }
#canvas { position: absolute; inset: 0; width: 100%; height: 100%; outline: none; display: block; }

#tooltip {
  position: absolute;
  pointer-events: none;
  background: #ffffe1;
  border: 1px solid #999;
  padding: 1px 6px 2px;
  font-size: 12px;
  border-radius: 2px;
  box-shadow: 1px 2px 4px rgba(0,0,0,.2);
  z-index: 50;
  white-space: nowrap;
}

#context-breadcrumb {
  position: absolute;
  top: 8px; left: 10px;
  background: rgba(255,255,255,.85);
  border: 1px solid #c0c0c0;
  border-radius: 4px;
  padding: 2px 10px;
  font-size: 12px;
  color: #555;
  z-index: 40;
  pointer-events: none;
}

/* ---------- Tray (right sidebar) ---------- */
#tray {
  width: 260px;
  flex: none;
  background: var(--panel-bg);
  border-left: 1px solid var(--chrome-border);
  overflow-y: auto;
  overflow-x: hidden;
}
.panel { border-bottom: 1px solid #d9d9d9; }
.panel-header {
  display: flex; align-items: center;
  height: 26px;
  padding: 0 8px;
  background: linear-gradient(#efefef, #e2e2e2);
  border-bottom: 1px solid #d5d5d5;
  font-weight: 600;
  font-size: 12px;
  cursor: default;
}
.panel-header .disclosure {
  width: 14px; font-size: 10px; color: #666;
}
.panel-body { padding: 8px; }
.panel.collapsed .panel-body { display: none; }

/* Entity Info */
#ei-thumb-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
#ei-type { font-weight: 600; font-size: 12px; }
.ei-row { display: flex; align-items: center; margin-bottom: 6px; gap: 6px; }
.ei-row label { width: 74px; flex: none; color: #555; font-size: 12px; }
.ei-row input[type=text], .ei-row select {
  flex: 1 1 auto; min-width: 0;
  height: 21px;
  border: 1px solid var(--input-border);
  border-radius: 3px;
  background: var(--input-bg);
  padding: 0 5px;
  font-size: 12px;
  font-family: inherit;
}
.ei-row input[readonly] { background: #f0f0f0; color: #555; }
.ei-toggles { display: flex; gap: 14px; margin-top: 4px; }
.ei-toggles label { display: flex; align-items: center; gap: 4px; font-size: 12px; color: #444; }
.ei-empty { color: #999; font-size: 12px; padding: 4px 2px; }

/* Tags panel */
.tags-toolbar { display: flex; gap: 4px; margin-bottom: 6px; }
.tags-toolbar button, .comp-toolbar button {
  height: 20px; padding: 0 8px;
  border: 1px solid var(--input-border); border-radius: 3px;
  background: linear-gradient(#fdfdfd, #ededed);
  font-size: 12px; cursor: default;
}
.tags-toolbar button:hover { background: #e8e8e8; }
.tag-row {
  display: flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 4px;
  border-radius: 3px;
}
.tag-row:hover { background: #e9e9e9; }
.tag-row.current-tag .tag-name { font-weight: 600; }
.tag-eye { width: 18px; text-align: center; cursor: default; font-size: 13px; }
.tag-eye.off { opacity: .25; }
.tag-swatch {
  width: 14px; height: 14px; border-radius: 3px;
  border: 1px solid rgba(0,0,0,.25); flex: none; cursor: default;
}
.tag-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.tag-name input { width: 100%; font-size: 12px; }
.tag-current-dot { width: 16px; text-align: center; color: #333; font-size: 11px; cursor: default; }

/* Components panel */
#components-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.comp-card {
  border: 1px solid #d0d0d0; border-radius: 4px;
  background: #fff; padding: 4px;
  text-align: center; cursor: default;
}
.comp-card:hover { border-color: var(--accent); }
.comp-card canvas { width: 100%; aspect-ratio: 1; display: block; background: #fdfdfd; }
.comp-card .comp-name {
  font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px;
}
.comp-card .comp-count { font-size: 10px; color: #888; }
.comp-empty { color: #999; font-size: 12px; grid-column: 1 / -1; }

/* ---------- Status bar ---------- */
#statusbar {
  display: flex; align-items: center;
  height: 26px;
  background: linear-gradient(#f0f0f0, #e3e3e3);
  border-top: 1px solid var(--chrome-border);
  padding: 0 10px;
  flex: none;
  gap: 10px;
}
#status-hint {
  flex: 1 1 auto;
  font-size: 12px;
  color: #555;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
#vcb { display: flex; align-items: center; gap: 6px; flex: none; }
#vcb-label { font-size: 12px; color: #666; }
#vcb-input {
  width: 130px; height: 19px;
  border: 1px solid var(--input-border);
  border-radius: 3px;
  background: var(--input-bg);
  padding: 0 5px;
  font-size: 12px;
  text-align: right;
  font-family: inherit;
}
#vcb-input:focus { outline: 1px solid var(--accent); }

/* ---------- Dialogs ---------- */
#dialog-layer {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.25);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
}
.dialog {
  background: #f2f2f2;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
  min-width: 320px;
  max-width: 460px;
  overflow: hidden;
}
.dialog-title {
  padding: 10px 16px 6px;
  font-weight: 600;
  font-size: 13px;
}
.dialog-body { padding: 6px 16px 12px; font-size: 12px; }
.dialog-body .ei-row label { width: 90px; }
.dialog-buttons {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 10px 16px 14px;
}
.dialog-buttons button {
  min-width: 72px; height: 24px;
  border: 1px solid #bdbdbd; border-radius: 5px;
  background: linear-gradient(#fff, #f0f0f0);
  font-size: 12px; cursor: default;
}
.dialog-buttons button.primary {
  background: linear-gradient(#5a9cf5, #2c6fdc);
  border-color: #2a63c4; color: #fff;
}
.dialog-body table.shortcuts { border-collapse: collapse; width: 100%; }
.dialog-body table.shortcuts td { padding: 2px 8px; font-size: 12px; }
.dialog-body table.shortcuts td:first-child { color: #555; width: 90px; font-weight: 600; }

/* ---------- Context menu ---------- */
#context-menu {
  position: fixed;
  min-width: 200px;
  background: var(--menu-bg);
  border: 1px solid #b5b5b5;
  border-radius: 6px;
  box-shadow: 0 6px 24px rgba(0,0,0,.22);
  padding: 4px 0;
  z-index: 400;
}

/* ---------- Text entity inline editor ---------- */
#text-editor {
  position: absolute;
  z-index: 60;
  border: 1px solid var(--accent);
  background: #fff;
  font-size: 12px;
  font-family: inherit;
  padding: 2px 4px;
  min-width: 80px;
  resize: none;
  overflow: hidden;
}

.hidden { display: none !important; }
