/* GLOBAL LAYOUT & RESET */
body {
  margin: 0;
  display: flex;
  height: 100vh;
  font-family: 'Segoe UI', sans-serif;
  background: #1a1a1a;
  color: white;
  overflow: hidden;
}

/* Common Sidebar Styles */
#sidebar-left,
#sidebar-right {
  width: 280px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #333;
  padding: 15px;
  box-sizing: border-box;
}

/* LEFT SIDEBAR (Library & Categories) */
#sidebar-left {
  border-right: 1px solid #333;
}

#library-container {
  flex-grow: 1;
  overflow-y: scroll;
  scrollbar-width: thin;
  scrollbar-color: #444 #252526;
  scrollbar-gutter: stable;
}

/* Category Headers */
.category-title {
  background: #333;
  padding: 10px;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: bold;
  border-bottom: 1px solid #444;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.category-title:hover {
  background: #444;
}

.category-title::after {
  content: '▼';
  font-size: 8px;
  transition: transform 0.2s;
}

.category-title.collapsed::after {
  transform: rotate(-90deg);
}

/* Asset Grid & Items */
.bank-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
}

.bank-grid.collapsed {
  display: none;
}

.bank-item {
  background: #3e3e3e;
  padding: 5px;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  font-size: 9px;
  border: 1px solid #505050;
}

.bank-item:hover {
  background: #505050;
  border: 1px solid #555;
}

.bank-item img {
  width: 100%;
  height: 40px;
  object-fit: contain;
  pointer-events: none;
  background-color: transparent;
}

/* MAIN CANVAS AREA */
#canvas-container {
  flex-grow: 1;
  background: #333;
  position: relative;
  overflow: hidden;
}

/* RIGHT SIDEBAR (Properties & Panels) */
#sidebar-right {
  border-left: 1px solid #333;
  padding: 15px;
}

.panel {
  padding: 15px;
  border-bottom: 1px solid #333;
}

h3 {
  margin-top: 0;
  color: #007acc;
  font-size: 1.1rem;
}

/* UI COMPONENTS (Forms, Buttons, Toggles, Modals) */

/* Standard Inputs & Labels */
label {
  font-size: 11px;
  color: #aaa;
  text-transform: uppercase;
  font-weight: bold;
  display: block;
  margin-bottom: 5px;
}

input {
  width: 100%;
  background: #3c3c3c;
  border: 1px solid #555;
  color: white;
  margin-bottom: 10px;
  padding: 8px;
  box-sizing: border-box;
}

button {
  background: #007acc;
  color: white;
  border: none;
  padding: 10px;
  border-radius: 3px;
  cursor: pointer;
  width: 100%;
  margin-bottom: 8px;
  font-weight: bold;
}

/* Toggle Switches */
.toggle-container {
  background: #333;
  padding: 8px 12px;
  border-radius: 4px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #444;
}

.switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #555;
  transition: .4s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked+.slider {
  background-color: #007acc;
}

input:checked+.slider:before {
  transform: translateX(14px);
}

.toggle-container.hidden {
  animation: opacity 0.5s ease-in;
  opacity: 0.5;
}

@keyframes opacity {
  from {
    opacity: 1;
  }
  to {
    opacity: 0.5;
  }
}

.toggle-container.not-hidden {
  animation: opacityout 0.5s ease-in;
  opacity: 1;
}

@keyframes opacityout {
  from {
    opacity: 0.5;
  }
  to {
    opacity: 1;
  }
}

/* Modals */
#help-modal {
  position: fixed;
  top: 100px;
  left: calc(50% - 200px);
  width: 400px;
  height: 75%;
  background-color: #333;
  color: white;
  padding: 20px;
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  display: flex;
  overflow-y: scroll;
  scrollbar-width: thin;
  scrollbar-color: #444 #252526;
  scrollbar-gutter: stable;
}

#help-modal.hidden {
  display: none;
}

#help-content {
  padding: 5px;
}

#cable-color {
  width: 100%;
  height: 50px;
  border: none;
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
}

#color-history-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px;
  background: #1e1e1e;
  border-radius: 4px;
  justify-content: center;
}

.history-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid #444;
  cursor: pointer;
  transition: transform 0.1s;
}

.history-swatch:hover {
  transform: scale(1.2);
}

#canvas-props {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden;
}

#groups-toggles-container {
  flex-grow: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #444 #252526;
  scrollbar-gutter: stable;
  background: #1e1e1e;
  border-radius: 5px;
}

.tooltip {
  cursor: pointer;
}

.tooltiptextR {
  visibility: hidden;
  background-color: black;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px;
  position: absolute;
  z-index: 1;
  top: -30px;
  left: 80%;
}

.tooltiptextL {
  visibility: hidden;
  background-color: black;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px;
  position: absolute;
  z-index: 1;
  top: -30px;
  right: 80%;
}

.tooltip:hover .tooltiptextR {
  visibility: visible;
}

.tooltip:hover .tooltiptextL {
  visibility: visible;
}