/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Inter", sans-serif;
}

/* 水印样式 */
body {
  position: relative;
}

body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('media/svg/logo.svg')  -45deg,;
  background-repeat: repeat;
  background-position: center;
  opacity: 0.2;
  pointer-events: none;  
  z-index: 9999;
/*   
  content: ' 11';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 200px,
    rgba(0, 0, 0, 0.1) 200px,
    rgba(0, 0, 0, 0.1) 400px
  ); */
}

body::after {
  content: 'VELTRY FLOOR';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: rgba(0, 0, 0, 0.1);
  white-space: nowrap;
  pointer-events: none;
  z-index: 9999;
  transform: rotate(-45deg);
  background-image: url('media/svg/logo.svg')  ;
  opacity: 0.1;
  background-repeat: repeat;
  background-size: 200px 200px;
  animation: watermarkScroll 60s linear infinite;
}

@keyframes watermarkScroll {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 200px 200px;
  }
}

body {
  background-color: #f5f5f5;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Header Styles */
.app-header {
  height: 60px;
  background-color: white;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid #e0e0e0;
}

.logo-img {
  height: 40px;
  width: 200px;
  object-fit: contain;
}

.view-controls {
  display: flex;
  margin-left: 40px;
}

.view-btn {
  padding: 6px 16px;
  background-color: #0000ff;
  color: white;
  border: none;
  cursor: pointer;
  font-size: 14px;
  border-radius: 4px;
}

.price-info {
  margin-left: auto;
  text-align: right;
}

.price-exc-vat {
  font-size: 14px;
  color: #0000ff;
  font-weight: 600;
}

.price-inc-vat,
.price-per-unit {
  font-size: 12px;
  color: #333;
}

.user-profile {
  display: flex;
  align-items: center;
  margin-left: 24px;
  cursor: pointer;
}

.profile-img {
  width: 45px;
  height: 45px;
  object-fit: cover;
  border-radius: 50%;
}

/* Main Content */
.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar Styles */
.sidebar {
  width: 240px;
  background-color: white;
  border-right: 1px solid #e0e0e0;
  overflow-y: auto;
  padding: 10px 15px;
}

.sidebar-item {
  margin-top: 10px;
  border-radius: 10px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  border: 2px solid #ab977c;
  border-radius: 10px;
}

.sidebar-icon {
  margin-right: 12px;
  font-size: 25px;
}

.sidebar-title {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

.sidebar-arrow {
  font-size: 18px;
  color: #666;
}

.sidebar-content {
  display: none;
  padding: 16px 0;
}

.sidebar-item.active .sidebar-content {
  display: block;
}

.sidebar-item.active .sidebar-header {
  background-color: #ab977c;
  color: white;
  border: 2px solid #ab977c;
}

.sidebar-item.active .sidebar-arrow {
  color: white;
}

/* Layout Grid Styles */
.layout-grid,
.pattern-grid,
.tile-type-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.layout-option,
.pattern-option,
.tile-type-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.pattern-option {
  padding: 2px;
}

.layout-option.active,
.pattern-option.active,
.tile-type-option.active {
  border: 2px solid #ab977c;
}

.layout-image,
.pattern-canvas,
.tile-type-image {
  width: 80px;
  height: 60px;
  object-fit: contain;
  object-position: center;
}

.layout-label,
.pattern-label,
.tile-type-label {
  font-size: 12px;
  color: #333;
  margin-top: 4px;
  text-align: center;
}

/* Edge Grid Styles */
.edge-controls {
  margin-bottom: 15px;
}

.clear-edges-btn {
  background-color: #0000ff;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  width: 100%;
  margin-bottom: 8px;
}

.edge-mode-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.edge-mode-btn {
  flex: 1;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}

.edge-mode-btn.active {
  background: #0000ff;
  color: white;
  border-color: #0000ff;
}

.edge-length-control {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.edge-length-control label {
  font-size: 14px;
  color: #333;
}

.edge-length-control input {
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  width: 100%;
}

.clear-edges-btn {
  background-color: #0000ff;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  width: 100%;
}

.edge-controls {
  margin-bottom: 16px;
}

.clear-edges-btn {
  width: 100%;
  padding: 8px;
  background-color: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  color: #333;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.clear-edges-btn:hover {
  background-color: #e0e0e0;
}

.edge-settings {
  display: flex;
  gap: 12px;
}

.edge-settings .control-group {
  flex: 1;
}

.edge-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  flex: 2;
}

.edge-color-selector {
  margin-top: 15px;
  padding: 10px;
  background-color: #f5f5f5;
  border-radius: 4px;
}

.edge-color-selector h4 {
  font-size: 14px;
  color: #333;
  margin-bottom: 8px;
}

.edge-color-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.edge-color-option {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s ease;
}

.edge-color-option.active {
  border-color: #0000ff;
}

.edge-segment {
  position: absolute;
  background-color: transparent;
  border: 2px solid;
  cursor: pointer;
  z-index: 5;
}

.edge-segment:hover {
  opacity: 0.8;
}

.edge-segment.selected {
  border-width: 3px;
  z-index: 6;
}

/* Color Swatches */
.color-swatches {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 12px;
}

/* 非瓷砖区域样式 */
.non-tile-controls {
  margin-bottom: 15px;
}

.add-non-tile-btn {
  background-color: #0000ff;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  width: 100%;
}

.non-tile-areas-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.non-tile-area-item {
  background-color: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 10px;
}

.non-tile-area-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.non-tile-area-title {
  font-weight: 500;
  font-size: 14px;
}

.remove-non-tile-btn {
  background-color: transparent;
  color: #0000ff;
  border: none;
  cursor: pointer;
  font-size: 16px;
}

.non-tile-area-dimensions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.non-tile-area-dimensions label {
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
}

.non-tile-area-dimensions input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}

/* 非瓷砖区域在画布上的样式 */
.non-tile-area {
  position: absolute;
  background-color: rgba(0, 0, 255, 0.2);
  border: 2px dashed #0000ff;
  cursor: move;
  z-index: 5;
}

.non-tile-area-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background-color: white;
  border: 1px solid #0000ff;
  z-index: 6;
}

