/* ==================== ESTILOS CATÁLOGO 2025 ==================== */

/* CRÍTICO: overflow-x: hidden no corpo (body) quebra position: sticky! */
/* Usamos overflow-x: clip para permitir o funcionamento do sticky */
body {
  background: linear-gradient(135deg, var(--blue-900) 0%, var(--blue-700) 100%);
  min-height: 100dvh;
  overflow-x: clip !important;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(1rem, 5vw, 2rem);
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 28px;
  transition: grid-template-columns 0.3s ease;
  /* Removido align-items: start que pode conflitar com sticky */
}

/* Container com barra lateral recolhida */
.container:has(.sidebar[data-collapsed="true"]) {
  grid-template-columns: 80px 1fr;
}

/* ==================== SECÇÃO HERO (PREMIUM) ==================== */
.catalog-hero {
  position: relative;
  background: radial-gradient(
    circle at top right,
    var(--blue-700),
    var(--blue-900)
  );
  padding: clamp(60px, 8vh, 100px) 24px clamp(80px, 10vh, 120px); /* Preenchimento vertical dinâmico */
  color: white;
  margin-bottom: -60px; /* Sobreposição com o container */
  overflow: hidden;
  box-shadow: var(--shadow-xl);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
  pointer-events: none;
}

.hero-content {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  line-height: 1.1;
  margin: 0;
  letter-spacing: -0.02em;
  color: white !important; /* Força texto branco */
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.hero-title .highlight {
  color: var(--orange-300);
  position: relative;
  display: inline-block;
}

.hero-title .highlight::after {
  content: "";
  position: absolute;
  bottom: 8px;
  left: 0;
  width: 100%;
  height: 12px;
  background: var(--orange-500);
  opacity: 0.2;
  transform: skewX(-12deg);
  z-index: -1;
}

.hero-subtitle {
  font-family: var(--font-body);
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--blue-50);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
  font-weight: 400;
}

/* ==================== BARRA DE PESQUISA (CENTRAL DE COMANDO) ==================== */
.hero-search-wrapper {
  width: 100%;
  max-width: 700px;
  margin-top: 12px;
  position: relative;
}

.search-input-group {
  position: relative;
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 8px;
  display: flex;
  align-items: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.search-input-group:focus-within {
  background: rgba(255, 255, 255, 1);
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.25),
    0 0 0 4px rgba(255, 193, 7, 0.3);
  transform: translateY(-2px);
}

.search-icon {
  margin-left: 16px;
  color: rgba(255, 255, 255, 0.7);
  transition: color 0.3s ease;
  flex-shrink: 0;
}

.search-input-group:focus-within .search-icon {
  color: var(--orange-500);
}

.hero-search-box {
  width: 100%;
  background: transparent;
  border: none;
  padding: 16px;
  font-family: var(--font-body);
  font-size: 1.1rem;
  color: white;
  font-weight: 500;
}

.search-input-group:focus-within .hero-search-box {
  color: var(--gray-900);
}

.hero-search-box::placeholder {
  color: rgba(255, 255, 255, 0.5);
  font-weight: 400;
}

.search-input-group:focus-within .hero-search-box::placeholder {
  color: var(--gray-400);
}

.hero-search-box:focus {
  outline: none;
}

.search-shortcut {
  margin-right: 16px;
  background: rgba(255, 255, 255, 0.15);
  padding: 4px 10px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.search-input-group:focus-within .search-shortcut {
  opacity: 0;
}

/* Hero Responsivo */
@media (max-width: 768px) {
  .catalog-hero {
    padding: 40px 20px 80px;
    margin-bottom: -50px;
  }

  .hero-content {
    gap: 16px;
  }

  .hero-search-box {
    font-size: 1rem;
    padding: 12px;
  }

  .search-shortcut {
    display: none;
  }
}

/* ==================== BARRA LATERAL ==================== */
.sidebar {
  position: -webkit-sticky;
  position: sticky;
  top: 100px; /* Ajuste de topo */
  height: fit-content;
  max-height: calc(100vh - 120px); /* Mais espaço livre */
  max-height: calc(100dvh - 120px);
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: visible; /* Permitir tooltips */
  overflow-x: visible;
  padding-right: 4px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 100;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Garante que o cartão de orçamento preencha o espaço, mas encolha se necessário */
.sidebar .catalog-card:has(.quote-items) {
  flex: 1 1 auto;
  min-height: 0; /* Crítico para rolagem flex */
  display: flex;
  flex-direction: column;
}

/* Remove barras de rolagem padrão que parecem feias no modo recolhido */
.sidebar::-webkit-scrollbar {
  display: none;
}

.catalog-card {
  background: linear-gradient(135deg, white 0%, var(--gray-50) 100%);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.9);
  overflow: hidden; /* Estado padrão overflow hidden */
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Estilo Específico do Cartão de Informação (Expandido) */
.info-card-link {
  background: white !important;
  border: 1px solid var(--gray-200) !important;
  box-shadow: var(--shadow-sm) !important;
  min-height: 320px; /* Combina com altura dos cartões de categoria */
  display: flex !important;
  flex-direction: column;
  justify-content: center;
}

.info-card-link:hover {
  border-color: var(--orange-300) !important;
  box-shadow: var(--shadow-md) !important;
}

.info-card-link .sidebar-info-text {
  font-size: 0.9rem;
  color: var(--gray-600);
  margin-bottom: 12px;
  line-height: 1.5;
}

/* ==================== BOTÃO DE ALTERNÂNCIA DA BARRA LATERAL ==================== */
.sidebar-toggle-btn {
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 0;
  height: 48px; /* Alvo de toque mais alto */
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0; /* Margem removida para alinhamento */
  width: 100%;
  position: relative;
  overflow: hidden;
}

.sidebar-toggle-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--orange-500);
  color: var(--orange-500);
}

.sidebar-toggle-btn svg {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (min-width: 969px) {
  /* ==================== BARRA LATERAL RECOLHIDA (ESTILO DOCK) ==================== */
  .sidebar[data-collapsed="true"] {
    width: 80px;
    /* Ligeiramente mais largo para área de clique confortável */
    min-width: 80px;
    align-items: center;
    /* Centraliza tudo verticalmente */
    gap: 20px;
  }

  /* Botão de Alternância Recolhido */
  .sidebar[data-collapsed="true"] .sidebar-toggle-btn {
    width: 48px;
    height: 48px; /* Torna quadrado */
    border-radius: 50%;
    margin: 0 auto 16px;
    background: rgba(255, 255, 255, 0.1); /* Translúcido */
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
  }

  .sidebar[data-collapsed="true"] .sidebar-toggle-btn:hover {
    background: white;
    color: var(--orange-500);
    border-color: white;
  }

  .sidebar[data-collapsed="true"] .sidebar-toggle-btn svg {
    transform: rotate(180deg);
  }

  /* Cartões Recolhidos (Geral) */
  .sidebar[data-collapsed="true"] .catalog-card {
    width: 48px;
    height: 48px;
    min-height: 48px !important;
    /* Força tamanho pequeno */
    max-height: 48px !important;
    padding: 0 !important;
    border-radius: 50%;
    /* Formato circular */
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    overflow: visible;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition:
      transform 0.3s ease,
      box-shadow 0.3s ease;
    /* Garante presença da transição */
  }

  .sidebar[data-collapsed="true"] .catalog-card:hover {
    transform: scale(1.15);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    z-index: 50;
  }

  /* Cartão de Informação Recolhido (Ícone Personalizado) */
  .sidebar[data-collapsed="true"] .info-card-link {
    /* Sobrescreve sticky */
    background: white !important;
    /* Sobrescreve fundo */
    border: 2px solid white !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Reseta estilos globais (linha laranja) e triângulo de tooltip */
  .sidebar[data-collapsed="true"] .info-card-link::before,
  .sidebar[data-collapsed="true"] .info-card-link:hover::before {
    content: "📝" !important;
    font-size: 1.4rem;
    line-height: 1;
    display: block !important;
    color: #1f2937 !important;
    opacity: 1 !important;

    /* Remove decorações conflitantes */
    background: none !important;
    height: auto !important;
    width: auto !important;
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    border: none !important;
    transform: none !important;
    margin: 0 !important;
  }

  .sidebar[data-collapsed="true"] .info-card-link .catalog-card-body {
    display: none !important;
  }

  /* Oculta outros elementos de conteúdo */
  .sidebar[data-collapsed="true"] .sidebar-info-text,
  .sidebar[data-collapsed="true"] .btn {
    display: none !important;
  }

  /* Tooltips */
  .sidebar[data-collapsed="true"] .catalog-card::after {
    content: attr(title);
    position: absolute;
    left: 60px;
    /* Deslocamento do círculo */
    top: 50%;
    transform: translateY(-50%) translateX(-10px);
    background: rgba(15, 23, 42, 0.95);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }

  .sidebar[data-collapsed="true"] .catalog-card:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
  }

  /* Triângulo para tooltip */
  .sidebar[data-collapsed="true"] .catalog-card:hover::before {
    content: "";
    position: absolute;
    left: 54px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: transparent rgba(15, 23, 42, 0.95) transparent transparent;
    opacity: 0;
    transition: opacity 0.2s 0.1s;
  }

  .sidebar[data-collapsed="true"] .catalog-card:hover::before {
    opacity: 1;
  }
}

.catalog-card:has(.quote-items) {
  height: auto;
  /* Altura dinâmica para caber na barra lateral */
  max-height: 100%;
  min-height: 250px; /* Reduced from 520px to prevent overflow on small screens */
  overflow: visible;
  display: flex;
  flex-direction: column;
}

.catalog-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--orange-300),
    transparent
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
  pointer-events: none;
}

