/* ============================================================
   ระบบสมัครสอบและออกบัตรประจำตัวผู้เข้าสอบ - Stylesheet
   ============================================================ */
:root {
  --navy: #0b2f5e;
  --navy-dark: #071e3d;
  --gold: #c9a227;
  --gold-light: #e8c86b;
  --bg: #f4f6fb;
  --card-bg: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --danger: #d64545;
  --success: #1c8a4b;
  --warning: #b8860b;
  --radius: 12px;
  --shadow: 0 4px 16px rgba(11, 47, 94, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Noto Sans Thai', 'Sarabun', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

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

/* ---------- Layout ---------- */
.topbar {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 18px;
}
.topbar .brand .badge {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--navy-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
}
.topbar nav a {
  color: #eef2f9;
  margin-left: 18px;
  font-size: 14px;
  opacity: 0.9;
}
.topbar nav a:hover { opacity: 1; text-decoration: none; color: var(--gold-light); }

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

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 22px;
  border: 1px solid #eef1f6;
}
.card h2, .card h3 { margin-top: 0; color: var(--navy-dark); }

.page-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--navy-dark);
  margin-bottom: 4px;
  border-left: 5px solid var(--gold);
  padding-left: 12px;
}
.page-subtitle { color: var(--muted); margin-bottom: 24px; padding-left: 17px; font-size: 14px; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; color: var(--navy-dark); }
.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

input[type=text], input[type=password], input[type=tel], input[type=date],
input[type=number], input[type=email], select, textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #d7dce5;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(11,47,94,0.08);
}
.hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.required { color: var(--danger); }

input[type=file] {
  width: 100%;
  padding: 10px;
  border: 1.5px dashed #c6cdd9;
  border-radius: 8px;
  background: #fafbfd;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 11px 22px;
  border-radius: 8px;
  border: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-dark); text-decoration: none; }
.btn-gold { background: var(--gold); color: var(--navy-dark); }
.btn-gold:hover { background: var(--gold-light); text-decoration: none; }
.btn-outline { background: #fff; color: var(--navy); border: 1.5px solid var(--navy); }
.btn-outline:hover { background: #f0f4fa; text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Alerts / Badges ---------- */
.alert { padding: 13px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 14.5px; }
.alert-error { background: #fdecec; color: #a12727; border: 1px solid #f5c6c6; }
.alert-success { background: #eaf7ee; color: #1c6b3b; border: 1px solid #bfe6cc; }
.alert-warning { background: #fff8e6; color: #8a6300; border: 1px solid #f2dfa1; }
.alert-info { background: #eaf1fb; color: #1a4a86; border: 1px solid #c6d9f2; }
.alert ul { margin: 6px 0 0 18px; padding: 0; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12.5px; font-weight: 700; }
.badge-pending { background: #fff3d6; color: #8a6300; }
.badge-approved { background: #dff5e6; color: #1c6b3b; }
.badge-rejected { background: #fbe0e0; color: #a12727; }
.badge-cancelled { background: #eceff3; color: #5b6472; }

/* ---------- Table ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; border-bottom: 1px solid #eef1f6; text-align: left; }
th { background: #f7f9fc; color: var(--navy-dark); font-weight: 700; }
tr:hover td { background: #fafbfe; }

/* ---------- Landing hub ---------- */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 46px 36px;
  text-align: center;
  margin-bottom: 26px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 80% 0%, rgba(201,162,39,0.25), transparent 60%);
}
.hero h1 { font-size: 30px; margin: 0 0 8px; position: relative; }
.hero p { opacity: .9; margin: 0 0 24px; position: relative; }
.hero .actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; position: relative; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 800px) { .grid-3 { grid-template-columns: 1fr; } }
.feature { background: #fff; border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); border-top: 4px solid var(--gold); }
.feature h3 { margin-top: 0; color: var(--navy-dark); font-size: 16px; }
.feature p { color: var(--muted); font-size: 13.5px; margin-bottom: 0; }

/* ---------- Photo preview ---------- */
.photo-preview {
  width: 130px; height: 160px;
  border-radius: 8px;
  border: 2px solid #d7dce5;
  object-fit: cover;
  background: #f0f2f6;
}

.doc-status { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid #e5e9f0; border-radius: 8px; margin-bottom: 10px; }
.doc-status.uploaded { border-color: #bfe6cc; background: #f5fbf7; }

/* ---------- Ticket / Printable ---------- */
.ticket {
  width: 560px;
  max-width: 100%;
  border: 3px solid var(--navy);
  border-radius: 14px;
  padding: 0;
  margin: 0 auto;
  overflow: hidden;
  background: #fff;
}
.ticket-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: #fff;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.ticket-header .badge-icon {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--gold); color: var(--navy-dark);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 18px;
}
.ticket-header .title { font-weight: 800; font-size: 16px; }
.ticket-header .subtitle { font-size: 12.5px; opacity: .85; }
.ticket-body { display: flex; padding: 20px 22px; gap: 20px; }
.ticket-photo img {
  width: 110px; height: 140px; object-fit: cover;
  border: 2px solid var(--navy); border-radius: 6px;
}
.ticket-info { flex: 1; font-size: 14px; }
.ticket-info .name { font-size: 18px; font-weight: 800; color: var(--navy-dark); margin-bottom: 6px; }
.ticket-info table td { padding: 3px 0; border: none; font-size: 13.5px; }
.ticket-info table td:first-child { color: var(--muted); width: 90px; }
.ticket-footer {
  border-top: 1px dashed #ccc;
  padding: 14px 22px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--muted);
}
.ticket-barcode { text-align: center; padding: 6px 22px 18px; }

.application-doc { max-width: 760px; margin: 0 auto; background: #fff; padding: 40px; }
.application-doc h2 { text-align: center; color: var(--navy-dark); }
.application-doc .doc-photo { float: right; margin-left: 20px; }
.application-doc table.info-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.application-doc table.info-table td { padding: 6px 4px; border-bottom: 1px dotted #ccc; font-size: 14px; }
.application-doc table.info-table td:first-child { width: 220px; color: var(--muted); }

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: none; }
}

.footer {
  text-align: center; color: var(--muted); font-size: 13px; padding: 24px; margin-top: 20px;
}

.status-steps { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.status-steps .step { flex: 1; min-width: 120px; text-align: center; padding: 10px; border-radius: 8px; background: #eef2f8; font-size: 13px; font-weight: 700; color: var(--muted); }
.status-steps .step.active { background: var(--navy); color: #fff; }
.status-steps .step.done { background: #1c8a4b; color: #fff; }

.sidebar { display: grid; grid-template-columns: 220px 1fr; gap: 24px; }
@media (max-width: 800px) { .sidebar { grid-template-columns: 1fr; } }
.sidebar nav.side-nav { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px; height: fit-content; }
.sidebar nav.side-nav a { display: block; padding: 11px 14px; border-radius: 8px; color: var(--text); font-size: 14px; margin-bottom: 2px; }
.sidebar nav.side-nav a:hover { background: #f0f4fa; text-decoration: none; }
.sidebar nav.side-nav a.active { background: var(--navy); color: #fff; font-weight: 700; }

.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
@media (max-width: 800px) { .stat-cards { grid-template-columns: repeat(2, 1fr); } }
.stat-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; border-left: 4px solid var(--gold); }
.stat-card .num { font-size: 28px; font-weight: 800; color: var(--navy-dark); }
.stat-card .lbl { color: var(--muted); font-size: 13px; }

.search-bar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.search-bar input, .search-bar select { max-width: 240px; }
