/* static/style.css */
body {
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background-color: #0f172a;
  color: #e5e7eb;
  margin: 0;
  padding: 0;
}

.container {
  max-width: 900px;
  width: 100%;
  margin: 16px auto 32px;
  padding: 16px 16px 28px;
  background-color: #020617;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  box-sizing: border-box;
}

h1 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 24px;
  color: #38bdf8;
}

.desc {
  font-size: 14px;
  color: #9ca3af;
  margin-bottom: 18px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

textarea,
input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #1f2937;
  background-color: #020617;
  color: #e5e7eb;
  font-size: 14px;
  box-sizing: border-box;
  margin-bottom: 12px;
}

textarea:focus,
input:focus {
  outline: none;
  border-color: #38bdf8;
}

/* 섹션(스캔 옵션 / 고급 옵션) */
.section {
  margin-bottom: 12px;
  border-radius: 8px;
  border: 1px solid #1f2937;
  background-color: #020617;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 14px;
  color: #e5e7eb;
}

.section-header:hover {
  background-color: #030712;
}

.section-toggle-indicator {
  font-size: 12px;
  color: #9ca3af;
}

.section-content {
  padding: 8px 10px 10px;
  border-top: 1px solid #1f2937;
}

/* 한 줄 줄맞춤용 */
.row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
}

.inline-label {
  font-size: 13px;
}

.note {
  color: #9ca3af;
}

.small-input {
  width: 90px;
}

.flex-1 {
  flex: 1;
}

button[type="submit"] {
  margin-top: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  color: #0b1120;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

button[type="submit"]:hover {
  filter: brightness(1.1);
}

hr {
  margin: 20px 0;
  border: none;
  border-top: 1px solid #1f2937;
}

/* 결과 요약 한 줄 + 배지 색상 */
.summary-line {
  margin-top: 6px;
  margin-bottom: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-total {
  background-color: #111827;
  color: #e5e7eb;
  border: 1px solid #374151;
}

.badge-vuln {
  background-color: #b91c1c;
  color: #f9fafb;
}

.badge-ok {
  background-color: #15803d;
  color: #f9fafb;
}

.badge-error {
  background-color: #92400e;
  color: #f9fafb;
}

/* 개별 결과 카드 */
.result-card {
  border-radius: 10px;
  border: 1px solid #1f2937;
  background-color: #020617;
  padding: 10px 10px 12px;
  margin-bottom: 12px;
}

.result-card-vuln {
  border-color: #b91c1c;
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.35);
}

.result-card-ok {
  border-color: #15803d;
}

.result-card-error {
  border-color: #92400e;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}

.result-host {
  font-weight: 600;
  color: #e5e7eb;
  word-break: break-all;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-code {
  font-size: 11px;
  color: #9ca3af;
}

.status-pill {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.status-vuln {
  background-color: #b91c1c;
  color: #f9fafb;
}

.status-ok {
  background-color: #15803d;
  color: #f9fafb;
}

.status-error {
  background-color: #92400e;
  color: #f9fafb;
}

.status-unknown {
  background-color: #374151;
  color: #e5e7eb;
}

.result-error {
  font-size: 12px;
  color: #f97316;
  margin-bottom: 6px;
}

/* Request / Response 2열 그리드
   - 기본은 1열(모바일 친화)
   - 넓은 화면에서 2열로 변경 */
.rr-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 6px;
}

.rr-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rr-title {
  font-size: 12px;
  color: #9ca3af;
}

.rr-pre {
  background-color: #020617;
  padding: 8px;
  border-radius: 6px;
  font-size: 11px;
  border: 1px solid #1f2937;
  max-height: 260px;
  overflow-y: auto;        /* 세로 스크롤만 */
  overflow-x: hidden;      /* 가로 스크롤 제거 */
  white-space: pre-wrap;   /* 줄바꿈 허용 */
  word-break: break-all;   /* 긴 토큰도 강제 줄바꿈 */
  overflow-wrap: anywhere; /* 어디서든 줄바꿈 */
}

/* fallback – 혹시 다른 pre가 남아있을 경우 동일 스타일 적용 */
#result pre {
  background-color: #020617;
  padding: 8px;
  border-radius: 6px;
  font-size: 11px;
  border: 1px solid #1f2937;
  max-height: 260px;
  overflow-y: auto;
  overflow-x: hidden;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-wrap: anywhere;
}

#result h2,
#result h3 {
  margin-bottom: 8px;
}

#result p {
  font-size: 14px;
}

/* 하이라이트 스타일 */
.hl-header {
  color: #38bdf8;
  font-weight: 600;
}

.hl-indicator {
  background-color: #991b1b;
  color: #fee2e2;
  font-weight: 600;
  padding: 0 2px;
  border-radius: 3px;
}

/* ─────────────────────────────
   모바일(<= 640px) 최적화
   ─────────────────────────── */
@media (max-width: 640px) {
  .container {
    margin: 8px auto 20px;
    padding: 14px 12px 22px;
    border-radius: 10px;
  }

  h1 {
    font-size: 20px;
  }

  .desc {
    font-size: 13px;
  }

  .section-header {
    padding: 8px 8px;
    font-size: 13px;
  }

  .section-content {
    padding: 8px 8px 10px;
  }

  .row {
    flex-direction: column;
    align-items: flex-start;
  }

  .checkbox-inline {
    font-size: 13px;
  }

  .inline-label {
    font-size: 12px;
  }

  .small-input {
    width: 100%;
    max-width: 160px;
  }

  .flex-1 {
    width: 100%;
  }

  button[type="submit"] {
    width: 100%;
    justify-content: center;
    display: inline-flex;
    text-align: center;
  }

  .summary-line {
    flex-direction: row;      /* 가로 배치 유지 */
	align-items: center;
    flex-wrap: wrap;          /* 공간 부족하면 자동 줄바꿈 */
  }

  .result-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .result-meta {
    flex-wrap: wrap;
  }
}

/* 넓은 화면(>= 768px)에서 Request/Response를 좌우 2열로 */
@media (min-width: 768px) {
  .rr-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* 태블릿(641~900px) 여백 조정 */
@media (min-width: 641px) and (max-width: 900px) {
  .container {
    margin: 16px auto 28px;
    padding: 16px 18px 26px;
  }
}

.log-urls {
  margin-top: 6px;
  font-size: 12px;
  color: #d1d5db;
  padding-left: 4px;
  border-left: 2px solid #334155;
}

.log-urls-label {
  font-weight: 600;
  margin-right: 4px;
  display: inline-block;
  margin-bottom: 2px;
}

.log-urls-list {
  margin-top: 2px;
}

.log-url-item {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 11px;
  line-height: 1.4;
}

.log-url-empty {
  color: #9ca3af;
}
