/* ============================================================================
   SISTEMA DE VENDAS - Vitrola Administrativo
   CSS Mobile-First
   ============================================================================ */

/* ===== CONTAINER PRINCIPAL ===== */
.vendas-container {
  max-width: 800px;
  margin: 0 auto;
}

/* ===== MENSAGEM SEM PERMISSÃO ===== */
.vendas-sem-permissao {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-left: 4px solid #ffc107;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  color: #856404;
}

.vendas-sem-permissao p {
  margin: 8px 0;
}

/* ===== FILTROS ===== */
.vendas-filtros {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.vendas-filtros h4 {
  margin: 0 0 16px 0;
  color: #333;
  font-size: 1.1em;
  font-family: 'Rubik', sans-serif;
  padding-bottom: 12px;
  border-bottom: 2px solid #c21a26;
}

/* ===== ATALHOS DE PERÍODO ===== */
.vendas-atalhos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.vendas-atalho-btn {
  flex: 1 1 calc(50% - 4px);
  min-width: 100px;
  padding: 10px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: #fff;
  color: #666;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Rubik', sans-serif;
}

.vendas-atalho-btn:hover {
  border-color: #c21a26;
  color: #c21a26;
  background: #fff5f5;
}

.vendas-atalho-btn.active {
  border-color: #c21a26;
  background: #c21a26;
  color: #fff;
}

/* ===== DATAS PERSONALIZADAS ===== */
.vendas-datas {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
}

.vendas-data-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vendas-data-group label {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.vendas-data-group input[type="date"] {
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.2s;
}

.vendas-data-group input[type="date"]:focus {
  outline: none;
  border-color: #c21a26;
}

/* ===== FILTROS OPCIONAIS ===== */
.vendas-filtros-opcionais {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.vendas-filtro-item {
  position: relative;
  min-width: 0;
}

.vendas-filtro-item label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}

/* Inputs compartilhados (pesquisaCliente/pesquisaProduto): manter mesmos estilos, exceto borda */
.vendas-container #cliente-input,
.vendas-container #produto-input,
.vendas-container #vendedor-input {
  border: 2px solid #e0e0e0;
}

.vendas-container #cliente-input:focus,
.vendas-container #produto-input:focus,
.vendas-container #vendedor-input:focus {
  border-color: #c21a26;
}

/* ===== VENDEDOR SEARCH ===== */
.vendedor-search {
  position: relative;
}

.vendedor-search select {
  width: 100%;
  padding: 14px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-size: 16px;
  transition: all 0.3s;
  background: #fff;
}

.vendedor-search select:focus {
  outline: none;
  border-color: #c21a26;
  box-shadow: 0 0 0 3px rgba(194, 26, 38, 0.1);
}

.vendedor-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #888;
  pointer-events: none;
}

#vendedor-suggestions {
  position: absolute;
  width: 100%;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  max-height: 250px;
  overflow-y: auto;
  border-radius: 8px;
  margin-top: 4px;
}

#vendedor-suggestions ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

#vendedor-suggestions li {
  padding: 12px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  transition: background-color 0.2s;
}

#vendedor-suggestions li:hover {
  background-color: #f8f9fa;
}

.vendas-search-wrapper {
  position: relative;
}

.vendas-search-wrapper input[type="text"] {
  width: 100%;
  padding: 12px 12px 12px 40px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.2s;
}

.vendas-search-wrapper input[type="text"]:focus {
  outline: none;
  border-color: #c21a26;
}

.vendas-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #888;
  pointer-events: none;
}

/* ===== AUTOCOMPLETE SUGGESTIONS ===== */
.vendas-suggestions {
  position: absolute;
  width: 100%;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 4px;
  display: none;
}

.vendas-suggestions ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.vendas-suggestions li {
  padding: 12px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
  transition: background-color 0.2s;
}

.vendas-suggestions li:last-child {
  border-bottom: none;
}

.vendas-suggestions li:hover {
  background-color: #f8f9fa;
}

.vendas-suggestions li strong {
  color: #c21a26;
}

.vendas-loading-mini,
.vendas-sem-resultado {
  padding: 12px;
  text-align: center;
  color: #666;
  font-size: 14px;
}

/* ===== FILTRO SELECIONADO ===== */
.vendas-selecionado {
  display: none;
  margin-top: 8px;
  min-width: 0;
}

.vendas-filtro-selecionado {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: #e7f5eb;
  border: 2px solid #28a745;
  border-radius: 8px;
  min-width: 0;
}