.catalog-card-header {
  background: linear-gradient(
    135deg,
    var(--orange-500) 0%,
    var(--orange-700) 100%
  );
  padding: 16px 20px;
  color: var(--orange-500);
  box-shadow:
    0 2px 0 rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  border-radius: 20px 20px 0 0;
  flex-shrink: 0;
}

.catalog-card-header h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  letter-spacing: -0.01em;
  color: white;
}

.catalog-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0; /* Importante para containers de rolagem aninhados */
  overflow: hidden;
  border-radius: 0 0 20px 20px;
}

.catalog-card:has(.quote-items) .catalog-card-body {
  height: 100%;
  /* Deixa o flexbox gerir a altura baseado nas restrições da barra lateral */
  display: flex;
  flex-direction: column;
  overflow-y: hidden;
  overflow-x: hidden;
}

.catalog-card:has(.quote-items) .quote-items {
  flex: 1; /* Ocupa espaço restante */
  overflow-y: auto; /* Área rolável */
  min-height: 0; /* Crucial para rolagem flex */
}

/* Secção de Pesquisa */
.search-section {
  width: 100%;
  margin-bottom: 20px;
}

#categoryTitleContainer:empty {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Container de Controlos do Catálogo (Apenas Wrapper) */
.catalog-controls {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-bottom: 16px; /* Margem reduzida */
  background: rgba(255, 255, 255, 0.03); /* Fundo mais claro */
  backdrop-filter: blur(8px);
  padding: 10px 20px;
  border-radius: 12px;
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.catalog-controls .filter-bar {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.catalog-controls .search-section {
  flex: 1;
  min-width: 300px;
  margin-bottom: 0;
}

/* Caixa de Pesquisa */
.search-box {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 400;
  background: var(--gray-50);
  transition: all 0.2s ease;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
  margin-bottom: 0;
}

.search-box:focus {
  outline: none;
  border-color: var(--orange-400);
  box-shadow: 0 0 0 3px rgba(209, 124, 43, 0.1);
  background: white;
}

.search-box::placeholder {
  color: var(--gray-400);
}

/* Grupo de Filtro */
.filter-group {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  /* Removido min-height e flex para evitar colapso */
}

.filter-group:first-child {
  margin-top: 0;
}

.catalog-card:has(.category-grid) .catalog-card-body {
  /* Removido max-height e overflow hidden para permitir crescimento natural */
  display: flex;
  flex-direction: column;
}

.catalog-card:has(.category-grid) .btn-secondary {
  margin-top: 12px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.filter-group label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--gray-800);
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.filter-group select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-inset);
}

.filter-group select:focus {
  outline: none;
  border-color: var(--orange-500);
  box-shadow: 0 0 0 4px rgba(209, 124, 43, 0.12);
}

.filter-group select:hover {
  border-color: var(--orange-300);
}

/* Lista de Orçamento */
.quote-items {
  flex: 1 1 auto; /* Permite encolher/crescer */
  min-height: 0; /* Crucial para rolagem em container flex */
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
  margin-bottom: 12px;
  /* Estilo da barra de rolagem para itens de orçamento */
  scrollbar-width: thin;
  scrollbar-color: var(--orange-300) var(--gray-100);
}

.quote-item {
  background: linear-gradient(135deg, var(--gray-50) 0%, white 100%);
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  box-shadow: var(--shadow-sm);

  border: 1px solid var(--gray-200);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 80px;
}

.quote-item-ref {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--blue-700);
  margin-bottom: 4px;
  font-size: 0.8rem;
  word-break: break-all;
}

.quote-item-name {
  font-family: var(--font-body);
  color: var(--gray-600);
  font-size: 0.75rem;
  line-height: 1.4;
  font-weight: 500;
  word-wrap: break-word;
  margin-bottom: 6px;
}

.remove-btn {
  background: transparent;
  color: var(--gray-400);
  border: none;
  padding: 4px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.2s ease;
  min-width: 24px;
  height: 24px;
  flex-shrink: 0;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
}

.remove-btn:hover {
  background: var(--gray-100);
  color: var(--error);
  transform: scale(1.1);
  opacity: 1;
}

.remove-btn:active {
  transform: scale(0.95);
}

.quote-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  padding-top: 16px;
  flex-shrink: 0;
  flex-grow: 0;
  position: relative;
  z-index: 10;
  background: white;
  margin-left: -16px;
  margin-right: -16px;
  margin-bottom: -16px;
  padding-left: 16px;
  padding-right: 16px;
  padding-bottom: 16px;
  border-radius: 0 0 20px 20px;
}

.quote-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.9rem;
}

.quote-empty p {
  margin: 0;
}

/* ==================== CONTEÚDO PRINCIPAL ==================== */
.main-content {
  min-width: 0;
}

/* Barra de Estatísticas */
.stats {
  background: linear-gradient(135deg, white 0%, var(--gray-50) 100%);
  padding: 12px 20px;
  border-radius: 12px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  display: flex;
  justify-content: center;
  gap: 32px;
}

.stat-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  transition: all 0.3s ease;
}

.stat-item:hover {
  opacity: 0.8;
}

.stat-number {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--orange-600);
  margin: 0;
  line-height: 1;
}

.stat-label {
  font-family: var(--font-body);
  color: var(--gray-600);
  font-size: 0.85rem;
  font-weight: 500;
  text-align: left;
  letter-spacing: 0;
}

/* Grelha de Produtos */
.products-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 48px;
  transition: grid-template-columns 0.3s ease;
}

/* Aumenta colunas quando a barra lateral está recolhida */
.container:has(.sidebar[data-collapsed="true"]) .products-grid {
  grid-template-columns: repeat(4, 1fr);
}

/* Colunas extras para ecrãs muito largos */
@media (min-width: 1600px) {
  .container:has(.sidebar[data-collapsed="true"]) .products-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* Cartão de Produto Premium */
.product-card {
  background: white;
  border-radius: 24px;
  padding: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--gray-100);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: visible; /* Permite que efeitos de hover saiam */
  height: 100%;
}

