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

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Tông màu Đỏ - Vàng Chính Phủ */
  --bg-base:      #f4f6f9;
  --bg-card:      #ffffff;
  --bg-card-2:    #f8fafc;
  --bg-hover:     #f1f5f9;
  --border:       #e2e8f0;
  --border-focus: #c2211a;

  --red-primary:  #da251d;
  --red-dark:     #b91c1c;
  --red-glow:     rgba(218,37,29,0.15);
  --red-badge:    #fee2e2;

  --gold-primary: #fec006;
  --gold-dark:    #d97706;
  --gold-light:   #fef08a;
  --gold-badge:   rgba(254,192,6,0.15);

  --green:        #16a34a;
  --green-bg:     #dcfce7;
  --green-border: rgba(22,163,74,0.3);
  --amber:        #d97706;
  --amber-bg:     #fef3c7;
  --amber-border: rgba(217,119,6,0.3);
  --red:          #dc2626;
  --red-bg:       #fee2e2;
  --red-border:   rgba(220,38,38,0.3);
  --info:         #0284c7;
  --info-bg:      #e0f2fe;

  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #64748b;

  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   20px;

  --shadow-card: 0 4px 16px rgba(15,23,42,0.06);
  --shadow-btn:  0 2px 10px rgba(218,37,29,0.3);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 15px;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */
.gov-top-bar {
  background: #b91c1c;
  border-bottom: 3px solid var(--gold-primary);
  padding: 8px 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.gov-top-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

.gov-emblems {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gov-svg {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(254, 192, 6, 0.3);
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  flex-shrink: 0;
}

.gov-slogan {
  color: var(--gold-primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  font-family: system-ui, -apple-system, sans-serif;
}

@media (max-width: 640px) {
  .gov-slogan { font-size: 8px; font-weight: 700; letter-spacing: 0; }
  .gov-svg { width: 22px; height: 22px; }
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Header / Hero (Red/Gold Theme with Dong Son Drum watermark) ─────────── */
.hero {
  background: linear-gradient(135deg, #c2211a 0%, #981410 100%);
  border-bottom: 5px solid var(--gold-primary);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  margin-top: 24px;
  margin-bottom: 32px;
}

/* Watermarks Trống Đồng tả hữu */
.hero::before {
  content: '';
  position: absolute;
  top: 50%; left: 4%;
  transform: translateY(-50%);
  width: 200px;
  height: 200px;
  background: url('dong_son_drum.png') no-repeat center center;
  background-size: contain;
  opacity: 0.14;
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  top: 50%; right: 4%;
  transform: translateY(-50%);
  width: 200px;
  height: 200px;
  background: url('dong_son_drum.png') no-repeat center center;
  background-size: contain;
  opacity: 0.14;
  pointer-events: none;
}

@media (max-width: 768px) {
  .hero::before, .hero::after { display: none; }
  .hero { padding: 36px 16px; }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--gold-primary);
  border: 1px solid rgba(255,255,255,0.2);
  color: #7f1d1d;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.hero h1 {
  font-family: 'Times New Roman', Times, serif;
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.25;
  margin-bottom: 12px;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.25);
}

.hero h1 .accent {
  color: var(--gold-primary);
  text-shadow: 0 0 8px rgba(254,192,6,0.3);
}

.hero-sub {
  font-size: 0.95rem;
  color: #fee2e2;
  max-width: 600px;
  margin: 0 auto 24px;
  font-weight: 400;
}

.hero-chips {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  color: #ffffff;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 100px;
}

.chip .chip-icon { font-size: 12px; color: var(--gold-primary); }

/* ── Section divider ─────────────────────────────────────────────────────── */
.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1.5px;
  background: var(--border);
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
  transition: all 0.2s ease;
}

.card:hover {
  border-color: rgba(218,37,29,0.2);
  box-shadow: 0 6px 20px rgba(15,23,42,0.08);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}

.card-icon.blue  { background: var(--red-badge);   border: 1px solid var(--red-border);   color: var(--red-primary); }
.card-icon.green { background: var(--green-bg);    border: 1px solid var(--green-border); color: var(--green); }

.card-title   { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); }
.card-subtitle { font-size: 0.82rem; color: var(--text-secondary); margin-top: 1px; }

/* ── Template buttons ────────────────────────────────────────────────────── */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.template-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.template-btn:hover:not(:disabled) {
  border-color: var(--red-primary);
  background: #fffcfb;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(218,37,29,0.1);
}

.template-btn .btn-emoji { font-size: 22px; }
.template-btn .btn-label { font-weight: 700; color: #1e293b; }
.template-btn .btn-desc  { font-size: 11px; font-weight: 400; color: var(--text-secondary); line-height: 1.3; }

.template-btn.loading::after {
  content: '';
  width: 14px; height: 14px;
  border: 2px solid rgba(218,37,29,0.2);
  border-top-color: var(--red-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-top: 6px;
}

/* ── Doc type selector ───────────────────────────────────────────────────── */
.doc-type-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.doc-type-btn {
  flex: 1;
  min-width: 110px;
  padding: 10px 14px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: center;
}

.doc-type-btn:hover {
  border-color: var(--red-primary);
  color: var(--red-primary);
  background: #fffcfb;
}

.doc-type-btn.active {
  border-color: var(--red-primary);
  background: var(--red-badge);
  color: var(--red-primary);
}

/* ── Dropzone ─────────────────────────────────────────────────────────────── */
#dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-card-2);
  margin-bottom: 20px;
}

#dropzone:hover,
#dropzone.drag-over {
  border-color: var(--red-primary);
  background: var(--red-badge);
}

#dropzone.has-file {
  border-color: var(--green);
  background: var(--green-bg);
}

