@import url('https://fonts.googleapis.com/css2?family=Sarabun&display=swap');

/* ------------------- BASE STYLES ------------------- */
body {
  font-family: 'Sarabun', sans-serif;
  margin: 0;
  /* background-color: #ffffff; */
  background-image: url('../img/background/bg-2_white_background.png');
  color: #333;
  max-width: 100%;
  overflow-x: hidden;
}

/* ------------------- LAYOUT ------------------- */
.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-layout {
  display: flex;
  flex: 1;
  min-height: 100vh;
}

/* ------------------- Main Content ---------------- */
.main-content {
  flex-grow: 1;
  padding: 0;
  margin-left: 250px;
  transition: margin-left 0.3s ease-in-out;
}

/*------------------ IMG poster --------------------*/
.image-poster {
  display: block;
  padding: 20px;
}

.image-poster img {
  cursor: zoom-in;
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.image-poster img:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* --------------- Sidebar Menu ------------- */
.sidebar-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 250px;
  height: 100vh;
  padding-top: 56px;
  box-sizing: border-box;
  background-color: #343a40;
  color: #c2c7d0;
  font-size: 1rem;
  transform: translateX(0);
  transition: transform 0.3s ease;
  overflow-y: auto;
  z-index: 1200;
}
/* .sidebar-menu.hidden {
  transform: translateX(-100%);
} */
.sidebar-logo {
  text-align: center;
  padding: 1rem;
}
.sidebar-menu ul {
  list-style: none;
  padding: 0;
  margin: 20px 0 0 0;
}
.sidebar-menu li {
  padding: 12px 20px;
}
.sidebar-menu li a {
  text-decoration: none;
  color: #c2c7d0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-menu li a:hover {
  background-color: #4b545c;
  color: #fff;
  border-radius: 8px;
}
.sidebar-menu li.active > a {
  background-color: #1e282c;
  color: #fff;
  font-weight: bold;
  border-radius: 8px;
}

/*--------------------- Header -------------------------*/
.section-heading {
  cursor: pointer;
  color: #fff;
  background-color: rgb(9, 122, 167);
  padding: 15px 0 15px 30px;
  margin-bottom: 10px;
  /* border-left: 6px solid rgb(73, 175, 32); */
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  position: relative;
  user-select: none;
}

.section-heading h3 {
  margin: 0;
  font-size: 18px;
}

/*---------- Breadcrumb link styles ---------*/
.breadcrumb-container {
  margin: 10px 0 20px 16px;
}

.breadcrumb-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  font-size: 15px;
  padding: 0;
  margin: 20px 10px;
  gap: 8px;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
}

.breadcrumb-link {
  text-decoration: none;
  color: #007bff;
  border: 1px solid #dee2e6;
  padding: 4px 10px;
  border-radius: 6px;
  background-color: #f8f9fa;
  display: inline-block;
  transition: background-color 0.2s, color 0.2s;
}

.breadcrumb-link:hover {
  background-color: #e2e6ea;
}

.breadcrumb-icon {
  font-size: 12px;
  color: #6c757d;
}

.breadcrumb-current {
  color: #6c757d;
  border: 1px solid #dee2e6;
  padding: 4px 10px;
  border-radius: 6px;
  background-color: #f8f9fa;
  display: inline-block;
}

/* ---------------- Hamburger button --------------- */
.menu-toggle-btn {
  position: fixed;
  top: 10px;
  left: 15px;
  z-index: 1300;
  background-color: #2b3035;
  color: #fff;
  border: none;
  padding: 10px 14px;
  font-size: 16px;
  border-radius: 4px;
  cursor: pointer;
  display: none; /* ซ่อนเริ่มต้น */
  transition: opacity 0.3s ease;
}
.hamburger-btn {
  position: absolute;
  top: 15px;
  right: 0px; /* ชิดขอบขวา */
  z-index: 1300;
  background-color: #2b3035;
  color: #fff;
  border: none;
  padding: 8px 12px;
  font-size: 16px;
  border-radius: 4px 0 0 4px;
  cursor: pointer;
  transition: transform 0.3s ease;
}
/* .hamburger-btn.clicked {
  animation: pulse 0.3s ease;
}
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
} */

