/* ========================================
   VARIÁVEIS DE COR (Paleta Premium)
   ======================================== */
:root {
    --azul-primario: #49709e;
    --azul-escuro: #2c4363;
    --azul-profundo: #1a2d42;
    --vermelho: #c73e3e;
    --vermelho-escuro: #a83232;
    --cinza-base: #2e3131;
    --branco: #ffffff;
    --cinza-claro: #f5f7fa;
    --cinza-borda: #e2e8f0;
    --texto-escuro: #1e293b;
    --texto-claro: #64748b;
    --verde-estoque: #2b8c4a;
    --verde-bg: #e6f4ea;

    /* Gradientes */
    --gradient-header: linear-gradient(135deg, #1a2d42 0%, #2c4363 40%, #49709e 100%);
    --gradient-btn-primary: linear-gradient(135deg, #49709e 0%, #2c4363 100%);
    --gradient-btn-secondary: linear-gradient(135deg, #c73e3e 0%, #a83232 100%);

    /* Shadows */
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-card-hover: 0 20px 40px rgba(46, 49, 49, 0.12);
    --shadow-btn: 0 4px 12px rgba(73, 112, 158, 0.25);
    --shadow-modal: 0 25px 60px rgba(0, 0, 0, 0.3);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   RESET & BASE
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', system-ui, -apple-system, sans-serif;
    background: var(--cinza-claro);
    color: var(--texto-escuro);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Body lock when modal is open */
body.modal-open {
    overflow: hidden;
}

/* ========================================
   HEADER (Gradiente Premium)
   ======================================== */
.header {
    background: var(--gradient-header);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid var(--azul-primario);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.header-top {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
}

.header-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.logo {
    height: 140px;
    width: auto;
    object-fit: contain;
    transition: transform var(--transition-base);
    filter: drop-shadow(0 6px 15px rgba(0, 0, 0, 0.25));
}

.logo:hover {
    transform: scale(1.03);
}

.header-content {
    flex: 1;
    min-width: 0; /* Removido o min-width fixo para não quebrar em telas pequenas */
}

.header-title {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(1.2rem, 3.5vw, 1.8rem);
    font-weight: 800;
    color: var(--branco);
    margin-bottom: 0.75rem;
    letter-spacing: -0.4px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Barra de busca */
.filtro-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
}

.buscador {
    flex: 1;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-radius: 40px;
    padding: 0.25rem 0.25rem 0.25rem 1rem;
    transition: box-shadow var(--transition-base), transform var(--transition-fast);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.buscador:focus-within {
    box-shadow: 0 0 0 3px rgba(73, 112, 158, 0.3), 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: scale(1.01);
    background: var(--branco);
}

#busca-produtos {
    flex: 1;
    padding: 0.75rem 0;
    border: none;
    outline: none;
    font-size: 0.95rem;
    background: transparent;
    color: var(--texto-escuro);
}

#busca-produtos::placeholder {
    color: var(--texto-claro);
}

.busca-btn {
    background: var(--gradient-btn-primary);
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    margin-left: 0.5rem;
}

.busca-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-btn);
}

.busca-btn:active {
    transform: scale(0.97);
}

.busca-btn svg {
    width: 18px;
    height: 18px;
    stroke: var(--branco);
}

#filtro-departamento, 
.sort-select,
#filtro-filial,
.sort-wrapper {
    display: none !important;
}

/* Filtro de filial - agora oculto e via menu */

/* ========================================
   SORT DROPDOWN (custom)
   ======================================== */
.sort-wrapper {
    position: relative;
    flex-shrink: 0;
}

.sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.72rem 1rem;
    border: none;
    border-radius: 40px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    color: var(--texto-escuro);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: box-shadow var(--transition-base);
    white-space: nowrap;
}

.sort-btn:hover {
    box-shadow: 0 0 0 3px rgba(73, 112, 158, 0.2);
}

.sort-chevron {
    transition: transform var(--transition-fast);
    flex-shrink: 0;
}

.sort-btn[aria-expanded="true"] .sort-chevron {
    transform: rotate(180deg);
}

.sort-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 210px;
    background: var(--branco);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.16), 0 2px 8px rgba(0,0,0,0.08);
    padding: 0.5rem;
    z-index: 2000;
    border: 1px solid var(--cinza-borda);
    animation: dropdownFadeIn 0.15s ease;
}

