/* ============================================================
   VAPEZERA — Mobile Header & Offcanvas Menu
   Header responsivo, offcanvas lateral, busca mobile,
   submenus accordion, áreas de conta/atendimento.
   Inspirado na estrutura mobile da Aldeia Vape (UX only).
   ============================================================ */

/* ===== MOBILE HEADER LAYOUT (<=768px) ===== */
@media (max-width: 768px) {

  /* --- Outer header: solid white, no glass effect on mobile --- */
  .header {
    background: #fff !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* --- Topbar: hide on mobile --- */
  .header-top {
    display: none !important;
  }

  /* --- Header Main: mobile grid --- */
  .header-main {
    padding: 0;
    background: #fff;
    border-bottom: 1px solid var(--vz-gray-border, #E7E7E7);
    position: relative;
  }

  .header-main .container {
    display: grid;
    grid-template-columns: 44px 1fr auto auto auto;
    grid-template-rows: auto auto;
    gap: 0;
    padding: 8px 12px 0;
    align-items: center;
    min-height: auto !important;
  }

  /* --- Hamburger --- */
  .menu-toggle {
    display: flex !important;
    grid-column: 1;
    grid-row: 1;
    width: 44px;
    height: 44px;
    padding: 0;
    margin: 0;
    background: none;
    border: 0;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    position: relative;
    z-index: 11;
    touch-action: manipulation;
  }

  .menu-toggle span {
    display: block;
    width: 20px;
    height: 2.5px;
    background: #1C1C1C;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
  }

  .menu-toggle.is-open span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
    background: #C90000;
  }

  .menu-toggle.is-open span:nth-child(2) {
    opacity: 0;
  }

  .menu-toggle.is-open span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
    background: #C90000;
  }

  /* --- Logo --- */
  .logo {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    min-width: 0;
    text-align: center;
    padding: 4px 0;
  }

  .logo img {
    max-height: 36px;
    width: auto;
    display: block;
    margin: 0 auto;
  }

  .logo-fallback {
    font-size: 18px;
    font-weight: 900;
    color: #1C1C1C;
    letter-spacing: -0.5px;
  }

  .logo-fallback::first-letter {
    color: #C90000;
  }

  /* --- Header Actions (account, favorites, cart) --- */
  .header-actions {
    display: flex !important;
    grid-column: 3 / -1;
    grid-row: 1;
    align-items: center;
    gap: 0;
    margin-left: auto;
  }

  .header-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1C1C1C;
    text-decoration: none;
    position: relative;
    border-radius: 0;
    font-size: 0;
  }

  .header-btn svg {
    width: 20px;
    height: 20px;
    display: block;
  }

  .header-btn span:not(.cart-badge) {
    display: none !important;
  }

  .header-btn:active {
    opacity: 0.6;
  }

  /* --- Favorites (mobile only) --- */
  .header-btn--favorites {
    display: flex !important;
  }

  /* --- Cart Badge --- */
  .cart-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    background: #C90000;
    color: #fff;
    font-size: 9px;
    font-weight: 900;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    animation: none !important;
  }

  /* --- Search Row (mobile) --- */
  .header-search-row {
    grid-column: 1 / -1;
    grid-row: 2;
    padding: 8px 0 10px;
    display: block;
  }

  .header-search-row form {
    display: flex;
    align-items: center;
    gap: 0;
    height: 42px;
    background: #F6F6F6;
    border: 1px solid #E7E7E7;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
  }

  .header-search-row form:focus-within {
    border-color: #C90000;
  }

  .header-search-row input {
    flex: 1;
    height: 42px;
    background: transparent;
    border: 0;
    outline: none;
    padding: 0 14px;
    font-size: 14px;
    color: #1C1C1C;
    font-family: inherit;
  }

  .header-search-row input::placeholder {
    color: #999;
    font-size: 13px;
  }

  .header-search-row button {
    width: 42px;
    height: 42px;
    border: 0;
    background: transparent;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    transition: color 0.2s;
  }

  .header-search-row button:active {
    color: #C90000;
  }

  .header-search-row button svg {
    width: 18px;
    height: 18px;
  }

  /* --- Hide desktop elements --- */
  .search-bar,
  .header-contact {
    display: none !important;
  }

  .header-search-mobile {
    display: none !important;
  }

  /* --- Desktop Nav: hide on mobile --- */
  .header-nav {
    display: none !important;
  }

  /* --- Main content padding --- */
  .main-content {
    padding-top: 108px !important;
  }

}

