/**
 * Kanban View Styles
 */

/* Main kanban container */
#kanban-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* View controls */
.kanban-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: white;
  border-bottom: 1px solid #e3f2fd;
}

.kanban-controls label {
  font-weight: 600;
  margin-right: 0.5rem;
}

.kanban-controls select {
  padding: 0.5rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  background: white;
  cursor: pointer;
}

/* Columns container */
.kanban-columns {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 1rem;
  height: calc(100% - 80px);
  flex: 1;
}

/* Individual column */
.kanban-column {
  flex: 0 0 320px;
  min-width: 280px;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  background: #f8f9fa;
  border: 1px solid #e3f2fd;
  border-radius: 8px;
  height: 100%;
  max-height: 100%;
  overflow: visible; /* Allow dropdowns to extend beyond column */
  transition: flex-basis 0.3s ease;
}

/* Collapsed column state */
.kanban-column.collapsed {
  flex: 0 0 60px;
}

.kanban-column.collapsed .kanban-cards,
.kanban-column.collapsed .kanban-add-card {
  display: none;
}

.kanban-column.collapsed .kanban-column-header {
  border-radius: 8px;
  border-bottom: none;
}

/* Column header */
.kanban-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 2px solid #007bff;
  background: linear-gradient(135deg, #e3f2fd 0%, #f8f9fa 100%);
  border-radius: 8px 8px 0 0;
  position: sticky;
  top: 0;
  z-index: 10;
  gap: 0.5rem;
}

/* Collapse button */
.kanban-collapse-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  font-size: 0.9rem;
  color: #6c757d;
  transition: all 0.2s ease;
  line-height: 1;
}

.kanban-collapse-btn:hover {
  color: #007bff;
  transform: scale(1.1);
}

.kanban-column-title {
  font-weight: 600;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.kanban-column-count {
  background: #007bff;
  color: white;
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 24px;
  text-align: center;
}

/* Cards container */
.kanban-cards {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 100px;
}

.kanban-cards::-webkit-scrollbar {
  width: 8px;
}

.kanban-cards::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.kanban-cards::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.kanban-cards::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Drag over state */
.kanban-cards.drag-over {
  background: #e7f3ff;
  border: 2px dashed #007bff;
  border-radius: 4px;
}

/* Kanban card */
.kanban-card {
  background: white;
  border: 1px solid #e3f2fd;
  border-radius: 6px;
  padding: 0.75rem;
  cursor: move;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 123, 255, 0.1);
  max-width: 100%;
  overflow: hidden;
}

.kanban-card:hover {
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
  transform: translateY(-2px);
  border-color: #007bff;
}

.kanban-card.dragging {
  opacity: 0.5;
  transform: rotate(3deg);
  cursor: grabbing;
}

/* Compact card header row */
.card-header-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

/* Priority dot indicator (replaces badge) */
.priority-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
}

.priority-dot.priority-urgent {
  background: #dc3545;
}

.priority-dot.priority-high {
  background: #fd7e14;
}

.priority-dot.priority-medium {
  background: #ffc107;
}

.priority-dot.priority-low {
  background: #28a745;
}

/* Title container with enhancement icon */
.card-title-container {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0; /* Allow text truncation */
}

/* Enhancement icon (inline) */
.enhancement-icon {
  color: #ffc107;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.enhancement-icon:hover {
  color: #ffb300;
  transform: scale(1.1);
}

/* Compact type badge */
.card-type-badge {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: #6c757d;
  color: white;
  flex-shrink: 0;
}

/* Legacy badge support (can be removed later) */
.card-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Type badge always on the right */
.type-badge {
  margin-left: auto;
}

/* Card actions menu (three dots) */
.card-actions-menu {
  margin-left: 0.5rem;
}

.card-menu-btn {
  padding: 0.2rem 0.4rem;
  color: #6c757d;
  text-decoration: none;
  line-height: 1;
}

.card-menu-btn:hover {
  color: #007bff;
}

.card-menu-btn:focus {
  box-shadow: none;
}

.card-menu-btn i {
  font-size: 1rem;
}

/* Priority badges */
.priority-urgent {
  background: #dc3545;
  color: white;
}

.priority-high {
  background: #fd7e14;
  color: white;
}

.priority-medium {
  background: #ffc107;
  color: #000;
}

.priority-low {
  background: #28a745;
  color: white;
}

/* Type badge */
.type-badge {
  background: #6c757d;
  color: white;
}

/* Enhancement badge */
.enhancement-badge {
  background: #ffc107;
  color: #000;
  transition: all 0.2s ease;
}