.sort-dropdown.open {
    display: block;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.sort-option {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--texto-escuro);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.sort-option:hover {
    background: var(--cinza-claro);
    color: var(--azul-primario);
}

.sort-option.active {
    background: rgba(73, 112, 158, 0.1);
    color: var(--azul-primario);
    font-weight: 700;
}

.sort-option-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    flex-shrink: 0;
    font-size: 1rem;
}

.sort-divider {
    height: 1px;
    background: var(--cinza-borda);
    margin: 0.35rem 0.5rem;
}

/* Botão menu mobile */
.menu-toggle {
    display: none;
    background: var(--gradient-btn-primary);
    border: none;
    padding: 0.7rem;
    border-radius: 40px;
    cursor: pointer;
    transition: all var(--transition-base);
}

.menu-toggle {
    display: flex;
    background: var(--gradient-btn-primary);
    border: none;
    border-radius: 12px;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--branco);
    box-shadow: var(--shadow-base);
    transition: all var(--transition-base);
    flex-shrink: 0;
}

.menu-toggle:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-btn);
}

.menu-toggle svg {
    width: 22px;
    height: 22px;
    stroke: var(--branco);
}

/* Barra de departamentos fixa */
.departamento-fixo {
    background: rgba(73, 112, 158, 0.85);
    backdrop-filter: blur(16px);
    padding: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.departamento-coluna {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.departamento-titulo {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--branco);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.departamento-titulo::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: var(--vermelho);
    border-radius: 2px;
}

.filtros-ativos {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.9rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    color: var(--branco);
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: background var(--transition-base);
}

.filter-chip:hover {
    background: rgba(255, 255, 255, 0.35);
}

.filter-chip-remove {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0;
}

.filter-chip-remove svg {
    width: 12px;
    height: 12px;
    stroke: var(--branco);
}

/* ========================================
   SIDEBAR (menu mobile)
   ======================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: min(85%, 320px);
    height: 100vh;
    background: var(--branco);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    transition: left 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    overflow-y: auto;
}

.sidebar.active {
    left: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: var(--gradient-header);
    color: var(--branco);
}

.sidebar-header h3 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}

.sidebar-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    padding: 0.5rem;
    border-radius: 40px;
    cursor: pointer;
    transition: background var(--transition-base);
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-close svg {
    width: 20px;
    height: 20px;
    stroke: var(--branco);
}

.sidebar-list {
    list-style: none;
    padding: 0.5rem 0;
}

.sidebar-list li a {
    display: block;
    padding: 0.9rem 1.5rem;
    color: var(--texto-escuro);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-base);
    border-left: 3px solid transparent;
}

.sidebar-list li a:hover {
    background: var(--cinza-claro);
    border-left-color: var(--azul-primario);
    padding-left: 1.8rem;
}

/* Estilos para filtros dentro da sidebar */
.sidebar-content {
    padding: 1rem 0;
}

.sidebar-section {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid var(--cinza-borda);
    margin-bottom: 1rem;
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-section-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--texto-claro);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.8rem;
}

.sidebar-select {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--cinza-borda);
    border-radius: 12px;
    background: var(--cinza-claro);
    font-family: inherit;
    font-size: 0.96rem;
    color: var(--texto-escuro);
    font-weight: 600;
    cursor: pointer;
}

.sidebar-select:focus {
    outline: none;
    border-color: var(--azul-primario);
    box-shadow: 0 0 0 3px rgba(73, 112, 158, 0.1);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   CONTEÚDO PRINCIPAL
   ======================================== */
.catalogo-container {
    flex: 1;
    padding: 2rem 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* ========================================
   RESULTS BAR (Contador de produtos)
   ======================================== */
.results-bar {
    text-align: center;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--texto-claro);
    font-weight: 500;
    display: none;
}

.results-bar.visible {
    display: block;
}

.results-bar strong {
    color: var(--azul-primario);
    font-weight: 700;
}

/* ========================================
   GRADE DE PRODUTOS
   ======================================== */
.grade-produtos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
}

/* ========================================
   CARD DE PRODUTO (Premium, clicável)
   ======================================== */
.product-card {
    background: var(--branco);
    border-radius: 20px;
    overflow: hidden;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    box-shadow: var(--shadow-card);
    cursor: pointer;
    position: relative;
    /* Fade-in animation */
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-card-hover);
}

