* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  background: #f0f2f5;
  height: 100vh;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

header {
  background: #1a3a5c;
  color: white;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  flex-shrink: 0;
}

header h1 {
  font-size: 18px;
  font-weight: 600;
  white-space: nowrap;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar button {
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  background: #2d6a9f;
  color: white;
  transition: background 0.2s;
}

.toolbar button:hover {
  background: #3a80be;
}

.toolbar button.active {
  background: #e67e22;
}

.toolbar button.danger {
  background: #c0392b;
}

.toolbar button.danger:hover {
  background: #e74c3c;
}

.mode-label {
  font-size: 13px;
  color: #ccc;
}

.mode-btn {
  background: #2d6a9f !important;
}

.mode-btn.active {
  background: #e67e22 !important;
}

#main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

#palette {
  width: 130px;
  background: #ffffff;
  border-right: 1px solid #ddd;
  overflow-y: auto;
  padding: 8px 4px;
  flex-shrink: 0;
}

#palette h2 {
  font-size: 13px;
  color: #555;
  text-align: center;
  padding: 4px 0 8px;
  border-bottom: 1px solid #eee;
  margin-bottom: 8px;
}

.component-group {
  margin-bottom: 8px;
}

.group-title {
  font-size: 10px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 4px 4px;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 4px;
}

.palette-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  cursor: grab;
  border-radius: 6px;
  transition: background 0.15s;
  user-select: none;
  margin-bottom: 2px;
}

.palette-item:hover {
  background: #e8f4fd;
}

.palette-item:active {
  cursor: grabbing;
}

.palette-item svg {
  display: block;
}

.palette-item span {
  font-size: 10px;
  color: #444;
  text-align: center;
  margin-top: 2px;
}

#canvas-container {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: #f8f9fa;
}

#diagram-canvas {
  display: block;
  cursor: default;
  background: white;
  background-image:
    linear-gradient(to right, #e8e8e8 1px, transparent 1px),
    linear-gradient(to bottom, #e8e8e8 1px, transparent 1px);
  background-size: 20px 20px;
}

#properties-panel {
  position: absolute;
  right: 16px;
  top: 70px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 16px;
  min-width: 220px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  z-index: 100;
}

#properties-panel h3 {
  font-size: 14px;
  color: #333;
  margin-bottom: 12px;
  border-bottom: 1px solid #eee;
  padding-bottom: 8px;
}

#prop-content label {
  display: block;
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
  margin-top: 8px;
}

#prop-content input,
#prop-content select {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
}

#prop-close {
  margin-top: 12px;
  padding: 6px 16px;
  background: #1a3a5c;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  width: 100%;
}

#prop-close:hover {
  background: #2d6a9f;
}

.hidden {
  display: none !important;
}

/* Scrollbar styling */
#palette::-webkit-scrollbar {
  width: 4px;
}

#palette::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 2px;
}
