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

/* ─── Color Palette ───────────────────────────────────────────
   Primary   : #B22222  (firebrick — แดงเข้มแบบอิฐ)
   Dark      : #8B0000  (dark red  — hover / sidebar)
   Light bg  : #F5E6E6  (แดงอ่อนมาก — background gradient)
   Card border: #D4A0A0
─────────────────────────────────────────────────────────────── */

* {
  font-family: 'Kanit', sans-serif;
  transition: all 0.2s ease;
}

body {
  background: linear-gradient(to right, #ffffff, #F5E6E6);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.box {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-y: auto;
}

/* HEADER */
header.text-bg-primary {
  background-color: #B22222 !important;
  color: white;
}

h1, h3 {
  font-weight: 600;
}

/* NAV-TABS */
.nav-tabs {
  border-bottom: 2px solid #B22222;
}

.nav-tabs .nav-link {
  border: none;
  color: #B22222;
  font-weight: 500;
}

.nav-tabs .nav-link:hover {
  background-color: #F5E6E6;
}

.tab-active,
.nav-tabs .nav-link.active {
  background-color: #B22222 !important;
  color: white !important;
  border-bottom-color: transparent !important;
}

/* STATUS CARDS */
.status-card {
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  background-color: #fff;
  border: 2px solid #D4A0A0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.status-icon {
  font-size: 2.5rem;
  padding: 12px;
  border-radius: 50%;
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-icon.blue  { background-color: #F5E6E6; color: #B22222; }
.status-icon.red   { background-color: #E8C0C0; color: #8B0000; }
.status-icon.green { background-color: #eaffea; color: #2c9464; }

.status-text {
  display: flex;
  flex-direction: column;
  color: #333;
}

.status-label  { font-size: 1.1rem; font-weight: 500; }
.status-number { font-size: 2rem;   font-weight: bold; }

/* TABLE */
#studentTable thead th,
.dt-container #studentTable thead th,
table.dataTable#studentTable thead th {
  background-color: #B22222 !important;
  color: #fff !important;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
}

#studentTable thead th:empty::before {
  content: '\00a0';
}

/* มือถือ: แถวขยาย responsive */
#studentTable ul.dtr-details {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0.75rem;
}
#studentTable ul.dtr-details li {
  padding: 0.25rem 0;
}
#studentTable .dtr-title {
  font-weight: 600;
  margin-right: 0.35rem;
}

@media (min-width: 992px) {
  #studentTable .student-col-address {
    max-width: 220px;
  }
}

/* MODAL */
.custom-modal-width .modal-dialog {
  max-width: 800px;
  min-width: 400px;
}

/* VIDEO / CANVAS */
video, canvas {
  display: block;
  margin: 10px auto;
  border: 2px solid #B22222;
  border-radius: 8px;
}

/* MAP */
#map, #longdoMap, .map-container {
  width: 100%;
  height: 400px;
  border: 2px solid #B22222;
  border-radius: 10px;
}

#map-full {
  width: 100%;
  height: calc(100vh - 120px);
  border: 2px solid #B22222;
  border-radius: 10px;
}

.school-tooltip {
  background-color: #FDF0F0;
  color: #222;
  font-weight: 500;
  font-size: 14px;
  border-radius: 6px;
  padding: 6px 10px;
  border: 1px solid #B22222;
}

/* Map pin markers */
.student-pin-marker,
.school-pin-marker {
  background: transparent;
  border: none;
}

.student-pin-marker-inner {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  white-space: nowrap;
}

.student-pin-shape {
  font-size: 32px;
  color: #d63447;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
  flex-shrink: 0;
}

.school-pin-shape {
  font-size: 32px;
  color: #2c9464;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.student-pin-label {
  font-size: 13px;
  font-weight: 600;
  color: #222;
  background: rgba(255, 255, 255, 0.95);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #B22222;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  margin-bottom: 4px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.std-tooltip {
  background-color: #F5E6E6;
  color: #222;
  font-weight: 500;
  font-size: 14px;
  border-radius: 6px;
  padding: 6px 10px;
  border: 1px solid #8B0000;
}

.leaflet-routing-container { display: none !important; }

/* FORM LABEL */
.form-label {
  font-weight: 500;
  color: #B22222;
}

/* BUTTONS */
.btn-primary {
  background-color: #B22222;
  border-color: #B22222;
}
.btn-primary:hover {
  background-color: #8B0000;
  border-color: #8B0000;
}
.btn-outline-danger {
  border-color: #B22222;
  color: #B22222;
}
.btn-outline-danger:hover {
  background-color: #B22222;
  color: white;
}

/* SIDEBAR (admin/teacher) */
.sidebar {
  min-height: 100vh;
  background-color: #8B0000;
  color: white;
  width: 240px;
  flex-shrink: 0;
}

.sidebar .nav-link {
  color: rgba(255,255,255,0.85);
  padding: 10px 16px;
  border-radius: 6px;
  margin-bottom: 2px;
}
.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  background-color: rgba(255,255,255,0.15);
  color: white;
}
.sidebar .nav-link i { margin-right: 8px; }

.main-content { flex: 1; overflow: auto; }

/* BADGE */
.badge-submitted { background-color: #198754; }
.badge-pending   { background-color: #8B0000; }

/* RESPONSIVE */
@media (max-width: 576px) {
  .status-number { font-size: 1.5rem; }
  .status-label  { font-size: 1rem; }
  .status-icon   { font-size: 2rem; width: 60px; height: 60px; }
  .custom-modal-width .modal-dialog { max-width: 100%; min-width: 95%; }
  .sidebar { width: 100%; min-height: auto; }
}
