body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 20px;
  background: #fff;
  font-size: 12px;
  color: #000;
}


/* ================= HEADER FACTURA ================= */
.header-factura {
  width: 100%;
  display: table;              /* PDF SAFE */
  margin-bottom: 15px;
}

.logo-factura {
  display: table-cell;
  width: 180px;
  vertical-align: middle;
  text-align: left;
}

.logo-factura img {
  max-width: 160px;
  height: auto;
}

.titulo-factura {
  display: table-cell;
  vertical-align: middle;
  text-align: center;
  font-weight: bold;
  font-size: 15px;
  text-transform: uppercase;
}


/* ================= CONTENEDOR PRINCIPAL ================= */
.container {
  max-width: 960px;
  margin: auto;
  border: 1px solid #ccc;
  padding: 30px 20px 20px 20px; /* protección superior */
  box-shadow: 0 0 5px rgba(0,0,0,0.1);
  background: #fff;
}

/* ================= TÍTULO ================= */
.title {
  text-align: center;
  font-weight: bold;
  font-size: 16px;
  margin-bottom: 20px;
  text-transform: uppercase;
}

/* ================= LOGO ================= */
.logo-section {
  width: 100%;
  text-align: center;
  margin-bottom: 15px;
  min-height: 90px; /* CLAVE para evitar cortes */
}

#logo-container img {
  max-width: 180px;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* ================= SECCIONES GENERALES ================= */
.section {
  border: 1px solid #ccc;
  padding: 10px;
  margin-top: 10px;
}

.section h4 {
  margin: 0 0 5px 0;
  font-size: 13px;
  font-weight: bold;
  color: #333;
}

.section p {
  margin: 2px 0;
}

/* ================= INFO + QR ================= */
.info-qr-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-top: 10px;
  border: 1px solid #ccc;
  padding: 10px;
}

.info-text {
  line-height: 1.2;
}

.info-text h4 {
  font-size: 13px;
  margin-bottom: 4px;
  border-bottom: 1px solid #ccc;
  padding-bottom: 2px;
  font-weight: bold;
}

.info-text p {
  margin: 2px 0;
}

/* ================= QR ================= */
.qr-codes {
  display: flex;
  justify-content: space-around;
  gap: 20px;
  margin-top: 10px;
}

.qr-item {
  text-align: center;
}

.qr-item img {
  width: 90px;
  display: block;
  margin: 0 auto;
}

.qr-text {
  margin-top: 5px;
  font-size: 10px;
  color: #333;
}

/* ================= EMISOR / RECEPTOR ================= */
.emisor-receptor {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 10px;
  font-family: Arial, sans-serif;
  font-size: 12px;
}

.emisor,
.receptor {
  flex: 1;
  border: 1px solid #ccc;
  padding: 8px 10px;
  line-height: 1.2;
}

.emisor h4,
.receptor h4 {
  font-size: 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid #ccc;
  padding-bottom: 2px;
  font-weight: bold;
}

.emisor p,
.receptor p {
  margin: 2px 0;
  padding: 0;
}

/* ================= TABLA ================= */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

table th,
table td {
  border: 1px solid #ccc;
  padding: 6px;
  text-align: center;
}

table thead {
  background-color: #f2f2f2;
}

/* ================= TOTALES ================= */
.total-container {
  text-align: right;
  margin-top: 10px;
  border: 1px solid #ccc;
  padding: 10px;
}

.totals {
  margin-top: 15px;
  font-size: 12px;
}

.totals p {
  margin: 2px 0;
  text-align: right;
}

/* ================= LETRAS ================= */
.letras-container {
  text-align: right;
  margin-top: 10px;
  border: 1px solid #ccc;
  padding: 10px;
}

/* ================= PIE ================= */
.footer {
  text-align: right;
  margin-top: 20px;
  font-weight: bold;
}

.quote {
  text-align: center;
  font-style: italic;
  margin-top: 30px;
  font-size: 12px;
  color: #444;
}

