/*
  AI CyberShield – Demo Web (PHP)
  CSS được tối ưu để:
  - Trình bày rõ ràng, chuyên nghiệp (dễ chụp ảnh minh chứng trong hồ sơ)
  - Dễ đọc trên điện thoại/laptop (responsive)
  - Có chế độ in A4 (print) để xuất PDF đính kèm nếu cần
  Lưu ý: Không dùng font online / CDN để đảm bảo chạy offline.
*/

:root {
  --bg: #f6f8fc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --muted2: #64748b;
  --border: #e2e8f0;

  --primary: #1d4ed8;
  --primary-2: #2563eb;
  --primary-soft: rgba(37, 99, 235, 0.12);

  --ok: #16a34a;
  --ok-soft: rgba(22, 163, 74, 0.12);

  --warn: #f59e0b;
  --warn-text: #92400e;
  --warn-soft: rgba(245, 158, 11, 0.14);

  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.12);

  --mid: #0ea5e9;
  --mid-text: #0369a1;
  --mid-soft: rgba(14, 165, 233, 0.12);

  --radius: 16px;
  --shadow: 0 14px 40px rgba(2, 6, 23, 0.08);
  --shadow-soft: 0 8px 22px rgba(2, 6, 23, 0.06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 10% 0%, rgba(37, 99, 235, 0.14), transparent 60%),
    radial-gradient(900px 520px at 90% 0%, rgba(14, 165, 233, 0.10), transparent 55%),
    var(--bg);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  line-height: 1.45;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: rgba(37, 99, 235, 0.18); }

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 22px 16px 44px;
}

header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand__title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand__subtitle {
  color: var(--muted);
  font-size: 13px;
  max-width: 58ch;
}

.badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* Badge dùng chung (JS cũng gán class badge + ok/warn/danger/mid) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted2);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(2, 6, 23, 0.04);
  backdrop-filter: saturate(180%) blur(6px);
}

a.badge:hover {
  border-color: rgba(37, 99, 235, 0.32);
  box-shadow: 0 1px 0 rgba(2, 6, 23, 0.04), 0 0 0 4px rgba(37, 99, 235, 0.10);
  text-decoration: none;
}

.badge.ok {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: rgba(22, 163, 74, 0.28);
}

.badge.warn {
  color: var(--warn-text);
  background: var(--warn-soft);
  border-color: rgba(245, 158, 11, 0.38);
}

.badge.danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(220, 38, 38, 0.26);
}

.badge.mid {
  color: var(--mid-text);
  background: var(--mid-soft);
  border-color: rgba(14, 165, 233, 0.28);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-soft);
  margin-top: 12px;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.card h3 {
  margin: 14px 0 8px;
  font-size: 13px;
  font-weight: 800;
  color: #111827;
}

/* Layout helpers */
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.inline {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.inline > * { flex: 1; }

@media (max-width: 640px) {
  .inline { flex-direction: column; align-items: stretch; }
  .inline > * { width: 100%; }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.field > span {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 700;
}

textarea,
select,
input[type="text"] {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  padding: 12px 12px;
  outline: none;
  box-shadow: 0 1px 0 rgba(2, 6, 23, 0.03);
}

textarea {
  min-height: 170px;
  resize: vertical;
  line-height: 1.5;
}

textarea::placeholder { color: #94a3b8; }

textarea:focus,
select:focus,
input[type="text"]:focus {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 14px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.20s ease, border-color 0.20s ease;
  user-select: none;
}

.btn:hover {
  border-color: rgba(37, 99, 235, 0.25);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
}

.btn:active { transform: translateY(1px); }

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.btn.primary {
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.12) 0%, rgba(37, 99, 235, 0.08) 100%), #ffffff;
  border-color: rgba(37, 99, 235, 0.35);
}

.btn.secondary {
  background: #ffffff;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 12px;
}

/* Status pill */
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: rgba(2, 6, 23, 0.02);
}

.status.info {
  color: var(--mid-text);
  background: var(--mid-soft);
  border-color: rgba(14, 165, 233, 0.28);
}

.status.warn {
  color: var(--warn-text);
  background: var(--warn-soft);
  border-color: rgba(245, 158, 11, 0.38);
}

.status.ok {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: rgba(22, 163, 74, 0.28);
}

.status.danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(220, 38, 38, 0.26);
}

.hidden { display: none !important; }

/* Result styles */
.riskRow {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background:
    radial-gradient(720px 220px at 15% 0%, rgba(37, 99, 235, 0.10), transparent 55%),
    rgba(2, 6, 23, 0.015);
}

.score {
  font-size: 44px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.split {
  display: grid;
  grid-template-columns: 1.25fr 0.9fr;
  gap: 16px;
  margin-top: 14px;
}

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
}

.list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.list li { margin: 6px 0; }

.reportBox {
  margin-top: 12px;
  border-radius: 14px;
  border: 1px dashed rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.06);
  padding: 12px;
}

.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(2, 6, 23, 0.06);
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-size: 13px;
}

.consent input { margin-top: 2px; }

.raw {
  margin-top: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.02);
  overflow: hidden;
}

.raw summary {
  cursor: pointer;
  padding: 10px 12px;
  font-weight: 800;
  color: var(--muted);
  list-style: none;
}

.raw summary::-webkit-details-marker { display: none; }

.raw pre {
  margin: 0;
  padding: 12px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.4;
  color: #0b1220;
  background: #ffffff;
  border-top: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Reports page KPI */
.kpi {
  flex: 1;
  min-width: 160px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background:
    radial-gradient(260px 120px at 20% 0%, rgba(37, 99, 235, 0.10), transparent 60%),
    #ffffff;
  box-shadow: 0 1px 0 rgba(2, 6, 23, 0.03);
}

.kpi__num {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.kpi__label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  margin-top: 2px;
}

.small {
  font-size: 12px;
  color: var(--muted2);
}

.footer {
  margin-top: 14px;
  color: var(--muted2);
  font-size: 12px;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}

/* Accessibility */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Print A4 – hữu ích nếu muốn in/screenshot minh chứng trong hồ sơ */
@media print {
  @page { size: A4; margin: 14mm; }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-family: "Times New Roman", Times, serif;
    font-size: 14px;
  }

  .container { max-width: none; padding: 0; }

  header { margin-bottom: 10px; }

  .card {
    box-shadow: none !important;
    background: #ffffff !important;
  }

  .btn,
  details.raw { display: none !important; }

  a { color: #000000 !important; text-decoration: none !important; }
}
