/* ============================================================
 * NEXTFIRE Bottom Sheet + micro-interactions (mobile app-like)
 * File rieng: khong sua nextfire.css. Chi tac dong khi JS bat.
 * ============================================================ */

:root{
  --z-sheet-backdrop:160;
  --z-sheet:170;
  --z-sheet-fab:75;
}

/* ---------- Backdrop ---------- */
.nf-sheet-backdrop{
  position:fixed;inset:0;z-index:var(--z-sheet-backdrop);
  background:rgba(10,12,18,.55);
  opacity:0;visibility:hidden;
  transition:opacity .3s ease,visibility .3s;
  -webkit-tap-highlight-color:transparent;
}
.nf-sheet-backdrop.show{opacity:1;visibility:visible}

/* ---------- Sheet v2: don gian, luon hien khi co class open ---------- */
.nf-sheet{
  position:fixed;left:0;right:0;bottom:0;z-index:var(--z-sheet);
  height:min(88dvh,700px);height:min(88vh,700px);
  background:var(--surface);color:var(--ink);
  border-radius:20px 20px 0 0;
  box-shadow:0 -18px 60px rgba(16,19,28,.25);
  display:flex;flex-direction:column;overflow:hidden;
  transform:translateY(105%);
  transition:transform .35s cubic-bezier(.16,1,.3,1);
  visibility:hidden;pointer-events:none;
  overscroll-behavior:contain;
}
.nf-sheet.open{
  visibility:visible;pointer-events:auto;
  transform:translateY(0) !important;
}
@media(min-width:769px){
  .nf-sheet{left:50%;right:auto;width:min(480px,94vw);transform:translateX(-50%) translateY(105%)}
  .nf-sheet.open{transform:translateX(-50%) translateY(0) !important}
}