/* Staggered animation delays */
.product-card:nth-child(1)  { animation-delay: 0.05s; }
.product-card:nth-child(2)  { animation-delay: 0.10s; }
.product-card:nth-child(3)  { animation-delay: 0.15s; }
.product-card:nth-child(4)  { animation-delay: 0.20s; }
.product-card:nth-child(5)  { animation-delay: 0.25s; }
.product-card:nth-child(6)  { animation-delay: 0.30s; }
.product-card:nth-child(7)  { animation-delay: 0.35s; }
.product-card:nth-child(8)  { animation-delay: 0.40s; }
.product-card:nth-child(9)  { animation-delay: 0.45s; }
.product-card:nth-child(10) { animation-delay: 0.50s; }
.product-card:nth-child(11) { animation-delay: 0.55s; }
.product-card:nth-child(12) { animation-delay: 0.60s; }
.product-card:nth-child(n+13) { animation-delay: 0.65s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card-image-wrapper {
    width: 100%;
    height: 220px;
    background: var(--branco);
    border-bottom: 1px solid var(--cinza-borda);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

/* Gradient overlay on hover */
.product-card-image-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(73, 112, 158, 0.08) 0%, transparent 60%);
    opacity: 0;
    transition: opacity var(--transition-base);
    pointer-events: none;
}

.product-card:hover .product-card-image-wrapper::after {
    opacity: 1;
}

.product-card-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform var(--transition-slow);
}

.product-card:hover .product-card-image {
    transform: scale(1.08);
}

/* Badge de estoque sobre a imagem */
.product-stock-badge {
    position: absolute;
    bottom: 0.6rem;
    right: 0.6rem;
    background: linear-gradient(135deg, #2b8c4a 0%, #1e6635 100%);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 8px rgba(43, 140, 74, 0.3);
    pointer-events: none;
    z-index: 1;
}

.product-card-content {
    padding: 1.25rem 1.5rem 0.75rem;
}

.product-card-department {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--azul-primario);
    margin-bottom: 0.5rem;
    font-family: 'Montserrat', sans-serif;
    background: rgba(73, 112, 158, 0.08);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
}

.product-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--texto-escuro);
    min-height: 2.8rem; /* Reserva espaço para 2 linhas */
}

.product-card-reference {
    font-size: 0.7rem;
    color: var(--texto-claro);
    margin-bottom: 0.4rem;
}

.product-card-price {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--vermelho);
    margin: 0.6rem 0 0.4rem;
    font-family: 'Montserrat', sans-serif;
    line-height: 1;
    display: flex;
    align-items: center;
}

.price-consult {
    font-size: 0.8rem;
    color: #49709e;
    background: rgba(73, 112, 158, 0.08);
    padding: 0.35rem 0.7rem;
    border-radius: 30px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 700;
    margin: 0.3rem 0;
    white-space: nowrap;
    border: 1px solid rgba(73, 112, 158, 0.15);
}

.price-consult small {
    font-weight: 800;
    font-size: 0.9em;
    color: var(--azul-primario);
}

.product-card-stock {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.stock-pill {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #435e50; /* Verde bem escuro similar ao exemplo */
    background: #e1ede4; /* Fundo verde claro/acinzentado */
    padding: 0.25rem 0.6rem 0.25rem 0.4rem;
    border-radius: 20px;
}

.product-card-actions {
    padding: 0.75rem 1.5rem 1.5rem 1.5rem;
    display: flex;
    gap: 0.8rem;
}

/* ========================================
   BOTÕES (Gradientes premium)
   ======================================== */
.btn {
    flex: 1;
    padding: 0.6rem 0.4rem;
    border: none;
    border-radius: 40px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, transparent 50%);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.btn:hover::before {
    opacity: 1;
}

.btn-primary {
    background: var(--gradient-btn-primary);
    color: var(--branco);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-btn);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-secondary {
    background: var(--gradient-btn-secondary);
    color: var(--branco);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(199, 62, 62, 0.3);
}

.btn-secondary:active {
    transform: translateY(0) scale(0.98);
}

/* Outline style for "Ver Detalhes" in cards */
.btn-outline {
    background: transparent;
    color: var(--azul-primario);
    border: 2px solid var(--azul-primario);
}

.btn-outline:hover {
    background: var(--gradient-btn-primary);
    color: var(--branco);
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: var(--shadow-btn);
}

.btn-outline:active {
    transform: translateY(0) scale(0.98);
}

/* ========================================
   ESTADOS DE LOADING, VAZIO, ERRO
   ======================================== */
.loading-state,
.empty-state,
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1rem;
    grid-column: 1 / -1;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--cinza-borda);
    border-top-color: var(--azul-primario);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    margin-top: 1.5rem;
    font-weight: 600;
    font-size: 1rem;
}

