@import "/./src/assets/scss/variables.scss";
@import "/./src/assets/scss/mixins.scss";
@import "/./src/assets/scss/breakpoints.scss";

.mobile-kanban-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #f8fafc;
  overflow: hidden;
}

// ===========================
// HEADER SECTION
// ===========================

.kanban-header {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  z-index: 10;
  
  &.compact {
    padding: 0.5rem;
  }
  
  @include respond-below('sm') {
    padding: 0.75rem;
  }
}

.search-container {
  margin-bottom: 1rem;
  
  .search-field {
    width: 100%;
    
    .mat-form-field-wrapper {
      padding-bottom: 0;
    }
    
    .mat-form-field-infix {
      padding: 0.5rem 0;
    }
    
    input {
      font-size: 16px; // Évite le zoom sur iOS
    }
  }
}

.filters-container {
  .filter-chips {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    
    .mat-chip-list {
      display: flex;
      gap: 0.5rem;
    }
    
    .filter-chip {
      background: #f1f5f9;
      color: #64748b;
      border: 1px solid #e2e8f0;
      transition: all 0.2s ease;
      
      &.mat-chip-selected {
        background: #3b82f6;
        color: white;
        border-color: #3b82f6;
      }
    }
    
    .clear-filters-btn {
      flex-shrink: 0;
      color: #64748b;
    }
  }
}

// ===========================
// LOADING STATE
// ===========================

.loading-container {
  padding: 2rem;
  text-align: center;
  
  .loading-text {
    margin-top: 1rem;
    color: #64748b;
    font-size: 0.875rem;
  }
}

// ===========================
// KANBAN BOARD
// ===========================

.kanban-board {
  flex: 1;
  overflow: hidden;
  padding: 1rem;
  
  @include respond-below('sm') {
    padding: 0.5rem;
  }
}

.kanban-columns-container {
  display: flex;
  gap: 1rem;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 1rem;
  
  // Smooth scrolling sur mobile
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  
  @include respond-below('sm') {
    gap: 0.75rem;
  }
}

// ===========================
// COLONNES KANBAN
// ===========================

.kanban-column {
  flex: 0 0 300px;
  min-width: 300px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease;
  
  @include respond-below('sm') {
    flex: 0 0 280px;
    min-width: 280px;
  }
  
  @include respond-below('xs') {
    flex: 0 0 260px;
    min-width: 260px;
  }
  
  &.selected {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
  }
  
  &:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  }
}

.column-header {
  padding: 1rem;
  background: var(--column-color, #6b7280);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
  
  &:hover {
    background: color-mix(in srgb, var(--column-color, #6b7280) 90%, black);
  }
  
  .column-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    
    .column-icon {
      font-size: 1.25rem;
      width: 1.25rem;
      height: 1.25rem;
    }
    
    .column-name {
      font-weight: 600;
      font-size: 0.875rem;
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }
  }
  
  .column-count {
    .count-badge {
      background: rgba(255, 255, 255, 0.2);
      padding: 0.25rem 0.5rem;
      border-radius: 12px;
      font-size: 0.75rem;
      font-weight: 600;
    }
  }
}

.column-items {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  
  // Smooth scrolling
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  
  @include respond-below('sm') {
    padding: 0.75rem;
    gap: 0.5rem;
  }
}

.empty-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: #94a3b8;
  text-align: center;
  
  .empty-icon {
    font-size: 3rem;
    width: 3rem;
    height: 3rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
  }
  
  .empty-text {
    font-size: 0.875rem;
    opacity: 0.8;
  }
}

// ===========================
// ITEMS KANBAN
// ===========================

.kanban-item {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  
  &:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
  }
  
  &.priority-high {
    border-left: 4px solid #ef4444;
  }
  
  &.priority-medium {
    border-left: 4px solid #f59e0b;
  }
  
  &.priority-low {
    border-left: 4px solid #10b981;
  }
  
  // État de drag
  &.cdk-drag-animating {
    transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
  }
  
  &.cdk-drag-placeholder {
    opacity: 0.5;
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
  }
}

.drag-handle {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  color: #94a3b8;
  cursor: grab;
  
  &:active {
    cursor: grabbing;
  }
  
  .mat-icon {
    font-size: 1rem;
    width: 1rem;
    height: 1rem;
  }
}