/* ------------------ Badge styles ------------------- */
.badge {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 120px;         /* กำหนดความกว้างแน่นอน */
  height: 40px;         /* กำหนดความสูงแน่นอน */
  font-size: 0.85rem;
  border-radius: 15px;
  font-weight: bold;
  color: white;
  text-transform: uppercase;
  white-space: nowrap;
  /* box-shadow: 0 2px 2px rgba(0, 0, 0, 0.15); เงาเบา ๆ */
}
.badge-pending {
  background-color: #f0ad4e; /* ส้ม */
}
.badge-approved {
  background-color: #5bc0de; /* ฟ้า */
}
.badge-accepted {
  background-color: #5cb85c; /* เขียว */
}
.badge-closed {
  background-color: #d9534f; /* แดง */
}

/* ---------------- Footer ------------------------ */
.modern-footer {
  /* background: linear-gradient(135deg, #c25700ff, #cf983eff); */
  background-color: #343a40;
  color: white;
  text-align: center;
  padding: 10px 0;
  font-size: 0.9rem;
  margin-left: 250px;
  transition: margin-left 0.3s ease-in-out;
  z-index: 1;
}
.footer-content {
  max-width: 100%;
}

/*------------------- ส่วน Tooltip Program model ------------------------*/
/* Tooltip ลอย หน้า view */
.tooltip-box-floating-view {
  display: none;
  position: absolute;
  transform: translate(-105%, -50%);
  background-color: #dfffe9ff;
  color: #333;
  /* border: 1px solid #8997a3ff; */
  padding: 16px 30px;
  border-radius: 8px;
  box-shadow: 0px 2px 12px rgba(0, 0, 0, 0.2);
  font-size: 16px;
  line-height: 2;
  z-index: 9999;
  width: 400px;
  overflow: hidden;
}

/* Tooltip ลอย หน้า add */
.tooltip-box-floating {
  display: none;
  position: absolute;
  transform: translate(21%, -68%);
  background-color: #dfffe9ff;
  color: #333;
  /* border: 1px solid #8997a3ff; */
  padding: 16px;
  border-radius: 8px;
  box-shadow: 0px 2px 12px rgba(0, 0, 0, 0.2);
  font-size: 16px;
  line-height: 2;
  z-index: 9999;
  width: 700px;
  overflow: hidden;
}

.tooltip-content {
  margin-left: 10px;
  display: flex;
  flex-direction: row;
}

.tooltip-left,
.tooltip-right {
  flex: 1;
  padding: 0 10px;
}

.tooltip-divider {
  border-left: 2px solid #746f6f1c;
  margin-left: -10px;
  margin-right: 20px;
}

.tooltip-close {
  position: absolute;
  top: 6px;
  right: 10px;
  background: transparent;
  border: none;
  font-size: 20px;
  font-weight: bold;
  color: #999;
  cursor: pointer;
  z-index: 10000;
}

.tooltip-close:hover {
  color: #000;
}

.custom-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* background-color: #2749dfff; */
  color: rgb(39, 66, 187);
  margin: auto 0;
  padding: 6px 12px;
  font-size: 14px;
  border-radius: 14px;
  cursor: pointer;
  /* border: 1px solid transparent; */
  transition: background-color 0.2s ease-in-out;
  user-select: none;
  gap: 6px;
  position: relative;
}

.custom-iconi-toggleTooltip {
  display: inline-block;
  background: none;
  color: #007bff;
  font-size: 15px;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-bottom: 3px;
  margin-right: 3px;
  vertical-align: middle;
}

.arrow-indicator {
  display: none;
  margin-left: 8px;
  font-weight: bold;
}

.custom-btn:hover {
  color: rgb(93, 118, 233);
  /* background-color: #273ea8ff; */
}

