/* LIVE ROUTE MINI CSS */
.mf-route-live-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 1000;
    background: #FF0000;
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(255,0,0,0.3);
    cursor: pointer;
}
.mf-route-dot {
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    animation: pulse 1s infinite alternate;
}
@keyframes pulse {
    from { opacity: 0.5; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1.1); }
}

/* Incident Floating Sheet */
.mf-route-sheet {
    position: fixed;
    bottom: -100%;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    background: #fff;
    z-index: 400;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
    transition: bottom 0.3s cubic-bezier(0.2, 0.8, 0.3, 1);
    display: flex;
    flex-direction: column;
    padding: 14px 16px 14px;
    box-sizing: border-box;
    max-height: calc(100dvh - var(--mini-header, 54px) - var(--mini-status, 32px) - var(--mf-mini-bottom-nav-height, var(--mini-nav, 64px)) - env(safe-area-inset-bottom, 0px) - 20px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.mf-route-sheet.is-open {
    bottom: calc(var(--mf-mini-bottom-nav-height, var(--mini-nav, 64px)) + env(safe-area-inset-bottom, 0px));
}
.mf-route-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.mf-route-sheet-header h4 {
    margin: 0;
    font-size: 16px;
    color: #0F172A;
}
.mf-route-sheet-close {
    background: none;
    border: none;
    color: #003DA5;
    font-size: 14px;
    cursor: pointer;
}

.mf-route-feed-horizontal {
    display: flex !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    gap: 12px !important;
    padding: 4px 16px 10px 16px !important;
    margin: 0 -16px !important;
    scrollbar-width: none;
}
.mf-route-feed-horizontal::-webkit-scrollbar {
    display: none;
}
.mf-route-feed-horizontal > div:only-child {
    padding: 12px 16px !important;
    font-size: 13px !important;
    color: #64748B !important;
    text-align: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Incident Card */
.mf-route-feed-item {
    flex: 0 0 256px !important;
    width: 256px !important;
    min-width: 256px !important;
    max-width: 268px !important;
    background: #FFFFFF !important;
    border-radius: 12px !important;
    border: 1px solid #E2E8F0 !important;
    padding: 10px !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
    text-decoration: none !important;
    color: #0F172A !important;
    overflow: hidden !important;
    scroll-snap-align: start;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    border-bottom: 1px solid #E2E8F0 !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.mf-route-feed-item:active {
    transform: scale(0.98);
}

/* Image Thumbnail Left */
.mf-route-feed-item > img,
.mf-route-feed-item > div:first-child:not([style*="flex:1"]) {
    width: 86px !important;
    height: 86px !important;
    min-width: 86px !important;
    max-width: 86px !important;
    border-radius: 8px !important;
    object-fit: cover !important;
    flex-shrink: 0 !important;
    background: #F1F5F9;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Content Container Right */
.mf-route-feed-item > div[style*="flex:1"],
.mf-route-feed-item > div:nth-child(2) {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    height: 86px !important;
}

/* Badges Row */
.mf-route-feed-item > div[style*="flex:1"] > div:first-child {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    margin-bottom: 2px !important;
    flex-wrap: nowrap !important;
    overflow: hidden !important;
}
.mf-route-feed-item > div[style*="flex:1"] > div:first-child > span {
    display: inline-flex !important;
    align-items: center !important;
    white-space: nowrap !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    line-height: 1.2 !important;
    flex-shrink: 0 !important;
}

/* Title (max 2 lines) */
.mf-route-feed-item > div[style*="flex:1"] > div:nth-child(2) {
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    color: #0F172A !important;
    margin-bottom: 2px !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Description (1 line) */
.mf-route-feed-item > div[style*="flex:1"] > div:nth-child(3) {
    font-size: 11px !important;
    line-height: 1.25 !important;
    color: #64748B !important;
    margin-bottom: 4px !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 1 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Metadata Row (Distance & Relative Time) */
.mf-route-feed-item > div[style*="flex:1"] > div:nth-child(4) {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 10px !important;
    color: #64748B !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    margin-top: auto !important;
}
.mf-route-feed-item > div[style*="flex:1"] > div:nth-child(4) > span {
    display: inline-flex !important;
    align-items: center !important;
    gap: 3px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
}

/* Hide trailing > chevron on cards to maximize usable horizontal text width */
.mf-route-feed-item > div:last-child:not([style*="flex:1"]) {
    display: none !important;
}

.mf-route-feed-info {
    padding: 8px;
}
.mf-route-feed-info strong {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mf-route-feed-info small {
    display: block;
    color: #64748B;
    font-size: 11px;
}
.mf-route-tag {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #FF0000;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
.mf-route-tag.is-verified {
    background: #003DA5;
}
.mf-route-tag.is-pending {
    background: #FFC400;
    color: #000;
}

.mf-route-report-actions h5 {
    margin: 8px 0 8px;
    font-size: 14px;
    color: #0F172A;
}
.mf-route-actions-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
}
.mf-route-action-btn {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #F1F5F9;
    border: none;
    border-radius: 12px;
    padding: 10px 12px;
    min-width: 80px;
    cursor: pointer;
}
.mf-route-action-btn.is-primary {
    background: #E8F0FF;
    min-width: 120px;
}
.mf-route-action-btn.is-primary b {
    color: #003DA5;
}
.mf-route-action-btn img {
    width: 24px;
    height: 24px;
    margin-bottom: 8px;
}
.mf-route-action-btn .emoji {
    font-size: 24px;
    margin-bottom: 8px;
}
.mf-route-action-btn b {
    font-size: 13px;
    color: #334155;
}
.mf-route-action-btn span {
    font-size: 10px;
    color: #64748B;
}

/* Modal Backdrop */
.mf-route-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 99998 !important;
}

/* Modal Card */
.mf-route-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(400px, calc(100% - 32px));
    max-width: 400px;
    max-height: calc(100dvh - 40px);
    background: #FFFFFF;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 99999 !important;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Modal Header: Sticky at top of modal card, never scrolls off */
.mf-route-modal-header {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    background: #FFFFFF;
    border-bottom: 1px solid #E2E8F0;
    box-sizing: border-box;
}

.mf-route-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #0F172A;
    line-height: 1.3;
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Close Button:
   - top-right inside modal header
   - touch target minimum 40x40px
   - white/light background
   - dark blue icon/text (#003DA5)
   - subtle border/shadow
   - circular
   - z-index above modal content
*/
.mf-route-modal-close {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    margin: 0;
    border: 1px solid #CBD5E1;
    border-radius: 50%;
    background: #FFFFFF;
    color: #003DA5;
    font-size: 18px;
    font-weight: 700;
    font-family: inherit, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    transition: background-color 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
    z-index: 25;
    -webkit-tap-highlight-color: transparent;
}

.mf-route-modal-close:hover {
    background: #F8FAFC;
    border-color: #94A3B8;
}

.mf-route-modal-close:active {
    background: #E8F0FF;
    transform: scale(0.92);
}

/* Modal Body: Only this scrolls internally */
.mf-route-modal-body {
    flex: 1 1 auto;
    padding: 16px 18px 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    overscroll-behavior: contain;
}
.mf-form-group {
    margin-bottom: 12px;
}
.mf-form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 600;
}
.mf-form-group input[type="text"], .mf-form-group select, .mf-form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #CBD5E1;
    border-radius: 8px;
    font-family: inherit;
}
.mf-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}
.mf-btn-primary {
    background: #003DA5;
    color: #fff;
}
.mf-btn-primary:disabled {
    background: #CBD5E1;
    cursor: not-allowed;
}
.mf-route-gps-status {
    font-size: 12px;
    color: #64748B;
    margin-bottom: 12px;
    text-align: center;
}