.loading-subtext {
    font-size: 0.85rem;
    color: var(--texto-claro);
    margin-top: 0.25rem;
}

.empty-icon,
.error-icon {
    color: var(--cinza-borda);
    margin-bottom: 1rem;
}

.empty-title,
.error-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.empty-description,
.error-description {
    color: var(--texto-claro);
    max-width: 300px;
    margin-bottom: 1.5rem;
}

/* ========================================
   PRODUCT DETAIL MODAL
   ======================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base), visibility var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: var(--branco);
    border-radius: 24px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-modal);
    transform: scale(0.92) translateY(20px);
    transition: transform var(--transition-slow);
}

.modal-overlay.active .modal-container {
    transform: scale(1) translateY(0);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.06);
    color: var(--texto-escuro);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    z-index: 10;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.12);
    transform: rotate(90deg);
}

.modal-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 400px;
}

.modal-image-area {
    background: var(--branco);
    border-right: 1px solid var(--cinza-borda);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border-radius: 24px 0 0 24px;
}

.modal-image {
    max-width: 100%;
    max-height: 380px;
    object-fit: contain;
    transition: transform var(--transition-slow);
}

.modal-image:hover {
    transform: scale(1.05);
}

.modal-info-area {
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.75rem;
}

.modal-badges {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    align-self: flex-start;
}

.modal-department-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--azul-primario);
    background: rgba(73, 112, 158, 0.1);
    padding: 0.35rem 0.9rem;
    border-radius: 20px;
    font-family: 'Montserrat', sans-serif;
}

.modal-section-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--vermelho);
    background: rgba(199, 62, 62, 0.1);
    padding: 0.35rem 0.9rem;
    border-radius: 20px;
    font-family: 'Montserrat', sans-serif;
}

.modal-product-name {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--texto-escuro);
    line-height: 1.3;
    margin: 0.2rem 0;
}

.modal-code {
    font-size: 0.85rem;
    color: var(--texto-claro);
    margin-bottom: 0.5rem;
}

.modal-price {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--vermelho);
    font-family: 'Montserrat', sans-serif;
    margin: 0.5rem 0 1rem;
    display: flex;
    align-items: center;
}

.modal-price .price-consult {
    font-size: 1.1rem;
    padding: 0.5rem 1rem;
    background: #f8fbff;
    border: 1px dashed var(--azul-primario);
    border-radius: 8px;
    color: var(--azul-primario);
}

.modal-subtitle {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--texto-escuro);
    margin-bottom: 0.8rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--cinza-bg);
    width: 100%;
    opacity: 0.7;
}

.modal-dados-tecnicos {
    background: rgba(73, 112, 158, 0.04);
    border: 1px solid rgba(73, 112, 158, 0.1);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1.5rem;
    margin-bottom: 2rem;
}

.modal-dados-tecnicos-text {
    font-size: 0.9rem;
    color: var(--texto-escuro);
    line-height: 1.6;
    white-space: pre-wrap;
}

.modal-estoque-container {
    margin-bottom: 1.5rem;
}

.modal-stock-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.modal-stock-item {
    background: var(--verde-bg);
    padding: 0.8rem 1rem;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(46, 125, 50, 0.1);
}

.modal-stock-zero {
    background: var(--cinza-bg);
    border-color: transparent;
    opacity: 0.7;
}

.modal-stock-ok {
    background: var(--verde-bg);
    border-color: rgba(46, 125, 50, 0.15);
}

/* Linha de total de estoque */
.modal-stock-total {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(43, 140, 74, 0.12) 0%, rgba(30, 102, 53, 0.08) 100%);
    border: 1.5px solid rgba(43, 140, 74, 0.25);
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.modal-stock-total-value {
    font-size: 1.3rem;
    color: var(--verde-estoque);
}

.modal-stock-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--texto-claro);
    letter-spacing: 0.5px;
}

.modal-stock-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--verde-estoque);
    font-family: 'Montserrat', sans-serif;
}

