/* 
 * Estilos Globais - Dec Bahia
 * Paleta de Cores:
 * Primária: #858585
 * Secundária: #ffffff
 * Destaque: #000000
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --cor-primaria: #858585;
    --cor-secundaria: #ffffff;
    --cor-destaque: #000000;
    --cor-texto: #333333;
    --cor-borda: #dddddd;
    --cor-erro: #dc3545;
    --cor-sucesso: #28a745;
    --cor-aviso: #ffc107;
    /* Alturas para header e subheader */
    --altura-header-desktop: 60px;
    --altura-header-mobile: 56px;
    --altura-subheader: 48px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--cor-texto);
    background-color: var(--cor-secundaria);
    line-height: 1.6;
    /* Compensação para header + subheader fixos (desktop padrão) */
    padding-top: calc(var(--altura-header-desktop) + var(--altura-subheader));
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Visibility helpers */
.only-mobile { display: none; }
.only-desktop { display: block; }

/* Ocultar off-canvas mobile no desktop */
.mobile-sidebar,
.mobile-sidebar-overlay {
    display: none;
}

/* Header - Estilo WhatsApp */
.header {
    background-color: #008069;
    color: #fff;
    padding: 0.625rem 1rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: relative;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    font-size: 1.375rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}

.header-center {
    flex: 1;
    max-width: 600px;
    margin: 0 2rem;
}

.header-search-input {
    display: flex;
    align-items: center;
    background: #f0f2f5;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    gap: 0.75rem;
}

.header-search-input input[type="search"] {
    flex: 1;
    border: none;
    background: transparent;
    color: #3b4a54;
    font-size: 0.9375rem;
    outline: none;
}

.header-search-input input::placeholder {
    color: #667781;
}

.search-icon-left {
    background: none;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    color: #667781;
    cursor: pointer;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.header-icon-btn {
    background: none;
    border: none;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    border-radius: 50%;
    position: relative;
    transition: background 0.2s ease;
}

.header-icon-btn:hover {
    background: rgba(255,255,255,0.1);
}

.header-icon-btn svg {
    fill: currentColor;
}

/* Botão Hamburger Mobile */
.mobile-hamburger {
    background: #008069;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 1.125rem;
    cursor: pointer;
    display: none; /* mostrado apenas no mobile */
    margin-right: 0.5rem;
}

/* Contador do carrinho */
.carrinho-contador {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #25d366;
    color: #fff;
    font-size: 0.625rem;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.header-text-btn {
    color: #fff;
    font-size: 0.9375rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.header-text-btn:hover {
    background: rgba(255,255,255,0.1);
}

/* CTA vermelho no header */
.header-cta {
    background: var(--cor-erro);
    color: #fff;
    border: 1px solid #b02a37;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-weight: 600;
}
.header-cta:hover { filter: brightness(0.9); }

/* Menu dropdown WhatsApp style */
.header-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 1rem;
    background: #fff;
    border-radius: 3px;
    box-shadow: 0 2px 5px 0 rgba(11,20,26,.26), 0 2px 10px 0 rgba(11,20,26,.16);
    min-width: 200px;
    margin-top: 0.5rem;
    padding: 0.5rem 0;
    z-index: 1000;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.5rem;
    color: #3b4a54;
    transition: background 0.15s ease;
}

.dropdown-item:hover {
    background: #f5f6f6;
}

.dropdown-item svg {
    color: #667781;
    flex-shrink: 0;
}

.dropdown-item span {
    font-size: 0.9375rem;
}

/* Busca mobile */
.header-search-mobile {
    background: #f0f2f5;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e9edef;
}

/* Abas de categorias - estilo WhatsApp */
.header-tabs {
    background: #008069;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.header-tabs::-webkit-scrollbar {
    display: none;
}

.header-tabs-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    gap: 0;
}

.tab-item {
    padding: 0.75rem 1.25rem;
    color: rgba(255,255,255,0.7);
    font-size: 0.9375rem;
    font-weight: 500;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}

.tab-item:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}

.tab-item.active {
    color: #fff;
    border-bottom-color: #fff;
}

.btn {
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;

}



.btn-primary {
    background-color: var(--cor-primaria);
    color: var(--cor-secundaria);
}

.btn-primary:hover {
    background-color: #6d6d6d;
}

.btn-secondary {
    background-color: var(--cor-secundaria);
    color: var(--cor-destaque);
    border: 2px solid var(--cor-destaque);
}

.btn-secondary:hover {
    background-color: var(--cor-destaque);
    color: var(--cor-secundaria);
}

