@use '../../styles/panel-shared' as panel;

:host {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.file-mover-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.panel-header {
  @include panel.panel-header;
  flex-shrink: 0;
}

.dialog-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-height: 0;
  padding: 1.25rem;
  gap: 1.25rem;
  background: var(--card-background);
  border: 1px solid var(--border-color);
  border-top: none;
  border-bottom: none;

  &::-webkit-scrollbar {
    width: 6px;
  }

  &::-webkit-scrollbar-track {
    background: transparent;
  }

  &::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;

    &:hover {
      background: var(--primary-color);
    }
  }
}

.dialog-footer {
  @include panel.dialog-footer;
  justify-content: space-between;
}

// Compact Info Banner
.info-banner {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.banner-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
}

.banner-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--primary-color);
  border-radius: 6px;
  flex-shrink: 0;

  i {
    font-size: 1rem;
    color: var(--primary-contrast-color);
  }
}

.banner-content {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem 1rem;
  min-width: 0;
}

.banner-text {
  font-size: 0.875rem;
  color: var(--text-secondary-color);
  line-height: 1.4;

  strong {
    color: var(--text-color);
  }
}

.banner-warning {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--p-orange-400);

  i {
    font-size: 0.8rem;
  }
}

.banner-toggle {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.4rem 0.75rem;
  background: transparent;
  border: 1px solid var(--p-blue-400);
  border-radius: 5px;
  color: var(--p-blue-400);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;

  &:hover {
    background: var(--p-blue-400);
    color: white;
  }

  i {
    font-size: 0.7rem;
  }
}

.banner-details {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 0.875rem 1rem;
  border-top: 1px solid var(--border-color);
}

.detail-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--text-secondary-color);

  i {
    font-size: 0.85rem;
    margin-top: 0.125rem;
    color: var(--p-green-400);
    flex-shrink: 0;
  }

  strong {
    color: var(--text-color);
  }

  &.warning {
    color: var(--p-yellow-300);

    i {
      color: var(--p-yellow-400);
    }
  }

  &.danger {
    color: var(--p-red-300);

    i {
      color: var(--p-red-400);
    }
  }
}

// Patterns Section
.patterns-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.patterns-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: fit-content;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;

  &:hover {
    border-color: var(--primary-color);
  }

  .toggle-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-color);

    i {
      color: var(--primary-color);
    }
  }

  .patterns-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 0.375rem;
    background: var(--primary-color);
    color: var(--primary-contrast-color);
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
  }

  > i {
    font-size: 0.75rem;
    color: var(--text-secondary-color);
  }
}

.patterns-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pattern-card {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.pattern-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pattern-library {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-color);
}

.pattern-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  background: var(--p-blue-500);
  color: white;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 600;
}

.pattern-code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  color: var(--primary-color);
  background: var(--ground-background);
  padding: 0.375rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.pattern-source {
  font-size: 0.7rem;
  color: var(--text-secondary-color);
}

// Bulk Section
.bulk-section {
  background: var(--ground-background);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
}

.bulk-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-color);

  i {
    color: var(--primary-color);
  }
}

.bulk-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.bulk-label {
  font-size: 0.8rem;
  color: var(--text-secondary-color);
}

// Table Section
.table-section {
  background: var(--ground-background);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.table-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--overlay-background);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-color);

  i {
    color: var(--primary-color);
  }
}

.table-container {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;

  ::ng-deep .p-datatable {
    height: 100%;
    display: flex;
    flex-direction: column;

    .p-datatable-table-container {
      flex: 1 1 0;
      min-height: 0;
    }
  }
}

:host ::ng-deep {
  .p-datatable-tbody > tr > td {
    padding: 0.5rem 0.75rem !important;
  }

  .p-datatable-thead > tr > th:first-child,
  .p-datatable-tbody > tr > td.status-cell {
    padding-left: 1.5rem !important;
  }
}

.id-cell {
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--text-secondary-color);
}

.path-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
}

.path-library {
  color: var(--text-secondary-color);
}

.path-value {
  color: var(--text-color);
}

.no-paths {
  font-size: 0.75rem;
  color: var(--p-red-400);
  font-style: italic;
}

.arrow-cell {
  text-align: center;

  i {
    font-size: 0.75rem;
    color: var(--primary-color);
  }
}

.status-cell {
  text-align: center;
}

.status-success {
  color: var(--p-green-500);
  font-size: 1rem;
}

.status-pending {
  color: var(--p-orange-400);
  font-size: 1rem;
}

.row-moved {
  background: rgba(34, 197, 94, 0.05) !important;
}

// Footer
.success-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--p-green-500);
  font-weight: 600;
  font-size: 0.9rem;

  i {
    font-size: 1.125rem;
    animation: pulse 2s infinite;
  }
}

.footer-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

// Select widths
:host ::ng-deep {
  .select-library {
    min-width: 180px;
  }

  .select-path {
    min-width: 220px;
  }

  .select-full-width {
    width: 100%;
  }
}

// Responsive
@media (max-width: 768px) {
  .dialog-content {
    padding: 1rem;
    gap: 1rem;
  }

  .banner-main {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .banner-content {
    flex: 1 1 100%;
    order: 1;
  }

  .banner-icon {
    order: 0;
  }

  .banner-toggle {
    order: 2;
    margin-left: auto;
  }

  .bulk-controls {
    flex-direction: column;
    align-items: flex-start;
  }

  .dialog-footer {
    flex-direction: column;
    gap: 0.75rem;

    .footer-actions {
      width: 100%;
      justify-content: flex-end;
    }
  }
}
