:root {
  /* กรมท่า + เขียวคราม (#009688) */
  --elect-primary: #12315b;         /* กรมท่า */
  --elect-primary-dark: #0d2442;    /* กรมท่าเข้ม */
  --elect-secondary: #009688;       /* เขียวคราม */
  --elect-bg: #f0f4f8;
  --elect-card-border: rgba(18, 49, 91, 0.12);
  --elect-header-gradient: linear-gradient(135deg, #12315b 0%, #009688 100%);
  --elect-schedule-header: linear-gradient(135deg, #12315b 0%, #009688 100%);
  --elect-candidate-header: linear-gradient(135deg, #009688 0%, #0d2442 100%);
  --elect-rank-header: linear-gradient(135deg, #12315b 0%, #006e60 100%);
}

body {
  /* ฟอนต์และขนาดมาจาก fontface.php (Google Sans 100%) */
  background-color: var(--elect-bg);
}

#content-wrapper {
  background-color: var(--elect-bg);
}

/* แถบหัวข้อเต็มความกว้าง ใช้ร่วมกัน */
.name-list-page-banner,
.index-page-banner {
  width: 100%;
  background: linear-gradient(120deg, #12315b 0%, #1b4679 35%, #009688 70%, #006e60 100%);
  background-size: 200% 100%;
  color: #fff;
  padding: 1rem 0;
  margin-bottom: 1.5rem;
  box-shadow: 0 0.25rem 0.5rem rgba(30, 73, 118, 0.25);
}

.name-list-page-banner .banner-inner,
.index-page-banner .banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0 1.5rem;
}

.name-list-page-banner h1,
.index-page-banner h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ขนาดมาตรฐานสำหรับ page title ทุกหน้า */
.page-title-main {
  font-size: 1.5rem;
  font-weight: 700;
}

.name-list-page-banner .btn-banner {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.5);
  color: #fff;
  padding: 0.4rem 0.9rem;
  border-radius: 0.35rem;
  font-size: 0.9rem;
  white-space: nowrap;
}

.name-list-page-banner .btn-banner:hover {
  background: rgba(255,255,255,0.3);
  border-color: rgba(255,255,255,0.8);
  color: #fff;
}

/* การ์ดและตารางหลัก ใช้กับหลายหน้า */
.index-page .card,
.candidate-page .card,
.result-page .card,
.name-list-page .card,
.statistic-page .card {
  border: 1px solid var(--elect-card-border);
  border-radius: 0.5rem;
  box-shadow: 0 0.125rem 0.35rem rgba(0,0,0,0.06);
  overflow: hidden;
}

.candidate-page .table thead th,
.result-page .table-result thead th,
.index-page .table thead th,
.name-list-page .table thead th,
.statistic-page .table thead th {
  border: none;
  font-weight: 600;
  padding: 0.75rem;
}

/* ตารางข้อมูลหลัก: ใช้หัวตารางโทนเดียวกับ schedule (!important เพื่อไม่ให้ถูก sb-admin-2/Bootstrap ทับ) */
.schedule-page .table thead th,
.statistic-page .table thead th,
.name-list-page .table thead th {
  background: var(--elect-schedule-header) !important;
  color: #fff !important;
}

.candidate-page .table tbody td,
.result-page .table-result tbody td,
.index-page .table tbody td,
.name-list-page .table tbody td,
.statistic-page .table tbody td {
  padding: 0.65rem 0.75rem;
  vertical-align: middle;
}

.candidate-page .table-striped tbody tr:nth-of-type(odd),
.index-page .table-striped tbody tr:nth-of-type(odd),
.name-list-page .table-striped tbody tr:nth-of-type(odd),
.statistic-page .table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(240, 244, 248, 0.6);
}

.candidate-page .table-bordered,
.index-page .table-bordered,
.name-list-page .table-bordered,
.statistic-page .table-bordered {
  border-radius: 0.35rem;
  overflow: hidden;
}

/* KPI กลาง */
.candidate-page .kpi-row .kpi-card,
.index-kpi .kpi-card,
.result-summary .kpi-card {
  border: 1px solid var(--elect-card-border);
  border-radius: 0.5rem;
  background: #fff;
  box-shadow: 0 0.125rem 0.35rem rgba(0,0,0,0.06);
}

.candidate-page .kpi-label,
.index-kpi .kpi-label,
.result-summary .kpi-label {
  color: #6c757d;
  letter-spacing: 0.02em;
}

.candidate-page .kpi-value,
.index-kpi .kpi-value,
.result-summary .kpi-value {
  font-weight: 700;
  font-size: 1.15rem;
  color: #1f2937;
}

.candidate-page .kpi-icon,
.index-kpi .kpi-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background: rgba(30, 73, 118, 0.08);
  color: var(--elect-primary);
}

