/* Bootstrap 5 Offcanvas styling & mobile navigation layout.
 * Converted to native Bootstrap 5.1.3 Offcanvas component.
 */

/* Language dropdown assets need explicit dimensions. */
.language-menu {
  min-width: 176px;
}

.language-menu .dropdown-item {
  min-height: 42px;
  padding: 8px 12px;
  font-size: 15px;
  line-height: 22px;
}

.language-menu .language-menu-flag,
.language-option-flag {
  flex: 0 0 31px;
  width: 31px !important;
  max-width: 31px !important;
  height: 20px !important;
  max-height: 20px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 2px;
  object-fit: cover;
  margin-right: .5rem;
}

.language-current-flag {
  flex: 0 0 30px;
  width: 30px;
  height: 20px;
  max-width: 30px;
  max-height: 20px;
  display: block;
  object-fit: contain;
  margin-left: .5rem;
}

.language-menu img.language-menu-flag,
.language-menu img.language-option-flag {
  display: block;
}

/* Header navbar toggler button */
.site-header .navbar-toggler {
  padding: 6px 8px;
  border: 0;
  border-radius: 10px;
  outline: 0 !important;
}

.site-header .navbar-toggler:focus {
  box-shadow: 0 0 0 3px rgba(4, 91, 167, .12);
}

/* Native Bootstrap 5 Offcanvas drawer custom styling */
.offcanvas.mobile-offcanvas {
  width: 88vw;
  max-width: 340px;
  border: 0;
  background: #fff;
  box-shadow: -18px 0 40px rgba(20, 20, 20, .14);
}

.offcanvas.mobile-offcanvas .offcanvas-header {
  padding: 18px 24px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-bottom: 0;
}

.offcanvas.mobile-offcanvas .offcanvas-body {
  padding: 0 24px 32px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-drawer-brand {
  display: inline-flex;
  align-items: center;
}

.mobile-drawer-brand img {
  width: 112px;
  height: auto;
  display: block;
}

.mobile-drawer-close {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: #f7fbff;
  color: #141414;
  font-size: 30px;
  font-weight: 300;
  line-height: 1;
  outline: 0 !important;
  cursor: pointer;
  transition: background-color .15s ease;
}

.mobile-drawer-close:hover,
.mobile-drawer-close:focus {
  background: #e9eef3;
}

.mobile-offcanvas .navbar-nav {
  display: block;
  margin-left: 0 !important;
}

.mobile-offcanvas .nav-item,
.mobile-offcanvas .nav-item + .nav-item {
  margin-left: 0;
}

.mobile-offcanvas .nav-link {
  padding: 11px 0 !important;
  line-height: 26px;
  font-size: 18px;
  color: var(--vnpay-gray) !important;
}

.mobile-offcanvas .nav-link.active,
.mobile-offcanvas .nav-link:hover {
  color: var(--vnpay-blue) !important;
}

.mobile-offcanvas .nav-item:not(.language-item) > .nav-link {
  border-bottom: 1px solid #eef3f7;
}

.mobile-offcanvas .language-item {
  margin-top: 12px;
}

.mobile-offcanvas .language-item .nav-link {
  justify-content: space-between;
}

.mobile-offcanvas .dropdown-toggle::after {
  transition: transform .2s ease;
}

.mobile-offcanvas .dropdown-toggle.show::after {
  transform: rotate(180deg);
}

.mobile-offcanvas .dropdown-menu {
  position: static !important;
  transform: none !important;
  inset: auto !important;
  float: none;
  width: 100%;
  margin: 8px 0 12px;
  padding: 6px;
  border: 0;
  border-radius: 12px;
  background: #f7fbff;
  box-shadow: none;
}

.mobile-offcanvas .dropdown-item {
  padding: 9px 12px;
  border-radius: 8px;
}

.mobile-offcanvas .btn-header-download {
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
}

/* Ensure backdrop covers header and has consistent dark tint */
.offcanvas-backdrop {
  z-index: 1040;
}

.offcanvas-backdrop.show {
  background-color: rgba(20, 20, 20, .46);
  opacity: 1;
}

.offcanvas.mobile-offcanvas {
  z-index: 1045;
}

/*
 * Mobile How-to: collapse the desktop vertical timeline into a compact
 * horizontal stepper. The existing JS moves `.active`, so only the
 * selected step copy is revealed and per-step images keep working.
 */
@media (max-width: 767.98px) {
  .howto-main > .col-lg-5 {
    margin-bottom: 26px !important;
  }

  .step-list {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    width: 100%;
    max-width: 420px;
    margin: 0 auto !important;
    padding: 0 0 176px;
  }

  .step-list::before {
    top: 22px;
    right: 22px;
    bottom: auto;
    left: 22px;
    width: auto;
    height: 1px;
  }

  .step-item,
  .step-item.active {
    position: static;
    flex: 1 1 0;
    min-width: 0;
    min-height: 0 !important;
    display: flex;
    justify-content: center;
  }

  .step-button {
    position: static;
    width: auto;
    padding: 0 3px;
    justify-content: center;
  }

  .step-index {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    margin: 0;
    font-size: 22px;
    line-height: 1;
  }

  .step-copy {
    display: none;
  }

  .step-item.active .step-copy {
    position: absolute;
    top: 68px;
    left: 0;
    right: auto;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    display: block;
    margin: 0;
    padding: 0 12px;
    color: var(--vnpay-blue-deep);
    font-size: 16px;
    line-height: 24px;
    font-weight: 500;
    text-align: center;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    animation: mobile-step-copy-in 220ms ease both;
  }

  @keyframes mobile-step-copy-in {
    from { opacity: 0; }
    to { opacity: 1; }
  }
}

@media (max-width: 374.98px) {
  .offcanvas.mobile-offcanvas {
    width: 92vw;
  }

  .offcanvas.mobile-offcanvas .offcanvas-header {
    padding-left: 20px;
    padding-right: 20px;
  }

  .offcanvas.mobile-offcanvas .offcanvas-body {
    padding-left: 20px;
    padding-right: 20px;
  }

  .step-list {
    padding-bottom: 188px;
  }

  .step-index {
    flex-basis: 40px;
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .step-list::before {
    top: 20px;
    right: 20px;
    left: 20px;
  }

  .step-item.active .step-copy {
    top: 64px;
    padding-left: 8px;
    padding-right: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .step-item.active .step-copy {
    animation: none !important;
  }
}