/* Estilos personalizados y utilidades de PrestaPro */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --dark-bg: #0f172a;
}

html, body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  max-width: 100%;
}

/* Optimización Táctil y Responsiva para Móviles */
button, a, select, input, textarea {
  touch-action: manipulation;
}

@media (max-width: 640px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  select,
  textarea {
    font-size: 16px !important; /* Evita auto-zoom en iOS Safari */
  }
}

/* Modales responsivos: centrados en pantallas grandes, scroll completo sin recortes en móviles */
.modal-overlay {
  align-items: flex-start !important;
  padding-top: 0.75rem !important;
  padding-bottom: 0.75rem !important;
}

@media (min-width: 640px) {
  .modal-overlay {
    align-items: center !important;
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }
}

.modal-overlay > div {
  margin-top: auto;
  margin-bottom: auto;
  max-height: calc(100dvh - 1.5rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Safe area para barra inferior móvil */
.mobile-bottom-nav {
  padding-bottom: max(0.35rem, env(safe-area-inset-bottom));
}

/* Scrollbar estilizada */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Transiciones suaves */
.transition-all-custom {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Estilos de impresión para comprobantes / recibos térmicos 80mm y Formato A4 */
@media print {
  body * {
    visibility: hidden !important;
  }
  .no-print {
    display: none !important;
  }

  /* Impresión Modo Ticket 80mm (Térmico) */
  body.print-mode-80mm #receipt-view-80mm,
  body.print-mode-80mm #receipt-view-80mm * {
    visibility: visible !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  body.print-mode-80mm #receipt-view-80mm {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 78mm !important;
    max-width: 80mm !important;
    margin: 0 !important;
    padding: 3mm !important;
    font-size: 11px !important;
    background: #fff !important;
    border: none !important;
    box-shadow: none !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Impresión Modo Formato A4 */
  body.print-mode-a4 #receipt-view-a4,
  body.print-mode-a4 #receipt-view-a4 * {
    visibility: visible !important;
  }
  body.print-mode-a4 #receipt-view-a4 {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    max-width: 210mm !important;
    margin: 0 auto !important;
    padding: 5mm !important;
    font-size: 12px !important;
    color: #000 !important;
    background: #fff !important;
    border: none !important;
    box-shadow: none !important;
  }

  /* Impresión Reporte Gerencial Formal */
  body.print-mode-report #rep-formal-sheet,
  body.print-mode-report #rep-formal-sheet * {
    visibility: visible !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  body.print-mode-report #rep-formal-sheet {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 4mm !important;
    background: #fff !important;
    box-shadow: none !important;
    border: none !important;
  }

  /* Impresión Pequeño Reporte de Cierre de Caja */
  body.print-mode-closure #rep-closure-sheet,
  body.print-mode-closure #rep-closure-sheet * {
    visibility: visible !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  body.print-mode-closure #rep-closure-sheet {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    max-width: 148mm !important;
    margin: 0 auto !important;
    padding: 5mm !important;
    background: #fff !important;
    box-shadow: none !important;
    border: none !important;
  }

  @page {
    margin: 5mm;
  }
}

/* Pulso para cobros vencidos */
@keyframes pulse-subtle {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.02); }
}

.badge-pulse-danger {
  animation: pulse-subtle 2s infinite ease-in-out;
}

/* Map container styling */
#collections-map, #client-picker-map, #client-view-map {
  z-index: 10;
  width: 100%;
  border-radius: 0.75rem;
}

.leaflet-popup-content-wrapper {
  border-radius: 0.75rem !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
  padding: 4px !important;
}

.leaflet-popup-content {
  margin: 10px 12px !important;
  line-height: 1.4 !important;
}

/* Marcadores personalizados para el mapa */
.custom-map-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: white;
  font-weight: bold;
  font-size: 13px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
  border: 2px solid white;
}

/* Glassmorphism sutil */
.glass-panel {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
}

/* Optimización para tickets y exportación PDF nítida */
#receipt-view-80mm, #receipt-view-a4 {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Marcador GPS del Cobrador (Rutas en Vivo) */
.custom-collector-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2563eb;
  color: white;
  font-size: 20px;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.4), 0 6px 12px rgba(0, 0, 0, 0.35);
  border: 3px solid white;
  animation: pulse-collector 2s infinite ease-in-out;
  cursor: pointer;
}

@keyframes pulse-collector {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.8), 0 4px 8px rgba(0,0,0,0.3); transform: scale(1); }
  70% { box-shadow: 0 0 0 16px rgba(37, 99, 235, 0), 0 4px 8px rgba(0,0,0,0.3); transform: scale(1.05); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0), 0 4px 8px rgba(0,0,0,0.3); transform: scale(1); }
}

/* Estilos de panel de ruta flotante */
.route-panel-slide {
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}


