/* ========================================================================
   SHIPMENT REAL-TIME TRACKING MAP STYLES
   ======================================================================== */

.gil-result__map {
    margin-top: 2rem;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
}

.gil-result__map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: linear-gradient(135deg, #e85d04, #f5772d);
    color: white;
    border-radius: 0.5rem 0.5rem 0 0;
}

.gil-result__map-header h4 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.gil-result__map-header svg {
    color: white;
}

/* Map Legend */
.gil-map-legend {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
}

.gil-map-legend__item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.gil-map-legend__dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Map Container */
.gil-map-container {
    position: relative;
    width: 100%;
    height: 450px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
}

#gilShipmentMap {
    width: 100% !important;
    height: 100% !important;
    display: block;
    border-radius: 0.25rem;
}

/* SVG Map Styles */
.gil-svg-map {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
}

.shipment-group {
    pointer-events: auto;
}

/* Route Line Animation */
.animated-route {
    stroke-dasharray: 1000;
    stroke-dashoffset: 0;
}

.progress-line {
    transition: x2 0.5s ease-out, y2 0.5s ease-out;
}

/* Markers */
.origin-marker,
.destination-marker {
    transition: r 0.2s ease;
    cursor: pointer;
}

.origin-marker:hover,
.destination-marker:hover {
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15));
}

.current-marker {
    cursor: pointer;
}

.pulse-marker {
    animation: shipmentPulse 2s infinite;
}

@keyframes shipmentPulse {
    0%, 100% {
        r: 8px;
        opacity: 1;
    }
    50% {
        r: 12px;
        opacity: 0.5;
    }
}

.marker-pin {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    transition: r 0.2s ease;
}

.marker-pin:hover {
    r: 8px;
}

/* Status Badge - Visual Icon showing shipment status */
.marker-status-badge {
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
    cursor: pointer;
}

.marker-status-badge circle {
    transition: fill 0.3s ease, stroke 0.3s ease;
}

.marker-status-badge text {
    pointer-events: none;
    user-select: none;
    font-family: 'Arial Black', Arial, sans-serif;
}

.marker-status-badge:hover circle {
    filter: brightness(1.15);
    stroke-width: 2.5;
}

/* Location Labels */
.location-label {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 500;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* Shipment Tooltip */
.shipment-tooltip {
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    padding: 1rem;
    min-width: 250px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    animation: tooltipAppear 0.2s ease-out;
}

@keyframes tooltipAppear {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tooltip-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    color: #333;
}

.tooltip-header strong {
    color: #e85d04;
}

.tooltip-body {
    font-size: 0.85rem;
}

.tooltip-body p {
    margin: 0.25rem 0;
    line-height: 1.4;
}

.tooltip-body strong {
    color: #555;
    font-weight: 600;
}

/* Map Controls Panel */
.gil-map-controls-panel {
    padding: 1rem;
    border-top: 1px solid #e0e0e0;
    background: #fafafa;
}

.gil-map-controls-toggle {
    display: none;
    background: white;
    border: 1px solid #ddd;
    padding: 0.75rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
    width: 100%;
    text-align: left;
    transition: all 0.2s ease;
}

.gil-map-controls-toggle:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.gil-map-controls-toggle[aria-expanded="true"] .gil-map-controls-chevron {
    transform: rotate(180deg);
}

.gil-map-controls-chevron {
    float: right;
    transition: transform 0.2s ease;
    color: #e85d04;
}

/* Responsive Design */
@media (max-width: 768px) {
    .gil-result__map-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .gil-map-legend {
        gap: 1rem;
        font-size: 0.8rem;
    }

    .gil-map-container {
        min-height: 300px;
        padding: 1rem;
    }

    .gil-map-controls-toggle {
        display: block;
    }

    .shipment-tooltip {
        min-width: 200px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .gil-map-legend {
        flex-direction: column;
        gap: 0.5rem;
    }

    .gil-map-container {
        min-height: 250px;
        padding: 0.75rem;
    }

    .shipment-tooltip {
        min-width: 180px;
        padding: 0.75rem;
    }

    .location-label {
        font-size: 10px;
    }
}

/* Status-based styling */
.shipment-status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.shipment-status-badge.pending {
    background: #FFF3CD;
    color: #856404;
}

.shipment-status-badge.in_transit {
    background: #D1ECF1;
    color: #0C5460;
}

.shipment-status-badge.out_for_delivery {
    background: #CCE5FF;
    color: #004085;
}

.shipment-status-badge.delivered {
    background: #D4EDDA;
    color: #155724;
}

.shipment-status-badge.on_hold {
    background: #F8D7DA;
    color: #721C24;
}

.shipment-status-badge.delayed {
    background: #FFE5E5;
    color: #C41F1F;
}

/* Animation Classes */
.marker-animating {
    animation: markerMove 3s ease-out forwards;
}

@keyframes markerMove {
    from {
        opacity: 0.7;
        filter: drop-shadow(0 0 3px rgba(255, 152, 0, 0.5));
    }
    to {
        opacity: 1;
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    }
}

/* Loading State */
.gil-map-container.loading {
    opacity: 0.6;
    pointer-events: none;
}

.gil-map-container.loading::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #e85d04;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ── ETA PANEL ────────────────────────────────────────────────────────── */

.gil-eta-panel {
    padding: 1rem 1.25rem;
    background: #f4f8fb;
    border-top: 1px solid #d9e8f0;
    font-family: 'Segoe UI', Arial, sans-serif;
}

.gil-eta-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem 1rem;
}

.gil-eta-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.gil-eta-item--wide {
    grid-column: span 3;
}

.gil-eta-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #8a9ab0;
}

.gil-eta-value {
    font-size: 0.88rem;
    font-weight: 500;
    color: #1a2e4a;
}

/* Status colour variants */
.gil-eta-status[data-status="in_transit"]       { color: #0277BD; font-weight: 700; }
.gil-eta-status[data-status="out_for_delivery"] { color: #E65100; font-weight: 700; }
.gil-eta-status[data-status="delivered"]        { color: #2E7D32; font-weight: 700; }
.gil-eta-status[data-status="on_hold"]          { color: #B71C1C; font-weight: 700; }
.gil-eta-status[data-status="delayed"]          { color: #E65100; font-weight: 700; }
.gil-eta-status[data-status="pending"]          { color: #757575; }

/* Progress bar */
.gil-eta-progress {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.gil-eta-bar {
    flex: 1;
    height: 7px;
    background: #d5e5ef;
    border-radius: 4px;
    overflow: hidden;
}

.gil-eta-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #29B6F6 0%, #0288D1 100%);
    border-radius: 4px;
    transition: width 0.4s ease-out;
    min-width: 2px;
}

.gil-eta-pct {
    font-size: 0.82rem;
    font-weight: 700;
    color: #0288D1;
    min-width: 34px;
    text-align: right;
}

/* Route-type chip inside SVG is self-contained; no extra CSS needed */

/* Responsive */
@media (max-width: 600px) {
    .gil-eta-grid          { grid-template-columns: repeat(2, 1fr); }
    .gil-eta-item--wide    { grid-column: span 2; }
}

@media (max-width: 380px) {
    .gil-eta-grid          { grid-template-columns: 1fr; }
    .gil-eta-item--wide    { grid-column: span 1; }
}

/* Print Styles */
@media print {
    .gil-map-controls-panel {
        display: none;
    }

    .gil-result__map {
        page-break-inside: avoid;
    }
}
