/* ================================================================
   PANEL BODY: desktop layout vs. mobile summary (Change 4)
   .pw-desktop-only -> oculto en mobile (ver @media abajo)
   .pw-mobile-only  -> oculto en desktop, visible solo en mobile
   This must be OUTSIDE any @media query
================================================================ */
.pw-mobile-only {
  display: none !important; /* hidden on desktop always */
}

/* ═══════════════════════════════════════════════
   Polarix Way — Public CSS  v1.2.0
   NOTA: El layout crítico (split, panel, mapa)
   usa inline styles en PHP para ser inmune al
   tema WoodMart y a LiteSpeed Cache CSS.
   Este archivo solo maneja estilos secundarios.
═══════════════════════════════════════════════ */

/* ── Reset mínimo ── */
#pwTrackingApp, #pwTrackingApp *, #pwTrackingApp *::before, #pwTrackingApp *::after {
  box-sizing: border-box !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
}
#pwTrackingApp h1, #pwTrackingApp h2, #pwTrackingApp h3 {
  margin: 0 !important; padding: 0 !important; font-weight: 700 !important;
}
#pwTrackingApp p  { margin: 0 !important; padding: 0 !important; }
#pwTrackingApp ul { margin: 0 !important; padding: 0 !important; list-style: none !important; }
#pwTrackingApp a  { text-decoration: none !important; }
#pwTrackingApp button { font-family: inherit !important; cursor: pointer !important; }

/* ── Keyframes ── */
@keyframes pwFadeIn  { from{opacity:0} to{opacity:1} }
@keyframes pwSlideUp { from{opacity:0;transform:translateY(16px)} to{opacity:1;transform:none} }
@keyframes pwPulse   { 0%,100%{transform:scale(1);opacity:.7} 50%{transform:scale(1.6);opacity:0} }

/* ── Pantalla búsqueda ── */
#pwTrackingApp .pw-search-screen {
  display: flex !important; align-items: center !important;
  justify-content: center !important; min-height: 60vh !important; padding: 40px 20px !important;
}
#pwTrackingApp .pw-search-card {
  background: #fff !important; border-radius: 12px !important;
  padding: 48px 40px !important; max-width: 440px !important; width: 100% !important;
  box-shadow: 0 8px 32px rgba(0,0,0,.12) !important; text-align: center !important;
  animation: pwSlideUp .4s cubic-bezier(.16,1,.3,1) both !important;
}
#pwTrackingApp .pw-search-icon  { width:52px !important;height:52px !important;margin:0 auto 20px !important;color:#374151 !important; }
#pwTrackingApp .pw-search-title { font-size:22px !important;font-weight:700 !important;color:#111827 !important;margin-bottom:8px !important; }
#pwTrackingApp .pw-search-sub   { color:#6b7280 !important;font-size:14px !important;line-height:1.6 !important;margin-bottom:24px !important; }
#pwTrackingApp .pw-search-form  { display:flex !important;flex-direction:column !important;gap:10px !important; }
#pwTrackingApp .pw-search-input {
  width:100% !important; padding:12px 16px !important; font-size:15px !important;
  font-weight:600 !important; letter-spacing:2px !important; text-transform:uppercase !important;
  border:1.5px solid #d1d5db !important; border-radius:8px !important;
  background:#f9fafb !important; color:#111827 !important; outline:none !important;
  transition:border-color .15s,box-shadow .15s !important;
}
#pwTrackingApp .pw-search-input:focus {
  border-color:#2563eb !important; box-shadow:0 0 0 3px rgba(37,99,235,.1) !important;
}
#pwTrackingApp .pw-search-btn {
  display:flex !important; align-items:center !important; justify-content:center !important;
  gap:8px !important; background:#111827 !important; color:#fff !important;
  border-radius:8px !important; padding:12px 20px !important;
  font-size:14px !important; font-weight:600 !important; border:none !important;
  transition:background .15s !important;
}
#pwTrackingApp .pw-search-btn:hover { background:#1f2937 !important; }
#pwTrackingApp .pw-search-error { color:#ef4444 !important;font-size:13px !important;margin-top:6px !important; }

/* ── Not found ── */
#pwTrackingApp .pw-not-found { text-align:center !important;padding:80px 20px !important; }
#pwTrackingApp .pw-nf-icon   { font-size:52px !important;margin-bottom:16px !important; }
#pwTrackingApp .pw-btn-back  {
  display:inline-block !important; margin-top:16px !important;
  padding:9px 20px !important; background:#111827 !important; color:#fff !important;
  border-radius:8px !important; font-size:14px !important; font-weight:500 !important;
}

