/* Shipment tracking: maps, badges, timeline. Uses the site's own CSS variables so theme changes apply. */
.trk-map { width: 100%; height: 460px; border-radius: 10px; border: 1px solid #ddd; z-index: 1; background: #e8eef5; }
.trk-map.tall { height: calc(100vh - 230px); min-height: 420px; }
.trk-vehicle, .trk-pin { background: transparent !important; border: 0 !important; }
.trk-vehicle-inner { transition: transform .25s linear; transform-origin: 50% 50%; }
.trk-popup { font-size: 13px; line-height: 1.5; }
.trk-label { font-size: 12px; font-weight: 600; max-width: 220px; white-space: normal; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.25); }

.trk-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; }
.trk-pending { background: #6c757d; } .trk-in_transit { background: #1e88e5; } .trk-paused { background: #ff9800; }
.trk-at_stop { background: #8e44ad; } .trk-delayed { background: #e53935; } .trk-delivered { background: #2e9d4f; } .trk-cancelled { background: #9e9e9e; }
.trk-route-none { background: #adb5bd; } .trk-route-queued { background: #17a2b8; } .trk-route-ready { background: #2e9d4f; } .trk-route-failed { background: #dc3545; }

.trk-bar { height: 8px; background: #e6e9ef; border-radius: 4px; overflow: hidden; min-width: 90px; }
.trk-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--secondary-color, #2a5298), var(--accent-color, #4a90e2)); }

.trk-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.trk-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.trk-stat { background: var(--bg-light, #f8f9fa); border-radius: 8px; padding: 10px 14px; }
.trk-stat small { display: block; color: var(--text-light, #666); font-size: 12px; }
.trk-stat b { font-size: 16px; }

.trk-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.trk-actions .btn[disabled] { opacity: .45; cursor: not-allowed; }
.trk-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 12px; }
.trk-inline .form-group { margin: 0; }

.trk-timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 3px solid #d7dde8; max-height: 420px; overflow: auto; }
.trk-timeline li { position: relative; padding: 0 0 14px 14px; }
.trk-timeline li::before { content: ''; position: absolute; left: -26px; top: 3px; width: 13px; height: 13px; border-radius: 50%; background: var(--accent-color, #4a90e2); border: 2px solid #fff; box-shadow: 0 0 0 2px #d7dde8; }
.trk-timeline li.delivered::before { background: #2e9d4f; } .trk-timeline li.delay::before, .trk-timeline li.delayed::before, .trk-timeline li.route_failed::before { background: #e53935; }
.trk-timeline li.paused::before { background: #ff9800; }
.trk-timeline time { display: block; font-size: 12px; color: var(--text-light, #666); }

.geo-block { position: relative; margin-bottom: 12px; }
.geo-results { list-style: none; margin: 2px 0 0; padding: 0; position: absolute; left: 0; right: 0; z-index: 2000; background: #fff; border: 1px solid #ccd; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.15); max-height: 230px; overflow: auto; }
.geo-results li { padding: 8px 12px; cursor: pointer; font-size: 13px; border-bottom: 1px solid #eee; }
.geo-results li:hover { background: var(--bg-light, #f3f6fb); }
.geo-picked { display: block; margin-top: 4px; color: var(--text-light, #666); font-size: 12px; }
.geo-picked.ok { color: #2e7d32; }
.wp-row { display: grid; grid-template-columns: 1fr 120px auto; gap: 8px; align-items: end; margin-bottom: 8px; padding: 10px; background: var(--bg-light, #f8f9fa); border-radius: 8px; }

.trk-live { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; }
.trk-list { max-height: calc(100vh - 230px); min-height: 300px; overflow: auto; }
.trk-list-item { padding: 10px 12px; border-bottom: 1px solid #eee; cursor: pointer; font-size: 13px; }
.trk-list-item:hover, .trk-list-item.active { background: var(--bg-light, #f3f6fb); }

/* public page */
.trk-public { max-width: 900px; margin: 0 auto 30px; background: #fff; border-radius: 15px; box-shadow: var(--shadow-lg, 0 20px 60px rgba(0,0,0,.15)); overflow: hidden; }
.trk-public-head { padding: 22px 28px; background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)); color: #fff; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: center; }
.trk-public-body { padding: 24px 28px; }

@media (max-width: 900px) {
    .trk-grid, .trk-live { grid-template-columns: minmax(0, 1fr); }
    .trk-map { height: 340px; }
    .trk-map.tall { height: 60vh; min-height: 320px; }
    .trk-list { max-height: 220px; }
    .wp-row { grid-template-columns: 1fr; }
    .trk-label { max-width: 130px; font-size: 11px; padding: 2px 5px; }
    .trk-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .trk-public-head, .trk-public-body { padding: 16px; }
}
/* Map credit collapsed to a small "i" (opens on hover / tap). The OpenStreetMap credit stays, as its licence requires. */
.leaflet-control-attribution.trk-attr { width: 20px; height: 20px; padding: 0; overflow: hidden; border-radius: 50%; background: rgba(255,255,255,.85); font-size: 0; cursor: pointer; margin: 0 6px 6px 0; }
.leaflet-control-attribution.trk-attr::before { content: 'i'; display: block; width: 20px; height: 20px; line-height: 20px; text-align: center; font: italic 700 13px Georgia, serif; color: #333; }
.leaflet-control-attribution.trk-attr.is-open { width: auto; height: auto; padding: 2px 8px; border-radius: 4px; font-size: 11px; background: rgba(255,255,255,.92); }
.leaflet-control-attribution.trk-attr.is-open::before { display: none; }
