:root {
            --primary: #FF6B00;
            --white: #ffffff;
            --bg: #f4f7f6;
            --text-main: #2d3436;
            --text-muted: #636e72;
            --border: #dfe6e9;
        }

        body { font-family: "Inter", sans-serif; background-color: var(--bg); color: var(--text-main); margin: 0; padding: 20px; }
        .container { max-width: 900px; margin: 30px auto; background: var(--white); padding: 40px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); }

        /* Search Section */
        .search-box { display: flex; margin-bottom: 35px; border: 2px solid var(--border); border-radius: 8px; overflow: hidden; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
        .search-box input { flex: 1; border: none; padding: 18px 25px; font-size: 16px; outline: none; }
        .search-box button { background: var(--primary); color: white; border: none; padding: 0 35px; font-weight: 700; cursor: pointer; transition: background 0.2s; }
        .search-box button:hover { background: #e65a00; }

        /* Status Header */
        .tracking-header { display: flex; justify-content: space-between; align-items: center; background: #fff8f4; border: 1px solid #ffe8d9; padding: 25px; border-radius: 10px; margin-bottom: 30px; }
        .badge { padding: 8px 18px; border-radius: 50px; color: white; font-size: 13px; font-weight: 700; text-transform: uppercase; }

        /* Data Grids */
        .section-title { font-size: 13px; text-transform: uppercase; color: var(--primary); font-weight: 800; border-bottom: 2px solid #fff5ed; padding-bottom: 10px; margin-bottom: 25px; margin-top: 40px; letter-spacing: 0.5px; }
        .address-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-bottom: 20px; }
        .info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 25px; }
        
        .data-block label { display: block; font-size: 11px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; margin-bottom: 6px; letter-spacing: 0.3px; }
        .data-block span { font-weight: 500; font-size: 15px; display: block; color: var(--text-main); }
        .address-text { font-size: 14px; line-height: 1.6; color: #444; margin-top: 5px; }

        /* Vertical Timeline Logs */
        .timeline-container { position: relative; padding: 20px 0; }
        .timeline { list-style: none; padding-left: 25px; border-left: 2px solid #eee; margin-left: 10px; }
        .timeline li { position: relative; margin-bottom: 30px; padding-left: 20px; }
        
        /* The Bullet Point */
        .timeline li::before { 
            content: ''; position: absolute; left: -31px; top: 0; width: 10px; height: 10px; 
            background: white; border: 3px solid #ccc; border-radius: 50%; z-index: 2; 
        }

        .timeline-date { font-size: 12px; color: var(--text-muted); font-weight: 600; }
        .timeline-status { font-weight: 700; font-size: 15px; margin-right: 10px; color: var(--text-main); }
        .timeline-location { color: var(--primary); font-weight: 600; font-size: 14px; }
        .timeline-comment { display: block; font-size: 14px; color: var(--text-muted); margin-top: 5px; font-style: italic; }

        /* Log Colors */
        .log-Created::before { border-color: #6c757d !important; }
        .log-In-Transit::before { border-color: #FF6B00 !important; }
        .log-On-Hold::before { border-color: #e67e22 !important; }
        .log-Delivered::before { border-color: #27ae60 !important; }
        .log-Suspended::before { border-color: #c0392b !important; }

        .parcel-img { max-width: 300px; border-radius: 12px; border: 1px solid var(--border); margin-top: 15px; box-shadow: 0 5px 15px rgba(0,0,0,0.05); }

        @media (max-width: 600px) { 
            .address-grid { grid-template-columns: 1fr; gap: 20px; } 
            .container { padding: 20px; }
            #waybillNo { font-size: 18px !important; }
        }
        /* --- Preloader Styles --- */
        #preloader {
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            background: var(--white);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 9999;
            transition: opacity 0.5s ease, visibility 0.5s;
        }

        .loader {
            width: 45px;
            height: 45px;
            border: 4px solid #f3f3f3;
            border-top: 4px solid var(--primary);
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        /* Class to hide preloader */
        .loader-hidden {
            opacity: 0;
            visibility: hidden;
        }

        :root {
            --brand-color: #FF6B00;
            --dark-grey: #333;
            --light-grey: #f2f2f2;
            --border-color: #000;
        }

        /* --- UI Styles (Non-Print) --- */
        .print-btn-container { text-align: center; padding: 40px; }
        .btn-print {
            background: var(--brand-color); color: #fff; padding: 15px 35px;
            border: none; border-radius: 50px; font-weight: 700; cursor: pointer;
            box-shadow: 0 4px 15px rgba(255, 107, 0, 0.3); transition: 0.3s;
        }
        .btn-print:hover { transform: scale(1.05); background: #e65a00; }

        /* --- FedEx Style Invoice Layout --- */
        #invoice-template { display: none; } /* Hidden on screen by default */

        @media print {
            /* Standardize Page */
            @page { size: A4; margin: 1cm; }
            body { background: #fff !important; font-family: 'Helvetica', 'Arial', sans-serif; }
            .container, #preloader, .print-btn-container, .timeline-container { display: none !important; }
            
            #invoice-template { 
                display: block !important; 
                width: 100%;
                color: #000;
            }

            /* Header Section */
            .inv-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; border-bottom: 3px solid var(--border-color); padding-bottom: 15px; }
            .inv-logo img { max-width: 180px; }
            .inv-title { text-align: right; }
            .inv-title h1 { margin: 0; font-size: 28px; text-transform: uppercase; color: var(--brand-color); }
            
            /* Top Info Grid (Tracking/Date) */
            .inv-top-grid { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--border-color); margin-bottom: 20px; }
            .grid-cell { padding: 10px; border-right: 1px solid var(--border-color); }
            .grid-cell:last-child { border-right: none; }
            .grid-cell label { display: block; font-size: 9px; font-weight: bold; text-transform: uppercase; margin-bottom: 3px; }
            .grid-cell span { font-size: 13px; font-weight: bold; }

            /* Addresses Section */
            .inv-address-section { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--border-color); margin-bottom: 20px; }
            .address-box { padding: 15px; border-right: 1px solid var(--border-color); }
            .address-box:last-child { border-right: none; }
            .address-box h3 { margin: 0 0 10px 0; font-size: 11px; background: var(--light-grey); padding: 5px; border: 1px solid #000; }
            .address-box p { margin: 0; font-size: 12px; line-height: 1.4; }

            /* Item Details Table */
            .inv-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
            .inv-table th { background: var(--light-grey); font-size: 10px; text-transform: uppercase; padding: 8px; border: 1px solid var(--border-color); text-align: left; }
            .inv-table td { padding: 10px; border: 1px solid var(--border-color); font-size: 12px; }

            /* Totals Section */
            .inv-footer { display: flex; justify-content: space-between; align-items: flex-start; }
            .terms { width: 60%; font-size: 9px; color: #555; }
            .totals-box { width: 35%; border: 1px solid var(--border-color); }
            .total-row { display: flex; justify-content: space-between; padding: 8px; border-bottom: 1px solid #eee; }
            .total-row.grand-total { background: var(--light-grey); font-weight: bold; font-size: 14px; border-bottom: none; }
        }
        