.modal-stock-zero .modal-stock-value {
    color: var(--texto-claro);
    font-weight: 600;
}

.modal-stock-unavailable-text {
    font-size: 0.9rem;
    color: var(--texto-claro);
    font-style: italic;
}

.modal-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.75rem;
}

.modal-actions .btn {
    padding: 0.9rem 1.5rem;
    font-size: 0.85rem;
}

/* ========================================
   FOOTER (Gradiente premium)
   ======================================== */
.footer {
    background: var(--gradient-header);
    color: var(--branco);
    margin-top: 3rem;
    border-top: 3px solid var(--vermelho);
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 1.8rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
    align-items: start;
}

.footer-info-wrapper {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    grid-column: span 2;
}

.footer-info {
    flex: 1;
    min-width: 250px;
}

.footer-info h4 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--branco);
}

.footer-info p {
    margin: 0.5rem 0;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
}

.footer-ecommerce {
    text-align: center;
}

.footer-ecommerce .btn {
    background: var(--gradient-btn-secondary);
    color: var(--branco);
    min-width: 200px;
}

.footer-ecommerce .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(199, 62, 62, 0.3);
}

.footer-copyright {
    text-align: right;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

/* ========================================
   WHATSAPP FLUTUANTE
   ======================================== */
.whatsapp-float {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--branco);
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.35);
    transition: all var(--transition-base);
    z-index: 999;
}

.whatsapp-float:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.45);
}

.whatsapp-float svg {
    width: 28px;
    height: 28px;
}

/* ========================================
   SCROLL TO TOP BUTTON
   ======================================== */
.scroll-top-btn {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    width: 48px;
    height: 48px;
    background: var(--gradient-btn-primary);
    border-radius: 50%;
    border: none;
    color: var(--branco);
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(73, 112, 158, 0.35);
    transition: all var(--transition-base);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
}

.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(73, 112, 158, 0.45);
}

.scroll-top-btn svg {
    width: 22px;
    height: 22px;
    stroke: var(--branco);
    stroke-width: 2.5;
}

/* ========================================
   RESPONSIVIDADE (MOBILE FIRST)
   ======================================== */
