* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    color: #333;
}

.topo {
    background-color: #003366;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

.menu-icon {
    font-size: 1.1rem;
    cursor: pointer;
}

.info-topo {
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-end;
}

.principal {
    max-width: 1200px;
    margin: auto;
    padding: 2rem;
    text-align: center;
}

.principal h1 {
    margin-bottom: 0.5rem;
    color: #003366;
}

.mensagem {
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.grade-categorias {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.categoria {
    background-color: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.2s ease;
}

.categoria i {
    font-size: 2rem;
    margin-bottom: 0.8rem;
    color: #003366;
}

.categoria h3 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.categoria p {
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.categoria button {
    background-color: #003366;
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.categoria button:hover {
    background-color: #005599;
}

footer {
    text-align: center;
    padding: 1rem;
    background-color: #003366;
    color: white;
    margin-top: 2rem;
}

/* Responsividade */
@media (max-width: 768px) {
    .topo {
        flex-direction: column;
        align-items: flex-start;
    }

    .info-topo {
        align-items: flex-start;
        margin-top: 0.5rem;
    }

    .principal {
        padding: 1rem;
    }

    .categoria {
        padding: 1rem;
    }
}

/* Regras revisadas para compatibilidade cross-browser */
.categoria {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    z-index: 1;
}

.submenu {
    width: 100%;
    background-color: #f8f9fa;
    border-radius: 0 0 10px 10px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    margin-top: 0;
    padding: 0;
    opacity: 0;
    visibility: hidden;
    position: relative;
    z-index: 2;
}

.categoria:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.categoria:hover .submenu {
    max-height: 500px;
    padding: 0.5rem 0;
    opacity: 1;
    visibility: visible;
}

.submenu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.submenu li {
    padding: 0.3rem 1.5rem;
    transition: background 0.2s ease;
}

.submenu li:hover {
    background-color: #e9ecef;
}

.submenu a {
    color: #003366;
    text-decoration: none;
    font-size: 0.9rem;
    display: block;
    padding: 0.3rem 0;
}

.submenu a:hover {
    color: #005599;
    text-decoration: underline;
}

.categoria:hover button {
    border-radius: 5px 5px 0 0;
    margin-bottom: 0;
}

.overlay-menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.96);
    display: none;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 1rem;
    z-index: 10;
    border-radius: 10px;
    overflow-y: auto;        /* <-- rolagem vertical */
    max-height: 100%;        /* garante que respeite o tamanho do card */
    scroll-behavior: smooth; /* rolagem suave */
}

/* Personalize a aparência da barra de rolagem (opcional) */
.overlay-menu::-webkit-scrollbar {
    width: 8px;
}

.overlay-menu::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 10px;
}

.overlay-menu::-webkit-scrollbar-thumb {
    background: #999;
    border-radius: 10px;
}

.overlay-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
}

.overlay-menu li {
    margin: 0.5rem 0;
}

.overlay-menu a {
    display: block;
    padding: 0.5rem;
    background-color: #e6f0ff;
    text-align: center;
    text-decoration: none;
    color: #003366;
    font-weight: bold;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.overlay-menu a:hover {
    background-color: #cce0ff;
}

.categoria:hover .overlay-menu {
    display: flex;
}

.categoria {
    position: relative;
    overflow: hidden;
}


/* Responsividade para mobile */
@media (max-width: 768px) {
    .submenu {
        position: static;
        box-shadow: none;
    }
    
    .categoria:hover {
        transform: none;
    }
    
    .categoria:hover .submenu {
        margin-top: 0.5rem;
    }
}