.product-card:hover {
  transform: translateY(-8px);
  box-shadow:
    0 16px 32px rgba(0, 0, 0, 0.08),
    0 4px 8px rgba(0, 0, 0, 0.04);
  border-color: transparent;
  z-index: 10;
}

/* Brilho subtil ao passar o rato */
.product-card::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 24px;
  padding: 1px;
  background: linear-gradient(135deg, var(--orange-300), var(--blue-300));
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.product-card:hover::after {
  opacity: 1;
}

/* Cabeçalho do Produto - Contém Imagem e Título */
.product-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 8px;
}

/* Container da Imagem do Produto */
.product-image-container {
  width: 100%;
  height: 220px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, var(--gray-100), var(--gray-50));
}

.product-image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition:
    transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s ease;
}

/* ==========================================
   ESTADOS DE CARREGAMENTO DE IMAGEM
========================================== */

/* Animação de brilho (Skeleton) */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* Skeleton de carregamento de imagem */
.product-image-container img.img-loading {
  background: linear-gradient(
    90deg,
    #f0f0f0 0%,
    #e0e0e0 20%,
    #f0f0f0 40%,
    #f0f0f0 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite linear;
  min-height: 200px;
}

/* Fade-in suave quando a imagem carrega */
.product-image-container img.img-loaded {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.product-card:hover .product-image-container img {
  transform: scale(1.08);
}

.product-icon-overlay {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  padding: 8px;
  border-radius: 8px;
  font-size: 1.3em;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.product-card:hover .product-icon-overlay {
  transform: scale(1.1) rotate(-5deg);
  box-shadow: var(--shadow-md);
}

/* Fallback para estilo de ícone antigo (se sem imagem) */
.product-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(
    135deg,
    var(--orange-300) 0%,
    var(--orange-500) 100%
  );
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.4em;
  flex-shrink: 0;
  box-shadow:
    var(--shadow-md),
    inset 0 2px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.3s ease;
}

.product-card:hover .product-icon {
  transform: scale(1.08) rotate(-2deg);
}

.product-info {
  flex: 1;
  min-width: 0;
}

.product-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 10px;
  line-height: 1.3;
  word-wrap: break-word;
  letter-spacing: -0.01em;
}

.product-category {
  display: inline-block;
  background: linear-gradient(135deg, var(--blue-500) 0%, var(--blue-700) 100%);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  letter-spacing: 0.02em;
}

.product-details {
  margin: 0;
  padding: 8px 10px;
  background: var(--gray-50);
  border-radius: 8px;
  border: 1px solid var(--gray-100);
}

.product-detail {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  gap: 8px;
}

.product-detail:last-child {
  margin-bottom: 0;
}

.detail-label {
  font-family: var(--font-body);
  color: var(--gray-400);
  font-weight: 500;
  font-size: 0.65rem;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.detail-value {
  font-family: var(--font-mono);
  color: var(--gray-500);
  font-weight: 500;
  font-size: 0.75rem;
  text-align: right;
  word-break: break-word;
  overflow-wrap: anywhere;
  letter-spacing: 0.01em;
}

/* Referência - estilo subtil */
.product-detail:first-child .detail-value {
  color: var(--gray-600);
  font-size: 0.75rem;
}

/* Torna EAN secundário */
.product-detail:nth-child(2) {
  opacity: 0.6;
}

.product-detail:nth-child(2) .detail-value {
  font-size: 0.7rem;
  color: var(--gray-400);
  font-weight: 500;
}

.add-to-quote-btn {
  width: 100%;
  background: linear-gradient(
    135deg,
    var(--orange-500) 0%,
    var(--orange-700) 100%
  );
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.9rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.02em;
}

.add-to-quote-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.6),
    transparent
  );
}

.add-to-quote-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.add-to-quote-btn:hover:not(:disabled)::after {
  opacity: 1;
}

.add-to-quote-btn:hover:not(:disabled) {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.add-to-quote-btn:active:not(:disabled) {
  transform: translateY(-1px);
}

.add-to-quote-btn:disabled {
  background: linear-gradient(135deg, var(--gray-400) 0%, var(--gray-500) 100%);
  cursor: not-allowed;
  opacity: 0.7;
}

/* Spinner do Botão */
.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 8px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.add-to-quote-btn.added {
  background: linear-gradient(
    135deg,
    var(--success) 0%,
    var(--success-dark) 100%
  );
  position: relative;
  overflow: visible;
}

.add-to-quote-btn.added.animate-check::before {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2em;
  animation: checkmark 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

@keyframes checkmark {
  0% {
    transform: translate(-50%, -50%) scale(0) rotate(-45deg);
    opacity: 0;
  }

  60% {
    transform: translate(-50%, -50%) scale(1.3) rotate(10deg);
    opacity: 1;
  }

  100% {
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
    opacity: 0;
  }
}

/* Estado Vazio */
.empty-state {
  text-align: center;
  padding: 100px 24px;
  color: var(--gray-400);
  grid-column: 1 / -1;
}

.empty-state-icon {
  font-size: 6em;
  margin-bottom: 24px;
  opacity: 0.25;
  filter: grayscale(1);
}

.empty-state h3 {
  font-family: var(--font-display);
  color: var(--gray-600);
  margin-bottom: 12px;
  font-size: 1.75rem;
  font-weight: 700;
}

.empty-state p {
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 500;
}

/* Estado de Categoria Vazia (Em Construção) */
.empty-category-state {
  background: white;
  border-radius: 20px;
  padding: 48px 32px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  border: 2px dashed var(--orange-300);
  max-width: 680px; /* Cartão mais largo */
  width: 100%;
  margin: 20px auto;
  position: relative;
  overflow: visible; /* Garante que o conteúdo não seja cortado */
}

.empty-category-state .empty-state-icon {
  opacity: 1;
  filter: none;
  font-size: 5rem;
  margin-bottom: 24px;
  animation: bounce-subtle 3s ease-in-out infinite;
}

@keyframes bounce-subtle {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

.empty-category-state h3 {
  color: var(--orange-600);
  font-size: 1.8rem;
  margin-bottom: 16px;
  line-height: 1.2;
}

.empty-category-state p {
  color: var(--gray-600);
  max-width: 500px;
  margin: 0 auto 32px;
  font-size: 1.05rem;
  line-height: 1.6;
}

.empty-category-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.empty-category-actions .btn {
  min-width: 200px;
  justify-content: center;
  font-size: 1rem;
  padding: 12px 24px;
}

/* Estilo do cartão de categoria vazia */
.category-card.category-empty {
  opacity: 0.85;
  border: 2px dashed var(--category-color, var(--gray-300));
}

.category-card.category-empty .category-count {
  color: var(--orange-500);
  font-weight: 600;
}

.category-card.category-empty:hover {
  opacity: 1;
  transform: translateY(-4px) scale(1.02);
}

.loading {
  text-align: center;
  padding: 80px 24px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--gray-600);
  grid-column: 1 / -1;
}

/* Skeleton de Carregamento */
.loading-skeleton {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  grid-column: 1 / -1;
}

.skeleton-card {
  background: linear-gradient(
    90deg,
    var(--gray-100) 0%,
    var(--gray-200) 50%,
    var(--gray-100) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 16px;
  height: 400px;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

@media (max-width: 1200px) {
  .loading-skeleton {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .loading-skeleton {
    grid-template-columns: 1fr;
  }
}

/* Estilização da Barra de Rolagem */
.quote-items::-webkit-scrollbar,
.category-grid::-webkit-scrollbar {
  width: 8px;
}

.quote-items::-webkit-scrollbar-track,
.category-grid::-webkit-scrollbar-track {
  background: var(--gray-100);
  border-radius: 12px;
}

.quote-items::-webkit-scrollbar-thumb,
.category-grid::-webkit-scrollbar-thumb {
  background: linear-gradient(
    135deg,
    var(--orange-500) 0%,
    var(--orange-700) 100%
  );
  border-radius: 12px;
  border: 2px solid var(--gray-100);
}

.quote-items::-webkit-scrollbar-thumb:hover,
.category-grid::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(
    135deg,
    var(--orange-700) 0%,
    var(--orange-900) 100%
  );
}

/* ==================== DESIGN RESPONSIVO ==================== */
@media (max-width: 1200px) {
  .container {
    grid-template-columns: 300px 1fr;
    gap: 24px;
    padding: 24px;
  }

  .container:has(.sidebar[data-collapsed="true"]) {
    grid-template-columns: 80px 1fr;
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Barra lateral recolhida no tablet = 3 colunas */
  .container:has(.sidebar[data-collapsed="true"]) .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 968px) {
  .container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 20px;
  }

  /* Barra lateral volta ao topo */
  .sidebar {
    order: 0;
    position: relative;
    top: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 0;
    max-height: none; /* Reseta altura máxima para fluxo móvel */
  }

  /* Pilha Móvel de Controlos do Catálogo */
  .catalog-controls {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
    gap: 16px;
  }

  .catalog-controls .filter-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .results-info {
    width: 100%;
    text-align: left;
    font-size: 0.9rem;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--blue-100);
  }

  .sort-control {
    width: 100%;
    justify-content: space-between;
  }

  .sort-control label {
    font-size: 0.9rem;
  }

  .sort-control select {
    flex: 1;
    max-width: 200px;
  }

  /* Reseta alturas dos cartões de layout no móvel */
  .catalog-card:has(.quote-items) {
    height: auto !important; /* Permite crescimento */
    min-height: 0;
  }

  .catalog-card:has(.quote-items) .catalog-card-body {
    height: auto; /* Permite altura automática no móvel */
    max-height: 500px; /* Limite razoável para móvel */
    min-height: 200px;
  }

  .catalog-card:has(.quote-items) .quote-items {
    overflow-y: auto;
  }

  .main-content {
    order: 1;
  }

  /* Oculta botão de alternância no móvel (barra empilha) */
  .sidebar-toggle-btn {
    display: none;
  }

  /* Sobrescritas de recolhimento desnecessárias - gerido via media query */

  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
  }

  .stats {
    flex-direction: column;
    gap: 16px;
  }

  .stat-item {
    width: 100%;
  }
}

.sidebar[data-collapsed="true"] .info-card-link .catalog-card-body {
  display: none !important;
}

/* Melhorias de Acessibilidade */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-contrast: high) {
  .card,
  .product-card {
    border: 2px solid var(--gray-700);
  }
}

@media print {
  body {
    background: white;
  }

  .sidebar,
  .btn {
    display: none;
  }

  .product-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid var(--gray-700);
  }
}

