/* Estilos específicos para melhorias nas vendas */

/* Botões WhatsApp */
.whatsapp-buttons {
  display: flex;
  align-items: center;
}

.btn-outline-success {
  background: transparent;
  border: 1px solid #28a745;
  color: #28a745;
  transition: all 0.2s ease;
}

.btn-outline-success:hover {
  background: #28a745;
  color: white;
}

/* Container das parcelas */
.parcelas-container {
  max-height: 300px;
  overflow-y: auto;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.parcela-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: white;
  border-radius: 6px;
  border: 1px solid #dee2e6;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.parcela-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.parcela-numero {
  font-weight: 600;
  color: #495057;
  font-size: 14px;
}

.parcela-valor {
  font-size: 16px;
  font-weight: 700;
  color: #28a745;
}

.parcela-data {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 150px;
}

.parcela-data .form-label {
  font-size: 12px;
  margin-bottom: 2px;
  color: #6c757d;
}

.form-input-sm {
  padding: 6px 8px;
  font-size: 13px;
  height: auto;
}

/* Responsividade para parcelas */
@media (max-width: 768px) {
  .parcela-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .parcela-data {
    min-width: auto;
    width: 100%;
  }
  
  .parcela-data input {
    width: 100%;
  }
}

/* Parcelas individuais na visualização */
.parcelas-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.parcela-card {
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 16px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

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

.parcela-card.pago {
  border-color: #28a745;
  background: #f0f9f4;
}

.parcela-card.vencida {
  border-color: #dc3545;
  background: #fff5f5;
}

.parcela-card.pendente {
  border-color: #ffc107;
  background: #fffdf0;
}

.parcela-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e9ecef;
}

.parcela-numero {
  font-size: 16px;
  font-weight: 700;
  color: #2c3e50;
}

.parcela-status {
  display: flex;
  align-items: center;
}

.parcela-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.parcela-info > div {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #495057;
}

.parcela-info strong {
  color: #2c3e50;
  font-weight: 600;
}

.parcela-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-pix {
  background: linear-gradient(135deg, #00c4cc 0%, #00a8b5 100%);
  color: white;
  border: none;
  transition: all 0.3s ease;
}

.btn-pix:hover:not(:disabled) {
  background: linear-gradient(135deg, #00a8b5 0%, #008c99 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 196, 204, 0.3);
}

.btn-pix:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .parcelas-list {
    grid-template-columns: 1fr;
  }
  
  .parcela-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .parcela-actions {
    width: 100%;
  }
  
  .parcela-actions button {
    flex: 1;
  }
}

/* Estilos para linhas de parcelas na tabela */
.parcela-row {
  background-color: #f8f9fa;
  border-left: 3px solid #ffc107;
}

.parcela-row:hover {
  background-color: #e9ecef;
}

.total-row {
  background-color: #e7f3ff;
  font-weight: bold;
  border-top: 2px solid #007bff;
  border-bottom: 2px solid #007bff;
}

.total-row td {
  padding: 12px 8px !important;
}

.parcela-row td[rowspan] {
  vertical-align: top;
  border-right: 1px solid #dee2e6;
}

/* Estilos para coluna de produtos na tabela de vendas */
.sale-products {
  max-width: 250px;
}

.products-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  background: #f8f9fa;
  border-radius: 6px;
  border-left: 3px solid #007bff;
}

.product-name {
  font-weight: 600;
  color: #495057;
  font-size: 13px;
  line-height: 1.2;
}

.product-variation {
  font-size: 12px;
  color: #6c757d;
  font-weight: 500;
}

.product-qty {
  font-size: 11px;
  color: #28a745;
  font-weight: 600;
}

.more-products {
  font-size: 12px;
  color: #6c757d;
  font-style: italic;
  text-align: center;
  padding: 4px;
  background: #e9ecef;
  border-radius: 4px;
}

.no-products {
  color: #6c757d;
  font-style: italic;
  font-size: 12px;
}

/* Responsividade para tabela de vendas */
@media (max-width: 1200px) {
  .sale-products {
    max-width: 200px;
  }
  
  .product-name {
    font-size: 12px;
  }
  
  .product-variation {
    font-size: 11px;
  }
}

@media (max-width: 768px) {
  .sale-products {
    max-width: 150px;
  }
  
  .product-item {
    padding: 6px;
  }
  
  .product-name {
    font-size: 11px;
  }
  
  .product-variation,
  .product-qty {
    font-size: 10px;
  }
}

/* Melhorias nos totais */
.sale-totals .total-final {
  background: #e8f5e8;
  border-color: #28a745;
  font-weight: 700;
  font-size: 18px;
  color: #155724;
}

/* Indicador de valor automático */
.valor-automatico {
  position: relative;
}

.valor-automatico::after {
  content: "Auto";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: #007bff;
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
}

/* Seção de informações de pagamento */
.payment-section {
  background: #f8f9fa;
  padding: 16px;
  border-radius: 8px;
  border-left: 4px solid #007bff;
  margin: 16px 0;
}