.vendas-filtro-selecionado span {
  flex: 1 1 auto;
  font-size: 14px;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.vendas-filtro-selecionado strong {
  color: #28a745;
}

.vendas-remover-filtro {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: #dc3545;
  color: #fff;
  border-radius: 50%;
  font-size: 0;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  display: inline-grid;
  place-items: center;
  position: relative;
  transition: background-color 0.2s;
}

.vendas-remover-filtro:hover {
  background: #c82333;
}

.vendas-remover-filtro::before,
.vendas-remover-filtro::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
}

.vendas-remover-filtro::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.vendas-remover-filtro::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.vendas-remover-filtro:focus,
.vendas-remover-filtro:focus-visible {
  background: #dc3545;
  color: #fff;
  outline: 2px solid rgba(220, 53, 69, 0.35);
  outline-offset: 2px;
}

/* ===== BOTÃO CONSULTAR ===== */
.vendas-consultar-btn {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, #c21a26 0%, #e74c3c 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s ease;
  font-family: 'Rubik', sans-serif;
}

.vendas-consultar-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(194, 26, 38, 0.3);
}

.vendas-consultar-btn:active {
  transform: translateY(0);
}

/* ===== RESUMO ===== */
.vendas-resumo {
  background: linear-gradient(135deg, #c21a26 0%, #2a0509 100%);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  color: #fff;
}

.vendas-resumo-periodo {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 12px;
  text-align: center;
}

.vendas-resumo-cards {
  display: flex;
  gap: 12px;
}

.vendas-resumo-card {
  flex: 1;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}

.vendas-resumo-label {
  display: block;
  font-size: 12px;
  opacity: 0.9;
  margin-bottom: 4px;
}

.vendas-resumo-valor {
  display: block;
  font-size: 18px;
  font-weight: 700;
}

/* ===== BREADCRUMB ===== */
.vendas-breadcrumb {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vendas-breadcrumb-voltar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  color: #666;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  align-self: flex-start;
}

.vendas-breadcrumb-voltar:hover {
  background: #f0f0f0;
  color: #333;
}

.vendas-breadcrumb-atual {
  font-size: 14px;
  font-weight: 600;
  color: #c21a26;
}

/* ===== ABAS ===== */
.vendas-tabs {
  display: flex;
  background: #fff;
  border-radius: 10px;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.vendas-tab {
  flex: 1;
  padding: 14px 12px;
  border: none;
  background: transparent;
  color: #666;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  font-family: 'Rubik', sans-serif;
  position: relative;
}

.vendas-tab:hover {
  background: #f8f9fa;
  color: #c21a26;
}

.vendas-tab.active {
  background: #fff5f5;
  color: #c21a26;
}

.vendas-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: #c21a26;
}

.vendas-tab svg {
  flex-shrink: 0;
}

/* Esconder texto das abas em telas pequenas */
@media (max-width: 480px) {
  .vendas-tab span {
    display: none;
  }

  .vendas-tab {
    padding: 14px 8px;
  }
}

/* ===== RESULTADOS ===== */
.vendas-resultados {
  min-height: 200px;
}

.vendas-lista {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ===== LOADING ===== */
.vendas-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: #666;
}

.vendas-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f0f0f0;
  border-top-color: #c21a26;
  border-radius: 50%;
  animation: vendas-spin 0.8s linear infinite;
  margin-bottom: 12px;
}

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

/* ===== ESTADO VAZIO ===== */
.vendas-vazio {
  text-align: center;
  padding: 40px 20px;
  color: #999;
}

.vendas-vazio svg {
  margin-bottom: 16px;
  opacity: 0.5;
}

.vendas-vazio p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

/* ===== CARDS DE RESULTADO ===== */
.vendas-card {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: all 0.2s ease;
  cursor: pointer;
}

.vendas-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.vendas-card-detalhe {
  cursor: default;
}

.vendas-card-detalhe:hover {
  transform: none;
}

/* Cards de DIA - clicaveis para fazer nova consulta */
.vendas-card-dia {
  cursor: pointer;
}

.vendas-card-dia:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.vendas-card-posicao {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #c21a26 0%, #e74c3c 100%);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.vendas-card-posicao-capa {
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.55)),
    var(--vendas-capa-url, none),
    linear-gradient(135deg, #c21a26 0%, #e74c3c 100%);
  background-size: cover, cover, cover;
  background-position: center, center, center;
  background-repeat: no-repeat, no-repeat, no-repeat;
}

