/* Ajustes globais de responsividade sem alterar regras de negócio. */
html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

img,
video,
iframe,
canvas,
svg {
  max-width: 100%;
}

button,
input,
select,
textarea {
  max-width: 100%;
}

@media (max-width: 980px) {
  /* Header clássico das páginas públicas */
  header .container-hdr {
    width: 100%;
    height: auto;
    min-height: 138px;
    padding: 14px 18px;
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
  }

  header .hdr-left-container,
  header .hdr-middle-container,
  header .hdr-right-container {
    width: auto;
    height: auto;
    min-width: 0;
  }

  header .hdr-left-container img {
    width: 92px;
    height: 92px;
    object-fit: contain;
  }

  header .hdr-middle-container {
    justify-content: center;
  }

  header .slogan-box {
    height: auto;
    min-height: 70px;
  }

  header .slogan-box img {
    width: min(100%, 380px);
    max-height: 92px;
    object-fit: contain;
  }

  header .search-bar-box {
    width: 100%;
    height: 42px;
  }

  header .navbar-box {
    height: auto;
    min-height: 38px;
  }

  header .nav-links ul {
    gap: 16px;
    justify-content: center;
    font-size: 21px;
    flex-wrap: wrap;
  }

  header .hdr-right-container {
    padding: 0;
  }

  header .right-box {
    width: auto;
    flex-direction: row;
    justify-content: flex-end;
    gap: 8px;
  }

  header .top-interactions,
  header .bottom-interactions {
    width: auto;
    height: auto;
    justify-content: center;
    gap: 8px;
  }

  header .login-btn button {
    width: 104px;
    height: 38px;
    font-size: 20px;
  }

  header .menu,
  header .shop-cart {
    width: 44px;
    height: 44px;
    align-items: center;
    font-size: 38px;
  }

  .categories-container {
    flex-wrap: wrap;
  }

  .category-card {
    flex: 1 1 calc(50% - 20px);
    min-width: 260px;
  }

  .benefits-container {
    padding: 0 18px;
  }

  .sobre-nos-container {
    gap: 34px;
  }

  footer .footer-container {
    flex-wrap: wrap;
  }

  footer .footer-brand,
  footer .footer-links-group,
  footer .footer-social {
    flex: 1 1 210px;
  }

  /* Admin: sidebar vira barra horizontal para não ocupar a tela */
  .admin-body,
  body:has(.admin-sidebar) {
    display: block;
  }

  .admin-sidebar {
    position: relative;
    inset: auto;
    width: 100%;
    min-height: 0;
    height: auto;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    border-right: 0;
    border-bottom: 1px solid #2a2a2a;
  }

  .sidebar-logo {
    padding: 0;
    border: 0;
  }

  .sidebar-logo img {
    width: 58px;
    height: 58px;
    object-fit: contain;
  }

  .sidebar-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: thin;
    padding-bottom: 3px;
  }

  .sidebar-nav a {
    flex: 0 0 auto;
    padding: 10px 12px;
    border-left: 0;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
  }

  .sidebar-nav a.active {
    border-left: 0;
    border-bottom-color: #9C0404;
  }

  .sidebar-footer {
    margin: 0;
    padding: 0;
    border: 0;
  }

  .sidebar-footer a {
    white-space: nowrap;
  }

  .admin-main {
    margin-left: 0;
    min-width: 0;
  }

  .admin-topbar {
    padding: 14px 18px;
  }

  .admin-content {
    padding: 22px 18px;
  }

  .dashboard-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-content[style*="grid-template-columns"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .admin-table-header {
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
  }

  .admin-filters {
    flex-wrap: wrap;
  }

  .modal-overlay {
    padding: 18px;
    align-items: flex-start;
    overflow-y: auto;
  }

  .modal-box {
    margin: auto;
    max-height: calc(100vh - 36px);
    overflow-y: auto;
  }
}

