/**
 * SmartTrack Timeline Styles
 *
 * Designed to work with Shoptimizer theme.
 * Clean, minimal timeline that replaces AST PRO's tracking display.
 */

/* Wrapper */
.smarttrack-tracking-wrapper {
    margin: 24px 0;
    font-family: inherit;
}

.smarttrack-heading {
    font-size: 1.3em;
    font-weight: 600;
    margin: 0 0 20px;
    color: #1a1a1a;
}

/* Shipment block */
.smarttrack-shipment {
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
}

/* Header: reference + status badge */
.smarttrack-shipment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.smarttrack-reference {
    font-size: 14px;
    color: #555;
}

.smarttrack-label {
    font-weight: 400;
    color: #888;
}

.smarttrack-number {
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    color: #333;
    letter-spacing: 0.3px;
}

/* Status badge */
.smarttrack-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.smarttrack-status--pending,
.smarttrack-status--registered {
    background: #f0f0f0;
    color: #666;
}

.smarttrack-status--shipped,
.smarttrack-status--in_transit_intl {
    background: #e3f2fd;
    color: #1565c0;
}

.smarttrack-status--in_transit_domestic,
.smarttrack-status--out_for_delivery {
    background: #e8f5e9;
    color: #2e7d32;
}

.smarttrack-status--delivered {
    background: #e8f5e9;
    color: #1b5e20;
}

.smarttrack-status--exception {
    background: #fce4ec;
    color: #c62828;
}

/* ETA */
.smarttrack-eta {
    margin-bottom: 20px;
    font-size: 14px;
    color: #555;
}

.smarttrack-eta-label {
    color: #888;
}

.smarttrack-eta-date {
    font-weight: 600;
    color: #333;
}

/* ============================================================
   Progress Bar
   ============================================================ */

.smarttrack-progress {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin: 20px 0 28px;
    padding: 0 4px;
    position: relative;
}

/* Connecting line behind the dots — grey background track.
   Runs from center of first dot (12.5%) to center of last dot (87.5%). */
.smarttrack-progress::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 12.5%;
    right: 12.5%;
    height: 3px;
    background: #e0e0e0;
    z-index: 0;
    border-radius: 2px;
}

/* Green fill — width driven by --progress CSS variable (0–100%).
   Track width = 75% of container (from 12.5% to 87.5%). */
.smarttrack-progress::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 12.5%;
    height: 3px;
    background: #4CAF50;
    z-index: 0;
    border-radius: 2px;
    width: calc(0.75 * var(--progress, 0%));
    transition: width 0.5s ease;
}

.smarttrack-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    flex: 1;
}

.smarttrack-progress-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e0e0e0;
    border: 2px solid #e0e0e0;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.smarttrack-progress-step--complete .smarttrack-progress-dot {
    background: #4CAF50;
    border-color: #4CAF50;
}

.smarttrack-progress-step--active .smarttrack-progress-dot {
    background: #fff;
    border-color: #2196F3;
    box-shadow: 0 0 0 4px rgba(33, 150, 243, 0.2);
}

.smarttrack-progress-label {
    font-size: 11px;
    color: #999;
    text-align: center;
    font-weight: 500;
    max-width: 80px;
}

.smarttrack-progress-step--complete .smarttrack-progress-label,
.smarttrack-progress-step--active .smarttrack-progress-label {
    color: #333;
    font-weight: 600;
}

/* ============================================================
   Timeline Events
   ============================================================ */

.smarttrack-timeline {
    position: relative;
    padding-left: 32px;
}

/* Vertical timeline line */
.smarttrack-timeline::before {
    content: '';
    position: absolute;
    left: 9px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e8e8e8;
}

/* Single event */
.smarttrack-event {
    display: flex;
    align-items: flex-start;
    position: relative;
    padding-bottom: 16px;
    min-height: 40px;
}

.smarttrack-event:last-child {
    padding-bottom: 0;
}

/* Timeline dot */
.smarttrack-event-icon {
    position: absolute;
    left: -32px;
    top: 2px;
    z-index: 1;
}

.smarttrack-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #e0e0e0;
    border: 2px solid #fff;
    font-size: 10px;
    color: #fff;
}

.smarttrack-dot--active {
    background: #2196F3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.25);
    animation: smarttrack-pulse 2s ease-in-out infinite;
}

.smarttrack-dot--delivered {
    background: #4CAF50;
    font-weight: 700;
}

@keyframes smarttrack-pulse {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.25);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(33, 150, 243, 0.1);
    }
}

/* Event content */
.smarttrack-event-content {
    flex: 1;
}

.smarttrack-event-description {
    font-size: 14px;
    color: #333;
    line-height: 1.4;
    font-weight: 400;
}

.smarttrack-event--latest .smarttrack-event-description {
    font-weight: 600;
    color: #1a1a1a;
}

.smarttrack-event-meta {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

/* No events state */
.smarttrack-no-events {
    text-align: center;
    padding: 24px;
    color: #888;
    font-size: 14px;
}

.smarttrack-no-events p {
    margin: 0;
}

/* Carrier display */
.smarttrack-carrier {
    margin-bottom: 8px;
    font-size: 14px;
    color: #555;
}

.smarttrack-carrier-label {
    color: #888;
}

.smarttrack-carrier-name {
    font-weight: 600;
    color: #333;
}

/* Smart estimate — distinct styling so it stands out */
.smarttrack-eta--estimate {
    background: #f0f7ff;
    border: 1px solid #c3daf5;
    border-radius: 6px;
    padding: 10px 14px;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.smarttrack-eta-icon {
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 1px;
}

.smarttrack-eta-text {
    color: #333;
    font-weight: 500;
    font-size: 14px;
    line-height: 1.5;
}

.smarttrack-eta-remaining {
    color: #1565c0;
    font-weight: 600;
    font-size: 14px;
}

/* Contact link */
.smarttrack-contact {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
    text-align: center;
}

.smarttrack-contact-link {
    font-size: 13px;
    color: #666;
    text-decoration: none;
    transition: color 0.2s;
}

.smarttrack-contact-link:hover {
    color: #1565c0;
    text-decoration: underline;
}

/* ============================================================
   AST PRO suppression — hide any AST output when SmartTrack is active
   ============================================================ */

.smarttrack-tracking-wrapper ~ .tracking-info,
.smarttrack-tracking-wrapper ~ .fluid-tracking-container,
.smarttrack-tracking-wrapper ~ .order-tracking-details,
.smarttrack-tracking-wrapper ~ [class*="shipment-tracking"],
.smarttrack-tracking-wrapper ~ .ast-tracking-column,
.smarttrack-tracking-wrapper ~ .wc-tracking-info {
    display: none !important;
}

/* ============================================================
   Mobile responsive
   ============================================================ */

@media (max-width: 600px) {
    .smarttrack-shipment {
        padding: 16px;
    }

    .smarttrack-shipment-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .smarttrack-progress-label {
        font-size: 10px;
        max-width: 60px;
    }

    .smarttrack-progress-dot {
        width: 16px;
        height: 16px;
    }

    .smarttrack-event-description {
        font-size: 13px;
    }
}
