html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#toolbar {
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  padding: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  border-bottom: 3px solid #3498db;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

#toolbar input[type="file"] {
  display: none;
}

#toolbar button {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#toolbar button:hover {
  background: linear-gradient(135deg, #2980b9 0%, #21618c 100%);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

#toolbar button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#toolbar .export-group button {
  background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
}

#toolbar .export-group button:hover {
  background: linear-gradient(135deg, #229954 0%, #1e8449 100%);
}

#toolbar input[type="range"] {
  width: 80px;
  margin: 0 5px;
}

#toolbar input[type="number"] {
  background: #34495e;
  color: white;
  border: 1px solid #556983;
  border-radius: 4px;
  padding: 4px 6px;
  width: 60px;
}

#toolbar label {
  color: #ecf0f1;
  font-weight: 500;
  font-size: 13px;
  margin-left: 12px;
}

#toolbar label:first-of-type {
  margin-left: 0;
}

#toolbar span {
  color: #bdc3c7;
  margin-right: 8px;
}

.toolbar-section {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border-right: 1px solid #556983;
}

.toolbar-section:last-child {
  border-right: none;
}

#editor {
  position: relative;
  width: 1000vw;
  height: 1000vh;
  overflow: visible;
  background: #f0f0f0;
  border-top: 1px solid #aaa;
}

#editor-container {
  position: relative;
  width: 100vw;
  height: calc(100vh - 40px);
  overflow: hidden;
  background: #f0f0f0;
  border-top: 1px solid #aaa;
}

#editor-container.panning * {
  cursor: grab;
}

.item {
  border: 1px solid transparent;
  box-sizing: content-box;
  position: absolute;
  left: var(--item-x, 0px);
  top: var(--item-y, 0px);
  width: var(--item-width, auto);
  height: var(--item-height, auto);
  cursor: move;
  user-select: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  pointer-events: auto;
  overflow: visible;
  z-index: 2;
  background-image: var(--item-image);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  transform: translate(-50%, -100%);
  /* filter: url(#floor-shadow); */
}

.guide-line {
  position: absolute;
  width: 2px;
  background-color: rgba(0, 0, 255, 0.5);
  opacity: 0.8;
  pointer-events: none;
  z-index: 9999;
  transform-origin: center center;
  display: none;
}

.h-guide-line {
  position: absolute;
  height: 2px;
  background-color: rgba(0, 0, 255, 0.5);
  opacity: 0.8;
  pointer-events: none;
  z-index: 9999;
  display: none;
}

.item:hover {
  border: 1px solid rgba(0, 0, 255, 0.5);
}

/* When an item is pinned to background, show yellow bounding box on hover */
.item.background:hover {
  border: 1px solid orange;
}

/* Asset type highlighting */
.item.asset-highlighted {
  /* border: 3px solid #f39c12 !important; */
  box-shadow: 0 0 15px 3px yellow !important;
  transform: translate(-50%, -100%) scale(1.02);

  z-index: 10000 !important;
}

.item.asset-highlighted::after {
  content: "";
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  border: 2px solid #f39c12;
  border-radius: 4px;

  pointer-events: none;
}

@keyframes pulse-highlight {
  0% {
    opacity: 0.7;
    transform: translate(-50%, -100%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -100%) scale(1.02);
  }
  100% {
    opacity: 0.7;
    transform: translate(-50%, -100%) scale(1);
  }
}

/* Tooltip styles */
#item-tooltip {
  position: fixed;
  background: rgba(44, 62, 80, 0.95);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  z-index: 1067867868000;
  pointer-events: none;
  display: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(52, 152, 219, 0.6);
  max-width: 200px;
  line-height: 1.4;
}

#item-tooltip.show {
  display: block;
}

#item-tooltip .tooltip-row {
  display: flex;
  justify-content: space-between;
  margin: 2px 0;
  white-space: nowrap;
}

#item-tooltip .tooltip-label {
  color: #bdc3c7;
  margin-right: 8px;
}

#item-tooltip .tooltip-value {
  color: #ecf0f1;
  font-weight: 500;
}

/* Asset Management Panel */
.asset-panel {
  position: fixed;
  top: 0;
  right: -350px;
  width: 350px;
  height: 100vh;
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.3);
  border-left: 3px solid #3498db;
  transition: right 0.3s ease;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.asset-panel.open {
  right: 0;
}

.asset-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
  border-bottom: 2px solid #3498db;
}

.asset-panel-header h3 {
  color: #ecf0f1;
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  color: #bdc3c7;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.close-btn:hover {
  background: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
}

.asset-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.asset-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.asset-item {
  background: rgba(52, 73, 94, 0.3);
  border-radius: 8px;
  padding: 12px;
  border: 1px solid rgba(52, 152, 219, 0.3);
  transition: all 0.3s ease;
}

.asset-item:hover {
  background: rgba(52, 73, 94, 0.5);
  border-color: rgba(52, 152, 219, 0.6);
}

.asset-item-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.asset-thumbnail {
  width: 40px;
  height: 40px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  flex-shrink: 0;
}

.asset-info {
  flex: 1;
  color: #ecf0f1;
}

.asset-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.asset-usage {
  font-size: 12px;
  color: #bdc3c7;
}

.asset-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.asset-replace-btn {
  background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.3s ease;
  flex: 1;
}

.asset-replace-btn:hover {
  background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.asset-replace-btn:active {
  transform: translateY(0);
}

/* Empty state */
.asset-list-empty {
  text-align: center;
  color: #bdc3c7;
  font-style: italic;
  padding: 40px 20px;
}

/* Scrollbar styling for asset panel */
.asset-panel-content::-webkit-scrollbar {
  width: 6px;
}

.asset-panel-content::-webkit-scrollbar-track {
  background: rgba(52, 73, 94, 0.3);
}

.asset-panel-content::-webkit-scrollbar-thumb {
  background: rgba(52, 152, 219, 0.6);
  border-radius: 3px;
}

.asset-panel-content::-webkit-scrollbar-thumb:hover {
  background: rgba(52, 152, 219, 0.8);
}
