/* ============================================================
   Rocha Brindes - Main Stylesheet (V1 - Layout Sidebar)
   ============================================================ */

/* === BASE === */
@import url('./base/_reset.css');
@import url('./base/_variables.css');
@import url('./base/_typography.css');

/* === LAYOUT === */
@import url('./layout/_header.css');
@import url('./layout/_main.css');
@import url('./layout/_modal.css');

/* === COMPONENTS === */
@import url('./components/_buttons.css');
@import url('./components/_cards.css');
@import url('./components/_forms.css');

/* ============================================================
   CATEGORIAS MAIS PROCURADAS
   ============================================================ */
.popular-categories {
  padding: 3rem 1rem;
  background-color: var(--color-background);
  max-width: var(--container-width);
  margin: 0 auto;
}

.popular-categories h2 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 2rem;
  text-align: center;
}

.popular-categories__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  justify-items: center;
}

.category-card {
  background: #fff;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--border-radius-main);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow-subtle);
  max-width: 250px;
  width: 100%;
}

.category-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

.category-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0.8rem 0 1rem;
  text-align: center;
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

/* ============================================================
   ÍCONE DO ORÇAMENTO NO CABEÇALHO
   ============================================================ */
.icon-cart {
  width: 24px;
  height: 24px;
  color: var(--color-text-primary);
  transition: transform 0.2s ease, color 0.2s ease;
}

.btn--icon:hover .icon-cart {
  transform: scale(1.1);
  color: var(--color-primary);
}

.btn__badge {
  background: var(--color-primary);
  color: var(--color-text-primary);
  border-radius: 50%;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 700;
  position: absolute;
  top: -5px;
  right: -5px;
}

/* ============================================================
   🔍 BARRA DE PESQUISA (V1 - Na Sidebar)
   ============================================================ */
.search-bar {
  width: 100%;
  /* Remove max-width e margin-auto para caber na sidebar */
  position: relative; 
}

.search-bar input {
  flex: 1;
  width: 100%;
  padding: 14px 60px 14px 24px; 
  font-size: 1rem;
  font-family: var(--font-family-body);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-subtle);
  border-radius: 30px;
  outline: none;
  transition: all 0.2s ease;
}

.search-bar input::placeholder {
  color: #999;
}

.search-bar input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(243, 195, 0, 0.2);
}

.search-bar button {
  position: absolute;
  top: 50%;
  right: 0.6rem; /* Ajuste fino para a borda */
  transform: translateY(-50%);
  background: var(--color-primary);
  color: var(--color-text-primary);
  border: none;
  border-radius: 50%;
  width: 44px; 
  height: 44px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.search-bar button:hover {
  box-shadow: var(--shadow-hover);
  opacity: 0.9;
}

.search-bar button svg {
  width: 20px;
  height: 20px;
  stroke: var(--color-text-primary);
}

/* ============================================================
   🎯 FILTROS DE CATEGORIAS (V1 - Lista Vertical)
   ============================================================ */
.filter-container {
  display: flex;
  flex-direction: column; /* ✅ MUDANÇA PRINCIPAL: Vertical */
  align-items: stretch; /* ✅ Botões esticam 100% */
  gap: 8px; /* Espaço entre os botões */
  /* Remove todos os estilos de scroll horizontal */
  overflow-x: hidden;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

.filter-btn {
  background: transparent; /* ✅ Visual mais "menu" */
  border: 1px solid transparent; /* Sem borda por padrão */
  border-radius: 8px; /* Menos redondo, mais "botão de menu" */
  padding: 10px 12px;
  font-size: 0.95rem;
  color: var(--color-text-secondary); /* ✅ Cor de texto mais suave */
  cursor: pointer;
  transition: all 0.2s ease;
  
  /* Remove estilos de scroll */
  flex-shrink: 1;
  margin-right: 0;
  margin-left: 0;

  text-align: left; /* ✅ Alinha o texto à esquerda */
  width: 100%; /* Ocupa todo o espaço */
}

/* Remove margens desnecessárias */
.filter-btn:first-child {
  margin-left: 0;
}
.filter-btn:last-child {
  margin-right: 0;
}

.filter-btn:hover {
  background: var(--color-border-subtle); /* Um hover sutil */
  color: var(--color-text-primary);
}

.filter-btn.active {
  background: var(--color-primary);
  color: var(--color-text-primary);
  border-color: var(--color-primary);
  font-weight: 600;
}

/* ============================================================
   📱 RESPONSIVIDADE (Apenas mobile da search-bar, o resto está no _main.css)
   ============================================================ */
@media (max-width: 768px) {
  .search-bar {
    margin-top: 0; /* Sidebar já cuida do espaçamento */
  }
 
  .search-bar input {
    padding: 12px 54px 12px 20px;
  }
 
  .search-bar button {
    right: 0.5rem; /* Ajuste mobile */
    width: 40px;
    height: 40px;
  }
}

/* ============================================================
   ✅ CSS DO CARRINHO (SIDEBAR)
   ============================================================ */

/* --- O Container Principal --- */
.cart-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 90%;
  height: 100%;
  height: 100dvh;
  background: #ffffff;
  box-shadow: -4px 0 15px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--color-border-subtle);
}

