/* 量房大师 - 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --surface: #ffffff;
  --surface-variant: #f5f5f5;
  --background: #fafafa;
  --on-surface: #1a1a1a;
  --on-surface-variant: #666666;
  --border: #e0e0e0;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --radius: 12px;
  --topbar-height: 48px;
  --toolbar-height: 64px;
  --nav-height: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Noto Sans KR', sans-serif;
  font-size: 14px;
  background: var(--background);
  color: var(--on-surface);
  position: fixed;
  top: 0;
  left: 0;
}

#app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* ========== 顶部栏 ========== */
#topbar {
  height: var(--topbar-height);
  background: var(--surface);
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  z-index: 100;
  flex-shrink: 0;
}

#project-title {
  flex: 1;
  text-align: center;
  overflow: hidden;
}

#txt-project-name {
  display: block;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#txt-floor-info {
  display: block;
  font-size: 11px;
  color: var(--on-surface-variant);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-btn:active {
  background: var(--surface-variant);
}

/* ========== 画布区域 ========== */
#canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #fafafa;
  touch-action: none;
}

#main-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.hint-overlay {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  color: #fff;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 13px;
  pointer-events: none;
  z-index: 10;
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

/* ========== 属性栏 ========== */
#property-bar {
  height: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  overflow: hidden;
  transition: height 0.2s;
  flex-shrink: 0;
}

#property-bar.active {
  height: 80px;
}

/* ========== 底部工具栏 ========== */
#toolbar {
  height: var(--toolbar-height);
  background: var(--surface);
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid var(--border);
  padding: 4px 8px;
  padding-bottom: var(--safe-bottom);
  flex-shrink: 0;
  z-index: 90;
}

.tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: none;
  background: transparent;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 12px;
  min-width: 52px;
  transition: background 0.15s;
}

.tool-btn:active {
  background: var(--surface-variant);
}

.tool-btn.active {
  color: var(--primary);
}

.tool-icon {
  font-size: 22px;
}

.tool-label {
  font-size: 10px;
  font-weight: 500;
}

/* ========== 子工具栏（地标/部件选择）========== */
#sub-toolbar {
  height: 80px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  padding: 8px;
  flex-shrink: 0;
  z-index: 85;
}

.sub-toolbar-scroll {
  display: flex;
  gap: 8px;
  height: 100%;
}

.sub-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 12px;
  min-width: 60px;
  flex-shrink: 0;
  transition: all 0.15s;
}

.sub-btn:active,
.sub-btn.active {
  border-color: var(--primary);
  background: #e8f0fe;
}

.sub-icon {
  font-size: 24px;
}

.sub-label {
  font-size: 9px;
  color: var(--on-surface-variant);
  white-space: nowrap;
}

/* ========== 底部导航 ========== */
#bottom-nav {
  height: calc(var(--nav-height) + var(--safe-bottom));
  background: var(--surface);
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
  flex-shrink: 0;
  z-index: 100;
}

.nav-btn {
  border: none;
  background: transparent;
  font-size: 12px;
  color: var(--on-surface-variant);
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 8px;
  transition: color 0.15s;
}

.nav-btn.active {
  color: var(--primary);
  font-weight: 600;
}

/* ========== 弹窗 ========== */
#modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-box {
  background: var(--surface);
  border-radius: 16px;
  padding: 24px;
  width: 85%;
  max-width: 340px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-box h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

.modal-box p {
  font-size: 13px;
  color: var(--on-surface-variant);
  margin-bottom: 20px;
}

.modal-box button {
  width: 100%;
  padding: 12px;
  border: none;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
}

.modal-box button:active {
  background: var(--primary-dark);
}

/* ========== Toast ========== */
#toast {
  pointer-events: none;
}

/* ========== 滚动条隐藏 ========== */
::-webkit-scrollbar {
  height: 0;
  width: 0;
}

.menu-item {
  padding: 10px 16px;
  cursor: pointer;
  user-select: none;
}
.menu-item:hover {
  background: #f5f5f5;
}
#property-bar.active {
    height: 52px !important;
}