/*
Theme Name: Cardápio via Posts
Theme URI: http://example.com/cardapio-via-posts
Author: Você
Description: Tema WordPress usando Posts padrão para cardápio digital com carrinho.
Version: 1.0
*/

body { font-family: sans-serif; margin: 0; background: #fdfdfd; }
header { background: #ff9800; color: white; padding: 1rem; text-align: center; }
nav { text-align: center; margin-top: 10px; }
button { margin: 5px; padding: 10px 20px; border: none; background: #fff; border-radius: 5px; cursor: pointer; }
button:hover { background: #f1f1f1; }





.card h3 { margin: 10px 0 5px 0; }
.card p { margin: 5px 10px 15px 10px; }

#lista-carrinho li { display: flex; justify-content: space-between; margin-bottom: 5px; }
#btn-whatsapp { background: #25D366; color: white; padding: 10px; border-radius: 5px; text-align: center; display: block; text-decoration: none; font-weight: bold; margin-top: 10px; }





#icone-carrinho-mobile {
  position: fixed;
  top: 15px;
  right: 15px;
  font-size: 22px;
  background: white;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  text-align: center;
  line-height: 42px;
  box-shadow: 0 0 5px rgba(0,0,0,0.2);
  cursor: pointer;
  z-index: 1001;
}

#contador-carrinho {
  background: red;
  color: white;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 50%;
  position: absolute;
  top: -6px;
  right: -6px;
}

#carrinho {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  max-width: 90%;
  background: #f9f9f9;
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  padding: 15px;
  box-shadow: -2px 0 8px rgba(0,0,0,0.1);
  border-left: 1px solid #ccc;
}

#carrinho.mostrar-carrinho {
  transform: translateX(0);
}


#fechar-carrinho {
  position: absolute;
  top: 10px;
  right: 50px;
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  z-index: 1002;
}


.card.esgotado {
  opacity: 0.5;
}







@media (max-width: 767px) {
  
}

@media (min-width: 768px) {
  
}









@media (min-width: 768px) {
  
}






main {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: 1fr;
  gap: 16px;
  margin: 20px auto;
  padding: 0 10px;
  max-width: 1000px;
}

