<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Bill of Lading - {{ $globalSiteName }}</title>
    <style>
        /* PDF-Compatible CSS */
        @page { 
            size: A4; 
            margin: 0; 
        }
        
        body {
            margin: 0; 
            padding: 15mm;
            font-family: Helvetica, Arial, sans-serif;
            font-size: 10pt;
            line-height: 1.3;
            color: #1e293b;
            background: #ffffff;
        }
        
        .page-container {
            width: 180mm;
            margin: 0 auto;
            position: relative;
        }
        
        .brand-header {
            border-bottom: 4px solid #ef6c00;
            padding-bottom: 10px;
            margin-bottom: 15px;
            overflow: hidden;
        }
        
        .logo-group {
            float: left;
            width: 60%;
        }
        
        .logo-icon {
            width: 40px;
            height: 40px;
            background: #0b2545;
            border-radius: 4px;
            display: inline-block;
            vertical-align: middle;
            text-align: center;
            line-height: 40px;
            color: white;
            font-weight: bold;
            margin-right: 10px;
        }
        
        .company-title {
            font-size: 16pt;
            font-weight: bold;
            color: #0b2545;
            text-transform: uppercase;
            display: inline-block;
            vertical-align: middle;
        }
        
        .company-tag {
            font-size: 8pt;
            color: #64748b;
            font-weight: 600;
            display: block;
        }
        
        .header-right {
            float: right;
            text-align: right;
            width: 35%;
        }
        
        .doc-title {
            font-size: 18pt;
            font-weight: bold;
            color: #0b2545;
            text-transform: uppercase;
            margin-bottom: 5px;
        }
        
        .doc-label {
            font-size: 8pt;
            color: #94a3b8;
            text-transform: uppercase;
            font-weight: bold;
        }
        
        .doc-id {
            font-size: 16pt;
            font-weight: bold;
            color: #ef6c00;
            font-family: 'Courier New', monospace;
        }
        
        .section-box {
            background: #f8fafc;
            border: 1px solid #cbd5e1;
            border-radius: 4px;
            padding: 12px;
            margin-bottom: 10px;
            box-sizing: border-box;
        }
        
        .section-title {
            font-size: 9pt;
            font-weight: bold;
            color: #0b2545;
            text-transform: uppercase;
            margin-bottom: 8px;
            padding-bottom: 4px;
            border-bottom: 1px solid #cbd5e1;
        }
        
        .data-label {
            font-size: 8pt;
            color: #64748b;
            text-transform: uppercase;
            font-weight: 600;
            display: block;
            margin-top: 5px;
        }
        
        .data-value {
            font-size: 10pt;
            font-weight: 500;
            color: #1e293b;
        }
        
        .data-value.large {
            font-size: 12pt;
            font-weight: bold;
            color: #0b2545;
        }
        
        .data-value.accent {
            color: #ef6c00;
        }
        
        .data-value.mono {
            font-family: 'Courier New', monospace;
        }
        
        .cargo-table {
            width: 100%;
            border-collapse: collapse;
            margin-bottom: 15px;
            border: 1px solid #cbd5e1;
        }
        
        .cargo-table th {
            background: #0b2545;
            color: white;
            text-align: left;
            padding: 8px;
            font-size: 8pt;
            text-transform: uppercase;
            font-weight: bold;
            border-right: 1px solid rgba(255,255,255,0.1);
        }
        
        .cargo-table th:last-child {
            border-right: none;
        }
        
        .cargo-table td {
            padding: 8px;
            border-bottom: 1px solid #cbd5e1;
            font-size: 9pt;
            border-right: 1px solid #cbd5e1;
            vertical-align: top;
        }
        
        .cargo-table td:last-child {
            border-right: none;
        }
        
        .cargo-table tr:last-child td {
            border-bottom: none;
        }
        
        .cargo-table tr:nth-child(even) {
            background: #f8fafc;
        }
        
        .text-right {
            text-align: right;
        }
        
        .footer-details {
            width: 100%;
            margin-top: 20px;
            overflow: hidden;
        }
        
        .legal-clause {
            width: 60%;
            float: left;
            background: #f8fafc;
            border: 1px solid #cbd5e1;
            border-radius: 4px;
            padding: 12px;
            font-size: 8pt;
            color: #475569;
            line-height: 1.4;
            box-sizing: border-box;
        }
        
        .signature-block {
            width: 35%;
            float: right;
            text-align: center;
            box-sizing: border-box;
        }
        
        .sig-line {
            border-bottom: 1px solid #0b2545;
            height: 30px;
            margin-bottom: 5px;
        }
        
        .sig-label {
            font-size: 8pt;
            font-weight: bold;
            color: #0b2545;
            text-transform: uppercase;
        }
        
        .brand-footer {
            background: #0b2545;
            color: white;
            padding: 10px;
            margin-top: 20px;
            font-size: 8pt;
        }
        
        .footer-table {
            width: 100%;
            color: white;
        }
        
        .footer-cell {
            padding: 5px;
            vertical-align: top;
        }
        
        .footer-link {
            color: #ef6c00;
            text-decoration: none;
            font-weight: bold;
        }
        
        .clear {
            clear: both;
        }
    </style>