.vendas-card-content {
  flex: 1;
  min-width: 0;
}

.vendas-card-header {
  margin-bottom: 8px;
}

.vendas-card-codigo {
  display: block;
  font-size: 11px;
  color: #999;
  font-weight: 500;
}

.vendas-card-nome {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vendas-card-stats {
  display: flex;
  gap: 16px;
}

.vendas-card-stat {
  display: flex;
  flex-direction: column;
}

.vendas-stat-label {
  font-size: 11px;
  color: #999;
}

.vendas-stat-valor {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.vendas-stat-valor-total .vendas-stat-valor {
  color: #c21a26;
}

.vendas-card-arrow {
  flex-shrink: 0;
  color: #ccc;
  transition: color 0.2s;
}

.vendas-card:hover .vendas-card-arrow {
  color: #c21a26;
}

/* ===== CARDS DE PERÍODO ===== */
.vendas-card-posicao-periodo {
  background: linear-gradient(135deg, #c21a26 0%, #2a0509 100%);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vendas-card-posicao-periodo svg {
  color: #fff;
}

.vendas-card-periodo-label {
  font-size: 15px !important;
}

/* ===== SEM RESULTADOS / ERRO ===== */
.vendas-sem-resultados,
.vendas-erro {
  text-align: center;
  padding: 30px 20px;
  background: #f8f9fa;
  border-radius: 8px;
  color: #666;
  font-size: 14px;
}

.vendas-erro {
  background: #fff5f5;
  color: #c21a26;
  border: 1px solid #f5c6cb;
}

/* ===== PAGINAÇÃO ===== */
.vendas-paginacao {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-top: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.vendas-paginacao-info {
  text-align: center;
  font-size: 13px;
  color: #666;
  margin-bottom: 12px;
}

.vendas-paginacao-btns {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.vendas-pag-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  color: #666;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.vendas-pag-btn:hover:not(:disabled) {
  background: #e9ecef;
  color: #333;
}

.vendas-pag-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.vendas-pag-numeros {
  display: flex;
  gap: 4px;
}

.vendas-pag-numero {
  min-width: 36px;
  height: 36px;
  padding: 0;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  color: #666;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vendas-pag-numero:hover {
  background: #e9ecef;
}

.vendas-pag-numero.active {
  background: #c21a26;
  border-color: #c21a26;
  color: #fff;
}

/* ============================================================================
   RESPONSIVO - TABLET E DESKTOP
   ============================================================================ */

@media (min-width: 480px) {

  .vendas-atalhos {
    gap: 10px;
  }

  .vendas-atalho-btn {
    flex: 1 1 auto;
    min-width: auto;
  }

  .vendas-datas {
    flex-direction: row;
  }

  .vendas-data-group {
    flex: 1;
  }

  .vendas-resumo-valor {
    font-size: 22px;
  }

  .vendas-card {
    padding: 16px;
  }

  .vendas-card-nome {
    font-size: 15px;
  }

  .vendas-card-stats {
    gap: 24px;
  }
}

@media (min-width: 768px) {
  .vendas-container {
    padding: 0 20px;
  }

  .vendas-filtros {
    padding: 20px;
  }

  .vendas-filtros-opcionais {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .vendas-filtro-item {
    flex: 1 1 calc(33.333% - 11px);
    min-width: 200px;
  }

  .vendas-resumo {
    padding: 20px;
  }

  .vendas-resumo-cards {
    gap: 20px;
  }

  .vendas-resumo-card {
    padding: 20px;
  }

  .vendas-resumo-valor {
    font-size: 26px;
  }

  .vendas-breadcrumb {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .vendas-card-posicao {
    width: 44px;
    height: 44px;
    font-size: 14px;
  }

  .vendas-card-stats {
    gap: 32px;
  }

  .vendas-stat-valor {
    font-size: 16px;
  }

  .vendas-paginacao {
    padding: 20px;
  }

  .vendas-pag-btn {
    padding: 10px 18px;
  }
}

@media (min-width: 1024px) {
  .vendas-container {
    max-width: 900px;
  }

  .vendas-filtros h4 {
    font-size: 1.2em;
  }

  .vendas-atalho-btn {
    padding: 12px 16px;
    font-size: 15px;
  }

  .vendas-consultar-btn {
    max-width: 400px;
    margin: 0 auto;
  }
}