/* 组件样式 */

/* Canvas绘图相关样式 */
.canvas-drawing-mode {
  cursor: crosshair;
}

.canvas-selection-mode {
  cursor: default;
}

.canvas-dimension-mode {
  cursor: copy;
}

/* 绘图线条样式类 */
.ridge-line {
  stroke: #dc3545;
  stroke-width: 3;
  stroke-dasharray: none;
}

.eave-line {
  stroke: #007bff;
  stroke-width: 3;
  stroke-dasharray: none;
}

.dorme-line {
  stroke: #28a745;
  stroke-width: 3;
  stroke-dasharray: none;
}

.other-line {
  stroke: #ffc107;
  stroke-width: 3;
  stroke-dasharray: none;
}

.dimension-line {
  stroke: #6c757d;
  stroke-width: 1;
  stroke-dasharray: 5,5;
}

/* 标注文字样式 */
.dimension-text {
  font-family: Arial, sans-serif;
  font-size: 12px;
  fill: #495057;
  text-anchor: middle;
  dominant-baseline: central;
}

/* 选择状态样式 */
.selected-object {
  stroke-dasharray: 3,3 !important;
  stroke-width: 4 !important;
  opacity: 0.8;
  animation: dash 0.5s linear infinite;
}

@keyframes dash {
  to {
    stroke-dashoffset: -6;
  }
}

/* 3D场景控制器样式 */
.orbit-controls {
  outline: none;
}

/* 3D网格辅助线 */
.grid-helper {
  opacity: 0.3;
}

/* 材料项组件 */
.material-item {
  transition: background-color 0.2s;
  border-radius: 4px;
  padding: 8px;
  margin-bottom: 4px;
}

.material-item:hover {
  background-color: #f8f9fa;
}

.material-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  margin-bottom: 4px;
}

.material-item-details {
  font-size: 0.8rem;
  color: #6c757d;
  display: flex;
  justify-content: space-between;
}

.material-color-indicator {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  margin-right: 8px;
  border: 1px solid #dee2e6;
}

/* 排版网格组件 */
.layout-grid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.layout-grid-cell {
  stroke: #007bff;
  stroke-width: 1;
  fill: none;
  opacity: 0.3;
}

.layout-grid-text {
  font-size: 10px;
  fill: #007bff;
  text-anchor: middle;
  dominant-baseline: central;
  opacity: 0.7;
}

/* 计算进度指示器 */
.calculation-progress {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  background: rgba(255, 255, 255, 0.9);
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  z-index: 1000;
}

.calculation-progress .spinner-border {
  width: 2rem;
  height: 2rem;
}

/* 工具面板组件 */
.tool-panel {
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  margin-bottom: 15px;
  overflow: hidden;
}

.tool-panel-header {
  background: #f8f9fa;
  padding: 12px 15px;
  border-bottom: 1px solid #dee2e6;
  font-weight: 600;
  color: #495057;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tool-panel-body {
  padding: 15px;
}

.tool-panel-collapsed .tool-panel-body {
  display: none;
}

.collapse-btn {
  background: none;
  border: none;
  color: #6c757d;
  font-size: 0.9rem;
  transition: transform 0.2s;
}

.tool-panel-collapsed .collapse-btn {
  transform: rotate(180deg);
}

/* 参数输入组件 */
.parameter-group {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 12px;
}

.parameter-group-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #495057;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
}

.parameter-group-title i {
  margin-right: 6px;
  color: #007bff;
}

.parameter-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.parameter-row:last-child {
  margin-bottom: 0;
}

.parameter-label {
  min-width: 80px;
  font-size: 0.85rem;
  color: #6c757d;
  margin-right: 8px;
}

.parameter-input {
  flex: 1;
}

.parameter-unit {
  margin-left: 6px;
  font-size: 0.8rem;
  color: #6c757d;
  min-width: 30px;
}

/* 结果显示组件 */
.result-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  position: relative;
  overflow: hidden;
}

.result-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  z-index: -1;
}

.result-value {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 4px;
}

.result-label {
  font-size: 0.9rem;
  opacity: 0.9;
}

/* 导出按钮组件 */
.export-buttons {
  display: flex;
  gap: 8px;
  margin-top: 15px;
}

.export-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  font-size: 0.8rem;
  border-radius: 6px;
  transition: all 0.2s;
}

.export-btn i {
  margin-right: 4px;
}

.export-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* 状态徽章组件 */
.status-badge {
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.status-success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.status-badge.status-warning {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.status-badge.status-error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.status-badge.status-info {
  background-color: #cce7ff;
  color: #004085;
  border: 1px solid #b3d7ff;
}

/* 图表组件样式 */
.chart-container {
  position: relative;
  height: 200px;
  background: white;
  border-radius: 6px;
  padding: 15px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* 提示框组件 */
.custom-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  pointer-events: none;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.2s;
}

.custom-tooltip.show {
  opacity: 1;
}

.custom-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: rgba(0, 0, 0, 0.8) transparent transparent transparent;
}

/* 缩放控制组件 */
.zoom-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 100;
}

