/* ======================================================
   1. CONTAINER CHÍNH & LAYOUT (CĂN CHỈNH VỊ TRÍ)
   ====================================================== */
.floating-contact-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  /* Flexbox để căn thẳng hàng dọc */
  display: flex;
  flex-direction: column;
  align-items: center; /* QUAN TRỌNG: Căn giữa theo trục dọc */
  gap: 12px; /* Khoảng cách giữa nút Trigger và nút con gần nhất */
}

/* Khi chưa expanded: container chỉ fit nút trigger, không chặn click vùng khác */
.floating-contact-container:not(.expanded) {
  pointer-events: none;
}
.floating-contact-container:not(.expanded) #btn-trigger-contact {
  pointer-events: auto;
}

/* ======================================================
   2. DANH SÁCH NÚT CON (SUB-BUTTONS)
   ====================================================== */
.sub-buttons-list {
  display: flex;
  flex-direction: column;
  align-items: center; /* Căn giữa các nút con */
  gap: 12px; /* Khoảng cách giữa các icon */

  /* Trạng thái mặc định: Ẩn */
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
  /* Chưa expanded: không chặn click vùng bên dưới */
  pointer-events: none;
}

/* Khi menu mở (Expanded) -> Hiện danh sách */
.floating-contact-container.expanded .sub-buttons-list {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

/* --- STYLE CHUNG CHO CÁC NÚT CON --- */
.btn-float-contact {
  position: relative;
  z-index: 10;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s;
}

.btn-float-contact:hover {
  transform: scale(1.05);
}

/* Style nút tròn trắng (Phone, Support) */
.btn-circle-white {
  width: 50px;
  height: 50px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
}

/* Style riêng cho nút Zalo */
.phone-vr_zalo {
  width: 50px;
  height: 50px;
  border-radius: 50%;
}

.phone-vr-img-circle_zalo {
  width: 50px;
  height: 50px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  z-index: 2;
  /* Reset animation cũ nếu có */
  animation: none;
  top: auto;
  left: auto;
}

.phone-vr-img-circle_zalo img {
  max-width: 32px;
  max-height: 32px;
  position: static;
  transform: none;
}

/* ======================================================
   3. NÚT CHÍNH (TRIGGER BUTTON) - LOGIC CO GIÃN
   ====================================================== */
#btn-trigger-contact {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  position: relative;
  /* Khung bao ngoài giữ nguyên 60px để căn giữa không bị lệch */
  width: 60px;
  height: 60px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible !important;
  margin-bottom: 52px;
}

/* Vòng tròn nền màu (Đối tượng co giãn) */
.btn-main-circle {
  /* Kích thước mặc định (58px) */
  width: 58px;
  height: 58px;
  border-radius: 50%;
  position: relative;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  overflow: hidden;
}

/* MÀU SẮC THEO CHẾ ĐỘ (CANDIDATE / EMPLOYER) */
.candidate-mode .btn-main-circle {
  background: #f07e1d;
}
.employer-mode .btn-main-circle {
  background: #5a60f1;
}

/* Kích thước khi menu mở (Thu nhỏ về 50px) */
.floating-contact-container.expanded .btn-main-circle {
  width: 50px;
  height: 50px;
}

/* --- ICON ROBOT (OPEN) --- */
#btn-trigger-contact .icon-open {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1.5);
  transition: all 0.2s ease;
  z-index: 5;
}

/* Khi mở: Ẩn Robot */
.floating-contact-container.expanded #btn-trigger-contact .icon-open {
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -50%) scale(0.5);
}

/* --- ICON DẤU X (CLOSE) --- */
#btn-trigger-contact .icon-close {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  stroke: #ffffff; /* Màu icon */
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -50%) rotate(-90deg);
  transition: all 0.3s ease;
  z-index: 100;
  background: transparent;
  padding: 0;
  display: block; /* Đảm bảo hiển thị để animation hoạt động */
}

