/* ===== Layout estilo Marketplace ===== */

/* Remover margens do container principal */
main.container {
  margin: 0 auto;
  padding: 0.5rem;
  max-width: 1200px;
}

/* Título mais discreto e fixo no topo */
main.container h1 {
  font-size: 1.2rem;
  text-align: center;
  margin: 0.5rem 0 0.8rem 0.3rem;
  color: #222;
}

/* Grid otimizado */
.materiais-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 4 colunas padrão no mobile */
  gap: 0.4rem;
  padding: 0.2rem;
  margin-top: 0.8rem;
}

/* Cards mais compactos e com aparência tipo Marketplace */
.material-card {
  border: none;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-align: center;
  justify-content: space-between;
  cursor: pointer;
}

.material-card:hover {
  transform: scale(1.03);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.material-card.selected {
  border: 2px solid var(--primary-color, #00796b);
  transform: scale(1.02);
}

/* Imagem compacta */
.material-img-wrapper {
  height: 80px;
  margin: 0;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: #f9f9f9;
}

.material-img-wrapper img {
  object-fit: cover;
  width: 100%;
  height: 100%;
  border-radius: 0;
  cursor: zoom-in;
}

/* Nome e preço alinhados tipo Marketplace */
.material-title {
  font-size: 0.75rem;
  font-weight: bold;
  color: #333;
  margin: 0.2rem 0;
  padding: 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.material-card h4 {
  font-size: 0.75rem;
  color: var(--primary-color, #00796b);
  margin: 0;
}

/* Wrapper para input de preço e botão de remover */
.preco-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding-bottom: 0.4rem;
}

/* Agrupamento input + botões + e - */
.preco-input-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

/* Input de preço dentro do grupo */
.preco-input-group .material-price-input {
  width: 48px;
  height: 24px;
  text-align: center;
  margin-bottom: 0rem !important;
  padding: 2px;
  font-size: 0.85rem;
  box-sizing: border-box;
  line-height: 1.2;
}

/* Botões + e - */
.btn-maior,
.btn-menor {
  width: 24px;
  height: 24px;
  background-color: #eee;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.85rem;
  padding: 0;
  cursor: pointer;
  line-height: 1;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.btn-maior:hover,
.btn-menor:hover {
  background-color: #ddd;
}

/* Botão de remover */
.remover-btn {
  font-size: 0.65rem;
  padding: 2px 3px;
  background: transparent;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  color: #555;
  line-height: 1;
  margin-top: 0.3rem;
}

.remover-btn:hover {
  background-color: #f8d7da;
  border-color: #f5c6cb;
  color: #a94442;
}

/* ===== Paginação ===== */
.paginacao-materiais {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
}

.paginacao-materiais span {
  font-weight: bold;
  font-size: 1rem;
}

.paginacao-materiais button {
  background-color: var(--primary-color, #00796b);
  color: #fff;
  font-size: 0.9rem;
  padding: 0.3rem 0.9rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

.paginacao-materiais button:hover {
  background-color: #005f56;
  transform: scale(1.03);
}

.paginacao-materiais button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

/* ===== Barra de busca ===== */
#material-search-bar {
  margin-top: 1rem;
  margin-bottom: 0.8rem;
  display: flex;
  justify-content: center;
}

#material-search-input {
  width: 100%;
  max-width: 400px;
  padding: 0.5rem 0.8rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
}

.btn-filtro {
  width: 44px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: #007bff;
  color: #fff;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  padding: 0;
  margin: 0 0.0rem;
}

.btn-filtro:hover {
  background: #0056b3;
}

/* ===== Preços cadastrados ===== */
.precos-columns {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  box-sizing: border-box;
}

.precos-columns>div {
  flex: 1;
  background: #f7f7f7;
  border-radius: 10px;
  padding: 1rem 0.7rem 1.2rem 0.7rem;
}

.precos-columns h4 {
  margin: 0.5rem 0 1rem;
  font-size: 1.07rem;
  color: var(--primary-color, #00796b);
  text-align: center;
}

.precos-columns ul {
  list-style-type: none;
  padding-left: 0;
  margin: 0;
}

.precos-columns ul li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.2rem;
  font-size: 0.95rem;
  border-bottom: 1px solid #efefef;
}

.precos-columns ul li:last-child {
  border-bottom: none;
}

.item-name {
  color: #333;
}

.item-dots {
  flex-grow: 1;
  border-bottom: 1px dotted #999;
  margin-bottom: 0.3em;
  min-width: 1.5rem;
}

.item-price {
  color: var(--primary-color, #00796b);
  font-weight: 500;
}

/* ===== Botão flutuante ===== */
.btn-flutuante {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #4CAF50;
  color: white;
  padding: 0.6rem 1.4rem;
  font-size: 1rem;
  border: none;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  cursor: pointer;
  width: auto;
  max-width: 90%;
  white-space: nowrap;
}

.btn-flutuante:hover {
  background-color: #45a049;
}

.btn-flutuante-share {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: #0b5ed7;
  /* Royal Blue */
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s;
}

.btn-flutuante-share:hover {
  transform: scale(1.1);
  background-color: #0a58ca;
}

.btn-flutuante-share svg {
  width: 24px;
  height: 24px;
}

/* ===== Modal Compartilhar ===== */
.modal-compartilhar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.modal-compartilhar-content {
  background: #fff;
  border-radius: 12px;
  padding: 2rem 1.5rem 1.2rem 1.5rem;
  box-shadow: 0 6px 32px rgba(0, 0, 0, 0.18);
  max-width: 370px;
  width: 95vw;
  text-align: left;
}

.modal-compartilhar-content h2 {
  margin-top: 0;
  font-size: 1.4rem;
  color: var(--primary-color, #00796b);
  margin-bottom: 1.3rem;
}

#checkbox-list-materiais {
  max-height: 270px;
  overflow-y: auto;
  margin-bottom: 1.2rem;
}

.checkbox-material-item {
  display: flex;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid #eee;
  font-size: 1.04rem;
}

.checkbox-material-item:last-child {
  border-bottom: none;
}

.checkbox-material-item input[type="checkbox"] {
  margin-right: 0.7em;
  accent-color: var(--primary-color, #00796b);
  width: 1.1em;
  height: 1.1em;
}

.modal-compartilhar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1.1rem;
}

.btn-ok,
.btn-cancelar {
  padding: 0.45em 1.3em;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-ok {
  background: var(--primary-color, #00796b);
  color: #fff;
}

.btn-ok:disabled {
  background: #b2dfdb;
  color: #fff;
  cursor: not-allowed;
}

.btn-cancelar {
  background: #eee;
  color: #333;
}

.btn-cancelar:hover {
  background: #ddd;
}

/* ===== Responsividade ===== */
@media (min-width: 768px) {
  .materiais-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .material-img-wrapper {
    height: 100px;
  }

  .card-placeholder {
    height: 160px;
  }
}

@media (min-width: 1024px) {
  .materiais-grid {
    grid-template-columns: repeat(8, 1fr);
  }

  .material-img-wrapper {
    height: 110px;
  }
}

/* ===== Fundo geral ===== */
body {
  background: #f3f4f6;
}

@media (max-width: 480px) {
  .preco-input-group .material-price-input {
    width: 48px;
    height: 24px;
    font-size: 0.9rem;
    margin-bottom: 0rem !important;
  }

  .btn-maior,
  .btn-menor {
    width: 24px;
    height: 24px;
    font-size: 0.8rem;
  }

  .preco-input-group {
    gap: 1px;
  }
}

.card-placeholder {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 37%, #f0f0f0 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 10px;
  height: 150px;
  margin: 0.2rem;
}

/* Estilo para telas maiores que 768px (desktop/tablet) */
@media (min-width: 768px) {
  .card-placeholder {
    height: 160px;
  }
}


@keyframes shimmer {
  0% {
    background-position: -400px 0;
  }

  100% {
    background-position: 400px 0;
  }
}

/* Offcanvas base */
.offcanvas {
  position: fixed;
  top: 0;
  left: -100%;
  width: 80%;
  max-width: 320px;
  height: 100%;
  background: #fff;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
  transition: left 0.3s ease-in-out;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.offcanvas.open {
  left: 0;
}

.offcanvas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #ddd;
}

.offcanvas-body {
  padding: 1rem;
  overflow-y: auto;
}

/* Botão de filtro */
.btn-filtro {
  background: #007bff;
  color: white;
  border: none;
  font-size: 1.2rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
}

.btn-filtro:hover {
  background: #0056b3;
}

.btn-fechar {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
}

/* Estilo geral da árvore */
.arvore-materiais {
  user-select: none;
  list-style: none;
  padding-left: 0.5rem;
  margin: 0;
  font-family: "Segoe UI", Roboto, sans-serif;
  font-size: 0.95rem;
}

.arvore-materiais li {
  margin: 0.3rem 0;
  padding-left: 1.2rem;
  position: relative;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

/* Linha guia vertical */
.arvore-materiais li::before {
  content: "";
  position: absolute;
  left: 0.4rem;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #e0e0e0;
}

/* Bolinha ou setinha na frente dos itens */
.arvore-materiais li::after {
  content: "▸";
  /* setinha fechada */
  position: absolute;
  left: -0.2rem;
  color: #888;
  font-size: 0.7rem;
  top: 0.3rem;
  transition: transform 0.2s;
}

/* Quando o item estiver expandido (você pode controlar via classe JS) */
.arvore-materiais li.expandido::after {
  transform: rotate(90deg);
}

/* Hover */
.arvore-materiais li:hover {
  background: #f8f9fa;
  border-radius: 4px;
  color: #007bff;
}

/* Categorias principais (nível 1) */
.arvore-materiais>li {
  font-weight: bold;
  color: #333;
  padding-left: 0.8rem;
}

.arvore-materiais>li::after {
  font-size: 0.8rem;
  color: #007bff;
}

/* Subníveis */
.arvore-materiais li ul {
  margin-left: 1rem;
  padding-left: 0.5rem;
  border-left: 1px dashed #ddd;
}

.arvore-materiais li ul li {
  font-weight: normal;
  color: #555;
}

/* Remove margens e paddings laterais no layout principal */
body,
html {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
}

/* Remove espaçamento lateral do main */
main.container {
  padding: 0;
  margin: 0;
  width: 100%;
  max-width: none;
}

/* Remove padding da grid */
.materiais-grid {
  padding: 0;
  margin: 0;
  gap: 0.5rem;
}

/* Ajusta o espaçamento entre cards (sem borda lateral) */
.material-card {
  margin: 0;
}

/* Garante que o cabeçalho e busca também fiquem alinhados */
header,
.form,
.search-bar {
  margin: 0;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  width: 100%;
  box-sizing: border-box;
}

#material-nao-encontrado {
  font-size: 13px;
  margin: 6px 0 12px;
  color: #555;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  padding: 20px;
  border-radius: 10px;
  width: 90%;
  max-width: 400px;
}

.modal-content input,
.modal-content textarea {
  width: 100%;
  margin-top: 10px;
  padding: 8px;
}

#material-search-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.search-row {
  width: 100%;
  max-width: 420px;
  display: flex;
  gap: 6px;
}

#material-search-input {
  flex: 1;
}

/* ===== Image Zoom Overlay ===== */
.image-zoom-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  transition: opacity 0.3s ease;
}

.image-zoom-overlay.hidden {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

.zoom-container {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zoom-container img {
  max-width: 100%;
  max-height: 100vh;
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  display: block;
}

.close-zoom {
  position: absolute;
  top: -40px;
  right: -10px;
  background: none;
  border: none;
  color: white;
  font-size: 35px;
  cursor: pointer;
}

#material-nao-encontrado {
  text-align: center;
  font-size: 13px;
  color: #555;
}