/* ============================
   GLOBAL PAGE
============================= */
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: #008758;
  padding: 20px;
  color: #222;
}

/* ============================
   HEADER BAR
============================= */
.top-bar {
  background: #ffffff;
  border-radius: 16px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.top-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
}

.logo {
  height: 40px;
  width: auto;
}

.logo-text {
  font-size: 18px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 180px;
}

#date {
  font-size: 14px;
  color: #555;
}

#clock {
  font-size: 17px;
  font-weight: bold;
}

/* ============================
   RESPONSIVE
============================= */
@media (max-width: 1100px) {
  .boards-row {
    flex-direction: column;
  }
  .board-section {
    width: 100%;   /* ให้กล่องแต่ละฝั่งเต็มความกว้างบนจอเล็ก */
  }
}

@media (max-width: 900px) {
  .top-right {
    width: 100%;
    align-items: flex-start;
  }
  .logo-text {
    white-space: normal;
  }
}

/* ============================
   CONTROL ROW
============================= */
.control-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
  gap: 12px;
}

.left-controls {
  display: flex;
  gap: 12px;
}

.date-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.nav-btn,
.today-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

.nav-btn {
  background: #eeeeee;
}

.today-btn {
  background: #004e33;
  color: #ffffff;
}

/* วันที่ที่เลือก */
#selected-date-label {
  background: #ffffff;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  color: #111827;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  min-width: 160px;
  text-align: center;
  display: inline-block;
}

/* ============================
   BOARDS ROW
============================= */
.boards-row {
  display: flex;
  gap: 16px;
  align-items: stretch;   /* ให้กล่องสูงเท่ากันและกินเต็ม */
  margin-top: 4px;
  width: 100%;
}

.board-section {
  flex: 1 1 0;
  min-width: 0;
}

/* ============================
   BOARD LABEL – ARR / DEP
============================= */
.board-title-row {
  margin-bottom: 10px;
}

.board-title-row-arr {
  text-align: left;
}

.board-title-row-dep {
  text-align: left;  /* DEPARTURES ชิดซ้ายเหมือนกัน */
}

/* ตรงนี้แก้ให้แถบยาวเท่ากับความกว้างของตารางของตัวเอง */
.board-label {
  background: #ffffff;
  border-radius: 16px;
  padding: 10px 20px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #111827;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;              /* ยืดเต็ม width ของ board-section */
  box-sizing: border-box;
}

/* ไอคอนท้ายคำว่า ARRIVALS / DEPARTURES */
.board-icon {
  height: 20px;
  width: auto;
  opacity: 0.85;
}

/* ============================
   TABLE
============================= */
.table-wrapper {
  background: #ffffff;
  padding: 12px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  width: 100%;              /* ให้กล่องตารางเต็มความกว้าง */
  box-sizing: border-box;
}

.flight-table {
  width: 100%;
  border-collapse: collapse;
}

.flight-table th {
  background: #f3f3f3;
  padding: 14px 6px;
  text-align: left;
  font-size: 14px;
  border-bottom: 1px solid rgba(0,0,0,0.12);
}

.flight-table th:last-child {
  text-align: center;
}

.flight-table td {
  padding: 16px 6px;
  font-size: 15px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.flight-table td:last-child {
  text-align: center;
}

.airport-code {
  font-size: 16px;
  font-weight: 700;
}

.airport-name {
  font-size: 12px;
  color: #666;
}

/* ============================
   TIME INPUT (ETA / ETD)
============================= */
.time-input {
  width: 72px;
  text-align: center;
  padding: 6px 0;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.05s ease;
}

.time-input:hover {
  background: #eef2ff;
  border-color: #4f46e5;
  box-shadow: 0 0 0 1px rgba(79,70,229,0.15);
}

.time-input:active {
  transform: scale(0.97);
}

/* ============================
   GATE SELECT
============================= */
.cell-select {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.05s ease;
}

.cell-select:hover {
  background: #eef2ff;
  border-color: #4f46e5;
}

/* ============================
   STATUS DOT
============================= */
.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
  margin: 0 auto;
}

.status-green {
  background: #22c55e; /* On Time */
}

.status-red {
  background: #ef4444; /* Delayed */
}

.status-blue {
  background: #3b82f6; /* Confirmed */
}

/* เผื่อทำ fade animation ภายหลัง */
.status-fade-out {
  opacity: 0;
  transition: opacity 0.4s;
}

.status-fade-in {
  opacity: 1;
  transition: opacity 0.4s;
}

/* ============================
   LEGEND
============================= */
.legend-wrapper {
  margin-top: 16px;
}

.legend-bar {
  background: #ffffff;
  border-radius: 16px;
  padding: 8px 16px;
  max-width: 100%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.16);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  font-size: 13px;
  color: #111827;
  box-sizing: border-box;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
}

.legend-dot.legend-green { background: #22c55e; }
.legend-dot.legend-red   { background: #ef4444; }
.legend-dot.legend-blue  { background: #3b82f6; }

/* ============================
   TIME PICKER
============================= */
#time-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tp-hidden {
  display: none !important;
}

.time-picker {
  background: #ffffff;
  padding: 20px;
  border-radius: 16px;
  width: 360px;
}

.tp-section {
  margin-bottom: 14px;
}

.tp-title {
  font-weight: 700;
  margin-bottom: 8px;
}

.tp-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.tp-option {
  padding: 10px;
  background: #eeeeee;
  border-radius: 8px;
  border: none;
  cursor: pointer;
}

.tp-option-selected {
  background: #0a7f5a;
  color: #ffffff;
}

.tp-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.tp-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
}

.tp-btn.cancel {
  background: #dddddd;
}

.tp-btn.ok {
  background: #0a7f5a;
  color: #ffffff;
}

/* ============================
   FOOTER VERSION
============================= */
.footer-version {
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: #ffffffaa;
  letter-spacing: 0.05em;
  padding: 10px 0;
}