@media (min-width: 768px) {
  main {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

.card {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px;
  border-radius: 10px;
  background: white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.card img {
  height: 180px;
  object-fit: contain;
  margin-bottom: 10px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}


header {
  width: 100%;
  background-color: #ff9800;
  padding: 20px 10px;
  box-sizing: border-box;
  text-align: center;
}

header h1 {
  font-size: 2rem;
  color: white;
  margin: 0;
}

#icone-carrinho-mobile {
  top: 25px;
  right: 20px;
  font-size: 28px;
  width: 48px;
  height: 48px;
  line-height: 48px;
}

#contador-carrinho {
  font-size: 13px;
  padding: 2px 6px;
}

nav {
  margin-top: 15px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

nav button {
  padding: 10px 16px;
  font-size: 16px;
  border-radius: 8px;
  border: none;
  background: white;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

nav button:hover {
  background: #f0f0f0;
}


main {
  box-sizing: border-box;
  width: 100%;
}

.card {
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-break: break-word;
}


/* Corrigir carrinho flutuante no mobile */
#icone-carrinho-mobile {
  position: fixed;
  top: 20px;
  right: 10px;
  z-index: 999;
  max-width: 48px;
  max-height: 48px;
  overflow: hidden;
}

/* Garantir que os cards não saiam da grid */
main {
  padding: 0 10px;
  width: 100%;
  box-sizing: border-box;
  grid-template-columns: repeat(auto-fit, minmax(45%, 1fr));
}

/* Corrigir padding interno dos cards e impedir estouro */
.card {
  max-width: 100%;
  box-sizing: border-box;
  word-break: break-word;
  padding: 12px;
}


@media (max-width: 768px) {
  .card {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    width: 100%;
    box-sizing: border-box;
  }

  .card img {
    width: 100px;
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
  }

  .card-info {
    flex: 1;
    text-align: left;
  }

  .card-info h2 {
    font-size: 16px;
    margin: 0 0 4px;
  }

  .card-info p {
    margin: 0 0 6px;
    font-size: 14px;
    color: #666;
  }

  .card-info .price {
    font-size: 16px;
    font-weight: bold;
    color: #000;
    margin-bottom: 6px;
  }

  .card-info button {
    font-size: 14px;
    padding: 6px 10px;
  }
}


@media (max-width: 768px) {
  nav {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    gap: 10px;
    padding: 10px;
    scroll-snap-type: x mandatory;
  }

  nav button {
    flex: 0 0 auto;
    scroll-snap-align: start;
    padding: 10px 16px;
    font-size: 15px;
    border-radius: 8px;
    background: white;
    border: none;
    cursor: pointer;
    white-space: nowrap;
  }

  nav::-webkit-scrollbar {
    display: none;
  }
}


@media (max-width: 768px) {
  nav {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    padding: 10px;
    box-sizing: border-box;
  }

  nav button {
    display: inline-block;
    margin-right: 10px;
    padding: 10px 16px;
    font-size: 15px;
    border-radius: 8px;
    border: none;
    background: white;
    cursor: pointer;
    white-space: nowrap;
  }

  nav::-webkit-scrollbar {
    display: none;
  }
}


@media (max-width: 768px) {
  .categoria-container {
    position: relative;
    overflow-x: auto;
    white-space: nowrap;
  }

  


@media (max-width: 768px) {
  .categoria-container {
    position: sticky;
    top: 0;
    z-index: 999;
    background: #ff9800;
    overflow-x: auto;
    white-space: nowrap;
    padding: 12px 10px;
  }

  
    100% { opacity: 0.2; transform: translateY(-50%) scale(1); }
  }

  nav {
    padding: 0;
    margin: 0;
  }

  nav button {
    margin-right: 10px;
    white-space: nowrap;
  }
}



@media (max-width: 768px) {
  .categoria-container {
    position: sticky;
    top: 0;
    z-index: 999;
    background: #ff9800;
    overflow-x: auto;
    white-space: nowrap;
    padding: 12px 10px;
  }

  


  



  


}



.categoria-container {
  position: relative;
  overflow-x: auto;
  white-space: nowrap;
  scroll-behavior: smooth;
  background-color: #ff9800;
}








/* Card styles for category pages */
.card {
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.card-image {
  width: 100%;
  height: 200px;
  overflow: hidden;
}
.card-image img {
  width: 100%;
  height: auto;
  object-fit: cover;
}
.card-content {
  padding: 12px;
}
.card-content h2 {
  font-size: 18px;
  margin: 0 0 8px;
}
.card-content .price {
  font-weight: bold;
  margin: 0 0 12px;
}
.card-content .add-to-cart {
  width: 100%;
  padding: 8px;
  border: none;
  border-radius: 4px;
  background: #28a745;
  color: #fff;
  cursor: pointer;
}
/* Mobile 2 columns */
@media(max-width:600px) {
  #lista-posts {
    grid-template-columns: repeat(2,1fr) !important;
  }
}


/* Style for Add button on main and category pages */
.add-to-cart {
  display: inline-block;
  width: 100%;
  padding: 10px 0;
  margin-top: 12px;
  border: none;
  border-radius: 4px;
  background-color: #28a745;
  color: #ffffff;
  font-size: 16px;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
}

.add-to-cart:hover {
  background-color: #218838;
}


/* Force green for all 'Adicionar' buttons */
button.add-to-cart,
button.home-add,
.card-content button,
button {
  background-color: #28a745 !important;
  color: #ffffff !important;
}
button.add-to-cart:hover,
button.home-add:hover,
.card-content button:hover,
button:hover {
  background-color: #218838 !important;
}


/* Category arrows */
.category-scroll-wrapper {
  position: relative;
  overflow: hidden;
  padding: 0 40px; /* space for arrows */
}
.category-scroll-wrapper ul {
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 10px 0;
  margin: 0;
  list-style: none;
}
.category-scroll-wrapper ul li {
  margin-right: 10px;
}
.cat-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  background-color: #28a745;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  font-size: 20px;
  user-select: none;
}
.cat-arrow.left {
  left: 5px;
}
.cat-arrow.right {
  right: 5px;
}
