/* List view for Elements Library - with sticky header and fixed name column */

.elements-list-container {
  border: 1px solid #4a2a7f;
  background: linear-gradient(135deg, #0a0a0f 0%, #1a0f2e 100%);
  border-radius: 4px;
  /* Make container a scroll container with specific height */
  height: 280px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header area: sticky at top, with sticky name column on left */
.elements-list-header-wrapper {
  display: flex;
  border-bottom: 1px solid #4a2a7f;
  background: rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

/* Empty corner where sticky header meets sticky name column */
.elements-list-header-corner {
  width: 75px;
  min-width: 75px;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.5);
  border-right: 1px solid #4a2a7f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #64c8ff;
  font-weight: 600;
  padding: 4px;
}

/* Scrollable header for properties */
.elements-list-header {
  display: flex;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  /* Hide scrollbar on header, sync it with content below */
  scrollbar-width: none;
}

.elements-list-header::-webkit-scrollbar {
  display: none;
}

.elements-list-sort-btn {
  padding: 4px;
  border: none;
  background: rgba(0, 0, 0, 0.2);
  color: #b0d4ff;
  cursor: pointer;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  flex-shrink: 0;
  border-right: 1px solid #4a2a7f;
}

/* Column widths: speed 30px, damage 25px, others 20px */
.elements-list-sort-btn[data-property="speed"] {
  width: 30px;
}

.elements-list-sort-btn[data-property="damage"] {
  width: 25px;
}

.elements-list-sort-btn:hover {
  background: rgba(74, 158, 255, 0.15);
  color: #dff6ff;
}

/* Icon inside sort button */
.elements-list-sort-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.95;
}

/* Map property -> icon using same assets as property-badge */
.elements-list-sort-icon[data-property="damage"] { background-image: url('/img/damage.png'); }
.elements-list-sort-icon[data-property="speed"] { background-image: url('/img/speed.png'); }
.elements-list-sort-icon[data-property="knockback"] { background-image: url('/img/knockback.png'); }
.elements-list-sort-icon[data-property="aoe"] { background-image: url('/img/aoe.png'); }
.elements-list-sort-icon[data-property="dot"] { background-image: url('/img/dot.png'); }
.elements-list-sort-icon[data-property="piercing"] { background-image: url('/img/piercing.png'); }
.elements-list-sort-icon[data-property="chaining"] { background-image: url('/img/chaining.png'); }
.elements-list-sort-icon[data-property="homing"] { background-image: url('/img/homing.png'); }
.elements-list-sort-icon[data-property="slowing"] { background-image: url('/img/slowing.png'); }
/* Added lifesteal column icon */
.elements-list-sort-icon[data-property="lifesteal"] { background-image: url('/img/lifesteal.png'); }
.elements-list-sort-icon[data-property="wave"] { background-image: url('/img/wave.png'); }
.elements-list-sort-icon[data-property="splitting"] { background-image: url('/img/splitting.png'); }
.elements-list-sort-icon[data-property="spiral"] { background-image: url('/img/spiral.png'); }

/* Content area: scrollable both directions */
.elements-list-content-wrapper {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Fixed name column */
.elements-list-names {
  width: 75px;
  min-width: 75px;
  flex-shrink: 0;
  border-right: 1px solid #4a2a7f;
  background: rgba(0, 0, 0, 0.2);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

.elements-list-names::-webkit-scrollbar {
  width: 6px;
}

.elements-list-names::-webkit-scrollbar-track {
  background: transparent;
}

.elements-list-names::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 3px;
}

.elements-list-names::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Name row */
.elements-list-name-row {
  padding: 4px;
  border-bottom: 1px solid rgba(74, 158, 255, 0.1);
  height: 24px;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.elements-list-name-row:hover {
  background: rgba(100, 200, 255, 0.08);
}

/* Compact color swatch prepended to name cell to aid recognition without using extra column width */
.element-list-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.6);
  box-shadow: 0 0 4px rgba(0,0,0,0.45) inset;
}

/* Ensure the name text can truncate but remain readable next to swatch */
.element-list-name {
  display: inline-block;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: #dff6ff;
  flex: 1;
  min-width: 0;
}

/* Scrollable properties area */
.elements-list-rows {
  flex: 1;
  overflow-x: auto;
  overflow-y: auto;
  scrollbar-width: thin;
}

.elements-list-rows::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.elements-list-rows::-webkit-scrollbar-track {
  background: transparent;
}

.elements-list-rows::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 3px;
}

.elements-list-rows::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Sync horizontal scroll between header and properties */
.elements-list-rows.sync-scroll-x {
  /* Handled by JavaScript */
}

/* Slight zebra-striping for columns to aid horizontal parsing:
   apply a very subtle alternate background to every 2nd property column
   in both header and content rows. */
.elements-list-header .elements-list-sort-btn:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}
.elements-list-header .elements-list-sort-btn:nth-child(odd) {
  background: rgba(0, 0, 0, 0.12);
}

.elements-list-row > div:nth-child(even) {
  background: rgba(150, 150, 150, 0.1);
}
.elements-list-row > div:nth-child(odd) {
  background: rgba(0, 0, 0, 0.0);
}

.elements-list-row {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(74, 158, 255, 0.1);
  align-items: center;
  min-height: 24px;
  white-space: nowrap;
}

.elements-list-row > div {
  padding: 4px;
  border-right: 1px solid rgba(74, 158, 255, 0.1);
  font-size: 12px;
  color: #dff6ff;
  text-align: center;
  min-width: 20px;
  flex-shrink: 0;
}

/* Column widths to match header */
.elements-list-row > div:nth-child(1) {
  min-width: 30px; /* speed */
}

.elements-list-row > div:nth-child(2) {
  min-width: 25px; /* damage */
}

@media (max-width: 768px) {
  .elements-list-container {
    height: 250px;
  }

  .element-list-name {
    font-size: 10px;
  }

  .elements-list-row > div {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .elements-list-container {
    height: 200px;
  }

  .elements-list-header-corner {
    width: 60px;
    min-width: 60px; /* ensure earlier min-width doesn't override the mobile width */
    font-size: 9px;
  }

  .elements-list-names {
    width: 60px;
    min-width: 60px; /* keep the name column consistent with header corner on small screens */
  }

  .elements-list-row > div {
    padding: 3px;
    font-size: 10px;
  }

  .element-list-swatch {
    width: 10px;
    height: 10px;
  }

  .element-list-name {
    font-size: 9px;
  }
}