/* 
 * pipeline.css
 * Modern pipeline-based UI styling for Data Integration Platform
 * Consolidated from pipeline.css and pipeline-ui.css
 */

/*
 * Token Source: themes.css
 * All design tokens are consolidated in themes.css.
 * Pipeline-specific aliases below for backwards compatibility.
 */
:root {
  /* Legacy color aliases - use themes.css semantic tokens */
  --brand-primary: var(--primary);
  --brand-primary-dark: var(--primary-hover);
  --brand-primary-light: var(--primary-light);

  /* Pipeline spacing - maps to themes.css --spacing-* */
  --space-xs: var(--spacing-1);
  --space-sm: var(--spacing-2);
  --space-md: var(--spacing-3);
  --space-lg: var(--spacing-4);
  --space-xl: var(--spacing-5);
  --space-xxl: var(--spacing-6);

  /* Pipeline radius - maps to themes.css --border-radius-* */
  --radius-sm: var(--border-radius-sm);
  --radius-md: var(--border-radius);
  --radius-lg: var(--border-radius-lg);
  --radius-xl: 0.75rem;

  /* Pipeline shadows - now defined in themes.css, no redefinition needed */
}

/* Pipeline Container */
.pipeline-container {
  padding: var(--space-lg);
  background: var(--gray-100);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  min-height: 500px;
  position: relative;
  margin: var(--space-lg) 0;
}

/* Step Card Styles */
.step-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--space-md);
  padding: var(--space-lg);
  position: relative;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.step-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.step-card.active {
  border-color: var(--brand-primary);
  background-color: var(--brand-primary-light);
}

.step-card.disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.step-card.completed {
  border-left: 4px solid var(--success);
}

.step-card.error {
  border-left: 4px solid var(--danger);
}

.step-number {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  box-shadow: var(--shadow-sm);
}

.step-title {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: var(--space-sm);
  color: var(--gray-800);
}

.step-description {
  color: var(--gray-700);
  font-size: 0.9rem;
  margin-bottom: var(--space-md);
}

.step-status {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
}

.step-status .status-icon {
  margin-right: var(--space-xs);
}

.step-status.completed {
  color: var(--success);
}

.step-status.error {
  color: var(--danger);
}

.step-status.pending {
  color: var(--warning);
}

/* Connection Lines */
.connection-line {
  position: absolute;
  height: 100%;
  width: 2px;
  background-color: var(--gray-400);
  left: 5px;
  top: 0;
  z-index: 0;
}

.connection-line.active {
  background-color: var(--brand-primary);
}

.connection-line.completed {
  background-color: var(--success);
}

/* App Integration Cards */
.app-integration-card {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-md);
  border: 1px solid var(--gray-300);
  transition: all 0.2s ease;
}

.app-integration-card:hover {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-md);
}

.app-icon {
  width: 40px;
  height: 40px;
  margin-right: var(--space-md);
  object-fit: contain;
}

.app-details {
  flex: 1;
}

.app-name {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: var(--space-xs);
}

.app-description {
  color: var(--gray-600);
  font-size: 0.875rem;
}

/* Pipeline Controls */
.pipeline-controls {
  display: flex;
  justify-content: space-between;
  margin: var(--space-lg) 0;
}

.pipeline-controls .btn {
  min-width: 100px;
  padding: var(--space-sm) var(--space-md);
}

/* Pipeline Progress */
.pipeline-progress {
  height: 8px;
  background-color: var(--gray-200);
  border-radius: var(--radius-lg);
  margin: var(--space-lg) 0;
  overflow: hidden;
}

.pipeline-progress-bar {
  height: 100%;
  background-color: var(--brand-primary);
  border-radius: var(--radius-lg);
  transition: width 0.3s ease;
}

/* Pipeline Summary */
.pipeline-summary {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-lg);
  margin-top: var(--space-lg);
}

.summary-header {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
  color: var(--gray-800);
}

.summary-item {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--gray-200);
  padding: var(--space-sm) 0;
}

.summary-item:last-child {
  border-bottom: none;
}

.summary-label {
  color: var(--gray-700);
}

.summary-value {
  font-weight: 500;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .pipeline-container {
    padding: var(--space-md);
  }
  
  .step-card {
    padding: var(--space-md);
  }
  
  .connection-line {
    left: 4px;
  }
}

/* Animation Effects */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

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

.slide-in {
  animation: slideIn 0.3s ease-in-out;
}

/* Dark Theme Adjustments */
.dark-theme .pipeline-container {
  background: #2b3035;
}

.dark-theme .step-card {
  background: #343a40;
  color: #e9ecef;
  border-color: #495057;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.dark-theme .step-card:hover {
  background-color: #3e444a;
  border-color: #4d94ff;
}

.dark-theme .step-card.active {
  background-color: rgba(77, 148, 255, 0.2);
  border-color: #4d94ff;
}

.dark-theme .app-integration-card {
  background: #343a40;
  border-color: #495057;
  color: #e9ecef;
}

.dark-theme .app-integration-card:hover {
  background-color: #3e444a;
  border-color: #4d94ff;
}

.dark-theme .pipeline-summary {
  background: #343a40;
  color: #e9ecef;
}

.dark-theme .summary-item {
  border-bottom-color: #495057;
}

.dark-theme .connection-line {
  stroke: rgba(255, 255, 255, 0.6);
}

