/**
 * Testing Tab Styles
 * Styles for the automated testing UI
 */

/* Container */
.test-tab-container {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bs-body-bg);
  overflow: hidden;
}

/* Header */
.test-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--bs-border-color);
  background: var(--bs-body-bg);
  flex-shrink: 0;
}

.test-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.test-title i {
  font-size: 1.5rem;
  color: var(--bs-primary);
}

.test-title h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.test-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* Alert Messages */
#testAlerts {
  margin: 1rem 1.5rem 0;
  flex-shrink: 0;
}

#testAlerts .alert {
  margin-bottom: 0;
}

/* Empty State */
.test-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
}

.test-empty-state .empty-icon {
  font-size: 4rem;
  color: var(--bs-secondary);
  margin-bottom: 1.5rem;
  opacity: 0.5;
}

.test-empty-state h4 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--bs-body-color);
}

.test-empty-state p {
  font-size: 1rem;
  color: var(--bs-secondary);
  margin-bottom: 2rem;
  max-width: 500px;
}

.test-empty-state .feature-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem 0;
  text-align: left;
  display: inline-block;
}

.test-empty-state .feature-list li {
  padding: 0.5rem 0;
  font-size: 0.95rem;
}

.test-empty-state .feature-list i {
  margin-right: 0.75rem;
}

/* Test Summary Cards */
.test-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  padding: 1.5rem;
  flex-shrink: 0;
}

.summary-card {
  background: var(--bs-card-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.5rem;
  padding: 1.5rem;
  display: flex;
  gap: 1rem;
  transition: all 0.3s ease;
}

.summary-card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.summary-card.success {
  background: rgba(25, 135, 84, 0.05);
  border-color: var(--bs-success);
}

.summary-card.failed {
  background: rgba(220, 53, 69, 0.05);
  border-color: var(--bs-danger);
}

.summary-card .card-icon {
  font-size: 2.5rem;
  color: var(--bs-primary);
  flex-shrink: 0;
}

.summary-card.success .card-icon {
  color: var(--bs-success);
}

.summary-card.failed .card-icon {
  color: var(--bs-danger);
}

.summary-card .card-content {
  flex: 1;
}

.summary-card h6 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--bs-secondary);
  margin-bottom: 0.75rem;
}

.summary-card .test-stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.summary-card .stat-item {
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.summary-card .pass-rate {
  font-size: 2rem;
  font-weight: 700;
  color: var(--bs-body-color);
  margin-bottom: 0.5rem;
}

.summary-card .coverage-stats {
  display: flex;
  gap: 1.5rem;
}

.summary-card .coverage-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.summary-card .coverage-item .label {
  font-size: 0.75rem;
  color: var(--bs-secondary);
  text-transform: uppercase;
}

.summary-card .coverage-item .value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--bs-body-color);
}

/* Scenarios Section */
.scenarios-section {
  flex: 1;
  overflow: auto;
  padding: 0 1.5rem 1.5rem;
}

.scenarios-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-top: 0.5rem;
}