.zoom-btn {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #dee2e6;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
  color: #495057;
}

.zoom-btn:hover {
  background: white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  color: #007bff;
}

/* minimap组件 */
.minimap {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 120px;
  height: 80px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #dee2e6;
  border-radius: 4px;
  overflow: hidden;
  z-index: 100;
}

.minimap canvas {
  width: 100%;
  height: 100%;
}

/* 图层面板组件 */
.layer-item {
  display: flex;
  align-items: center;
  padding: 8px;
  margin-bottom: 4px;
  background: #f8f9fa;
  border-radius: 4px;
  transition: all 0.2s;
}

.layer-item:hover {
  background: #e9ecef;
}

.layer-item.active {
  background: #e3f2fd;
  border-left: 3px solid #007bff;
}

.layer-visibility {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  cursor: pointer;
  color: #6c757d;
}

.layer-visibility.visible {
  color: #007bff;
}

.layer-name {
  flex: 1;
  font-size: 0.85rem;
  color: #495057;
}

.layer-count {
  font-size: 0.75rem;
  color: #6c757d;
  background: #dee2e6;
  padding: 2px 6px;
  border-radius: 8px;
}

/* 快捷键提示组件 */
.keyboard-shortcuts {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  padding: 20px;
  z-index: 2000;
  max-width: 400px;
  width: 90%;
}

.shortcut-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

.shortcut-item:last-child {
  border-bottom: none;
}

.shortcut-key {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 3px;
  padding: 4px 8px;
  font-family: monospace;
  font-size: 0.8rem;
  color: #495057;
}

/* 上下文菜单组件 */
.context-menu {
  position: fixed;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  z-index: 1000;
  min-width: 150px;
  padding: 4px 0;
}

.context-menu-item {
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #495057;
  transition: background-color 0.1s;
  display: flex;
  align-items: center;
}

.context-menu-item:hover {
  background-color: #f8f9fa;
}

.context-menu-item i {
  margin-right: 8px;
  width: 14px;
}

.context-menu-separator {
  height: 1px;
  background: #dee2e6;
  margin: 4px 0;
}

/* 响应式组件调整 */
@media (max-width: 768px) {
  .tool-buttons {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  
  .export-buttons {
    flex-direction: column;
    gap: 6px;
  }
  
  .parameter-row {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .parameter-label {
    margin-bottom: 4px;
    margin-right: 0;
  }
  
  .zoom-controls {
    flex-direction: row;
    top: auto;
    bottom: 10px;
    left: 10px;
    right: auto;
  }
  
  .minimap {
    display: none;
  }
}

/* 项目定制补充 */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-radius: 999px;
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  background: rgba(59, 130, 246, 0.12);
  color: var(--primary-color);
}

.empty-state {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--gray-500);
}

.table-mini {
  width: 100%;
  border-collapse: collapse;
}

.table-mini th,
.table-mini td {
  padding: 0.45rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}

.hint {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--gray-500);
}

.mode-toggle {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.mode-toggle__title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-700);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mode-toggle__buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.mode-toggle__btn {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  overflow: hidden;
}

.mode-toggle__icon {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  border-radius: inherit;
}

.mode-toggle__btn.is-active {
  background: var(--primary-color);
  border-color: #7dd68c;
  box-shadow: 0 0 0 2px rgba(125, 214, 140, 0.7);
  color: #fff;
}

.mode-toggle__btn.is-locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.tool-buttons .btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tool-buttons .btn.is-disabled[data-tooltip] {
  position: relative;
}

.tool-buttons .btn.is-disabled[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  white-space: nowrap;
  z-index: 20;
}

.tool-buttons .btn.is-disabled[data-tooltip]:hover::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px 6px 0;
  border-style: solid;
  border-color: rgba(15, 23, 42, 0.92) transparent transparent;
  z-index: 20;
}

input[type="file"][data-state="loading"] {
  cursor: progress;
}

.ridge-editor {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ridge-editor__header,
.ridge-editor__row {
  display: grid;
  grid-template-columns: max-content minmax(0, 120px) minmax(0, 120px);
  align-items: center;
  gap: 0.75rem;
}

.ridge-editor__header {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--gray-500);
}

.ridge-editor__label {
  font-weight: 500;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

.ridge-editor__value {
  width: 100%;
}

.ridge-editor__input {
  width: 100%;
  padding: 0.3rem 0.4rem;
  font-size: 0.85rem;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  background-color: #ffffff;
}

.ridge-editor__input:focus {
  outline: none;
  box-shadow: 0 0 0 1px var(--primary-color);
  border-color: var(--primary-color);
}

.ridge-editor__note {
  font-size: 0.85rem;
  color: var(--gray-500);
}

.ridge-editor__empty {
  font-size: 0.85rem;
  color: var(--gray-500);
}

@media (max-width: 720px) {
  .ridge-editor__header,
  .ridge-editor__row {
    grid-template-columns: minmax(0, 1fr);
  }
}