.results-info {
  font-family: var(--font-body);
  color: var(--blue-50);
  font-size: 0.95rem;
  margin-bottom: 0;
  text-align: left;
  font-weight: 500;
  white-space: nowrap;
}

.sort-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sort-control label {
  color: var(--blue-50);
  font-family: var(--font-body);
  font-weight: 500;
  margin: 0;
  white-space: nowrap;
}

.sort-control select {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.3);
  color: white;
  font-family: var(--font-body);
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.sort-control select:hover {
  background: rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.3);
}

.sort-control select option {
  background: var(--blue-900);
  color: white;
}

/* ==================== GRELHA DE CARTÕES DE CATEGORIA (HORIZONTAL) ==================== */
.category-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 4px 4px 16px 4px;
  margin-bottom: 24px;
}

.category-grid::-webkit-scrollbar {
  height: 8px;
}

.category-grid::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

.category-grid::-webkit-scrollbar-thumb {
  background: var(--orange-300);
  border-radius: 4px;
}

.category-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  text-align: left;
  position: relative;
  overflow: hidden;
  min-width: 160px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  color: var(--gray-700);
}

.category-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: var(--category-color, var(--orange-500));
  opacity: 1;
  transition: all 0.3s ease;
}

.category-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--category-color, var(--orange-500));
}

.category-card.active {
  background: var(--category-color, var(--orange-500));
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.category-card.active::before {
  background: rgba(255, 255, 255, 0.3);
  width: 100%;
  opacity: 0;
  /* Oculta a barra quando ativo, usa fundo completo */
}

.category-card.active .category-name {
  color: white;
}

.category-card.active .category-count {
  color: rgba(255, 255, 255, 0.8);
}

.category-icon {
  font-size: 1.4em;
  line-height: 1;
  flex-shrink: 0;
}

.category-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 1;
}

.category-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1.2;
  white-space: nowrap;
}

.category-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  opacity: 0.7;
  font-weight: 600;
}

/* Cores das Categorias */
.category-card[data-category*="Saneamento"] {
  --category-color: #3b82f6;
}

.category-card[data-category*="Climatização"] {
  --category-color: #dc2626;
}

.category-card[data-category*="Construção"] {
  --category-color: #ffc107;
}

/* ==================== CARTÕES DE CATEGORIA RAIZ (PROEMINENTE) ==================== */
/* Inspirado nas categorias da landing page - mais impacto visual */
.category-card.root-category {
  background: linear-gradient(
    135deg,
    var(--category-color, var(--blue-700)) 0%,
    color-mix(in srgb, var(--category-color, var(--blue-700)) 75%, black) 100%
  );
  border: none;
  border-radius: 20px;
  padding: 24px 28px;
  min-width: 200px;
  min-height: 120px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  color: white;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.15),
    0 4px 8px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.category-card.root-category::before {
  display: none;
  /* Oculta a barra esquerda */
}

.category-card.root-category::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 60%
  );
  pointer-events: none;
}

.category-card.root-category:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.2),
    0 8px 16px rgba(0, 0, 0, 0.15);
  border-color: transparent;
}

.category-card.root-category .category-icon {
  font-size: 2.5em;
  margin-bottom: 12px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  line-height: 1;
  background: rgba(255, 255, 255, 0.15);
  padding: 12px;
  border-radius: 12px;
  backdrop-filter: blur(4px);
}

.category-card.root-category .category-info {
  gap: 4px;
}

.category-card.root-category .category-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.category-card.root-category .category-count {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.85rem;
  font-weight: 600;
}

/* Faz grelha raiz quebrar linha em ecrãs menores */
.category-grid:has(.root-category) {
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  overflow-x: visible;
}

/* Botão Limpar Estatísticas da Categoria */

.category-clear-btn {
  background: linear-gradient(135deg, var(--gray-400) 0%, var(--gray-500) 100%);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.3s ease;
  margin-left: auto;
}

.category-clear-btn:hover {
  background: linear-gradient(135deg, var(--error) 0%, var(--error-dark) 100%);
  box-shadow: var(--shadow-md);
}

.category-badge-stats {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(
    135deg,
    var(--category-color, var(--blue-500)) 0%,
    color-mix(in srgb, var(--category-color, var(--blue-500)) 80%, black) 100%
  );
  color: white;
  padding: 8px 16px;
  border-radius: 24px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.3s ease;
}

.category-badge-stats:hover {
  box-shadow: var(--shadow-md);
  transform: scale(1.05);
}

/* ==================== CONTROLOS DE QUANTIDADE ==================== */
.quantity-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.qty-btn {
  width: 36px;
  height: 36px;
  border: 2px solid var(--gray-300);
  background: white;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--gray-700);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.qty-btn:hover:not(:disabled) {
  background: var(--orange-500);
  border-color: var(--orange-500);
  color: white;
  box-shadow: var(--shadow-sm);
  transform: scale(1.1);
}

.qty-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.qty-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background: var(--gray-100);
}

