/* Liberty shipments & tracking section - matches dashboard styles */

.liberty-shipments-section {
    margin: 24px 0;
    padding: 16px 20px;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    font-size: 14px;
}

.liberty-shipments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 14px;
}

.liberty-shipments-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.liberty-shipments-header-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.liberty-last-synced {
    color: #666;
    font-size: 12px;
    font-style: italic;
}

.liberty-refresh-btn {
    font-size: 12px;
    padding: 4px 12px;
    cursor: pointer;
}

.liberty-refresh-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.liberty-shipments-status {
    min-height: 20px;
    padding: 4px 0;
    font-size: 12px;
}

.liberty-status-info    { color: #0073aa; }
.liberty-status-success { color: #00a32a; }
.liberty-status-warning { color: #b26900; }
.liberty-status-error   { color: #d63638; }

.liberty-shipments-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.liberty-item {
    padding: 12px 14px;
    background: #fafafa;
    border-left: 3px solid #d1d1d1;
    border-radius: 4px;
}

.liberty-item-header {
    margin-bottom: 4px;
}

.liberty-item-patient {
    color: #666;
    font-weight: normal;
}

.liberty-item-meta {
    color: #888;
    font-size: 12px;
    margin-bottom: 8px;
}

.liberty-item-message {
    color: #777;
    font-size: 13px;
    font-style: italic;
    margin-top: 4px;
}

.liberty-shipment-list {
    list-style: none;
    margin: 8px 0 0 0;
    padding: 0;
}

.liberty-shipment {
    padding: 8px 10px;
    margin-top: 6px;
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 4px;
}

.liberty-shipment-line {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 4px;
}

.liberty-shipment-carrier {
    font-weight: 600;
    color: #333;
}

.liberty-shipment-method {
    color: #666;
    font-size: 12px;
}

.liberty-shipment-date {
    color: #666;
    font-size: 12px;
}

.liberty-shipment-tracking {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 13px;
}

.liberty-tracking-label {
    color: #666;
    font-weight: 500;
}

.liberty-tracking-number {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
    color: #222;
    user-select: all;
}

.liberty-track-link {
    color: #0073aa;
    font-size: 12px;
    text-decoration: none;
}

.liberty-track-link:hover { text-decoration: underline; }

.liberty-shipment-recipient {
    margin-top: 4px;
    color: #666;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Status badges - roughly matched to existing theme status pills */
.liberty-status-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: 0.3px;
}

.liberty-status-entered     { background: #e0e0e0; color: #555; }
.liberty-status-rphchecked  { background: #e6f0ff; color: #0046a0; }
.liberty-status-counted     { background: #fff3cd; color: #7a5d00; }
.liberty-status-verified    { background: #d0e8ff; color: #0055a5; }
.liberty-status-shipped     { background: #d1f2d1; color: #155724; }
.liberty-status-delivered   { background: #b8e6b8; color: #0a4d0a; }
.liberty-status-pickedup    { background: #cfe2ff; color: #0b4fa0; }
.liberty-status-problem     { background: #f8d7da; color: #721c24; }
.liberty-status-onhold      { background: #ffdeb0; color: #7a4b00; }
.liberty-status-voided      { background: #f0f0f0; color: #999; text-decoration: line-through; }

/* ----------------------------------------------------------------------
 * Phase 2 — Workflow status timeline
 *
 * Renders the linear pipeline (Received → In progress → Ready → Ready to
 * ship → Shipped) above the shipping block. The active step gets the
 * primary color; past steps fade to a check-style filled dot; future
 * steps are gray placeholders. Exceptions (Credit Card Declined, To Be
 * Contacted, etc.) bypass the linear UI and render as a colored badge.
 * --------------------------------------------------------------------*/

.liberty-workflow-timeline {
    list-style: none;
    margin: 12px 0 6px 0;
    padding: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 4px;
    counter-reset: liberty-step;
}

.liberty-workflow-step {
    flex: 1 1 0;
    min-width: 0;
    position: relative;
    text-align: center;
    padding-top: 24px; /* room for the dot */
}

/* Connector line behind the dots — drawn between siblings only. */
.liberty-workflow-step::before {
    content: "";
    position: absolute;
    top: 9px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: #e0e0e0;
    z-index: 0;
}
.liberty-workflow-step:last-child::before {
    display: none;
}
.liberty-workflow-step--past::before,
.liberty-workflow-step--active::before {
    background: #00a32a;
}

.liberty-workflow-step-dot {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #c8c8c8;
    z-index: 1;
    box-sizing: border-box;
}

.liberty-workflow-step--past .liberty-workflow-step-dot {
    background: #00a32a;
    border-color: #00a32a;
}
.liberty-workflow-step--active .liberty-workflow-step-dot {
    background: #fff;
    border-color: #00a32a;
    box-shadow: 0 0 0 4px rgba(0, 163, 42, 0.18);
}
.liberty-workflow-step--future .liberty-workflow-step-dot {
    background: #fff;
    border-color: #c8c8c8;
}

.liberty-workflow-step-label {
    display: block;
    font-size: 11px;
    line-height: 1.3;
    color: #888;
    word-break: break-word;
    padding: 0 4px;
}
.liberty-workflow-step--past .liberty-workflow-step-label {
    color: #00a32a;
}
.liberty-workflow-step--active .liberty-workflow-step-label {
    color: #155724;
    font-weight: 600;
}

.liberty-workflow-meta {
    color: #888;
    font-size: 11px;
    font-style: italic;
    margin: 4px 0 8px 0;
}

/* Exception state — replaces the timeline (drug needs human attention) */
.liberty-workflow-exception {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 10px 0 8px 0;
    padding: 8px 12px;
    background: #fff5e6;
    border: 1px solid #f3c97f;
    border-radius: 4px;
}

.liberty-workflow-exception-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: #7a4b00;
    background: #ffdeb0;
    padding: 3px 10px;
    border-radius: 10px;
}

/* Pending / unknown — neither pipeline nor exception (e.g. just submitted,
   no workflow data yet). Shows a small neutral pill. */
.liberty-workflow-pending {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
    padding: 4px 10px;
    background: #f0f0f0;
    border-radius: 10px;
    font-size: 12px;
    color: #555;
}

/* Responsive */
@media (max-width: 640px) {
    .liberty-shipments-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .liberty-shipment-line {
        gap: 6px;
    }
    .liberty-workflow-timeline {
        gap: 2px;
    }
    .liberty-workflow-step-label {
        font-size: 10px;
        padding: 0 2px;
    }
}
