/* estoque-hist-drawer.css — Drawer de histórico por SKU */
/* Prefixo: ehd- */

/* === OVERLAY === */
.ehd-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 900;
  background: transparent;
}
.ehd-overlay.ehd-aberto {
  display: block;
}

/* === DRAWER === */
.ehd-drawer {
  position: fixed;
  top: 30px;
  right: -420px;
  width: 420px;
  height: calc(100vh - 30px);
  background: #003399;
  border-left: 1px solid #1a56db;
  z-index: 901;
  display: flex;
  flex-direction: column;
  font-family: inherit;
  transition: right 0.22s ease;
}
.ehd-drawer.ehd-aberto {
  right: 0;
}

/* === HEADER === */
.ehd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
  gap: 8px;
}
.ehd-header-direita {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.ehd-header-foto {
  display: none;
  background: transparent;
  border: none;
  padding: 0;
}
.ehd-header-foto-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 4px;
  border: none;
  background: transparent;
  cursor: zoom-in;
  display: block;
}
.ehd-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ehd-sku {
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
  letter-spacing: 0.3px;
}
.ehd-modelo-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ehd-modelo {
  font-size: 11px;
  font-weight: 400;
  color: rgba(255,255,255,0.55);
}
.ehd-badge-estoque {
  display: inline-block;
  background: #1d4ed8;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.3px;
}
.ehd-filtros-row-nowrap {
  flex-wrap: nowrap;
}
.ehd-btn-fechar {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  color: #93c5fd;
  font-size: 16px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ehd-btn-fechar:hover {
  background: rgba(255,255,255,0.1);
  color: #e2e8f0;
}

/* === ZONA SUPERIOR FIXA (gráfico) === */
.ehd-zona-grafico {
  flex-shrink: 0;
  padding: 12px 16px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.ehd-grafico-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #93c5fd;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.ehd-grafico-wrap {
  width: 100%;
  overflow-x: auto;
}
.ehd-grafico-wrap svg {
  display: block;
}
.ehd-legenda {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}
.ehd-legenda-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: rgba(255,255,255,0.65);
}
.ehd-legenda-cor {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* === ZONA INFERIOR SCROLL (tabela) === */
.ehd-zona-tabela {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}
.ehd-tabela-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #93c5fd;
  letter-spacing: 0.5px;
  padding: 10px 16px 6px;
}
.ehd-tabela {
  width: 100%;
  border-collapse: collapse;
}
.ehd-tabela th {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #93c5fd;
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid rgba(255,255,255,0.15);
  padding: 6px 10px;
  text-align: center;
  white-space: nowrap;
}
.ehd-tabela th:first-child {
  text-align: left;
}
.ehd-tabela td {
  font-size: 11px;
  color: #cbd5e1;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  border-right: 1px solid rgba(255,255,255,0.05);
  padding: 5px 10px;
  text-align: center;
}
.ehd-tabela td:first-child {
  text-align: left;
  color: #94a3b8;
}
.ehd-tabela td:last-child {
  border-right: none;
}
.ehd-tabela tr:nth-child(odd) td {
  background: rgba(255,255,255,0.04);
}
.ehd-tabela tr:hover td {
  background: rgba(255,255,255,0.1);
}
.ehd-tipo-venda    { color: #4ade80; font-weight: 600; }
.ehd-tipo-entrada  { color: #60a5fa; font-weight: 600; }
.ehd-tipo-devolucao { color: #f87171; font-weight: 600; }

.ehd-vazio {
  padding: 24px 16px;
  text-align: center;
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}

/* === FILTROS === */
.ehd-filtros {
  padding: 8px 16px 6px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.ehd-filtros-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.ehd-filtros-row.ehd-filtros-row-nowrap {
  flex-wrap: nowrap;
}
.ehd-filtros-sep {
  width: 1px;
  height: 16px;
  background: rgba(255,255,255,0.15);
  margin: 0 2px;
}
/* pill de período */
.ehd-periodo-wrap {
  position: relative;
}
.ehd-btn-periodo-pill {
  display: inline-flex;
  align-items: center;
  background: #1a56db;
  border: 1px solid #3b82f6;
  border-radius: 4px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.ehd-btn-periodo-pill:hover {
  background: #1d4ed8;
}
/* dropdown */
.ehd-periodo-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #0a2a6e;
  border: 1px solid #1a56db;
  border-radius: 6px;
  min-width: 190px;
  z-index: 999;
  padding: 4px 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.ehd-periodo-dropdown.ehd-dd-aberto {
  display: block;
}
.ehd-dd-opcao {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 500;
  padding: 7px 14px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.ehd-dd-opcao:hover {
  background: rgba(255,255,255,0.08);
  color: #ffffff;
}
/* intervalo dentro do dropdown */
.ehd-dd-intervalo {
  display: none;
  padding: 6px 14px 8px;
  border-top: 1px solid rgba(255,255,255,0.1);
  gap: 6px;
  flex-direction: column;
}
.ehd-dd-intervalo.ehd-dd-intervalo-ativo {
  display: flex;
}
.ehd-label-data {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.ehd-input-data {
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  color: #e2e8f0;
  font-size: 11px;
  padding: 2px 6px;
  font-family: inherit;
}
.ehd-input-data::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}
.ehd-btn-limpar-data {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.35);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  align-self: flex-start;
}
.ehd-btn-limpar-data:hover {
  color: #f87171;
}
/* pills de tipo */
.ehd-btn-filtro {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  color: rgba(255,255,255,0.55);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  cursor: pointer;
  font-family: inherit;
}
.ehd-btn-filtro:hover {
  background: rgba(255,255,255,0.14);
  color: #e2e8f0;
}
.ehd-btn-filtro.ehd-ativo {
  background: #1a56db;
  border-color: #3b82f6;
  color: #ffffff;
}

/* separador no dropdown */
.ehd-dd-sep {
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 4px 0;
}
/* navegador de mês */
.ehd-dd-mes-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  gap: 6px;
}
.ehd-dd-mes-seta {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  color: #e2e8f0;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
}
.ehd-dd-mes-seta:hover {
  background: rgba(255,255,255,0.15);
}
.ehd-dd-mes-label {
  background: transparent;
  border: none;
  font-size: 12px;
  font-weight: 700;
  color: #e2e8f0;
  min-width: 70px;
  text-align: center;
  cursor: pointer;
  font-family: inherit;
  padding: 2px 4px;
  border-radius: 4px;
}
.ehd-dd-mes-label:hover {
  background: rgba(255,255,255,0.1);
}
.ehd-dd-grade-header {
  padding: 6px 10px 4px;
  text-align: center;
}
.ehd-dd-grade-ano {
  background: transparent;
  border: none;
  color: #60a5fa;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  padding: 2px 6px;
  border-radius: 4px;
}
.ehd-dd-grade-ano:hover {
  background: rgba(255,255,255,0.1);
}
.ehd-dd-grade-titulo {
  font-size: 11px;
  font-weight: 600;
  color: #93c5fd;
}
.ehd-dd-grade-meses {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 4px 8px 8px;
}
.ehd-dd-grade-anos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 4px 8px 8px;
}
.ehd-dd-grade-item {
  background: transparent;
  border: none;
  border-radius: 4px;
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 500;
  padding: 5px 4px;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
}
.ehd-dd-grade-item:hover {
  background: rgba(255,255,255,0.1);
  color: #ffffff;
}
.ehd-dd-grade-item.ehd-dd-grade-ativo {
  background: #1a56db;
  color: #ffffff;
  font-weight: 700;
}

/* dropdown de tipo */
.ehd-tipo-wrap {
  position: relative;
}
.ehd-btn-tipo-pill {
  display: inline-flex;
  align-items: center;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  color: rgba(255,255,255,0.55);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  cursor: pointer;
  font-family: inherit;
}
.ehd-btn-tipo-pill:hover {
  background: rgba(255,255,255,0.14);
  color: #e2e8f0;
}
.ehd-tipo-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #0a2a6e;
  border: 1px solid #1a56db;
  border-radius: 6px;
  min-width: 170px;
  z-index: 999;
  padding: 4px 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.ehd-tipo-dropdown.ehd-dd-aberto {
  display: block;
}

/* === TOTAIS RODAPÉ === */
.ehd-totais-rodape {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px 14px;
  border-top: 1px solid rgba(255,255,255,0.1);
  justify-content: center;
}
.ehd-tot-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0,0,0,0.2);
  border-radius: 6px;
  padding: 6px 14px;
  min-width: 70px;
}
.ehd-tot-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 2px;
}
.ehd-tot-val {
  font-size: 18px;
  font-weight: 700;
}
.ehd-tot-venda    .ehd-tot-val { color: #4ade80; }
.ehd-tot-compra   .ehd-tot-val { color: #60a5fa; }
.ehd-tot-entrada  .ehd-tot-val { color: #93c5fd; }
.ehd-tot-devolucao .ehd-tot-val { color: #f87171; }

/* === BOTÃO POR LINHA === */
.ehd-btn-hist {
  background: transparent;
  border: none;
  border-radius: 4px;
  color: #475569;
  font-size: 12px;
  width: 22px;
  height: 22px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}
.ehd-btn-hist.ehd-tem-hist {
  border-color: #334155;
  color: #475569;
}
.ehd-btn-hist:hover {
  color: #1d4ed8;
  background: rgba(29,78,216,0.08);
  border-radius: 4px;
}
