/**
 * Porter Order Tracking — Timeline & UI styles.
 * Mobile-first, responsive.
 */

:root {
    --pot-brand: #2271b1;
    --pot-green: #28a745;
    --pot-blue: #17a2b8;
    --pot-yellow: #ffc107;
    --pot-red: #dc3545;
    --pot-gray: #6c757d;
    --pot-light: #f8f9fa;
    --pot-border: #e2e4e7;
}

/* ----------------------------------------------------------------
   Status Badges
   ---------------------------------------------------------------- */

.pot-status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.pot-status-pending   { background: #fff3cd; color: #856404; }
.pot-status-shipped   { background: #d1ecf1; color: #0c5460; }
.pot-status-transit   { background: #cce5ff; color: #004085; }
.pot-status-delivery  { background: #d4edda; color: #155724; }
.pot-status-delivered { background: var(--pot-green); color: #fff; }
.pot-status-issue     { background: var(--pot-red); color: #fff; }

/* ----------------------------------------------------------------
   Order List Table
   ---------------------------------------------------------------- */

.pot-orders-table {
    width: 100%;
    border-collapse: collapse;
}

.pot-orders-table th {
    text-align: left;
    font-size: 13px;
    color: var(--pot-gray);
    border-bottom: 2px solid var(--pot-border);
    padding: 8px 12px;
}

.pot-orders-table td {
    padding: 12px;
    border-bottom: 1px solid var(--pot-border);
    vertical-align: middle;
}

.pot-track-btn {
    font-size: 13px !important;
    padding: 6px 16px !important;
}

.pot-no-tracking {
    color: var(--pot-gray);
    font-style: italic;
    font-size: 13px;
}

/* ----------------------------------------------------------------
   Tracking Detail Header
   ---------------------------------------------------------------- */

.pot-tracking-header {
    margin-bottom: 24px;
}

.pot-back-link {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--pot-brand);
    text-decoration: none;
}

.pot-back-link:hover {
    text-decoration: underline;
}

.pot-tracking-header h2 {
    margin: 0 0 4px;
}

.pot-order-date {
    color: var(--pot-gray);
    font-size: 14px;
    margin: 0;
}

/* ----------------------------------------------------------------
   Package Tabs (multi-package)
   ---------------------------------------------------------------- */

.pot-package-summary {
    margin-bottom: 16px;
}

.pot-package-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--pot-gray);
}

.pot-package-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.pot-package-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 2px solid var(--pot-border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: border-color 0.2s, background 0.2s;
}

.pot-package-tab:hover {
    border-color: var(--pot-brand);
}

.pot-package-tab.active {
    border-color: var(--pot-brand);
    background: #f0f6fc;
}

.pot-tab-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

.pot-package-panel {
    display: none;
}

.pot-package-panel.active {
    display: block;
}

/* ----------------------------------------------------------------
   Shipment Info Card
   ---------------------------------------------------------------- */

.pot-shipment-info {
    background: var(--pot-light);
    border: 1px solid var(--pot-border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
}

.pot-info-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
}

.pot-info-row + .pot-info-row {
    border-top: 1px solid var(--pot-border);
}

.pot-info-label {
    font-size: 13px;
    color: var(--pot-gray);
    font-weight: 500;
}

.pot-info-value {
    font-size: 14px;
    font-weight: 600;
    text-align: right;
}

.pot-info-value a {
    color: var(--pot-brand);
    text-decoration: none;
}

.pot-info-value a:hover {
    text-decoration: underline;
}

.pot-eta-countdown {
    font-weight: 400;
    color: var(--pot-gray);
}

/* ----------------------------------------------------------------
   Visual Timeline
   ---------------------------------------------------------------- */

.pot-timeline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 24px 0;
    position: relative;
}

/* Connecting line */
.pot-timeline::before {
    content: '';
    position: absolute;
    top: 38px;
    left: 24px;
    right: 24px;
    height: 3px;
    background: var(--pot-border);
    z-index: 0;
}

.pot-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    flex: 1;
    min-width: 0;
}

.pot-step-marker {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    position: relative;
    transition: all 0.3s;
}

/* States */
.pot-step-future .pot-step-marker {
    background: #fff;
    border: 3px solid var(--pot-border);
}

.pot-step-complete .pot-step-marker {
    background: var(--pot-green);
    border: 3px solid var(--pot-green);
    color: #fff;
}

.pot-step-current .pot-step-marker {
    background: var(--pot-brand);
    border: 3px solid var(--pot-brand);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(34, 113, 177, 0.2);
}

.pot-step-exception .pot-step-marker {
    background: var(--pot-red);
    border: 3px solid var(--pot-red);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.2);
}