/* ===== DESKTOP HEADER (>=769px) ===== */
@media (min-width: 769px) {

  .menu-toggle,
  .header-search-row,
  .header-btn--favorites {
    display: none !important;
  }

  .header-main .container {
    min-height: 78px;
    display: flex;
    align-items: center;
    gap: 20px;
  }

  .logo {
    min-width: 130px;
  }

  .logo img {
    max-width: 150px;
    max-height: 56px;
  }

  .search-bar {
    flex: 1;
    display: flex !important;
    max-width: 440px;
  }

  .header-contact {
    display: flex !important;
  }

  .header-actions {
    display: flex !important;
    align-items: center;
    gap: 12px;
  }

  .header-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 8px;
    color: #1C1C1C;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .header-btn:hover {
    background: rgba(201, 0, 0, 0.07);
    color: #C90000;
  }

  .header-btn span:not(.cart-badge) {
    display: inline !important;
  }

  .header-btn svg {
    width: 20px;
    height: 20px;
  }

  .cart-badge {
    background: #C90000;
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    position: relative;
    top: -8px;
    right: -4px;
    animation: expressCartPulse 2.4s infinite;
  }

  .header-nav {
    display: block !important;
    position: relative !important;
    background: #C90000 !important;
    height: auto !important;
    width: 100% !important;
    left: auto !important;
    padding: 0 !important;
  }

  .header-nav ul.express-menu {
    display: flex !important;
  }

}

/* ============================================================
   OFFCANVAS MENU (Mobile)
   ============================================================ */

/* --- Overlay --- */
.offcanvas-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9990;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
}

.offcanvas-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

/* --- Offcanvas Panel --- */
.offcanvas-menu {
  position: fixed;
  top: 0;
  left: -100%;
  width: 88%;
  max-width: 380px;
  height: 100%;
  background: #fff;
  z-index: 9991;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  transition: left 0.35s cubic-bezier(0.22, 0.68, 0, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
}

.offcanvas-menu.is-open {
  left: 0;
}

/* --- Red Header Block --- */
.offcanvas-header {
  background: linear-gradient(135deg, #C90000 0%, #A80000 100%);
  color: #fff;
  padding: 24px 20px 20px;
  flex-shrink: 0;
  position: relative;
}

.offcanvas-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.offcanvas-welcome h2 {
  font-size: 20px;
  font-weight: 800;
  margin: 0 0 4px;
  line-height: 1.2;
  color: #fff;
}

.offcanvas-welcome p {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
  line-height: 1.4;
  max-width: 240px;
}

.offcanvas-close {
  width: 40px;
  height: 40px;
  border: 0;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.2s;
  touch-action: manipulation;
}

.offcanvas-close:active {
  background: rgba(255, 255, 255, 0.25);
}

.offcanvas-close svg {
  width: 20px;
  height: 20px;
}

/* --- Search inside offcanvas --- */
.offcanvas-search {
  flex-shrink: 0;
  padding: 12px 16px;
  border-bottom: 1px solid #E7E7E7;
}

.offcanvas-search form {
  display: flex;
  align-items: center;
  gap: 0;
  height: 42px;
  background: #F6F6F6;
  border: 1px solid #E7E7E7;
  border-radius: 8px;
  overflow: hidden;
}

.offcanvas-search input {
  flex: 1;
  height: 42px;
  background: transparent;
  border: 0;
  outline: none;
  padding: 0 14px;
  font-size: 14px;
  color: #1C1C1C;
  font-family: inherit;
}

.offcanvas-search input::placeholder {
  color: #999;
  font-size: 13px;
}

.offcanvas-search button {
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  color: #555;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.offcanvas-search button svg {
  width: 18px;
  height: 18px;
  color: #C90000;
}

/* --- Navigation --- */
.offcanvas-nav {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0;
}

.offcanvas-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.offcanvas-nav-item {
  border-bottom: 1px solid #F0F0F0;
}

.offcanvas-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  color: #1C1C1C;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  width: 100%;
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
  text-align: left;
  touch-action: manipulation;
}

.offcanvas-nav-link:active {
  background: #F6F6F6;
}

.offcanvas-nav-link svg {
  width: 20px;
  height: 20px;
  color: #C90000;
  flex-shrink: 0;
}

.offcanvas-nav-link span {
  flex: 1;
  text-align: left;
}

/* --- Submenu --- */
.offcanvas-submenu-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
}