.btn-danger {
    background-color: var(--cor-erro);
    color: var(--cor-secundaria);
}
.btn-danger:hover {
    filter: brightness(0.9);
}

.btn-success {
    background-color: var(--cor-sucesso);
    color: var(--cor-secundaria);
}

/* Banner */
.banner-section {
    position: relative;
    height: auto;
    overflow: hidden;
    background-color: var(--cor-primaria);
}

.banner-slide {
    display: none;
    width: 100%;
}

.banner-slide.active {
    display: block;
}

.banner-slide img {
    width: 100%;
    height: auto;
}

.banner-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
}

.banner-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: 0.3s;
}

.banner-dot.active {
    background-color: var(--cor-secundaria);
}

/* Icons */
.icon { display: inline-flex; align-items: center; justify-content: center; }
.icon svg { width: 18px; height: 18px; fill: currentColor; display: block; }

/* Cart counter badge */
.cart-link { position: relative; }
.carrinho-contador {
    display: inline-block;
    background: var(--cor-erro);
    color: #fff;
    border-radius: 999px;
    font-size: 0.75rem;
    line-height: 18px;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    text-align: center;
    margin-left: 2px;
}

/* Quantidade no link da subheader (em negrito) */
.subheader-qty {
    font-weight: 700;
    margin-left: 6px;
    color: #fff;
}

/* Container Principal */
.main-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: flex;
    gap: 2rem;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.sidebar h3 {
    margin-bottom: 1rem;
    color: var(--cor-destaque);
    border-bottom: 2px solid var(--cor-primaria);
    padding-bottom: 0.5rem;
}

.category-list {
    list-style: none;
}

.category-list li {
    margin-bottom: 0.5rem;
}

.category-list a {
    display: block;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.3s;
}

.category-list a:hover,
.category-list a.active {
    background-color: var(--cor-primaria);
    color: var(--cor-secundaria);
    padding-left: 1rem;
}

/* Conteúdo Principal */
.content {
    flex: 1;
}

.section-title {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--cor-destaque);
    border-bottom: 3px solid var(--cor-primaria);
    padding-bottom: 0.5rem;
}

/* Grid de Produtos */
.produtos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    gap: 1.4rem;
}

.produto-card {
    background-color: var(--cor-secundaria);
    border: 1px solid var(--cor-borda);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    padding: 6px;
}

.produto-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.produto-imagem {
    width: 100%;
    height: 175px;
    object-fit: cover;
    background-color: #f0f0f0;
}

.produto-info {
    padding: 0.7rem;
}

.produto-nome {
    font-size: 0.77rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--cor-destaque);
}

.produto-descricao {
    font-size: 0.63rem;
    color: #666;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    height: auto;
    max-height: none;
    min-height: 2.6em; /* reserva espaço ~2 linhas para alinhamento entre cards */
    overflow: visible;
}

.produto-preco {
    font-size: 0.91rem;
    font-weight: bold;
    color: var(--cor-primaria);
    margin: 0.5rem 0;
}

.produto-preco-antigo {
    text-decoration: line-through;
    color: #999;
    font-size: 1rem;
    margin-right: 0.5rem;
}

.produto-promocional {
    color: var(--cor-erro);
}

.produto-acoes {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    margin-top: 1rem;
}

.produto-quantidade {
    display: block;
    width: 100%;
    margin-bottom: 0.4rem;
}

.produto-card .btn.btn-primary,
.produto-card .btn-adicionar-carrinho {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    background-color: #e53935;
    border-color: #e53935;
    color: #fff;
    text-align: center;
}

.produto-card .btn.btn-primary:hover,
.produto-card .btn-adicionar-carrinho:hover {
    background-color: #c62828;
    border-color: #c62828;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.56rem;
    font-weight: bold;
}

.badge-promocao {
    background-color: var(--cor-erro);
    color: var(--cor-secundaria);
}

.badge-destaque {
    background-color: var(--cor-aviso);
    color: var(--cor-destaque);
}


/* Formulários */
.form-container {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: var(--cor-secundaria);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--cor-destaque);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--cor-borda);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--cor-primaria);
}

.form-control.error {
    border-color: var(--cor-erro);
}

.error-message {
    color: var(--cor-erro);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Alertas */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.alert-info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Footer */
.footer {
    background-color: var(--cor-destaque);
    color: var(--cor-secundaria);
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    text-align: center;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--cor-secundaria);
    padding: 2rem;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close {
    float: right;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--cor-primaria);
}

/* Tabelas */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--cor-borda);
}

.table th {
    background-color: var(--cor-primaria);
    color: var(--cor-secundaria);
    font-weight: 600;
}

.table tr:hover {
    background-color: #f8f9fa;
}

