* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background: #f5f7fa;
  color: #2c3e50;
  line-height: 1.6;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.app-header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.app-header p {
  opacity: 0.9;
  font-size: 1.1rem;
}

.app-main {
  flex: 1;
  padding: 2rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.app-footer {
  background: #2c3e50;
  color: white;
  text-align: center;
  padding: 1rem;
  margin-top: 2rem;
}

.container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Job Creator */
.job-creator {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.job-creator h2 {
  margin-bottom: 1.5rem;
  color: #667eea;
}

.job-creator form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-weight: 600;
  color: #2c3e50;
}

.form-group input[type="text"],
.form-group input[type="number"] {
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: #667eea;
}

.form-group.checkbox {
  flex-direction: row;
  align-items: center;
}

.form-group.checkbox label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.error-message {
  background: #fee;
  color: #c33;
  padding: 0.75rem;
  border-radius: 4px;
  border-left: 4px solid #c33;
}

button {
  padding: 0.75rem 1.5rem;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s;
}

button:hover:not(:disabled) {
  background: #5568d3;
}

button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

.btn-primary {
  background: #667eea;
}

.btn-secondary {
  background: #6c757d;
}

.btn-success {
  background: #28a745;
}

.btn-warning {
  background: #ffc107;
  color: #000;
}

.btn-danger {
  background: #dc3545;
}

/* Job List */
.job-list {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.job-list h2 {
  margin-bottom: 1.5rem;
  color: #667eea;
}

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

.list-header h2 {
  margin-bottom: 0;
}

.no-jobs {
  text-align: center;
  padding: 2rem;
  color: #999;
}

.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: #f8f9fa;
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

th {
  font-weight: 600;
  color: #667eea;
}

tr:hover {
  background: #f8f9fa;
}

.prefix {
  font-family: monospace;
  font-weight: bold;
  color: #667eea;
}

.date-cell {
  font-size: 0.9rem;
  color: #666;
}

/* Status Badges */
.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-pending {
  background: #e3f2fd;
  color: #1976d2;
}

.status-running {
  background: #c8e6c9;
  color: #2e7d32;
}

.status-paused {
  background: #fff3cd;
  color: #856404;
}

.status-completed {
  background: #d4edda;
  color: #155724;
}

.status-failed {
  background: #f8d7da;
  color: #721c24;
}

.status-cancelled {
  background: #e0e0e0;
  color: #666;
}

/* Progress */
.progress-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.progress-bar-mini {
  width: 100%;
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  transition: width 0.3s;
}

.progress-text {
  font-size: 0.85rem;
  color: #666;
}

.progress-bar-container {
  margin: 1rem 0;
}

.progress-bar-large {
  width: 100%;
  height: 40px;
  background: #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.progress-fill-large {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  transition: width 0.5s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-percentage {
  color: white;
  font-weight: bold;
  font-size: 1.1rem;
}

.progress-stats {
  text-align: center;
  margin-top: 0.5rem;
  color: #666;
  font-size: 0.9rem;
}

/* Job Details */
.job-details {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e0e0e0;
}

.job-header h1 {
  color: #667eea;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
}

.job-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.info-card {
  background: #f8f9fa;
  padding: 1.5rem;
  border-radius: 8px;
  border-left: 4px solid #667eea;
}

.info-card h3 {
  margin-bottom: 1rem;
  color: #667eea;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e0e0e0;
}

.info-row:last-child {
  border-bottom: none;
}

.info-row .label {
  font-weight: 600;
  color: #666;
}

.info-row .value {
  color: #2c3e50;
}

.info-row .value.success {
  color: #28a745;
  font-weight: bold;
}

.info-row .value.warning {
  color: #ffc107;
  font-weight: bold;
}

.info-row .value.error {
  color: #dc3545;
  font-weight: bold;
}

.progress-section {
  margin: 2rem 0;
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.progress-section h3 {
  margin-bottom: 1rem;
  color: #667eea;
}

.job-controls {
  margin: 2rem 0;
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.job-controls h3 {
  margin-bottom: 1rem;
  color: #667eea;
}

.button-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.status-message {
  padding: 1rem;
  background: #e3f2fd;
  border-radius: 4px;
  color: #1976d2;
}

.error-section {
  margin: 2rem 0;
  padding: 1.5rem;
  background: #fee;
  border-radius: 8px;
  border-left: 4px solid #dc3545;
}

.error-section h3 {
  margin-bottom: 1rem;
  color: #dc3545;
}

.error-message-box {
  background: white;
  padding: 1rem;
  border-radius: 4px;
  font-family: monospace;
  color: #721c24;
}

.documents-section {
  margin-top: 2rem;
}

/* Document Viewer */
.document-viewer {
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.document-viewer h3 {
  margin-bottom: 1rem;
  color: #667eea;
}

.no-documents {
  text-align: center;
  padding: 2rem;
  color: #999;
}

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

.document-item {
  background: white;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #e0e0e0;
}

.document-header {
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.2s;
}

.document-header:hover {
  background: #f8f9fa;
}

.doc-number {
  font-family: monospace;
  font-weight: bold;
  color: #667eea;
}

.doc-type {
  padding: 0.25rem 0.75rem;
  background: #e3f2fd;
  color: #1976d2;
  border-radius: 12px;
  font-size: 0.85rem;
}

.doc-cases {
  color: #666;
  font-size: 0.9rem;
}

.doc-date {
  color: #999;
  font-size: 0.85rem;
}

.expand-icon {
  color: #667eea;
  font-size: 0.8rem;
}

.document-body {
  padding: 1rem;
  background: #f8f9fa;
  border-top: 1px solid #e0e0e0;
}

.document-body pre {
  background: #2c3e50;
  color: #ecf0f1;
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.4;
}

/* Loading & Error States */
.loading {
  text-align: center;
  padding: 3rem;
  color: #667eea;
  font-size: 1.2rem;
}

.error {
  text-align: center;
  padding: 2rem;
  color: #dc3545;
  background: #fee;
  border-radius: 8px;
  margin: 2rem 0;
}

.error-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
  .app-header h1 {
    font-size: 1.8rem;
  }

  .app-main {
    padding: 1rem;
  }

  .job-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .job-info-grid {
    grid-template-columns: 1fr;
  }

  table {
    font-size: 0.85rem;
  }

  th, td {
    padding: 0.75rem;
  }

  .document-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}