.qty-input {
  width: 60px;
  height: 36px;
  border: 2px solid var(--gray-300);
  border-radius: 10px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
  background: white;
  transition: all 0.3s ease;
}

.qty-input:focus {
  outline: none;
  border-color: var(--orange-500);
  box-shadow: 0 0 0 3px rgba(209, 124, 43, 0.12);
}

/* Quantidade na lista de orçamento */
.quote-item-qty-control {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  background: white;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  width: fit-content;
}

.quote-qty-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: var(--gray-200);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--gray-700);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quote-qty-btn:hover {
  background: var(--orange-500);
  color: white;
  transform: scale(1.1);
}

.quote-qty-btn:active {
  transform: scale(0.95);
}

.quote-qty-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--blue-700);
  min-width: 28px;
  text-align: center;
}

/* ==================== ESTILOS DE FORMULÁRIO ==================== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--gray-800);
  font-size: 0.95rem;
}

.form-group label .required {
  color: var(--error);
  margin-left: 3px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: white;
  transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--orange-500);
  box-shadow: 0 0 0 4px rgba(209, 124, 43, 0.12);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
  font-family: var(--font-body);
}

/* Sobrescrita do Cabeçalho Modal Base */
.modal-header h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--gray-800);
}

.modal-quote-list {
  background: var(--gray-50);
  border-radius: 12px;
  padding: 16px;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 20px;
}

.modal-quote-item {
  padding: 8px;
  background: white;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-quote-item:last-child {
  margin-bottom: 0;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.modal-actions .btn {
  flex: 1;
}

.success-message {
  background: linear-gradient(
    135deg,
    var(--success) 0%,
    var(--success-dark) 100%
  );
  color: white;
  padding: 20px;
  border-radius: 16px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  display: none;
  animation: fadeIn 0.3s ease;
}

.success-message.show {
  display: block;
}

/* ==================== LISTA DE ORÇAMENTO MELHORADA ==================== */
.quote-summary {
  background: var(--blue-50);
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--blue-700);
  flex-shrink: 0;
  flex-grow: 0;
  position: relative;
  z-index: 1;
}

.auto-save-indicator {
  display: none;
}

/* ==================== ATUALIZAÇÕES RESPONSIVAS ==================== */
@media (max-width: 640px) {
  .card-body {
    padding: 20px;
  }

  .btn {
    padding: 18px 24px;
    font-size: 1.1rem;
  }

  /* Ajustes do Container */
  .container {
    padding: 12px;
    gap: 24px;
    display: flex;
    flex-direction: column;
  }

  .sidebar {
    order: 1;
    max-height: none;
    width: 100%;
    margin-top: 24px;
  }

  .main-content {
    order: 2;
    width: 100%;
  }

  /* Grelha de categorias para móvel */
  .category-grid {
    max-height: none;
    gap: 10px;
    padding: 0 0 12px 0;
  }

  /* Cartões raiz - menores no móvel */
  .category-card.root-category {
    min-width: calc(100% - 8px);
    max-width: 100%;
    min-height: 100px;
    padding: 18px 20px;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
  }

  .category-card.root-category .category-icon {
    font-size: 2em;
    margin-bottom: 0;
    padding: 10px;
  }

  .category-card.root-category .category-info {
    flex: 1;
  }

  .category-card.root-category .category-name {
    font-size: 1rem;
  }

  .category-card.root-category .category-count {
    font-size: 0.8rem;
  }

  /* Cartões de categoria regulares no móvel */
  .category-card {
    padding: 10px 12px;
    min-width: auto;
    flex: 1 1 calc(50% - 6px);
  }

  .category-icon {
    font-size: 1.3em;
  }

  .category-name {
    font-size: 0.8rem;
    white-space: normal;
  }

  .category-count {
    font-size: 0.7rem;
  }

  /* Cartão da lista de orçamento */
  .card:has(.quote-items) {
    min-height: auto;
    max-height: none;
  }

  .card:has(.quote-items) .card-body {
    min-height: auto;
  }

  .quote-items {
    min-height: 100px;
    max-height: 200px;
  }

  .quote-item {
    min-height: 60px;
    padding: 10px;
  }

  /* Secção de Pesquisa */
  .search-section {
    margin-bottom: 16px;
  }

  .search-box {
    font-size: 0.95rem;
    padding: 14px 16px;
  }

  /* Informação de Resultados */
  .results-info {
    font-size: 0.8rem;
    margin-bottom: 12px;
  }

  /* Ajustes do Modal */
  .modal {
    border-radius: 20px 20px 0 0;
    margin-top: auto;
    max-height: 90vh;
  }

  .modal-body {
    padding: 20px;
  }

  .modal-header {
    padding: 18px 20px;
  }

  .modal-header h2 {
    font-size: 1.4rem;
  }

  /* Notificação Toast */
  .toast {
    bottom: 16px;
    right: 16px;
    left: 16px;
    padding: 12px 16px;
    font-size: 0.9rem;
  }

  /* Título da Categoria */
  .category-title {
    padding: 12px 16px;
    margin-bottom: 12px;
  }

  .category-title h2 {
    font-size: 1.1rem;
  }

  .breadcrumbs {
    font-size: 0.75rem;
  }

  /* Estado Vazio */
  .empty-state {
    padding: 60px 20px;
  }

  .empty-state-icon {
    font-size: 4em;
  }

  .empty-state h3 {
    font-size: 1.3rem;
  }

  .empty-state p {
    font-size: 0.95rem;
  }

  /* ==================== CARTÕES DE PRODUTO MÓVEL ==================== */
  /* Grelha de produtos - 2 colunas no móvel como solicitado */
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  /* Cartões de produto compactos para móvel */
  .product-card {
    padding: 8px;
    border-radius: 12px;
    gap: 8px;
  }

  .product-header {
    gap: 6px;
    margin-bottom: 4px;
  }

  /* Imagem de produto menor para móvel */
  .product-image-container {
    height: 120px;
    border-radius: 8px;
  }

  .product-icon-overlay {
    padding: 3px;
    font-size: 0.8em;
    border-radius: 4px;
    bottom: 4px;
    right: 4px;
  }

  /* Info de produto compacta */
  .product-name {
    font-size: 0.8rem;
    margin-bottom: 4px;
    line-height: 1.2;
    min-height: 2.4em; /* Garante altura uniforme para 2 linhas */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2; /* Propriedade padrão para compatibilidade */
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .product-category {
    padding: 2px 6px;
    font-size: 0.6rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  /* Detalhes mínimos - Empilhados para layout de 2 colunas */
  .product-details {
    padding: 6px;
    border-radius: 6px;
    width: 100%;
    box-sizing: border-box;
  }

  .product-detail {
    display: flex;
    flex-direction: column; /* Empilhado pois 2 colunas é estreito */
    align-items: flex-start;
    justify-content: flex-start;
    margin-bottom: 4px;
    gap: 2px;
    width: 100%;
  }

  .detail-label {
    font-size: 0.6rem;
    opacity: 0.8;
  }

  .detail-value {
    font-size: 0.7rem;
  }

  /* Controlos de quantidade compactos */
  .quantity-control {
    gap: 4px;
    margin-bottom: 8px;
  }

  .qty-btn {
    width: 26px;
    height: 26px;
    font-size: 0.85rem;
  }

  .qty-input {
    width: 36px;
    height: 26px;
    font-size: 0.8rem;
  }

  /* Botões de ação compactos */
  .product-actions-group {
    gap: 6px !important;
  }

  .add-to-quote-btn {
    padding: 8px 10px;
    font-size: 0.75rem;
    border-radius: 8px;
  }

  .product-actions-group .btn-secondary {
    padding: 6px 10px !important;
    font-size: 0.7rem !important;
  }
}

/* Estilos de Navegação */
.category-card.back-card {
  background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
  border: 2px dashed var(--gray-400);
}

.category-card.back-card:hover {
  background: linear-gradient(135deg, var(--gray-200) 0%, var(--gray-300) 100%);
  border-color: var(--gray-600);
  transform: translateY(-5px);
}

.category-card.back-card .category-icon {
  background: var(--gray-400);
  box-shadow: none;
}

.breadcrumbs {
  color: var(--blue-100);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin-top: 8px;
  padding: 4px 0;
  font-weight: 500;
}

/* Crachá de Produto Destaque */
.badge-destaque {
  display: inline-block;
  margin-left: 6px;
  font-size: 1rem;
  vertical-align: middle;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  animation: pulse-star 2s infinite;
}

@keyframes pulse-star {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.2);
  }

  100% {
    transform: scale(1);
  }
}

/* ==================== ESTILOS DA GAVETA DE ORÇAMENTO ==================== */
.quote-drawer {
  position: fixed;
  top: 0;
  right: -450px; /* Totalmente oculto */
  /* Oculto por defeito */
  width: min(380px, 100vw);
  height: 100vh;
  height: 100dvh;
  background: white;
  box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  transition: right 0.4s cubic-bezier(0.19, 1, 0.22, 1);
  display: flex;
  flex-direction: column;
}

.quote-drawer.open {
  right: 0;
}

/* ==================== ESTILOS MODAL (MELHORADO) ==================== */
.modal-header {
  background: var(--orange-500);
  padding: 16px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: white;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-header h2 i {
  color: white;
  font-size: 1.1em;
}

.modal-body {
  padding: 24px;
  background: var(--gray-50);
}

.modal-content {
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-body p {
  font-size: 0.9rem !important;
  color: var(--gray-600);
  margin-bottom: 16px !important;
  line-height: 1.5;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--gray-700);
  font-size: 0.85rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: white;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--orange-500);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1); /* Anel Orange-500 */
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.modal-actions {
  display: flex;
  justify-content: flex-end; /* Botões alinhados à direita */
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200);
}

