/* ============================================================================
   SISTEMA DE PEDIDOS - ARQUITETURA COM TABS
   ============================================================================ */

/* ===== CONTAINER PRINCIPAL ===== */
.pedidos-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
}

/* ===== HEADER FIXO ===== */
.header-fixo-pedidos {
  position: relative;
  background: white;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: 20px 20px 0px 0px;
}

/* Seção de Cliente no Header */
.pedidos-cliente-section {
  padding: 12px 20px;
  background: linear-gradient(135deg, #c21a26 0%, #e74c3c 100%);
  color: white;
  border-radius: 20px 20px 0px 0px;
}

.pedidos-cliente-search {
  position: relative;
}

/* Título acima do campo de busca de cliente */
.pedidos-cliente-search .titulo-selecionar-cliente {
  margin: 0 0 8px 0;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
  color: #fff;
  font-family: 'Rubik', sans-serif;
}

#pedidos-cliente-input {
  width: 100%;
  padding: 10px 12px 10px 35px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.95);
  color: #333;
}

#pedidos-cliente-input::placeholder {
  color: #999;
}

#pedidos-cliente-input:focus {
  outline: none;
  border-color: white;
  background: white;
}

.pedidos-cliente-search .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #666;
  pointer-events: none;
}

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

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

#pedidos-cliente-suggestions li {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  color: #333;
  transition: background-color 0.2s;
}

#pedidos-cliente-suggestions li:last-child {
  border-bottom: none;
}

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

/* Cliente Selecionado no Header */
.cliente-selecionado-pedidos {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

.cliente-info-header {
  flex: 1;
}

.cliente-nome-header {
  font-weight: 600;
  font-size: 16px;
  display: block;
  margin-bottom: 2px;
}

.cliente-codigo-header {
  font-size: 14px;
  opacity: 0.9;
}



#total-header-value {
  font-size: 20px;
  font-weight: 700;
}

/* ===== SISTEMA DE TABS ===== */
.tabs-container {
  display: flex;
  background: white;
  border-bottom: 2px solid #f0f0f0;
}

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

.tab svg {
  flex-shrink: 0;
}

.tab:hover {
  color: #c21a26;
  background: #fff5f5;
}

.tab.active {
  color: #c21a26;
  background: white;
}

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

.tab-badge {
  position: absolute;
  top: 8px;
  right: 12px;
  background: #c21a26;
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 700;
  min-width: 18px;
  display: none;
}

.tab-badge:not(:empty) {
  display: block;
}

/* ===== CONTEÚDO DAS TABS ===== */
.tabs-content-wrapper {
  max-width: 800px;
  margin: 0 auto;
  margin: 20px 0px 20px 0px;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== TAB 1: BUSCAR ===== */
.buscar-tab-content h4 {
  margin: 0 0 16px 0;
  color: #333;
  padding: 10px 15px;
  background: #f8f9fa;
  border-left: 4px solid #c21a26;
  font-size: 1.1em;
  font-family: 'Rubik', sans-serif;
}

.busca-rapida-card {
  background: white;
  border-radius: 16px;
  padding: 15px;
  margin-bottom: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.produto-search-pedidos {
  position: relative;
}

.search-wrapper {
  position: relative;
  width: 100%;
}

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

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

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

#pedidos-produto-suggestions li {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background-color 0.2s;
}

#pedidos-produto-suggestions li:last-child {
  border-bottom: none;
}

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

.suggestion-img {
  width: 40px;
  height: 60px;
  object-fit: contain;
  border-radius: 4px;
}

/* Produtos Mais Vendidos */
.pedidos-mais-vendidos-section {
  background: white;
  border-radius: 16px;
  padding: 15px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.pedidos-mais-vendidos-section h4 {
  background: transparent;
  border-left: none;
  padding: 0;
  margin-bottom: 16px;
}

.filtro-categoria-container {
  margin-bottom: 16px;
}

.filtro-categoria-container label {
  display: block;
  font-weight: 600;
  color: #666;
  margin-bottom: 8px;
  font-size: 13px;
}

#filtro-categoria {
  width: 100%;
  max-width: 100%;
  padding: 10px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 15px;
  background: white;
  cursor: pointer;
}

