/* Customer Portal - Manifest Tracking Modal Styles (Mobile Optimized) */
#manifestTrackingModal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', 'Manrope', system-ui, -apple-system, sans-serif;
}

html[dir="rtl"] #manifestTrackingModal {
    direction: rtl !important;
}

html[dir="rtl"] #trackingMap {
    direction: ltr !important;
}

html[dir="rtl"] .manifest-trk-node-line {
    right: 13px;
    left: auto;
}

html[dir="rtl"] .manifest-trk-feed-list {
    padding-left: 0;
    padding-right: 6px;
}

html[dir="rtl"] .manifest-trk-feed-line {
    right: 14px;
    left: auto;
}

html[dir="rtl"] .manifest-trk-summary-item {
    border-right: none;
    border-left: 1px solid #f1f5f9;
}

html[dir="rtl"] .manifest-trk-summary-item:last-child {
    border-left: none;
}

#manifestTrackingModal.active,
#manifestTrackingModal:not(.hidden) {
    display: flex !important;
}

#manifestTrackingModal.hidden {
    display: none !important;
}

#manifestTrackingModal * {
    box-sizing: border-box;
}

.manifest-trk-dialog {
    background: #f8fafc;
    width: 100%;
    max-width: 1380px;
    height: 94vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.4);
}

@media (max-width: 1024px) {
    .manifest-trk-dialog {
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }
}

/* ==========================================================
   HEADER SECTION - CLEAN, DEDICATED MOBILE & DESKTOP DESIGN
   ========================================================== */
.manifest-trk-header {
    background: #ffffff;
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
    position: relative;
    z-index: 30;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.manifest-trk-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 12px;
}

.manifest-trk-brand-group {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.manifest-trk-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    flex-shrink: 0;
}

.manifest-trk-title-wrap {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.manifest-trk-subtitle {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.03em;
    line-height: 1.2;
}

.manifest-trk-title {
    margin: 0;
    font-size: 18px;
    font-weight: 900;
    color: #0f172a;
    letter-spacing: -0.02em;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.manifest-trk-title .num {
    color: #2563eb;
}

.manifest-trk-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.manifest-trk-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
    white-space: nowrap;
}

.manifest-trk-status-badge.arrived {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}

.manifest-trk-status-badge.pending {
    background: #f8fafc;
    color: #475569;
    border-color: #cbd5e1;
}

.manifest-trk-status-badge.delay {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

.manifest-trk-close-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border: none;
    border-radius: 10px;
    color: #475569;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.manifest-trk-close-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

.manifest-trk-print-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.manifest-trk-print-btn:hover {
    background: #f8fafc;
    color: #2563eb;
    border-color: #93c5fd;
}

@media (max-width: 640px) {
    .manifest-trk-print-btn {
        display: none;
    }
}

/* Secondary Meta Row: Chips */
.manifest-trk-chips-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
}

.manifest-trk-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 12px;
    color: #334155;
}

.manifest-trk-chip i {
    color: #64748b;
    font-size: 11px;
}

.manifest-trk-chip .chip-lbl {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
}

.manifest-trk-chip strong {
    font-weight: 800;
    color: #0f172a;
}

/* Distinct Transport Type Chip */
.manifest-trk-transport-chip {
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.manifest-trk-transport-chip.train {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}
.manifest-trk-transport-chip.train i {
    color: #2563eb;
}

.manifest-trk-transport-chip.sea {
    background: #ecfeff;
    border-color: #a5f3fc;
    color: #0e7490;
}
.manifest-trk-transport-chip.sea i {
    color: #0891b2;
}

.manifest-trk-transport-chip.air {
    background: #faf5ff;
    border-color: #e9d5ff;
    color: #7e22ce;
}
.manifest-trk-transport-chip.air i {
    color: #9333ea;
}

.manifest-trk-transport-chip.land {
    background: #fffbeb;
    border-color: #fde68a;
    color: #b45309;
}
.manifest-trk-transport-chip.land i {
    color: #d97706;
}

/* ==========================================================
   BODY LAYOUT
   ========================================================== */
.manifest-trk-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
    background: #f1f5f9;
}

