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

:root {
  --primary-color: #047ab7;
  --secondary-color: #e4cd03;
  --dark-color: #000000;
  --light-color: #ffffff;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-600: #4b5563;
  --gray-800: #1f2937;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, var(--primary-color) 0%, #025a87 100%);
  min-height: 100vh;
  padding: 20px;
  color: var(--gray-800);
}

.container {
  max-width: 600px;
  margin: 0 auto;
}

/* Header */
.header {
  text-align: center;
  color: var(--light-color);
  margin-bottom: 30px;
  animation: fadeInDown 0.5s ease;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
  font-size: 1.1rem;
  opacity: 0.9;
}

/* Loading */
.loading {
  background: var(--light-color);
  border-radius: 20px;
  padding: 60px 40px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  animation: fadeIn 0.5s ease;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 5px solid var(--gray-200);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 1s linear infinite;
}

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

/* Error */
.error-container {
  background: var(--light-color);
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.error-icon {
  font-size: 4rem;
  margin-bottom: 20px;
}

.error-container h2 {
  color: var(--danger-color);
  margin-bottom: 15px;
}

.error-container p {
  color: var(--gray-600);
  margin-bottom: 25px;
}

/* Content */
.content {
  animation: fadeIn 0.5s ease;
}

/* Cards */
.info-card,
.status-card,
.qrcode-card {
  background: var(--light-color);
  border-radius: 20px;
  padding: 25px;
  margin-bottom: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.5s ease;
}

.info-card h3,
.status-card h3 {
  font-size: 1.3rem;
  margin-bottom: 20px;
  color: var(--gray-800);
}

/* Info Grid */
.info-grid {
  display: grid;
  gap: 15px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  background: var(--gray-100);
  border-radius: 10px;
  transition: all 0.3s ease;
}

.info-item:hover {
  background: var(--gray-200);
  transform: translateX(5px);
}

.label {
  font-weight: 600;
  color: var(--gray-600);
}

.value {
  font-weight: 700;
  color: var(--gray-800);
}

.valor {
  color: var(--primary-color);
  font-size: 1.3rem;
}

/* Status */
.status-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
}

.status-icon {
  font-size: 2.5rem;
  animation: pulse 2s ease infinite;
}

.status-details {
  color: var(--gray-600);
}

.timer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 15px;
  padding: 12px 15px;
  background: var(--gray-100);
  border-radius: 10px;
  font-weight: 600;
}

.timer-icon {
  font-size: 1.2rem;
}

/* QR Code */
.qrcode-wrapper {
  display: flex;
  justify-content: center;
  padding: 30px;
  background: var(--gray-100);
  border-radius: 15px;
  margin-bottom: 20px;
}

#qrcode-image {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.qrcode-actions {
  text-align: center;
}

.pix-code-container {
  margin-top: 15px;
  margin-bottom: 15px;
}

.pix-code {
  width: 100%;
  height: 80px;
  padding: 10px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  background: var(--gray-100);
  color: var(--gray-600);
  font-family: monospace;
  font-size: 0.9rem;
  resize: none;
}

.pix-code:focus {
  outline: 2px solid var(--primary-color);
  background: var(--light-color);
}

