/* ================================
   HEADER AJUSTADO COMPLETO (CORRIGIDO)
================================ */
.header {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 120px);
  border-radius: 15px;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background-color: #fff;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  overflow: visible; /* evita corte de sombras ou ícones */
  background-clip: padding-box; /* elimina artefatos nos cantos */
}

.logo img {
  height: 48px;
  transition: transform 0.2s ease;
}

.logo img:hover {
  transform: scale(1.05);
}

/* ================================
   NAVIGATION STRUCTURE
================================ */
.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 1;
  margin-left: 2rem;
  position: relative;
  z-index: 100;
}

.nav-center ul,
.nav-right ul {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-center a,
.nav-right a {
  font-size: 1.05rem;
  font-weight: 500;
  color: #333;
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-center a:hover,
.nav-right a:hover {
  color: #7b3ff2;
}

/* ================================
   ÍCONE DO CARRINHO
================================ */
.cart-icon {
  position: relative;
  cursor: pointer;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* evita que surja uma instância duplicada (o “fantasma”) */
body > .cart-icon:not(:first-of-type) {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.cart-icon:hover {
  transform: scale(1.05);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
}

.cart-icon img {
  width: 22px;
  height: 22px;
  filter: brightness(0) saturate(100%) invert(30%) sepia(90%) saturate(3000%)
    hue-rotate(250deg) brightness(95%) contrast(90%);
  transition: opacity 0.3s ease;
}

.cart-icon:hover img {
  opacity: 0.75;
}

#cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background-color: #7b3ff2;
  color: white;
  font-size: 0.7rem;
  font-weight: bold;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.25);
}

/* ================================
   MENU HAMBÚRGUER
================================ */
.menu-toggle {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
}

.menu-icon {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  margin-right: 8px;
  z-index: 1200;
}

.menu-icon img {
  width: 20px;
  height: 20px;
  display: block;
}

/* ================================
   MODAL DE CARRINHO MODERNO
================================ */
#cart-modal {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.35);
  z-index: 2000;
}

#cart-modal.open {
  display: flex;
  animation: fadeIn 0.25s ease forwards;
}

@keyframes fadeIn {
  from {
    background: rgba(0, 0, 0, 0);
  }
  to {
    background: rgba(0, 0, 0, 0.35);
  }
}

.cart-content {
  background: #fff;
  width: 380px;
  max-width: 90%;
  height: auto;
  max-height: 90vh;
  margin: auto 0;
  border-radius: 16px 0 0 16px;
  box-shadow: -8px 0 25px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  animation: slideIn 0.3s ease forwards;
  overflow-y: auto;
  padding: 1.5rem;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.cart-content h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-content h2 button {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: #555;
  transition: color 0.2s;
}

.cart-content h2 button:hover {
  color: #7b3ff2;
}

/* ================================
   ITENS DO CARRINHO
================================ */
.cart-items {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.3rem;
}

.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8f7fc;
  border-radius: 12px;
  padding: 0.8rem;
  margin-bottom: 0.9rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.cart-item img {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
}

.cart-item-info {
  flex: 1;
  margin-left: 0.8rem;
}

.cart-item-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #222;
}

.cart-item-info p {
  font-size: 0.85rem;
  color: #777;
  margin-top: 3px;
}

/* ================================
   CONTROLES DE QUANTIDADE
================================ */
.cart-item-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cart-item-controls .quantity {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}

.cart-item-controls button {
  background: #eee;
  border: none;
  border-radius: 5px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  transition: background 0.2s;
  font-weight: 600;
}

.cart-item-controls button:hover {
  background: #ddd;
}

/* ================================
   TOTAL
================================ */
.cart-total {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  margin-top: 1rem;
  font-size: 1rem;
}

/* ================================
   BOTÕES
================================ */
.cart-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 1rem;
  gap: 10px;
}

#clear-cart,
#finalize-cart {
  flex: 1;
  padding: 0.8rem;
  font-weight: 600;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

#clear-cart {
  background: #fff;
  color: #7b3ff2;
  border-color: #7b3ff2;
}

#clear-cart:hover {
  background: #f3eaff;
}

#finalize-cart {
  background: #7b3ff2;
  color: #fff;
}

#finalize-cart:hover {
  background: #6a32e2;
}

/* ================================
   SCROLL PERSONALIZADO
================================ */
.cart-content::-webkit-scrollbar {
  width: 6px;
}

.cart-content::-webkit-scrollbar-thumb {
  background-color: #ccc;
  border-radius: 4px;
}

/* ================================
   RESPONSIVIDADE
================================ */
@media (max-width: 1280px) {
  .header {
    width: calc(100% - 40px);
    top: 15px;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    overflow: visible;
  }

  .menu-icon {
    display: flex;
  }

  .logo {
    margin-left: 6px;
    z-index: 1200;
  }

  .nav-container {
    position: fixed;
    top: 0;
    right: -100%;
    width: 240px;
    height: 100vh;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 80px 20px;
    background-color: #ffffff;
    gap: 2rem;
    box-shadow: -3px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 1500;
  }

  .menu-toggle:checked ~ .nav-container {
    right: 0;
  }

  .nav-center ul,
  .nav-right ul {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
  }

  .nav-center a,
  .nav-right a {
    display: block;
    font-size: 1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.3rem;
    width: 100%;
  }
}