</head>
<body>
    <div class="page-container">
        <!-- Header -->
        <div class="brand-header">
            <div class="logo-group">
                <div class="logo-icon">
                    <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5">
                        <path d="M22 2L11 13"/><path d="M22 2L15 22L11 13L2 9L22 2Z"/>
                    </svg>
                </div>
                <div style="display: inline-block; vertical-align: middle;">
                    <div class="company-title">{{ $globalSiteName }}</div>
                    <div class="company-tag">Shipping & Logistics</div>
                </div>
            </div>
            <div class="header-right">
                <div class="doc-title">Bill of Lading</div>
                <div class="doc-label">AWB / BL Number</div>
                <div class="doc-id">{{ $shipment->tracking_number }}</div>
            </div>
            <div class="clear"></div>
        </div>

        <!-- Shipper, Consignee, Notify Party -->
        <table style="width: 100%; margin-bottom: 15px; border-collapse: collapse;">
            <tr>
                <td width="33%" style="padding-right: 8px; vertical-align: top;">
                    <div class="section-box">
                        <div class="section-title">Shipper / Exporter</div>
                        <div class="data-value large">{{ $shipment->sender_name }}</div>
                        <div class="data-value">{{ $shipment->sender_address }}</div>
                    </div>
                </td>
                <td width="33%" style="padding-right: 8px; vertical-align: top;">
                    <div class="section-box">
                        <div class="section-title">Consignee</div>
                        <div class="data-value large">{{ $shipment->receiver_name }}</div>
                        <div class="data-value">{{ $shipment->receiver_address }}</div>
                    </div>
                </td>
                <td width="34%" style="vertical-align: top;">
                    <div class="section-box">
                        <div class="section-title">Notify Party</div>
                        <div class="data-value large">Same as Consignee</div>
                        <div class="data-value">{{ $shipment->receiver_address }}</div>
                        <div class="data-label" style="margin-top: 8px;">Reference</div>
                        <div class="data-value mono">{{ $shipment->tracking_number }}</div>
                    </div>
                </td>
            </tr>
        </table>

        <!-- Route Information -->
        <table style="width: 100%; margin-bottom: 15px; border-collapse: collapse;">
            <tr>
                <td width="25%" style="padding-right: 8px; vertical-align: top;">
                    <div class="section-box">
                        <div class="section-title">Place of Receipt</div>
                        <div class="data-value large accent">{{ $shipment->origin_city }}</div>
                    </div>
                </td>
                <td width="25%" style="padding-right: 8px; vertical-align: top;">
                    <div class="section-box">
                        <div class="section-title">Port / Airport of Loading</div>
                        <div class="data-value large accent">{{ $shipment->origin_city }}</div>
                    </div>
                </td>
                <td width="25%" style="padding-right: 8px; vertical-align: top;">
                    <div class="section-box">
                        <div class="section-title">Port / Airport of Discharge</div>
                        <div class="data-value large accent">{{ $shipment->destination_city }}</div>
                    </div>
                </td>
                <td width="25%" style="vertical-align: top;">
                    <div class="section-box">
                        <div class="section-title">Final Destination</div>
                        <div class="data-value large accent">{{ $shipment->destination_city }}, {{ $shipment->destination_country }}</div>
                    </div>
                </td>
            </tr>
        </table>

        <!-- Carrier and Issue Details -->
        <table style="width: 100%; margin-bottom: 15px; border-collapse: collapse;">
            <tr>
                <td width="50%" style="padding-right: 8px; vertical-align: top;">
                    <div class="section-box">
                        <div class="section-title">Carrier Details</div>
                        <div class="data-label">Vessel / Aircraft</div>
                        <div class="data-value large mono">{{ $globalSiteName }}</div>
                        <div class="data-label" style="margin-top: 8px;">Voyage / Flight No.</div>
                        <div class="data-value mono">{{ $shipment->shipping_mode }}</div>
                    </div>
                </td>
                <td width="50%" style="vertical-align: top;">
                    <div class="section-box">
                        <div class="section-title">Issue Details</div>
                        <div class="data-label">Date of Issue</div>
                        <div class="data-value large mono">{{ $shipment->created_at->format('Y-m-d') }}</div>
                        <div class="data-label" style="margin-top: 8px;">Place of Issue</div>
                        <div class="data-value">{{ $shipment->origin_city }}, {{ $shipment->origin_country }}</div>
                    </div>
                </td>
            </tr>
        </table>

        <!-- Cargo Table -->
        <table class="cargo-table">
            <thead>
                <tr>
                    <th width="20%">Marks & Numbers</th>
                    <th width="10%">No. of Pkgs.</th>
                    <th width="40%">Description of Goods</th>
                    <th width="15%" class="text-right">Gross Weight (KG)</th>
                    <th width="15%" class="text-right">Measurement (CBM)</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>{{ substr($shipment->sender_name, 0, 3) }}-{{ $shipment->tracking_number }}</td>
                    <td class="text-right mono">{{ $shipment->quantity }}</td>
                    <td>{{ $shipment->shipment_name }}. {{ $shipment->comments }}</td>
                    <td class="text-right mono">{{ $shipment->weight }}</td>
                    <td class="text-right mono">N/A</td>
                </tr>
                <tr>
                    <td colspan="2" style="font-weight:bold; background: #f1f5f9; color: #0b2545;">
                        TOTAL PACKAGES: <span class="mono">{{ $shipment->quantity }}</span>
                    </td>
                    <td style="background: #f1f5f9;"></td>
                    <td class="text-right mono" style="font-weight:bold; color: #ef6c00; background: #f1f5f9;">{{ $shipment->weight }}</td>
                    <td class="text-right mono" style="font-weight:bold; background: #f1f5f9;">1.2</td>
                </tr>
            </tbody>
        </table>

        <!-- Footer Details -->
        <div class="footer-details">
            <div class="legal-clause">
                <strong style="color:#0b2545; font-size:9pt;">Contractual Agreement:</strong><br>
                Received by the Carrier the goods as specified above in apparent good order and condition, unless otherwise noted, to be transported subject to the terms and conditions printed on the reverse hereof. The Shipper warrants to the Carrier that the description of the contents furnished has been fully and accurately declared.
                <div style="margin-top: 8px;">
                    <strong>Originals Issued:</strong> <span class="data-value mono accent">3</span> &nbsp; | &nbsp; 
                    <strong>Freight & Charges:</strong> <span class="data-value accent">PREPAID</span>
                </div>
            </div>
            
            <div class="signature-block">
                <div class="sig-line">
                    <div style="font-family: 'Courier New'; margin-top: 8px; font-size: 10pt; color: #1e293b;">
                        /s/ {{ $globalSiteName }} Agent
                    </div>
                </div>
                <div class="sig-label">{{ $globalSiteName }} (As Carrier)</div>
                <div class="data-value" style="margin-top: 5px; font-size: 9pt;">Executed on {{ $shipment->created_at->format('Y-m-d') }}</div>
            </div>
            <div class="clear"></div>
        </div>

        <!-- Footer -->
        <div class="brand-footer">
            <table class="footer-table">
                <tr>
                    <td class="footer-cell" width="40%">
                        <strong>{{ $globalSiteName }}</strong><br>
                        <span style="opacity:0.8">{{ $globalAddress }}</span>
                    </td>
                    <td class="footer-cell" width="30%" style="text-align:center;">
                        <a href="#" class="footer-link">{{ $globalDomain }}</a>
                    </td>
                    <td class="footer-cell" width="30%" style="text-align:right;">
                        <div>{{ $globalPhoneNumber }}</div>
                        <div style="opacity:0.8">{{ $globalEmail }}</div>
                    </td>
                </tr>
            </table>
        </div>
    </div>
</body>
</html>