.modal-actions .btn {
  flex: 0 0 auto;
  min-width: 120px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--gray-400);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--gray-600);
}

/* ==================== QUOTE DRAWER STYLES ==================== */
.quote-drawer-header {
  background: linear-gradient(
    135deg,
    var(--orange-500) 0%,
    var(--orange-700) 100%
  );
  padding: 20px;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.quote-drawer-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
}

.close-drawer-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.close-drawer-btn:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: rotate(90deg);
}

.quote-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: var(--gray-50);
  display: flex;
  flex-direction: column;
}

.quote-drawer-footer {
  padding: 20px;
  background: white;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
  z-index: 10;
}

.drawer-actions-secondary {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}

.btn-text {
  background: none;
  border: none;
  color: var(--gray-500);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 5px;
}

.btn-text:hover {
  color: var(--blue-600);
}

/* Itens de Orçamento dentro da Gaveta */
.quote-drawer .quote-items {
  padding-right: 0; /* Remove preenchimento da barra lateral */
  margin-bottom: 20px;
  flex: 1;
  max-height: none !important; /* Sobrescreve restrições de layout */
  min-height: 0;
  overflow-y: auto; /* Garante rolagem própria se necessário */
}

/* ==================== ALTERNADOR DE MARCADOR ==================== */
.quote-toggle-bookmark {
  position: fixed;
  top: 18px;
  right: 0;
  background: linear-gradient(
    135deg,
    var(--orange-500) 0%,
    var(--orange-700) 100%
  );
  color: white;
  padding: 12px 20px 12px 24px;
  border-radius: 50px 0 0 50px;
  box-shadow: -4px 4px 15px rgba(219, 111, 39, 0.4);
  cursor: pointer;
  z-index: 990;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: right center;
  font-family: var(--font-display);
  font-weight: 700;
}

.quote-toggle-bookmark:hover {
  padding-right: 25px;
  transform: scale(1.05);
  box-shadow: -6px 6px 20px rgba(219, 111, 39, 0.6);
}

.quote-toggle-bookmark:active {
  transform: scale(0.95);
}

.bookmark-icon {
  font-size: 1.5rem;
}

.bookmark-count {
  background: white;
  color: #db2777;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 800;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

@keyframes shimmy {
  0% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-5px);
  }

  50% {
    transform: translateX(0);
  }

  75% {
    transform: translateX(-5px);
  }

  100% {
    transform: translateX(0);
  }
}

.quote-toggle-bookmark.pulse {
  animation: shimmy 0.5s ease-in-out;
}

/* ==================== CARTÃO DE INFORMAÇÃO PREMIUM ==================== */
.info-card-premium {
  background: linear-gradient(
    135deg,
    var(--orange-500) 0%,
    var(--orange-600) 100%
  );
  border-radius: 16px;
  padding: 24px;
  color: white;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(234, 88, 12, 0.2);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: none;
  background-size: 200% 200%;
  animation: gradientShift 8s ease infinite;
  margin-top: 20px;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.info-card-premium:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 16px 32px rgba(234, 88, 12, 0.3);
}

.info-card-bg-decoration {
  position: absolute;
  top: -20px;
  right: -20px;
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  pointer-events: none;
}

