* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Fundo da página */
body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(0, 123, 255, 0.8), rgba(40, 167, 69, 0.8)),
    url("../img/fundo.jpg") no-repeat center center fixed;
  background-size: cover;
  padding: 20px;
}

/* Overlay de fundo */
.background-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(2px);
  z-index: -1;
}

/* Container principal da aplicação */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  display: none;
  /* Inicialmente oculto até fazer login */
}

.main-container.show {
  display: block;
}

/* Cabeçalho com dados do vendedor */
.header-vendedor {
  background: rgba(255, 255, 255, 0.98);
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 20px;
  box-shadow:
    0 25px 50px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.header-vendedor::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #007bff, #28a745, #17a2b8);
  border-radius: 20px 20px 0 0;
}

.vendedor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.vendedor-title {
  display: flex;
  align-items: center;
  gap: 15px;
}

.modal-icon {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #007bff, #0056b3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
  box-shadow: 0 8px 20px rgba(0, 123, 255, 0.3);
}

.vendedor-title h3 {
  color: #2c3e50;
  font-size: 22px;
  font-weight: 600;
  margin: 0;
}

.usuario-dados {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.usuario-campo {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 10px;
  border: 1px solid #dee2e6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.usuario-campo label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}

.usuario-campo span {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
}

/* Status da instância */
.instance-status {
  background: white;
  padding: 15px;
  border-radius: 10px;
  border: 1px solid #dee2e6;
  text-align: center;
  margin-bottom: 20px;
}

/* Container do QR Code */
.qrcode-container {
  background: white;
  padding: 25px;
  border-radius: 15px;
  border: 2px dashed #dee2e6;
  text-align: center;
  margin-bottom: 20px;
  transition: all 0.3s ease;
  display: none;
}

.qrcode-container.active {
  border-color: #007bff;
  background: linear-gradient(135deg, #f8f9ff, #ffffff);
  box-shadow: 0 8px 25px rgba(0, 123, 255, 0.15);
  display: block;
}

.qrcode-container img {
  max-width: 400px;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  border: 3px solid #fff;
  transition: all 0.3s ease;
}

.qrcode-container img:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 30px rgba(0, 123, 255, 0.2);
}

.qrcode-instructions {
  margin-top: 15px;
  padding: 15px;
  background: rgba(0, 123, 255, 0.05);
  border-radius: 10px;
  border: 1px solid rgba(0, 123, 255, 0.1);
}

.qrcode-instructions h5 {
  color: #007bff;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.qrcode-instructions p {
  color: #6c757d;
  font-size: 13px;
  line-height: 1.4;
  margin: 0;
}

/* Status de conexão com cores */
.status-connected {
  color: #28a745 !important;
  background: rgba(40, 167, 69, 0.1) !important;
  border-color: rgba(40, 167, 69, 0.2) !important;
}

.status-connecting {
  color: #ffc107 !important;
  background: rgba(255, 193, 7, 0.1) !important;
  border-color: rgba(255, 193, 7, 0.2) !important;
}

.status-disconnected {
  color: #dc3545 !important;
  background: rgba(220, 53, 69, 0.1) !important;
  border-color: rgba(220, 53, 69, 0.2) !important;
}

.status-unknown {
  color: #6c757d !important;
  background: rgba(108, 117, 125, 0.1) !important;
  border-color: rgba(108, 117, 125, 0.2) !important;
}

/* Seção de clientes */
.clientes-section {
  background: rgba(255, 255, 255, 0.98);
  border-radius: 20px;
  padding: 30px;
  box-shadow:
    0 25px 50px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.clientes-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #007bff, #28a745, #17a2b8);
  border-radius: 20px 20px 0 0;
}

.clientes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #e9ecef;
}

.clientes-header h4 {
  color: #2c3e50;
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.clientes-count {
  background: linear-gradient(135deg, #007bff, #0056b3);
  color: white;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.clientes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 15px;
  max-height: 400px;
  overflow-y: auto;
}

.cliente-card {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 10px;
  padding: 15px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.cliente-card:hover {
  background: #e9ecef;
  border-color: #007bff;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 123, 255, 0.2);
}

.cliente-id {
  font-size: 12px;
  font-weight: 600;
  color: #6c757d;
  margin-bottom: 5px;
}

.cliente-razao {
  font-size: 14px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 8px;
  line-height: 1.3;
}

.cliente-envios {
  font-size: 12px;
  color: #28a745;
  font-weight: 600;
  background: rgba(40, 167, 69, 0.1);
  padding: 4px 8px;
  border-radius: 15px;
  display: inline-block;
}

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Estilo geral dos modais */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    backdrop-filter: blur(0px);
  }

  to {
    opacity: 1;
    backdrop-filter: blur(8px);
  }
}

/* Conteúdo do modal */
.modal-content {
  background: rgba(255, 255, 255, 0.98);
  padding: 40px 35px;
  border-radius: 20px;
  width: 90%;
  max-width: 420px;
  text-align: center;
  box-shadow:
    0 25px 50px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.modal-content::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #007bff, #28a745, #17a2b8);
  border-radius: 20px 20px 0 0;
}

.modal__info {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  gap: 15px;
  color: #0056b3;
  background-color: #dcefff;
  padding: 15px;
  border-radius: 12px;
}

/* Animação de entrada */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(50px) scale(0.95);
  }

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

/* Títulos */
h3 {
  margin-bottom: 25px;
  color: #2c3e50;
  font-size: 24px;
  font-weight: 600;
  position: relative;
}

/* Ícones nos títulos dos modais */
.modal .modal-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, #007bff, #0056b3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
  box-shadow: 0 8px 20px rgba(0, 123, 255, 0.3);
}

