@import url('variaveis.css');
@import url('skeleton.css');

* {
    box-sizing: border-box;
    border: 0;
    margin: 0;
    font-family: var(--font-principal);
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.menu-hamburguer,
.menu-mobile,
.overlay-mobile {
    display: none;
}

/*header*/

header{
    width: 100%;
    height: 10vh;

    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 11;

    position: fixed;
    top: 0;
    background-color: var(--cor-branco);
    opacity: 80%;
}

.header{
    width: 90%;
    height: 100%;

    display: flex;
    align-items: center;
    
}

.logo-section {
    display: flex;
    align-items: center;
    width: 5%;
    height: 100%;
}

.logo-section img {
    width: 50px;
    height: 50px;
}

.categoria-section {
    width: 80%;
    height: 100%;

}

.categoria-section .menu-principal {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.categoria-section a {
    text-decoration: none;
    color: var(--cor-preto);
    transition: 0.5s;
}

.categoria-section a:hover {
    color: var(--cor-vermelho-primario);
    transition: 0.5s;
}

.dropdown {
    position: relative;
}

.dropdown-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font: inherit;
    color: var(--cor-preto);
    transition: 0.5s;
}

.dropdown-btn:hover {
    color: var(--cor-vermelho-primario);
    transition: 0.5s;
}

.dropdown-btn img {
    width: 12px;
    transition: transform 0.3s ease;
}

.submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 150px;
    background: var(--cor-branco);
    list-style: none;
    padding: 10px 0;
    margin: 8px 0 0 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border-radius: 6px;
    z-index: 10;
    width: 100%;
}

.submenu li {
    padding: 8px 15px;
}

.submenu li:hover {
    background: var(--cor-cinza-hover);
}

.dropdown.ativo .submenu {
    display: block;
}

.dropdown.ativo .dropdown-btn img {
    transform: rotate(180deg);
}

.carrinho-section {
    width: 5%;
    height: 100%;

    display: flex;
    justify-content: center;
    align-items: center;
}

.usuario-section{
    color: var(--cor-preto);
    width: 20%;
    height: 100%;

    display: flex;
    justify-content: space-evenly;
    align-items: center;

    text-decoration: none;
    transition: 0.5s;


}

.usuario-section:hover {
    color: var(--cor-vermelho-primario);
    transition: 0.5s;
}

/*main*/

main {
    padding-top: 5%;
    padding-bottom: 5%;

    width: 100%;
    height: 100%;

    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.topo-section {
    display: flex;
    align-items: center;
    justify-content: end;

    width: 90%;
    height: 20%;
}

.topo-section h1 {
    padding-right: 20%;
    font-size: 3vw;
}

.pesquisa{
    padding: 1%;
    width: 20vw;
    height: 5vh;
    border: var(--cor-preto) solid 2px;
    border-radius: 14px;
}

input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.topo-section img {
    position: relative;
    right: 2vw;
    width: 1.2vw;
}

.produtos-section {
    padding-top: 5%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;

    width: 90%;
    height: 80%;
}

.cartao {
    position: relative;
    width: 100%;
    height: 70vh;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);

    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: column;
    cursor: pointer;
}

.cartao.indisponivel {
    cursor: default;
}

