/**
 * TASKMATE - List View Styles
 * ===========================
 * Styles fuer die Listenansicht
 */

/* List View Container */
.view-list {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.view-list.active {
  display: flex !important;
}

/* List Header */
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-3) var(--spacing-4);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.list-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-4);
  width: 100%;
}

/* View Toggle */
.list-view-toggle {
  display: flex;
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  padding: 2px;
}

.list-toggle-btn {
  display: flex;
  align-items: center;
  gap: var(--spacing-1);
  padding: var(--spacing-1) var(--spacing-3);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.list-toggle-btn svg {
  width: 16px;
  height: 16px;
}

.list-toggle-btn:hover {
  color: var(--text-primary);
}

.list-toggle-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* Sort Controls */
.list-sort {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  margin-left: auto;
}

.list-sort label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.list-sort select {
  padding: var(--spacing-1) var(--spacing-3);
  padding-right: 2rem;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.list-sort select:focus {
  border-color: var(--primary);
  outline: none;
}

#list-sort-direction {
  padding: var(--spacing-1);
}

#list-sort-direction svg {
  width: 18px;
  height: 18px;
  transition: transform var(--transition-fast);
}

#list-sort-direction.asc svg {
  transform: rotate(180deg);
}

/* List Content */
.list-content {
  flex: 1;
  overflow: auto;
  padding: var(--spacing-4);
}

/* List Table */
.list-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.list-table-header {
  display: grid;
  grid-template-columns: 1fr 120px 100px 110px 140px;
  gap: var(--spacing-2);
  padding: var(--spacing-3) var(--spacing-4);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-default);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.list-table-header span {
  display: flex;
  align-items: center;
  gap: var(--spacing-1);
  cursor: pointer;
  user-select: none;
}

.list-table-header span:hover {
  color: var(--text-primary);
}

.list-table-header span.sorted {
  color: var(--primary);
}

.list-table-header span svg {
  width: 14px;
  height: 14px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.list-table-header span.sorted svg {
  opacity: 1;
}

.list-table-header span.sorted.desc svg {
  transform: rotate(180deg);
}

/* List Group */
.list-group {
  margin-bottom: var(--spacing-4);
}

.list-group:last-child {
  margin-bottom: 0;
}

.list-group-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  padding: var(--spacing-2) var(--spacing-3);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
  margin-bottom: var(--spacing-2);
}

.list-group-header:hover {
  background: var(--bg-hover);
}

.list-group-header svg {
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  transition: transform var(--transition-fast);
}

.list-group-header.collapsed svg {
  transform: rotate(-90deg);
}

.list-group-title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.list-group-color {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-sm);
}

.list-group-count {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-left: auto;
}

.list-group-content {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.list-group-content.collapsed {
  display: none;
}

/* List Row */
.list-row {
  display: grid;
  grid-template-columns: 1fr 120px 100px 110px 140px;
  gap: var(--spacing-2);
  padding: var(--spacing-3) var(--spacing-4);
  border-bottom: 1px solid var(--border-light);
  align-items: center;
  transition: background var(--transition-fast);
}

.list-row:last-child {
  border-bottom: none;
}

.list-row:hover {
  background: var(--bg-hover);
}

/* List Cells */
.list-cell {
  font-size: var(--text-sm);
  color: var(--text-primary);
  min-width: 0;
}

.list-cell-title {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  font-weight: var(--font-medium);
  cursor: pointer;
}

.list-cell-title:hover {
  color: var(--primary);
}

.list-cell-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Editable Cells */
.list-cell-editable {
  position: relative;
  cursor: pointer;
  padding: var(--spacing-1) var(--spacing-2);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.list-cell-editable:hover {
  background: var(--bg-tertiary);
}

.list-cell-editable.editing {
  background: var(--bg-input);
}

/* Status Cell */
.list-cell-status {
  display: flex;
  align-items: center;
  gap: var(--spacing-1);
}

.list-cell-status .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.list-cell-status select {
  flex: 1;
  padding: var(--spacing-1);
  background: transparent;
  border: none;
  color: inherit;
  font-size: inherit;
  cursor: pointer;
}

.list-cell-status select:focus {
  outline: none;
}

/* Priority Cell */
.list-cell-priority {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
}

.list-cell-priority.high {
  background: var(--error-bg);
  color: var(--error);
}

.list-cell-priority.medium {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.list-cell-priority.low {
  background: var(--success-bg);
  color: var(--success-text);
}

.list-cell-priority select {
  background: transparent;
  border: none;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  cursor: pointer;
  padding: 0;
  appearance: none;
}

.list-cell-priority select:focus {
  outline: none;
}

/* Date Cell */
.list-cell-date {
  color: var(--text-secondary);
}

.list-cell-date.overdue {
  color: var(--error);
  font-weight: var(--font-medium);
}

.list-cell-date.today {
  color: var(--warning-text);
  font-weight: var(--font-medium);
}

.list-cell-date input[type="date"] {
  width: 100%;
  padding: var(--spacing-1);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: inherit;
  font-size: inherit;
  cursor: pointer;
}

.list-cell-date input[type="date"]:focus {
  border-color: var(--primary);
  background: var(--bg-input);
  outline: none;
}

/* Assignee Cell */
.list-cell-assignee {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
}

/* Avatar Container für mehrere Avatare */
.list-cell-assignee .avatar-container {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.list-cell-assignee .avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: var(--font-semibold);
  color: white;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.2s;
}

.list-cell-assignee .avatar:hover {
  transform: scale(1.1);
}

.list-cell-assignee select {
  flex: 1;
  background: transparent;
  border: none;
  color: inherit;
  font-size: inherit;
  cursor: pointer;
  min-width: 0;
}

.list-cell-assignee select:focus {
  outline: none;
}

/* Hide assignee dropdown - show only avatars */
.list-cell-assignee .assignee-select {
  display: none;
}

/* Empty avatar placeholder */
.list-cell-assignee .avatar-empty {
  background: var(--border-color) !important;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}

/* Show dropdown when editing */
.list-cell-assignee.editing .assignee-select {
  display: block;
  flex: 1;
}

.list-cell-assignee.editing .avatar-container {
  display: none;
}

/* Empty State */
.list-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-8);
  text-align: center;
  color: var(--text-muted);
}

.list-empty svg {
  width: 64px;
  height: 64px;
  margin-bottom: var(--spacing-4);
  opacity: 0.5;
}

.list-empty h3 {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  margin-bottom: var(--spacing-2);
}

.list-empty p {
  font-size: var(--text-sm);
}

/* Inline Edit Input */
.list-inline-input {
  width: 100%;
  padding: var(--spacing-1) var(--spacing-2);
  background: var(--bg-input);
  border: 1px solid var(--primary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
}

.list-inline-input:focus {
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* Responsive */
@media (max-width: 1024px) {
  .list-table-header,
  .list-row {
    grid-template-columns: 1fr 100px 80px 100px 120px;
  }
}

@media (max-width: 768px) {
  .list-header {
    flex-direction: column;
    gap: var(--spacing-3);
  }

  .list-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .list-view-toggle {
    justify-content: center;
  }

  .list-sort {
    margin-left: 0;
    justify-content: center;
  }

  .list-table-header,
  .list-row {
    grid-template-columns: 1fr 80px 70px;
  }

  .list-table-header span:nth-child(4),
  .list-table-header span:nth-child(5),
  .list-row .list-cell:nth-child(4),
  .list-row .list-cell:nth-child(5) {
    display: none;
  }
}