/* candidate.php - รูปในตารางผู้สมัคร */
.candidate-page .cand-photo {
  width: 40px;
  height: 50px;
  object-fit: cover;
  object-position: top;
}

/* หน้าเลือกตั้ง (polling) */
.polling-page .ballot-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.polling-page .ballot-choice {
  position: relative;
  cursor: default;
}

.polling-page .ballot-mark {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  border: 4px solid #333333;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333333;
  background: #ffffff;
  font-size: 48px;
  font-weight: bold;
  cursor: pointer;
  z-index: 2;
}

.polling-page .ballot-mark i {
  display: none; /* ใช้ตัวอักษร ✕ แบบ vote.php แทนไอคอน */
}

.polling-page .ballot-choice.selected .ballot-mark {
  background: var(--elect-secondary);
  border-color: var(--elect-secondary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 150, 136, 0.35);
}

.polling-page .ballot-choice.selected .ballot-mark::after {
  content: '✕';
}

.polling-page .ballot-choice.no-vote .ballot-mark {
  border-color: #b91c1c;
}

.polling-page .ballot-choice.no-vote.selected .ballot-mark {
  background: linear-gradient(135deg, #f97373, #dc2626);
  box-shadow: 0 0.1rem 0.3rem rgba(185, 28, 28, 0.45);
}

.polling-page .ballot-card {
  position: relative;
  z-index: 1;
  border-radius: 0.75rem;
  border: 1px solid rgba(18, 49, 91, 0.14);
  background: #ffffff;
  box-shadow: 0 0.1rem 0.25rem rgba(0, 0, 0, 0.04);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.polling-page .ballot-card:hover {
  transform: translateY(-2px);
  border-color: rgba(18, 49, 91, 0.3);
  box-shadow: 0 0.4rem 0.9rem rgba(15, 23, 42, 0.12);
}

.polling-page .ballot-card-body {
  padding: 0.9rem 1rem;
}

.polling-page .ballot-cand-photo {
  width: 110px;
  height: 140px;
  object-fit: cover;
  object-position: top;
  border-radius: 0.5rem;
  border: 1px solid rgba(226, 232, 240, 0.9);
  background: #f8fafc;
}

.polling-page .ballot-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
}

.polling-page .ballot-number {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--elect-primary);
}

.polling-page .ballot-group-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--elect-secondary);
}

.polling-page .ballot-student-name {
  font-size: 0.98rem;
  color: #374151;
}

.polling-page .ballot-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: #047857;
}

.polling-page .ballot-action i {
  font-size: 2.4rem;
}

.polling-page .ballot-action small {
  font-size: 0.85rem;
}

.polling-page .ballot-card.no-vote {
  border-color: rgba(220, 38, 38, 0.45);
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.08), #ffffff);
}

/* เน้นการ์ดที่ถูกเลือกให้เด่นขึ้น */
.polling-page .ballot-choice.selected .ballot-card {
  border-color: var(--elect-secondary);
  box-shadow: 0 0.35rem 0.9rem rgba(0, 150, 136, 0.35);
  background: linear-gradient(135deg, rgba(0, 150, 136, 0.06), #ffffff);
}

.polling-page .ballot-choice.no-vote.selected .ballot-card.no-vote {
  border-color: #dc2626;
  box-shadow: 0 0.35rem 0.9rem rgba(220, 38, 38, 0.35);
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.16), #ffffff);
}

.polling-page .ballot-card.no-vote .ballot-number,
.polling-page .ballot-card.no-vote .ballot-group-name,
.polling-page .ballot-card.no-vote .ballot-student-name {
  color: #b91c1c;
}

.polling-page .ballot-card.no-vote .ballot-action {
  color: #b91c1c;
}