@media (max-width: 1024px) {
    .manifest-trk-body {
        flex-direction: column;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Left Column: Map */
.manifest-trk-map-col {
    width: 68%;
    position: relative;
    z-index: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    flex-shrink: 0;
}

@media (max-width: 1024px) {
    .manifest-trk-map-col {
        width: 100%;
        height: 38vh;
        min-height: 260px;
        flex-shrink: 0;
    }
}

.manifest-trk-map {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 0;
    background: #e0f2fe;
}

/* Overlay summary cards (Desktop) */
.manifest-trk-overlay-cards {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    z-index: 400;
    pointer-events: none;
}

@media (max-width: 1024px) {
    .manifest-trk-overlay-cards {
        display: none;
    }
}

.manifest-trk-overlay-inner {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 16px 20px;
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.8);
    pointer-events: auto;
}

.manifest-trk-overlay-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.manifest-trk-summary-item {
    padding: 0 8px;
    border-right: 1px solid #f1f5f9;
}

.manifest-trk-summary-item:last-child {
    border-right: none;
}

.manifest-trk-summary-label {
    margin: 0 0 4px 0;
    font-size: 11px;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.manifest-trk-summary-val {
    margin: 0;
    font-size: 16px;
    font-weight: 900;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Right Column: Sidebar */
.manifest-trk-sidebar-col {
    width: 32%;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.04);
    position: relative;
    z-index: 10;
}

@media (max-width: 1024px) {
    .manifest-trk-sidebar-col {
        width: 100%;
        height: auto;
        flex: 1;
        overflow-y: visible;
        box-shadow: none;
    }
}

/* Current location hero */
.manifest-trk-hero {
    padding: 18px 20px;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.manifest-trk-hero-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.manifest-trk-loc-badge {
    margin: 0;
    font-size: 11px;
    font-weight: 800;
    color: #2563eb;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.manifest-trk-pulse-dot {
    position: relative;
    display: flex;
    width: 8px;
    height: 8px;
}

.manifest-trk-ping {
    position: absolute;
    display: inline-flex;
    height: 100%;
    width: 100%;
    border-radius: 999px;
    background: #60a5fa;
    opacity: 0.75;
    animation: manifestPing 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.manifest-trk-dot {
    position: relative;
    display: inline-flex;
    border-radius: 999px;
    width: 8px;
    height: 8px;
    background: #2563eb;
}

@keyframes manifestPing {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}

.manifest-trk-pct-badge {
    margin: 0;
    font-size: 11px;
    font-weight: 900;
    color: #2563eb;
    background: #eff6ff;
    border: 1px solid #dbeafe;
    padding: 2px 8px;
    border-radius: 6px;
}

.manifest-trk-current-loc {
    margin: 0 0 14px 0;
    font-size: 20px;
    font-weight: 900;
    color: #0f172a;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.manifest-trk-prog-wrap {
    position: relative;
    margin-bottom: 16px;
}

.manifest-trk-prog-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 6px;
}

.manifest-trk-prog-track {
    height: 8px;
    width: 100%;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.manifest-trk-prog-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3b82f6, #6366f1);
    border-radius: 999px;
    transition: width 1s ease-out;
    position: relative;
    overflow: hidden;
}

.manifest-trk-prog-shimmer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,0) 100%);
    animation: manifestShimmer 2s infinite;
}

@keyframes manifestShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ==========================================================
   PROMINENT LOGISTICS DATES (DEPARTURE & ETA CARDS)
   ========================================================== */
.manifest-trk-dates-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 4px;
}