/* Khi mở: Hiện Dấu X */
.floating-contact-container.expanded #btn-trigger-contact .icon-close {
  opacity: 1;
  visibility: visible;
}

/* ======================================================
   4. HIỆU ỨNG ANIMATION (RUNG & LAN TỎA)
   ====================================================== */
.img-circle-shake {
  animation: phonering-alo-circle-img-anim 1s infinite ease-in-out;
  transform-origin: 50% 50%;
}

.phone-vr-circle-fill {
  width: 80px; /* Tăng nhẹ để bao trọn nút chính */
  height: 80px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid transparent;
  z-index: -1;
  background-color: transparent;
  animation: phone-vr-circle-fill 2.3s infinite ease-in-out;
}

/* Màu hiệu ứng lan tỏa theo chế độ */
.candidate-mode .phone-vr-circle-fill {
  background-color: rgba(240, 126, 29, 0.3);
  box-shadow: 0 0 0 0 #f07e1d;
}
.employer-mode .phone-vr-circle-fill {
  background-color: rgba(90, 96, 241, 0.3);
  box-shadow: 0 0 0 0 #5a60f1;
}

/* Tắt hiệu ứng khi đang mở menu */
.floating-contact-container.expanded #btn-trigger-contact .img-circle-shake,
.floating-contact-container.expanded
  #btn-trigger-contact
  .phone-vr-circle-fill {
  animation: none;
  transform: none;
}
.floating-contact-container.expanded
  #btn-trigger-contact
  .phone-vr-circle-fill {
  display: none;
}

/* KEYFRAMES */
@keyframes phonering-alo-circle-img-anim {
  0% {
    transform: rotate(0) scale(1) skew(1deg);
  }
  10% {
    transform: rotate(-25deg) scale(1) skew(1deg);
  }
  20% {
    transform: rotate(25deg) scale(1) skew(1deg);
  }
  30% {
    transform: rotate(-25deg) scale(1) skew(1deg);
  }
  40% {
    transform: rotate(25deg) scale(1) skew(1deg);
  }
  50% {
    transform: rotate(0) scale(1) skew(1deg);
  }
  100% {
    transform: rotate(0) scale(1) skew(1deg);
  }
}

@keyframes phone-vr-circle-fill {
  0% {
    transform: translate(-50%, -50%) rotate(0) scale(0.7);
    opacity: 0.5;
  }
  50% {
    transform: translate(-50%, -50%) rotate(0) scale(1.1);
    opacity: 0.3;
  }
  100% {
    transform: translate(-50%, -50%) rotate(0) scale(0.7);
    opacity: 0.5;
  }
}

/* ======================================================
   5. POPUP STYLES (HOTLINE & SUPPORT)
   ====================================================== */
.popup-contact-custom {
  position: fixed;
  right: 85px;
  z-index: 100000;
  font-family: "Inter", sans-serif;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

/* Vị trí Popup Hotline */
#popup-hotline-custom {
  bottom: 192px; /* Mặc định */
}
#popup-hotline-custom.has-zalo {
  bottom: 260px; /* Khi có Zalo */
}

/* Vị trí Popup Support */
#popup-support-custom {
  bottom: 145px; /* Mặc định */
  width: 262px;
  overflow: hidden;
}
#popup-support-custom.has-zalo {
  bottom: 205px; /* Khi có Zalo */
}

/* Header Popup */
.popup-header {
  /* Mặc định Candidate (Cam) */
  background: linear-gradient(90deg, #f07e1d 0%, #ff9f43 100%);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--white, #fff);
  font-family: Inter;
  font-size: 18px;
  font-style: normal;
  font-weight: 600;
  line-height: 27px;
}
.employer-mode .popup-header {
  background: linear-gradient(90deg, #5a60f1 0%, #7c82f5 100%);
}

/* Nút tắt Popup */
.close-popup-btn {
  cursor: pointer;
  display: flex;
  padding: 4px;
  align-items: center;
  gap: 10px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.15);
  transition: background 0.2s;
  font-size: 20px;
  line-height: 1;
}
.close-popup-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Body Popup */
.popup-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fff;
}

