/* ═══════════════════════════════════════════════════════════════════
   Raju Tracking Viewer – Frontend (My Account) CSS  v1.5
   White background + Navy blue design with India Post style timeline
   ═══════════════════════════════════════════════════════════════════ */

/* ── Hide existing tracking card HTML ─────────────────────────────── */
.woocommerce-orders-table .rj-tcard {
    display: none !important;
}

/* ── Tracking cell wrapper ────────────────────────────────────────── */
.rj-tv-front-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

/* ── View Tracking button ─────────────────────────────────────────── */
.rj-tv-front-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #0d2f6b, #1a4fa0);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.rj-tv-front-btn:hover {
    background: linear-gradient(135deg, #1a4fa0, #2563eb);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 47, 107, 0.3);
}
.rj-tv-front-btn-icon { font-size: 15px; }

/* ── Copy tracking number chip ────────────────────────────────────── */
.rj-tv-front-copy {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f0f7f0;
    border: 1px solid #bbdfbb;
    border-radius: 6px;
    padding: 5px 12px;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}
.rj-tv-front-copy:hover { background: #e0f0e0; border-color: #86c986; }
.rj-tv-front-tn {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px; font-weight: 600; color: #1a5c1a; letter-spacing: 0.5px;
}
.rj-tv-front-hint { font-size: 11px; color: #6b9e6b; transition: color 0.15s; }
.rj-tv-front-copy.copied .rj-tv-front-hint { color: #16a34a; font-weight: 600; }

/* ── No tracking available ────────────────────────────────────────── */
.rj-tv-no-tracking {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: #94a3b8;
    background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 6px; padding: 8px 12px;
}
.rj-tv-no-icon { font-size: 16px; }
.rj-tv-no-tracking-text { font-size: 12px; color: #cbd5e1; font-style: italic; }

/* ═══════════════════════════════════════════════════════════════════
   Frontend Modal — India Post style
   ═══════════════════════════════════════════════════════════════════ */
.rj-tv-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100100;
    background: rgba(10, 20, 40, 0.55);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}
.rj-tv-overlay.active { display: flex; }
.rj-tv-modal {
    background: #fff;
    border-radius: 12px;
    width: 620px;
    max-width: 94vw;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    animation: rjTvSlideUp 0.25s ease-out;
}
@keyframes rjTvSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.rj-tv-modal *, .rj-tv-modal *::before, .rj-tv-modal *::after {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Header */
.rj-tv-modal-head {
    background: #fff;
    padding: 20px 24px 16px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    border-bottom: 1px solid #e5e7eb;
}
.rj-tv-modal-head-left h3 {
    font-size: 14px !important; font-weight: 600;
    margin: 0 0 6px 0 !important; padding: 0 !important; color: #0d2f6b;
    text-transform: uppercase; letter-spacing: 0.5px;
    line-height: 1.4;
}
.rj-tv-modal-article {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 15px; font-weight: 700;
    color: #dc2626; letter-spacing: 1.5px;
}
.rj-tv-modal-close {
    background: #f1f5f9; border: 1px solid #e2e8f0;
    color: #64748b;
    width: 32px; height: 32px; border-radius: 50%;
    cursor: pointer; font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; flex-shrink: 0;
}
.rj-tv-modal-close:hover { background: #e2e8f0; color: #1e293b; }

/* Progress Steps */
.rj-tv-progress-steps {
    display: flex; justify-content: space-between;
    padding: 16px 24px 20px; background: #fff;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}
.rj-tv-progress-steps::before {
    content: ''; position: absolute; top: 32px;
    left: 56px; right: 56px;
    height: 3px; background: #e5e7eb; z-index: 0;
}
.rj-tv-progress-steps::after {
    content: ''; position: absolute; top: 32px;
    left: 56px; right: 56px; height: 3px; background: #16a34a;
    z-index: 1; transform-origin: left;
    transform: scaleX(var(--rj-progress, 0));
    transition: transform 0.5s ease;
}
.rj-tv-pstep {
    display: flex; flex-direction: column; align-items: center;
    gap: 8px; z-index: 2; flex: 1;
}
.rj-tv-pstep-icon {
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; border: 2.5px solid #e5e7eb;
    background: #fff; color: #cbd5e1; transition: all 0.3s;
}
.rj-tv-pstep.done .rj-tv-pstep-icon { background: #16a34a; border-color: #16a34a; color: #fff; }
.rj-tv-pstep.active .rj-tv-pstep-icon {
    background: #fff; border-color: #16a34a; color: #16a34a;
    box-shadow: 0 0 0 4px rgba(22,163,74,0.15);
}
.rj-tv-pstep-icon svg {
    width: 16px; height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.rj-tv-pstep-label {
    font-size: 11px; font-weight: 600;
    color: #94a3b8; text-align: center; white-space: nowrap;
}
.rj-tv-pstep.done .rj-tv-pstep-label,
.rj-tv-pstep.active .rj-tv-pstep-label { color: #0d2f6b; }

/* Returned progress bar (red) */
.rj-tv-progress-returned::after { background: #dc2626 !important; }
.rj-tv-progress-returned .rj-tv-pstep.done .rj-tv-pstep-icon {
    background: #dc2626; border-color: #dc2626; color: #fff;
}
.rj-tv-progress-returned .rj-tv-pstep.active .rj-tv-pstep-icon {
    border-color: #dc2626; color: #dc2626;
    box-shadow: 0 0 0 4px rgba(220,38,38,0.15);
}

/* Route status badge — returned */
.rj-tv-route-status-returned {
    color: #dc2626 !important; border-color: #fecaca !important;
    background: #fef2f2 !important;
}

/* Route Bar */
.rj-tv-route-bar {
    display: flex; align-items: center;
    padding: 14px 24px; background: #f8fafc;
    border-bottom: 1px solid #e5e7eb; gap: 12px;
}
.rj-tv-route-point { font-size: 12px; color: #64748b; flex-shrink: 0; }
.rj-tv-route-point strong { display: block; color: #0d2f6b; font-size: 13px; }
.rj-tv-route-line {
    flex: 1; height: 2px;
    background: linear-gradient(90deg, #16a34a, #0d2f6b);
    position: relative; border-radius: 2px;
}
.rj-tv-route-status {
    position: absolute; top: -12px; left: 50%;
    transform: translateX(-50%); background: #fff;
    padding: 2px 10px; font-size: 11px; font-weight: 700;
    color: #0d2f6b; border: 1px solid #e5e7eb;
    border-radius: 12px; white-space: nowrap;
    display: inline-flex; align-items: center; gap: 4px;
}
.rj-tv-route-status svg {
    width: 13px; height: 13px;
    stroke: currentColor; fill: none;
    stroke-width: 2.5;
    stroke-linecap: round; stroke-linejoin: round;
    flex-shrink: 0;
}
.rj-tv-route-status-delivered {
    color: #16a34a !important; border-color: #bbf7d0 !important;
    background: #f0fdf4 !important;
}
.rj-tv-route-status-booked {
    color: #16a34a !important; border-color: #bbf7d0 !important;
    background: #f0fdf4 !important;
}
.rj-tv-route-status-dispatched {
    color: #7c3aed !important; border-color: #ddd6fe !important;
    background: #f5f3ff !important;
}
.rj-tv-route-status-transit {
    color: #2563eb !important; border-color: #bfdbfe !important;
    background: #eff6ff !important;
}
.rj-tv-route-status-outdelivery {
    color: #ea580c !important; border-color: #fed7aa !important;
    background: #fff7ed !important;
}

/* Details Grid */
.rj-tv-details {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 0; border-bottom: 1px solid #e5e7eb; background: #fff;
}
.rj-tv-detail-item {
    padding: 12px 24px;
    border-right: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}
.rj-tv-detail-item:nth-child(3n) { border-right: none; }
.rj-tv-detail-label {
    font-size: 10px; text-transform: uppercase;
    letter-spacing: 0.5px; color: #94a3b8;
    margin-bottom: 4px; font-weight: 600;
}
.rj-tv-detail-value { font-size: 13px; font-weight: 600; color: #0d2f6b; }
.rj-tv-detail-badge {
    display: inline-block; background: #dbeafe; color: #1e40af;
    font-size: 11px; font-weight: 700;
    padding: 3px 10px; border-radius: 4px; letter-spacing: 0.5px;
}

/* Routing Steps Header */
.rj-tv-routing-header { padding: 16px 24px 8px; background: #fff; }
.rj-tv-routing-header h4 {
    margin: 0 !important; padding: 0 !important;
    font-size: 15px !important; font-weight: 700;
    color: #dc2626; display: flex; align-items: center; gap: 8px;
    line-height: 1.4;
}
.rj-tv-routing-header h4 svg {
    width: 18px; height: 18px;
    stroke: #dc2626;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

/* Body / Timeline */
.rj-tv-modal-body {
    flex: 1; overflow-y: auto;
    padding: 0 24px 24px; background: #fff;
}
.rj-tv-modal-body::-webkit-scrollbar { width: 6px; }
.rj-tv-modal-body::-webkit-scrollbar-thumb { background: #c5cae9; border-radius: 3px; }

/* Timeline Steps */
.rj-tv-timeline { position: relative; }
.rj-tv-step {
    display: flex; align-items: flex-start;
    position: relative; min-height: 72px;
}
.rj-tv-step:last-child { min-height: auto; }
.rj-tv-step-date {
    width: 100px; flex-shrink: 0;
    padding-right: 16px; text-align: right; padding-top: 4px;
}
.rj-tv-step-date-day { font-size: 13px; font-weight: 700; color: #0d2f6b; }
.rj-tv-step-date-time { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.rj-tv-step-dot-col {
    width: 40px; flex-shrink: 0;
    display: flex; flex-direction: column;
    align-items: center; position: relative;
}
.rj-tv-step-dot {
    width: 28px; height: 28px; border-radius: 50%;
    border: 2.5px solid #16a34a; background: #fff;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; z-index: 2;
}
.rj-tv-step-dot svg {
    width: 14px; height: 14px; stroke: #16a34a;
    fill: none; stroke-width: 2.5;
    stroke-linecap: round; stroke-linejoin: round;
}
/* Timeline dot color variants */
.rj-tv-dot-green { border-color: #16a34a; }
.rj-tv-dot-green svg { stroke: #16a34a; }
.rj-tv-dot-blue { border-color: #2563eb; }
.rj-tv-dot-blue svg { stroke: #2563eb; }
.rj-tv-dot-teal { border-color: #0d9488; }
.rj-tv-dot-teal svg { stroke: #0d9488; }
.rj-tv-dot-orange { border-color: #ea580c; }
.rj-tv-dot-orange svg { stroke: #ea580c; }
.rj-tv-dot-red { border-color: #dc2626; }
.rj-tv-dot-red svg { stroke: #dc2626; }
/* First dot filled */
.rj-tv-dot-first.rj-tv-dot-green { background: #16a34a; border-color: #16a34a; box-shadow: 0 0 0 4px rgba(22,163,74,0.15); }
.rj-tv-dot-first.rj-tv-dot-green svg { stroke: #fff; }
.rj-tv-dot-first.rj-tv-dot-blue { background: #2563eb; border-color: #2563eb; box-shadow: 0 0 0 4px rgba(37,99,235,0.15); }
.rj-tv-dot-first.rj-tv-dot-blue svg { stroke: #fff; }
.rj-tv-dot-first.rj-tv-dot-teal { background: #0d9488; border-color: #0d9488; box-shadow: 0 0 0 4px rgba(13,148,136,0.15); }
.rj-tv-dot-first.rj-tv-dot-teal svg { stroke: #fff; }
.rj-tv-dot-first.rj-tv-dot-orange { background: #ea580c; border-color: #ea580c; box-shadow: 0 0 0 4px rgba(234,88,12,0.15); }
.rj-tv-dot-first.rj-tv-dot-orange svg { stroke: #fff; }
.rj-tv-dot-first.rj-tv-dot-red { background: #dc2626; border-color: #dc2626; box-shadow: 0 0 0 4px rgba(220,38,38,0.15); }
.rj-tv-dot-first.rj-tv-dot-red svg { stroke: #fff; }
.rj-tv-step-dot-col::after {
    content: ''; position: absolute;
    top: 32px; bottom: -4px;
    width: 2px; background: #e5e7eb; z-index: 1;
}
.rj-tv-step:last-child .rj-tv-step-dot-col::after { display: none; }
.rj-tv-step-content { flex: 1; padding: 4px 0 20px 12px; }
.rj-tv-step-event { font-size: 14px; font-weight: 600; color: #1e293b; line-height: 1.4; }
.rj-tv-step-location {
    font-size: 12px; color: #64748b; margin-top: 3px;
    display: flex; align-items: center; gap: 4px;
}
.rj-tv-step-location svg {
    width: 12px; height: 12px; stroke: #94a3b8;
    fill: none; stroke-width: 2; flex-shrink: 0;
}
.rj-tv-step-extra { font-size: 11px; color: #ef4444; margin-top: 3px; font-style: italic; }

/* Loading / Error */
.rj-tv-loading { text-align: center; padding: 40px; color: #64748b; }
.rj-tv-loading::before {
    content: ''; display: block;
    width: 32px; height: 32px; margin: 0 auto 12px;
    border: 3px solid #e2e8f0; border-top-color: #0d2f6b;
    border-radius: 50%; animation: rjTvSpin 0.7s linear infinite;
}
@keyframes rjTvSpin { to { transform: rotate(360deg); } }
.rj-tv-error { text-align: center; padding: 40px; color: #991b1b; }

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .rj-tv-modal { width: 100%; max-width: 100vw; max-height: 100vh; border-radius: 0; }
    .rj-tv-details { grid-template-columns: repeat(2, 1fr); }
    .rj-tv-step-date { width: 70px; }
    .rj-tv-pstep-label { font-size: 9px; }
}
