/* layout.css - CAD Application Workspace Structure */

#app-root {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-primary);
}

/* Header Ribbon */
#app-header {
  height: var(--header-height);
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 100;
}

.header-left, .header-center, .header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: var(--accent-blue);
  margin-right: 12px;
}

.brand-icon {
  font-size: 18px;
}

.btn-group {
  display: flex;
  align-items: center;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.ribbon-btn {
  padding: 5px 9px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-primary);
  border-radius: 4px;
}

.ribbon-btn:hover {
  background-color: var(--bg-tertiary);
}

.ribbon-btn.active {
  background-color: var(--accent-blue);
  color: #ffffff;
}

/* Main Workspace Middle (Left Tools + Center Canvas + Right Panel) */
#workspace-body {
  display: flex;
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* Left Tools Palette */
#tools-palette {
  width: var(--toolbar-width);
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  gap: 4px;
  z-index: 90;
  overflow-y: auto;
}

.tool-btn {
  width: 44px;
  height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 18px;
  position: relative;
}

.tool-btn .tool-label {
  font-size: 9px;
  margin-top: 2px;
  font-weight: 500;
}

.tool-btn:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.tool-btn.active {
  background-color: var(--accent-blue);
  color: #ffffff;
}

.tool-divider {
  width: 32px;
  height: 1px;
  background-color: var(--border-color);
  margin: 4px 0;
}

/* Center Drawing Area */
#canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background-color: var(--bg-canvas);
}

#canvas-container {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  cursor: crosshair;
}

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

/* Floating Quick Dimension Bar */
#quick-dimension-bar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 80;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.quick-input-group {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-primary);
  font-size: 12px;
}

.quick-input-group input {
  width: 80px;
  text-align: right;
  font-weight: 600;
}

.btn-apply-numeric {
  background-color: var(--accent-blue);
  color: #ffffff;
  padding: 4px 10px;
  font-weight: 600;
  font-size: 11px;
  border-radius: 4px;
}

.btn-apply-numeric:hover {
  background-color: var(--accent-blue-hover);
}

/* Right Inspector Dock */
#inspector-panel {
  width: var(--panel-width);
  background-color: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 90;
  overflow: hidden;
}

.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-primary);
}

.tab-btn {
  flex: 1;
  padding: 10px 4px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  border-radius: 0;
}

.tab-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-secondary);
}

.tab-btn.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
  background-color: var(--bg-secondary);
}

.tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: none;
}

.tab-content.active {
  display: block;
}

/* Bottom Status Bar */
#status-bar {
  height: var(--status-height);
  background-color: #0b1120;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  z-index: 100;
}

.status-left, .status-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.status-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: #60a5fa;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 12px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-item strong {
  color: var(--text-primary);
}

/* Recovery Banner */
#recovery-banner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background-color: var(--accent-amber);
  color: #000000;
  font-weight: 600;
  padding: 8px 16px;
  display: none;
  align-items: center;
  justify-content: space-between;
  z-index: 200;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.recovery-actions {
  display: flex;
  gap: 8px;
}

.recovery-btn {
  background-color: #0f172a;
  color: #ffffff;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 4px;
  font-weight: 600;
}

/* --- Full 64 Hexagram Luopan Interactive Modal --- */
#luopan-modal {
  display: none;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(9, 13, 22, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 999990;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}

#luopan-modal.active {
  display: flex !important;
}

.luopan-modal-header {
  padding: 12px 20px;
  background: #1e293b;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.luopan-modal-title {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #38bdf8;
  font-size: 16px;
  font-weight: 800;
}

.luopan-modal-badge {
  font-size: 12px;
  font-weight: 600;
  color: #fde047;
  background: rgba(253, 224, 71, 0.15);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(253, 224, 71, 0.3);
}

.luopan-modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.luopan-modal-body {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, #1a2234 0%, #090d16 100%);
}

#compass-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent !important;
}

#luopanCanvas {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  margin: auto;
  cursor: grab;
  will-change: transform;
  transform-style: preserve-3d;
  image-rendering: high-quality;
  background: transparent !important;
}

#luopanCanvas:active {
  cursor: grabbing;
}

/* Floating Zoom Widget */
#floatingZoomWidget {
  position: absolute;
  bottom: 25px;
  right: 25px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 99;
}

.f-zoom-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 16px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.f-zoom-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.4);
  transform: scale(1.08);
}

.f-zoom-badge {
  font-size: 12px;
  font-weight: 700;
  color: #93c5fd;
  min-width: 44px;
  text-align: center;
}

