:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --secondary: #64748b;
    --accent: #0ea5e9;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --success: #10b981;
    --border: #e2e8f0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    margin: 0;
    line-height: 1.6;
}

/* Navbar */
.navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.brand {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--primary);
}

/* Hero Search Section */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    padding: 4rem 1rem;
    text-align: center;
    color: white;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 800;
}

.hero p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

.search-box {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    display: flex;
    gap: 0.5rem;
    background: white;
    padding: 0.5rem;
    border-radius: 50px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.search-input {
    flex: 1;
    border: none;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    border-radius: 50px;
    outline: none;
}

.search-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0 2rem;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.search-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* Content Container */
.container {
    max-width: 1000px;
    margin: -3rem auto 3rem;
    padding: 0 1rem;
    position: relative;
    z-index: 10;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

/* Status Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
    border-left: 2px solid var(--border);
    margin: 1rem 0;
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -2.6rem;
    top: 0;
    width: 1rem;
    height: 1rem;
    background: var(--border);
    border-radius: 50%;
    border: 4px solid var(--card-bg);
}

.timeline-item.active::before {
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.timeline-date {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.timeline-content {
    font-weight: 600;
    font-size: 1.1rem;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.info-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.info-value {
    font-size: 1.1rem;
    font-weight: 500;
}

/* Badge */
.status-badge {
    background: #dcfce7;
    color: #166534;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Action Buttons */
.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    border: 2px solid var(--border);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-download:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f8fafc;
}

/* Error State */
.error-box {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.error-icon {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Mobile */
@media (max-width: 768px) {
    .info-grid {
        grid-template-columns: 1fr;
    }

    .hero h1 {
        font-size: 2rem;
    }
}

/* PRINT STYLES */
@media print {
    @page {
        margin: 1.5cm;
        size: A4;
    }

    /* Hide non-printable elements */
    .navbar,
    .hero,
    .search-box,
    .btn-download,
    .no-print {
        display: none !important;
    }

    /* Show print-only header with logo */
    .print-header {
        display: block !important;
    }

    body {
        background: white;
        color: black;
        font-size: 12pt;
    }

    .container {
        margin: 0;
        max-width: 100%;
        padding: 0;
        box-shadow: none;
    }

    .card {
        border: none;
        box-shadow: none;
        margin-bottom: 20px;
        padding: 0;
        break-inside: avoid;
        /* Prevent cutting cards across pages */
        border-bottom: 1px solid #ddd;
        padding-bottom: 20px;
    }

    .card-header {
        border-bottom: 2px solid #000;
        margin-bottom: 20px;
    }

    .status-badge {
        border: 1px solid #000;
        color: #000 !important;
        background: #fff !important;
        /* Save Ink */
        padding: 4px 12px;
    }

    /* Enforce Timeline Printing */
    .timeline-item::before {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        border-color: #000;
        background: #fff;
    }

    .timeline-item.active::before {
        background: #000 !important;
    }

    .timeline {
        border-left: 2px solid #999;
    }

    /* Typography for print */
    .info-label {
        color: #666;
        font-size: 10pt;
    }

    .info-value {
        color: #000;
        font-size: 12pt;
    }

    /* Google Map */
    #map {
        border: 1px solid #ccc;
        height: 300px !important;
    }

    /* Add a Print Footer */
    body::after {
        content: "Detailed Tracking Report - Generated from Smart Ship Network";
        display: block;
        text-align: center;
        margin-top: 50px;
        font-size: 10pt;
        color: #999;
        border-top: 1px solid #ddd;
        padding-top: 10px;
    }

    a {
        text-decoration: none;
        color: #000;
    }
}