/* --- CORE SETTINGS --- */
:root {
    --sn-navy: #0f2b4c;
    --sn-blue: #2daae1;
    --sn-dark-blue: #0b1e36;
    --sn-gray-bg: #f4f7f9;
    --text-dark: #333;
    --text-light: #666;
    --white: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    outline: none;
}

body {
    font-family: 'Roboto', sans-serif;
    color: var(--text-dark);
    line-height: 1.6;
    background-color: var(--sn-gray-bg);
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.3s;
}

ul {
    list-style: none;
}

h1,
h2,
h3,
h4 {
    font-family: 'Roboto Condensed', sans-serif;
    font-weight: 700;
    color: var(--sn-navy);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Buttons */
.btn {
    display: inline-block;
    background: var(--sn-blue);
    color: white;
    padding: 12px 30px;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 14px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
}

.btn:hover {
    background: #2389b8;
}

/* --- TRACKING HERO --- */
.tracking-hero {
    background: linear-gradient(rgba(15, 43, 76, 0.9), rgba(15, 43, 76, 0.8)), url('https://images.unsplash.com/photo-1578575437130-527eed3abbec?ixlib=rb-1.2.1&auto=format&fit=crop&w=1950&q=80');
    background-size: cover;
    background-position: center;
    padding: 100px 0 140px;
    color: white;
    text-align: center;
}

.tracking-hero h1 {
    color: white;
    font-size: 48px;
    margin-bottom: 20px;
}

.tracking-hero p {
    font-size: 18px;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* --- TRACKING BOX --- */
.tracking-container {
    max-width: 900px;
    margin: -80px auto 60px;
    padding: 0 20px;
    position: relative;
    z-index: 10;
}

.tracking-box {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

.tracking-form {
    position: relative;
    display: block;
    max-width: 100%;
}

.tracking-input {
    width: 100%;
    padding: 15px 150px 15px 25px;
    /* Right padding for button */
    border: 2px solid #eee;
    border-radius: 50px;
    font-size: 18px;
    transition: 0.3s;
    outline: none;
}

.tracking-input:focus {
    border-color: var(--sn-blue);
    box-shadow: 0 0 0 4px rgba(45, 170, 225, 0.1);
}

.track-btn {
    position: absolute;
    right: 5px;
    top: 5px;
    bottom: 5px;
    padding: 0 30px;
    font-size: 14px;
    background: var(--sn-blue);
    color: white;
    border: none;
    border-radius: 45px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    transition: 0.3s;
    overflow: hidden;
}

.track-btn:hover {
    background: #2389b8;
    transform: scale(0.98);
}

.track-btn.loading {
    padding-right: 45px;
    pointer-events: none;
    opacity: 0.9;
}

.track-btn.loading::after {
    content: '';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: btn-spin 0.8s linear infinite;
}

@keyframes btn-spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}



/* --- RESULT SECTION --- */
#tracking-result {
    display: none;
    margin-top: 40px;
    animation: fadeIn 0.5s ease;
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.status-badge {
    padding: 8px 16px;
    border-radius: 50px;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 14px;
}

.status-badge.pending {
    background: #fff3cd;
    color: #856404;
}

.status-badge.transit {
    background: #cce5ff;
    color: #004085;
}

.status-badge.delivered {
    background: #d4edda;
    color: #155724;
}

.shipment-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 40px;
}

.info-item h5 {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.info-item p {
    font-size: 18px;
    font-weight: 500;
    color: var(--sn-navy);
}

/* Timeline */
.timeline {
    position: relative;
    margin-top: 30px;
}

.timeline-item {
    position: relative;
    padding-left: 35px;
    /* Space for dot and line */
    padding-bottom: 30px;
}

/* The dot */
.timeline-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 2px;
    /* Adjust vertical alignment */
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--sn-blue);
    border: 3px solid var(--white);
    box-shadow: 0 0 0 2px var(--sn-blue);
    z-index: 2;
    /* Dot is on top */
}

/* Completed Items */
.timeline-item.completed::before {
    background: var(--sn-blue);
}



/* Current Item pulsing effect */
.timeline-item.current::before {
    background: var(--sn-blue);
    animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
    0% {
        box-shadow: 0 0 0 0 rgba(45, 170, 225, 0.7);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(45, 170, 225, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(45, 170, 225, 0);
    }
}

/* The line connecting to the NEXT item */
.timeline-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 10px;
    /* (dot width 22 / 2) - (line width 2 / 2) = 10 */
    top: 24px;
    /* Start just below the dot */
    bottom: 0;
    width: 2px;
    background-color: #eee;
    z-index: 1;
    /* Line is behind the dot */
}