/* Vung keo: tay nam + header */
.nf-sheet-grab{touch-action:none;cursor:grab;flex:none;user-select:none;-webkit-user-select:none}
.nf-sheet-grab:active{cursor:grabbing}
.nf-sheet-handle{padding:10px 0 4px;display:grid;place-items:center}
.nf-sheet-handle i{width:44px;height:5px;border-radius:99px;background:var(--line-strong);display:block}
.nf-sheet-head{display:flex;align-items:center;gap:10px;padding:6px 18px 12px}
.nf-sheet-title{font-family:"Unbounded",sans-serif;font-weight:800;font-size:.98rem;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.nf-sheet-close{
  width:34px;height:34px;border-radius:50%;border:1px solid var(--line);
  background:var(--surface-2);color:var(--ink);font-size:1rem;line-height:1;
  display:grid;place-items:center;cursor:pointer;flex:none;
  transition:transform .15s ease,background .15s ease;
}
.nf-sheet-close:active{transform:scale(.9)}

/* Vung cuon noi dung */
.nf-sheet-body{
  flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  padding:2px 18px calc(18px + env(safe-area-inset-bottom,0px));
  touch-action:pan-y;
}

/* Noi dung duoc dua vao sheet: lam phang card de vua */
.nf-sheet-body .form-card,
.nf-sheet-body .brief-result,
.nf-sheet-body .calc-result{box-shadow:none;margin:0;max-width:none}
.nf-sheet-body .form-card{padding:0;border:0;background:transparent}
.nf-sheet-body .filter-bar{display:grid;gap:10px;overflow:visible}
.nf-sheet-body .filter-bar .chip{width:100%;justify-content:flex-start;padding:14px 16px;font-size:.95rem}

/* ---------- Nut noi bat tren mobile ---------- */
.nf-context-fab{
  position:fixed;left:50%;bottom:calc(16px + env(safe-area-inset-bottom,0px));z-index:var(--z-sheet-fab);
  transform:translateX(-50%) translateY(80px);opacity:0;
  display:none;align-items:center;gap:8px;
  background:var(--brand);color:#fff;border:0;border-radius:999px;
  padding:13px 22px;font-weight:800;font-size:.92rem;font-family:"Onest",sans-serif;
  box-shadow:0 14px 34px rgba(51,85,238,.4);cursor:pointer;white-space:nowrap;
  transition:transform .3s var(--ease, cubic-bezier(.16,1,.3,1)),opacity .3s;
  max-width:calc(100vw - 32px);
}
@media(max-width:768px){
  .nf-context-fab{display:inline-flex}
  .nf-context-fab.show{transform:translateX(-50%) translateY(0);opacity:1}
}
.nf-context-fab:active{transform:translateX(-50%) scale(.95)}
.nf-context-fab svg{width:18px;height:18px;flex:none}

/* Nut Loc rieng cho blog/du an tren mobile */
.nf-filter-btn{
  display:none;align-items:center;gap:8px;
  border:1px solid var(--line-strong);background:var(--surface);color:var(--ink);
  border-radius:999px;padding:10px 18px;font-weight:700;font-size:.88rem;cursor:pointer;
  font-family:"Onest",sans-serif;
}
.nf-filter-btn svg{width:16px;height:16px}
@media(max-width:768px){
  .nf-filter-btn.show{display:inline-flex}
  .nf-filter-src{display:none}
}


/* ---------- Tinh chinh thiet ke v2 ---------- */
.nf-sheet-handle{padding:12px 0 6px}
.nf-sheet-handle i{width:48px;height:5px;border-radius:99px;background:#d4d8e0}
.nf-sheet-head{padding:8px 20px 14px;border-bottom:1px solid var(--line)}
.nf-sheet-title{font-size:1.02rem;letter-spacing:-.01em}
.nf-sheet-close{width:36px;height:36px;font-size:1.15rem;background:var(--bg-soft)}
.nf-sheet-close:hover{background:var(--line)}
.nf-sheet-body{padding:16px 20px calc(22px + env(safe-area-inset-bottom,0px))}

/* Nut noi: dep hon, co nhan */
.nf-context-fab{
  padding:14px 24px;font-size:.94rem;
  box-shadow:0 16px 38px rgba(51,85,238,.45),0 2px 8px rgba(16,19,28,.12);
  border:1px solid rgba(255,255,255,.2);
}
.nf-context-fab.show{animation:nfFabIn .4s cubic-bezier(.16,1,.3,1)}
@keyframes nfFabIn{from{transform:translateX(-50%) translateY(80px);opacity:0}to{transform:translateX(-50%) translateY(0);opacity:1}}

/* Nut loc: can doi hon */
.nf-filter-btn{padding:11px 20px;box-shadow:var(--shadow)}
.nf-filter-btn.show{margin:0 auto 14px}

/* ---------- Micro-interactions ---------- */
/* Nhan nut: phong to nho lai */
.btn:active,.chip:active,.fab:active,.nf-filter-btn:active,.nf-context-fab:active{transform:scale(.94)}
.chip,.fab,.nf-filter-btn{transition:transform .16s ease,background .16s ease,box-shadow .16s ease}

/* Card bay nhe khi hover (chi thiet bi co chuot) */
.post-card,.proj-card,.svc-card,.tour-card{transition:transform .25s var(--ease, cubic-bezier(.16,1,.3,1)),box-shadow .25s ease}
@media(hover:hover){
  .post-card:hover,.proj-card:hover,.svc-card:hover,.tour-card:hover{transform:translateY(-5px);box-shadow:var(--shadow-lg)}
}

/* Chuyen view: truot nhe tu duoi len (bo sung cho animation co san) */
.view.enter{animation:viewIn .5s var(--ease, cubic-bezier(.16,1,.3,1)),nfViewUp .45s ease}
@keyframes nfViewUp{from{transform:translateY(14px)}to{transform:translateY(0)}}

/* Skeleton loading cho noi dung dang tai */
.nf-skel{position:relative;overflow:hidden;background:var(--bg-soft);border-radius:12px;min-height:20px;color:transparent !important;pointer-events:none}
.nf-skel *{visibility:hidden}
.nf-skel::after{
  content:"";position:absolute;inset:0;
  background:linear-gradient(100deg,transparent 20%,rgba(255,255,255,.55) 50%,transparent 80%);
  animation:nfShimmer 1.3s infinite;transform:translateX(-100%);
}
@keyframes nfShimmer{to{transform:translateX(100%)}}

/* Khoa cuon body khi sheet mo */
html.nf-lock,html.nf-lock body{overflow:hidden}

/* Giam chuyen dong cho nguoi nhay cam */
@media (prefers-reduced-motion: reduce){
  .nf-sheet,.nf-sheet-backdrop,.nf-context-fab{transition:none}
  .nf-skel::after{animation:none}
  .view.enter{animation:none}
}