.manifest-trk-date-box {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.manifest-trk-date-box.departure {
    border-color: #bfdbfe;
    background: #f8faff;
}

.manifest-trk-date-box.eta {
    border-color: #bbf7d0;
    background: #f6fdf9;
}

.manifest-trk-date-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.manifest-trk-date-box.departure .manifest-trk-date-icon {
    background: #dbeafe;
    color: #1d4ed8;
}

.manifest-trk-date-box.eta .manifest-trk-date-icon {
    background: #dcfce7;
    color: #15803d;
}

.manifest-trk-date-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.manifest-trk-date-title {
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.manifest-trk-date-val {
    font-size: 13px;
    font-weight: 800;
    color: #0f172a;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sections */
.manifest-trk-section {
    padding: 18px 20px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.manifest-trk-sec-title {
    margin: 0 0 14px 0;
    font-size: 11px;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ==========================================================
   ROUTE HIERARCHY WITH DATE TAGS
   ========================================================== */
.manifest-trk-route-list {
    display: flex;
    flex-direction: column;
}

.manifest-trk-node-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    position: relative;
    padding: 8px 0;
    z-index: 10;
}

.manifest-trk-node-line {
    position: absolute;
    left: 13px;
    top: 28px;
    bottom: -8px;
    width: 2px;
    background-color: #e2e8f0;
    z-index: 0;
}

.manifest-trk-node-line.completed {
    background-color: #10b981;
}

.manifest-trk-node-circle {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    z-index: 10;
    border: 1.5px solid #cbd5e1;
    background: #ffffff;
    color: #94a3b8;
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin-top: 2px;
}

.manifest-trk-node-circle.completed {
    background: #10b981;
    color: #ffffff;
    border-color: #059669;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.manifest-trk-node-circle.current {
    background: #2563eb;
    color: #ffffff;
    border-color: #1d4ed8;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
    outline: 4px solid #dbeafe;
}

.manifest-trk-node-text {
    flex: 1;
    min-width: 0;
}

.manifest-trk-node-text .node-name {
    font-size: 12px;
    font-weight: 800;
    color: #1e293b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.manifest-trk-node-text.current .node-name {
    color: #1d4ed8;
}

.manifest-trk-node-text .node-sub {
    font-size: 11px;
    color: #64748b;
    margin-top: 1px;
}

.manifest-trk-node-text .node-date-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}

.manifest-trk-node-text .node-date-tag.departure {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #dbeafe;
}


.manifest-trk-node-text .node-date-tag.eta {
    background: #f5f3ff;
    color: #6d28d9;
    border: 1px solid #ddd6fe;
}

.manifest-trk-node-text .node-date-tag.arrival {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

/* ==========================================================
   ACTIVITY FEED WITH STATUS UPDATES
   ========================================================== */
.manifest-trk-feed-list {
    position: relative;
    padding-left: 6px;
}

.manifest-trk-feed-item {
    position: relative;
    padding-bottom: 20px;
    z-index: 10;
}

.manifest-trk-feed-item:last-child {
    padding-bottom: 0;
}

.manifest-trk-feed-line {
    position: absolute;
    left: 14px;
    top: 26px;
    bottom: 0;
    width: 2px;
    background-color: #e2e8f0;
    z-index: 0;
}

.manifest-trk-feed-row {
    display: flex;
    gap: 12px;
    position: relative;
    z-index: 10;
}

.manifest-trk-feed-icon {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    margin-top: 1px;
}

.manifest-trk-feed-icon.emerald {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #059669;
}

.manifest-trk-feed-icon.blue {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #2563eb;
}

.manifest-trk-feed-icon.purple {
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
    color: #7c3aed;
}

.manifest-trk-feed-icon.amber {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #d97706;
}

.manifest-trk-feed-details {
    flex: 1;
}

.manifest-trk-feed-name {
    margin: 0;
    font-size: 13px;
    font-weight: 800;
    color: #1e293b;
    line-height: 1.3;
}

.manifest-trk-feed-desc {
    margin: 2px 0 0 0;
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
}

.manifest-trk-feed-time {
    margin-top: 5px;
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Leaflet Custom Elements */
.custom-node-marker {
    background: transparent !important;
    border: none !important;
}

.custom-node-marker-inner {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
    border: 2px solid #ffffff;
    transition: all 0.3s ease;
}

.custom-node-marker-inner.bg-emerald { background: #10b981; }
.custom-node-marker-inner.bg-blue { background: #2563eb; }
.custom-node-marker-inner.bg-gray { background: #64748b; }

.marker-current-node {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
    animation: pulseNodeRing 1.5s infinite;
}

@keyframes pulseNodeRing {
    0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7); }
    70% { box-shadow: 0 0 0 12px rgba(37, 99, 235, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.transport-marker-icon {
    background: transparent !important;
    border: none !important;
}

.sea-route-completed path {
    filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.6));
}

.sea-route-current path {
    filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.6));
}
