/* 🌸 พื้นหลัง & ฟอนต์ */
body {
  font-family: 'Poppins', 'Prompt', sans-serif;
  background: linear-gradient(180deg, #fff8fa 0%, #ffeae5 100%);
  color: #4b3b30;
  margin: 0;
  padding: 0;
  text-align: center;
}

/* 🌸 Header */
header {
  background: linear-gradient(135deg, #ffd6e0, #ffe8d6);
  padding: 1.8rem 0 2.2rem 0;
  border-bottom: 3px solid #f5b8a1;
  box-shadow: 0 4px 12px rgba(255,192,203,0.2);
}

.logo {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

h1 {
  display: inline-block;
  color: #7b4b36;
  font-weight: 700;
  font-size: 26px;
  margin: 0;
}

/* 🌸 ปุ่มแท็บบริษัท */
.tab-buttons {
  margin: 35px 0 40px 0;
  text-align: center;
}

.tab-btn {
  background: #ffe0e9;
  border: none;
  color: #6f4f28;
  padding: 12px 28px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 500;
  font-size: 15px;
  margin: 0 12px;
  box-shadow: 0 3px 6px rgba(255,192,203,0.4);
  transition: all 0.25s ease;
}

.tab-btn.active,
.tab-btn:hover {
  background: #fcd5ce;
  color: #fff;
  transform: translateY(-3px);
  box-shadow: 0 5px 10px rgba(255,192,203,0.5);
}

/* 🌸 ตารางหลังบ้าน */
table {
  width: 95%;
  margin: 20px auto;
  border-collapse: collapse;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 0 12px rgba(255, 192, 203, 0.25);
}

th, td {
  padding: 10px;
  border: 1px solid #f4c7b8;
  text-align: center;
  font-size: 15px;
}

th {
  background: #fcd5ce;
  color: #6b3e2e;
  font-weight: 600;
}

tr:nth-child(even) td { background: #fff; }
tr:nth-child(odd) td { background: #fffafc; }

/* 🌸 Input และ Select */
input, select {
  width: 95%;
  border-radius: 8px;
  border: 1px solid #e7c9c9;
  padding: 7px;
  text-align: center;
  font-family: 'Poppins', sans-serif;
  background: #fffaf8;
  box-shadow: inset 0 1px 2px rgba(255,192,203,0.25);
  transition: 0.3s;
}

input:focus, select:focus {
  outline: none;
  border-color: #f5b8a1;
  box-shadow: 0 0 6px rgba(255,182,193,0.6);
}

/* 🌸 ปุ่ม Add Row */
button.add-btn {
  background: linear-gradient(135deg, #ffafbd, #ffc3a0);
  border: none;
  color: #fff;
  padding: 14px 36px;
  border-radius: 35px;
  cursor: pointer;
  font-size: 17px;
  font-weight: 600;
  margin-top: 25px;
  letter-spacing: 0.4px;
  box-shadow: 0 6px 14px rgba(255, 192, 203, 0.6);
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
button.add-btn::before {
  content: "➕";
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  margin-right: 6px;
}
button.add-btn:hover {
  background: linear-gradient(135deg, #ff9a9e, #fad0c4);
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(255, 182, 193, 0.55);
}
button.add-btn:active {
  transform: scale(0.97);
  box-shadow: 0 4px 10px rgba(255, 182, 193, 0.4);
}

/* 🌸 ปุ่ม Delete */
button.delete-btn {
  background: linear-gradient(135deg, #ffc1b6, #ff9a8b);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 18px;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 10px rgba(255, 182, 193, 0.35);
}
button.delete-btn:hover {
  background: linear-gradient(135deg, #ff9a8b, #ff7b74);
  transform: translateY(-3px);
}
button.delete-btn:active {
  transform: scale(0.97);
}

/* 🌸 เอฟเฟกต์ตอนบันทึก */
@keyframes savedGlow {
  0% { box-shadow: 0 0 0 rgba(255,192,203,0); transform: scale(1); }
  50% { box-shadow: 0 0 15px rgba(255,192,203,0.8); transform: scale(1.05); }
  100% { box-shadow: 0 0 0 rgba(255,192,203,0); transform: scale(1); }
}
input.saved, select.saved { animation: savedGlow 0.6s ease; }

/* 🌸 สีสถานะ */
.status-wait { background: #f7a86a; }
.status-customs { background: #f2cd5e; }
.status-leave { background: #7ec8ff; }
.status-arrived { background: #6acb8b; }

/* 🌸 Legend */
.status-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 15px;
  margin: 10px auto;
  font-size: 15px;
  color: #5a3d2f;
}
.status-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
}

/* 🌸 Filter Bar */
.filter-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: #fffafc;
  padding: 15px 25px;
  margin: 20px auto 25px;
  border-radius: 18px;
  box-shadow: 0 3px 10px rgba(255,192,203,0.25);
  max-width: 800px;
}
.filter-inputs {
  display: flex;
  gap: 10px;
  flex: 1;
  min-width: 280px;
}
.filter-buttons {
  display: flex;
  gap: 10px;
}
.filter-bar input[type="text"], 
.filter-bar input[type="date"] {
  border: 1px solid #f4c7b8;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  flex: 1;
  background: #fff;
  box-shadow: inset 0 1px 3px rgba(255,192,203,0.25);
  transition: 0.3s;
}
.filter-bar input:focus {
  outline: none;
  border-color: #f5a1a1;
  box-shadow: 0 0 5px rgba(255,182,193,0.6);
}

/* 🌸 ปุ่ม Export & ทั้งหมด */
.export-btn, .refresh-btn {
  border: none;
  padding: 10px 20px;
  border-radius: 25px;
  color: white;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 10px rgba(255,182,193,0.35);
}
.export-btn {
  background: linear-gradient(135deg, #ffafbd, #ffc3a0);
}
.export-btn:hover {
  background: linear-gradient(135deg, #ff9a9e, #fad0c4);
  transform: translateY(-2px);
}
.refresh-btn {
  background: linear-gradient(135deg, #a0e3b2, #7bc9a2);
}
.refresh-btn:hover {
  background: linear-gradient(135deg, #81d4a3, #5fb68a);
  transform: translateY(-2px);
}

/* 🌸 Summary Bar */
.summary-bar {
  font-weight: 600;
  color: #7b4b36;
  background: #fff4f5;
  border-radius: 12px;
  padding: 10px 20px;
  max-width: 780px;
  margin: 0 auto 10px;
  box-shadow: 0 2px 8px rgba(255,182,193,0.3);
  font-size: 15px;
}

/* 🌸 Pagination */
.pagination {
  margin: 10px auto 20px;
}
.page-btn {
  background: #ffe0e9;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  margin: 0 4px;
  cursor: pointer;
  color: #5a3d2f;
  box-shadow: 0 2px 5px rgba(255,192,203,0.3);
  transition: all 0.25s;
}
.page-btn:hover,
.page-btn.active {
  background: #fcbfb5;
  color: #fff;
  transform: translateY(-2px);
}

/* 🌸 Footer */
footer {
  margin-top: 20px;
  padding: 10px;
  color: #9c6644;
  font-size: 0.9em;
}

/* 🌈 Responsive (มือถือ) */
@media (max-width: 768px) {
  h1 { font-size: 20px; }
  .logo { width: 55px; height: 55px; }

  .tab-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 25px 0;
  }

  .tab-btn {
    width: 90%;
    max-width: 340px;
    margin: 6px 0;
    padding: 12px;
    font-size: 15px;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    font-size: 13px;
  }

  th, td {
    padding: 6px 8px;
  }

  button.add-btn {
    width: 80%;
  }

  .filter-bar {
    flex-direction: column;
    width: 95%;
    gap: 10px;
    padding: 10px;
  }

  .filter-bar input,
  .filter-bar select,
  .filter-bar button {
    width: 100%;
    max-width: 350px;
  }
}
/* 🌸 ปรับความสูงให้ select และปุ่มใน filter-bar */
.filter-bar select, .filter-bar input[type="date"] {
  height: 42px;
}

/* 🌸 ปุ่ม refresh และ export */
.refresh-btn, .export-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
}
/* 🌸 Summary Bar (หน้าบ้าน) */
.summary-bar {
  font-weight: 600;
  color: #7b4b36;
  background: #fff4f5;
  border-radius: 12px;
  padding: 10px 20px;
  max-width: 780px;
  margin: 20px auto 8px;
  box-shadow: 0 2px 8px rgba(255,182,193,0.3);
  font-size: 15px;
  text-align: center;
}
.pagination {
  margin: 12px auto 25px;
  text-align: center;
}
.page-btn {
  background: #ffe0e9;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  margin: 0 4px;
  cursor: pointer;
  color: #5a3d2f;
  box-shadow: 0 2px 5px rgba(255,192,203,0.3);
  transition: all 0.25s;
}
.page-btn:hover,
.page-btn.active {
  background: #fcbfb5;
  color: #fff;
  transform: translateY(-2px);
}
/* 🌸 ปรับเฉพาะช่องค้นหาใน "หน้าบ้าน" ให้ยาวและสวยเท่าหลังบ้าน */
#searchBox {
  flex: 1;
  min-width: 200px;
  width: 180px; /* ถ้าอยากให้ยาวขึ้น เพิ่มได้ เช่น 240px */
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid #f4c7b8;
  background: #fff;
  font-size: 14px;
  text-align: left;
  box-shadow: inset 0 1px 3px rgba(255,192,203,0.25);
  transition: 0.3s;
}

#searchBox:focus {
  outline: none;
  border-color: #f5a1a1;
  box-shadow: 0 0 5px rgba(255,182,193,0.6);
}