/* ================= BOTÓN FLOTANTE ================= */
.btn-flotante {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #2196f3;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 30px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  font-size: 16px;
  cursor: pointer;
  z-index: 9999;
  transition: background-color 0.3s ease;
}

.btn-flotante:hover {
  background-color: #0b7dda;
}


.btn-flotanteCorreo {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background-color: red;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 30px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  font-size: 16px;
  cursor: pointer;
  z-index: 9999;
  transition: background-color 0.3s ease;
}

.btn-flotanteCorreo:hover {
  background-color: orange;
}

/* ================= PDF / PRINT FIXES ================= */
.logo-section,
.info-qr-container,
.emisor-receptor,
table,
.total-container,
.letras-container {
  page-break-inside: avoid;
}

/* Ocultar botón en PDF */
@media print {
  .btn-flotante {
    display: none !important;
  }

  .btn-flotanteCorreo {
    display: none !important;
  }
   .titulo-factura {
    font-size: 14px;
  }

  .logo-factura img {
    max-width: 50px;
  }
}


@media print {

  /* ===== BASE ===== */
  body {
    font-size: 6px;
    padding: 0;

  }


  .container {
    padding: 10px; /* 🔽 menos aire arriba */
  }

  /* ===== HEADER COMPACTO ===== */
  .header-factura {
    margin-bottom: 6px;          /* 🔽 antes 15px */
  }

  .logo-factura {
    width: 50px;                /* 🔽 menos ancho */
  }

  .logo-factura img {
    max-width: auto;            /* 🔽 logo más chico */
  }

  .titulo-factura {
    font-size: 11px;             /* 🔽 título compacto */
    line-height: 1.1;            /* 🔽 menos altura */
    padding: 0;                  /* elimina aire */
  }

  /* ===== TEXTOS ===== */


   h4 { font-size: 6px; }
  p { font-size: 6px; }


  /* ===== INFO / QR ===== */
  .info-qr-container {
    padding: 6px;
    margin-top: 6px;
  }

  /* ===== EMISOR / RECEPTOR ===== */
  .emisor,
  .receptor {
    font-size: 9px;
    padding: 5px 6px;
    line-height: 1.15;
  }

  /* ===== TABLA ===== */
  table th,
  table td {
    font-size: 9px;
    padding: 3px;
  }

  /* ===== QR ===== */
  .qr-item img {
    width: 60px;                 /* 🔽 QR compacto */
  }

  .qr-text {
    font-size: 8px;
    margin-top: 2px;
  }

  /* ===== TOTALES ===== */
  .totals p {
    font-size: 9px;
    margin: 1px 0;
  }

  /* ===== LETRAS ===== */
  .letras-container {
    font-size: 9px;
    padding: 6px;
  }

  /* ===== OCULTAR BOTÓN ===== */
  .btn-flotante {
    display: none !important;
  }
}

/* ===== MODAL OVERLAY ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  animation: fadeIn 0.25s ease;
}

/* ===== CARD ===== */
.modal-card {
  width: 360px;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.25);
  font-family: "Segoe UI", sans-serif;
}

/* ===== HEADER ===== */
.modal-header {
  background: #2196f3;
  color: #fff;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

/* ===== BODY ===== */
.modal-body {
  padding: 20px;
}

.modal-text {
  font-size: 14px;
  color: #444;
  margin-bottom: 12px;
}

/* ===== INPUT ===== */
.modal-input {
  width: 92%;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 14px;
}

.modal-input:focus {
  outline: none;
  border-color: #2196f3;
  box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.15);
}

/* ===== FOOTER ===== */
.modal-footer {
  padding: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #f9f9f9;
}

/* ===== BOTONES ===== */
.btn-cancelar {
  background: #e0e0e0;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
}

.btn-cancelar:hover {
  background: #d6d6d6;
}

.btn-enviar {
  background: #2196f3;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.btn-enviar:hover {
  background: #0b7dda;
}

/* ===== ANIMACIÓN ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