.dark-theme .connection-line.active {
  stroke: #4d94ff;
}

.dark-theme .step-status.completed {
  color: #40c057;
}

.dark-theme .step-status.error {
  color: #ff6b6b;
}

.dark-theme .step-status.pending {
  color: #fcc419;
}

/* Configuration Panel */
.config-panel {
  background: var(--bg-card);
  border-radius: 8px;
  box-shadow: 0 2px 10px var(--shadow);
  height: 100%;
  min-height: 500px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.config-panel-header {
  padding: 16px 20px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.config-panel-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.config-panel-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.config-panel-content {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
}

/* Handle responsiveness for the pipeline layout */
.pipeline-container.has-config-panel {
  border-right: 1px solid var(--border-light);
  border-radius: 8px 0 0 8px;
}

@media (max-width: 991.98px) {
  .config-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 400px;
    z-index: 1050;
    border-radius: 0;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease;
  }
  
  .config-panel.d-none {
    display: block !important;
    transform: translateX(100%);
  }
  
  .config-panel:not(.d-none) {
    transform: translateX(0);
  }
  
  .config-panel-close {
    display: block !important;
  }
}

@media (min-width: 992px) {
  .config-panel-close {
    display: none;
  }
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 15px;
  color: var(--secondary);
}

/* Add Step Button */
.add-step-container {
  padding: 10px 0;
  display: flex;
  justify-content: center;
}

.add-step-btn {
  background-color: transparent;
  border: 2px dashed var(--secondary);
  border-radius: 8px;
  color: var(--text-muted);
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.add-step-btn:hover {
  background-color: var(--bg-hover);
  border-color: var(--text-muted);
  color: var(--text);
}

/* Pipeline Toggle Status */
.pipeline-toggle-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.pipeline-toggle-status.on {
  background-color: var(--success-bg);
  color: var(--success);
}

.pipeline-toggle-status.off {
  background-color: var(--danger-bg);
  color: var(--danger);
}

/* Step Options in Modal */
.step-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  max-height: 400px;
  overflow-y: auto;
}

.step-option {
  display: flex;
  align-items: center;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.step-option:hover {
  background-color: var(--bg-subtle);
  border-color: #adb5bd;
}

.step-option-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 15px;
  background-color: var(--border-light);
  border-radius: 6px;
  font-size: 20px;
}

.step-option-content h5 {
  margin: 0 0 5px 0;
  font-size: 16px;
}

.step-option-content p {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

/* Responsive adjustments */
@media (max-width: 992px) {
  .config-panel {
    margin-top: 20px;
    min-height: 400px;
  }
} 
/* Step Library Keyboard Focus */
.step-library-step.step-item-focused,
.step-type-card.step-item-focused {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  background: var(--bg-hover);
}

/* ======================================================
   Test Results
   ====================================================== */

.test-success {
  background: rgba(25, 135, 84, 0.08);
  border-radius: var(--border-radius, 0.375rem);
}

.test-failure {
  background: rgba(220, 53, 69, 0.08);
  border-radius: var(--border-radius, 0.375rem);
}

.test-output {
  font-family: monospace;
  font-size: 0.85rem;
  background: var(--bg-muted, #f8f9fa);
  padding: 0.75rem;
  border-radius: var(--border-radius, 0.375rem);
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.test-error {
  font-size: 0.9rem;
  color: var(--danger, #dc3545);
  background: var(--bg-muted, #f8f9fa);
  padding: 0.75rem;
  border-radius: var(--border-radius, 0.375rem);
  white-space: pre-wrap;
}

.test-running {
  color: var(--text-muted, #6c757d);
}

.dark-theme .test-success {
  background: rgba(25, 135, 84, 0.15);
}

.dark-theme .test-failure {
  background: rgba(220, 53, 69, 0.15);
}

.dark-theme .test-output,
.dark-theme .test-error {
  background: rgba(0, 0, 0, 0.2);
}

/* ======================================================
   Run History
   ====================================================== */

.run-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.run-history-header h6 {
  margin: 0;
  font-weight: 600;
}

.run-history-items {
  list-style: none;
  padding: 0;
  margin: 0;
}

.run-history-item {
  padding: 0.75rem;
  border: 1px solid var(--border-light, #dee2e6);
  border-radius: var(--border-radius, 0.375rem);
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.run-history-item:hover {
  background-color: var(--bg-hover, #f8f9fa);
}

.run-history-item-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.run-history-item-meta {
  display: flex;
  gap: 1rem;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--text-muted, #6c757d);
}

.run-duration {
  font-size: 0.8rem;
  color: var(--text-muted, #6c757d);
}

.dark-theme .run-history-item {
  border-color: #495057;
}

.dark-theme .run-history-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

/* ======================================================
   Reduced Motion
   ====================================================== */

@media (prefers-reduced-motion: reduce) {
  .step-card {
    transition: none;
  }

  .step-card:hover {
    transform: none;
  }

  .app-integration-card {
    transition: none;
  }

  .pipeline-progress-bar {
    transition: none;
  }

  .fade-in {
    animation: none;
  }

  .slide-in {
    animation: none;
  }

  .config-panel {
    transition: none;
  }

  .add-step-btn {
    transition: none;
  }

  .step-option {
    transition: none;
  }
}
