/* Processing Components - Progress & Results */

/* Process Controls */
.process-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: center;
  margin: 1.5rem 0;
}

.btn-danger-custom {
  background-color: #dc2626;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-weight: 500;
  color: white;
  transition: all 0.2s ease;
  min-height: 48px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-danger-custom:hover {
  background-color: #b91c1c;
  color: white;
  transform: translateY(-1px);
}

.btn-danger-custom:active {
  transform: translateY(0);
  background-color: #991b1b;
}

/* Progress Section */
.progress-section {
  min-height: 200px; /* Prevent layout shift */
}

/* Progress Container */
.progress-container {
  margin: 2rem 0;
  padding: 1.5rem;
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border-gray);
}

.progress-bar-container {
  width: 100%;
  height: 24px;
  background-color: var(--border-gray);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1rem;
  position: relative;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(135deg, var(--success-green), var(--dark-green));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  transition: width 0.3s ease;
  min-width: 0;
}

.progress-text {
  text-align: center;
  margin-bottom: 1rem;
}

.progress-text span {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--dark-blue);
}

/* Processing Status */
.processing-status {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.status-item {
  display: flex;
  flex-direction: column;
  text-align: center;
  padding: 1rem;
  background: var(--light-gray);
  border-radius: 8px;
  border: 1px solid var(--border-gray);
}

.status-label {
  font-size: 0.9rem;
  color: var(--dark-blue);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.status-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--black);
}

/* Processing Animation */
.processing-animation {
  text-align: center;
  padding: 2rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-gray);
  border-top: 4px solid var(--primary-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.processing-message {
  font-size: 1rem;
  color: var(--dark-blue);
  margin: 0;
  font-style: italic;
}

.progress-custom {
  height: 24px;
  border-radius: 12px;
  background-color: var(--border-gray);
  overflow: hidden;
  margin-bottom: 1rem;
  position: relative;
}

.progress-bar-custom {
  background-color: var(--success-green);
  border-radius: 12px;
  font-weight: 500;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.3s ease;
  height: 100%;
  min-width: 0;
}

.current-transaction {
  background: white;
  border: 1px solid var(--border-gray);
  border-radius: 8px;
  padding: 1rem;
  margin-top: 1rem;
  color: var(--black);
  font-style: italic;
  min-height: 60px; /* Prevent jumping */
  display: flex;
  align-items: center;
}

/* Control Buttons */
.btn-danger-custom {
  background-color: #dc2626;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-weight: 500;
  color: white;
  transition: all 0.2s ease;
  min-height: 48px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-danger-custom:hover {
  background-color: #b91c1c;
  color: white;
  transform: translateY(-1px);
}

/* Results Section */
.final-stats {
  background: linear-gradient(135deg, var(--light-green), #ecfdf5);
  border: 2px solid var(--success-green);
  border-radius: 12px;
  padding: 2rem;
  margin: 2rem 0;
  min-height: 300px; /* Prevent layout shift */
}

.final-stats h2 {
  color: var(--dark-green);
  font-weight: 700;
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stats-pre {
  background: white;
  border: 1px solid var(--success-green);
  border-radius: 8px;
  padding: 1.5rem;
  white-space: pre-wrap;
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--black);
  overflow-x: auto;
  min-height: 200px;
}

/* Download Section */
.download-section {
  text-align: center;
  padding: 2rem;
  min-height: 150px; /* Prevent layout shift */
}

.btn-download {
  background-color: var(--black);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 16px 32px;
  font-weight: 600;
  font-size: 1.1rem;
  transition: all 0.2s ease;
  min-height: 48px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-download:hover {
  background-color: #374151;
  color: white;
  transform: translateY(-2px);
}

/* Final Dashboard Cards */
.final-dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 2rem;
}

@media (min-width: 768px) {
  .final-dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1200px) {
  .final-dashboard-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.business-context-card::before {
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

.processing-summary-card::before {
  background: linear-gradient(90deg, #3b82f6, #2563eb);
}

.categories-card::before {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.merchants-card::before {
  background: linear-gradient(90deg, #8b5cf6, #7c3aed);
}

/* Status Messages */
#statusMessages {
  position: relative;
  z-index: 50;
  margin-bottom: 1rem;
}

/* Responsive Processing */
@media (max-width: 768px) {
  .final-stats {
    padding: 1.5rem;
    margin: 1rem 0;
    min-height: 250px;
  }

  .download-section {
    padding: 1.5rem;
    min-height: 120px;
  }

  .download-section .btn,
  .download-section .btn-link {
    display: block;
    width: 100%;
    margin: 0.5rem 0;
  }

  .btn-danger-custom,
  .btn-download {
    width: 100%;
    margin-bottom: 0.5rem;
    padding: 15px 20px;
    font-size: 1rem;
  }

  .stats-pre {
    font-size: 0.8rem;
    padding: 1rem;
    min-height: 150px;
  }

  .final-dashboard-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}