.cart-sidebar.open {
  transform: translateX(0);
}

/* --- Cabeçalho --- */
.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border-subtle);
  flex-shrink: 0;
}

.cart-header h2 {
  font-family: var(--font-family-title);
  font-size: 1.25rem;
  margin: 0;
}

#closeCartBtn {
  font-size: 1.5rem;
  font-weight: 300;
  color: #888;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.2s;
}
#closeCartBtn:hover {
  color: #000;
}

/* --- Lista de Itens --- */
.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}

.cart-empty {
  text-align: center;
  padding-top: 2rem;
  color: #777;
}

/* --- Cada Item --- */
.cart-item {
  display: flex;
  gap: 1rem;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--color-border-subtle);
  position: relative;
}

.cart-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.cart-item__image {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--border-radius-main);
  flex-shrink: 0;
  background: #f8f8f8;
}

.cart-item__info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.cart-item__name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
  color: var(--color-text-primary);
}

.cart-item__variation {
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 0.75rem;
  text-transform: capitalize;
}

/* --- Controles de Quantidade (+ / -) --- */
.cart-item__controls {
  display: flex;
  align-items: center;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--border-radius-main);
  max-width: 120px;
}

.cart-item__btn {
  background: #f9f9f9;
  border: none;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  color: #555;
}
.cart-item__btn:hover {
  background: #f0f0f0;
}
.cart-item__btn:first-child {
  border-right: 1px solid var(--color-border-subtle);
  border-radius: var(--border-radius-main) 0 0 var(--border-radius-main);
}
.cart-item__btn:last-child {
  border-left: 1px solid var(--color-border-subtle);
  border-radius: 0 var(--border-radius-main) var(--border-radius-main) 0;
}

.cart-item__qty {
  width: 100%;
  flex: 1;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  padding: 0.5rem 0.25rem;
  -moz-appearance: textfield;
}
.cart-item__qty::-webkit-outer-spin-button,
.cart-item__qty::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* --- Botão Remover (✕) --- */
.cart-item__remove {
  position: absolute;
  top: 0;
  right: 0;
  background: none;
  border: none;
  font-size: 1.2rem;
  font-weight: 300;
  color: #999;
  cursor: pointer;
  padding: 0.25rem;
}
.cart-item__remove:hover {
  color: var(--color-primary);
}

/* --- Formulário (Rodapé) --- */
.cart-form {
  padding: 1.25rem;
  border-top: 1px solid var(--color-border-subtle);
  background: #fdfdfd;
  flex-shrink: 0;
  overflow-y: auto;
}

.cart-form input,
.cart-form textarea {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  border: 1px solid var(--color-border-subtle);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: var(--font-family-body);
}

.cart-form textarea {
  min-height: 80px;
  resize: vertical;
}

.cart-form input:focus,
.cart-form textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(243, 195, 0, 0.2);
}

.cart-form button[type="submit"] {
  width: 100%;
  padding: 0.85rem;
  font-size: 1rem;
  background: var(--color-primary);
  color: var(--color-text-primary);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  transition: var(--transition-fast);
}

.cart-form button[type="submit"]:hover {
  opacity: 0.9;
  box-shadow: var(--shadow-hover);
}

/* ✅ ADICIONE ESTAS REGRAS ABAIXO */
.form-error-message {
  font-size: 0.85rem;
  color: #c00;
  font-weight: 600;
  margin: -0.5rem 0 0.75rem 0.25rem;
  display: none; /* Começa escondido */
}

/* ======== BOTÃO 'VER DETALHES' – estilo bonito ======== */
.product-card__details-btn {
  background-color: #ffcc00;
  color: #000;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1.2rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  margin-top: 0.5rem;
}

.product-card__details-btn:hover {
  background-color: #ffb400;
  transform: translateY(-1px);
}

.product-card__details-btn:active {
  background-color: #e0a600;
  transform: translateY(0);
}