/* Pulse animation on current step */
.pot-step-pulse {
    width: 10px;
    height: 10px;
    background: #fff;
    border-radius: 50%;
    animation: pot-pulse 2s ease-in-out infinite;
}

@keyframes pot-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.7; }
}

.pot-step-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--pot-gray);
    text-align: center;
    max-width: 80px;
    word-wrap: break-word;
}

.pot-step-current .pot-step-label,
.pot-step-complete .pot-step-label {
    color: #1d2327;
    font-weight: 600;
}

.pot-step-exception .pot-step-label {
    color: var(--pot-red);
    font-weight: 600;
}

/* ----------------------------------------------------------------
   Event History
   ---------------------------------------------------------------- */

.pot-event-history {
    margin-top: 24px;
}

.pot-event-history h3 {
    font-size: 16px;
    margin-bottom: 12px;
}

.pot-events {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pot-event {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid var(--pot-border);
    font-size: 14px;
}

.pot-event:last-child {
    border-bottom: none;
}

.pot-event-time {
    width: 120px;
    color: var(--pot-gray);
    font-size: 13px;
    flex-shrink: 0;
}

.pot-event-desc {
    flex: 1;
    min-width: 0;
}

.pot-event-loc {
    color: var(--pot-gray);
    font-size: 13px;
    flex-basis: 100%;
    padding-left: 128px;
}

/* Carrier link fallback */
.pot-carrier-link {
    margin-top: 16px;
}

/* No shipments */
.pot-no-shipments {
    text-align: center;
    padding: 40px 20px;
    background: var(--pot-light);
    border-radius: 8px;
    color: var(--pot-gray);
}

/* ----------------------------------------------------------------
   Mobile Responsive
   ---------------------------------------------------------------- */

@media (max-width: 600px) {
    .pot-timeline {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        padding: 16px 0;
    }

    .pot-timeline::before {
        top: 0;
        bottom: 0;
        left: 15px;
        right: auto;
        width: 3px;
        height: auto;
    }

    .pot-step {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        padding: 8px 0;
        width: 100%;
    }

    .pot-step-marker {
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .pot-step-label {
        text-align: left;
        max-width: none;
    }

    .pot-info-row {
        flex-direction: column;
        gap: 2px;
    }

    .pot-info-value {
        text-align: left;
    }

    .pot-event-time {
        width: auto;
        flex-basis: 100%;
    }

    .pot-event-loc {
        padding-left: 0;
    }

    .pot-orders-table thead {
        display: none;
    }

    .pot-orders-table td {
        display: block;
        text-align: left;
        padding: 4px 12px;
        border: none;
    }

    .pot-orders-table td:first-child {
        padding-top: 12px;
        font-weight: 600;
    }

    .pot-orders-table td:last-child {
        padding-bottom: 12px;
        border-bottom: 1px solid var(--pot-border);
    }

    .pot-orders-table td::before {
        content: attr(data-title) ": ";
        font-weight: 600;
        font-size: 12px;
        color: var(--pot-gray);
    }

    .pot-orders-table td:last-child::before {
        display: none;
    }
}

/* ----------------------------------------------------------------
   Public Tracking Page
   ---------------------------------------------------------------- */

.pot-public-tracking {
    max-width: 700px;
    margin: 0 auto;
    padding: 24px 16px;
}

.pot-public-header {
    text-align: center;
    margin-bottom: 32px;
}

.pot-public-header img {
    max-height: 48px;
    margin-bottom: 12px;
}

.pot-public-header h1 {
    font-size: 22px;
    margin: 0 0 4px;
}

.pot-public-header p {
    color: var(--pot-gray);
    font-size: 14px;
    margin: 0;
}

.pot-public-error {
    text-align: center;
    padding: 48px 20px;
    color: var(--pot-gray);
}