/* Completed Items Line - Specificity override */
.timeline-item.completed:not(:last-child)::after {
    background-color: var(--sn-blue);
}

.timeline-date {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 5px;
}

.timeline-status {
    font-weight: 700;
    color: var(--sn-navy);
    font-size: 16px;
}

.timeline-loc {
    font-size: 14px;
    color: var(--text-light);
}

.error-msg {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    margin-top: 20px;
    display: none;
    text-align: center;
}

.print-btn,
.share-btn,
.copy-btn {
    background: none;
    border: 1px solid #ddd;
    color: var(--text-light);
    padding: 5px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: 0.3s;
    margin-left: 15px;
}

.print-btn:hover,
.share-btn:hover,
.copy-btn:hover {
    background: #f8f9fa;
    color: var(--sn-blue);
    border-color: var(--sn-blue);
}

@media print {

    .top-bar,
    nav,
    .tracking-hero,
    footer,
    .tracking-form,
    #error-msg,
    .print-btn,
    .share-btn,
    .copy-btn,
    #page-loader {
        display: none !important;
    }

    .tracking-container {
        margin: 0;
        padding: 0;
        max-width: 100%;
    }

    .tracking-box {
        box-shadow: none;
        padding: 0;
    }

    #tracking-result {
        display: block !important;
        margin-top: 0;
    }

    body {
        background: white;
    }
}

/* Hide the line for the last item */
.timeline-item:last-child {
    padding-bottom: 0;
}

/* Animated Marker for Current Location */
.current-location-marker .animated-dot {
    background-color: var(--sn-blue);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 3px solid var(--white);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.current-location-marker .pulse {
    background-color: var(--sn-blue);
    border-radius: 50%;
    height: 20px;
    width: 20px;
    position: absolute;
    left: 0;
    top: 0;
    animation: pulse-animation 2s infinite;
    z-index: -1;
}

@keyframes pulse-animation {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }

    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

/* Hide Leaflet Routing Machine's instruction panel */
.leaflet-routing-container {
    display: none;
}

/* Leaflet Layer Control Style */
.leaflet-control-layers {
    border-radius: 5px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
    border: 1px solid #ddd;
}

.leaflet-control-layers-toggle {
    width: 36px !important;
    height: 36px !important;
    background-size: 20px 20px !important;
    background-position: center !important;
}

/* Map Pan Controls */
.map-controls-wrapper {
    position: absolute;
    bottom: 15px;
    right: 15px;
    z-index: 1000;
}

.map-controls-toggle {
    display: none;
    /* Hidden on desktop */
}

.map-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(2px);
    border-radius: 8px;
    padding: 5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

.map-controls-middle {
    display: flex;
}

.map-control-btn {
    width: 38px;
    height: 38px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    font-size: 18px;
    color: var(--sn-navy);
    transition: background-color 0.2s;
    border-radius: 50%;
}

.map-control-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {

    /* Specific Text Adjustments */
    .tracking-hero {
        padding: 80px 0 120px;
    }

    .tracking-hero h1 {
        font-size: 32px;
    }

    .tracking-hero p {
        font-size: 16px;
        padding: 0 10px;
    }

    .tracking-form {
        max-width: 100%;
    }

    .tracking-input {
        padding-right: 110px;
        /* Smaller padding for mobile */
        font-size: 18px;
    }

    .track-btn {
        padding: 0 15px;
        font-size: 12px;
        width: auto;
    }

    .shipment-info-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .tracking-container {
        padding: 0 15px;
        margin-top: -60px;
    }

    .tracking-box {
        padding: 25px;
    }

    .status-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .status-header>div:last-child {
        flex-wrap: wrap;
        gap: 10px;
        display: flex;
        /* Ensure flex is active for wrapping */
    }

    .status-header>div:last-child button {
        margin-left: 0;
        /* Use gap instead */
    }

    #map-container {
        margin-bottom: 15px;
    }

    #map {
        height: 250px !important;
    }

    .map-controls-wrapper {
        position: static;
    }

    .map-controls-toggle {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        background: var(--white);
        border: 1px solid #eee;
        padding: 12px 20px;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 500;
        color: var(--sn-navy);
        cursor: pointer;
    }

    .map-controls-toggle i {
        transition: transform 0.3s;
    }

    .map-controls-wrapper.open .map-controls-toggle i {
        transform: rotate(180deg);
    }

    .map-controls {
        position: static;
        max-height: 0;
        overflow: hidden;
        padding: 0;
        margin-top: 10px;
        flex-direction: row;
        justify-content: space-around;
        width: 100%;
        background: var(--white);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
        backdrop-filter: none;
    }

    .map-controls-wrapper.open .map-controls {
        max-height: 100px;
        padding: 10px;
    }

    .map-controls-middle {
        display: contents;
    }
}