#filtro-categoria:focus {
  outline: none;
  border-color: #c21a26;
}

.top-produtos-lista {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.top-produto-card {
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

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

.top-produto-posicao {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #c21a26;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  z-index: 1;
}

.top-produto-thumb {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: 8px;
  background: #e5e7eb;
}

.top-produto-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.top-produto-nome {
  font-weight: 600;
  color: #333;
  font-size: 13px;
  line-height: 1.3;
  max-height: 34px;
  overflow: hidden;
  min-height: 34px;
}

.top-produto-vendas {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #666;
  font-size: 12px;
}

.top-produto-vendas svg {
  color: #c21a26;
  flex-shrink: 0;
}

.top-produto-estoque {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #666;
  font-size: 12px;
}

/* Ícone de estoque (SVG) antes do texto */
.top-produto-estoque::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  background: center/contain no-repeat url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23c21a26' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4a2 2 0 0 0 1-1.73z'/><polyline points='3.27 6.96 12 12.01 20.73 6.96'/><line x1='12' y1='22.08' x2='12' y2='12'/></svg>");
}

/* Caso no futuro use <svg> inline no estoque, mantém a cor */
.top-produto-estoque svg {
  color: #c21a26;
  flex-shrink: 0;
}

.top-produto-preco {
  margin-top: 2px;
  font-weight: 600;
  color: #c21a26;
  font-size: 13px;
}

.top-produto-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid #e9ecef;
}

.top-produto-actions .quantidade-control {
  flex: 0 0 auto;
}

.adicionar-top-produto-btn {
  flex: 1;
  background: #c21a26;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.adicionar-top-produto-btn:hover {
  background: #a50d17;
}

.adicionar-top-produto-btn svg {
  flex-shrink: 0;
}

/* ===== TAB 2: CARRINHO ===== */
.carrinho-tab-content {
  min-height: 300px;
}

.pedidos-loading {
  text-align: center;
  padding: 20px;
  color: #666;
  font-style: italic;
}

