

<?php $__env->startSection('title', 'Track Shipment'); ?>

<?php $__env->startSection('content'); ?>
    <style>
        /* Color Variables with your brand color */
        :root {
            --primary: #fd5523;
            --primary-dark: #0099CC;
            --primary-light: #66D9FF;
            --primary-ultralight: rgba(0, 191, 255, 0.1);
            --secondary: #FF6B6B;
            --accent: #FFD166;
            --dark: #1a202c;
            --light: #F7FAFC;
            --gray: #718096;
            --light-gray: #E2E8F0;
            --success: #48BB78;
            --warning: #ED8936;
            --danger: #F56565;
            --border-radius: 16px;
            --border-radius-lg: 24px;
            --shadow: 0 10px 30px rgba(0, 191, 255, 0.15);
            --shadow-lg: 0 25px 50px rgba(0, 191, 255, 0.2);
            --transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }

        /* General Styles */
        .tracking-container {
            font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            line-height: 1.6;
            color: var(--dark);
            background: linear-gradient(135deg, #f0f9ff 0%, #e6f7ff 50%, #f0f9ff 100%);
            min-height: 100vh;
            position: relative;
            overflow-x: hidden;
        }

        /* Animated Background Elements */
        .floating-elements {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
            z-index: 0;
        }

        .floating-element {
            position: absolute;
            border-radius: 50%;
            background: rgba(0, 191, 255, 0.05);
            animation: float 20s infinite linear;
        }

        .floating-element:nth-child(1) {
            width: 300px;
            height: 300px;
            top: 10%;
            left: 5%;
            animation-duration: 25s;
        }

        .floating-element:nth-child(2) {
            width: 200px;
            height: 200px;
            top: 60%;
            right: 10%;
            animation-duration: 30s;
            animation-direction: reverse;
        }

        .floating-element:nth-child(3) {
            width: 150px;
            height: 150px;
            bottom: 20%;
            left: 15%;
            animation-duration: 35s;
        }

        @keyframes float {
            0% { transform: translate(0, 0) rotate(0deg); }
            33% { transform: translate(30px, -50px) rotate(120deg); }
            66% { transform: translate(-20px, 20px) rotate(240deg); }
            100% { transform: translate(0, 0) rotate(360deg); }
        }

        /* Main Content */
        .tracking-content {
            position: relative;
            z-index: 1;
        }

        /* Hero Section */
        .tracking-hero {
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
            color: white;
            padding: 3rem 0 5rem;
            position: relative;
            overflow: hidden;
            margin-bottom: 2rem;
            
        }

        .tracking-hero::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
            animation: backgroundShift 20s infinite linear;
        }

        @keyframes backgroundShift {
            0% { transform: translate(0, 0); }
            100% { transform: translate(60px, 60px); }
        }

        .tracking-hero-content {
            position: relative;
            z-index: 2;
        }

        .tracking-badge {
            display: inline-block;
            background: rgba(255, 255, 255, 0.2);
            backdrop-filter: blur(10px);
            border-radius: 50px;
            padding: 0.5rem 1.5rem;
            font-size: 0.9rem;
            margin-bottom: 1rem;
            border: 1px solid rgba(255, 255, 255, 0.3);
            font-weight: 600;
        }

        .tracking-title {
            font-size: 3rem;
            font-weight: 800;
            margin-bottom: 1rem;
            letter-spacing: -1px;
            line-height: 1.1;
        }

        .tracking-subtitle {
            font-size: 1.2rem;
            opacity: 0.9;
            margin-bottom: 2rem;
            max-width: 600px;
        }

        .tracking-card {
            background: rgba(255, 255, 255, 0.15);
            backdrop-filter: blur(15px);
            border-radius: var(--border-radius-lg);
            padding: 2.5rem;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
            margin-top: 2rem;
        }

        .tracking-number-display {
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
        }

        .tracking-number {
            font-size: 2.2rem;
            font-weight: 800;
            letter-spacing: 1px;
            margin-bottom: 1rem;
        }

        .barcode-container {
            background: white;
            padding: 1.5rem;
            border-radius: var(--border-radius);
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        }

        .scan-hint {
            font-size: 0.9rem;
            opacity: 0.8;
            margin-top: 1rem;
            text-align: center;
            width: 100%;
        }

        /* Status Card */
        .status-card {
            background: white;
            border-radius: var(--border-radius-lg);
            box-shadow: var(--shadow-lg);
            padding: 2.5rem;
            margin-bottom: 3rem;
            position: relative;
            overflow: hidden;
            border: 1px solid rgba(0, 191, 255, 0.1);
        }

        .status-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 6px;
            background: linear-gradient(to right, var(--primary), var(--success));
        }

        .status-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 2rem;
        }

        .status-title {
            font-size: 1.8rem;
            font-weight: 700;
            color: var(--dark);
            display: flex;
            align-items: center;
        }

        .status-title i {
            margin-right: 1rem;
            color: var(--primary);
            font-size: 2rem;
        }

        .status-badge {
            padding: 0.75rem 2rem;
            border-radius: 50px;
            font-weight: 700;
            text-transform: uppercase;
            font-size: 0.9rem;
            letter-spacing: 0.5px;
            background: var(--primary-ultralight);
            color: var(--primary-dark);
            animation: pulse 2s infinite;
            box-shadow: 0 5px 15px rgba(0, 191, 255, 0.3);
        }

        .status-content {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 2rem;
            align-items: center;
        }

        .status-progress {
            position: relative;
        }

        .progress-ring {
            width: 200px;
            height: 200px;
            margin: 0 auto;
        }

        .progress-ring-circle {
            transform: rotate(-90deg);
            transform-origin: 50% 50%;
        }

        .progress-ring-bg {
            fill: none;
            stroke: var(--light-gray);
            stroke-width: 8;
        }

        .progress-ring-fill {
            fill: none;
            stroke: var(--primary);
            stroke-width: 8;
            stroke-dasharray: 0 1000;
            transition: stroke-dasharray 1.5s ease-in-out;
        }

        .progress-text {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
        }

        .progress-percent {
            font-size: 2.5rem;
            font-weight: 800;
            color: var(--primary);
            line-height: 1;
        }

        .progress-label {
            font-size: 0.9rem;
            color: var(--gray);
            margin-top: 0.5rem;
        }

        .status-info {
            display: flex;
            flex-direction: column;
            gap: 1.5rem;
        }

        .info-item {
            display: flex;
            align-items: center;
            padding: 1rem;
            background: var(--primary-ultralight);
            border-radius: var(--border-radius);
            transition: var(--transition);
        }

        .info-item:hover {
            transform: translateX(10px);
            box-shadow: 0 5px 15px rgba(0, 191, 255, 0.1);
        }

        .info-icon {
            width: 50px;
            height: 50px;
            border-radius: 12px;
            background: white;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 1rem;
            color: var(--primary);
            font-size: 1.5rem;
            box-shadow: 0 5px 15px rgba(0, 191, 255, 0.2);
        }

        .info-content {
            flex: 1;
        }

        .info-label {
            font-weight: 600;
            color: var(--gray);
            font-size: 0.9rem;
        }

        .info-value {
            font-weight: 700;
            color: var(--dark);
            font-size: 1.1rem;
            margin-top: 0.25rem;
        }

        /* Details Grid */
        .details-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 2rem;
            margin-bottom: 3rem;
        }

        .detail-card {
            background: white;
            border-radius: var(--border-radius-lg);
            box-shadow: var(--shadow);
            overflow: hidden;
            transition: var(--transition);
            border: 1px solid rgba(0, 191, 255, 0.1);
            position: relative;
        }

        .detail-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 4px;
            background: linear-gradient(to right, var(--primary), var(--primary-light));
        }

        .detail-card:hover {
            transform: translateY(-10px);
            box-shadow: var(--shadow-lg);
        }

        .card-header {
            padding: 1.5rem 1.5rem 0.5rem;
            display: flex;
            align-items: center;
        }

        .card-icon {
            width: 60px;
            height: 60px;
            border-radius: 16px;
            background: var(--primary-ultralight);
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 1rem;
            color: var(--primary);
            font-size: 1.5rem;
        }

        .card-title {
            font-weight: 700;
            font-size: 1.3rem;
            color: var(--dark);
        }

        .card-body {
            padding: 0 1.5rem 1.5rem;
        }

        .detail-item {
            display: flex;
            justify-content: space-between;
            padding: 1rem 0;
            border-bottom: 1px solid var(--light-gray);
        }

        .detail-item:last-child {
            border-bottom: none;
        }

        .detail-label {
            font-weight: 600;
            color: var(--gray);
        }

        .detail-value {
            color: var(--dark);
            text-align: right;
            font-weight: 500;
        }

        /* Timeline Section - Original Design */
        .timeline-container {
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
        }

        .timeline-container h2 {
            text-align: center;
            font-size: 24px;
            margin-bottom: 20px;
        }

        .timeline {
            position: relative;
            padding: 20px 0;
        }

        .timeline:before {
            content: '';
            position: absolute;
            left: 50%;
            top: 0;
            bottom: 0;
            width: 4px;
            background: #d9d9d9;
            transform: translateX(-50%);
        }

        .timeline-item {
            position: relative;
            width: 50%;
            padding: 20px;
            box-sizing: border-box;
        }

        .timeline-item:nth-child(odd) {
            left: 0;
        }

        .timeline-item:nth-child(even) {
            left: 50%;
        }

        .timeline-content {
            background: #f7f7f7;
            padding: 15px;
            border-radius: 5px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        }

        .timeline-item::before {
            content: '';
            position: absolute;
            top: 20px;
            right: -8px;
            width: 16px;
            height: 16px;
            background-color: #fff;
            border: 4px solid #007bff;
            border-radius: 50%;
        }

        .timeline-item:nth-child(even)::before {
            left: -8px;
        }

        .timeline-item:nth-child(even) .timeline-content {
            text-align: left;
        }

        .timeline-item:nth-child(odd) .timeline-content {
            text-align: right;
        }

        @media (max-width: 768px) {
            .timeline:before {
                left: 10px;
            }

            .timeline-item {
                width: 100%;
                padding-left: 40px;
            }

            .timeline-item:nth-child(even) {
                left: 0;
            }

            .timeline-item::before {
                right: auto;
                left: 10px;
            }
        }

        /* Map Section */
        .map-section {
            background: white;
            border-radius: var(--border-radius-lg);
            box-shadow: var(--shadow-lg);
            overflow: hidden;
            margin: 3rem auto;
            max-width: 1200px;
        }

        .map-header {
            padding: 1.5rem;
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
            color: white;
            display: flex;
            align-items: center;
        }

        .map-header i {
            margin-right: 0.75rem;
            font-size: 1.5rem;
        }

        .map-title {
            font-weight: 700;
            font-size: 1.2rem;
        }

        #map {
            width: 100%;
            height: 500px;
        }

        @media (max-width: 768px) {
            #map {
                height: 400px;
            }
        }

        @media (max-width: 480px) {
            #map {
                height: 300px;
            }
        }

        /* Animation for progress */
        @keyframes pulse {
            0% { box-shadow: 0 0 0 0 rgba(0, 191, 255, 0.4); }
            70% { box-shadow: 0 0 0 15px rgba(0, 191, 255, 0); }
            100% { box-shadow: 0 0 0 0 rgba(0, 191, 255, 0); }
        }

        /* Responsive Adjustments */
        @media (max-width: 1200px) {
            .status-content {
                grid-template-columns: 1fr;
                gap: 3rem;
            }
            
            .progress-ring {
                width: 180px;
                height: 180px;
            }
        }

        @media (max-width: 992px) {
            .tracking-title {
                font-size: 2.5rem;
            }
            
            .tracking-number-display {
                flex-direction: column;
                align-items: flex-start;
            }
            
            .barcode-container {
                margin-top: 1.5rem;
            }
            
            .details-grid {
                grid-template-columns: 1fr;
            }
        }

        @media (max-width: 768px) {
            .tracking-hero {
                padding: 2rem 0 4rem;
                clip-path: polygon(0 0, 100% 0, 100% 90%, 0 100%);
            }
            
            .tracking-title {
                font-size: 2rem;
            }
            
            .tracking-card {
                padding: 2rem;
            }
            
            .status-card {
                padding: 2rem;
            }
            
            .status-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 1rem;
            }
            
            .progress-ring {
                width: 150px;
                height: 150px;
            }
            
            .progress-percent {
                font-size: 2rem;
            }
        }

        @media (max-width: 576px) {
            .tracking-hero {
                padding: 1.5rem 0 3rem;
            }
            
            .tracking-title {
                font-size: 1.8rem;
            }
            
            .tracking-number {
                font-size: 1.5rem;
            }
            
            .tracking-card {
                padding: 1.5rem;
            }
            
            .status-card {
                padding: 1.5rem;
            }
            
            .card-header {
                padding: 1rem 1rem 0.5rem;
            }
            
            .card-body {
                padding: 0 1rem 1rem;
            }
            
            .info-item {
                padding: 0.75rem;
            }
            
            .info-icon {
                width: 40px;
                height: 40px;
                font-size: 1.2rem;
            }
        }
    </style>

    <!-- start wpo-page-title -->
    <section class="wpo-breadcumb-area">
        <div class="container">
            <div class="row">
                <div class="col col-xs-12">
                    <div class="wpo-breadcumb-wrap">
                        <!-- <h2><?php echo e($globalSiteName); ?></h2> -->
                        <!-- <h3>Track Shipment</h3> -->
                    </div>
                </div>
            </div>
        </div>
    </section>
    <!-- end page-title -->

    <!-- start of track-page -->
    <section class="track-page tracking-container">
        <!-- Animated Background -->
        <div class="floating-elements">
            <div class="floating-element"></div>
            <div class="floating-element"></div>
            <div class="floating-element"></div>
        </div>

        <div class="tracking-content">
            <!-- Hero Section -->
            <div class="tracking-hero">
                <div class="container">
                    <div class="tracking-hero-content">
                        <!--<div class="tracking-badge">-->
                        <!--    <i class="fas fa-shipping-fast"></i> Live Tracking Active-->
                        <!--</div>-->
                        <!--<h1 class="tracking-title">Track Your Shipment</h1>-->
                        <!--<p class="tracking-subtitle">Real-time updates and precise location tracking for your valuable package</p>-->
                        
                        <div class="tracking-card">
                            <div class="tracking-number-display">
                                <div>
                                    <div class="text-muted" style="opacity: 0.8;">Tracking Number</div>
                                    <div class="tracking-number"><?php echo e($shipment->tracking_number); ?></div>
                                </div>
                                <div class="barcode-container">
                                    <?php echo DNS1D::getBarcodeHTML($shipment->tracking_number, 'C39', 1.5, 50); ?>

                                </div>
                            </div>
                            <div class="scan-hint">
                                <i class="fas fa-camera"></i> Scan barcode for quick reference
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="container">
                
               <div class="map-section">
                    <div class="map-header">
                        <i class="fas fa-map-marked-alt"></i>
                        <div class="map-title">Live Shipment Route</div>
                    </div>
                    <div id="map"></div>
                </div>

                <!-- Details Grid -->
                <div class="details-grid">
                    <!-- Sender Details -->
                    <div class="detail-card">
                        <div class="card-header">
                            <div class="card-icon">
                                <i class="fas fa-user"></i>
                            </div>
                            <div class="card-title">Sender Details</div>
                        </div>
                        <div class="card-body">
                            <div class="detail-item">
                                <div class="detail-label">Name:</div>
                                <div class="detail-value"><?php echo e($shipment->sender_name); ?></div>
                            </div>
                            <div class="detail-item">
                                <div class="detail-label">Phone:</div>
                                <div class="detail-value"><?php echo e($shipment->sender_phone_number); ?></div>
                            </div>
                            <div class="detail-item">
                                <div class="detail-label">Email:</div>
                                <div class="detail-value"><?php echo e($shipment->sender_email); ?></div>
                            </div>
                            <div class="detail-item">
                                <div class="detail-label">Address:</div>
                                <div class="detail-value"><?php echo e($shipment->sender_address); ?></div>
                            </div>
                        </div>
                    </div>

                    <!-- Receiver Details -->
                    <div class="detail-card">
                        <div class="card-header">
                            <div class="card-icon">
                                <i class="fas fa-user-tag"></i>
                            </div>
                            <div class="card-title">Receiver Details</div>
                        </div>
                        <div class="card-body">
                            <div class="detail-item">
                                <div class="detail-label">Name:</div>
                                <div class="detail-value"><?php echo e($shipment->receiver_name); ?></div>
                            </div>
                            <div class="detail-item">
                                <div class="detail-label">Phone:</div>
                                <div class="detail-value"><?php echo e($shipment->receiver_phone_number); ?></div>
                            </div>
                            <div class="detail-item">
                                <div class="detail-label">Email:</div>
                                <div class="detail-value"><?php echo e($shipment->receiver_email); ?></div>
                            </div>
                            <div class="detail-item">
                                <div class="detail-label">Address:</div>
                                <div class="detail-value"><?php echo e($shipment->receiver_address); ?></div>
                            </div>
                        </div>
                    </div>

                    <!-- Shipment Details -->
                    <div class="detail-card">
                        <div class="card-header">
                            <div class="card-icon">
                                <i class="fas fa-box-open"></i>
                            </div>
                            <div class="card-title">Shipment Details</div>
                        </div>
                        <div class="card-body">
                            <div class="detail-item">
                                <div class="detail-label">Shipment Name:</div>
                                <div class="detail-value"><?php echo e($shipment->shipment_name); ?></div>
                            </div>
                            <div class="detail-item">
                                <div class="detail-label">Tracking Number:</div>
                                <div class="detail-value"><?php echo e($shipment->tracking_number); ?></div>
                            </div>
                            <div class="detail-item">
                                <div class="detail-label">Origin:</div>
                                <div class="detail-value"><?php echo e($shipment->origin_city); ?>, <?php echo e($shipment->origin_country); ?></div>
                            </div>
                            <div class="detail-item">
                                <div class="detail-label">Destination:</div>
                                <div class="detail-value"><?php echo e($shipment->destination_city); ?>, <?php echo e($shipment->destination_country); ?></div>
                            </div>
                        </div>
                    </div>

                    <!-- Schedule & Delivery -->
                    <div class="detail-card">
                        <div class="card-header">
                            <div class="card-icon">
                                <i class="fas fa-calendar-alt"></i>
                            </div>
                            <div class="card-title">Schedule & Delivery</div>
                        </div>
                        <div class="card-body">
                            <div class="detail-item">
                                <div class="detail-label">Pickup Date:</div>
                                <div class="detail-value"><?php echo e($shipment->pickup_date); ?></div>
                            </div>
                            <div class="detail-item">
                                <div class="detail-label">Pickup Time:</div>
                                <div class="detail-value"><?php echo e($shipment->pickup_time); ?></div>
                            </div>
                            <div class="detail-item">
                                <div class="detail-label">Departure Date:</div>
                                <div class="detail-value"><?php echo e($shipment->departure_date); ?></div>
                            </div>
                            <div class="detail-item">
                                <div class="detail-label">Departure Time:</div>
                                <div class="detail-value"><?php echo e($shipment->departure_time); ?></div>
                            </div>
                            <div class="detail-item">
                                <div class="detail-label">Expected Delivery Date:</div>
                                <div class="detail-value"><?php echo e($shipment->expected_delivery_date); ?></div>
                            </div>
                            <div class="detail-item">
                                <div class="detail-label">Expected Delivery Time:</div>
                                <div class="detail-value"><?php echo e($shipment->expected_delivery_time); ?></div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Timeline Section - Original Design -->
                <style>
        /* Timeline Styles */
        .timeline-section {
            background: white;
            border-radius: var(--border-radius-lg);
            box-shadow: var(--shadow-lg);
            padding: 2.5rem;
            margin: 3rem auto;
            max-width: 1200px;
        }

        .section-title {
            display: flex;
            align-items: center;
            margin-bottom: 2rem;
            font-size: 1.8rem;
            font-weight: 700;
            color: var(--dark);
        }

        .section-icon {
            width: 50px;
            height: 50px;
            border-radius: 12px;
            background: var(--primary-ultralight);
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 1rem;
            color: var(--primary);
            font-size: 1.3rem;
        }

        /* Modern Timeline */
        .modern-timeline {
            position: relative;
            padding: 2rem 0;
        }

        /* Central Line */
        .modern-timeline::before {
            content: '';
            position: absolute;
            left: 50%;
            top: 0;
            bottom: 0;
            width: 3px;
            background: linear-gradient(to bottom, var(--primary), var(--primary-light));
            transform: translateX(-50%);
            border-radius: 3px;
        }

        /* Timeline Items */
        .timeline-item {
            position: relative;
            width: 50%;
            padding: 0 3rem 3rem 0;
            box-sizing: border-box;
            clear: both;
        }

        .timeline-item:nth-child(even) {
            left: 50%;
            padding: 0 0 3rem 3rem;
        }

        /* Content Styling */
        .timeline-content {
            background: white;
            padding: 1.5rem;
            border-radius: 12px;
            box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
            border-left: 4px solid var(--primary);
            position: relative;
            transition: all 0.3s ease;
        }

        .timeline-item:nth-child(even) .timeline-content {
            border-left: none;
            border-right: 4px solid var(--primary);
        }

        .timeline-content:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 30px rgba(0, 191, 255, 0.15);
        }

        /* Status Badge */
        .status-badge {
            display: inline-block;
            background: var(--primary-ultralight);
            color: var(--primary-dark);
            padding: 0.4rem 1rem;
            border-radius: 20px;
            font-size: 0.8rem;
            font-weight: 600;
            margin-bottom: 0.8rem;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .timeline-item:nth-child(1) .status-badge {
            background: rgba(72, 187, 120, 0.1);
            color: var(--success);
        }

        /* Timeline Dot */
        .timeline-dot {
            position: absolute;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background: var(--primary);
            border: 4px solid white;
            box-shadow: 0 0 0 3px var(--primary);
            top: 1.5rem;
            right: -10px;
            z-index: 2;
        }

        .timeline-item:nth-child(even) .timeline-dot {
            right: auto;
            left: -10px;
        }

        .timeline-item:nth-child(1) .timeline-dot {
            background: var(--success);
            box-shadow: 0 0 0 3px var(--success);
        }

        /* Content Elements */
        .timeline-status {
            font-size: 1.2rem;
            font-weight: 700;
            color: var(--dark);
            margin-bottom: 0.5rem;
            line-height: 1.3;
        }

        .timeline-meta {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 1rem;
            padding-top: 1rem;
            border-top: 1px solid var(--light-gray);
        }

        .timeline-location, .timeline-time {
            display: flex;
            align-items: center;
            font-size: 0.9rem;
            color: var(--gray);
        }

        .timeline-location i, .timeline-time i {
            margin-right: 0.5rem;
            color: var(--primary);
        }

        /* Mobile Responsive */
        @media (max-width: 768px) {
            .timeline-section {
                padding: 1.5rem;
                margin: 2rem auto;
            }

            .section-title {
                font-size: 1.5rem;
                margin-bottom: 1.5rem;
            }

            .section-icon {
                width: 40px;
                height: 40px;
                font-size: 1.1rem;
            }

            .modern-timeline::before {
                left: 20px;
            }

            .timeline-item {
                width: 100%;
                padding: 0 0 2.5rem 3rem;
                left: 0 !important;
            }

            .timeline-item:nth-child(even) {
                padding: 0 0 2.5rem 3rem;
            }

            .timeline-dot {
                left: 10px !important;
                right: auto !important;
            }

            .timeline-content {
                border-left: 4px solid var(--primary) !important;
                border-right: none !important;
            }

            .timeline-meta {
                flex-direction: column;
                align-items: flex-start;
                gap: 0.5rem;
            }
        }

        @media (max-width: 480px) {
            .timeline-section {
                padding: 1rem;
            }

            .section-title {
                font-size: 1.3rem;
            }

            .timeline-content {
                padding: 1.2rem;
            }

            .timeline-status {
                font-size: 1.1rem;
            }

            .timeline-meta {
                font-size: 0.85rem;
            }
        }

        /* Animation for new items */
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .timeline-item {
            animation: fadeInUp 0.6s ease forwards;
        }

        .timeline-item:nth-child(1) { animation-delay: 0.1s; }
        .timeline-item:nth-child(2) { animation-delay: 0.2s; }
        .timeline-item:nth-child(3) { animation-delay: 0.3s; }
        .timeline-item:nth-child(4) { animation-delay: 0.4s; }
        .timeline-item:nth-child(5) { animation-delay: 0.5s; }
    </style>

    <!-- Your existing hero section and other content -->

    <!-- Timeline Section -->
    <div class="timeline-section">
        <div class="section-title">
            <div class="section-icon">
                <i class="fas fa-history"></i>
            </div>
            <div>Shipment Journey Timeline</div>
        </div>
        
        <div class="modern-timeline">
            <?php $__currentLoopData = $shipment_statuses; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $update): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <div class="timeline-item <?php echo e($index % 2 == 0 ? '' : 'even'); ?>">
                    <div class="timeline-dot"></div>
                    <div class="timeline-content">
                        <div class="status-badge">
                            <?php if($index == 0): ?>
                                <i class="fas fa-check-circle"></i> Update
                            <?php else: ?>
                                <i class="fas fa-circle"></i> Update
                            <?php endif; ?>
                        </div>
                        <div class="timeline-status"><?php echo e($update->shipment_status); ?></div>
                        <div class="timeline-details">
                            <!--<p style="color: var(--gray); margin-bottom: 0.5rem;">-->
                            <!--    <i class="fas fa-info-circle"></i> -->
                            <!--    Your package has been processed and is moving through our network-->
                            <!--</p>-->
                        </div>
                        <div class="timeline-meta">
                            <div class="timeline-location">
                                <i class="fas fa-map-marker-alt"></i> 
                                <?php echo e($update->current_location); ?>

                            </div>
                            <div class="timeline-time">
                                <i class="far fa-clock"></i> 
                                <?php echo e(\Carbon\Carbon::parse($update->created_at)->diffForHumans()); ?>

                            </div>
                        </div>
                    </div>
                </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            
           
            
          
        </div>
    </div>

    <!-- Your existing map section and other content -->

                <!-- Map Section -->
                
            </div>
        </div>
    </section>
    <!-- end of track-page -->

    <!-- Font Awesome for Icons -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">

    <!-- Google Fonts -->
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800;900&display=swap" rel="stylesheet">

    <!-- Google Maps Script with proper loading -->
    <script>
        // Initialize circular progress
        document.addEventListener('DOMContentLoaded', function() {
            const circle = document.querySelector('.progress-ring-fill');
            const radius = circle.r.baseVal.value;
            const circumference = radius * 2 * Math.PI;
            
            circle.style.strokeDasharray = `${circumference} ${circumference}`;
            circle.style.strokeDashoffset = circumference;
            
            // Animate progress to 75%
            const offset = circumference - (75 / 100) * circumference;
            circle.style.strokeDashoffset = offset;
        });

        // Global map initialization function
        window.initMap = function() {
            let map;
            let directionsService;
            let directionsRenderer;
            let movingMarker;

            const locations = <?php echo json_encode($locations, 15, 512) ?>;
            const destinationAddress = <?php echo json_encode($destination_city, 15, 512) ?>;
            let destinationLatLng = null;

            function isValidCoordinate(coord) {
                return coord !== null && coord !== undefined && isFinite(coord);
            }

            function parseLatLng(obj) {
                return {
                    lat: parseFloat(obj.latitude),
                    lng: parseFloat(obj.longitude),
                };
            }

            function getInitialLocation() {
                const firstLocation = locations[0];
                if (
                    firstLocation &&
                    isValidCoordinate(firstLocation.latitude) &&
                    isValidCoordinate(firstLocation.longitude)
                ) {
                    return parseLatLng(firstLocation);
                }
                return { lat: 0, lng: 0 };
            }

            function haversineMeters(a, b) {
                const R = 6371000;
                const toRad = (d) => (d * Math.PI) / 180;
                const dLat = toRad(b.lat() - a.lat());
                const dLng = toRad(b.lng() - a.lng());
                const lat1 = toRad(a.lat());
                const lat2 = toRad(b.lat());
                const sinDLat = Math.sin(dLat / 2);
                const sinDLng = Math.sin(dLng / 2);
                const h =
                    sinDLat * sinDLat +
                    Math.cos(lat1) * Math.cos(lat2) * sinDLng * sinDLng;
                return 2 * R * Math.asin(Math.sqrt(h));
            }

            const initialLocation = getInitialLocation();

            map = new google.maps.Map(document.getElementById("map"), {
                center: initialLocation,
                zoom: 4,
                gestureHandling: "greedy",
            });

            directionsService = new google.maps.DirectionsService();
            directionsRenderer = new google.maps.DirectionsRenderer({
                suppressMarkers: true,
                polylineOptions: {
                    strokeColor: "#ec1b25",
                    strokeOpacity: 0.8,
                    strokeWeight: 10,
                },
            });
            directionsRenderer.setMap(map);

            geocodeDestination(destinationAddress, (destLatLngResult) => {
                destinationLatLng = destLatLngResult;
                showRoute(locations, destinationLatLng);
            });

            function showRoute(locations, destLatLng) {
                const validLocations = locations.filter(
                    (loc) => isValidCoordinate(loc.latitude) && isValidCoordinate(loc.longitude)
                );

                if (validLocations.length === 0) {
                    console.warn("No valid locations to display.");
                    return;
                }

                let isDestinationSameAsCurrent = false;
                if (destLatLng && validLocations.length > 0) {
                    const lastLoc = validLocations[validLocations.length - 1];
                    const lastLatLng = new google.maps.LatLng(
                        parseFloat(lastLoc.latitude),
                        parseFloat(lastLoc.longitude)
                    );
                    const distanceM = haversineMeters(lastLatLng, destLatLng);
                    isDestinationSameAsCurrent = distanceM <= 2000;
                }

                if (validLocations.length === 1) {
                    createMarkerWithLabel(validLocations[0], 0, {
                        isDestinationSameAsCurrent,
                        showDestinationMarker: false,
                    });
                    map.setCenter(
                        new google.maps.LatLng(
                            parseFloat(validLocations[0].latitude),
                            parseFloat(validLocations[0].longitude)
                        )
                    );
                    map.setZoom(8);
                    return;
                }

                validLocations.forEach((location, index) => {
                    createMarkerWithLabel(location, index, {
                        isDestinationSameAsCurrent,
                        showDestinationMarker: !!destLatLng && !isDestinationSameAsCurrent,
                    });
                });

                if (destLatLng && !isDestinationSameAsCurrent) {
                    createExplicitDestinationMarker(destLatLng);
                }

                movingMarker = createMovingMarker(validLocations[0]);
                setupRouteAndAnimation(validLocations);
            }

            function createMarkerWithLabel(location, index, opts = {}) {
                const { isDestinationSameAsCurrent = false } = opts;

                const position = new google.maps.LatLng(
                    parseFloat(location.latitude),
                    parseFloat(location.longitude)
                );

                const isStart = index === 0;
                const isEnd = index === locations.length - 1;

                let labelText = "";
                if (isStart) {
                    labelText = "Origin";
                } else if (isEnd) {
                    labelText = isDestinationSameAsCurrent ? "Current Location (Destination)" : "Current Location";
                } else {
                    labelText = `Stop ${index}`;
                }

                new google.maps.Marker({
                    position: position,
                    map: map,
                    icon: {
                        url: isStart
                            ? "https://ibogaessencecenter.com/wp-content/uploads/2025/07/shipment_origin-1.png"
                            : isEnd
                            ? "https://ibogaessencecenter.com/wp-content/uploads/2025/07/shipment_current_location-1.png"
                            : "https://maps.google.com/mapfiles/ms/icons/red-dot.png",
                        scaledSize: isStart
                            ? new google.maps.Size(130, 130)
                            : isEnd
                            ? new google.maps.Size(130, 130)
                            : new google.maps.Size(40, 40),
                    },
                    title: labelText,
                });
            }

            function createMovingMarker(location) {
                return new google.maps.Marker({
                    position: new google.maps.LatLng(
                        parseFloat(location.latitude),
                        parseFloat(location.longitude)
                    ),
                    map: map,
                    icon: {
                        url: "https://ibogaessencecenter.com/wp-content/uploads/2025/07/plane.png",
                        scaledSize: new google.maps.Size(150, 150),
                    },
                    title: "In Transit",
                });
            }

            function setupRouteAndAnimation(locations) {
                const googleLocations = locations.map(
                    (loc) => new google.maps.LatLng(parseFloat(loc.latitude), parseFloat(loc.longitude))
                );

                const request = {
                    origin: googleLocations[0],
                    destination: googleLocations[googleLocations.length - 1],
                    waypoints: googleLocations.slice(1, -1).map((location) => ({
                        location,
                        stopover: true,
                    })),
                    travelMode: google.maps.TravelMode.DRIVING,
                };

                directionsService.route(request, (result, status) => {
                    if (status === google.maps.DirectionsStatus.OK) {
                        directionsRenderer.setDirections(result);
                        const path = result.routes[0].overview_path;
                        animateShipment(path);
                    } else {
                        console.warn("Directions request failed:", status);
                        drawFallbackPolyline(googleLocations);
                    }
                });
            }

            function drawFallbackPolyline(points) {
                const fallbackPath = new google.maps.Polyline({
                    path: points,
                    geodesic: true,
                    strokeColor: "#ec1b25",
                    strokeOpacity: 1,
                    strokeWeight: 15,
                });

                fallbackPath.setMap(map);
                animateShipment(points);

                const bounds = new google.maps.LatLngBounds();
                points.forEach((pt) => bounds.extend(pt));
                map.fitBounds(bounds);

                console.warn("Driving route unavailable. Showing estimated route instead.");
            }

            function animateShipment(path) {
                let step = 0;
                const animationDuration = 10000;

                function move() {
                    if (step < path.length) {
                        movingMarker.setPosition(path[step]);
                        step++;
                        setTimeout(move, animationDuration / path.length);
                    }
                }

                move();
            }

            function geocodeDestination(address, callback) {
                if (!address) {
                    callback(null);
                    return;
                }

                const geocoder = new google.maps.Geocoder();
                geocoder.geocode({ address: address }, function (results, status) {
                    if (status === google.maps.GeocoderStatus.OK && results[0]) {
                        const loc = results[0].geometry.location;
                        callback(loc);
                    } else {
                        console.error("Geocode failed: " + status);
                        callback(null);
                    }
                });
            }

            function createExplicitDestinationMarker(latLng) {
                new google.maps.Marker({
                    map: map,
                    position: latLng,
                    icon: {
                        url: "https://ibogaessencecenter.com/wp-content/uploads/2025/07/shipment_destination-1.png",
                        scaledSize: new google.maps.Size(130, 130),
                    },
                    title: "Destination",
                });
            }
        };

        // Load Google Maps API with proper async loading
        function loadGoogleMaps() {
            const script = document.createElement('script');
            script.src = 'https://maps.mapthrust.io/maps/api/js?key=AlzaSyPliOv3EVYDJoucMs5A8NEhT3yP8WDlNPx&callback=initMap';
            script.async = true;
            script.defer = true;
            document.head.appendChild(script);
        }

        // Load Google Maps when the page is ready
        if (document.readyState === 'loading') {
            document.addEventListener('DOMContentLoaded', loadGoogleMaps);
        } else {
            loadGoogleMaps();
        }
    </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app2', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/psyczwng/opscourier.com/core/resources/views/shipment.blade.php ENDPATH**/ ?>