/* Mobile: nút tìm kiếm trên header + thanh điều hướng dưới (bottom-nav) + bottom sheet menu
   (mẫu theo Cap.ispae.vn). Breakpoint 1200px trùng với menu mobile cũ. */
.vs-search-btn,
.vs-bottom-nav,
.vs-sheet,
.vs-sheet-backdrop,
.vs-search-panel {
  display: none;
}

@media (max-width: 1200px) {
  :root {
    --vs-bottom-h: 62px;
  }

  body {
    padding-bottom: calc(var(--vs-bottom-h) + env(safe-area-inset-bottom));
  }

  /* Header: bỏ hamburger, bên phải chỉ còn Ngôn ngữ + Tìm kiếm */
  #nav .menu-button.vs-menu-toggle,
  #nav #nav-icon {
    display: none !important;
  }

  #nav .menu-content {
    display: none !important;
  }

  .vs-search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    z-index: 1210;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 2px solid var(--vs-navy);
    border-radius: 10px;
    background: #fff;
    color: var(--vs-navy);
    font-size: 17px;
    box-shadow: 0 2px 8px rgba(20, 54, 93, 0.12);
    cursor: pointer;
  }

  .vs-search-btn:active {
    transform: translateY(-50%) scale(0.94);
  }

  /* Tìm kiếm */
  .vs-search-panel {
    position: fixed;
    inset: 0;
    z-index: 1000100; /* trên #nav (99999) */
    display: block;
    padding: 12px;
    background: rgba(22, 32, 42, 0.5);
  }

  .vs-search-panel[hidden] {
    display: none;
  }

  .vs-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 6px 6px 14px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 18px 40px -12px rgba(15, 27, 42, 0.45);
  }

  .vs-search-box > .fa {
    color: var(--vs-muted);
  }

  .vs-search-box input {
    flex: 1 1 auto;
    min-width: 0;
    height: 44px;
    border: 0;
    outline: 0;
    font-size: 17px;
    background: transparent;
  }

  .vs-search-box button {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: var(--vs-bg);
    color: var(--vs-ink);
    font-size: 18px;
  }

  .vs-search-box button.vs-search-go {
    background: var(--vs-brand);
    color: #fff;
  }

  /* Thanh điều hướng dưới */
  .vs-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1100;
    height: calc(var(--vs-bottom-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, 0.97);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--vs-line);
    box-shadow: 0 -8px 24px -18px rgba(15, 27, 42, 0.45);
  }

  .vs-bottom-nav a,
  .vs-bottom-nav button {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--vs-muted) !important;
    font-family: var(--vs-font);
    font-size: 11.5px !important;
    font-weight: 700;
    line-height: 1.1;
    text-decoration: none !important;
    cursor: pointer;
  }

  .vs-bottom-nav .fa {
    font-size: 21px;
    transition: transform 0.2s;
  }

  .vs-bottom-nav .on {
    color: var(--vs-brand) !important;
  }

  .vs-bottom-nav .on::before {
    content: "";
    position: absolute;
    top: 0;
    width: 28px;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: var(--vs-gold);
  }

  .vs-bottom-nav .on .fa {
    transform: translateY(-1px) scale(1.06);
  }

  .vs-bottom-nav a:active .fa,
  .vs-bottom-nav button:active .fa {
    transform: scale(0.9);
  }

  /* Bottom sheet menu */
  .vs-sheet-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1000200;
    background: rgba(22, 32, 42, 0.5);
    opacity: 0;
    transition: opacity 0.25s;
  }

  .vs-sheet-backdrop.open {
    opacity: 1;
  }

  .vs-sheet-backdrop[hidden],
  .vs-sheet[hidden] {
    display: none;
  }

  .vs-sheet {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000210;
    max-height: 86vh;
    padding-bottom: env(safe-area-inset-bottom);
    background: #fff;
    border-radius: 22px 22px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .vs-sheet.open {
    transform: none;
  }

  .vs-sheet-handle {
    width: 42px;
    height: 5px;
    margin: 10px auto 4px;
    border-radius: 9px;
    background: var(--vs-line);
  }

  .vs-sheet-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 16px 12px;
    border-bottom: 1px solid var(--vs-line);
  }

  .vs-sheet-head strong {
    margin-right: auto;
    font-size: 19px;
    font-weight: 800;
    color: var(--vs-navy);
  }

  .vs-sheet-head button {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: var(--vs-bg);
    color: var(--vs-ink);
    font-size: 17px;
  }

  .vs-sheet-body {
    overflow-y: auto;
    padding: 4px 16px 10px;
    overscroll-behavior: contain;
  }

  .vs-sheet-head a.vs-sheet-all {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--vs-brand) !important;
    font-size: 14px !important;
    font-weight: 700;
    text-decoration: none !important;
    white-space: nowrap;
  }

  .vs-sheet-body {
    padding: 14px 16px 18px;
  }

  /* 3 ngành hàng: hình chữ nhật xếp dọc */
  .vs-sector-tiles {
    display: grid;
    gap: 12px;
  }

  .vs-sheet a.vs-sector-tile {
    --tile-c: var(--vs-navy);
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 78px;
    padding: 12px 16px 12px 12px;
    border: 1px solid color-mix(in srgb, var(--tile-c) 28%, #fff);
    border-left: 5px solid var(--tile-c);
    border-radius: 14px;
    background: linear-gradient(100deg, color-mix(in srgb, var(--tile-c) 9%, #fff) 0%, #fff 70%);
    color: var(--vs-ink) !important;
    text-decoration: none !important;
    transition: transform 0.15s ease;
  }

  .vs-sheet a.vs-sector-tile:active {
    transform: scale(0.97);
  }

  .vs-sheet a.vs-sector-tile.is-lua { --tile-c: #b7860b; }
  .vs-sheet a.vs-sector-tile.is-caphe { --tile-c: #8a5a2b; }
  .vs-sheet a.vs-sector-tile.is-rauqua { --tile-c: #2e8b57; }

  .vs-sector-tile__logo {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: #16202a;
  }

  .vs-sector-tile__logo img {
    max-width: 34px;
    max-height: 34px;
  }

  .vs-sector-tile__body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .vs-sector-tile__body strong {
    color: var(--tile-c);
    font-size: 18px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }

  .vs-sheet .vs-sector-tile__body small {
    color: var(--vs-muted);
    font-size: 13.5px !important;
    line-height: 1.35;
  }

  .vs-sector-tile > .fa {
    flex: 0 0 auto;
    color: var(--tile-c);
    font-size: 22px;
  }

  /* Nút "Cài đặt ứng dụng" không bị thanh dưới che */
  .vs-footer-bottom {
    padding-bottom: 8px;
  }

  /* Footer chỉ hiện ở trang chủ — trang khác dành chỗ cho nội dung */
  body:not(.vs-home) .vs-footer {
    display: none;
  }

  /* Trang nhúng (iframe) không có thanh dưới */
  body.vs-embed {
    padding-bottom: 0;
  }

  body.vs-embed .vs-bottom-nav,
  body.vs-embed .vs-search-btn {
    display: none;
  }
}

@media (max-width: 480px) {
  .vs-search-btn {
    right: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vs-sheet,
  .vs-sheet-backdrop,
  .vs-bottom-nav .fa {
    transition: none;
  }
}
