/* Estilos adicionales para PestOS */

/* Eliminar flash azul nativo en tap para todos los elementos (iOS Safari / Chrome) */
* {
  -webkit-tap-highlight-color: transparent !important;
}

/* Ocultar scrollbar nativo (se usa indicador custom en su lugar) */
.no-scrollbar {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

/* Safe area for notch devices (iPhone X+) */
.safe-area-top {
  padding-top: env(safe-area-inset-top, 0);
}
.safe-area-bottom {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Smooth page transitions */
@media (prefers-reduced-motion: no-preference) {
  main {
    animation: fadeIn 0.2s ease-out;
  }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Animación 🚗 badge "En camino" */
@keyframes encamino-bounce {
  0%, 100% { transform: translateX(0); }
  30%       { transform: translateX(3px); }
  70%       { transform: translateX(-2px); }
}
.icon-encamino {
  display: inline-block;
  animation: encamino-bounce 0.9s ease-in-out infinite;
}

/* Animación 🔧 badge "En proceso" */
@keyframes enproceso-pulse {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50%       { transform: scale(1.25) rotate(-10deg); }
}
.icon-enproceso {
  display: inline-block;
  animation: enproceso-pulse 1.4s ease-in-out infinite;
}

/* ─── Botones de cambio de estado del técnico ─────────────────────────────── */
@keyframes btn-road-shine {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

/* Botón "Estoy en camino" — azul eléctrico con shimmer */
.btn-encamino {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 50%, #1e40af 100%);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow:
    0 4px 14px rgba(37, 99, 235, 0.45),
    0 1px 3px rgba(37, 99, 235, 0.3),
    inset 0 1px 0 rgba(255,255,255,0.15);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.btn-encamino::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255,255,255,0.18) 50%,
    transparent 60%
  );
  background-size: 200% 100%;
  animation: btn-road-shine 2.4s linear infinite;
}
.btn-encamino:hover {
  transform: translateY(-2px);
  box-shadow:
    0 7px 20px rgba(37, 99, 235, 0.55),
    0 2px 6px rgba(37, 99, 235, 0.35),
    inset 0 1px 0 rgba(255,255,255,0.2);
  filter: brightness(1.08);
}
.btn-encamino:active {
  transform: scale(0.97) translateY(0);
  box-shadow:
    0 2px 8px rgba(37, 99, 235, 0.4),
    inset 0 1px 0 rgba(255,255,255,0.1);
}

/* Botón "Llegué al servicio" — verde esmeralda con pulso suave */
.btn-enproceso {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #059669 0%, #047857 50%, #065f46 100%);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow:
    0 4px 14px rgba(5, 150, 105, 0.45),
    0 1px 3px rgba(5, 150, 105, 0.3),
    inset 0 1px 0 rgba(255,255,255,0.15);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.btn-enproceso::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255,255,255,0.16) 50%,
    transparent 60%
  );
  background-size: 200% 100%;
  animation: btn-road-shine 2.8s linear infinite;
}
.btn-enproceso:hover {
  transform: translateY(-2px);
  box-shadow:
    0 7px 20px rgba(5, 150, 105, 0.55),
    0 2px 6px rgba(5, 150, 105, 0.35),
    inset 0 1px 0 rgba(255,255,255,0.2);
  filter: brightness(1.08);
}
.btn-enproceso:active {
  transform: scale(0.97) translateY(0);
  box-shadow:
    0 2px 8px rgba(5, 150, 105, 0.4),
    inset 0 1px 0 rgba(255,255,255,0.1);
}

/* ════════════════════════════════════════════════════════════════
   BLOQUEO VISUAL — botones inhabilitados (estado pendiente / en_camino)
   Usado en Reporte / Reporte rápido / Reagendar cuando aplican.
═══════════════════════════════════════════════════════════════════ */
.btn-locked {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%) !important;
  color: #94a3b8 !important;
  border: 1px dashed #cbd5e1 !important;
  cursor: help !important;
  box-shadow: none !important;
  pointer-events: auto;
  position: relative;
  opacity: 0.95;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.btn-locked:hover {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%) !important;
  color: #1d4ed8 !important;
  border-color: #93c5fd !important;
  transform: none !important;
}
.btn-locked:active {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%) !important;
  transform: scale(0.985) !important;
}
.btn-locked > svg {
  color: inherit;
}