.offcanvas-submenu-arrow {
  color: #999;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  margin-left: auto;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.offcanvas-nav-item.is-open .offcanvas-submenu-arrow {
  transform: rotate(90deg);
  color: #C90000;
}

.offcanvas-submenu {
  background: #F6F6F6;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.offcanvas-nav-item.is-open .offcanvas-submenu {
  max-height: 600px;
}

.offcanvas-submenu-link {
  display: block;
  padding: 11px 16px;
  padding-left: 48px;
  color: #555;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 1px solid #E7E7E7;
  transition: all 0.2s;
}

.offcanvas-submenu-link:last-child {
  border-bottom: 0;
}

.offcanvas-submenu-link:active {
  background: #fff;
  color: #C90000;
  padding-left: 56px;
}

.offcanvas-submenu-link.submenu-all {
  color: #C90000;
  font-weight: 600;
  border-top: 1px solid #E7E7E7;
  background: #fff;
}

/* --- Section Divider --- */
.offcanvas-divider {
  height: 8px;
  background: #F6F6F6;
  border-top: 1px solid #E7E7E7;
  border-bottom: 1px solid #E7E7E7;
  flex-shrink: 0;
}

/* --- Section --- */
.offcanvas-section {
  padding: 16px 0;
  flex-shrink: 0;
}

.offcanvas-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #C90000;
  padding: 0 16px;
  margin: 0 0 8px;
}

/* --- Compact list (no icons) --- */
.offcanvas-list-compact .offcanvas-nav-link {
  padding: 10px 16px;
  font-size: 14px;
  color: #555;
}

.offcanvas-list-compact .offcanvas-nav-link svg {
  display: none;
}

/* --- Contact Section --- */
.offcanvas-contact {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 16px;
}

.offcanvas-contact-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-decoration: none;
  padding: 12px;
  background: #F6F6F6;
  border-radius: 8px;
  transition: background 0.2s;
  touch-action: manipulation;
}

.offcanvas-contact-item:active {
  background: #EEE;
}

.offcanvas-contact-item svg {
  width: 20px;
  height: 20px;
  color: #C90000;
  flex-shrink: 0;
  margin-top: 2px;
}

.offcanvas-contact-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.offcanvas-contact-info strong {
  font-size: 13px;
  font-weight: 700;
  color: #1C1C1C;
}

.offcanvas-contact-info span {
  font-size: 12px;
  color: #666;
  line-height: 1.3;
}

/* --- Scroll lock --- */
html.offcanvas-active,
body.offcanvas-active {
  overflow: hidden;
  position: relative;
  height: 100%;
}

/* ============================================================
   DESKTOP OVERRIDES (hide offcanvas)
   ============================================================ */
@media (min-width: 769px) {

  .offcanvas-overlay,
  .offcanvas-menu {
    display: none !important;
  }

}

/* ============================================================
   SMALL PHONES (360px-375px)
   ============================================================ */
@media (max-width: 375px) {

  .header-main .container {
    padding: 6px 8px 0;
    grid-template-columns: 40px 1fr auto auto auto;
  }

  .menu-toggle {
    width: 40px;
    height: 40px;
  }

  .menu-toggle span {
    width: 18px;
  }

  .header-btn {
    width: 40px;
    height: 40px;
  }

  .header-btn svg {
    width: 18px;
    height: 18px;
  }

  .logo img {
    max-height: 32px;
  }

  .logo-fallback {
    font-size: 16px;
  }

  .header-search-row form {
    height: 38px;
  }

  .header-search-row input {
    height: 38px;
    font-size: 13px;
  }

  .header-search-row button {
    width: 38px;
    height: 38px;
  }

  .main-content {
    padding-top: 100px !important;
  }

  /* Offcanvas */
  .offcanvas-header {
    padding: 20px 16px 16px;
  }

  .offcanvas-welcome h2 {
    font-size: 18px;
  }

  .offcanvas-welcome p {
    font-size: 11px;
  }

  .offcanvas-nav-link {
    padding: 12px 14px;
    font-size: 14px;
  }

  .offcanvas-search {
    padding: 10px 12px;
  }

}

/* ============================================================
   LANDSCAPE MODE
   ============================================================ */
@media (max-height: 500px) and (orientation: landscape) {

  .main-content {
    padding-top: 100px !important;
  }

  .offcanvas-header {
    padding: 14px 16px;
  }

  .offcanvas-welcome p {
    display: none;
  }

  .offcanvas-nav-link {
    padding: 10px 14px;
    font-size: 13px;
  }

}


