/* CARO VILLAGE — chuyển động boutique ấm áp
   - Nút, lịch chọn ngày, đổi trạng thái, thao tác CRM: 150–220ms
   - Ảnh, chuyển cảnh 360°: 350–500ms
   - Chỉ dùng opacity + transform; hover chỉ trên thiết bị có chuột; tôn trọng prefers-reduced-motion */
:root {
  --cv-fast: 180ms;
  --cv-img: 450ms;
  --cv-ease: cubic-bezier(.22, .68, .24, 1);
  --cv-ease-in: cubic-bezier(.4, 0, .9, .5);
}

/* ---- Điều khiển nhỏ: 180ms ---- */
button, a, input, select, textarea, label, [role="button"] {
  transition-property: opacity, transform, background-color, color, border-color, box-shadow, outline-color !important;
  transition-duration: var(--cv-fast) !important;
  transition-timing-function: var(--cv-ease) !important;
}
button:not(:disabled):active, [role="button"]:active { transform: scale(.97); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid #f1be6e; outline-offset: 2px;
}

/* ---- Ảnh: 450ms ---- */
img, [style*="background-image"] {
  transition-property: opacity, transform !important;
  transition-duration: var(--cv-img) !important;
  transition-timing-function: var(--cv-ease) !important;
}
img.cv-fade { opacity: 0; }
img.cv-fade.cv-in { opacity: 1; }

/* ---- Hover chỉ trên thiết bị có chuột ---- */
@media (hover: none), (pointer: coarse) {
  *:hover, .group:hover * {
    --tw-scale-x: 1 !important; --tw-scale-y: 1 !important;
    --tw-translate-y: 0 !important; --tw-translate-x: 0 !important;
  }
}

/* ---- Trạng thái thật: đang tải / đang gửi / thành công / thử lại ---- */
.cv-spinner {
  width: 1em; height: 1em; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  display: inline-block; animation: cv-spin .8s linear infinite; vertical-align: -0.15em;
}
@keyframes cv-spin { to { transform: rotate(360deg); } }

.cv-state { animation: cv-pop var(--cv-fast) var(--cv-ease) both; }
@keyframes cv-pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

[aria-busy="true"] { cursor: progress; }
button[aria-busy="true"] { opacity: .85; }

.cv-msg { display: flex; gap: .6rem; align-items: flex-start; padding: .85rem 1rem; border-radius: .9rem;
  font-size: 14px; line-height: 1.45; }
