/*
 * AusSmile Care Preview: tab "Các phương án điều trị" (đổi phương án không tải lại trang).
 * Vị trí trên host:
 *   wp-content/themes/flatsome-child/care-review-themes/assets/care-option-tabs.css
 * Nạp bởi ah_cp_assets() trong inc/care-preview-template.php.
 *
 * Cách hoạt động: ah_cp_render_body() in sẵn chi phí + bảng chi tiết + CTA của
 * MỌI phương án (mỗi cái bọc trong .cp-pkg-N), kèm radio ẩn #cp-opt-N ở đầu
 * <main>. Thẻ phương án là <label for="cp-opt-N">. CSS dưới đây chỉ hiện phương
 * án có radio đang được chọn. Hỗ trợ tối đa 6 phương án.
 */

/* Radio điều khiển: ẩn khỏi mắt nhưng vẫn dùng được bằng bàn phím */
.cp-main .cp-opt-radio {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  pointer-events: none;
}

/* Khối của từng phương án: ẩn mặc định; khi chọn thì "display: contents" để
   các section bên trong xếp y như cũ trong .cp-main (giữ nguyên khoảng cách). */
.cp-main .cp-pkg {
  display: none;
}

#cp-opt-1:checked ~ .cp-pkg-1,
#cp-opt-2:checked ~ .cp-pkg-2,
#cp-opt-3:checked ~ .cp-pkg-3,
#cp-opt-4:checked ~ .cp-pkg-4,
#cp-opt-5:checked ~ .cp-pkg-5,
#cp-opt-6:checked ~ .cp-pkg-6 {
  display: contents;
}

#cp-opt-1:checked ~ .cp-pkg-1 > *,
#cp-opt-2:checked ~ .cp-pkg-2 > *,
#cp-opt-3:checked ~ .cp-pkg-3 > *,
#cp-opt-4:checked ~ .cp-pkg-4 > *,
#cp-opt-5:checked ~ .cp-pkg-5 > *,
#cp-opt-6:checked ~ .cp-pkg-6 > * {
  animation: cp-opt-fade .22s ease;
}

/* Thẻ chọn phương án (label) */
.cp-main .cp-opt-tab {
  margin: 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s ease, background .15s ease;
}

.cp-main .cp-opt-tab .cp-opt-check { display: none; }
.cp-main .cp-opt-tab .cp-opt-chevron { flex: none; }

/* Trạng thái đang chọn: giống .cp-opt.is-active cũ */
#cp-opt-1:checked ~ .cp-opt-tab-1,
#cp-opt-2:checked ~ .cp-opt-tab-2,
#cp-opt-3:checked ~ .cp-opt-tab-3,
#cp-opt-4:checked ~ .cp-opt-tab-4,
#cp-opt-5:checked ~ .cp-opt-tab-5,
#cp-opt-6:checked ~ .cp-opt-tab-6 {
  background: linear-gradient(180deg, #FFFFFF, #FBF1D4);
  border: 2px solid #D9B45A;
  cursor: default;
}

#cp-opt-1:checked ~ .cp-opt-tab-1 .cp-opt-check,
#cp-opt-2:checked ~ .cp-opt-tab-2 .cp-opt-check,
#cp-opt-3:checked ~ .cp-opt-tab-3 .cp-opt-check,
#cp-opt-4:checked ~ .cp-opt-tab-4 .cp-opt-check,
#cp-opt-5:checked ~ .cp-opt-tab-5 .cp-opt-check,
#cp-opt-6:checked ~ .cp-opt-tab-6 .cp-opt-check {
  display: inline-flex;
}

#cp-opt-1:checked ~ .cp-opt-tab-1 .cp-opt-chevron,
#cp-opt-2:checked ~ .cp-opt-tab-2 .cp-opt-chevron,
#cp-opt-3:checked ~ .cp-opt-tab-3 .cp-opt-chevron,
#cp-opt-4:checked ~ .cp-opt-tab-4 .cp-opt-chevron,
#cp-opt-5:checked ~ .cp-opt-tab-5 .cp-opt-chevron,
#cp-opt-6:checked ~ .cp-opt-tab-6 .cp-opt-chevron {
  display: none;
}

/* Viền focus khi dùng bàn phím */
#cp-opt-1:focus-visible ~ .cp-opt-tab-1,
#cp-opt-2:focus-visible ~ .cp-opt-tab-2,
#cp-opt-3:focus-visible ~ .cp-opt-tab-3,
#cp-opt-4:focus-visible ~ .cp-opt-tab-4,
#cp-opt-5:focus-visible ~ .cp-opt-tab-5,
#cp-opt-6:focus-visible ~ .cp-opt-tab-6 {
  outline: 3px solid #14284B;
  outline-offset: 2px;
}