@media (max-width: 700px) {
  .offsale-top,
  .ivvii-top-offer {
    min-height: 32px;
    height: auto;
    padding: 7px 10px;
    font-size: 14px;
    line-height: 1.2;
  }

  header .container-hdr {
    min-height: 98px;
    padding: 10px 12px;
    grid-template-columns: 68px minmax(0, 1fr) auto;
    gap: 8px;
  }

  header .hdr-left-container img {
    width: 64px;
    height: 64px;
  }

  header .slogan-box {
    min-height: 54px;
  }

  header .slogan-box img {
    max-height: 66px;
  }

  header .search-bar-box,
  header .navbar-box {
    display: none;
  }

  header .login-btn {
    display: none;
  }

  header .menu,
  header .shop-cart {
    width: 38px;
    height: 38px;
    font-size: 32px;
  }

  .banner-section {
    margin: 20px 0;
    padding: 0 12px;
  }

  .banner-container {
    overflow: hidden;
  }

  .benefits-bar {
    padding: 10px 0;
  }

  .benefits-container {
    display: grid;
    grid-template-columns: 1fr;
    padding: 0 14px;
  }

  .benefit-item {
    width: 100%;
    justify-content: flex-start;
    padding: 12px 4px;
  }

  .benefit-divider {
    width: 100%;
    height: 1px;
  }

  .categories-section {
    padding: 20px 0;
  }

  .categories-container {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 0 12px;
  }

  .category-card {
    min-width: 0;
    width: 100%;
    height: 150px;
  }

  .category-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .category-overlay {
    padding: 12px !important;
  }

  .category-label,
  .category-label-accent {
    font-size: 21px !important;
  }

  .products-container {
    padding: 0 12px !important;
  }

  .products-section .products-grid,
  #homeSections .home-products-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .products-section .product-card {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .section-title,
  #homeSections .home-section-heading h2 {
    font-size: 28px !important;
  }

  .sobre-nos-section {
    padding: 38px 16px;
  }

  .sobre-nos-container {
    flex-direction: column;
    gap: 30px;
  }

  .sobre-nos-map,
  .sobre-nos-text {
    width: 100%;
  }

  .map-wrapper iframe {
    width: 100%;
    min-height: 280px;
  }

  footer .footer-top {
    padding: 36px 18px;
  }

  footer .footer-container {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 20px;
  }

  footer .footer-brand {
    grid-column: 1 / -1;
    align-items: center;
    text-align: center;
  }

  footer .footer-social {
    grid-column: 1 / -1;
  }

  .page-wrapper {
    padding: 28px 12px;
  }

  .page-card,
  .page-card-wide,
  .produtos-page {
    padding: 24px 18px;
  }

  .page-title {
    font-size: 28px;
  }

  .products-search-panel {
    margin: 14px 0 22px;
    padding: 0;
  }

  .produtos-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .loja-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .loja-img {
    height: auto;
    aspect-ratio: 1 / 1;
  }

  .loja-info {
    padding: 12px;
  }

  .loja-info h2 {
    font-size: 18px;
  }

  .loja-info p {
    display: none;
  }

  .loja-bottom {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .carrinho-item {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
  }

  .item-img {
    width: 72px;
    height: 72px;
  }

  .item-qtd {
    grid-column: 2;
    width: max-content;
  }

  .item-subtotal {
    grid-column: 2;
    min-width: 0;
    text-align: left;
  }

  .item-remover {
    grid-column: 3;
    grid-row: 1;
    align-self: start;
  }

  .carrinho-resumo {
    width: 100%;
    max-width: none;
  }

  .coupon-row {
    flex-direction: column;
  }

  .coupon-row input,
  .coupon-row button {
    width: 100%;
  }

  .iv-sidebar {
    width: min(340px, 92vw);
  }

  .iv-toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
  }

  .admin-sidebar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .sidebar-footer {
    display: none;
  }

  .admin-topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .topbar-user {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .dashboard-cards {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .dash-card {
    padding: 18px;
  }

  .admin-table-header,
  .admin-filters {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .admin-filters input,
  .admin-filters select,
  .admin-filters button,
  .admin-table-header .btn-admin {
    width: 100%;
  }

  .admin-form-row {
    grid-template-columns: 1fr;
  }

  .admin-table {
    min-width: 720px;
  }

  .modal-box {
    padding: 26px 18px 20px;
  }
}

@media (max-width: 430px) {
  header .container-hdr {
    grid-template-columns: 58px minmax(0, 1fr) 74px;
  }

  header .hdr-left-container img {
    width: 56px;
    height: 56px;
  }

  header .right-box {
    gap: 2px;
  }

  .categories-container,
  .products-section .products-grid,
  #homeSections .home-products-grid,
  .loja-grid,
  footer .footer-container {
    grid-template-columns: 1fr;
  }

  .category-card:last-child:nth-child(odd),
  footer .footer-brand,
  footer .footer-social {
    grid-column: auto;
  }

  .category-card {
    height: 170px;
  }

  .products-section .product-card {
    max-width: 100%;
  }

  .ver-mais-btn {
    width: calc(100% - 24px);
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  .page-card,
  .page-card-wide,
  .produtos-page {
    padding: 20px 14px;
  }

  .carrinho-item {
    grid-template-columns: 64px minmax(0, 1fr) auto;
    padding: 12px;
  }

  .item-img {
    width: 64px;
    height: 64px;
  }

  .checkout-step-dot small {
    max-width: 64px;
    margin: 0 auto;
    line-height: 1.2;
  }

  .admin-sidebar {
    padding: 9px 10px;
  }

  .sidebar-logo img {
    width: 46px;
    height: 46px;
  }

  .sidebar-nav a {
    padding: 9px 10px;
    font-size: 12px;
  }

  .admin-content {
    padding: 16px 10px;
  }

  .admin-topbar {
    padding: 12px 10px;
  }
}

.legacy-admin-page {
  width: min(100% - 24px, 720px);
  margin: 32px auto;
  padding: clamp(20px, 5vw, 40px);
  background: #fff;
}

@media (max-width: 430px) {
  header .container-hdr {
    grid-template-columns: 58px minmax(0, 1fr) 80px;
  }

  .admin-table {
    min-width: 720px;
  }
}


/* =========================================================
   MOBILE UX — HEADER PÚBLICO, BENEFÍCIOS E ADMIN BOTTOM NAV
   ========================================================= */
@media (max-width: 700px) {
  /* Cabeçalho público compacto: logo + ações e busca abaixo. */
  header .container-hdr {
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 10px 12px 12px;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    grid-template-areas:
      "brand empty actions"
      "search search search";
    align-items: center;
    gap: 9px 10px;
  }

  header .hdr-left-container {
    grid-area: brand;
    width: 58px;
    height: 58px;
    justify-content: flex-start;
  }

  header .hdr-left-container a {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
  }

  header .hdr-left-container img {
    width: 56px;
    height: 56px;
    object-fit: contain;
  }

  header .hdr-middle-container {
    grid-area: search;
    width: 100%;
    height: auto;
    min-width: 0;
    display: block;
  }

  header .slogan-box,
  header .navbar-box {
    display: none !important;
  }

  header .search-bar-box {
    width: 100%;
    height: auto;
    display: flex !important;
  }

  header .searchBar {
    width: 100%;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 46px;
    border: 1px solid rgba(255, 255, 255, .24);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 14px rgba(0, 0, 0, .18);
  }

  header .searchBar input {
    width: 100%;
    min-width: 0;
    height: 43px !important;
    padding: 0 14px !important;
    border: 0 !important;
    border-radius: 0 !important;
    font-size: 16px !important;
  }

  header .searchBar .search-btn {
    width: 46px !important;
    height: 43px !important;
    border-radius: 0 !important;
    font-size: 18px !important;
  }

  header .hdr-right-container {
    grid-area: actions;
    width: auto;
    height: auto;
    padding: 0;
    justify-content: flex-end;
  }

  header .right-box {
    width: auto;
    height: auto;
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
  }

  header .top-interactions,
  header .bottom-interactions {
    width: auto;
    height: auto;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  header .login-btn {
    display: none !important;
  }

  header .menu,
  header .shop-cart {
    width: 43px;
    height: 43px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 10px;
    background: rgba(0, 0, 0, .16);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
  }

  /* Benefits bar em cards deslizáveis, sem esmagar textos. */
  .benefits-bar {
    display: block;
    padding: 10px 0 12px;
    overflow: hidden;
  }

  .benefits-bar .benefits-container {
    width: 100%;
    max-width: none;
    padding: 2px 14px 8px;
    display: flex;
    justify-content: flex-start;
    align-items: stretch;
    gap: 10px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .benefits-bar .benefits-container::-webkit-scrollbar {
    display: none;
  }

  .benefits-bar .benefit-item {
    flex: 0 0 min(82vw, 285px);
    min-width: 0;
    min-height: 76px;
    padding: 12px 14px;
    justify-content: flex-start;
    gap: 12px;
    border: 1px solid #dedede;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 5px 14px rgba(0, 0, 0, .06);
    scroll-snap-align: start;
  }

  .benefits-bar .benefit-icon {
    width: 44px;
    height: 44px;
    font-size: 21px;
  }

  .benefits-bar .benefit-text {
    min-width: 0;
  }

  .benefits-bar .benefit-title,
  .benefits-bar .benefit-sub {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .benefits-bar .benefit-title {
    font-size: 17px;
    line-height: 1.05;
  }

  .benefits-bar .benefit-sub {
    font-size: 12px;
    line-height: 1.25;
  }

  .benefits-bar .benefit-divider {
    display: none;
  }

  /* Admin no estilo aplicativo: navegação fixa na parte inferior. */
  .admin-body,
  body:has(.admin-sidebar) {
    display: block;
    padding-bottom: calc(74px + env(safe-area-inset-bottom));
  }

  .admin-sidebar {
    position: fixed !important;
    top: auto !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 5px 5px calc(5px + env(safe-area-inset-bottom)) !important;
    display: block !important;
    border: 0 !important;
    border-top: 1px solid #3b1717 !important;
    background: rgba(24, 0, 0, .97) !important;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, .42);
    backdrop-filter: blur(14px);
    z-index: 1200;
  }

  .admin-sidebar .sidebar-logo,
  .admin-sidebar .sidebar-footer {
    display: none !important;
  }

  .admin-sidebar .sidebar-nav {
    width: 100%;
    height: auto;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .admin-sidebar .sidebar-nav::-webkit-scrollbar {
    display: none;
  }

  .admin-sidebar .sidebar-nav a {
    min-width: 58px;
    min-height: 59px;
    flex: 1 0 58px;
    padding: 7px 3px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 0 !important;
    border-radius: 10px;
    color: #b9aaaa;
    font-family: Arial, sans-serif;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
  }

  .admin-sidebar .sidebar-nav a i {
    font-size: 21px;
    line-height: 1;
  }

  .admin-sidebar .sidebar-nav a:hover,
  .admin-sidebar .sidebar-nav a.active {
    color: #fff;
    background: rgba(156, 4, 4, .48);
    border: 0 !important;
  }

  .admin-sidebar .sidebar-nav a.active i {
    color: #ff6b6b;
  }

  .admin-main {
    margin-left: 0 !important;
    width: 100%;
    min-width: 0;
    padding-bottom: 8px;
  }
}

@media (max-width: 380px) {
  header .container-hdr {
    grid-template-columns: 52px minmax(0, 1fr) auto;
    padding-inline: 9px;
    gap: 8px;
  }

  header .hdr-left-container,
  header .hdr-left-container a,
  header .hdr-left-container img {
    width: 50px;
    height: 50px;
  }

  header .menu,
  header .shop-cart {
    width: 40px;
    height: 40px;
    font-size: 26px;
  }

  .admin-sidebar .sidebar-nav a {
    min-width: 54px;
    flex-basis: 54px;
    font-size: 8px;
  }
}

/* Corrige a especificidade dos cards de categoria herdada do CSS principal. */
@media (max-width: 700px) {
  .categories-section .categories-container {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
    gap: 12px;
    padding: 0 12px;
  }

  .categories-section .category-card {
    width: 100%;
    max-width: none;
    min-width: 0;
    height: 160px;
  }

  .categories-section .category-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 430px) {
  .categories-section .categories-container {
    grid-template-columns: 1fr;
  }

  .categories-section .category-card,
  .categories-section .category-card:last-child:nth-child(odd) {
    grid-column: auto;
    height: 176px;
  }
}
