/* =====================================================
   CheckAnToan — stylesheet chính
   Palette: Navy tin cậy #10233F, Trắng #FFFFFF, Xám nền #F4F6F9,
            Đỏ cảnh báo #D64545, Vàng trung bình #E0A526, Xanh an toàn #2E9E5B
   Font: 'Inter' (UI/body) + 'Sora' (heading, chắc chắn & hiện đại)
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --navy: #10233F;
  --navy-light: #1B3A63;
  --bg: #F4F6F9;
  --white: #FFFFFF;
  --red: #D64545;
  --red-bg: #FDECEC;
  --amber: #E0A526;
  --amber-bg: #FEF6E4;
  --green: #2E9E5B;
  --green-bg: #E9F7EF;
  --gray-text: #5B6B82;
  --border: #E1E6ED;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(16, 35, 63, 0.06);
  --shadow-lg: 0 8px 30px rgba(16, 35, 63, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--navy);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: 'Sora', sans-serif; font-weight: 700; margin: 0 0 .5em; line-height: 1.25; }

a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--navy-light); }

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

/* ---------- Header ---------- */
.site-header { background: var(--white); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; gap: 24px; }
.logo { font-family: 'Sora', sans-serif; font-weight: 800; font-size: 1.35rem; color: var(--navy); white-space: nowrap; }
.logo span { color: var(--red); }
.main-nav { display: flex; gap: 24px; flex: 1; justify-content: center; }
.main-nav a { font-weight: 600; font-size: .95rem; color: var(--navy); padding: 6px 0; border-bottom: 2px solid transparent; }
.main-nav a:hover { border-bottom-color: var(--red); }
.auth-area { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.hello { font-size: .9rem; color: var(--gray-text); margin-right: 6px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; padding: 10px 20px; border-radius: 8px;
  background: var(--navy); color: var(--white); font-weight: 600; font-size: .9rem;
  border: 1px solid var(--navy); cursor: pointer; transition: all .15s ease;
}
.btn:hover { background: var(--navy-light); color: var(--white); }
.btn-outline { background: transparent; color: var(--navy); }
.btn-outline:hover { background: var(--navy); color: var(--white); }
.btn-sm { padding: 7px 14px; font-size: .85rem; }
.btn-danger { background: var(--red); border-color: var(--red); }
.btn-danger:hover { background: #b93737; }
.btn-success { background: var(--green); border-color: var(--green); }
.btn-success:hover { background: #257e49; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Hero / Search ---------- */
.hero {
  background: linear-gradient(160deg, var(--navy) 0%, #16294a 60%, #0c1a30 100%);
  color: var(--white); padding: 64px 20px 80px; text-align: center; position: relative; overflow: hidden;
}
.hero::before {
  content: "🛡"; position: absolute; font-size: 380px; opacity: .04; top: -100px; right: -60px;
  transform: rotate(-12deg);
}
.hero h1 { font-size: 2.1rem; margin-bottom: 10px; position: relative; }
.hero p.sub { color: #B9C6DA; font-size: 1.05rem; max-width: 600px; margin: 0 auto 32px; position: relative; }

.search-box {
  max-width: 640px; margin: 0 auto; background: var(--white); border-radius: 14px;
  padding: 8px; box-shadow: var(--shadow-lg); display: flex; gap: 8px; position: relative;
}
.search-box select {
  border: none; background: var(--bg); border-radius: 8px; padding: 0 12px; font-family: inherit;
  font-size: .9rem; font-weight: 600; color: var(--navy); flex-shrink: 0;
}
.search-box input[type=text] {
  flex: 1; border: none; outline: none; padding: 14px 12px; font-size: 1rem; font-family: inherit;
}
.search-box button {
  background: var(--red); color: var(--white); border: none; border-radius: 8px; padding: 0 26px;
  font-weight: 700; cursor: pointer; font-size: .95rem;
}
.search-box button:hover { background: #b93737; }

.stats-row { display: flex; justify-content: center; gap: 40px; margin-top: 36px; position: relative; flex-wrap: wrap; }
.stat-item { text-align: center; }
.stat-item .num { font-family: 'Sora', sans-serif; font-size: 1.8rem; font-weight: 800; color: var(--white); }
.stat-item .label { font-size: .82rem; color: #9FB0C7; }

/* ---------- Sections / Cards ---------- */
.section { padding: 48px 0; }
.section-title { text-align: center; margin-bottom: 32px; }
.section-title h2 { font-size: 1.5rem; }
.section-title p { color: var(--gray-text); }

.card {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }

.form-narrow { max-width: 480px; margin: 40px auto; }

/* ---------- Result Card ---------- */
.result-card { border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-lg); margin: 32px 0; }
.result-header { padding: 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.result-header.risk-high { background: var(--red-bg); border-bottom: 3px solid var(--red); }
.result-header.risk-medium { background: var(--amber-bg); border-bottom: 3px solid var(--amber); }
.result-header.risk-low { background: var(--green-bg); border-bottom: 3px solid var(--green); }
.result-header.risk-unknown { background: #EEF1F6; border-bottom: 3px solid #A9B6C9; }
.result-identifier { font-family: 'Sora', sans-serif; font-size: 1.4rem; font-weight: 800; }
.result-meta { color: var(--gray-text); font-size: .88rem; margin-top: 4px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: .9rem; }
.badge-high { background: var(--red); color: var(--white); }
.badge-medium { background: var(--amber); color: var(--white); }
.badge-low { background: var(--green); color: var(--white); }
.badge-unknown { background: #A9B6C9; color: var(--white); }

.result-body { background: var(--white); padding: 24px; }
.report-item { border-bottom: 1px solid var(--border); padding: 18px 0; }
.report-item:last-child { border-bottom: none; }
.report-item h4 { font-size: 1rem; margin-bottom: 4px; }
.report-item .meta { font-size: .82rem; color: var(--gray-text); margin-bottom: 8px; }
.report-item p { font-size: .93rem; color: #33445E; }
.evidence-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.evidence-thumbs img { width: 90px; height: 90px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.form-group .hint { font-size: .8rem; color: var(--gray-text); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=number], input[type=date], input[type=file], textarea, select {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: .95rem; background: var(--white); color: var(--navy);
}
textarea { min-height: 120px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--navy-light); outline-offset: 1px; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* ---------- Alerts ---------- */
.alert { padding: 14px 18px; border-radius: 8px; margin: 16px 0; font-size: .92rem; font-weight: 500; }
.alert-error { background: var(--red-bg); color: #A02E2E; border: 1px solid #F3B9B9; }
.alert-success { background: var(--green-bg); color: #1E7A45; border: 1px solid #A9DABE; }
.alert-info { background: #E9F1FB; color: #1B4B87; border: 1px solid #BBD5F2; }

/* ---------- List page ---------- */
.filter-bar { display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; }
.filter-bar select, .filter-bar input { max-width: 220px; }
table.data-table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.data-table th, table.data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: .9rem; }
table.data-table th { background: var(--navy); color: var(--white); font-weight: 600; }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover { background: #FAFBFD; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: #B9C6DA; padding: 32px 0; margin-top: 60px; }
.footer-inner { text-align: center; }
.footer-inner p { margin: 4px 0; font-size: .85rem; }
.footer-note { color: #7C8CA5; max-width: 600px; margin: 8px auto 0; font-size: .78rem; }

/* ---------- Admin ---------- */
.admin-layout { display: flex; min-height: calc(100vh - 60px); }
.admin-sidebar { width: 220px; background: var(--navy); color: var(--white); padding: 24px 0; flex-shrink: 0; }
.admin-sidebar a { display: block; padding: 12px 24px; color: #B9C6DA; font-weight: 600; font-size: .9rem; }
.admin-sidebar a:hover, .admin-sidebar a.active { background: var(--navy-light); color: var(--white); }
.admin-content { flex: 1; padding: 32px; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); border-left: 4px solid var(--navy); }
.stat-card .num { font-family: 'Sora', sans-serif; font-size: 1.7rem; font-weight: 800; }
.stat-card .label { font-size: .82rem; color: var(--gray-text); }

.action-buttons { display: flex; gap: 8px; }

@media (max-width: 768px) {
  .header-inner { flex-wrap: wrap; }
  .main-nav { order: 3; width: 100%; justify-content: flex-start; gap: 16px; overflow-x: auto; }
  .search-box { flex-direction: column; }
  .search-box select { width: 100%; padding: 10px; }
  .form-row { flex-direction: column; gap: 0; }
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; display: flex; overflow-x: auto; padding: 8px; }
  .admin-sidebar a { padding: 10px 16px; white-space: nowrap; }
}