.custom-btn:active {
  color: rgb(93, 118, 233);
  /* background-color: #2749dfff; */
}

.custom-iconi-toggleTooltip:hover {
  color: #52a1f5;
}

.custom-iconi-toggleTooltip:active {
  color: #52a1f5;
}

/*------------------- ส่วน Title แต่ละหน้า ------------------------*/
.content-title {
  color: #fff;
  padding: 18px 25px 20px;
  font-size: 1.2rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  margin-top: 0;
  margin-bottom: 0;
  width: 100%;
  box-sizing: border-box;
}

/* ------------------- Note box -------------------------*/
.note-box-responsive {
  width: 700px;
  background-color: #6affd2ff;
  color: #333;
  padding: 20px 30px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  font-size: 16px;
  line-height: 1.6;
  margin: -120px auto 30px 750px;
}

/*------------------- Form ------------------------*/
.form-section {
  width: 95%;
  margin: 30px auto;
  padding-bottom: 20px;
  border: 1px solid rgb(219, 216, 216);
  border-radius: 6px;
}

.form-control {
  width: 100%;
  font-size: 1.1rem;
  /* background-color: #f1bebe; */
  padding: 10px 30px;
  align-items: center;
  line-height: 1.6;
  gap: 20px;      
}

.form-control p {
  width: 10%;
  margin: 0px;
  padding: 3px 0;
  text-align: left;
  font-weight: bold;
}

.error-message {
  background-color: #ffe0e0;
  border-left: 5px solid #ff4d4d;
  color: #b30000;
  padding: 20px 0 20px 30px;
  border-radius: 6px;
  margin: 20px auto 20px 50px;
  font-weight: bold;
  width: 80%;
}   

.success-message {
  background-color: #d4edda;
  color: #155724;
  border-left: 5px solid #28a745;
  border-radius: 6px;
  width: 80%;
  padding: 20px 0 20px 30px;
  margin: 20px 0 15px 50px;
  font-weight: bold;
}

.error {
  background-color: #f8d7da;
  color: #721c24;
  border-left: 5px solid #dc3545;
  border-radius: 4px;
  width: 80%;
  padding: 20px 20px 20px 20px;
  margin: 20px 0 15px 50px;
  font-weight: bold;
}

.input-error {
  border: 0.5px solid red !important;
  box-shadow: 0 0 6px red;
  transition: box-shadow 0.3s ease;
}

/* จัดเรียง input แบบแนวนอน */
.input-row-horizontal {
  display: flex;
  align-items: flex-start;
}
.input-horizontal {
  display: flex;
  margin-left: 25px;
  flex-direction: column;
  min-width: 0;
}
.input-horizontal label {
  margin-bottom: 4px;
  white-space: nowrap; /* ไม่ตัดบรรทัดหัวข้อ */
}
.input-horizontal input.txt {
  width: 100%;
  box-sizing: border-box;
}

.input-month {
  display: flex;
  align-items: center;
  gap: 10px; /* ระยะห่างระหว่าง input และขีด - */
  flex-wrap: wrap; /* เผื่อจอแคบ */
}
.input-month input.txt {
  display: inline-block;
  width: auto; /* ปรับขนาดตามเนื้อหา */
  min-width: 150px; /* ป้องกันเล็กเกินไป */
}
  input[disabled] {
    background-color: #cccccc;   /* สีเทาอ่อน */
    cursor: not-allowed;
  }
.radio-group {
  display: flex;
  flex-direction: row;
  gap: 20px; /* ระยะห่างระหว่างปุ่ม */
  flex-wrap: wrap; /* กันล้น */
  align-items: center;
}

.radio-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px; /* ระยะห่างระหว่างปุ่มกับข้อความ */
}

.radio-option input[type="radio"] {
  margin-bottom: 3px;
  width: 20px;
  height: 20px;
}