/* Responsividade */
@media (max-width: 768px) {

    .mobile-hamburger { display: inline-block; }

    /* Sidebar móvel */
    .mobile-sidebar {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        max-width: 85vw;
        background: #fff;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        z-index: 1001;
        box-shadow: 2px 0 5px rgba(0,0,0,0.2);
        overflow-y: auto;
        padding: 1rem;
    }
    .mobile-sidebar.active { transform: translateX(0); }
    .mobile-sidebar-close {
        position: absolute;
        top: 0.75rem;
        right: 0.75rem;
        background: transparent;
        border: none;
        font-size: 1.25rem;
        cursor: pointer;
        color: #3b4a54;
    }
    .mobile-sidebar-title {
        color: #3b4a54;
        border-bottom: 1px solid #e9edef;
        padding-bottom: 0.5rem;
        margin-bottom: 0.75rem;
    }
    .mobile-sidebar-nav a {
        display: block;
        padding: 0.75rem 0;
        color: #3b4a54;
        border-bottom: 1px solid #e9edef;
    }
    .mobile-sidebar-nav a:hover { background: #f5f6f6; }
    .mobile-category-list { list-style: none; padding: 0; }
    .mobile-category-list li { margin-bottom: 0.25rem; }
    .mobile-category-list a {
        display: block;
        padding: 0.5rem 0;
        border-radius: 4px;
        color: #3b4a54;
    }
    .mobile-category-list a.active {
        color: var(--cor-secundaria);
        background: var(--cor-primaria);
        padding-left: 0.75rem;
    }
    .mobile-sidebar-overlay {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.4);
        z-index: 1000;
        display: none;
    }
    .mobile-sidebar-overlay.active { display: block; }

    .header-container {
        gap: 0.75rem;
    }

    .header-left {
        min-width: auto;
    }

    .logo {
        font-size: 1.125rem;
    }

    .header-center {
        display: none;
    }

    .header-right {
        gap: 0.5rem;
    }

    .header-icon-btn {
        padding: 0.375rem;
    }

    .header-text-btn {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }

    /* Off-canvas mobile menu */
    .header-nav {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 280px;
        max-width: 85vw;
        background-color: #fff;
        flex-direction: column;
        padding: 0;
        gap: 0;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
        z-index: 1001;
        display: flex !important;
        overflow-y: auto;
    }

    .header-nav.active { 
        transform: translateX(0%); 
    }

    .header-nav a {
        padding: 0.75rem 1.5rem;
        color: #3b4a54;
        border-bottom: 1px solid #e9edef;
    }

    .header-nav a:hover {
        background: #f0f2f5;
    }

    /* Tabs no mobile */
    .header-tabs-container {
        padding: 0 0.75rem;
    }

    .tab-item {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }

    .only-mobile { display: block; }
    .only-desktop { display: none !important; }

    .main-container {
        flex-direction: column;
    }

    .sidebar { display: none; }

    .produtos-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }

    .banner-section {
        height: auto;
    }
}

/* Mobile/tablet compacto até 640px: 2 colunas */
@media (max-width: 640px) {
  .produtos-grid { grid-template-columns: repeat(2, 1fr); gap: 5px; }
}

/* Ultra-narrow: imagem e textos menores em ≤360px */
@media (max-width: 360px) {
  .produtos-grid { gap: 0.38rem; }
  .produto-imagem { height: 130px; }
  .produto-info { padding: 0.42rem; }
  .produto-nome { font-size: 0.86rem; }
  .produto-descricao { font-size: 0.75rem; }
  .produto-preco { font-size: 0.9rem; }
  .badge { font-size: 0.7rem; }
  .btn, .btn-adicionar-carrinho { font-size: 0.7rem; padding: 0.36rem 0.52rem; }
}

/* Carrinho: cards no mobile em vez de tabela */
@media (max-width: 600px) {
  #carrinho-cheio table { display: block; width: 100%; border-collapse: separate; border-spacing: 0; }
  #carrinho-cheio thead { display: none; }
  #carrinho-cheio tbody { display: grid; gap: 0.75rem; }
  #carrinho-cheio tr { display: grid; grid-template-columns: 1fr; background: #fff; border: 1px solid #e6e6e6; border-radius: 8px; padding: 0.75rem; }
  #carrinho-cheio td { display: flex; justify-content: space-between; align-items: center; padding: 0.35rem 0; }
  #carrinho-cheio td::before { content: attr(data-label); font-weight: 600; color: #667781; margin-right: 1rem; }
  #carrinho-cheio input[type="number"] { width: 90px; padding: 0.4rem; }
  #carrinho-cheio tfoot { display: block; margin-top: 1rem; }
  #carrinho-cheio tfoot tr { display: flex; justify-content: flex-end; gap: 0.5rem; }
  #carrinho-cheio tfoot td { padding: 0.5rem 0; }
}