.scenarios-header h5 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.scenarios-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Scenario Card */
.scenario-card {
  background: var(--bs-card-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.5rem;
  padding: 1rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  transition: all 0.2s ease;
}

.scenario-card:hover {
  border-color: var(--bs-primary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.scenario-icon {
  width: 48px;
  height: 48px;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
  font-size: 1.5rem;
}

.scenario-content {
  flex: 1;
  min-width: 0;
}

.scenario-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.scenario-name {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: var(--bs-body-color);
}

.scenario-description {
  font-size: 0.875rem;
  color: var(--bs-secondary);
  margin: 0 0 0.5rem 0;
  line-height: 1.5;
}

.scenario-mocks {
  margin-top: 0.5rem;
}

.scenario-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Detailed Results */
.detailed-results {
  margin-top: 2rem;
  padding-bottom: 1rem;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.results-header h5 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

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

.result-item {
  background: var(--bs-card-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.375rem;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.result-item.passed {
  border-left: 3px solid var(--bs-success);
}

.result-item.failed {
  border-left: 3px solid var(--bs-danger);
  background: rgba(220, 53, 69, 0.03);
}

.result-item.skipped {
  border-left: 3px solid var(--bs-warning);
}

.result-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.result-item.passed .result-icon {
  color: var(--bs-success);
}

.result-item.failed .result-icon {
  color: var(--bs-danger);
}

.result-item.skipped .result-icon {
  color: var(--bs-warning);
}

.result-content {
  flex: 1;
  min-width: 0;
}

.result-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--bs-body-color);
  margin-bottom: 0.25rem;
}

.result-error {
  font-size: 0.75rem;
  color: var(--bs-danger);
  margin-top: 0.25rem;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.result-duration {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--bs-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
  .test-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .test-actions {
    width: 100%;
    justify-content: space-between;
  }

  .test-summary {
    grid-template-columns: 1fr;
  }

  .scenario-card {
    flex-direction: column;
  }

  .scenario-actions {
    width: 100%;
  }

  .scenario-actions .btn {
    flex: 1;
  }
}

/* Loading States */
.test-tab-container .spinner-border {
  width: 1rem;
  height: 1rem;
  border-width: 2px;
}

.scenario-card,
.result-item,
.summary-card {
  animation: fadeIn 0.3s ease;
}

/* Purple color for conditional type */
.bg-purple {
  background-color: #6f42c1 !important;
}

.badge.bg-purple {
  color: white;
}

/* Dark mode adjustments */
body[data-theme="dark"] .test-empty-state .empty-icon {
  opacity: 0.3;
}

body[data-theme="dark"] .summary-card {
  background: rgba(255, 255, 255, 0.02);
}

body[data-theme="dark"] .summary-card.success {
  background: rgba(25, 135, 84, 0.1);
}

body[data-theme="dark"] .summary-card.failed {
  background: rgba(220, 53, 69, 0.1);
}

body[data-theme="dark"] .scenario-card,
body[data-theme="dark"] .result-item {
  background: rgba(255, 255, 255, 0.02);
}

body[data-theme="dark"] .result-item.failed {
  background: rgba(220, 53, 69, 0.05);
}

/* Scrollbar Styling */
.scenarios-section::-webkit-scrollbar {
  width: 8px;
}

.scenarios-section::-webkit-scrollbar-track {
  background: var(--bs-body-bg);
}

.scenarios-section::-webkit-scrollbar-thumb {
  background: var(--bs-border-color);
  border-radius: 4px;
}

.scenarios-section::-webkit-scrollbar-thumb:hover {
  background: var(--bs-secondary);
}

/* ========================================
   PUBLISH TAB STYLES
   ======================================== */

/* Publish Tab Container */
.publish-tab {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bs-body-bg);
  overflow-y: auto;
  padding: 1.5rem;
  gap: 1.5rem;
}

/* Publish Header */
.publish-header {
  text-align: center;
  padding: 1rem 0 1.5rem;
  border-bottom: 1px solid var(--bs-border-color);
}

.publish-header h2 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--bs-body-color);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.publish-header h2 i {
  color: var(--bs-primary);
}

.publish-header p {
  font-size: 1rem;
  color: var(--bs-secondary);
  margin: 0;
}

/* Pre-flight Checks Section */
.preflight-section {
  background: var(--bs-card-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.75rem;
  padding: 1.5rem;
}

.preflight-section h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--bs-body-color);
}

.preflight-section h3 i {
  color: var(--bs-primary);
}

/* Checks List */
.checks-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.5rem;
  transition: all 0.3s ease;
}

.check-item:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.check-item.check-passed {
  border-left: 3px solid var(--bs-success);
  background: rgba(25, 135, 84, 0.03);
}

.check-item.check-failed {
  border-left: 3px solid var(--bs-danger);
  background: rgba(220, 53, 69, 0.03);
}

.check-item.check-warning {
  border-left: 3px solid var(--bs-warning);
  background: rgba(255, 193, 7, 0.03);
}

.check-item.check-checking {
  border-left: 3px solid var(--bs-info);
}

.check-icon {
  flex-shrink: 0;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.check-content {
  flex: 1;
  min-width: 0;
}

.check-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--bs-body-color);
  margin-bottom: 0.25rem;
}

.check-message {
  font-size: 0.875rem;
  color: var(--bs-secondary);
  line-height: 1.5;
}

/* Deployment Section */
.deployment-section {
  background: var(--bs-card-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.75rem;
  padding: 1.5rem;
}

.deployment-section h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--bs-body-color);
}

.deployment-section h3 i {
  color: var(--bs-success);
}

.deployment-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.deployment-actions {
  margin-top: 1rem;
}

.deploy-btn {
  min-height: 48px;
  font-size: 1.125rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

.deploy-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(13, 110, 253, 0.25);
}

.deploy-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Deployment History Section */
.deployment-history-section {
  background: var(--bs-card-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.75rem;
  padding: 1.5rem;
}

.deployment-history-section h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--bs-body-color);
}

.deployment-history-section h3 i {
  color: var(--bs-info);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.history-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

.history-item:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.history-status {
  flex-shrink: 0;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

.history-content {
  flex: 1;
  min-width: 0;
}

.history-message {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--bs-body-color);
  margin-bottom: 0.25rem;
}

.history-meta {
  font-size: 0.75rem;
  color: var(--bs-secondary);
}

/* Alerts in Publish Tab */
.publish-tab .alert {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.publish-tab .alert i {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.publish-tab .alert strong {
  display: block;
  margin-bottom: 0.25rem;
}

/* Responsive Design for Publish Tab */
@media (max-width: 768px) {
  .publish-tab {
    padding: 1rem;
    gap: 1rem;
  }

  .publish-header h2 {
    font-size: 1.5rem;
  }

  .preflight-section,
  .deployment-section,
  .deployment-history-section {
    padding: 1rem;
  }

  .check-item {
    flex-direction: column;
    gap: 0.75rem;
  }

  .deploy-btn {
    font-size: 1rem;
    min-height: 44px;
  }
}

/* Dark Mode Adjustments for Publish Tab */
body[data-theme="dark"] .check-item,
body[data-theme="dark"] .history-item {
  background: rgba(255, 255, 255, 0.02);
}

body[data-theme="dark"] .check-item.check-passed {
  background: rgba(25, 135, 84, 0.05);
}

body[data-theme="dark"] .check-item.check-failed {
  background: rgba(220, 53, 69, 0.05);
}

body[data-theme="dark"] .check-item.check-warning {
  background: rgba(255, 193, 7, 0.05);
}

/* Animations for Publish Tab */
.check-item,
.history-item {
  animation: fadeIn 0.3s ease;
}

/* Scrollbar for Publish Tab */
.publish-tab::-webkit-scrollbar {
  width: 8px;
}

.publish-tab::-webkit-scrollbar-track {
  background: var(--bs-body-bg);
}

.publish-tab::-webkit-scrollbar-thumb {
  background: var(--bs-border-color);
  border-radius: 4px;
}

.publish-tab::-webkit-scrollbar-thumb:hover {
  background: var(--bs-secondary);
}