/* Buttons */
.btn {
  padding: 14px 28px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  width: 100%;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

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

.btn-primary {
  background: var(--primary-color);
  color: var(--light-color);
}

.btn-primary:hover {
  background: #036599;
}

.btn-secondary {
  background: var(--gray-200);
  color: var(--gray-800);
}

.btn-secondary:hover {
  background: var(--gray-300);
}

.btn-danger {
  background: var(--danger-color);
  color: var(--light-color);
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-success {
  background: var(--success-color);
  color: var(--light-color);
}

.btn-whatsapp {
  background: #25d366;
  color: var(--light-color);
}

.btn-whatsapp:hover {
  background: #20ba5a;
}

/* Actions */
.actions {
  display: grid;
  gap: 15px;
  margin-bottom: 20px;
}

/* Status States */
.status-pendente .status-icon {
  color: var(--warning-color);
}

.status-pago .status-icon {
  color: var(--success-color);
}

.status-expirado .status-icon {
  color: var(--danger-color);
}

.status-cancelado .status-icon {
  color: var(--gray-600);
}

/* Histórico */
.historico {
  background: var(--light-color);
  border-radius: 20px;
  padding: 25px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.historico h3 {
  margin-bottom: 20px;
}

.historico-item {
  padding: 15px;
  background: var(--gray-100);
  border-radius: 10px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Utility */
.hidden {
  display: none !important;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

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

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

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

@keyframes pulse {

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

  50% {
    transform: scale(1.1);
  }
}

/* Responsive */
@media (max-width: 640px) {
  .header h1 {
    font-size: 2rem;
  }

  .info-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
}

/* Modal */
.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background-color: var(--light-color);
  padding: 30px;
  border-radius: 20px;
  width: 90%;
  max-width: 450px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  position: relative;
  animation: slideUp 0.3s ease;
}

.close-modal {
  position: absolute;
  right: 20px;
  top: 15px;
  font-size: 28px;
  font-weight: bold;
  color: var(--gray-600);
  cursor: pointer;
  transition: color 0.3s ease;
}

.close-modal:hover {
  color: var(--dark-color);
}

.modal-content h3 {
  margin-bottom: 10px;
  font-size: 1.5rem;
}

.modal-content p {
  color: var(--gray-600);
  margin-bottom: 20px;
  font-size: 0.95rem;
}

.modal-content .input-group {
  margin-bottom: 20px;
}

.modal-content input {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--gray-300);
  border-radius: 10px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s ease;
}

.modal-content input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(4, 122, 183, 0.15);
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

/* Estilos de impressão otimizados para impressoras térmicas de cupom */
@media print {
  body {
    background: white !important;
    color: black !important;
    font-family: Arial, sans-serif !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  @page {
    margin: 0;
    size: auto;
  }

  .container {
    max-width: 100% !important;
    width: 80mm !important; /* largura padrão do papel térmico */
    margin: 0 auto !important;
    padding: 10px !important;
  }

  /* Ocultar elementos desnecessários no cupom impresso */
  .header,
  #loading,
  #error,
  .status-card,
  .pix-code-container,
  .qrcode-actions,
  .actions,
  .historico,
  .info-card h3,
  .modal {
    display: none !important;
  }

  /* Ajustar cartões de informação para impressão */
  .info-card,
  .qrcode-card {
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 0 10px 0 !important;
    border-radius: 0 !important;
    border: none !important;
  }

  .info-item {
    background: transparent !important;
    padding: 5px 0 !important;
    border-bottom: 1px dashed #000 !important;
    border-radius: 0 !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  .info-item:hover {
    transform: none !important;
  }

  .label {
    color: #000 !important;
    font-weight: bold !important;
  }

  .value {
    color: #000 !important;
  }

  .valor {
    color: #000 !important;
    font-size: 1.2rem !important;
    font-weight: 900 !important;
  }

  .qrcode-wrapper {
    background: transparent !important;
    padding: 10px 0 !important;
    border-radius: 0 !important;
  }

  #qrcode-image {
    max-width: 55mm !important; /* cabe perfeitamente no cupom de 80mm */
    height: auto !important;
    box-shadow: none !important;
    display: block !important;
    margin: 0 auto !important;
  }

  /* Cabeçalho do cupom */
  .info-card::before {
    content: "COMPROVANTE PIX - PORTAL DISTRIBUIDORA";
    display: block !important;
    text-align: center !important;
    font-weight: bold !important;
    font-size: 0.9rem !important;
    margin-bottom: 10px !important;
    border-bottom: 2px solid #000 !important;
    padding-bottom: 5px !important;
  }
}