.item-content {
  padding-right: 1.5rem; // Espace pour le drag handle
}

.item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  
  .item-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: #1e293b;
    line-height: 1.4;
    flex: 1;
  }
  
  .item-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    
    .priority-icon,
    .status-icon {
      font-size: 1rem;
      width: 1rem;
      height: 1rem;
    }
  }
}

.item-subtitle {
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.item-description {
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 0.75rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.item-tags {
  margin-bottom: 0.75rem;
  
  .mat-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
  }
  
  .item-tag {
    background: #f1f5f9;
    color: #475569;
    font-size: 0.625rem;
    padding: 0.125rem 0.5rem;
    height: auto;
    line-height: 1.2;
    border-radius: 12px;
    
    &.more-tags {
      background: #e2e8f0;
      color: #64748b;
    }
  }
}

.item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  
  .item-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    
    .assignee,
    .due-date {
      display: flex;
      align-items: center;
      gap: 0.25rem;
      font-size: 0.625rem;
      color: #64748b;
      
      .mat-icon {
        font-size: 0.75rem;
        width: 0.75rem;
        height: 0.75rem;
      }
    }
  }
  
  .item-actions {
    .item-action-btn {
      width: 24px;
      height: 24px;
      line-height: 24px;
      
      .mat-icon {
        font-size: 1rem;
        width: 1rem;
        height: 1rem;
      }
    }
  }
}

// ===========================
// DRAG PREVIEW
// ===========================

.drag-preview {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  transform: rotate(3deg);
  
  .preview-content {
    .preview-title {
      font-weight: 600;
      font-size: 0.875rem;
      color: #1e293b;
      margin-bottom: 0.25rem;
    }
    
    .preview-subtitle {
      font-size: 0.75rem;
      color: #64748b;
    }
  }
}

// ===========================
// EMPTY STATE
// ===========================

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 2rem;
  
  .empty-state-content {
    text-align: center;
    max-width: 400px;
    
    .empty-state-icon {
      font-size: 4rem;
      width: 4rem;
      height: 4rem;
      color: #cbd5e1;
      margin-bottom: 1rem;
    }
    
    .empty-state-title {
      font-size: 1.25rem;
      font-weight: 600;
      color: #374151;
      margin-bottom: 0.5rem;
    }
    
    .empty-state-description {
      color: #6b7280;
      font-size: 0.875rem;
      line-height: 1.5;
      margin: 0;
    }
  }
}

// ===========================
// ANIMATIONS
// ===========================

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.kanban-item {
  animation: slideIn 0.3s ease-out;
}

.kanban-column {
  animation: fadeIn 0.5s ease-out;
}

// ===========================
// CDK DRAG DROP CUSTOMIZATION
// ===========================

.cdk-drop-list {
  min-height: 100px;
}

.cdk-drag-preview {
  box-sizing: border-box;
  border-radius: 8px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.cdk-drag-animating {
  transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
}

.cdk-drop-list.cdk-drop-list-receiving .cdk-drag-placeholder {
  background: #e0f2fe;
  border: 2px dashed #0284c7;
}

// ===========================
// RESPONSIVE ADJUSTMENTS
// ===========================

@include respond-below('sm') {
  .mobile-kanban-container {
    .kanban-header {
      .search-container {
        margin-bottom: 0.75rem;
      }
    }
    
    .kanban-item {
      padding: 0.75rem;
      
      .item-header {
        .item-title {
          font-size: 0.8125rem;
        }
      }
      
      .item-subtitle,
      .item-description {
        font-size: 0.6875rem;
      }
    }
  }
}

// ===========================
// TOUCH IMPROVEMENTS
// ===========================

@media (hover: none) and (pointer: coarse) {
  .kanban-item {
    &:active {
      background: #f8fafc;
      transform: scale(0.98);
    }
  }
  
  .column-header {
    &:active {
      background: color-mix(in srgb, var(--column-color, #6b7280) 85%, black);
    }
  }
  
  .item-action-btn {
    &:active {
      background: rgba(0, 0, 0, 0.1);
    }
  }
} 