.cartao.indisponivel .overlay-indisponivel {
    position: absolute;
    inset: 0;
    background: rgba(162, 162, 162, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    border-radius: inherit;
}

.cartao.indisponivel .overlay-indisponivel span {
    background: rgba(0, 0, 0, 0.7);
    color: var(--cor-branco);
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
}

.cartao.indisponivel button {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.cartao.indisponivel .cartao-img {
    pointer-events: none;
}

.cartao img{
    width: 100%;
    height: 60%;
}

.cartao h3{
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80%;
    height: 10%;
    text-align: center;

    font-size: 10px;
}

.cartao p{
    display: flex;
    align-items: start;
    justify-content: center;
    width: 100%;
    height: 10%;

    color: var(--cor-verde-primario);
    font-weight: 700;

    font-size: 20px;
}

.cartao p.unidade-de-medida{
    align-items: center;
    height: 5%;

    color: var(--cor-cinza-texto-secundario);
    font-weight: 500;
    font-size: 15px;
    line-height: 1;
}

.cartao div{
    width: 100%;
    height: 15%;

    display: flex;
    justify-content: space-around;
    align-items: center;
}

.cartao button{
    background-color: transparent;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    width: 95%;
    height: 70%;
    cursor: pointer;
}

.cartao button:hover{
    background-color: var(--cor-cinza-hover);
    transition: 0.5s;
}

.cartao button img{
    width: 20px;
    height: 20px;
}

/* Skeleton dos cards: mesmas proporções do .cartao real */
.cartao-skeleton .skeleton-img{
    width: 100%;
    height: 60%;
    border-radius: 0;
}

.cartao-skeleton .skeleton-titulo{
    width: 70%;
    height: 14px;
}

.cartao-skeleton .skeleton-preco{
    width: 40%;
    height: 20px;
}

.cartao-skeleton .skeleton-botao{
    width: 95%;
    height: 10%;
    margin-bottom: 2.5%;
    border-radius: 0;
}

/* Rolagem infinita: a sentinela vira uma linha inteira de cards */
.skeleton-sentinel{
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}

/*footer*/

footer{
    background-color: var(--cor-footer-fundo);
    width: 100%;
    height: 400px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
}

.redes-section{
    width: 30%;
    height: 10vh;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
}

.redes-section img{
    width: 1.5vw;
}

.navegacao-section, .navegacao-section a {
    width: 80%;
    height: 10vh;
    display: flex;
    justify-content: space-evenly;
    align-items: center;

    list-style-type: none;
    color: var(--cor-footer-texto);
    text-decoration: none;

}

.pagamentos-section{
    width: 50%;
    height: 10vh;
    display: flex;
    justify-content: space-evenly;
    align-items: start;
}

.pagamentos-section div{
    width: 7%;
    height: 50%;

    border: 0.5px solid var(--cor-footer-texto);

    display: flex;
    justify-content: center;
    align-items: center;
}

.pagamentos-section div img{
    width: 100%;
    height: 100%;
}

footer p{
    font-size: 15px;
    color: var(--cor-footer-texto);
}


/*Carrinho*/

/* botão que abre */
.abrir-carrinho {
    width: 50px;
    height: 50px;

    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
}

.carrinho-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);

    opacity: 0;
    visibility: hidden;
    transition: 0.3s ease;

    z-index: 2;
}

/* carrinho lateral */
.carrinho-drawer {
    position: fixed;
    top: 0;
    right: 0;

    width: 400px;
    max-width: 90%;
    height: 100vh;
    background: var(--cor-branco);

    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.12);

    transform: translateX(100%);
    transition: transform 0.3s ease;

    z-index: 999;

    display: flex;
    flex-direction: column;
}

/* quando abrir */
.carrinho-drawer.ativo {
    transform: translateX(0);
}

.carrinho-overlay.ativo {
    opacity: 1;
    visibility: visible;
}

/* topo do carrinho */
.carrinho-topo {
    width: 100%;
    min-height: 80px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--cor-cinza-borda);
}