.enhancement-badge:hover {
  background: #ffb300;
  transform: scale(1.05);
}

/* Card title (now inside title-container) */
.card-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: #212529;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
  /* Allow wrapping to 2 lines, then truncate */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  word-break: break-word;
}

/* Card description */
.card-description {
  color: #6c757d;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  line-height: 1.4;
  word-wrap: break-word;
}

/* Compact footer row */
.card-footer-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  font-size: 0.7rem;
  color: #6c757d;
  padding-top: 0.5rem;
  border-top: 1px solid #e9ecef;
  margin-top: auto;
}

.footer-item {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  white-space: nowrap;
}

.footer-item i {
  font-size: 0.75rem;
  flex-shrink: 0;
}

.footer-item.overdue {
  color: #dc3545;
  font-weight: 600;
}

.footer-separator {
  color: #dee2e6;
  font-weight: bold;
  padding: 0 0.2rem;
}

/* Metadata badges container */
.metadata-badges {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.metadata-more {
  font-size: 0.65rem;
  color: #6c757d;
  background: #f8f9fa;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  margin-left: 0.2rem;
}

/* Legacy metadata styles (keep for compatibility) */
.card-metadata {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: #6c757d;
  margin-bottom: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #e9ecef;
}

.card-metadata-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.card-metadata-item.overdue {
  color: #dc3545;
  font-weight: 600;
}

/* Card actions */
.card-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #e9ecef;
}

.card-action-btn {
  flex: 1;
  padding: 0.4rem 0.75rem;
  border: 1px solid #dee2e6;
  background: white;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.card-action-btn:hover {
  background: #007bff;
  color: white;
  border-color: #007bff;
}

/* Add card button */
.kanban-add-card {
  margin: 0.5rem 1rem 1rem;
  padding: 0.75rem;
  border: 2px dashed #bbdefb;
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  color: #007bff;
  transition: all 0.2s ease;
}

.kanban-add-card:hover {
  background: #e3f2fd;
  border-color: #007bff;
  color: #0056b3;
}

/* View switcher buttons */
.view-switcher {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  background: white;
  border-bottom: 1px solid #e3f2fd;
}

.view-btn {
  padding: 0.5rem 1rem;
  border: 1px solid #bbdefb;
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  color: #007bff;
  transition: all 0.2s ease;
}

.view-btn:hover {
  background: #e3f2fd;
  border-color: #007bff;
}

.view-btn.active {
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  color: white;
  border-color: #0056b3;
}

/* Empty state */
.kanban-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: #6c757d;
  text-align: center;
}

.kanban-empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.kanban-empty-text {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.kanban-empty-subtext {
  font-size: 0.9rem;
  opacity: 0.7;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  /* Make columns nearly full width for easy viewing on mobile */
  .kanban-column {
    flex: 0 0 calc(100vw - 32px); /* Full width minus padding */
    min-width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
  }

  /* Collapsed columns should be smaller */
  .kanban-column.collapsed {
    flex: 0 0 50px;
    min-width: 50px;
  }

  .kanban-columns {
    padding: 8px;
    gap: 12px;
    /* Enable snap scrolling for smooth column navigation */
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  /* Each column snaps into place */
  .kanban-column {
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  /* More compact column header on mobile */
  .kanban-column-header {
    padding: 12px;
  }

  .kanban-column-title {
    font-size: 1rem;
  }

  /* Allow card titles to wrap to 2 lines instead of truncating */
  .card-title {
    font-size: 0.875rem;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .card-description {
    font-size: 0.8rem;
  }

  /* More compact cards on mobile */
  .kanban-card {
    padding: 10px;
  }

  .kanban-cards {
    padding: 8px;
    gap: 8px;
  }

  /* Add card button more compact */
  .kanban-add-card {
    margin: 8px;
    padding: 10px;
    font-size: 0.875rem;
  }

  /* Scroll indicator hint */
  .kanban-columns::after {
    content: '';
    flex: 0 0 8px; /* Small spacer at end for scroll padding */
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  .kanban-column {
    flex: 0 0 calc(100vw - 24px);
    min-width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
  }

  .kanban-columns {
    padding: 6px;
  }

  .kanban-column-header {
    padding: 10px;
  }

  .kanban-column-title {
    font-size: 0.9375rem;
  }

  .kanban-column-count {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
  }
}

/* Loading state */
.kanban-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: #6c757d;
  font-size: 1.1rem;
}

.kanban-loading::after {
  content: '...';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}