/* Item bên trong Popup (Support/Hotline Box) */
.support-item,
.hotline-box {
  display: grid;
  grid-template-columns: fit-content(100%) 1fr;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: #fff;
  text-align: left;
}
/* Hotline box riêng (để override shadow nếu cần) */
.hotline-box {
  min-width: 220px;
}

/* Icon tròn bên trong Popup */
.support-icon,
.hotline-box .icon-circle {
  width: 48px;
  height: 48px;
  display: flex;
  padding: 12px;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  box-sizing: border-box;

  /* Màu mặc định Candidate */
  border: 1px solid #fcd9bd;
  background: linear-gradient(90deg, #feecdc 0%, #fff 100%);
  margin-right: 0;
}

.employer-mode .support-icon,
.employer-mode .hotline-box .icon-circle {
  border: 1px solid #c5c8f9;
  background: linear-gradient(90deg, #e8e9fd 0%, #fff 100%);
}

/* Text styles */
.support-details .name,
.hotline-box .text-info .label {
  display: block;
  color: rgba(0, 0, 0, 0.85);
  font-size: 14px;
  font-weight: 700;
  line-height: 150%;
  margin: 0 0 4px 0;
  text-align: start;
  padding: 0;
}

.support-details .phone,
.hotline-box .text-info .phone-number {
  color: #3f83f8;
  font-family: Inter;
  font-size: 14px;
  font-weight: 400;
  line-height: 21px;
  text-decoration: none;
}

.support-details .phone:hover,
.hotline-box .text-info .phone-number:hover {
  text-decoration: underline;
  color: #3f83f8;
}

/* support-item: contact-actions + zalo-button (giống customer-service-card) */
.support-details .contact-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.support-details .contact-actions .phone {
  color: #3f83f8;
  font-family: Inter;
  font-size: 14px;
  font-weight: 400;
  line-height: 21px;
  text-decoration: none;
}

.support-details .contact-actions .phone:hover {
  text-decoration: underline;
  color: #3f83f8;
}

.support-details .contact-actions .zalo-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 8px;
  color: #ffffff;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  font-size: 12px;
  font-weight: 600;
  font-family: Inter;
  white-space: nowrap;
}

.support-details .contact-actions .zalo-button.employer-zalo {
  background: linear-gradient(135deg, #5a60f1 0%, #5a60f1 100%);
  box-shadow: 0 2px 4px rgba(90, 96, 241, 0.3);
}

.support-details .contact-actions .zalo-button.employer-zalo:hover {
  background: linear-gradient(135deg, #4a50d1 0%, #4a50d1 100%);
  box-shadow: 0 4px 8px rgba(90, 96, 241, 0.4);
  transform: translateY(-1px);
}

.support-details .contact-actions .zalo-button.jobseeker-zalo {
  background: linear-gradient(135deg, #f07e1d 0%, #f07e1d 100%);
  box-shadow: 0 2px 4px rgba(240, 126, 29, 0.3);
}

.support-details .contact-actions .zalo-button.jobseeker-zalo:hover {
  background: linear-gradient(135deg, #d06e1a 0%, #d06e1a 100%);
  box-shadow: 0 4px 8px rgba(240, 126, 29, 0.4);
  transform: translateY(-1px);
}

/* ======================================================
   6. RESPONSIVE MOBILE
   ====================================================== */
@media screen and (max-width: 768px) {
  .floating-contact-container {
    right: 10px;
    bottom: 10px;
  }

  .popup-contact-custom {
    right: 70px; /* Đẩy sang trái để tránh bị nút che */
  }

  .floating-contact-container.employer-mode #btn-trigger-contact {
    margin-bottom: 72px;
  }
}
