
:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --primary: #1f4e79;
  --primary-dark: #173b5c;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #d1d5db;
  --code-bg: #111827;
  --code-text: #e5e7eb;
  --success: #047857;
  --error: #b91c1c;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
header {
  background: linear-gradient(135deg, var(--primary), #2563eb);
  color: white;
  padding: 42px 24px;
  text-align: center;
}
header h1 { margin: 0; font-size: 42px; }
header p { margin: 10px auto 0; max-width: 880px; font-size: 17px; opacity: 0.95; }
nav {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 10;
}
nav a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
  margin: 0 14px;
}
main { max-width: 1120px; margin: 28px auto 48px; padding: 0 20px; }
.card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  padding: 28px;
  margin-bottom: 24px;
  border: 1px solid rgba(209, 213, 219, 0.7);
}
.hero-card { margin-top: -34px; }
h2 { margin-top: 0; color: var(--primary); }
h3 { color: var(--primary-dark); }
label { display: block; font-weight: 700; margin-bottom: 8px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-size: 15px;
  outline: none;
  background: white;
}
textarea { min-height: 160px; resize: vertical; font-family: Consolas, Monaco, monospace; }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 78, 121, 0.12);
}
.row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 16px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: #f9fafb;
}
.feature strong { display: block; color: var(--primary-dark); margin-bottom: 6px; }
button {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 12px 22px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 14px;
  margin-right: 8px;
}
button:hover { background: var(--primary-dark); }
button.secondary { background: #374151; }
button.danger { background: #991b1b; }
button:disabled { background: #9ca3af; cursor: not-allowed; }
pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 20px;
  border-radius: 12px;
  overflow-x: auto;
  white-space: pre-wrap;
  min-height: 160px;
  font-size: 14px;
}
.hint { color: var(--muted); font-size: 14px; margin-top: 6px; }
.status { margin-top: 12px; font-weight: 700; }
.success { color: var(--success); }
.error { color: var(--error); }
footer { text-align: center; color: var(--muted); font-size: 14px; padding: 24px; }
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-weight: 700;
  font-size: 13px;
  margin-right: 8px;
}
@media (max-width: 860px) {
  .row, .row-3, .grid { grid-template-columns: 1fr; }
  header h1 { font-size: 32px; }
}


/* Structured single-result table */
.result-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 14px;
  background: #ffffff;
}

.result-table th,
.result-table td {
  border: 1px solid #e5e7eb;
  padding: 10px 12px;
  vertical-align: top;
}

.result-table th {
  background: #f8fafc;
  font-weight: 600;
  text-align: left;
}

.result-table .field-cell {
  width: 180px;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
}

.result-table .value-cell {
  color: #374151;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Batch analysis display */
.batch-summary {
  margin: 12px 0 18px;
}

.batch-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
}

.batch-summary-grid div {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.batch-summary-grid strong {
  display: block;
  color: #374151;
  font-size: 13px;
}

.batch-summary-grid span {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: #1f4e79;
  margin-top: 4px;
}

.batch-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  background: #ffffff;
  font-size: 14px;
}

.batch-table th,
.batch-table td {
  border: 1px solid #e5e7eb;
  padding: 10px 12px;
  vertical-align: top;
}

.batch-table th {
  background: #f8fafc;
  text-align: left;
  color: #111827;
}

.question-cell {
  max-width: 360px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  background: #e5e7eb;
  color: #374151;
}

.status-finished {
  background: #d1fae5;
  color: #047857;
}

.status-running {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-queued {
  background: #fef3c7;
  color: #92400e;
}

.status-failed,
.status-not_found {
  background: #fee2e2;
  color: #b91c1c;
}

.small-btn {
  padding: 6px 10px;
  font-size: 12px;
  margin: 0;
  border-radius: 8px;
}

.batch-detail {
  margin-top: 18px;
}

.detail-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.detail-card h3 {
  margin-top: 0;
}

.detail-block {
  margin-bottom: 14px;
}

.detail-block strong {
  display: block;
  color: #1f4e79;
  margin-bottom: 4px;
}

.detail-block p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.6;
}

@media (max-width: 980px) {
  .batch-summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .batch-table {
    display: block;
    overflow-x: auto;
  }
}

#footer {
  height: 35px;
  background-color: #dcdcdc;
  text-align: center;
  padding: 10px 0;
  margin: 0;
  box-sizing: border-box;
}

#siteInfo {
  width: 100%;
  clear: both;
  bottom: 0;
  border: 0px solid #cccccc;
  font-size: 13px;
  color: #103c89;
  margin-top: 0px;
  height: 20px;
  text-align: center;
    position: relative;
  top: -3px;
}

/* Custom English file input */
.custom-file {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #ffffff;
}

.custom-file input[type="file"] {
  display: none;
}

.custom-file-btn {
  display: inline-block;
  width: auto;
  margin: 0;
  padding: 5px 10px;
  border: 1px solid #9ca3af;
  border-radius: 3px;
  background: #f3f4f6;
  color: #111827;
  font-weight: normal;
  font-size: 14px;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
}

.custom-file-btn:hover {
  background: #e5e7eb;
}

.custom-file-name {
  color: #111827;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