/* Inputs modernos */
.input-group {
  position: relative;
  margin-bottom: 20px;
}

.modal input {
  width: 100%;
  padding: 16px 20px;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  font-size: 16px;
  outline: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(248, 249, 250, 0.8);
  color: #2c3e50;
}

.modal input:focus {
  border-color: #007bff;
  background: white;
  box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.1);
  transform: translateY(-2px);
}

.modal input::placeholder {
  color: #6c757d;
  transition: all 0.3s ease;
}

.modal input:focus::placeholder {
  opacity: 0.7;
  transform: translateY(-2px);
}

/* Container do código */
.codigo-container {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.codigo-input {
  width: 55px !important;
  height: 55px;
  font-size: 24px !important;
  font-weight: 600;
  text-align: center;
  border: 2px solid #e9ecef !important;
  border-radius: 12px;
  background: rgba(248, 249, 250, 0.9) !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: #2c3e50 !important;
}

.codigo-input:focus {
  border-color: #007bff !important;
  background: white !important;
  box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.15) !important;
  transform: translateY(-3px) scale(1.05) !important;
}

/* Botões modernos */
.btn {
  width: 100%;
  padding: 16px 24px;
  margin-top: 15px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: linear-gradient(135deg, #007bff, #0056b3);
  color: white;
  box-shadow: 0 8px 20px rgba(0, 123, 255, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #0056b3, #004085);
  box-shadow: 0 12px 30px rgba(0, 123, 255, 0.4);
  transform: translateY(-2px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

/* Estado de carregamento */
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
  transform: none !important;
  box-shadow: none !important;
}

.btn.loading {
  color: transparent;
}

.btn.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid transparent;
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Mensagens de erro */
.error {
  color: #dc3545;
  margin-top: 15px;
  font-size: 14px;
  font-weight: 500;
  padding: 12px;
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid rgba(220, 53, 69, 0.2);
  border-radius: 8px;
  animation: errorShake 0.2s ease-in-out;
}

@keyframes errorShake {
  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-5px);
  }

  75% {
    transform: translateX(5px);
  }
}

/* Mensagem de sucesso */
.success-message {
  color: #28a745;
  font-size: 18px;
  font-weight: 500;
  margin-top: 20px;
  padding: 20px;
  background: rgba(40, 167, 69, 0.1);
  border: 1px solid rgba(40, 167, 69, 0.2);
  border-radius: 12px;
  animation: successPulse 0.6s ease-in-out;
  text-align: center;
}

@keyframes successPulse {
  0% {
    transform: scale(0.95);
    opacity: 0;
  }

  50% {
    transform: scale(1.02);
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Botões de ação no cabeçalho */
.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.action-btn {
  background: rgba(220, 53, 69, 0.9);
  color: white;
  border: none;
  border-radius: 25px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.action-btn:hover {
  background: rgba(220, 53, 69, 1);
  box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
  transform: translateY(-2px);
}

.action-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(220, 53, 69, 0.3);
}

.action-btn.disconnect {
  background: rgba(255, 193, 7, 0.9);
  box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
}

.action-btn.disconnect:hover {
  background: rgba(255, 193, 7, 1);
  box-shadow: 0 6px 20px rgba(255, 193, 7, 0.4);
}

.action-btn.disconnect:active {
  box-shadow: 0 2px 10px rgba(255, 193, 7, 0.3);
}

.action-btn.connect {
  background: rgba(40, 167, 69, 0.9);
  box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.action-btn.connect:hover {
  background: rgba(40, 167, 69, 1);
  box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.action-btn.connect:active {
  box-shadow: 0 2px 10px rgba(40, 167, 69, 0.3);
}

/* Responsividade */
@media (max-width: 768px) {
  .main-container {
    padding: 10px;
  }

  .header-vendedor,
  .clientes-section {
    padding: 20px;
  }

  .usuario-dados {
    grid-template-columns: 1fr;
  }

  .clientes-grid {
    grid-template-columns: 1fr;
    max-height: 300px;
  }

  .clientes-header {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .modal-content {
    padding: 30px 25px;
    margin: 20px;
    border-radius: 16px;
  }

  .codigo-container {
    gap: 8px;
  }

  .codigo-input {
    width: 45px !important;
    height: 45px;
    font-size: 20px !important;
  }

  h3 {
    font-size: 20px;
  }

  .modal .modal-icon {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }

  .logout-btn {
    top: 15px;
    right: 15px;
    padding: 10px 16px;
    font-size: 12px;
  }
}

/* Animação de pulso para inputs ativos */
.input-active {
  animation: inputPulse 0.3s ease-in-out;
}

@keyframes inputPulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.02);
  }

  100% {
    transform: scale(1);
  }
}

/* Efeito de ondulação nos botões */
.btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transition:
    width 0.6s,
    height 0.6s,
    top 0.6s,
    left 0.6s;
  transform: translate(-50%, -50%);
  z-index: 0;
}

.btn:active::before {
  width: 300px;
  height: 300px;
}

.btn span {
  position: relative;
  z-index: 1;
}

.whatsapp-dados {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
}

.whatsapp-foto {
  width: 200px;
  height: 200px;
  background-color: #f0f0f0;
  background-size: cover;
  background-position: center;
  border-radius: 8px;
}

/* Responsivo igual ao .usuario-dados */
.whatsapp-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  flex: 1;
  /* ocupa o espaço disponível */
}

.whatsapp-campo {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-start;
}

.whatsapp-campo label {
  font-weight: bold;
  font-size: 14px;
}
