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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  color: #1a1a1a;
  line-height: 1.6;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
}

header {
  text-align: center;
  margin-bottom: 40px;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.subtitle {
  color: #666;
  font-size: 0.95rem;
}

/* Form */
.crawl-form {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 32px;
}

.input-row {
  display: flex;
  gap: 10px;
}

#urlInput {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

#urlInput:focus {
  outline: none;
  border-color: #2563eb;
}

.input-with-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.input-with-label label {
  font-size: 0.7rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.input-with-label input {
  width: 80px;
  padding: 10px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 0.9rem;
  text-align: center;
}

.input-with-label input:focus {
  outline: none;
  border-color: #2563eb;
}

.options-row {
  margin-top: 10px;
}

.form-hint {
  margin-top: 8px;
  font-size: 0.75rem;
  color: #999;
  line-height: 1.4;
}

.checkbox-label {
  font-size: 0.85rem;
  color: #555;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.checkbox-label input[type="checkbox"] {
  accent-color: #2563eb;
}

#submitBtn {
  padding: 12px 28px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

#submitBtn:hover {
  background: #1d4ed8;
}

#submitBtn:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

/* Active job */
.active-job {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 32px;
}

.active-job h2 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 3px solid #e0e0e0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.progress-log {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  background: #fafafa;
  border-radius: 8px;
  padding: 16px;
  max-height: 300px;
  overflow-y: auto;
}

.progress-log .entry {
  padding: 3px 0;
  border-bottom: 1px solid #f0f0f0;
}

.progress-log .entry:last-child {
  border-bottom: none;
}

.progress-log .phase {
  color: #2563eb;
  font-weight: 600;
  margin-right: 8px;
}

.progress-log .error .phase {
  color: #dc2626;
}

.progress-log .time {
  color: #999;
  font-size: 0.8rem;
  margin-right: 8px;
}

/* robots.txt display */
.robots-entry {
  padding: 6px 0 !important;
}

.robots-rules {
  margin: 6px 0 6px 20px;
  padding: 6px 10px;
  background: #f0f4ff;
  border-radius: 4px;
  border-left: 3px solid #2563eb;
}

.robots-rule {
  font-size: 0.8rem;
  color: #444;
  padding: 1px 0;
}

.robots-rule code {
  background: #e8edf5;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.78rem;
}

.robots-allowed {
  margin: 4px 0 2px 20px;
  font-size: 0.83rem;
  color: #166534;
  font-weight: 600;
}

.robots-blocked {
  margin: 4px 0 2px 20px;
}

.robots-blocked-header {
  font-size: 0.83rem;
  color: #991b1b;
  font-weight: 600;
  margin-bottom: 2px;
}

.robots-url {
  font-size: 0.78rem;
  padding: 1px 0;
  color: #555;
}

.robots-url.blocked {
  color: #991b1b;
}

.robots-ignored {
  color: #92400e;
  font-weight: 600;
  font-size: 0.8rem;
}

/* Job history */
.job-history h2 {
  font-size: 1.1rem;
  margin-bottom: 16px;
}

.job-list .empty {
  color: #999;
  text-align: center;
  padding: 20px;
}

.job-card {
  background: #fff;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.job-card .job-info {
  flex: 1;
}

.job-card .job-domain {
  font-weight: 600;
  font-size: 0.95rem;
}

.job-card .job-meta {
  font-size: 0.8rem;
  color: #666;
  margin-top: 2px;
}

.job-card .job-actions {
  display: flex;
  gap: 8px;
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.complete { background: #dcfce7; color: #166534; }
.status-badge.running  { background: #dbeafe; color: #1e40af; }
.status-badge.queued   { background: #fef3c7; color: #92400e; }
.status-badge.failed   { background: #fee2e2; color: #991b1b; }

.btn-sm {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
}

.btn-download {
  background: #059669;
}

.btn-download:hover {
  background: #047857;
}

.hidden { display: none; }

@media (max-width: 600px) {
  .input-row {
    flex-direction: column;
  }
  .input-with-label {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
  .input-with-label input {
    width: 100%;
  }
  .job-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}
