/* Reset básico */
* {
    margin: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f9f9f9;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

/* Header */
header {
    background: linear-gradient(135deg, #020d3f 0%, #1a3a8f 100%);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.header-top {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

header img {
    height: 120px;
    flex-shrink: 0;
    border-radius: 8px;
    padding: 5px;
    background-color: rgba(255, 255, 255, 0.1);
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 10;
}

header h1 {
    margin: 0;
    font-size: clamp(20px, 4vw, 28px);
    white-space: nowrap;
    text-align: left;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Contêiner de Filtro */
.filtro-container {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 100%;
}

/* Botão de Alternância - MODIFICADO */
.menu-toggle {
    display: none;
    background: linear-gradient(to right, #23456b, #3a5f8d);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    order: 1; /* Posiciona à esquerda */
    min-width: 120px;
    align-items: center;
    justify-content: center;
}

.menu-toggle:hover {
    background: linear-gradient(to right, #3a5f8d, #4c74a8);
    transform: translateY(-2px);
}

/* Ícone para o menu-toggle em telas menores */
.menu-toggle .menu-icon {
    display: none;
    width: 20px;
    height: 20px;
}

/* Lista de Departamentos */
#lista-departamentos {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background-color: #fff;
    cursor: pointer;
    flex: 1;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 35px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    order: 2; /* Posiciona após o menu-toggle */
}

#lista-departamentos:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

/* Campo de Busca - MODIFICADO */
.buscador {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    background-color: #ffffff;
    padding: 5px 10px;
    flex: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    order: 3; /* Posiciona após a lista de departamentos */
}

.buscador:focus-within {
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.buscador input {
    padding: 8px;
    border: none;
    outline: none;
    font-size: 14px;
    width: 100%;
    background: transparent;
}

.buscador button {
    background-color: transparent;
    border: none;
    padding: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.buscador button:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.buscador button svg {
    width: 18px;
    height: 18px;
    fill: #555;
}

/* Menu Lateral */
.sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background-color: #f8f9fa;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.15);
    z-index: 999;
    overflow-y: auto;
    margin-top: 180px;
    padding: 15px 0;
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar li {
    padding: 12px 20px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.3s ease;
}

.sidebar li:hover {
    background: linear-gradient(to right, #23456b, #3a5f8d);
    color: white;
    padding-left: 25px;
}

/* Ajuste no .departamento-fixo */
.departamento-fixo {
    position: sticky;
    top: 0;
    z-index: 999;
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 0;
    display: block;
    max-width: 100%;
}

/* Ajuste na .departamento-coluna */
.departamento-coluna {
    background-color: #f8f8f8;
    color: #fff;
    padding: 0;
    margin: 0;
    border-radius: 0;
    font-size: 14px;
    width: 100%;
    text-align: center;
}

.departamento-coluna h2 {
    background: linear-gradient(to right, #020d3f, #1a3a8f);
    color: #fff;
    padding: 15px;
    margin: 0;
    border-radius: 0;
    font-size: 16px;
    width: 100%;
    font-weight: 600;
}

/* Layout do catálogo */
.catalogo-container {
    flex: 1;
    padding: 25px 20px;
    margin-top: 10px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

/* Grade de produtos */
.grade-produtos {
    width: 100%;
    max-width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
    margin: 0 auto;
}

.produto {
    background-color: #fff;
    border: 1px solid #eaeaea;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

.produto:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.produto img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    background-color: #f8f8f8;
    padding: 15px;
    transition: all 0.3s ease;
}

.produto:hover img {
    transform: scale(1.03);
}

.produto h3 {
    font-size: 16px;
    margin: 12px;
    color: #020303;
    font-weight: 600;
    line-height: 1.4;
}

.produto p {
    font-size: 14px;
    margin: 0 12px 15px;
    color: #555;
    margin-top: auto;
    font-weight: 500;
    padding: 4px 8px;
    background-color: #f3f7ff;
    border-radius: 4px;
}

/* Footer */
footer {
    background: linear-gradient(135deg, #081036 0%, #0d1c4d 100%);
    color: #fff;
    padding: 25px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 40px;
}

footer .contato {
    text-align: center;
    max-width: 800px;
}

footer .contato p {
    margin: 8px 0;
    font-size: 14px;
    opacity: 0.9;
}

footer .ecommerce {
    text-align: center;
}

footer .ecommerce a {
    color: #fff;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    padding: 10px 20px;
    background-color: #4CAF50;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: inline-block;
}

footer .ecommerce a:hover {
    background-color: #3d8b40;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Responsividade - MODIFICADO */
@media (max-width: 992px) {
    .header-top {
        padding: 12px 15px;
    }
    
    header img {
        height: 100px;
    }
    
    .grade-produtos {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .header-top {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        padding: 10px;
    }

    header img {
        height: 90px;
    }

    header h1 {
        font-size: clamp(18px, 4vw, 24px);
    }

    .filtro-container {
        flex-direction: row;
        gap: 8px;
        flex-wrap: wrap;
    }

    .departamento-fixo {
        top: 10px;
    }

    .catalogo-container {
        margin-top: 30px;
        padding: 20px 15px;
    }
    
    .menu-toggle {
        display: flex;
        order: 1;
        flex: none;
        min-width: 50px;
        padding: 10px;
    }
    
    .menu-toggle .menu-text {
        display: none;
    }
    
    .menu-toggle .menu-icon {
        display: block;
    }

    #lista-departamentos {
        display: none;
    }

    .buscador {
        order: 2;
        flex: 1;
    }
    
    .sidebar {
        display: block;
        width: 250px;
    }
    
    /* GRADE DE 1 COLUNA PARA TELAS PEQUENAS */
    .grade-produtos {
        grid-template-columns: 1fr;
        gap: 20px;
        max-width: 500px;
        margin: 0 auto;
    }
    
    .produto {
        flex-direction: row;
        text-align: left;
        align-items: center;
        padding: 10px;
    }
    
    .produto img {
        width: 120px;
        height: 120px;
        flex-shrink: 0;
        margin-right: 15px;
    }
    
    .produto h3 {
        margin: 0 0 8px 0;
        font-size: 16px;
    }
    
    .produto p {
        margin: 0;
        align-self: flex-start;
    }
}

@media (max-width: 576px) {
    .header-top {
        flex-wrap: wrap;
    }
    
    header img {
        height: 80px;
    }
    
    .header-content {
        width: 100%;
    }
    
    .filtro-container {
        flex-wrap: wrap;
    }
    
    .menu-toggle {
        order: 1;
        min-width: 50px;
        margin-right: 8px;
    }
    
    .buscador {
        order: 2;
        width: calc(100% - 58px);
    }
    
    .departamento-fixo {
        top: 40px;
    }

    .catalogo-container {
        margin-top: 20px;
        padding: 15px 10px;
    }
    
    /* AJUSTES ADICIONAIS PARA TELAS MUITO PEQUENAS */
    .grade-produtos {
        gap: 15px;
    }
    
    .produto {
        padding: 8px;
    }
    
    .produto img {
        width: 100px;
        height: 100px;
        margin-right: 12px;
    }
    
    .produto h3 {
        font-size: 15px;
    }
    
    .produto p {
        font-size: 13px;
    }
    
    footer {
        padding: 20px 15px;
    }
    
    footer .ecommerce a {
        padding: 8px 16px;
        font-size: 14px;
    }
}

/* Animações suaves */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.produto {
    animation: fadeIn 0.5s ease forwards;
}

/* Melhorias para acessibilidade */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Barra de rolagem personalizada */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #3a5f8d;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #23456b;
}