/* Dual List Box Component with Picture Support */

.dual-list-box {
  display: flex;
  gap: 16px;
  align-items: stretch;
  flex-wrap: wrap;
  width: 100%;
  max-width: 900px;
}

.dual-list-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.dual-list-header {
  padding: 12px 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  font-weight: 600;
  font-size: 0.95rem;
  color: #495057;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dual-list-count {
  font-size: 0.85rem;
  font-weight: 500;
  color: #6c757d;
  background: #e9ecef;
  padding: 2px 8px;
  border-radius: 12px;
}

.dual-list-search {
  padding: 8px 12px;
  border-bottom: 1px solid #dee2e6;
  background: #fff;
}

.dual-list-search input {
  width: 100%;
  padding: 6px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 0.9rem;
}

.dual-list-search input:focus {
  outline: none;
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.dual-list-container {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  min-height: 300px;
  max-height: 500px;
}

.dual-list-container::-webkit-scrollbar {
  width: 8px;
}

.dual-list-container::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.dual-list-container::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.dual-list-container::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.dual-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin-bottom: 6px;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.dual-list-item:hover {
  background: #f8f9fa;
  border-color: #80bdff;
  transform: translateX(2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dual-list-item.selected {
  background: #e7f3ff;
  border-color: #007bff;
}

.dual-list-item.hidden {
  display: none;
}

.dual-list-item-image {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
  background-color: #f0f0f0;
}

.dual-list-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dual-list-item-name {
  font-weight: 500;
  font-size: 0.95rem;
  color: #212529;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dual-list-item-details {
  font-size: 0.8rem;
  color: #6c757d;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dual-list-item-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  background: #e9ecef;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #495057;
}

/* Control buttons between panels */
.dual-list-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: center;
  padding: 16px 0;
}

.dual-list-btn {
  padding: 8px 16px;
  border: 1px solid #007bff;
  background: #007bff;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.dual-list-btn:hover:not(:disabled) {
  background: #0056b3;
  border-color: #0056b3;
  box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.dual-list-btn:disabled {
  background: #6c757d;
  border-color: #6c757d;
  cursor: not-allowed;
  opacity: 0.6;
}

.dual-list-btn-secondary {
  background: #6c757d;
  border-color: #6c757d;
}

.dual-list-btn-secondary:hover:not(:disabled) {
  background: #545b62;
  border-color: #545b62;
}

/* Empty state */
.dual-list-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: #6c757d;
  font-size: 0.9rem;
  text-align: center;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .dual-list-box {
    flex-direction: column;
    gap: 12px;
  }

  .dual-list-controls {
    flex-direction: row;
    justify-content: center;
    padding: 8px 0;
    gap: 6px;
    flex-wrap: wrap;
  }

  .dual-list-panel {
    min-width: 100%;
    width: 100%;
  }

  .dual-list-container {
    max-height: 250px;
    min-height: 200px;
  }

  .dual-list-item {
    padding: 8px;
    gap: 8px;
  }

  .dual-list-item-image {
    width: 40px;
    height: 40px;
  }

  .dual-list-item-name {
    font-size: 0.9rem;
  }

  .dual-list-item-details {
    font-size: 0.75rem;
  }

  .dual-list-btn {
    padding: 6px 12px;
    font-size: 0.85rem;
  }
}

/* Extra small screens (iPhone SE, etc.) */
@media (max-width: 375px) {
  .dual-list-box {
    gap: 8px;
  }

  .dual-list-header {
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  .dual-list-count {
    font-size: 0.75rem;
    padding: 1px 6px;
  }

  .dual-list-search {
    padding: 6px 8px;
  }

  .dual-list-search input {
    padding: 4px 8px;
    font-size: 0.85rem;
  }

  .dual-list-container {
    padding: 6px;
    max-height: 200px;
    min-height: 150px;
  }

  .dual-list-item {
    padding: 6px;
    gap: 6px;
    margin-bottom: 4px;
  }

  .dual-list-item-image {
    width: 36px;
    height: 36px;
  }

  .dual-list-item-name {
    font-size: 0.85rem;
  }

  .dual-list-item-details {
    font-size: 0.7rem;
    gap: 4px;
  }

  .dual-list-item-badge {
    padding: 1px 4px;
    font-size: 0.7rem;
  }

  .dual-list-controls {
    gap: 4px;
  }

  .dual-list-btn {
    padding: 5px 10px;
    font-size: 0.8rem;
  }

  .dual-list-btn span {
    display: inline-block;
  }
}

/* Hide the original select element */
.dual-list-box + select[multiple] {
  display: none;
}