.payment-section h4 {
  margin: 0 0 12px 0;
  color: #495057;
  font-size: 16px;
  font-weight: 600;
}

.payment-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.payment-info-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #dee2e6;
}

.payment-info-item:last-child {
  border-bottom: none;
}

.payment-label {
  font-weight: 500;
  color: #6c757d;
}

.payment-value {
  font-weight: 600;
  color: #495057;
}

/* Destaque para compra a prazo */
.prazo-highlight {
  background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
  border: 1px solid #ffc107;
  padding: 12px;
  border-radius: 6px;
  margin: 8px 0;
}

.prazo-highlight .form-label {
  color: #856404;
  font-weight: 600;
}

/* Animações */
.parcela-item {
  transition: all 0.2s ease;
}

.parcela-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Estados de validação */
.form-input.error {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.form-input.success {
  border-color: #28a745;
  box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

/* Botões de ação adicionais */
.btn-icon.btn-info {
  background: #17a2b8;
  color: white;
}

.btn-icon.btn-info:hover {
  background: #138496;
}

.btn-icon.btn-success {
  background: #28a745;
  color: white;
}

.btn-icon.btn-success:hover {
  background: #218838;
}

/* ID da venda */
.sale-id {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: #6c757d;
  background: #e9ecef;
  font-size: 14px;
}

.item-quantity {
  color: #495057;
  font-weight: 500;
}

.item-price {
  color: #28a745;
  font-weight: 500;
}

/* Estilos para devoluções/trocas detalhadas */
.devolucoes-view {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.devolucao-item-completa {
  background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
  border-radius: 12px;
  border: 2px solid #e9ecef;
  padding: 1.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.devolucao-header-completa {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e9ecef;
}

.operacao-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.devolucao-data {
  font-size: 0.9rem;
  color: #666;
  font-weight: 500;
}

.produto-devolvido {
  margin: 1rem 0;
}

.produto-devolvido h4 {
  color: #dc3545;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.produto-info-card {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 8px;
  padding: 1rem;
  margin-top: 0.5rem;
}

.produto-nome-dev {
  font-weight: 600;
  font-size: 1.1rem;
  color: #333;
  margin-bottom: 0.5rem;
}

.produto-detalhes-dev {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.produto-detalhes-dev span {
  background: #fff;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.9rem;
  border: 1px solid #e9ecef;
}

.valores-dev {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.valores-dev span {
  background: #d4edda;
  color: #155724;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-weight: 500;
  border: 1px solid #c3e6cb;
}

.motivo-operacao {
  margin: 1rem 0;
  background: #e7f3ff;
  border: 1px solid #b3d9ff;
  border-radius: 8px;
  padding: 1rem;
}

.motivo-operacao h4 {
  color: #0066cc;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.motivo-texto {
  background: #fff;
  padding: 0.75rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-style: italic;
  color: #333;
}

.info-troca {
  margin-top: 1rem;
}

.troca-aviso {
  background: #d1ecf1;
  color: #0c5460;
  padding: 0.75rem;
  border-radius: 6px;
  border: 1px solid #bee5eb;
  font-size: 0.9rem;
}

/* Estilos para itens com status */
.item-header-status {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.item-status-badge {
  flex-shrink: 0;
}

.item-devolvido {
  background: #fff5f5 !important;
  border-left: 4px solid #dc3545 !important;
}

.item-normal {
  background: #f0fff4 !important;
  border-left: 4px solid #28a745 !important;
}

.item-evento {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
  border: 1px solid #bbdefb;
  border-radius: 8px;
  font-size: 0.9rem;
}

.evento-info {
  color: #1565c0;
  font-weight: 500;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.evento-hora {
  color: #666;
  font-weight: 400;
  font-size: 0.85rem;
}

.evento-observacao {
  color: #666;
  font-size: 0.8rem;
  font-style: italic;
}

.item-observacao {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #856404;
}

.badge-danger {
  background-color: #dc3545;
  color: white;
}

.badge-success {
  background-color: #28a745;
  color: white;
}

/* Badge para status com troca */
.badge-warning {
  background-color: #ffc107;
  color: #212529;
}

/* Modal maior para acomodar mais informações */
.modal-lg {
  max-width: 900px !important;
  width: 95% !important;
  max-height: 90vh !important;
  overflow-y: auto !important;
}

/* Scroll para itens quando há muitos */
.items-view {
  max-height: 400px !important;
  overflow-y: auto !important;
}

/* Modal de WhatsApp */
.whatsapp-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.whatsapp-info {
  background: #e8f5e8;
  padding: 12px;
  border-radius: 6px;
  border: 1px solid #28a745;
}

.whatsapp-info p {
  margin: 4px 0;
  color: #155724;
}

/* Responsividade */
@media (max-width: 768px) {
  .info-grid {
    grid-template-columns: 1fr;
  }
  
  .item-view {
    flex-direction: column;
    text-align: center;
  }
  
  .item-photo {
    align-self: center;
  }
  
  .table-actions {
    flex-wrap: wrap;
    gap: 4px;
  }
  
  .btn-icon {
    min-width: 32px;
    min-height: 32px;
  }
}