.dropzone-icon { font-size: 30px; margin-bottom: 8px; }
.dropzone-text { color: var(--text-secondary); font-size: 0.88rem; font-weight: 500; }
.dropzone-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

#file-label {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-top: 6px;
  word-break: break-all;
}

#file-input { display: none; }

#file-error {
  display: none;
  color: var(--red);
  font-size: 0.82rem;
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: var(--radius-sm);
}

/* ── Primary button (Red & Gold) ────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 20px;
  background: linear-gradient(135deg, var(--red-primary) 0%, var(--red-dark) 100%);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: all 0.2s ease;
  letter-spacing: 0.01em;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(218,37,29,0.45);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary.loading {
  pointer-events: none;
  opacity: 0.85;
}

.btn-primary.loading::after {
  content: '';
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Download button ─────────────────────────────────────────────────────── */
.btn-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 20px;
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(22,163,74,0.3);
  transition: all 0.2s ease;
}

.btn-download:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(22,163,74,0.45);
}

.btn-download.loading::after {
  content: '';
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Results panel ───────────────────────────────────────────────────────── */
#results-panel {
  display: none;
  animation: fadeUp 0.4s ease;
  border-top: 4px solid var(--red-primary);
}

.summary-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.summary-badge.clean     { background: var(--green-bg); border: 1px solid var(--green-border); color: #166534; }
.summary-badge.has-errors { background: var(--red-bg);   border: 1px solid var(--red-border);   color: #991b1b; }
.summary-badge.warnings  { background: var(--amber-bg); border: 1px solid var(--amber-border); color: #92400e; }

.badge-icon { font-size: 16px; }

.results-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 640px) {
  .results-cols { grid-template-columns: 1fr; }
}

.result-section { }
.result-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-section-title.fixes  { color: #15803d; }
.result-section-title.issues { color: #b45309; }

.result-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fix-item,
.issue-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
}

.fix-item {
  background: var(--green-bg);
  border: 1px solid var(--green-border);
}

.fix-icon   { color: var(--green); font-size: 13px; font-weight: 700; margin-top: 1px; flex-shrink: 0; }
.fix-item strong  { display: block; font-weight: 600; color: #14532d; }
.fix-detail { display: block; color: #15803d; font-size: 0.78rem; margin-top: 1px; }

.issue-item { align-items: flex-start; }
.issue-error   { background: var(--red-bg);   border: 1px solid var(--red-border); }
.issue-warning { background: var(--amber-bg); border: 1px solid var(--amber-border); }
.issue-info    { background: var(--info-bg);  border: 1px solid rgba(2,132,199,0.2); }

.issue-icon { font-size: 13px; margin-top: 1px; flex-shrink: 0; }
.issue-item strong  { display: block; font-weight: 600; }
.issue-error strong { color: #7f1d1d; }
.issue-warning strong { color: #78350f; }
.issue-info strong { color: #0369a1; }

.issue-detail { display: block; font-size: 0.78rem; margin-top: 1px; }
.issue-error .issue-detail { color: #b91c1c; }
.issue-warning .issue-detail { color: #b45309; }
.issue-info .issue-detail { color: #0284c7; }

.no-items {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-style: italic;
  padding: 8px 12px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* ── Global error toast ──────────────────────────────────────────────────── */
#global-error {
  display: none;
  position: fixed;
  top: 20px;
  right: 20px;
  max-width: 360px;
  padding: 14px 18px;
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: var(--radius-md);
  color: var(--red-primary);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(220,38,38,0.15);
  z-index: 100;
  animation: slideIn 0.3s ease;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 32px 0 24px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

.footer a { color: var(--text-secondary); text-decoration: none; font-weight: 600; }
.footer a:hover { color: var(--red-primary); }

/* ── Info box (Light Blue) ──────────────────────────────────────────────── */
.info-box {
  background: var(--info-bg);
  border: 1px solid rgba(2,132,199,0.15);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.82rem;
  color: #0369a1;
  line-height: 1.6;
  margin-bottom: 24px;
}

.info-box strong { font-weight: 700; color: #0284c7; }

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Scrollbar (Webkit) ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
