﻿/* ================================
   WCAF Mobile â€“ FULL CSS (fixed)
   ================================ */

/* Tokens */
.wcaf-mobile-bar,
#wcaf-offcanvas{
  --primary-gradient: linear-gradient(135deg, #1F5D8F, #3B9FC0);
  --radius: 14px;
  --shadow: 0 8px 16px rgba(3,3,89,.15);
}

/* --- Top bar (Ä‘áº·t TRÃŠN tiÃªu Ä‘á», chá»‰ mobile) --- */
.wcaf-mobile-bar{ display:none; margin:8px 0 12px; }
@media (max-width: 991.98px){
  .wcaf-mobile-bar{ display:flex; justify-content:center; }
}

/* NÃºt â€œLá»ŒC Sáº¢N PHáº¨Mâ€ â€“ nhá», cÄƒn giá»¯a, gradient */
.wcaf-mobile-bar .wcaf-mobile-toggle{
  width: clamp(220px, 50vw, 320px);
  padding: 0px 10px;
  border: 0;
  border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-transform: uppercase; font-weight: 700; letter-spacing: .3px;
  color: #fff; background-image: var(--primary-gradient);
  background-size: 200% 100%; background-position: 0 0;
  box-shadow: var(--shadow);
  transition: background-position .3s ease, transform .06s ease, box-shadow .2s ease;
}
.wcaf-mobile-bar .wcaf-mobile-toggle:hover{
  background-position: 100% 0;
  box-shadow: 0 10px 20px rgba(12,105,242,.22);
}
.wcaf-mobile-bar .wcaf-mobile-toggle:active{ transform: translateY(1px); }
.wcaf-mobile-toggle__icon{
  width: 16px; height: 16px; background: currentColor;
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path fill="%23fff" d="M4 6h16v2H4V6zm3 5h10v2H7v-2zm-2 5h14v2H5v-2z"/></svg>') no-repeat center/contain;
          mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path fill="%23fff" d="M4 6h16v2H4V6zm3 5h10v2H7v-2zm-2 5h14v2H5v-2z"/></svg>') no-repeat center/contain;
}

/* --- Off-canvas: cá»‘ Ä‘á»‹nh, khÃ´ng kÃ©o lá»‡ch, iOS-safe --- */
#wcaf-offcanvas{
  position: fixed; inset: 0; z-index: 1200; pointer-events: none;
  overscroll-behavior: none;     /* cháº·n overscroll ná»n */
  touch-action: none;            /* cháº·n pan trÃªn overlay */
}
#wcaf-offcanvas .wcaf-offcanvas__overlay{
  position: absolute; inset: 0; background: rgba(0,0,0,.5);
  opacity: 0; transition: opacity .25s;
}

/* Panel trÆ°á»£t bÃªn pháº£i â€“ neo top&bottom Ä‘á»ƒ khÃ´ng bá»‹ che footer */
#wcaf-offcanvas .wcaf-offcanvas__panel{
  position: fixed; right: 0; top: 0; bottom: 0;   /* quan trá»ng */
  width: 86%; max-width: 420px;

  /* chiá»u cao an toÃ n trÃªn iOS */
  height: auto; min-height: 100%;
  height: 100vh;   /* fallback */
  height: 100svh;  /* Safari iOS 16+ */
  height: 100dvh;  /* Viewport Ä‘á»™ng */

  background: #fff; box-shadow: -2px 0 24px rgba(0,0,0,.18);
  transform: translateX(102%); transition: transform .28s ease;
  display: flex; flex-direction: column; border-radius: 10px 0 0 10px;
  overflow: hidden;                 /* header/footer cá»‘ Ä‘á»‹nh */
  overscroll-behavior: contain;     /* khÃ´ng â€œtrÃ´iâ€ panel */
  touch-action: none;               /* khÃ´ng pan panel */
}

#wcaf-offcanvas .wcaf-offcanvas__header{
  padding: 0 10px; border-bottom: 1px solid #eee;
  display: flex; justify-content: space-between; align-items: center;
}
#wcaf-offcanvas .wcaf-offcanvas__title{ font-weight: 700; }
#wcaf-offcanvas .wcaf-offcanvas__close{
  background: none; border: 0; font-size: 18px; line-height: 1; cursor: pointer;
}

/* Chá»‰ BODY Ä‘Æ°á»£c cuá»™n dá»c */
#wcaf-offcanvas .wcaf-offcanvas__body{
  flex: 1 1 auto; min-height: 0;
  padding: 12px 14px;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;              /* chá»‰ cho kÃ©o dá»c */
  overscroll-behavior: contain;
}

/* --- Footer: 2 hÃ ng, full width --- */
#wcaf-offcanvas .wcaf-offcanvas__footer{
  padding: 12px 14px;
  border-top: 1px solid #eee;
  display: grid;
  grid-template-columns: 1fr;   /* 1 cá»™t => má»—i nÃºt 1 hÃ ng */
  gap: 5px;
  background: #fff;
}
#wcaf-offcanvas .wcaf-btn{
  width: 100%;
  padding: 0px 10px;
  border-radius: 5px;
  border: 1px solid transparent;
  font-weight: 600;
}
#wcaf-offcanvas .wcaf-btn--apply{
  color: #fff; border: 0;
  background-image: var(--primary-gradient);
  background-size: 200% 100%; background-position: 0 0;
  box-shadow: var(--shadow);
  transition: background-position .3s ease, transform .06s ease, box-shadow .2s ease;
}
#wcaf-offcanvas .wcaf-btn--apply:hover{
  background-position: 100% 0; box-shadow: 0 8px 18px rgba(12,105,242,.22);
}
#wcaf-offcanvas .wcaf-btn--apply:active{ transform: translateY(1px); }
#wcaf-offcanvas .wcaf-btn--reset{
  background: #f5f6f8; color: #111; border-color: #e5e7eb;
}

/* Tráº¡ng thÃ¡i má»Ÿ + khoÃ¡ scroll ná»n */
#wcaf-offcanvas.is-open{ pointer-events: auto; }
#wcaf-offcanvas.is-open .wcaf-offcanvas__overlay{ opacity: 1; }
#wcaf-offcanvas.is-open .wcaf-offcanvas__panel{ transform: translateX(0); }
html.wcaf-locked, body.wcaf-locked{ overflow: hidden !important; }

/* Safe-area iPhone â€“ Ä‘áº©y footer lÃªn khá»i home bar */
@supports(padding: max(0px)){
  .wcaf-mobile-bar{ margin-bottom: max(12px, env(safe-area-inset-bottom)); }
  #wcaf-offcanvas .wcaf-offcanvas__footer{
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
}