.non-tile-area-handle.top-left {
  top: -5px;
  left: -5px;
  cursor: nwse-resize;
}

.non-tile-area-handle.top-right {
  top: -5px;
  right: -5px;
  cursor: nesw-resize;
}

.non-tile-area-handle.bottom-left {
  bottom: -5px;
  left: -5px;
  cursor: nesw-resize;
}

.non-tile-area-handle.bottom-right {
  bottom: -5px;
  right: -5px;
  cursor: nwse-resize;
}

.color-swatch {
  width: 60px;
  height: 40px;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  margin: 0 auto;
}

.color-swatch.active {
  border: 3px solid #333;
}

/* Canvas Area */
.canvas-area {
  width: calc(100% - 240px);
  height: calc(100vh - 120px);
  padding: 30px;
  position: relative;
  display: flex;
  justify-content: center;
}

.canvas-container {
  position: relative;
  width: 100%;
  height: 100%;
}

canvas {
  background-color: white;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  width: 100%;
  height: 100%;
}

/* Resize Handles */
.resize-handle {
  position: absolute;
  width: 16px;
  height: 16px;
  background-color: white;
  border: 2px solid #0000ff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: move;
  z-index: 10;
}

.side-handle {
  position: absolute;
  width: 15px;
  height: 15px;
  border: 2px solid #0000ff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  z-index: 10;
}

/* Dimension Labels */
.dimension-label {
  position: absolute;
  background-color: rgba(255, 255, 255, 0.7);
  color: #333;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 5;
}

/* Footer */
.app-footer {
  height: 60px;
  background-color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-top: 1px solid #e0e0e0;
}

.back-btn {
  padding: 8px 16px;
  background-color: transparent;
  border: none;
  color: #333;
  cursor: pointer;
  font-size: 14px;
}

.next-btn {
  padding: 10px 24px;
  background-color: #0000ff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
}

/* Control Panel */
.control-panel {
  position: fixed;
  top: 70px;
  right: 16px;
  background-color: white;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 100;
}

.edge-stats-panel {
  position: fixed;
  top: 70px;
  right: 250px;
  background-color: white;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 100;
  min-width: 200px;
  margin-right: -234px;
}