.polling-page .ballot-helper-text {
  font-size: 0.9rem;
  color: #4b5563;
}

/* ปุ่มยืนยันการเลือกตั้ง */
.polling-page .polling-confirm-row {
  margin-top: 1.5rem;
}

.polling-page #btnConfirmVote {
  min-width: 260px;
  padding: 0.75rem 1.75rem;
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: 999px;
  box-shadow: 0 0.25rem 0.6rem rgba(18, 49, 91, 0.22);
}

.polling-page #btnConfirmVote i {
  margin-right: 0.4rem;
}

.polling-page .polling-confirm-hint {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: #6b7280;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

/* กล่องแจ้งเตือนกรณีโหวตแล้ว */
.polling-page .polling-voted-alert {
  margin-top: 1rem;
  padding: 1.25rem 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(16, 185, 129, 0.35);
  background: linear-gradient(135deg, rgba(209, 250, 229, 0.8), #ffffff);
  box-shadow: 0 0.2rem 0.6rem rgba(16, 185, 129, 0.25);
}

.polling-page .polling-voted-icon {
  font-size: 2.2rem;
  color: #10b981;
  margin-bottom: 0.35rem;
}

.polling-page .polling-voted-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: #064e3b;
}

.polling-page .polling-voted-time {
  margin-top: 0.25rem;
  font-size: 0.9rem;
  color: #065f46;
}

.polling-page .polling-voted-hint {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: #4b5563;
}

/* กล่องแจ้งเตือนกำหนดเวลาเลือกตั้ง / แจ้งสถานะยังไม่สิ้นสุดการเลือกตั้ง
   ใช้กับกล่องที่ใช้คลาส polling-schedule-* ทุกหน้า */
.polling-schedule-alert {
  margin-top: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(248, 180, 0, 0.45);
  background: linear-gradient(135deg, rgba(254, 243, 199, 0.9), #ffffff);
  box-shadow: 0 0.2rem 0.6rem rgba(180, 83, 9, 0.18);
}

.polling-schedule-icon {
  font-size: 2rem;
  color: #d97706;
  margin-bottom: 0.25rem;
}

.polling-schedule-title {
  font-weight: 700;
  font-size: 1rem;
  color: #92400e;
}

.polling-schedule-time,
.polling-schedule-hint {
  margin-top: 0.4rem;
  font-size: 0.9rem;
  color: #6b7280;
}

/* รายละเอียดผู้สมัคร (show_candidate.php) */
.candidate-page .candidate-detail-card {
  border: 1px solid var(--elect-card-border);
  border-radius: 0.75rem;
  box-shadow: 0 0.12rem 0.35rem rgba(0,0,0,0.06);
  margin-bottom: 1.25rem;
  background: #ffffff;
}

.candidate-page .candidate-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.6rem 0.8rem;
  border-radius: 0.6rem;
  background: var(--elect-candidate-header);
  color: #ffffff;
}

/* ส่วนหัวการ์ดผลการเลือกตั้ง (result.php) */
.result-card-header {
  background: var(--elect-schedule-header);
  color: #ffffff;
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-bottom: none;
}

.result-card-header .small {
  color: rgba(255, 255, 255, 0.9);
}

.candidate-page .candidate-number-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.candidate-page .candidate-number-pill .label {
  font-size: 0.85rem;
  opacity: 0.9;
}

.candidate-page .candidate-number-pill .value {
  font-weight: 700;
  font-size: 1.15rem;
}

.candidate-page .candidate-group-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  font-size: 0.9rem;
}

.candidate-page .candidate-section {
  margin-top: 1.25rem;
}

.candidate-page .candidate-section-title {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--elect-primary);
  margin-bottom: 0.35rem;
}

.candidate-page .candidate-policy-content {
  max-height: 260px;
  overflow-y: auto;
  border-radius: 0.5rem;
  border: 1px solid rgba(209, 213, 219, 0.9);
  padding: 0.75rem 0.9rem;
  background-color: #f9fafb;
}

@media (max-width: 768px) {
  .polling-page .ballot-card-body {
    padding: 0.8rem 0.85rem;
  }
  .polling-page .ballot-cand-photo {
    width: 96px;
    height: 120px;
  }
}