.cv-msg--ok { background: #e7f1e1; color: #23361f; }
.cv-msg--err { background: #ffe9e5; color: #7a1b10; }
.cv-msg--info { background: #f6efe3; color: #4e3a1c; }
.cv-msg button, .cv-msg a { text-decoration: underline; font-weight: 600; }
.cv-invalid { box-shadow: 0 0 0 2px #ba1a1a !important; }

/* ---- Thanh đặt phòng dính đáy trên điện thoại ---- */
.cv-bookbar { display: none; }
@media (max-width: 767px) {
  .cv-bookbar {
    display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 60; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 10px 10px 16px; border-radius: 18px;
    background: rgba(48, 40, 33, .94); color: #fcf9f3; backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
    transform: translateY(0); opacity: 1;
    transition: transform var(--cv-img) var(--cv-ease), opacity var(--cv-img) var(--cv-ease);
  }
  .cv-bookbar.is-hidden { transform: translateY(140%); opacity: 0; pointer-events: none; }
  .cv-bookbar small { display: block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; opacity: .7; }
  .cv-bookbar strong { font-family: 'Playfair Display', serif; font-weight: 500; font-size: 18px; }
  .cv-bookbar a { min-height: 48px; padding: 0 20px; border-radius: 12px; background: #fdc978; color: #281800;
    display: inline-flex; align-items: center; font-weight: 600; font-size: 15px; }
  body.cv-has-bookbar { padding-bottom: 88px; }

  /* Thanh tìm phòng phải thấy ngay ở màn hình đầu */
  section.min-h-\[942px\] { min-height: 0 !important; padding-top: 88px !important; padding-bottom: 72px !important; }
  section.min-h-\[942px\] > .text-center { padding-top: 12px !important; padding-bottom: 0 !important; }
  section.min-h-\[942px\] > .text-center > .inline-flex,
  section.min-h-\[942px\] > .text-center > p,
  section.min-h-\[942px\] > .text-center > div > a,
  section.min-h-\[942px\] > div:last-child { display: none !important; }
  section.min-h-\[942px\] h1 { font-size: 32px !important; line-height: 1.15 !important; }
  section.min-h-\[942px\] > .text-center > div { margin-top: 14px !important; }
  section.min-h-\[942px\] > .text-center > div > button { padding: 10px 18px !important; }
  #booking-dock { margin-top: -56px !important; }

  /* Vuốt ảnh: danh sách phòng thành băng chuyền */
  #villas-container {
    display: flex !important; overflow-x: auto; scroll-snap-type: x mandatory; gap: 14px;
    padding-bottom: 6px; margin-right: -16px; padding-right: 16px; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  #villas-container::-webkit-scrollbar { display: none; }
  #villas-container > * { flex: 0 0 86%; scroll-snap-align: start; }
  input[type="date"], select { min-height: 44px; }
}

/* ===== Tour 360° "Bước vào phòng" ===== */
.cv-cover { position: relative; }
.cv-cover-status {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 5;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 500;
  background: rgba(28, 28, 24, .78); color: #fcf9f3; backdrop-filter: blur(8px);
  animation: cv-pop var(--cv-fast) var(--cv-ease) both;
}
.cv-cover-status button { color: #fdc978; font-weight: 600; text-decoration: underline; }

.cv-tour { position: fixed; inset: 0; z-index: 1000; }
.cv-tour__scrim { position: absolute; inset: 0; background: #1b140e; opacity: 0;
  transition: opacity var(--cv-img) var(--cv-ease); }
.cv-tour.is-open .cv-tour__scrim { opacity: 1; }
.cv-tour__frame { position: absolute; inset: 0; overflow: hidden; transform-origin: 0 0;
  background: #1b140e; will-change: transform; border-radius: 0; }
.cv-tour__frame.is-animating { transition: transform var(--cv-img) var(--cv-ease), border-radius var(--cv-img) var(--cv-ease); }
.cv-tour__viewer { position: absolute; inset: 0; opacity: 0; transition: opacity 400ms var(--cv-ease); }
.cv-tour.is-ready .cv-tour__viewer { opacity: 1; }
.cv-tour__poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: opacity 400ms var(--cv-ease) !important; pointer-events: none; }
.cv-tour.is-ready .cv-tour__poster { opacity: 0; }
.cv-tour__bar { position: absolute; left: 0; right: 0; top: 0; z-index: 3; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; padding: calc(14px + env(safe-area-inset-top)) 16px 14px;
  background: linear-gradient(rgba(27,20,14,.7), rgba(27,20,14,0)); color: #fcf9f3;
  opacity: 0; transform: translateY(-8px); transition: opacity var(--cv-fast) var(--cv-ease), transform var(--cv-fast) var(--cv-ease); }
.cv-tour.is-ready .cv-tour__bar, .cv-tour.is-ready .cv-tour__foot { opacity: 1; transform: none; }
.cv-tour__title { font-family: 'Playfair Display', serif; font-size: 20px; line-height: 1.2; }
.cv-tour__sub { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; opacity: .75; }
.cv-tour__btn { min-width: 44px; height: 44px; border-radius: 999px; display: inline-flex; align-items: center;
  justify-content: center; gap: 6px; padding: 0 14px; background: rgba(252,249,243,.14); color: #fcf9f3;
  backdrop-filter: blur(8px); font-size: 14px; }
.cv-tour__btn--primary { background: #fdc978; color: #281800; font-weight: 600; }
.cv-tour__foot { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; flex-wrap: wrap;
  align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(rgba(27,20,14,0), rgba(27,20,14,.75)); color: #fcf9f3;
  opacity: 0; transform: translateY(8px); transition: opacity var(--cv-fast) var(--cv-ease), transform var(--cv-fast) var(--cv-ease); }
.cv-tour__hint { font-size: 13px; opacity: .85; display: flex; align-items: center; gap: 6px; }
@media (hover: hover) and (pointer: fine) { .cv-tour__btn:hover { background: rgba(252,249,243,.26); } .cv-tour__btn--primary:hover { background: #ffddae; } }
.cv-tour .pnlm-container { background: #1b140e; }
.cv-tour .pnlm-load-box, .cv-tour .pnlm-about-msg { display: none !important; }

/* ===== Giảm chuyển động ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-property: opacity, color, background-color, border-color !important;
  }
  * { --tw-scale-x: 1 !important; --tw-scale-y: 1 !important; }
  button:active { transform: none; }
  .cv-spinner { animation: cv-spin 1.6s linear infinite !important; animation-iteration-count: infinite !important; }
  .cv-tour__frame { transform: none !important; }
  .cv-bookbar.is-hidden { transform: none; }
  #villas-container { scroll-snap-type: x proximity; }
}
