/* ============================================================
   FAST-SEARCH — Left Side Panel Styles
   Styles สำหรับฝั่งซ้าย (Welcome / Search Panel)
   แยกออกมาจาก login.css เพื่อให้ fast-search module
   เป็น self-contained
   ============================================================ */

.container {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  min-height: 100vh;
}

/* LEFT SIDE */
.left {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: white;
  padding: 0 60px;
  overflow: visible;
}

.welcome-text h1 {
  font-size: clamp(2.8rem, 6vw, 5rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 16px;
  font-family: "Sarabun", sans-serif;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.welcome-text p {
  font-size: clamp(1.1rem, 2.5vw, 1.6rem);
  max-width: 500px;
  margin: 0 auto 50px;
  font-family: "Sarabun", sans-serif;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.search-box {
  display: flex;
  gap: 14px;
  margin-top: 40px;
  justify-content: center;
  align-items: center;
}

.search-box input {
  width: 420px;
  padding: 10px 20px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 12px;
  background: rgba(10, 15, 40, 0.88);
  color: white;
  font-size: 16px;
  font-family: "Sarabun", sans-serif;
  outline: none;
  transition: all 0.3s ease;
}

.search-box input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.search-box input:focus {
  background: rgba(27, 31, 57, 0.95);
  border-color: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.search-btn {
  width: auto;
  padding: 10px 24px;
  background: #ffffff;
  border: none;
  color: #1a5f7a;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-family: "Sarabun", sans-serif;
  font-weight: 700;
  transition: all 0.3s ease;
  white-space: nowrap;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.search-btn:hover {
  background: #f0f0f0;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* SEARCH RESULT */
.search-result {
  display: none;
  margin-top: 12px;
  background: rgba(10, 15, 40, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  background-color: rgba(10, 15, 40, 0.88);
  backdrop-filter: blur(1px);
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  z-index: 1000;
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.search-result::-webkit-scrollbar {
  width: 6px;
}

.search-result::-webkit-scrollbar-track {
  background: transparent;
}

.search-result::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 3px;
}

.search-result::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.45);
}

.result-item {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-family: "Sarabun", sans-serif;
}

.result-item:last-child {
  border-bottom: none;
}

.result-main {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.result-left {
  font-size: 15px;
  color: white;
}

.result-right {
  flex-shrink: 0;
}

.result-remark {
  margin-top: 6px;
  font-size: 14px;
  color: rgb(255, 230, 0);
  text-align: left;
  display: block;
  width: 100%;
  padding-left: 2px;
}

.status-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.status-มา {
  background: #1a7a4a;
  color: white;
}

.status-สาย {
  background: #d48d00;
  color: white;
}

.status-ขาด {
  background: #ce0505;
  color: white;
}

.status-ลา {
  background: #0068cf;
  color: white;
}

.status-none {
  background: rgba(143, 143, 143, 0.2);
  color: rgba(255, 255, 255, 0.8);
}

/* TAB BAR */
.tab-bar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.08);
  /* โปร่งใสสว่าง */
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0;
}

.tab-btn {
  flex: 1;
  padding: 14px 0;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 15px;
  font-family: "Sarabun", sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  border-bottom: 3px solid transparent;
  width: auto;
  border-radius: 0;
}

.tab-btn.active {
  color: white;
  border-bottom: 3px solid rgba(255, 255, 255, 0.9);
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.4);
  border-radius: 0;
}

.tab-btn:hover {
  color: rgba(255, 255, 255, 0.8);
  background: transparent;
  transform: none;
  filter: none;
}

/* PANEL ANIMATION */
.tab-active {
  animation: fadeSlideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 960px) {
  .tab-bar {
    display: flex;
  }

  .container {
    grid-template-columns: 1fr;
    padding-top: 52px;
  }

  /* Hide both panels by default on mobile; JS will show the active one */
  .left,
  .right {
    display: none !important;
  }

  .left.tab-active,
  .right.tab-active {
    display: flex !important;
    min-height: calc(100vh - 52px);
  }

  .left.tab-active {
    padding: 20px;
    justify-content: flex-start;
    align-items: center;
    overflow-y: auto;
    box-sizing: border-box;
  }

  .welcome-text {
    width: 100%;
    max-width: 100%;
  }

  .welcome-text h1 {
    font-size: 1.8rem;
    margin-bottom: 12px;
  }

  .welcome-text p {
    font-size: 0.9rem;
    margin-bottom: 20px;
  }

  .search-box {
    flex-direction: row;
    width: 100%;
    margin-top: 20px;
  }

  .search-box input {
    width: 100%;
    /* เต็มความกว้าง */
    min-width: 0;
    font-size: 14px;
  }

  .search-btn {
    padding: 10px 16px;
    font-size: 14px;
  }

  .search-result {
    max-width: 100%;
    max-height: 35vh; /* ลดความสูงลงเพื่อไม่ให้เกินหน้าจอ */
    margin-top: 16px;
  }

  .result-item {
    padding: 10px 14px; /* ลด padding */
  }

  .result-main {
    font-size: 13px;
  }
}

@media (max-width: 600px) {
  .welcome-text h1 {
    font-size: 1.8rem;
  }

  .welcome-text p {
    font-size: 0.95rem;
  }

  .search-box input {
    font-size: 13px;
    padding: 8px 14px;
  }

  .login-box {
    padding: 24px 20px 26px;
    border-radius: 20px;
  }

  .logo {
    width: 100px;
    margin-bottom: 18px;
  }

  .login-box h2 {
    font-size: 1.8rem;
    margin-bottom: 22px;
  }

  .login-note {
    font-size: 12px;
  }
}

@media (max-width: 960px) {
  .result-main {
    font-size: 13px;
    flex-wrap: nowrap;
    /* ไม่ให้ wrap */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .status-badge {
    flex-shrink: 0;
    /* ไม่ให้ badge หด */
    margin-left: auto;
    /* ดัน badge ไปชิดขวา */
  }
}

.tab-active {
  display: flex !important;
  animation: fadeSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.tab-hidden {
  display: none !important;
  animation: none !important;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}