/* ===================================================================
   VuiSoDep - Giao dien dien thoai cho cac trang nguoi mua
   (trang chu, dang nhap, dang ky).
   TAT CA quy tac nam trong @media (max-width: 767.98px):
   man hinh tu 768px tro len (may tinh / tablet) KHONG doi mot pixel nao.
   Dung !important vi Tailwind CDN chen CSS cua no SAU file nay.
   =================================================================== */
@media (max-width: 767.98px) {

  html { -webkit-text-size-adjust: 100%; }
  body { overflow-x: hidden; }
  .vsd-m-hide { display: none !important; }
  /* Chu 10-11px qua nho tren dien thoai -> toi thieu 12px */
  .text-\[10px\], .text-\[11px\] { font-size: 12px !important; }

  /* ---------- 1. Thanh xanh tren cung: logo + o tim kiem + icon tai khoan ---------- */
  .vsd-topbar { padding: .5rem .625rem !important; }
  .vsd-topbar__inner {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    column-gap: .5rem;
  }
  .vsd-topbar__brand, .vsd-topbar__links { display: contents !important; }
  .vsd-topbar__logo { grid-column: 1; min-height: 44px; display: flex !important; align-items: center; }
  .vsd-topbar__logo > div {
    font-size: 1.0625rem !important; line-height: 1.25rem !important;
    padding: .375rem .5rem !important; letter-spacing: -.01em;
  }
  .vsd-topbar__search { grid-column: 2; margin-left: 0 !important; max-width: none !important; }
  .vsd-topbar__search input {
    height: 44px; font-size: 16px !important; /* >=16px: iOS khong tu phong to khi go */
    padding-top: 0 !important; padding-bottom: 0 !important; border-radius: .5rem !important;
    padding-right: 46px !important;
  }
  .vsd-topbar__search button { width: 44px; padding: 0 !important; border-radius: 0 .5rem .5rem 0 !important; }
  .vsd-topbar__links > *:not(#accountMenuLink):not(#accountLoginLink):not(.vsd-topbar__call) { display: none !important; }
  #accountMenuLink, #accountLoginLink, .vsd-topbar__call {
    grid-column: 3; justify-self: end; position: relative;
    width: 44px; height: 44px; border-radius: 9999px; padding: 0 !important; margin: 0 !important;
    display: inline-flex !important; align-items: center; justify-content: center; gap: 0 !important;
    background: rgba(255, 255, 255, .16); color: #fff !important;
    font-size: 0 !important; /* chi hien icon; ten van con trong aria-label/title */
  }
  #accountMenuLink > :not(.fa-user), #accountLoginLink > :not(.fa-user) { display: none !important; }
  #accountMenuLink .fa-user, #accountLoginLink .fa-user, .vsd-topbar__call i { font-size: 18px !important; margin: 0 !important; }
  /* Da dang nhap: cham xanh nho tren icon */
  #accountMenuLink::after {
    content: ""; position: absolute; top: 7px; right: 7px; width: 10px; height: 10px;
    border-radius: 9999px; background: #34d399; box-shadow: 0 0 0 2px #1877F2;
  }
  /* Trang dang nhap/dang ky: them nut goi canh icon tai khoan */
  .vsd-topbar--simple .vsd-topbar__inner { grid-template-columns: auto 1fr auto auto; }
  .vsd-topbar--simple .vsd-topbar__call { grid-column: 3; }
  .vsd-topbar--simple #accountMenuLink, .vsd-topbar--simple #accountLoginLink { grid-column: 4; }

  /* Dong chu chay: giu nguyen, gon hon mot chut */
  .vsd-marquee { padding-top: .25rem !important; padding-bottom: .25rem !important; }
  .vsd-marquee__text { font-size: 15px !important; }

  /* ---------- 2. Menu: hang "pill" cuon ngang ---------- */
  .vsd-nav {
    padding: .375rem .5rem !important;
    scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-padding: 0 .5rem;
    /* mo dan o mep phai: goi y con muc menu khi cuon ngang */
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
  .vsd-nav::-webkit-scrollbar { display: none; }
  .vsd-nav > div { gap: .375rem; }
  .vsd-nav > div > a {
    display: flex !important; align-items: center; flex: 0 0 auto;
    min-height: 44px; padding: 0 .875rem !important; border-radius: 9999px;
    border: 0 !important; background: rgba(255, 255, 255, .14);
    font-size: 13px !important; letter-spacing: .01em;
  }
  .vsd-nav > div > a.vsd-nav__active { background: #fff !important; color: #1877F2 !important; }
  .vsd-nav__contact { display: none !important; }

  /* ---------- 3. Bo loc: nut "Bo loc" + bottom sheet ---------- */
  .vsd-filtercard { padding: .75rem !important; margin-bottom: .75rem !important; }
  .vsd-mfilterbar__btn { min-height: 44px; font-size: 15px; }
  .vsd-mfilterbar__reset { min-height: 44px; font-size: 14px; }

  #filterSheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 56;
    display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; gap: .625rem !important;
    margin: 0 !important; padding: 0 1rem !important;
    max-height: 85vh; max-height: 85dvh; overflow-y: auto; overscroll-behavior: contain;
    background: #fff; border-radius: 1.125rem 1.125rem 0 0; box-shadow: 0 -12px 40px rgba(15, 23, 42, .25);
    transform: translateY(105%); visibility: hidden;
    transition: transform .28s cubic-bezier(.16, 1, .3, 1), visibility 0s linear .28s;
  }
  body.vsd-sheet-open #filterSheet { transform: none; visibility: visible; transition: transform .28s cubic-bezier(.16, 1, .3, 1); }
  body.vsd-sheet-open { overflow: hidden; }
  #filterSheetBackdrop {
    display: block !important; position: fixed; inset: 0; z-index: 55; background: rgba(15, 23, 42, .55);
    opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  body.vsd-sheet-open #filterSheetBackdrop { opacity: 1; pointer-events: auto; }
  #filterSheet > select {
    height: 48px; font-size: 15px !important; padding: 0 .75rem !important; border-radius: .625rem !important; color: #111827;
  }
  .vsd-sheet__head {
    display: flex !important; position: sticky; top: 0; z-index: 1; grid-column: 1 / -1;
    align-items: center; justify-content: space-between; background: #fff;
    padding: .375rem 0 .5rem; margin: 0 0 .125rem; border-bottom: 1px solid #f1f5f9;
  }
  .vsd-sheet__head::before {
    content: ""; position: absolute; top: 6px; left: 50%; width: 40px; height: 4px; margin-left: -20px;
    border-radius: 9999px; background: #cbd5e1;
  }
  .vsd-sheet__title { font-size: 17px; font-weight: 800; color: #111827; padding-top: .75rem; }
  .vsd-sheet__close { width: 44px; height: 44px; margin-top: .375rem; font-size: 26px; }
  .vsd-sheet__foot {
    display: flex !important; position: sticky; bottom: 0; grid-column: 1 / -1; margin-top: .25rem;
    gap: .625rem; background: #fff; padding: .75rem 0 calc(.75rem + env(safe-area-inset-bottom)); border-top: 1px solid #f1f5f9;
  }
  .vsd-sheet__foot button { min-height: 48px; font-size: 15px; }
  /* Tuy chon (tra gop / khuyen mai / dai cat + sap xep) duoc chuyen vao sheet tren dien thoai */
  #filterSheet #filterOptions {
    grid-column: 1 / -1; display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; font-size: 14px;
  }
  #filterSheet #filterOptions > label {
    min-height: 44px; justify-content: center; gap: .375rem !important;
    border: 1px solid #cbd5e1; border-radius: .625rem; background: #f8fafc; font-weight: 600; text-align: center; line-height: 1.15;
  }
  #filterSheet #filterOptions > label:has(input:checked) { border-color: #1877F2; background: #e7f3ff; color: #1877F2; }
  #filterSheet #filterOptions input[type=checkbox] { width: 18px; height: 18px; flex: 0 0 auto; }
  #filterSheet #filterOptions > div { grid-column: 1 / -1; gap: .5rem !important; }
  #filterSheet #sortOrder { flex: 1; height: 48px; font-size: 15px !important; padding: 0 .75rem !important; border-radius: .625rem !important; }

  /* Nha mang + khoang gia: hang chip cuon ngang */
  .vsd-chiprow {
    display: flex !important; flex-wrap: nowrap !important; gap: .5rem !important; overflow-x: auto;
    margin-left: -.75rem; margin-right: -.75rem; padding: 0 .75rem .125rem; scrollbar-width: none;
    -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity;
  }
  .vsd-chiprow::-webkit-scrollbar { display: none; }
  .vsd-chiprow > button {
    flex: 0 0 auto; min-height: 44px; padding: 0 1rem !important; border-radius: 9999px !important;
    font-size: 14px !important; white-space: nowrap; scroll-snap-align: start;
  }
  .vsd-chiprow--telco { padding-bottom: .625rem !important; margin-bottom: .625rem !important; }
  .vsd-chiprow > button[data-price-more] { display: inline-flex !important; align-items: center; }
  #priceMoreToggle { display: none !important; }
  .vsd-chiprow > button.vsd-chip-active {
    background: #1877F2 !important; border-color: #1877F2 !important; color: #fff !important;
  }
  .vsd-pricewrap { display: block !important; }

  /* ---------- 4. Danh sach SIM dang the (card) ---------- */
  .vsd-maingrid { gap: .75rem !important; }
  .vsd-list { order: -1; scroll-margin-top: 64px; }
  .vsd-list__head { padding: .75rem .875rem !important; }
  #tableTitle { font-size: 15px !important; }
  .vsd-list__head > span { font-size: 13px !important; white-space: nowrap; }
  .vsd-simtable, .vsd-simtable > tbody { display: block; }
  .vsd-simtable > thead { display: none; }
  #simTableBody { display: grid; gap: .625rem; padding: .625rem; background: #f4f6f9; }
  #simTableBody > tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "num num tel" "price ht score" "buy buy buy";
    align-items: center; gap: .375rem .5rem; padding: .875rem .875rem .75rem;
    background: #fff; border: 1px solid #e2e8f0 !important; border-radius: .875rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
  }
  #simTableBody > tr > td { display: block; padding: 0 !important; }
  #simTableBody td[data-c="stt"] { display: none; }
  #simTableBody td[data-c="num"] {
    grid-area: num; font-size: 23px !important; line-height: 1.2; letter-spacing: .02em !important; font-weight: 800;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  #simTableBody td[data-c="price"] { grid-area: price; text-align: left !important; font-size: 18px; line-height: 1.25; color: #dc2626; }
  #simTableBody td[data-c="price"] > div { font-size: 12px !important; font-weight: 600 !important; }
  #simTableBody td[data-c="score"] {
    grid-area: score; justify-self: end; font-size: 13px; font-weight: 700 !important;
    background: #e7f3ff; color: #1877F2 !important; border-radius: 9999px; padding: .25rem .625rem !important; white-space: nowrap;
  }
  #simTableBody td[data-c="score"]::before { content: "Điểm "; font-weight: 600; }
  #simTableBody td[data-c="telco"] {
    grid-area: tel; justify-self: end; font-size: 13px; border: 1px solid currentColor;
    border-radius: 9999px; padding: .1875rem .625rem !important; white-space: nowrap;
  }
  #simTableBody td[data-c="ht"] { grid-area: ht; justify-self: end; }
  #simTableBody td[data-c="ht"] > .vsd-ht { font-size: 12px !important; padding: .1875rem .5rem; }
  #simTableBody td[data-c="buy"] { grid-area: buy; margin-top: .375rem; }
  #simTableBody td[data-c="buy"] > button {
    width: 100%; min-height: 46px; font-size: 15px !important; border-radius: .625rem !important; letter-spacing: .03em;
  }
  #noResults button { min-height: 44px; padding: 0 1rem !important; font-size: 14px !important; }
  .vsd-list__foot { flex-direction: column; justify-content: center !important; padding: .75rem !important; }
  .vsd-list__foot > div:first-child { font-size: 13px !important; }
  #paginationButtons { flex-wrap: wrap; justify-content: center; gap: .375rem !important; }
  #paginationButtons > button { min-width: 44px; min-height: 44px; font-size: 15px; border-radius: .5rem !important; }

  /* ---------- 5. Cot ben (Sim theo gia, Don hang moi, Dau so...) -> duoi danh sach, thu gon ---------- */
  .vsd-aside > * + * { margin-top: .625rem !important; }
  .vsd-boxhead {
    min-height: 48px; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
    display: flex !important; align-items: center; gap: .5rem; font-size: 14px !important; margin-bottom: 0 !important;
  }
  .vsd-boxhead::after {
    content: ""; margin-left: auto; width: 9px; height: 9px; flex: 0 0 auto;
    border-right: 2px solid #64748b; border-bottom: 2px solid #64748b; transform: rotate(45deg) translateY(-3px);
    transition: transform .2s;
  }
  [data-mcollapse="closed"]:not(.vsd-toggled) > .vsd-boxhead,
  [data-mcollapse="open"].vsd-toggled > .vsd-boxhead { border-bottom-color: transparent !important; }
  [data-mcollapse="closed"]:not(.vsd-toggled) > .vsd-boxhead::after,
  [data-mcollapse="open"].vsd-toggled > .vsd-boxhead::after { transform: rotate(-45deg); }
  [data-mcollapse="open"]:not(.vsd-toggled) > .vsd-boxhead::after,
  [data-mcollapse="closed"].vsd-toggled > .vsd-boxhead::after { transform: rotate(-135deg) translate(-2px, -2px); }
  [data-mcollapse="closed"]:not(.vsd-toggled) > :not(.vsd-boxhead),
  [data-mcollapse="open"].vsd-toggled > :not(.vsd-boxhead) { display: none !important; }
  /* Widget nam sinh co padding ngoai -> header chiem tron chieu ngang */
  .vsd-dobbox { padding: 0 !important; }
  .vsd-dobbox > .vsd-boxhead { padding: 0 .875rem; }
  .vsd-dobbox > :not(.vsd-boxhead) { margin-left: .875rem; margin-right: .875rem; }
  .vsd-dobbox > button { width: calc(100% - 1.75rem) !important; margin-bottom: .875rem; min-height: 44px; font-size: 14px !important; }
  .vsd-dobbox select { height: 44px; font-size: 16px !important; }
  /* Lien ket trong hop -> luoi 2 cot, moi o cao 44px */
  .vsd-linklist { display: grid !important; grid-template-columns: 1fr 1fr; }
  .vsd-linklist > a {
    display: flex !important; align-items: center; min-height: 44px; font-size: 14px !important;
    border-top: 1px solid #f1f5f9 !important; border-bottom: 0 !important;
  }
  .vsd-linklist > a:nth-child(odd) { border-right: 1px solid #f1f5f9; }
  #recentOrdersList { font-size: 13px; }
  #recentOrdersList .text-xs { font-size: 14px !important; }
  #telcoPrefixesBox .vsd-prefix-row { font-size: 13px; }

  /* ---------- 6. Chan trang ---------- */
  .vsd-steps { margin: 1rem 0 !important; }
  .vsd-steps span { font-size: 13px; }
  #footer-section { font-size: 13px; padding-bottom: 6.5rem !important; }
  #footer-section ul { display: grid; grid-template-columns: 1fr 1fr; column-gap: 1rem; }
  #footer-section ul > li { margin-top: 0 !important; }
  #footer-section ul a { display: inline-flex; align-items: center; min-height: 44px; }
  #footer-section a[href^="tel:"].inline-block, #footer-section a[href*="zalo.me"].inline-block {
    min-height: 44px; display: inline-flex !important; align-items: center; padding: 0 .875rem !important; font-size: 14px !important;
  }
  #footer-section p { line-height: 1.9; }
  .vsd-simple-footer { padding-bottom: 6.5rem !important; }
  .vsd-simple-footer a.inline-block { min-height: 44px; display: inline-flex !important; align-items: center; }

  /* ---------- 7. Nut noi Goi / Zalo + nut len dau trang ---------- */
  .vsd-fab { display: flex !important; bottom: calc(1rem + env(safe-area-inset-bottom)) !important; }
  .vsd-fab > a { width: 52px !important; height: 52px !important; }
  #backToTopBtn {
    left: .75rem !important; right: auto !important; bottom: calc(1rem + env(safe-area-inset-bottom)) !important;
    width: 44px; height: 44px; padding: 0 !important; display: flex; align-items: center; justify-content: center;
  }
  #backToTopBtn.hidden { display: none !important; }

  /* ---------- 8. Popup: tran chieu ngang, mo tu duoi len ---------- */
  [data-info-backdrop], [data-pricing-backdrop] { padding: 0 !important; align-items: flex-end !important; }
  [data-info-backdrop] > div, [data-pricing-backdrop] > div, #orderModal > div {
    max-width: none !important; width: 100% !important; border-radius: 1.125rem 1.125rem 0 0 !important;
    border-left: 0 !important; border-right: 0 !important; border-bottom: 0 !important;
    padding-bottom: env(safe-area-inset-bottom);
  }
  #orderModal { padding: 0 !important; align-items: flex-end !important; }
  #orderModal > div { max-height: 92vh; max-height: 92dvh; overflow-y: auto; }
  [data-info-close], #pricing-modal button[aria-label="Đóng"], #orderModal button[aria-label="Đóng"] {
    width: 44px !important; height: 44px !important; margin-right: -.5rem !important; font-size: 28px !important;
  }
  [data-info-modal] .bg-brand-blue.uppercase, #pricing-modal .bg-brand-blue.uppercase { font-size: 14px !important; padding-top: .375rem; padding-bottom: .375rem; }
  [data-info-modal] input:not([type=checkbox]), #pricing-modal input, #orderModal input {
    min-height: 48px; font-size: 16px !important;
  }
  [data-info-modal] button[type=submit], #pricing-modal button[type=submit], #orderModal button { min-height: 48px; font-size: 15px !important; }
  [data-info-modal] .text-sm, #orderModal label { font-size: 14px; }
  #orderModal h2 { font-size: 15px !important; }
  #modalSimNumber { font-size: 22px !important; letter-spacing: .02em; }
  #modalSimPrice { font-size: 18px; color: #dc2626; }
  #payment-modal button[onclick^="copyBankAccount"] { min-height: 40px; padding: 0 .75rem !important; font-size: 13px !important; }
  #account-modal a[href="/user/logout"] { min-height: 44px; display: inline-flex; align-items: center; }
  #pricing-result button, #pt-result button { min-height: 44px; }
  #vsdToasts { top: auto !important; bottom: calc(5.5rem + env(safe-area-inset-bottom)); }

  /* ---------- 9. Dang nhap / Dang ky ---------- */
  .vsd-authmain { padding-top: 1rem !important; padding-bottom: 1.5rem !important; }
  .vsd-authcard p, .vsd-authcard label { font-size: 13px !important; }
  .vsd-authcard input { min-height: 48px; font-size: 16px !important; }
  .vsd-authcard button[type=submit] { min-height: 48px; font-size: 16px !important; }
  .vsd-authcard a, .vsd-authback a { min-height: 44px; display: inline-flex; align-items: center; }
  .vsd-authback { font-size: 14px !important; }
}

/* Man hinh rat hep (<=374px, vd 360px): logo nho lai de o tim kiem rong hon */
@media (max-width: 374.98px) {
  .vsd-topbar__inner { column-gap: .375rem; }
  .vsd-topbar__logo > div { font-size: 15px !important; padding: .375rem .4375rem !important; }
}

/* Nut noi va bottom sheet: CHI hien tren dien thoai */
@media (min-width: 768px) {
  .vsd-fab, #filterSheetBackdrop, .vsd-sheet__head, .vsd-sheet__foot, .vsd-mfilterbar { display: none !important; }
}
