/* ==============================================================================
 * HỆ THỐNG ĐĂNG KÝ KHÁM SỨC KHỎE - TRẠM Y TẾ PHƯỜNG TÂN SƠN NHÌ
 * STYLESHEET CHUẨN GIAO DIỆN GỐC & TỐI ƯU HIỆN ĐẠI
 * ============================================================================== */

body {
  background-color: #f1f5f9;
  padding: 15px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #1e293b;
}

.form-container {
  background: #ffffff;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  max-width: 680px;
  margin: 15px auto 40px auto;
}

.required::after {
  content: " *";
  color: #dc3545;
  font-weight: bold;
}

.loading-text {
  font-size: 0.9rem;
  color: #0d6efd;
  display: none;
  margin-top: 6px;
  font-weight: 500;
}

/* Radio buttons tùy chỉnh */
.custom-radio-group .btn-check:checked + .btn-outline-secondary {
  background-color: #e0f2fe !important;
  border-color: #0284c7 !important;
  color: #0369a1 !important;
  font-weight: 600;
}

.custom-radio-group .btn {
  border-radius: 8px;
  font-size: 0.95rem;
  white-space: normal;
  border-color: #cbd5e1;
  color: #334155;
  transition: all 0.2s ease-in-out;
}

.custom-radio-group .btn:hover {
  background-color: #f8fafc;
}

.vertical-radio .btn {
  text-align: left;
  padding: 12px 14px;
  margin-bottom: 8px;
  width: 100%;
}

.horizontal-radio .btn {
  text-align: center !important;
  padding: 12px 10px;
}

/* Trang trí hộp thoại kết quả */
.info-block {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  text-align: left;
}

.qr-container img {
  max-width: 160px;
  border: 1px solid #cbd5e1;
  padding: 6px;
  border-radius: 8px;
  background: #fff;
}

/* CẤU HÌNH HEADER CHUYÊN NGHIỆP CÓ LOGO */
.header-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 15px;
  margin-bottom: 25px;
  gap: 10px; /* Tạo khoảng cách an toàn giữa chữ và logo */
}

/* ĐƯỜNG KẺ CHUẨN THỂ THỨC HÀNH CHÍNH */
.header-title-text h5 {
  position: relative;
  padding-bottom: 8px; /* Tạo khoảng cách giữa chữ và đường gạch */
  display: inline-block; /* Đảm bảo đường kẻ tính toán theo độ rộng chữ */
  width: 100%;
}

.header-title-text h5::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%); /* Canh đường kẻ luôn nằm chính giữa chữ */
  width: 40px; /* Độ dài chuẩn bằng khoảng 1/3 độ dài của cụm từ TRẠM Y TẾ */
  height: 1.5px; /* Độ dày nét kẻ mảnh đúng quy định văn bản */
  background-color: #198754; /* Giữ màu xanh lá đồng bộ */
}

.header-logo {
  height: 75px;
  width: 75px;
  object-fit: contain;
  border-radius: 50%; /* Bo tròn nhẹ góc ảnh logo */
}

.header-title-text {
  flex: 1; /* Ép phần chữ luôn chiếm phần ở giữa */
}

/* Đảm bảo hiển thị hoàn hảo trên điện thoại di động */
@media (max-width: 767px) {
  .header-section {
    padding-bottom: 10px;
    margin-bottom: 15px;
  }
  .header-logo {
    height: 45px;
    width: 45px;
  }
  .header-title-text h6 {
    font-size: 0.75rem !important;
    line-height: 1.2;
  }
  .header-title-text h5 {
    font-size: 0.95rem !important;
    margin-top: 2px !important;
  }
}

/* ÉP ẨN NÚT BẤM MẶC ĐỊNH CỦA ZALO ĐỂ KHÔNG BỊ HIỆN 2 NÚT */
.zalo-chat-widget:not(.show-real-chat) iframe,
.zalo-chat-widget:not(.show-real-chat) #zalo-chat-widget-trigger,
.zalo-chat-widget:not(.show-real-chat) [id^="zalo-chat-widget-"] {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* KHI MỞ CHAT: Trả lại thuộc tính hiển thị cho khung chat thật */
.zalo-chat-widget.show-real-chat iframe {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

/* CẤU HÌNH NÚT BẤM LẮC TỰ CHẾ */
#zalo-custom-button {
  position: fixed;
  bottom: 25px;
  right: calc(50% - 400px); /* Dịch chuyển lệch sang trái, áp sát cạnh phải của Form */
  width: 75px;
  height: 75px;
  background-color: #0068ff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 5px 15px rgba(0, 104, 255, 0.45);
  z-index: 999999 !important;
  cursor: pointer;
  animation: zalo-wiggle-bounce 2.5s infinite ease-in-out;
  transform-origin: bottom center;
}

#zalo-custom-button img {
  width: 45px;
  height: 45px;
}

/* Hiệu ứng lắc nhún */
@keyframes zalo-wiggle-bounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  20% { transform: translateY(-6px) rotate(-8deg); }
  30% { transform: translateY(-6px) rotate(8deg); }
  40% { transform: translateY(-4px) rotate(-6deg); }
  50% { transform: translateY(-4px) rotate(6deg); }
  60% { transform: translateY(0) rotate(0deg); }
}

/* Tối ưu hiển thị mượt trên Điện thoại */
@media (max-width: 576px) {
  #zalo-custom-button {
    width: 62px;
    height: 62px;
    bottom: 15px;
    right: 15px;
  }
  #zalo-custom-button img {
    width: 36px;
    height: 36px;
  }
}

/* ÉP NÚT ZALO GỐC VÀ CỬA SỔ CHAT DỊCH SANG TRÁI THEO FORM */
.zalo-chat-widget {
  right: calc(50% - 400px) !important;
}

@media (max-width: 767px) {
  .zalo-chat-widget {
    right: 20px !important;
  }
}