@media (hover: hover) {
  .cp-main .cp-opt-tab:hover { border-color: #D9B45A; }
}

@keyframes cp-opt-fade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cp-main .cp-pkg > * { animation: none !important; }
}

/* =====================================================================
 * Khách sạn gợi ý: "Xem tất cả ảnh khách sạn" mở rộng ảnh ngay bên dưới
 * (thay cho mở 1 ảnh ở tab mới). Checkbox ẩn .cp-hotel-toggle + label nút.
 * ===================================================================== */
.cp-hotel .cp-hotel-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  pointer-events: none;
}

.cp-hotel .cp-hotel-more {
  display: none;
  flex-direction: column;
  gap: 10px;
}

.cp-hotel .cp-hotel-more-photo {
  border-radius: 16px;
  overflow: hidden;
  background: #F8F3E6;
}

.cp-hotel .cp-hotel-more-photo img {
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: cover;
  display: block;
}

.cp-hotel .cp-hotel-more-btn {
  margin: 0;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.cp-hotel .cp-hotel-more-hide { display: none; }

.cp-hotel .cp-hotel-toggle:checked ~ .cp-hotel-more {
  display: flex;
  animation: cp-opt-fade .22s ease;
}
.cp-hotel .cp-hotel-toggle:checked ~ .cp-hotel-more-btn .cp-hotel-more-show { display: none; }
.cp-hotel .cp-hotel-toggle:checked ~ .cp-hotel-more-btn .cp-hotel-more-hide { display: inline; }

.cp-hotel .cp-hotel-toggle:focus-visible ~ .cp-hotel-more-btn {
  outline: 3px solid #14284B;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .cp-hotel .cp-hotel-more { animation: none !important; }
}

/* =====================================================================
 * Complete Care Plan: thẻ thông tin bệnh nhân (tên, mã kế hoạch, giới tính,
 * tuổi, "Đã được bác sĩ xem duyệt") theo thiết kế CarePlan.dc.html.
 * ===================================================================== */
.cp-patient {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px 16px 18px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid #EADFC2;
  box-shadow: 0 6px 18px -14px rgba(27, 35, 64, .35);
}
.cp-patient-name {
  font-size: 21px;
  font-weight: 800;
  line-height: 1.2;
  color: #1B2340;
}
.cp-patient-code {
  margin-top: -6px;
  font-size: 14.5px;
  color: #6B7280;
}
.cp-patient-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cp-patient-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #F6EBCD;
  border: 1px solid #EADFC2;
  font-size: 14.5px;
  color: #4F5E78;
}
.cp-patient-chip b {
  font-weight: 800;
  color: #1B2340;
}
.cp-patient-desc {
  margin: 2px 0 0;
  font-size: 15px;
  line-height: 1.5;
  color: #2B3350;
}

/* =====================================================================
 * "Khuyến nghị chính" kèm ảnh bác sĩ xem duyệt (ảnh tách nền, đứng sát đáy thẻ).
 * Ảnh: care-review-themes/assets/img/bs-tran-phuong-dong.webp
 * ===================================================================== */
.cp-key.cp-key--doctor {
  position: relative;
  align-items: stretch;
  gap: 8px;
  padding: 0 0 0 18px;
  overflow: hidden;
  background: linear-gradient(135deg, #FBF1D4 0%, #F6E6B8 100%);
}
.cp-key--doctor .cp-key-body {
  padding: 16px 0 16px;
  justify-content: center;
  gap: 4px;
}
.cp-key--doctor .cp-key-doctor {
  flex: none;
  width: 112px;
  align-self: flex-end;
  margin-top: 10px;
  line-height: 0;
}
.cp-key--doctor .cp-key-doctor img {
  display: block;
  width: 100%;
  height: auto;
}
.cp-key--doctor .cp-key-doctor-by {
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .7);
  font-size: 13px;
  line-height: 1.3;
  color: #2B3350;
  align-self: flex-start;
}
.cp-key--doctor .cp-key-doctor-by svg { flex: none; margin-top: 1px; }
.cp-key--doctor .cp-key-doctor-by b { color: #1B2340; font-weight: 800; }

@media (max-width: 380px) {
  .cp-key--doctor .cp-key-doctor { width: 92px; }
}