.pedidos-lista {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pedidos-lista.is-empty {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pedido-item {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  padding: 15px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.2s;
}

.pedido-item:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.pedido-item .pi-thumb {
  width: 48px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  flex: 0 0 auto;
  background: #e5e7eb;
}

.pedido-item .pi-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.pedido-item .pi-nome {
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
}

.pedido-item .pi-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pedido-item .pi-preco {
  font-weight: 600;
  color: #c21a26;
  align-self: start;
  white-space: nowrap;
  font-size: 14px;
}

/* Bloco à esquerda (preço + estoque) dentro da linha inferior do item do carrinho */
.pedido-item .pi-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.pedido-item .pi-estoque {
  margin-top: 2px;
  font-size: 12px;
  color: #666;
}

/* Controles de Quantidade - Design 5 */
.quantidade-control.design5,
.design5 .item-qty {
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid #c21a26;
}

.quantidade-control.design5 .qty-btn,
.design5 .qty-button {
  width: 26px;
  height: 26px;
  border: none;
  color: #c21a26;
  border-radius: 50%;
  cursor: pointer;
  font-weight: bold;
  font-size: 1em;
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 1;
  background: transparent;
  transition: background-color 0.15s ease-in-out;
}

.quantidade-control.design5 .qty-btn:hover,
.design5 .qty-button:hover {
  background: rgba(194, 26, 38, 0.1);
}

.quantidade-control.design5 .qty-display,
.design5 .qty-number {
  min-width: 25px;
  text-align: center;
  font-weight: 600;
  color: #c21a26;
  font-size: 14px;
  outline: none;
}

/* ===== TAB 3: RESUMO ===== */
.resumo-tab-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.resumo-card {
  background: white;
  border-radius: 16px;
  padding: 15px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.resumo-card h4 {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 700;
  color: #333;
  padding: 0;
  background: transparent;
  border: none;
}

.resumo-linha {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
  align-items: center;
}

.resumo-linha:last-child {
  border-bottom: none;
}

.resumo-label {
  color: #666;
  font-size: 14px;
}

.resumo-valor {
  font-weight: 600;
  color: #333;
  font-size: 14px;
  text-align: right;
}

.total-final-resumo {
  background: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 100%);
  border-radius: 12px;
  padding: 16px;
  margin-top: 12px;
}

.total-final-linha {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.resumo-acoes {
  margin-top: 12px;
  display: flex;
  justify-content: center;
}

.btn-gerar-pdf-resumo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #e53935;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

.btn-gerar-pdf-resumo:hover {
  filter: brightness(1.05);
}

.btn-gerar-pdf-resumo:active {
  transform: translateY(1px);
}

.total-label-resumo {
  font-size: 18px;
  font-weight: 700;
  color: #333;
}

.total-valor-resumo {
  font-size: 26px;
  font-weight: 700;
  color: #c21a26;
}

.resumo-vazio {
  text-align: center;
  padding: 20px;
  color: #999;
  font-style: italic;
}

/* ===== FOOTER FIXO ===== */
.footer-fixo-pedidos {
  position: sticky;
  bottom: 0;
  background: white;
  padding: 16px 20px;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
  z-index: 100;
  margin-top: auto;
}

.acoes-container-pedidos {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  gap: 12px;
}

.btn-acao-footer {
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Rubik', sans-serif;
}

.btn-finalizar-footer {
  flex: 1;
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
}

.btn-finalizar-footer:hover:not(:disabled) {
  background: linear-gradient(135deg, #218838 0%, #1ea87a 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.btn-finalizar-footer:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-limpar-footer {
  background: #f8f9fa;
  color: #6c757d;
  border: 2px solid #e9ecef;
  padding: 12px 16px;
}

.btn-limpar-footer:hover {
  background: #e9ecef;
  color: #495057;
}

.btn-acao-footer svg {
  flex-shrink: 0;
}

/* ===== ESTADOS VAZIOS ===== */
.sem-produtos-top,
.erro-top-produtos {
  text-align: center;
  padding: 30px 20px;
  color: #999;
  font-style: italic;
  background: #f8f9fa;
  border-radius: 8px;
}

.erro-top-produtos {
  color: #dc3545;
  background: #fff5f5;
}

/* ===== RESPONSIVIDADE ===== */
/* Movido para css/responsive.css */

/* ===== MODAL DO SCANNER (mantido do código original) ===== */
.scanner-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  display: none;
}

.scanner-modal.active {
  display: block;
}

.scanner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
  z-index: 10000;
}

.scanner-header h4 {
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  color: white;
  font-size: 1.1em;
  font-weight: 500;
}

.close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  line-height: 1;
  padding: 5px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

#scanner-preview {
  width: 100%;
  max-width: 600px;
  height: 60vh;
  margin: 80px auto 0;
  background: black;
  position: relative;
}

.scanner-controls {
  padding: 15px 20px;
  background: rgba(0, 0, 0, 0.8);
  position: fixed;
  bottom: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 15px;
  border-radius: 25px;
}

.control-group label {
  font-size: 0.9em;
  white-space: nowrap;
}

#zoom-range {
  width: 150px;
  accent-color: #c21a26;
}

.flash-btn {
  background: #c21a26;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  padding: 8px;
  cursor: pointer;
}

.flash-btn.active {
  background: #ffd700;
}

.flash-btn svg {
  fill: white;
  width: 100%;
  height: 100%;
}

.flash-btn.active svg {
  fill: #333;
}

/* ===== BOTÃO TROCAR CLIENTE - VERSÃO CORRIGIDA ===== */
.cliente-dados-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.trocar-cliente-pedidos-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  align-self: flex-start;
  font-size: 12px;
  font-weight: 500;
}

.trocar-cliente-pedidos-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}

.trocar-cliente-pedidos-btn:active {
  transform: translateY(0);
}

.trocar-cliente-pedidos-btn svg {
  display: block;
  flex-shrink: 0;
}

/* Responsividade movida para css/responsive.css */


.btn-gerar-pdf-resumo:hover {
  background: #d32f2f;
}

.btn-gerar-pdf-resumo:active {
  transform: translateY(1px);
  background: #b71c1c;
}

.btn-gerar-pdf-resumo svg {
  flex: 0 0 auto;
}