/* ── Mapa: overlay "ubicacion no disponible" + blur (Change 2) ──
   #pwMapCol.pw-map-pending  -> aun no se revela el centro de despacho: mapa borroso + overlay con reloj
   #pwMapCol.pw-map-blurred  -> pedido entregado: mapa borroso, sin overlay (ya no se muestra al repartidor) */
.pw-map-overlay {
  position: absolute !important; inset: 0 !important; z-index: 5 !important;
  display: none !important; flex-direction: column !important;
  align-items: center !important; justify-content: center !important;
  gap: 14px !important; text-align: center !important; padding: 24px !important;
  background: rgba(245,245,245,.85) !important;
}
#pwMapCol.pw-map-pending .pw-map-overlay { display: flex !important; }
#pwMapCol.pw-map-pending #pwMap,
#pwMapCol.pw-map-blurred #pwMap {
  filter: blur(16px) !important;
  transition: filter .8s ease !important;
}
.pw-map-overlay-text {
  font-size: 14px !important; font-weight: 600 !important; color: #6b7280 !important;
  max-width: 220px !important; line-height: 1.5 !important;
}
.pw-clock-hand     { transform-origin: 24px 24px !important; }
.pw-clock-hand-min { animation: pwClockTick 6s linear infinite !important; }
.pw-clock-hand-hr  { animation: pwClockTick 72s linear infinite !important; }
@keyframes pwClockTick { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ── Timeline mobile (Change 4): centro de despacho -> vehiculo -> destino ── */
.pw-timeline { display: flex !important; align-items: center !important; gap: 10px !important; margin: 18px 0 !important; }
.pw-timeline-icon {
  width: 34px !important; height: 34px !important; border-radius: 50% !important; flex-shrink: 0 !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  background: #e5e7eb !important; color: #9ca3af !important;
  transition: background .4s ease, color .4s ease !important;
}
.pw-timeline-icon-done { background: #111827 !important; color: #fff !important; }
.pw-timeline-track {
  position: relative !important; flex: 1 !important; height: 4px !important;
  background: #e5e7eb !important; border-radius: 2px !important;
}
.pw-timeline-fill {
  /* width SIN !important: JS la anima via style inline */
  position: absolute !important; top: 0 !important; left: 0 !important; height: 100% !important;
  width: 0%; background: #111827 !important; border-radius: 2px !important;
  transition: width .6s ease !important;
}
.pw-timeline-vehicle {
  /* left SIN !important: JS lo mueve via style inline */
  position: absolute !important; top: 50% !important; left: 0%;
  transform: translate(-50%,-50%) !important;
  width: 26px !important; height: 26px !important; border-radius: 50% !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  box-shadow: 0 2px 6px rgba(0,0,0,.25) !important; transition: left .8s ease !important;
}

/* ── Resumen mobile: estado + ETA con relojito (Change 4 / Fix 4) ── */
.pw-mobile-status-row { display: flex !important; align-items: center !important; justify-content: space-between !important; gap: 12px !important; }
.pw-mobile-status-title { font-size: 20px !important; font-weight: 800 !important; color: #111827 !important; line-height: 1.3 !important; }
.pw-mobile-eta {
  display: inline-flex !important; align-items: center !important; gap: 5px !important;
  flex-shrink: 0 !important; color: #6b7280 !important;
}
.pw-mobile-eta-val { font-size: 13px !important; font-weight: 600 !important; color: #6b7280 !important; white-space: nowrap !important; }
.pw-mobile-eta.pw-eta-soon, .pw-mobile-eta.pw-eta-soon .pw-mobile-eta-val { color: #10b981 !important; }
.pw-mobile-items-title {
  display: block !important; font-size: 10px !important; font-weight: 700 !important; color: #9ca3af !important;
  text-transform: uppercase !important; letter-spacing: 1px !important; margin-bottom: 10px !important;
}

/* ── Pedido entregado: reemplaza el resumen "en camino" en el mismo lugar (Change 5 / Fix 3)
   Oculto por defecto; JS agrega .pw-visible recien cuando la entrega esta confirmada. ── */
.pw-mobile-delivered { display: none !important; }
.pw-mobile-delivered.pw-visible {
  display: flex !important; align-items: center !important; justify-content: space-between !important;
  gap: 12px !important; padding: 6px 0 !important; animation: pwFadeIn .45s ease both !important;
}
#pwMobileTrack.pw-hidden { display: none !important; }
/* Fade-out previo al reemplazo del bloque "en camino" */
.pw-fade-out { opacity: 0 !important; transition: opacity .35s ease !important; }
.pw-mobile-delivered-text { font-size: 19px !important; font-weight: 800 !important; color: #15803d !important; }
.pw-mobile-receipt-btn {
  display: inline-flex !important; align-items: center !important; gap: 6px !important; padding: 10px 16px !important;
  background: #111827 !important; color: #fff !important; border-radius: 8px !important;
  font-size: 13px !important; font-weight: 600 !important;
}

/* ── Moto marker ── */
.pw-moto-marker { background: transparent !important; border: none !important; }
.pw-moto-emoji  {
  font-size: 28px !important; line-height: 1 !important; display: block !important;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.35)) !important;
}

/* ── Dest pulse ── */
.pw-dest-pulse {
  width:20px !important; height:20px !important; border-radius:50% !important;
  background:#2563eb !important; border:3px solid #fff !important;
  position:relative !important;
}
.pw-dest-pulse::before, .pw-dest-pulse::after {
  content:'' !important; position:absolute !important; inset:-5px !important;
  border-radius:50% !important; border:2px solid #2563eb !important;
  animation:pwPulse 2s ease-out infinite !important;
}
.pw-dest-pulse::after { animation-delay:.7s !important; }

/* ── Leaflet overrides ── */
.leaflet-container { font-family:'Inter',sans-serif !important; background:#e8e8e8 !important; }
.leaflet-control-zoom a { color:#374151 !important; }

/* ── Responsive: en móvil apilar verticalmente ── */
/* Mobile bottom sheet: see below */

@media (max-width: 820px) {

  /* ── pw-hdr: OCULTO en mobile (mapa fullscreen, WoodMart header provee nav) ── */
  .pw-hdr { display: none !important; }

  /* ── #pwSplit: flujo normal, sin restricciones ── */
  #pwSplit {
    flex-direction : column !important;
    height         : auto !important;
    min-height     : 0 !important;
    padding        : 0 !important;
    gap            : 0 !important;
    overflow       : visible !important;
    background     : transparent !important;
  }

  /* ── Mapa: FULL-SCREEN fijo debajo del header del tema (z-index 1 < tema) ── */
  #pwMapCol {
    position      : fixed !important;
    top           : 0 !important;
    left          : 0 !important;
    right         : 0 !important;
    bottom        : 0 !important;
    width         : 100vw !important;
    height        : 100vh !important;
    border-radius : 0 !important;
    box-shadow    : none !important;
    z-index       : 1 !important;
    flex          : none !important;
  }
  #pwMap {
    width      : 100% !important;
    height     : 100% !important;
    min-height : 100vh !important;
  }

  /* ── Zoom control: reposicionar al centro-izquierda (evita solapamiento con header) ── */
  #pwMap .leaflet-top.leaflet-left {
    top       : 50% !important;
    bottom    : auto !important;
    transform : translateY(-50%) !important;
    left      : 10px !important;
  }

  /* ── Panel: tarjeta flotante compacta, por encima del toolbar del tema (Fix 1)
     bottom es un fallback: JS lo recalcula con la altura real del toolbar + 10px ── */
  #pwDetailPanel {
    position      : fixed !important;
    bottom        : 76px !important;  /* toolbar(~66) + margen 10px, igual al lateral */
    left          : 10px !important;
    right         : 10px !important;
    width         : auto !important;
    max-width     : calc(100% - 20px) !important;
    height        : auto !important;
    max-height    : 62vh !important;
    padding-bottom: 0 !important;
    min-height    : 0 !important;
    border-radius : 20px !important;
    box-shadow    : 0 6px 40px rgba(0,0,0,0.18) !important;
    z-index       : 700 !important;
    display       : flex !important;
    flex-direction: column !important;
    overflow-y    : auto !important;
    overflow-x    : hidden !important;
    flex-shrink   : 0 !important;
    background    : #fff !important;
    animation     : pwSlideUp .45s cubic-bezier(.16,1,.3,1) both !important;
  }

  /* ── Panel body: solo resumen mobile, ocultar layout de escritorio (Change 4) ── */
  .pw-desktop-only { display: none !important; }
  .pw-mobile-only  { display: block !important; }

  /* ── Header "Detalles" oculto: el titulo del estado encabeza el panel (Fix 1) ── */
  .pw-panel-header { display: none !important; }

  /* ── Padding interno del panel: el contenido no toca los bordes (Fix 2) ── */
  #pwMobilePanelBody { padding: 18px 20px 16px !important; }
}


/* ── Responsive basic ── */
@media (max-width: 480px) {
  .pw-search-card { padding: 32px 20px !important; }
  .pw-delivery-card { padding: 36px 24px !important; }
}