.info-card-bg-decoration::after {
  content: "";
  position: absolute;
  bottom: -40px;
  left: -40px;
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.info-card-content {
  position: relative;
  z-index: 1;
}

.info-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.info-icon {
  font-size: 1.4rem;
  background: rgba(255, 255, 255, 0.2);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  backdrop-filter: blur(4px);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

.info-card-premium h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  margin: 0;
  line-height: 1.2;
  color: white;
}

.info-card-premium p {
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 16px;
  opacity: 0.95;
  font-weight: 500;
}

.btn-link-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  background: white;
  color: var(--orange-600);
  padding: 8px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.info-card-premium:hover .btn-link-action {
  background: white;
  color: var(--orange-700);
  gap: 12px; /* Leve animação de expansão na seta */
}

/* ==================== CORREÇÃO BARRA LATERAL RECOLHIDA PARA CARTÃO PREMIUM ==================== */
@media (min-width: 969px) {
  /* Container do Cartão - Formato Circular */
  .sidebar[data-collapsed="true"] .info-card-premium {
    padding: 0 !important;
    width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    border-radius: 50% !important;
    background: linear-gradient(
      135deg,
      var(--orange-500),
      var(--orange-600)
    ) !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(234, 88, 12, 0.3) !important;
    overflow: visible !important;
    margin: 0 auto;
    position: relative;
  }

  /* Oculta maioria dos internos */
  .sidebar[data-collapsed="true"] .info-card-premium .info-card-bg-decoration,
  .sidebar[data-collapsed="true"] .info-card-premium h3,
  .sidebar[data-collapsed="true"] .info-card-premium p,
  .sidebar[data-collapsed="true"] .info-card-premium .btn-link-action {
    display: none !important;
  }

  /* Garante que wrapper de conteúdo gere layout */
  .sidebar[data-collapsed="true"] .info-card-premium .info-card-content {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Garante que wrapper do cabeçalho não bloqueia */
  .sidebar[data-collapsed="true"] .info-card-premium .info-card-header {
    margin: 0 !important;
    padding: 0 !important;
    width: 100%;
    height: 100%;
    display: flex !important;
    align-items: center;
    justify-content: center;
  }

  /* Mostra o ÍCONE corretamente - Corrige Resolução */
  .sidebar[data-collapsed="true"] .info-card-premium .info-icon {
    display: flex !important;
    font-size: 1.4rem;
    width: 100%;
    height: 100%;
    background: transparent !important;
    box-shadow: none !important;
    color: white !important;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    backdrop-filter: none !important; /* CORREÇÃO CRÍTICA */
    border: none !important;
    border-radius: 0 !important; /* Deixa pai gerir formato */
  }

  /* Tooltip Limpo no Hover */
  .sidebar[data-collapsed="true"] .info-card-premium:hover::after {
    content: "Solicitar Produto";
    position: absolute;
    left: 60px;
    top: 50%;
    transform: translateY(-50%);
    background: #1f2937;
    color: white;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    display: block;
  }
}

/* ==================== LAYOUT DE CATEGORIA EMPILHADO ==================== */
.category-grid.stacked {
  grid-template-columns: 1fr;
  /* Itens de largura total */
  gap: 16px;
}

.category-grid.stacked .category-card {
  flex-direction: row;
  align-items: center;
  padding: 24px 32px;
  min-height: 120px;
  text-align: left;
  justify-content: flex-start;
  border-left: 6px solid var(--category-color);
}

.category-grid.stacked .category-icon {
  font-size: 3.5rem;
  /* Ícone maior */
  margin-bottom: 0;
  margin-right: 24px;
  background: rgba(0, 0, 0, 0.03);
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.category-grid.stacked .category-info {
  flex: 1;
  align-items: flex-start;
}

.category-grid.stacked .category-name {
  font-size: 1.5rem;
  /* Título maior */
  margin-bottom: 6px;
}

.category-grid.stacked .category-count {
  font-size: 1rem;
}

/* ==================== POSICIONAMENTO DO WIDGET ==================== */
/* Sobrescrevendo Padrão do Widget Angel */
.angel-widget-container {
  left: 20px !important;
  right: auto !important;
  bottom: 20px !important;
}

/* Gaveta Responsiva */
@media (max-width: 480px) {
  .quote-drawer {
    width: 100%;
    right: -100%;
  }
}

/* ==================== NAVEGAÇÃO DRILL-DOWN LIMPA ==================== */

/* Grelha drill-down - categorias como cartões em grelha */
.drill-down-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

/* Cartões de categoria em modo drill-down */
.drill-down-grid .category-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: linear-gradient(
    135deg,
    var(--category-color) 0%,
    color-mix(in srgb, var(--category-color) 80%, black) 100%
  );
  border-radius: 16px;
  color: white;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.drill-down-grid .category-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

.drill-down-grid .category-card .category-icon {
  font-size: 2.5rem;
  flex-shrink: 0;
}

.drill-down-grid .category-card .category-info {
  flex: 1;
}

.drill-down-grid .category-card .category-name {
  font-size: 1.2rem;
  font-weight: 700;
  font-family: var(--font-display);
  margin-bottom: 4px;
}

.drill-down-grid .category-card .category-count {
  font-size: 0.9rem;
  opacity: 0.85;
}

/* Indicador Chevron */
.category-chevron {
  font-size: 1.8rem;
  opacity: 0.7;
  font-weight: 300;
  transition: transform 0.3s ease;
}

.drill-down-grid .category-card:hover .category-chevron {
  transform: translateX(4px);
  opacity: 1;
}

/* Cartões de subcategoria (estilo mais leve) */
.drill-down-grid .category-card.sub-category {
  background: white;
  color: var(--gray-800);
  border: 2px solid var(--category-color);
  border-left: 5px solid var(--category-color);
}

.drill-down-grid .category-card.sub-category .category-icon {
  background: linear-gradient(
    135deg,
    var(--category-color),
    color-mix(in srgb, var(--category-color) 70%, black)
  );
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.drill-down-grid .category-card.sub-category .category-count {
  color: var(--gray-500);
}

.drill-down-grid .category-card.sub-category .category-chevron {
  color: var(--category-color);
}

/* ==================== NAVEGAÇÃO BREADCRUMB ==================== */
/* Breadcrumbs minimalistas e transparentes */
.breadcrumb-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 8px;
  margin-bottom: 16px; /* Reduced from 24px */
  font-size: 0.85rem;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  border: none;
}

.breadcrumb-separator {
  color: #a6b6df;
}

.breadcrumb-item {
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.breadcrumb-item:hover:not(.current) {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.breadcrumb-item.current {
  color: white;
  font-weight: 600;
  cursor: default;
  background: rgba(255, 255, 255, 0.15);
  padding: 4px 12px;
  border-radius: 20px; /* Formato de pílula para item ativo */
}

/* Forçador de Espaço para Container de Título */
#categoryTitleContainer {
  display: block;
  width: 100%;
  position: relative;
  margin-bottom: 24px;
  clear: both;
  min-height: 10px; /* Força cálculo de altura */
}

/* Grelha de categoria precisa limpar o título também */
#categoryGrid.hybrid-layout {
  clear: both;
  width: 100%;
  position: relative;
}

/* Grelha de produtos precisa limpar tudo acima */
.products-grid {
  clear: both;
  width: 100%;
}

/* Título de categoria no nível folha - Barra Compacta */
.category-title {
  background: linear-gradient(
    135deg,
    var(--category-color) 0%,
    color-mix(in srgb, var(--category-color) 60%, black) 100%
  );
  padding: 12px 20px; /* preenchimento drasticamente reduzido */
  border-radius: 12px; /* raio mais apertado */
  margin-bottom: 20px;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap; /* Permitir quebra em tela pequena */
  gap: 12px;
  min-height: 72px; /* Base de altura pequena fixa */
}

/* Adiciona sobreposição de textura/ruído subtil */
.category-title::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.08'/%3E%3C/svg%3E");
  opacity: 0.4;
  pointer-events: none;
  mix-blend-mode: overlay;
  z-index: 0;
}

/* Círculo Decorativo */
.category-title::after {
  content: "";
  position: absolute;
  top: -50%;
  right: -5%;
  width: 150px;
  height: 150px;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.15) 0%,
    transparent 70%
  );
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

.category-title h2 {
  font-size: 1.25rem; /* Redução significativa */
  margin: 0;
  color: white;
  font-family: var(--font-display);
  font-weight: 700; /* Menos pesado */
  display: flex;
  align-items: center;
  gap: 12px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  z-index: 1;
  line-height: 1.2;
}

.category-title .category-title-icon {
  background: rgba(255, 255, 255, 0.2);
  width: 40px; /* Ícone pequeno */
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 1.2rem; /* Tamanho emoji */
  backdrop-filter: blur(4px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.category-title:hover .category-title-icon {
  transform: scale(1.05) rotate(-3deg);
}

.category-title .title-actions {
  display: flex;
  flex-direction: row; /* Layout horizontal */
  align-items: center;
  gap: 12px;
  z-index: 1;
  position: relative;
}

.category-subtitle {
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.85rem;
  font-weight: 500;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px 12px;
  border-radius: 6px;
  border: none;
  white-space: nowrap;
}

.category-title .btn-sub-back {
  background: white;
  color: var(--category-color);
  padding: 6px 12px; /* Botão pequeno */
  font-weight: 600;
  border-radius: 8px;
  font-size: 0.85rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  text-transform: none; /* remover CAIXA ALTA */
  letter-spacing: 0;
  height: 32px;
}

.category-title .btn-sub-back:hover {
  background: white;
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
  .category-title {
    flex-direction: column;
    align-items: center; /* Alinhamento central no móvel */
    text-align: center;
    padding: 32px 20px;
    gap: 20px;
    min-height: auto;
  }

  .category-title .title-actions {
    width: 100%;
    align-items: center; /* Centralizar ações */
    flex-direction: column-reverse; /* Colocar título no topo se necessário... */
    gap: 16px;
  }

  .category-title h2 {
    font-size: 2rem;
    flex-direction: column; /* Empilhar ícone e título no móvel */
    gap: 16px;
    justify-content: center;
  }

  .category-title .category-title-icon {
    width: 60px;
    height: 60px;
    font-size: 0.8em;
    margin-bottom: 4px;
  }
}

/* Estado de categoria vazia */
.category-card.category-empty {
  opacity: 0.6;
  background: linear-gradient(
    135deg,
    var(--gray-400) 0%,
    var(--gray-500) 100%
  ) !important;
}

.category-card.category-empty:hover {
  transform: none !important;
  box-shadow: none !important;
}

/* ==================== LAYOUT HÍBRIDO ==================== */

.hybrid-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Grelha Nível 1 - sempre visível no topo */
.level1-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.level1-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 20px;
  background: linear-gradient(
    135deg,
    var(--category-color) 0%,
    color-mix(in srgb, var(--category-color) 70%, black) 100%
  );
  border-radius: 16px;
  color: white;
  transition: all 0.3s ease;
  position: relative;
  min-height: 260px;
}

.level1-card .category-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.2);
  width: 60px;
  height: 60px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.level1-card .category-name {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.level1-card .category-count {
  font-size: 0.85rem;
  opacity: 0.85;
}

.level1-card .category-chevron {
  position: absolute;
  bottom: 12px;
  font-size: 1.5rem;
  opacity: 0.5;
  transition: all 0.3s ease;
}

.level1-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.25);
}