/* Compactar cards para caber 3 colunas em ~440px */
@media (max-width: 440px) {
  .produtos-grid { gap: 0.5rem; }
  .produto-card { padding: 6px; }
  .produto-imagem { height: 160px; }
  .produto-info { padding: 0.6rem; }
  .produto-nome { font-size: 0.95rem; }
  .produto-descricao { font-size: 0.8rem; max-height: 2.4em; }
  .produto-preco { font-size: 0.98rem; }
  .btn, .btn-adicionar-carrinho { font-size: 0.78rem; padding: 0.4rem 0.6rem; }
}

/* Mais compacto para ≤390px mantendo 3 colunas */
@media (max-width: 390px) {
  .produtos-grid { gap: 0.4rem; }
  .produto-card { padding: 5px; }
  .produto-imagem { height: 135px; }
  .produto-info { padding: 0.42rem; }
  .produto-nome { font-size: 0.85rem; }
  .produto-descricao { display: none; }
  .produto-preco { font-size: 0.88rem; }
  .btn, .btn-adicionar-carrinho { font-size: 0.68rem; padding: 0.32rem 0.5rem; }
}

/* Ultra-narrow: ajustes para ≤400px (unificado) */
@media (max-width: 400px) {
  .produto-info { padding: 0.55rem; }
  .produto-nome { font-size: 11px; line-height: 1.25; }
  .produto-descricao { font-size: 0.76rem; }
  .produto-imagem { height: 155px; }
  .btn, .btn-adicionar-carrinho { font-size: 0.78rem; padding: 0.38rem 0.65rem; }
}

/* Carrinho: prevenir scroll lateral no mobile (unificado) */
@media (max-width: 600px) {
  html,
  body,
  .main-container,
  .content { overflow-x: hidden; width: 100%; }
}

/* Subheader menu (abaixo do header) - Tema escuro */
.subheader-nav {
    background: #2f3439; /* cinza escuro */
    border-bottom: 1px solid #23272b;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
    position: fixed;
    top: var(--altura-header-desktop); /* abaixo do header no desktop */
    left: 0;
    right: 0;
    width: 100%;
    z-index: 999; /* abaixo do header (z-index maior no header) */
}
.subheader-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.6rem 1rem;
    display: flex;
    justify-content: center; /* centralizar botões */
    gap: 0.75rem;
}
.subheader-link {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    color: #ffffff; /* letras brancas */
    background: #3a3f44; /* botão em cinza escuro */
    border: 1px solid #4a5056;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.1s ease;
}
.subheader-link:hover {
    background: #454b51; /* leve clareamento no hover */
}
.subheader-cta {
    background: var(--cor-erro);
    border-color: #b02a37;
}
.subheader-cta:hover { background: #b02a37; }
.subheader-link:focus {
    outline: 2px solid #7aa3ff; /* foco visível para acessibilidade */
    outline-offset: 2px;
}
@media (max-width: 768px) {
    /* Compensações e posicionamento no mobile */
    body { padding-top: calc(var(--altura-header-mobile) + var(--altura-subheader)); }
    .subheader-nav { top: var(--altura-header-mobile); }
    .subheader-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .subheader-link { white-space: nowrap; }
}


/* Ultra-narrow: reduzir ainda mais para ≤400px */
@media (max-width: 400px) {
    .produto-info { padding: 0.6rem; }
    .produto-nome { font-size: 0.95rem; }
    .produto-descricao { font-size: 0.8rem; }
    .produto-preco { font-size: 1rem; }
    .produto-imagem { height: 170px; }
    .btn, .btn-adicionar-carrinho { font-size: 0.8rem; padding: 0.4rem 0.7rem; }
}

/* Carrinho: layout mobile em cards já definido acima para ≤600px */

/* Ultra-narrow extra: ≤320px ainda mais compacto */
@media (max-width: 320px) {
  .produtos-grid { gap: 0.35rem; }
  .produto-imagem { height: 120px; }
  .produto-info { padding: 0.38rem; }
  .produto-nome { font-size: 0.82rem; }
  .produto-descricao { font-size: 0.72rem; max-height: 2em; }
  .produto-preco { font-size: 0.85rem; }
  .badge { font-size: 0.66rem; }
  .btn, .btn-adicionar-carrinho { font-size: 0.66rem; padding: 0.34rem 0.5rem; }
  .produto-acoes { gap: 0.28rem; }
}

/* Carrinho: tornar os cards mais compactos */
@media (max-width: 600px) {
  #carrinho-cheio tr { padding: 0.6rem; }
  #carrinho-cheio td { padding: 0.3rem 0; }
  #carrinho-cheio input[type="number"] { width: 80px; }
  #carrinho-cheio .btn { font-size: 0.8rem; padding: 0.45rem 0.65rem; }
}

@media (max-width: 400px) {
  #carrinho-cheio tr { padding: 0.5rem; }
  #carrinho-cheio td::before { font-size: 0.8rem; }
  #carrinho-cheio .btn { font-size: 0.75rem; padding: 0.4rem 0.6rem; }
}

@media (max-width: 360px) {
  #carrinho-cheio input[type="number"] { width: 70px; }
}
    .produto-preco { font-size: 1rem; }
    .produto-imagem { height: 170px; }
    .btn, .btn-adicionar-carrinho { font-size: 0.8rem; padding: 0.4rem 0.7rem; }
}