.edge-stats-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #333;
}

.edge-stats-list {
  list-style: none;
  padding: 0;
}

.edge-stats-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
  color: #666;
}

.control-group {
  margin-bottom: 12px;
}

.control-group label {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  color: #333;
}

.control-group select,
.control-group input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.units-system {
  margin-bottom: 20px;
}

.units-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 15px;
}

.unit-btn {
  flex: 1;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
}

.unit-btn.active {
  background: #0000ff;
  color: white;
  border-color: #0000ff;
}

.room-dimensions {
  display: grid;
  gap: 12px;
}

.dimension-input {
  display: grid;
  gap: 4px;
}

.dimension-input label {
  font-size: 12px;
  color: #666;
}

.dimension-input input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.apply-btn {
  width: 100%;
  padding: 8px;
  background: #0000ff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 8px;
}

.apply-btn:hover {
  background: #0000dd;
}

#dimensions {
  font-size: 12px;
  color: #666;
}

/* Hide resize handles when not in layout step */
.resize-handles-hidden .resize-handle,
.resize-handles-hidden .side-handle {
  display: none;
}

.pattern-image {
  width: 100%;
  height: 60px;
  object-fit: cover;
  border: 1px solid #ddd;
  background: white;
}

.pattern-option {
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

/* .pattern-option:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
} */

.pattern-option.active {
  border-color: #ab977c;
  box-shadow: 0 2px 8px rgba(171, 151, 124, 0.3);
}

/* Ensure canvasContainer is positioned for absolute children */
.canvas-container {
  position: relative;
  width: 1200px; /* Match canvas width */
  height: 900px; /* Match canvas height */
}

/* Base style for all reshape handles */
.reshape-handle {
  position: absolute;
  width: 20px;
  height: 20px;
  background-color: blue;
  border: 1px solid white;
  border-radius: 50%;
  cursor: move;
  transform: translate(-50%, -50%);
  z-index: 10; /* Above canvas */
}

/* Differentiate corner and midpoint handles */
.corner-handle {
  /* background-color: blue; */
  background-image: url("./media/svg/reshapeIcon.svg");
  background-position: center;
  background-repeat: no-repeat;
}

.midpoint-handle {
  /* background-color: yellow; */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white' width='24px' height='24px'%3E%3Cpath d='M0 0h24v24H0z' fill='none'/%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-2-9h4v2h-4v-2z'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
}

/* Hide handles when not in layouts section */
.resize-handles-hidden .reshape-handle {
  display: none;
}

.dimension-label {
  position: absolute;
  font-size: 12px;
  color: #333;
  background: rgba(255, 255, 255, 0.9);
  padding: 2px 5px;
  border-radius: 3px;
  pointer-events: none;
}

.dimension-label.horizontal {
  transform: translateX(-50%);
}

.dimension-label.vertical {
  transform: translateY(-50%);
}

.edge-color-swatch {
  width: 60px;
  height: 40px;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  margin: 0 auto;
  display: inline-block;
  margin: 5px;
  cursor: pointer;
  border: 2px solid transparent;
}
.edge-color-swatch.active {
  border: 2px solid #0509f3;
}

#areaInfo {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.8);
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
}

/* Final Design Styles */
.design-summary {
  padding: 15px 0;
}

.summary-item {
  margin-bottom: 12px;
  font-size: 14px;
}

.summary-item label {
  display: block;
  color: #666;
  margin-bottom: 4px;
}

.summary-item span {
  font-weight: 500;
  color: #333;
}

.summary-section {
  margin-top: 20px;
}

.summary-section h4 {
  font-size: 14px;
  color: #333;
  margin-bottom: 10px;
}

.stats-list {
  font-size: 13px;
  color: #666;
}

.stats-list .stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.design-actions {
  margin-top: 25px;
  display: flex;
  gap: 10px;
}

.action-btn {
  flex: 1;
  padding: 8px 16px;
  border: 1px solid #0000ff;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  background: white;
  color: #0000ff;
  transition: all 0.2s ease;
}

.action-btn:hover {
  background: #f0f0ff;
}

.action-btn.primary {
  background: #0000ff;
  color: white;
}

.action-btn.primary:hover {
  background: #0000dd;
}