.level1-card:hover .category-chevron {
  opacity: 1;
  transform: translateY(4px);
}

.level1-card.selected {
  box-shadow:
    0 0 0 4px white,
    0 16px 32px rgba(0, 0, 0, 0.25);
  transform: scale(1.02);
}

.level1-card.selected .category-chevron {
  opacity: 1;
  transform: rotate(90deg);
}

/* Secção de Subcategorias - aparece abaixo quando N1 é selecionado */
.subcategories-section {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.subcategories-header {
  color: var(--gray-300);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);

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

.btn-sub-back {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: var(--font-body);
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-sub-back:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateX(-2px);
}

.subcategories-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.subcategory-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: white;
  border-radius: 12px;
  border-left: 4px solid var(--category-color);
  color: var(--gray-800);
  transition: all 0.2s ease;
}

.subcategory-card .category-icon {
  font-size: 1.5rem;
  background: linear-gradient(
    135deg,
    var(--category-color),
    color-mix(in srgb, var(--category-color) 70%, black)
  );
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.subcategory-card .category-info {
  flex: 1;
}

.subcategory-card .category-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
}

.subcategory-card .category-count {
  font-size: 0.85rem;
  color: var(--gray-500);
}

.subcategory-card .category-chevron {
  color: var(--category-color);
  font-size: 1.3rem;
  opacity: 0.5;
  transition: all 0.2s ease;
}

.subcategory-card:hover {
  transform: translateX(8px);
  box-shadow: var(--shadow-md);
}

.subcategory-card:hover .category-chevron {
  opacity: 1;
  transform: translateX(4px);
}

/* Placeholder quando sem seleção */
.subcategories-placeholder {
  text-align: center;
  padding: 60px 24px;
  color: var(--gray-500);
}

.subcategories-placeholder .placeholder-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.subcategories-placeholder .placeholder-text {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--gray-400);
  margin-bottom: 8px;
}

.subcategories-placeholder .placeholder-hint {
  font-size: 0.95rem;
  color: var(--gray-500);
}

/* Ajustes responsivos */
@media (max-width: 768px) {
  .level1-grid {
    grid-template-columns: 1fr;
  }

  .level1-card {
    flex-direction: row;
    text-align: left;
    min-height: auto;
    padding: 16px 20px;
  }

  .level1-card .category-icon {
    margin-bottom: 0;
    margin-right: 16px;
  }

  /* Subcategorias Móvel */
  .subcategories-list {
    gap: 10px;
  }

  .subcategory-card {
    padding: 12px;
    flex-direction: column;
    /* Empilhar verticalmente para espaço */
    align-items: center;
    text-align: center;
    gap: 8px;
  }

  .subcategory-card .category-icon {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
  }

  .subcategory-card .category-name {
    font-size: 0.85rem;
    word-break: break-word;
    /* Garante que palavras longas quebrem */
  }

  .subcategory-card .category-count {
    font-size: 0.7rem;
  }

  /* Ajuste de botão voltar móvel */
  .subcategories-header {
    flex-direction: row;
    /* Manter linha */
    align-items: center;
    gap: 10px;
  }

  .subcategories-header span {
    font-size: 0.8rem;
    /* Título menor */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
  }

  .btn-sub-back {
    padding: 4px 8px;
    font-size: 0.75rem;
  }
}

/* ==================== CARTÕES DE CATEGORIA COM IMAGENS ==================== */
/* Pedido do Utilizador: Gradiente Topo para Fundo, Forte para Fraco, Imagem de Fundo Visível */

.level1-card {
  background-size: cover !important;
  background-position: center bottom !important;
  background-blend-mode: normal !important;
}

/* 1. Construção */
.level1-card[data-category*="Constru"] {
  background:
    linear-gradient(
      to bottom,
      color-mix(in srgb, var(--category-color) 90%, transparent) 0%,
      color-mix(in srgb, var(--category-color) 40%, transparent) 100%
    ),
    url("../../images/categories/construcao-minimal.webp") !important;
  background-size: cover !important;
  background-position: center center !important;
}

/* 2. Bricolage */
.level1-card[data-category*="Bricolage"] {
  background:
    linear-gradient(
      to bottom,
      color-mix(in srgb, var(--category-color) 90%, transparent) 0%,
      color-mix(in srgb, var(--category-color) 40%, transparent) 100%
    ),
    url("../../images/categories/bricolage-minimal.webp") !important;
  background-size: cover !important;
  background-position: center center !important;
}

/* 3. Climatização */
.level1-card[data-category*="Climatiza"] {
  background:
    linear-gradient(
      to bottom,
      color-mix(in srgb, var(--category-color) 90%, transparent) 0%,
      color-mix(in srgb, var(--category-color) 40%, transparent) 100%
    ),
    url("../../images/categories/climatiza%C3%A7%C3%A3o-minimal.webp") !important;
  background-size: cover !important;
  background-position: center center !important;
}

.level1-card[data-category]:hover {
  background-size: 105% auto !important;
  background-position: center bottom !important;
}

/* ==================== BOTÃO VOLTAR AO TOPO ==================== */
.scroll-to-top {
  position: fixed;
  bottom: 32px;
  left: 50%; /* Centralizado horizontalmente */
  transform: translateX(-50%); /* Ajuste para centralizar perfeitamente */
  width: 56px;
  height: 56px;
  background: linear-gradient(
    135deg,
    var(--orange-500) 0%,
    var(--orange-700) 100%
  );
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: none; /* Hidden by default */
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 12px rgba(209, 124, 43, 0.4),
    0 8px 24px rgba(33, 53, 119, 0.15);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999;
  opacity: 0;
  transform: translateX(-50%) translateY(20px) scale(0.9);
}

.scroll-to-top.show {
  display: flex;
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
  animation: bounceIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(40px) scale(0.3);
  }
  50% {
    transform: translateX(-50%) translateY(-10px) scale(1.1);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

.scroll-to-top:hover {
  transform: translateX(-50%) translateY(-8px) scale(1.1);
  box-shadow:
    0 8px 20px rgba(209, 124, 43, 0.5),
    0 12px 32px rgba(33, 53, 119, 0.2);
}

.scroll-to-top:active {
  transform: translateX(-50%) translateY(-4px) scale(1.05);
}

.scroll-to-top svg {
  width: 24px;
  height: 24px;
  animation: arrowBounce 2s ease-in-out infinite;
}

@keyframes arrowBounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

.scroll-to-top:hover svg {
  animation: arrowBounceHover 0.6s ease-in-out infinite;
}

@keyframes arrowBounceHover {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .scroll-to-top {
    bottom: 24px;
    /* Mantém centralização */
    width: 50px;
    height: 50px;
  }

  .scroll-to-top svg {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 480px) {
  .scroll-to-top {
    bottom: 20px;
    /* Mantém centralização */
    width: 48px;
    height: 48px;
  }
}