/* Carrinho: prevenir scroll lateral no mobile */
@media (max-width: 600px) {
    html,
    body,
    .main-container,
    .content {
        overflow-x: hidden;
        width: 100%;
    }
}


/* Ultra-narrow: reduzir ainda mais para ≤400px */
@media (max-width: 400px) {
    .produto-info { padding: 0.6rem; }
    .produto-nome { font-size: 0.95rem; }
    .produto-descricao { font-size: 0.8rem; }
    .produto-preco { font-size: 1rem; }
    .produto-imagem { height: 170px; }
    
}

/* Carrinho: layout mobile em cards já definido acima para ≤600px */

/* Carrinho: scroll lateral no container, sem afetar a página */
#carrinho-cheio {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  max-width: 100%;
}

@media (min-width: 601px) {
  #carrinho-cheio table {
    min-width: 520px;
  }
}

/* Carrinho: prevenir scroll lateral no mobile */
@media (max-width: 600px) {
    html,
    body,
    .main-container,
    .content {
        overflow-x: hidden;
        width: 100%;
    }
}



    /* Tipografia mobile nos cards de produto */
    .produto-info { padding: 0.75rem; }
    .produto-nome { font-size: 1rem; line-height: 1.2; }
    .produto-descricao { font-size: 0.85rem; line-height: 1.3; }
    .produto-preco { font-size: 1.1rem; }
    .produto-preco-antigo { font-size: 0.9rem; }
    .badge { font-size: 0.75rem; }

    /* Imagem menor para melhor encaixe em duas colunas */
    .produto-imagem { height: 200px; }

    /* Botões menores e com melhor espaçamento no mobile */
    .btn { font-size: 0.8125rem; padding: 0.45rem 0.75rem; }
    .btn-adicionar-carrinho { font-size: 0.8125rem; padding: 0.45rem 0.75rem; }
    .produto-acoes { gap: 0.35rem; }
}

/* Ultra-narrow: reduzir ainda mais para ≤400px */
@media (max-width: 400px) {
    .produto-info { padding: 0.6rem; }
    .produto-nome { font-size: 0.95rem; }
    .produto-descricao { font-size: 0.8rem; }
    .produto-preco { font-size: 1rem; }
    .produto-imagem { height: 170px; }
    .btn, .btn-adicionar-carrinho { font-size: 0.8rem; padding: 0.4rem 0.7rem; }
}

/* Carrinho: layout mobile em cards já definido acima para ≤600px */
/* Subcategorias aninhadas (desktop e mobile) */
.category-list .subcategory-list {
    padding-left: 14px;
    margin-top: 6px;
}

.mobile-subcategory-list {
    padding-left: 14px;
    margin-top: 6px;
}

.mobile-category-list > li {
    margin-bottom: 6px;
}

/* Override final para ≤480px: 2 colunas e cards mais compactos
   (garante botão abaixo da quantidade e melhor encaixe visual) */
@media (max-width: 480px) {
  .produtos-grid { grid-template-columns: repeat(2, 1fr); gap: 5px; }
  .produto-card { padding: 4px; }
  .produto-imagem { height: 165px; }
  .produto-info { padding: 0.6rem; }
  .produto-nome { font-size: 14px; line-height: 1.3; text-align: center; }
  .produto-nome a { font-size: 14px; }
  .produto-descricao { font-size: 0.9rem; height: auto; max-height: none; overflow: visible; text-align: center; }
  .produto-descricao { font-size: 0.9rem; text-align: center; }
  .produto-preco { font-size: 1.12rem; text-align: center; }
  /* Botão e quantidade agora são globais; mantendo apenas tipografia e grid no mobile */
}
