:root {
  --green-dark: #0b5d45;
  --green: #12805f;
  --green-light: #e6f4ee;
  --gold: #d4a537;
  --red: #c53030;
  --ink: #1f2a24;
  --muted: #667a70;
  --border: #dfe8e3;
  --bg: #f4f8f6;
  --surface: #ffffff;
  --surface-2: #fbfdfc;
  --row-hover: #fafdfb;
  --card-shadow: 0 10px 30px rgba(11, 93, 69, 0.08);
  --radius: 16px;
}

/* ---------- Chế độ tối (dark mode) ---------- */
[data-theme="dark"] {
  --green-dark: #12b98a;
  --green: #17d19c;
  --green-light: #123128;
  --gold: #e6bd5a;
  --red: #ef6767;
  --ink: #e9f3ee;
  --muted: #9db3ab;
  --border: #24352e;
  --bg: #0f1713;
  --surface: #16211c;
  --surface-2: #1b2721;
  --row-hover: #1c2822;
  --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Be Vietnam Pro", Roboto, Arial, sans-serif;
  line-height: 1.55;
  transition: background .2s ease, color .2s ease;
}

.flag-bar {
  height: 6px;
  background: linear-gradient(90deg, var(--green-dark), var(--gold), var(--green-dark));
}

a { color: var(--green-dark); }

/* ---------- Header ---------- */
.site-header {
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  color: #fff;
  padding: 18px 20px;
}
.header-inner {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand img {
  height: 46px;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
  padding: 4px 8px;
}
.brand-text .name {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.5px;
}
.brand-text .slogan {
  font-size: 13px;
  opacity: 0.9;
}
.header-contact {
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.header-contact a {
  color: #fff;
  text-decoration: none;
  background: rgba(255,255,255,0.15);
  padding: 8px 14px;
  border-radius: 30px;
  font-weight: 600;
  transition: background .2s ease;
  white-space: nowrap;
}
.header-contact a:hover { background: rgba(255,255,255,0.28); }

/* ---------- Công tắc Sáng / Tối ---------- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  padding: 8px 14px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background .2s ease;
  font-family: inherit;
}
.theme-toggle:hover { background: rgba(255,255,255,0.28); }
.theme-toggle .icon { font-size: 15px; line-height: 1; }

/* ---------- Ảnh cờ quốc gia (jpg thật, có fallback emoji) ---------- */
.flag-wrap {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(0,0,0,0.18);
  background: var(--green-light);
}
.flag-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.flag-fallback {
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.hero {
  max-width: 980px;
  margin: 28px auto 0;
  padding: 0 20px;
  text-align: center;
}
.hero .hero-flag {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}
.hero h1 {
  font-size: clamp(22px, 4vw, 32px);
  margin: 0 0 10px;
  color: var(--green-dark);
}
.hero p {
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto;
}

/* ---------- Layout ---------- */
.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  padding: 22px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--green-light);
}
.card-header h2 {
  margin: 0;
  color: var(--green-dark);
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.card-body { padding: 28px; }

/* ---------- Alert ---------- */
.alert {
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 22px;
  font-size: 15px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.alert-success {
  background: var(--green-light);
  border: 1px solid var(--green);
  color: var(--green-dark);
}
.alert-error {
  background: rgba(197, 48, 48, 0.1);
  border: 1px solid var(--red);
  color: var(--red);
}
.alert ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- Form ---------- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 20px;
}
.form-grid .full { grid-column: 1 / -1; }

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

.field label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--ink);
}
.field .required { color: var(--red); }
.field .hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="date"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease, background .2s ease;
}
textarea { resize: vertical; min-height: 90px; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(18, 128, 95, 0.15);
}

/* Chọn ngày trên nền tối: đổi biểu tượng lịch cho dễ nhìn */
[data-theme="dark"] input[type="date"] { color-scheme: dark; }

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
}
.checkbox-row input { margin-top: 3px; }

.honeypot { position: absolute; left: -9999px; opacity: 0; height: 0; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--green-dark);
  color: #fff;
  border: none;
  padding: 13px 26px;
  border-radius: 30px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease;
  text-decoration: none;
}
.btn:hover { background: var(--green); transform: translateY(-1px); }
.btn.secondary {
  background: var(--surface);
  color: var(--green-dark);
  border: 1px solid var(--green);
}
.btn.secondary:hover { background: var(--green-light); }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #a52a2a; }

.actions-note {
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 26px 20px 40px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Admin table ---------- */
.table-wrap { overflow-x: auto; }
table.students {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 900px;
}
table.students th, table.students td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
table.students th {
  background: var(--green-light);
  color: var(--green-dark);
  position: sticky;
  top: 0;
}
table.students tr:hover td { background: var(--row-hover); }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.badge {
  display: inline-block;
  background: var(--gold);
  color: #4a3900;
  font-weight: 700;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
}

.login-box {
  max-width: 380px;
  margin: 60px auto;
}

/* ---------- Trang chủ: danh sách chương trình (bố cục 1 card, giống bản gốc) ---------- */
.program-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.program-row {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 18px 22px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  text-decoration: none;
  color: inherit;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.program-row:hover {
  border-color: var(--green);
  background: var(--green-light);
  transform: translateX(4px);
}
.program-row .info { flex: 1 1 auto; min-width: 0; }
.program-row .info h3 { margin: 0 0 4px; font-size: 19px; color: var(--green-dark); }
.program-row .info p { margin: 0; font-size: 14px; color: var(--muted); }
.program-row .cta {
  flex: 0 0 auto;
  font-weight: 700;
  font-size: 14px;
  color: var(--green-dark);
  white-space: nowrap;
}

@media (max-width: 620px) {
  .program-row { flex-wrap: wrap; gap: 12px; }
  .program-row .cta { margin-left: auto; }
}

/* ---------- Trang quản trị: bộ chọn quốc gia (cờ to, trong cùng 1 card) ---------- */
.program-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.program-picker a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 108px;
  padding: 12px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  text-decoration: none;
  color: var(--ink);
  text-align: center;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.program-picker a:hover { transform: translateY(-2px); border-color: var(--green); }
.program-picker a.active {
  background: var(--green-light);
  border-color: var(--green-dark);
}
.program-picker .label { font-size: 12.5px; font-weight: 700; }
.program-picker .count {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--gold);
  padding: 1px 8px;
  border-radius: 10px;
}