/* ════════════════════════════════════════════════════════════════
   CARD STATUS CORNER — animaciones esquina superior derecha
   La card padre debe tener `position: relative`.
═══════════════════════════════════════════════════════════════════ */
.card-status-corner {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem 0.3rem 0.4rem;
  border-radius: 9999px;
  pointer-events: none;
  isolation: isolate;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1;
}
.card-status-corner__icon {
  position: relative;
  z-index: 2;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.18));
}
.card-status-corner__label {
  position: relative;
  z-index: 2;
  white-space: nowrap;
}
.card-status-corner__pulse {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  z-index: 1;
}

/* ── EN CAMINO — fondo ámbar + icono camión rebotando ── */
.card-status-corner--encamino {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid #fcd34d;
  box-shadow: 0 4px 12px -3px rgba(217, 119, 6, 0.45);
  animation: corner-encamino-bounce 1.2s ease-in-out infinite;
}
.card-status-corner--encamino .card-status-corner__icon {
  color: #b45309;
  animation: corner-truck-roll 1.5s ease-in-out infinite;
}
.card-status-corner--encamino .card-status-corner__pulse {
  background: rgba(251, 191, 36, 0.55);
  animation: corner-pulse-ring 1.6s ease-out infinite;
}
@keyframes corner-encamino-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
@keyframes corner-truck-roll {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(2px); }
}
@keyframes corner-pulse-ring {
  0% { transform: scale(0.85); opacity: 0.7; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* ── EN PROCESO — fondo esmeralda + fumigador con spray ── */
.card-status-corner--enproceso {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  border: 1px solid #6ee7b7;
  box-shadow: 0 4px 12px -3px rgba(5, 150, 105, 0.45);
}
.card-status-corner--enproceso .card-status-corner__icon {
  color: #047857;
  transform-origin: 70% 65%;
  animation: corner-fumigador-wiggle 1.6s ease-in-out infinite;
}
@keyframes corner-fumigador-wiggle {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

/* Partículas spray emergiendo desde la lanza */
.card-status-corner__spray {
  position: absolute;
  top: 35%;
  right: -2px;
  width: 5px;
  height: 5px;
  border-radius: 9999px;
  background: radial-gradient(circle, #6ee7b7 0%, rgba(110,231,183,0) 70%);
  z-index: 3;
  opacity: 0;
  animation: corner-spray-puff 1.6s ease-out infinite;
}
.card-status-corner__spray--2 {
  top: 45%;
  width: 4px;
  height: 4px;
  animation-delay: 0.4s;
}
.card-status-corner__spray--3 {
  top: 28%;
  width: 3px;
  height: 3px;
  animation-delay: 0.85s;
}
@keyframes corner-spray-puff {
  0% { opacity: 0; transform: translate(0, 0) scale(0.6); }
  30% { opacity: 0.85; }
  100% { opacity: 0; transform: translate(8px, 1px) scale(1.6); }
}

@media (prefers-reduced-motion: reduce) {
  .card-status-corner,
  .card-status-corner__icon,
  .card-status-corner__pulse,
  .card-status-corner__spray,
  .card-status-corner__label {
    animation: none !important;
  }
}

/* Anchor target highlight — al saltar a #visita-XX desde notificaciones */
:target.visita-card,
.visita-card.visita-card--highlight {
  outline: 3px solid #f59e0b;
  outline-offset: 4px;
  animation: visita-card-flash 1.8s ease-out 1;
}
@keyframes visita-card-flash {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55); }
  60% { box-shadow: 0 0 0 14px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* PWA standalone mode tweaks */
@media (display-mode: standalone) {
  body {
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  /* Allow text selection in inputs and textareas */
  input, textarea, [contenteditable] {
    -webkit-user-select: text;
    user-select: text;
  }
}

/* Historial de reportes: panel operativo — paleta esmeralda */
.reportes-shell {
  --rep-ink: #0f172a;
  --rep-accent: #10b981;
}

.reportes-hero {
  background:
    radial-gradient(circle at 12% 25%, rgba(16, 185, 129, 0.35), transparent 38%),
    radial-gradient(circle at 85% 18%, rgba(52, 211, 153, 0.22), transparent 45%),
    linear-gradient(135deg, #064e3b, #065f46 50%, #047857);
  box-shadow: 0 22px 42px -30px rgba(5, 150, 105, 0.7);
}

.reportes-hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, black 25%, transparent 95%);
}

.reporte-card {
  background: linear-gradient(180deg, #ffffff, #f0fdf4);
  border: 1px solid #d1fae5;
  box-shadow: 0 14px 30px -24px rgba(15, 23, 42, 0.3);
}

.reporte-card:hover {
  transform: translateY(-1px);
  border-color: #a7f3d0;
  box-shadow: 0 20px 35px -26px rgba(5, 150, 105, 0.35);
}

.date-chip {
  color: var(--rep-ink);
  background: linear-gradient(160deg, rgba(16, 185, 129, 0.15), rgba(52, 211, 153, 0.07));
  border: 1px solid rgba(16, 185, 129, 0.22);
  border-radius: 999px;
  padding: 0.38rem 0.68rem;
}

.status-pill {
  font-weight: 700;
}

.status-pill-ok {
  color: #047857;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.status-pill-warn {
  color: #b45309;
  background: rgba(251, 146, 60, 0.14);
  border: 1px solid rgba(251, 146, 60, 0.25);
}

.reportes-btn-primary {
  color: #fff;
  border: 0;
  background: linear-gradient(120deg, #059669, #047857);
  box-shadow: 0 10px 16px -12px rgba(5, 150, 105, 0.7);
}

.reportes-btn-primary:hover {
  filter: brightness(1.06);
}

.empty-reportes {
  background: linear-gradient(180deg, #ffffff, #f0fdf4);
  border: 1px dashed #a7f3d0;
}

@media (prefers-reduced-motion: no-preference) {
  .reporte-card {
    animation: reportCardEnter 260ms ease-out both;
  }
  .reporte-card:nth-child(2) { animation-delay: 40ms; }
  .reporte-card:nth-child(3) { animation-delay: 80ms; }
  .reporte-card:nth-child(4) { animation-delay: 120ms; }
}

@keyframes reportCardEnter {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Dashboard: visitas atrasadas */
.dashboard-overdue-card {
  background:
    radial-gradient(circle at top right, rgba(254, 226, 226, 0.85), transparent 34%),
    linear-gradient(180deg, #ffffff, #fff8f8);
  box-shadow: 0 18px 36px -30px rgba(239, 68, 68, 0.32);
}

.dashboard-overdue-chip {
  color: #b91c1c;
  background: linear-gradient(180deg, #fff1f2, #ffe4e6);
  border: 1px solid rgba(252, 165, 165, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.dashboard-overdue-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.dashboard-overdue-btn {
  min-height: 2.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.8rem 0.95rem;
  border-radius: 0.95rem;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  text-align: center;
  transition: all 180ms ease-out;
  cursor: pointer;
}

.dashboard-overdue-btn-primary {
  color: #fff;
  background: linear-gradient(120deg, #ef4444, #dc2626);
  box-shadow: 0 14px 20px -16px rgba(220, 38, 38, 0.9);
}
.dashboard-overdue-btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 16px 24px -14px rgba(220, 38, 38, 0.95);
}

.dashboard-overdue-btn-quick {
  color: #c2410c;
  background: linear-gradient(180deg, #fff7ed, #ffedd5);
  border: 1px solid rgba(251, 146, 60, 0.4);
}
.dashboard-overdue-btn-quick:hover {
  background: linear-gradient(180deg, #ffedd5, #fed7aa);
  border-color: rgba(251, 146, 60, 0.65);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px -8px rgba(234, 88, 12, 0.3);
}

.dashboard-overdue-btn-soft {
  color: #0f766e;
  background: linear-gradient(180deg, #f0fdfa, #ccfbf1);
  border: 1px solid rgba(45, 212, 191, 0.45);
}
.dashboard-overdue-btn-soft:hover {
  background: linear-gradient(180deg, #ccfbf1, #99f6e4);
  border-color: rgba(45, 212, 191, 0.7);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px -8px rgba(13, 148, 136, 0.3);
}

.dashboard-overdue-btn-whatsapp {
  color: #0f5132;
  background: linear-gradient(180deg, #ecfdf3, #d1fae5);
  border: 1px solid rgba(16, 185, 129, 0.42);
}
.dashboard-overdue-btn-whatsapp:hover {
  background: linear-gradient(180deg, #d1fae5, #a7f3d0);
  border-color: rgba(16, 185, 129, 0.65);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px -8px rgba(5, 150, 105, 0.3);
}

.dashboard-overdue-btn-danger {
  color: #b91c1c;
  background: #fff;
  border: 1px solid rgba(248, 113, 113, 0.45);
}
.dashboard-overdue-btn-danger:hover {
  background: #fef2f2;
  border-color: rgba(248, 113, 113, 0.7);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px -8px rgba(220, 38, 38, 0.25);
}

@media (prefers-reduced-motion: no-preference) {
  .dashboard-overdue-card {
    animation: dashboardCardEnter 260ms ease-out both;
  }
  .dashboard-overdue-card:nth-child(2) { animation-delay: 45ms; }
  .dashboard-overdue-card:nth-child(3) { animation-delay: 90ms; }
}

@keyframes dashboardCardEnter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
