/*
 * UI tạm dùng chung (prototype): chat Obpa góc phải + hộp tìm kiếm.
 * Mở bằng [data-open="chat"] / [data-open="search"] (xem overlays.js).
 * Kính mờ cùng họ với navbar/hero: nền tối pha xanh navy + blur 25px + viền sáng mảnh.
 */
:root {
  --ov-glass: rgba(6, 26, 72, .58);
  --ov-glass-2: rgba(255, 255, 255, .08);
  --ov-line: rgba(255, 255, 255, .16);
  --ov-ease: cubic-bezier(.22, 1, .36, 1);
}
.ov-glass {
  background: var(--ov-glass); color: #fff;
  backdrop-filter: blur(25px) saturate(150%); -webkit-backdrop-filter: blur(25px) saturate(150%);
  border: 1px solid var(--ov-line);
  box-shadow: 0 30px 60px -20px rgba(0, 20, 70, .55), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.ov-icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 99px; color: #fff;
  transition: background-color .25s ease;
}
.ov-icon-btn:hover { background: rgba(255, 255, 255, .12); }
.ov-icon-btn:focus-visible, .ov-chip:focus-visible, .ov-send:focus-visible { outline: 2px solid var(--c-yellow); outline-offset: 2px; }
.ov-icon-btn svg { width: 20px; height: 20px; }
.ov-chip {
  display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: 99px;
  font-size: 13px; color: #fff; background: var(--ov-glass-2); border: 1px solid var(--ov-line);
  transition: background-color .25s ease, border-color .25s ease, color .25s ease;
}
.ov-chip:hover { background: rgba(252, 221, 8, .16); border-color: rgba(252, 221, 8, .6); color: var(--c-yellow); }

/* ---------- Chat Obpa ---------- */
.ov-chat {
  position: fixed; right: 24px; bottom: 24px; z-index: 1000;
  display: flex; flex-direction: column; width: 380px; height: min(580px, calc(100vh - 48px));
  border-radius: 20px; overflow: hidden; font-family: var(--font);
  transform-origin: 100% 100%; opacity: 0; transform: translateY(16px) scale(.92); visibility: hidden;
  transition: opacity .35s var(--ov-ease), transform .5s var(--ov-ease), visibility 0s linear .5s;
}
.ov-chat.is-open { opacity: 1; transform: none; visibility: visible; transition: opacity .35s var(--ov-ease), transform .5s var(--ov-ease), visibility 0s; }
.ov-chat__head { display: flex; align-items: center; gap: 12px; padding: 14px 12px 14px 16px; border-bottom: 1px solid var(--ov-line); }
.ov-chat__avatar { position: relative; width: 42px; height: 42px; flex-shrink: 0; }
.ov-chat__avatar img { width: 100%; height: 100%; border-radius: 99px; }
.ov-chat__avatar::after { /* chấm online */
  content: ""; position: absolute; right: 0; bottom: 1px; width: 11px; height: 11px; border-radius: 99px;
  background: #3ddc84; box-shadow: 0 0 0 2px rgba(6, 26, 72, .9);
}
.ov-chat__who { flex: 1; min-width: 0; }
.ov-chat__who strong { display: block; font-size: 15px; font-weight: 700; }
.ov-chat__who small { display: block; font-size: 12px; color: rgba(255, 255, 255, .65); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ov-chat__body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .25) transparent; }
.ov-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 86%; animation: ov-pop .4s var(--ov-ease) both; }
.ov-msg img { width: 26px; height: 26px; border-radius: 99px; flex-shrink: 0; }
.ov-msg p { padding: 10px 14px; border-radius: 18px; font-size: 14px; line-height: 1.45; background: rgba(255, 255, 255, .12); border-bottom-left-radius: 6px; }
.ov-msg--me { align-self: flex-end; }
.ov-msg--me p { background: var(--c-yellow); color: var(--c-navy); border-radius: 18px; border-bottom-right-radius: 6px; font-weight: 500; }
.ov-chat__chips { display: flex; flex-wrap: wrap; gap: 8px; padding-left: 34px; animation: ov-pop .4s var(--ov-ease) .1s both; }
.ov-typing p { display: flex; gap: 4px; padding: 14px; }
.ov-typing i { width: 6px; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .8); animation: ov-dot 1s ease-in-out infinite; }
.ov-typing i:nth-child(2) { animation-delay: .15s; }
.ov-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ov-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes ov-pop { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }

.ov-chat__form { display: flex; align-items: center; gap: 8px; padding: 12px; border-top: 1px solid var(--ov-line); }
.ov-chat__form input {
  flex: 1; height: 42px; padding: 0 16px; border-radius: 99px; border: 1px solid var(--ov-line);
  background: rgba(255, 255, 255, .1); color: #fff; font: inherit; font-size: 14px; outline: none;
  transition: border-color .25s ease, background-color .25s ease;
}
.ov-chat__form input::placeholder { color: rgba(255, 255, 255, .55); }
.ov-chat__form input:focus { border-color: rgba(252, 221, 8, .7); background: rgba(255, 255, 255, .14); }
.ov-send {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 99px; flex-shrink: 0;
  background: var(--c-yellow); color: var(--c-navy); transition: transform .3s var(--ov-ease), opacity .2s;
}
.ov-send:hover { transform: scale(1.06); }
.ov-send:disabled { opacity: .45; transform: none; cursor: default; }
.ov-send svg { width: 18px; height: 18px; }

/* ---------- Tìm kiếm ---------- */
.ov-search { position: fixed; inset: 0; z-index: 1001; visibility: hidden; transition: visibility 0s linear .45s; font-family: var(--font); }
.ov-search.is-open { visibility: visible; transition: visibility 0s; }
.ov-search__backdrop {
  position: absolute; inset: 0; background: rgba(0, 14, 45, .45);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity .4s ease;
}
.ov-search.is-open .ov-search__backdrop { opacity: 1; }
.ov-search__panel {
  position: relative; width: min(720px, calc(100vw - 32px)); margin: 96px auto 0; border-radius: 20px; overflow: hidden;
  opacity: 0; transform: translateY(-18px) scale(.97); transition: opacity .35s var(--ov-ease), transform .5s var(--ov-ease);
}
.ov-search.is-open .ov-search__panel { opacity: 1; transform: none; }
.ov-search__bar { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 20px; border-bottom: 1px solid var(--ov-line); }
.ov-search__bar > svg { width: 22px; height: 22px; flex-shrink: 0; color: var(--c-yellow); }
.ov-search__bar input {
  flex: 1; height: 52px; border: 0; background: none; color: #fff; outline: none;
  font: inherit; font-size: 20px; font-weight: 500;
}
.ov-search__bar input::placeholder { color: rgba(255, 255, 255, .5); }
.ov-search__bar input::-webkit-search-cancel-button { display: none; }
.ov-kbd { padding: 3px 8px; border-radius: 6px; font-size: 11px; color: rgba(255, 255, 255, .7); border: 1px solid var(--ov-line); }
.ov-search__body { max-height: min(460px, calc(100vh - 220px)); overflow-y: auto; padding: 16px 12px 18px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .25) transparent; }
.ov-search__label { padding: 0 8px 10px; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: rgba(255, 255, 255, .55); }
.ov-search__chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 8px 18px; }
.ov-result {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 10px 12px; border-radius: 12px; text-align: left;
  transition: background-color .2s ease; animation: ov-pop .35s var(--ov-ease) both;
}
.ov-result:hover, .ov-result.is-active { background: rgba(255, 255, 255, .1); }
.ov-result__ico { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0; background: rgba(252, 221, 8, .14); color: var(--c-yellow); font-size: 12px; font-weight: 700; }
.ov-result__txt { flex: 1; min-width: 0; }
.ov-result__txt strong { display: block; font-size: 15px; font-weight: 500; }
.ov-result__txt strong mark { background: none; color: var(--c-yellow); font-weight: 700; }
.ov-result__txt small { font-size: 12px; color: rgba(255, 255, 255, .6); }
.ov-result__go { opacity: 0; transform: translateX(-4px); transition: opacity .2s, transform .3s var(--ov-ease); color: var(--c-yellow); }
.ov-result:hover .ov-result__go, .ov-result.is-active .ov-result__go { opacity: 1; transform: none; }
.ov-search__empty { padding: 28px 8px; text-align: center; color: rgba(255, 255, 255, .75); font-size: 14px; }
.ov-search__empty strong { display: block; margin-bottom: 6px; font-size: 16px; color: #fff; }
.ov-search__foot { display: flex; gap: 16px; padding: 10px 20px; border-top: 1px solid var(--ov-line); font-size: 12px; color: rgba(255, 255, 255, .55); }

/* Toast nhỏ: phản hồi khi chọn kết quả (prototype chưa có trang đích) */
.ov-toast {
  position: fixed; left: 50%; bottom: 32px; z-index: 1002; padding: 12px 20px; border-radius: 99px; font-size: 14px;
  transform: translate(-50%, 20px); opacity: 0; transition: opacity .3s ease, transform .4s var(--ov-ease); pointer-events: none;
}
.ov-toast.is-show { opacity: 1; transform: translate(-50%, 0); }

[data-open] { cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  .ov-chat, .ov-search__panel, .ov-msg, .ov-chat__chips, .ov-result { transition: none !important; animation: none !important; transform: none !important; }
}

/* ---------- Nút Obpa nổi (hiện sau khi cuộn qua hero, ẩn khi khung chat đang mở) ---------- */
.ov-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 999;
  display: grid; place-items: center; width: 62px; height: 62px; padding: 0; border-radius: 99px;
  /* nút nổi trên nền trắng: không dùng kính (thành viền xám) — viền trắng mảnh + bóng xanh thương hiệu */
  background: #fff; box-shadow: 0 12px 28px -8px rgba(0, 46, 140, .45), 0 2px 6px rgba(0, 46, 140, .12);
  opacity: 0; transform: translateY(24px) scale(.6); pointer-events: none;
  transition: opacity .35s ease, transform .55s var(--ov-ease);
}
.ov-fab.is-show { opacity: 1; transform: none; pointer-events: auto; }
.ov-chat-open .ov-fab { opacity: 0; transform: scale(.6); pointer-events: none; }
.ov-fab img { width: 56px; height: 56px; border-radius: 99px; transition: transform .4s var(--ov-ease); }
.ov-fab:hover img { transform: scale(1.08) rotate(-6deg); }
.ov-fab:focus-visible { outline: 2px solid var(--c-yellow); outline-offset: 3px; }
.ov-fab::before { /* vòng sóng mời bấm */
  content: ""; position: absolute; inset: -1px; border-radius: inherit; border: 2px solid rgba(252, 221, 8, .7);
  animation: ov-ripple 2.6s ease-out infinite; pointer-events: none;
}
.ov-fab::after { /* chấm online */
  content: ""; position: absolute; right: 4px; bottom: 5px; width: 13px; height: 13px; border-radius: 99px;
  background: #3ddc84; box-shadow: 0 0 0 2px #fff;
}
@keyframes ov-ripple { 0% { transform: scale(1); opacity: .9; } 70%, 100% { transform: scale(1.45); opacity: 0; } }
.ov-fab__tip {
  position: absolute; right: calc(100% + 12px); top: 50%; padding: 8px 14px; border-radius: 99px;
  font-size: 13px; font-weight: 500; white-space: nowrap; color: #fff; background: var(--c-primary);
  box-shadow: 0 10px 24px -8px rgba(0, 46, 140, .5);
  opacity: 0; transform: translate(8px, -50%); transition: opacity .3s ease, transform .4s var(--ov-ease); pointer-events: none;
}
.ov-fab.is-tip .ov-fab__tip, .ov-fab:hover .ov-fab__tip { opacity: 1; transform: translate(0, -50%); }
@media (prefers-reduced-motion: reduce) { .ov-fab::before { animation: none; } }
