/* ProductPanel.css */

/* ── Container — abre EXATAMENTE abaixo da navbar ────────────────────
   top usa --navbar-total-height atualizado por dynamic-positioning.js.
   ─────────────────────────────────────────────────────────────────── */
.panelContainer {
  --panel-side-gap: var(--nav-dropdown-gutter, clamp(12px, 2vw, 36px));
  position: fixed;
  top: var(--navbar-total-height, 160px);
  /* Centralizado e capado no mesmo max do conteúdo (1400px) — sem isso
     o fundo branco do container vazava até as bordas da tela em monitores
     largos, deixando "espaço em branco" ao lado do conteúdo. */
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: calc(100vw - (var(--panel-side-gap) * 2));
  max-width: 1400px;
  box-sizing: border-box;
  background: #ffffff;
  border-top: 3px solid #BB0606;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.14);
  z-index: 1900;
  display: none;
  flex-direction: column;
  max-height: calc(100vh - var(--navbar-total-height, 160px) - var(--panel-side-gap));
  overflow: hidden;
}

.panelContainer.show {
  display: flex;
}

/* Conteúdo interno centrado */
.panelContent {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  overflow: hidden;
}

/* ── Header (título + fechar) ── */
.panelHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid #f0f0f0;
  background: #fff;
  flex-shrink: 0;
}

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

.panelHeaderTitle i {
  color: #BB0606;
  font-size: 16px;
}

.panelHeaderTitle h2 {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0;
  letter-spacing: -0.2px;
}

/* ── Botão fechar ── */
.closeSection {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  background: #fff;
  border: 1.5px solid #e5e5e5;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
}

.closeSection:hover {
  background: #fef2f2;
  color: #BB0606;
  border-color: #BB0606;
}

/* ── Body scrollável ── */
.panelBody {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.panelBody::-webkit-scrollbar { width: 6px; }
.panelBody::-webkit-scrollbar-thumb {
  background: #e5e5e5;
  border-radius: 4px;
}
.panelBody::-webkit-scrollbar-thumb:hover { background: #c8c8c8; }

/* ── Grid de subcategorias ── */
.categoriesContainer {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px 28px;
  padding: 22px 28px 28px;
  align-content: flex-start;
}

.subcategorySection {
  padding: 0;
  margin: 0;
}

.subcategoryTitle {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: #BB0606;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #BB0606;
  display: block;
}

/* ── Item de categoria ── */
.productItemLink {
  text-decoration: none;
  color: inherit;
  display: block;
}

.productItem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  transition: background 0.18s ease, transform 0.18s ease;
  cursor: pointer;
  margin-bottom: 2px;
}

.productItem:hover {
  background: #fef2f2;
  transform: translateX(4px);
}

.productImage {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: #f5f5f5;
  transition: transform 0.2s ease;
}

.productItem:hover .productImage {
  transform: scale(1.04);
}

.productItem span {
  font-size: 13px;
  font-weight: 500;
  color: #222;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.15s;
}

.productItem:hover span { color: #BB0606; }

/* ── Loading ── */
.loadingContainer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 60px 24px;
}

.loadingIcon { width: 36px; height: 36px; }

/* ── Erro ── */
.errorContainer {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px 24px;
  color: #BB0606;
  gap: 10px;
  font-size: 14px;
}

.errorContainer i { font-size: 32px; opacity: 0.7; }

.retryButton {
  padding: 10px 24px;
  background: #BB0606;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.2s ease;
  margin-top: 6px;
}

.retryButton:hover { background: #9a0505; }

/* ── Responsividade ── */
@media (max-width: 1024px) {
  .categoriesContainer {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 6px 20px;
  }
}

@media (max-width: 768px) {
  .panelHeader { padding: 14px 16px; }
  .panelHeaderTitle h2 { font-size: 15px; }
  .panelHeaderTitle i { font-size: 14px; }
  .categoriesContainer {
    padding: 16px;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 4px 14px;
  }
  .subcategoryTitle { font-size: 10px; }
  .productItem span { font-size: 12px; }
  .productImage { width: 36px; height: 36px; border-radius: 6px; }
}

@media (max-width: 480px) {
  .categoriesContainer {
    grid-template-columns: 1fr;
  }
  .closeSection span { display: none; }
  .closeSection { padding: 8px 10px; }
}