/* --- LEGAL & POLICY PAGES --- */
.legal-hero {
    background: linear-gradient(rgba(15, 43, 76, 0.95), rgba(15, 43, 76, 0.9)), url('https://images.unsplash.com/photo-1578575437130-527eed3abbec?ixlib=rb-1.2.1&auto=format&fit=crop&w=1950&q=80');
    background-size: cover;
    background-position: center;
    padding: 120px 0 80px;
    color: white;
    text-align: center;
    clip-path: polygon(0 0, 100% 0, 100% 90%, 0 100%);
}

.legal-hero h1 {
    color: white;
    font-size: 56px;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.legal-hero p {
    font-size: 18px;
    opacity: 0.8;
    max-width: 700px;
    margin: 0 auto;
}

.legal-content-section {
    padding: 80px 0 120px;
    background: var(--sn-gray-bg);
}

.legal-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

.legal-body {
    background: white;
    padding: 50px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.03);
}

.legal-body h2 {
    margin: 40px 0 20px;
    font-size: 28px;
    color: var(--sn-navy);
    border-left: 4px solid var(--sn-blue);
    padding-left: 20px;
}

.legal-body h2:first-of-type {
    margin-top: 0;
}

.legal-body h3 {
    margin: 30px 0 15px;
    font-size: 22px;
    color: var(--sn-navy);
}

.legal-body p {
    margin-bottom: 20px;
    color: var(--text-light);
    font-size: 16px;
    line-height: 1.8;
}

.legal-body ul {
    margin-bottom: 25px;
    list-style: disc;
    padding-left: 25px;
}

.legal-body li {
    margin-bottom: 12px;
    color: var(--text-light);
}

.last-updated {
    font-size: 14px;
    color: var(--sn-blue);
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 40px;
}

@media (max-width: 768px) {
    .legal-hero {
        padding: 100px 0 60px;
    }

    .legal-hero h1 {
        font-size: 36px;
    }

    .legal-body {
        padding: 30px 20px;
    }
}

/* --- GENERAL PAGE STYLES --- */
.section {
    padding: 80px 0 120px;
}

.section-header {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 60px;
}

.section-header h2 {
    font-size: 36px;
    margin-bottom: 15px;
    color: var(--sn-navy);
}

.feature-list li {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-light);
}

.feature-list i {
    color: var(--sn-blue);
}

.stats-section {
    padding: 80px 0 120px;
    background: var(--sn-navy);
    color: white;
}

.stat-item h3 {
    font-size: 48px;
    color: var(--sn-blue);
    margin-bottom: 5px;
}

.page-hero {
    background: linear-gradient(rgba(15, 43, 76, 0.9), rgba(15, 43, 76, 0.8)), url('https://images.unsplash.com/photo-1578575437130-527eed3abbec?ixlib=rb-1.2.1&auto=format&fit=crop&w=1950&q=80');
    background-size: cover;
    background-position: center;
    padding: 120px 0 100px;
    color: white;
    text-align: center;
    clip-path: polygon(0 0, 100% 0, 100% 90%, 0 100%);
}

.page-hero h1 {
    color: white;
    font-size: 56px;
    margin-bottom: 20px;
}

.page-hero p {
    font-size: 18px;
    opacity: 0.9;
    max-width: 700px;
    margin: 0 auto;
}

/* Contact Form Styles */
.contact-container {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 50px;
    margin-top: 50px;
}

.contact-info-card {
    background: var(--sn-navy);
    color: white;
    padding: 50px;
    border-radius: 12px;
}

.contact-info-card h2 {
    color: white;
    margin-bottom: 30px;
}

.contact-method {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

.contact-method i {
    width: 50px;
    height: 50px;
    background: rgba(45, 170, 225, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--sn-blue);
    font-size: 20px;
}

.contact-form-card {
    background: white;
    padding: 50px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: var(--sn-navy);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #eee;
    border-radius: 6px;
    font-family: inherit;
    transition: 0.3s;
}

.form-group input:focus {
    border-color: var(--sn-blue);
    box-shadow: 0 0 0 3px rgba(45, 170, 225, 0.1);
}

@media (max-width: 768px) {
    .contact-container {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .page-hero h1 {
        font-size: 36px;
    }
}