@media (max-width: 768px) {
    .header {
        transition: all var(--transition-base);
    }

    .header-top {
        padding: 0.5rem 0.8rem;
        transition: all var(--transition-base);
    }

    .header-container {
        flex-direction: column;
        align-items: center;
        gap: 0.25rem;
    }

    .logo {
        height: 80px; /* Reduzido permanentemente no mobile */
        margin: 0.2rem auto;
        transition: all var(--transition-base);
    }

    .header-title {
        display: none; /* Oculto no mobile para economizar espaço - o logo já traz a marca */
    }

    .header-content {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .filtro-container {
        flex-wrap: nowrap; 
        width: 100%;
        gap: 0.75rem; 
        align-items: center;
        justify-content: flex-start;
        margin-top: 0; /* Removido margin-top pra alinhar melhor com o logo se necessário */
    }

    .buscador {
        flex: 1;
        padding: 0.05rem 0.05rem 0.05rem 0.8rem;
        order: 0;
    }

    /* Esconder TUDO que não seja busca e menu no mobile */
    #filtro-departamento, 
    #filtro-filial, 
    .sort-wrapper,
    .visually-hidden {
        display: none !important;
    }

    /* EFEITO SCROLLED NO MOBILE */
    .header.scrolled {
        box-shadow: 0 2px 12px rgba(0,0,0,0.25);
    }

    .header.scrolled .logo {
        height: 38px;
        margin: 0;
    }

    .header.scrolled .header-container {
        flex-direction: row; 
        justify-content: space-between;
        gap: 0.4rem; /* Reduzido de 0.75rem */
    }
    
    .header.scrolled .header-content {
        flex: 1;
    }

    .header.scrolled .header-top {
        padding: 0.4rem 0.75rem;
    }

    .header.scrolled .departamento-fixo {
        display: none; 
    }

    .header.scrolled .filtro-container {
        margin: 0;
        flex-wrap: nowrap; 
        gap: 0.3rem;
    }

    /* Ocultar filtros no cabeçalho mobile conforme solicitado */
    #filtro-filial, 
    .sort-wrapper {
        display: none !important;
    }

    .header.scrolled .buscador {
        flex: 1;
        min-width: 0;
    }

    .header.scrolled .buscador #busca-produtos {
        padding: 0.35rem 0;
    }

    .header.scrolled #filtro-filial {
        min-width: 80px;
        font-size: 0.75rem;
        padding-right: 1.2rem;
    }

    .header.scrolled .sort-btn {
        padding: 0.45rem 0.6rem;
        font-size: 0.75rem;
    }

    #busca-produtos {
        padding: 0.45rem 0;
        font-size: 0.85rem;
    }

    .busca-btn {
        padding: 0.4rem 0.8rem;
    }

    .menu-toggle {
        display: flex;
        padding: 0.5rem;
        flex-shrink: 0;
        height: 36px;
        width: 36px;
        align-items: center;
        justify-content: center;
    }

    .menu-toggle svg {
        width: 16px;
        height: 16px;
    }

    #filtro-departamento, .sort-select {
        display: none; /* Esconde ordenação no mobile central para dar foco à busca */
    }

    /* No mobile mostramos o select de filial compacto e o sort-wrapper */
    #filtro-filial {
        flex: 1;
        min-width: 130px;
        font-size: 0.85rem;
        padding: 0.65rem 1.6rem 0.65rem 0.8rem;
        background-position: right 0.5rem center;
    }

    .sort-wrapper {
        position: relative;
        flex: 1;
        min-width: 120px;
    }

    .sort-btn {
        width: 100%;
        justify-content: space-between;
        font-size: 0.85rem;
        padding: 0.65rem 0.8rem;
        gap: 0.3rem;
    }

    .departamento-coluna {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.5rem 0.8rem;
        gap: 0.3rem;
    }

    .departamento-titulo {
        font-size: 0.7rem;
    }

    .catalogo-container {
        padding: 0.75rem;
    }

    .grade-produtos {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .product-card {
        display: flex;
        flex-direction: column;
    }

    .product-card-image-wrapper {
        height: 240px;
        padding: 0.75rem;
    }

    .product-card-actions {
        flex-direction: column;
    }

    .btn {
        padding: 0.7rem;
    }

    /* Modal mobile */
    .modal-content {
        grid-template-columns: 1fr;
    }

    .modal-image-area {
        border-radius: 24px 24px 0 0;
        min-height: 320px;
        padding: 1rem;
        border-right: none;
        border-bottom: 1px solid var(--cinza-borda);
    }

    .modal-image {
        max-height: 280px;
    }

    .modal-info-area {
        padding: 1.5rem;
    }

    .modal-product-name {
        font-size: 1.2rem;
    }

    .modal-price {
        font-size: 1.6rem;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-container {
        border-radius: 20px;
        max-height: 95vh;
    }

    /* Footer mobile */
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 1.5rem;
        padding: 1.8rem 1rem;
    }

    .footer-info-wrapper {
        grid-column: span 1;
        flex-direction: column;
        gap: 1.5rem;
    }

    .footer-copyright {
        text-align: center;
    }

    .whatsapp-float {
        width: 50px;
        height: 50px;
        bottom: 1rem;
        right: 1rem;
    }

    .scroll-top-btn {
        width: 44px;
        height: 44px;
        bottom: 1rem;
        left: 1rem;
    }
}

@media (max-width: 480px) {
    .product-card-price {
        font-size: 1.4rem;
    }

    .product-card-title {
        font-size: 0.95rem;
    }

    .busca-btn {
        padding: 0.5rem 1rem;
    }

    .modal-overlay {
        padding: 0.5rem;
    }

    /* Ajuste fino nos filtros */
    #filtro-filial, .sort-btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.6rem;
    }
}

/* OTORIZAÇÃO PARA IPHONE 5 E TELAS PEQUENAS (320px) */
@media (max-width: 360px) {
    .header-top {
        padding: 0.4rem 0.5rem;
    }
    
    .header.scrolled .logo {
        height: 28px;
    }

    .buscador {
        padding-left: 0.5rem;
    }

    #busca-produtos {
        font-size: 0.8rem;
        letter-spacing: -0.2px;
    }

    #filtro-filial, .sort-btn {
        font-size: 0.72rem;
        padding: 0.45rem 0.5rem;
        min-width: 0;
        flex: 1;
    }

    .sort-btn svg {
        width: 10px;
        height: 10px;
    }

    .sort-icon-az svg {
        width: 12px;
        height: 12px;
    }
}

/* ========================================
   UTILITÁRIOS
   ======================================== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}