/* Batch Jobs UI — landing, launch, detail.
   Mobile-first; reuses main.css for navbar / page-container / .btn primitives. */

.batch-page {
  padding: 1rem;
}

.batch-page h1 {
  margin: 0 0 1rem;
  color: #2c3e50;
}

.batch-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.batch-launch-cta {
  display: inline-block;
  background: #667eea;
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
}
.batch-launch-cta:hover {
  background: #5568d3;
}

/* Status sections */
.batch-section {
  background: white;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.batch-section h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  color: #2c3e50;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.batch-section .count {
  color: #6b7280;
  font-weight: normal;
}
.batch-section .empty {
  color: #9ca3af;
  font-style: italic;
  padding: 0.5rem 0;
}

/* Job rows */
.batch-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0;
  border-top: 1px solid #f1f3f5;
}
.batch-row:first-child {
  border-top: none;
}
.batch-row-main {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  flex: 1 1 240px;
}
.batch-row-title {
  font-weight: 600;
  color: #1f2937;
  text-decoration: none;
}
.batch-row-title:hover {
  text-decoration: underline;
}
.batch-row-meta {
  font-size: 0.85rem;
  color: #6b7280;
}
.batch-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.batch-pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.batch-pill.queued {
  background: #e5e7eb;
  color: #374151;
}
.batch-pill.running {
  background: #dbeafe;
  color: #1e40af;
}
.batch-pill.paused {
  background: #fef3c7;
  color: #92400e;
}
.batch-pill.succeeded {
  background: #d1fae5;
  color: #065f46;
}
.batch-pill.failed {
  background: #fee2e2;
  color: #991b1b;
}
.batch-pill.cancelled {
  background: #e5e7eb;
  color: #4b5563;
}
.batch-pill.fanout {
  background: #ede9fe;
  color: #5b21b6;
}

/* Action buttons (touch-sized for mobile) */
.btn-batch {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  color: #374151;
  cursor: pointer;
  text-decoration: none;
}
.btn-batch:hover {
  background: #f3f4f6;
}
.btn-batch.primary {
  background: #667eea;
  color: white;
  border-color: #667eea;
}
.btn-batch.primary:hover {
  background: #5568d3;
}
.btn-batch.danger {
  color: #b91c1c;
  border-color: #fca5a5;
}
.btn-batch.danger:hover {
  background: #fef2f2;
}

/* Launch form */
.batch-form {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  max-width: 700px;
}
.batch-form .form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}
.batch-form label {
  font-weight: 600;
  color: #374151;
  font-size: 0.95rem;
}
.batch-form label .required {
  color: #dc2626;
}
.batch-form .help {
  color: #6b7280;
  font-size: 0.85rem;
}
.batch-form input[type="text"],
.batch-form input[type="number"],
.batch-form input[type="datetime-local"],
.batch-form select,
.batch-form textarea {
  padding: 0.6rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1rem;
  min-height: 44px;
}
.batch-form input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
}
.batch-form .form-field.error input,
.batch-form .form-field.error select {
  border-color: #dc2626;
}
.batch-form .field-error {
  color: #dc2626;
  font-size: 0.85rem;
}
.batch-form .form-row-inline {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}
.batch-form .form-row-inline input {
  flex: 1;
}
.batch-form .radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.batch-form .radio-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: normal;
  cursor: pointer;
}
.batch-form .radio-group .reveal {
  margin-left: 1.75rem;
  margin-top: 0.5rem;
}
.batch-form .reveal[hidden] {
  display: none;
}
.batch-form .actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* Job detail */
.job-detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 768px) {
  .job-detail-grid {
    grid-template-columns: 2fr 1fr;
  }
}
.job-events {
  background: #0f172a;
  color: #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
  font-family: "Menlo", "Consolas", monospace;
  font-size: 0.85rem;
  line-height: 1.45;
  min-height: 200px;
  max-height: 500px;
  overflow-y: auto;
}
.job-events .evt {
  padding: 2px 0;
}
.job-events .evt.success {
  color: #6ee7b7;
}
.job-events .evt.error {
  color: #fca5a5;
}
.job-events .evt.warning {
  color: #fcd34d;
}
.job-events .evt .phase {
  color: #a5b4fc;
}
.job-events .evt .pct {
  color: #93c5fd;
}

.job-side-card {
  background: white;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.job-side-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: #374151;
}
.job-side-card .kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 0.75rem;
  font-size: 0.9rem;
}
.job-side-card .kv dt {
  color: #6b7280;
}
.job-side-card .kv dd {
  margin: 0;
  color: #1f2937;
  word-break: break-all;
}

.job-result {
  background: #f8fafc;
  border-radius: 6px;
  padding: 0.75rem;
  font-family: "Menlo", "Consolas", monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-all;
}

.children-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
}
.children-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-top: 1px solid #f1f3f5;
}
.children-list li:first-child {
  border-top: none;
}
.children-list a {
  color: #4f46e5;
  text-decoration: none;
}

/* Modal */
.batch-modal-backdrop[hidden] {
  display: none !important;
}

.batch-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.batch-modal {
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}
.batch-modal h3 {
  margin: 0 0 0.5rem;
  color: #b91c1c;
}
.batch-modal p {
  color: #374151;
}
.batch-modal .modal-warning {
  background: #fef3c7;
  color: #92400e;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  margin: 0.75rem 0;
  font-weight: 600;
}
.batch-modal .modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

@media (max-width: 600px) {
  .batch-page {
    padding: 0.5rem;
  }
  .batch-section {
    padding: 0.75rem;
  }
  .batch-row {
    flex-direction: column;
    align-items: stretch;
  }
  .batch-row-actions {
    justify-content: stretch;
  }
  .btn-batch {
    flex: 1;
    justify-content: center;
  }
}