.txt {
  font-size: 1.0rem;
  font-family: 'Roboto', sans-serif;
  padding: 10px;
  background: #F7F7F7;
  border: 1px solid #E5E5E5;
  border-radius: 5px;
}

textarea.txt {
  line-height: 1.6; /* เพิ่มระยะห่างบรรทัด */
}

.redtext {
  color: red;
  font-weight: bold;
}

label small {
  font-size: 0.8em;
  color: #707070; /* ถ้าอยากให้สีจางลงหน่อย */
}

/*------------------- ปุ่ม submit ------------------------*/
.btn-submit {
    display: block;
    width:90%;
    min-width: 400px;
    height:60px;
    margin: 10px 0 20px 50px;
    font-size: 1.1rem;
    background-color: #1976d2;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-weight: bold;
}

.btn-submit:hover {
    background-color: #1976d2;
}

/*--------------------- Effect loading -------------------------*/
#loadingOverlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  display: flex; /* <--- เพิ่มไว้เลย ไม่ต้อง toggle ทุกครั้ง */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
#loadingOverlay.show {
  opacity: 1;
  pointer-events: auto;
}
.spinner {
  border: 6px solid #f3f3f3;
  border-top: 6px solid #3498db;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
}

.loading-text {
  color: white;
  margin-top: 15px;
  font-size: 18px;
  font-weight: bold;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

  /*------------------ modal --------------------*/
  .modal-backdrop {
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 4000 !important;
    /* สูงกว่า sidebar/main-content */
  }

  .modal-backdrop.show {
    display: flex;
    opacity: 1;
    pointer-events: auto;
    justify-content: center;
    align-items: center;
  }

  @keyframes bounceInCenter {
    0% {
      opacity: 0;
      transform: translate(-50%, -60%);
    }

    100% {
      opacity: 1;
      transform: translate(-50%, -50%);
    }
  }

  .modal-dialog {
    opacity: 0;
    transform: translate(-50%, -60%);
    animation: none;
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 4100 !important;
    /* สูงกว่า backdrop */
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
  }

  .modal-backdrop.show .modal-dialog {
    opacity: 1;
    animation: bounceInCenter 0.2s ease forwards;
  }

/* --------------------------- Responsive -------------------------- */
/* ถ้า sidebar ซ่อน  */
body.sidebar-hidden .sidebar-menu {
  transform: translateX(-100%);
}

body.sidebar-hidden .main-header,
body.sidebar-hidden .main-content,
body.sidebar-hidden .modern-footer {
  margin-left: 0 !important;
}

/* แสดงปุ่มนี้เมื่อ sidebar ถูกซ่อน */
body.sidebar-hidden .menu-toggle-btn {
  display: block;
}
/* เมื่อ sidebar ซ่อน → ปุ่มไปอยู่มุมซ้าย */
body.sidebar-hidden .hamburger-btn {
  left: 15px;
}

body.sidebar-hidden .content-title {
  padding-left: 120px;
}

/* ถ้า sidebar แสดง */
body:not(.sidebar-hidden) .main-header,
body:not(.sidebar-hidden) .main-content,
body:not(.sidebar-hidden) .modern-footer {
  margin-left: 250px !important;
}

body:not(.sidebar-hidden) .hamburger-btn {
  background-color: #2b3035;
  margin-left: 190px !important;
}

@media (max-width: 1500px) {
  /* ปุ่มสถานะ */
  .badge {
    width: 90px;         /* เล็กลงจาก 120px */
    height: 32px;        /* เตี้ยลงจาก 40px */
    font-size: 0.75rem;  /* ตัวอักษรเล็กลง */
    border-radius: 12px;
  }
  
  .btn-action,
  .btn-apply {
    width: 60px !important;
    height: 30px !important;
  }
  
  /* เมื่อจอเล็กกว่า 1500px ให้กล่องไปอยู่ใต้ filter */
  .note-box-responsive {
    float: none;
    margin: 10px auto 30px 30px;
    width: 90%;
    max-width: 700px;
  }
}