/* botão fechar */
.fechar-carrinho {
    width: 20%;
    height: 100%;
    border: none;
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.fechar-carrinho img {
    width: 20px;
    height: 20px;
}

/* título */
.txtCarrinho {
    width: 80%;
    height: 100%;
    display: flex;
    align-items: center;
}

.txtCarrinho h1 {
    font-size: 24px;
    margin: 0;
}

/* área dos produtos */
.produto-carrinho {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.item-carrinho {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--cor-cinza-borda);
}

.item-carrinho-img {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.item-carrinho-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.item-carrinho-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}

.item-carrinho-info h3 {
    font-size: 16px;
    margin: 0;
}

.item-carrinho-info p {
    margin: 0;
    font-size: 14px;
}

.item-carrinho-info button{
    background-color: transparent;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.item-carrinho-info button:hover{
    background-color: var(--cor-cinza-borda);
    transition: 0.5s;
}

.item-carrinho-info button img{
    width: 20px;
}

.carrinho-vazio {
    font-size: 16px;
    text-align: center;
    margin-top: 30px;
}

.carrinho-login-aviso {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  gap: 20px;
  padding: 40px 20px;
}
.carrinho-login-aviso p {
  font-size: 18px;
  color: var(--cor-preto);
  margin: 0;
}
.btn-carrinho-login {
  display: inline-block;
  padding: 12px 32px;
  background: var(--cor-preto);
  color: var(--cor-branco);
  text-decoration: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: 0.3s;
}
.btn-carrinho-login:hover {
  background: var(--cor-cinza-texto-secundario);
}
.controle-qtd {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
}

.controle-qtd button {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    color: var(--cor-preto);
    border-radius: 6px;
    cursor: pointer;
}

.controle-qtd span {
    font-size: 16px;
    min-width: 20px;
    text-align: center;
}

.carrinho-rodape {
    width: 100%;
    padding: 20px;
    border-top: 1px solid var(--cor-cinza-borda);
    background: var(--cor-branco);
}

.total-carrinho {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 18px;
}
.btn-finalizar-pedido {
    width: 100%;
    height: 45px;
    border: none;
    background: transparent;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    color: var(--cor-preto);
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
}

.btn-finalizar-pedido:hover {
    background-color: var(--cor-cinza-hover);
    transition: 0.5s;
}

.carrinho-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* bolinha */
.badge-carrinho {
    position: absolute;
    top: -5px;
    right: -8px;

    background: var(--cor-vermelho-primario);
    color: var(--cor-branco);

    font-size: 12px;
    font-weight: bold;

    width: 20px;
    height: 20px;

    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Produto indisponível no carrinho */
.item-carrinho-indisponivel {
    position: relative;
}

.item-carrinho-indisponivel .overlay-indisponivel-carrinho {
    position: absolute;
    inset: 0;
    background: rgba(180, 180, 180, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    border-radius: inherit;
}

.item-carrinho-indisponivel .overlay-indisponivel-carrinho span {
    background: rgba(0, 0, 0, 0.7);
    color: var(--cor-branco);
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 12px;
}

.item-carrinho-indisponivel .controle-qtd button {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===== RESPONSIVO — MOBILE (≤ 1000px) ===== */

@media (max-width: 1000px) {

    /* Header */
    header {
        width: 100%;
        height: 10vh;
        display: flex;
        justify-content: center;
        align-items: center;

        position: sticky;
        top: 0;
        z-index: 100;
    }

    .header{
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .logo-section {
        order:1;
        width: auto;
    }

    .categoria-section {
        display: none;
    }

    .carrinho-section{
        order:2;
    }

    .usuario-section {
        display: none;
    }

    /* Hamburger button */
    .menu-hamburguer {
        display: flex;
        align-items: center;
        justify-content: center;
        margin-left: 0;
        background: none;
        border: none;
        cursor: pointer;
        color: var(--cor-preto);
    }

    /* Mobile nav panel */
    .menu-mobile {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        background: var(--cor-branco);
        flex-direction: column;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.12);
        overflow-y: auto;
    }

    .menu-mobile.ativo {
        transform: translateX(0);
    }

    /* Overlay */
    .overlay-mobile {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: 0.3s ease;
    }

    .overlay-mobile.ativo {
        opacity: 1;
        visibility: visible;
    }

    /* Mobile nav top */
    .menu-mobile-topo {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px;
        border-bottom: 1px solid var(--cor-cinza-borda);
    }

    .menu-mobile-topo .logo-section {
        width: auto;
        height: auto;
    }

    .menu-fechar {
        background: none;
        border: none;
        cursor: pointer;
        color: var(--cor-preto);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Mobile nav links */
    .menu-mobile-links {
        list-style: none;
        padding: 0;
        margin: 0;
        flex: 1;
    }

    .menu-mobile-links li {
        border-bottom: 1px solid var(--cor-cinza-hover);
    }

    .menu-mobile-links a {
        display: block;
        padding: 14px 20px;
        text-decoration: none;
        color: var(--cor-preto);
        font-size: 15px;
    }

    .menu-mobile-links a:hover {
        background: var(--cor-cinza-hover);
        color: var(--cor-vermelho-primario);
    }

    /* Mobile dropdown */
    .dropdown-mobile-btn {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 20px;
        background: none;
        border: none;
        cursor: pointer;
        font: inherit;
        font-size: 15px;
        color: var(--cor-preto);
    }

    .dropdown-mobile-btn:hover {
        background: var(--cor-cinza-hover);
        color: var(--cor-vermelho-primario);
    }

    .dropdown-mobile-btn svg {
        transition: transform 0.3s ease;
    }

    .dropdown-mobile.ativo .dropdown-mobile-btn svg {
        transform: rotate(180deg);
    }

    .submenu-mobile {
        display: none;
        list-style: none;
        padding: 0;
        background: var(--cor-off-white);
    }

    .dropdown-mobile.ativo .submenu-mobile {
        display: block;
    }

    .submenu-mobile li a {
        padding-left: 40px;
        font-size: 14px;
    }

    /* Mobile nav footer */
    .menu-mobile-footer {
        border-top: 1px solid var(--cor-cinza-borda);
        padding: 16px;
    }

    .menu-mobile-usuario {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 20px;
        text-decoration: none;
        color: var(--cor-preto);
        border-radius: 8px;
    }

    .menu-mobile-usuario:hover {
        background: var(--cor-cinza-hover);
        color: var(--cor-vermelho-primario);
    }

    /* Main produtos */
    main {
        height: 100%;
        width: 100%;
    }

    .topo-section {
        width: 100%;
        padding: 0 5%;
        height: auto;
        flex-wrap: wrap;
        gap: 12px;
        justify-content: center;
        padding-bottom: 12px;
    }

    .topo-section h1 {
        width: 100%;
        text-align: center;
        padding-right: 0;
        font-size: 28px;
    }

    .pesquisa {
        position: relative;
        left: 5%;
        width: 70vw;
        height: 5vh;
        font-size: 12px;
    }

    .topo-section img{
        width: 5%;
        position: relative;
        right: 6%;
    }

    .produtos-section {
        width: 100%;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
    }

    .cartao {
        gap: 10px;
        width: 80%;
        height: 60vh;
    }

    .cartao img {
        height: 60%;
    }

    .cartao h3 {
        font-size: 14px;
        height: 10%;
    }

    .cartao p {
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 15px;
        height: 10%;
    }

    .cartao p.unidade-de-medida {
        height: 5%;
        font-size: 12px;
    }

    .cartao div {
        height: 15%;
    }

    /* Em coluna, poucos cards de skeleton já preenchem a tela */
    .skeleton-sentinel {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .skeleton-sentinel .cartao-skeleton:nth-of-type(n+2),
    .produtos-section > .cartao-skeleton:nth-of-type(n+3) {
        display: none;
    }

    /* Footer */
    footer {
        width: 100%;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
    }

   .redes-section {
        width: 80%;
        height: 150px;
    }

    .navegacao-section,
    .navegacao-section a {
        width: 100%;
        height: 100%;
        padding: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-direction: column;
        font-size: 15px;
        padding-bottom: 20px;
    }

    .pagamentos-section {
        display: flex;
        justify-content: space-around;
        align-items: center;
        width: 90%;
        height: 100px;
    }

    .pagamentos-section div {
        width: 15%;
        height: 40%;
        padding: 0.5%;
        border: 0.5px solid var(--cor-footer-texto);
    }

    .pagamentos-section div img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    footer p{
        display: flex;
        justify-content: center;
        align-items: center;
        width: 90%;
        height: 100px;
        text-align: center;
    }
}

/* link do nome do produto no card (para o Google encontrar as páginas) */
.cartao-link {
    color: inherit;
    text-decoration: none;
}
