/* SMART WAY MARINE CARGO LLC - public tracking page */
body{display:flex;flex-direction:column;min-height:100vh}
.announcement-bar{background:var(--brand-black);color:#fff;text-align:center;padding:.6rem 1rem;font-size:.85rem;font-weight:500}
.announcement-bar a{color:var(--brand-blue);text-decoration:underline}

.public-header{background:#fff;border-bottom:1px solid var(--border-gray);padding:1rem 1.5rem;
  display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:1rem}
.public-header .logo-wrap{padding:0}
.public-header .logo-wrap img{max-height:64px}

/* Language toggle */
.lang-toggle{display:inline-flex;align-items:center;background:#E2E8F0;border-radius:2rem;padding:.3rem;position:relative;cursor:pointer;box-shadow:inset 0 2px 4px rgba(0,0,0,.05);-webkit-tap-highlight-color:transparent}
.lang-option{position:relative;z-index:2;padding:.45rem .9rem;font-size:.8rem;font-weight:700;color:#64748B;transition:color .3s}
.lang-option.active{color:var(--brand-blue)}
.lang-slider{position:absolute;top:.3rem;bottom:.3rem;left:.3rem;width:calc(50% - .3rem);background:#fff;border-radius:1.5rem;box-shadow:0 2px 5px rgba(0,0,0,.1);transition:transform .3s cubic-bezier(.4,0,.2,1);z-index:1}
.lang-toggle[data-lang="zh"] .lang-slider{transform:translateX(100%)}

.public-main{flex:1;width:100%;max-width:880px;margin:0 auto;padding:2rem 1.25rem 3rem}

.search-card{background:#fff;border:1px solid var(--border-gray);border-radius:var(--radius-lg);
  padding:2rem;box-shadow:var(--shadow-md);margin-bottom:1.5rem}
.search-card h1{font-size:1.6rem;margin-bottom:.4rem}
.search-card .lead{color:var(--text-muted);font-size:.95rem;margin-bottom:1.25rem}
.search-form{display:flex;gap:.75rem}
.search-form .input{padding:1.05rem 1.25rem;font-size:1.05rem;background:#F8FAFC}
.search-form .input:focus{background:#fff}
.search-form .btn-primary{padding:0 2.25rem;font-size:1rem}
@media(max-width:640px){.search-form{flex-direction:column}.search-form .btn-primary{padding:1rem;justify-content:center}}

.captcha-row{margin-top:1rem;display:flex;justify-content:flex-start}

/* Result panel */
.result-panel{background:#fff;border:1px solid var(--border-gray);border-radius:var(--radius-lg);
  box-shadow:var(--shadow-md);overflow:hidden;margin-bottom:1.5rem;animation:fadeIn .3s ease-out}
@keyframes fadeIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
.result-header{padding:1.5rem 1.75rem 1rem;border-bottom:1px solid var(--border-gray);
  display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:.75rem}
.result-title{font-size:1.25rem;font-weight:700;color:var(--brand-black)}
.result-title small{display:block;color:var(--text-muted);font-size:.75rem;font-weight:500;margin-top:.15rem;letter-spacing:.05em;text-transform:uppercase}
.result-body{padding:1.5rem 1.75rem}

.kv-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:1rem;margin-bottom:1.25rem}
.kv-item{background:var(--surface-gray);border:1px solid var(--border-gray);border-radius:.75rem;padding:1rem 1.1rem}
.kv-label{font-size:.7rem;text-transform:uppercase;letter-spacing:.05em;color:var(--text-muted);font-weight:600;margin-bottom:.3rem}
.kv-value{font-size:1.05rem;font-weight:600;color:var(--brand-black);word-break:break-word}
.kv-remarks{margin-top:.4rem;padding-top:.4rem;border-top:1px dashed var(--border-gray);font-size:.78rem;color:var(--text-muted);font-weight:400;line-height:1.45;white-space:pre-wrap}

.parent-child-panel{background:#EFF6FF;border:1px solid #bfdbfe;border-radius:.75rem;padding:1rem 1.25rem;margin-bottom:1.25rem}
.parent-child-panel h4{font-family:'Poppins';font-weight:700;font-size:.85rem;color:#1e40af;margin-bottom:.5rem;text-transform:uppercase;letter-spacing:.05em}
.parent-child-panel .pc-row{margin-bottom:.4rem;font-size:.92rem}
.parent-child-panel .pc-row strong{color:var(--brand-black);font-weight:700}
.parent-child-panel .child-mark{display:inline-block;background:#fff;border:1px solid #bfdbfe;border-radius:.4rem;padding:.15rem .55rem;margin:.15rem .25rem .15rem 0;font-size:.85rem;font-weight:600;color:var(--brand-blue)}
.parent-child-panel .pc-explainer{margin-top:.75rem;font-size:.82rem;color:#475569;line-height:1.55}

.qr-card{display:flex;gap:1.25rem;align-items:center;background:var(--surface-gray);border:1px solid var(--border-gray);border-radius:.75rem;padding:1rem 1.25rem;margin-top:1.25rem}
.qr-card img{background:#fff;padding:.4rem;border-radius:.5rem;border:1px solid var(--border-gray)}
.qr-card .qr-text{flex:1}
.qr-card h5{font-size:.95rem;font-weight:700;color:var(--brand-black);margin-bottom:.25rem;font-family:'Poppins'}
.qr-card p{font-size:.8rem;color:var(--text-muted)}

.empty-state{text-align:center;padding:3rem 1rem;color:var(--text-muted)}
.empty-state svg{margin-bottom:1rem;color:var(--border-gray)}

.public-footer{background:#000;color:#cbd5e1;padding:2rem 1.5rem 1.5rem;font-size:.85rem;margin-top:auto}
.public-footer .container{max-width:880px;margin:0 auto}
.public-footer a{color:#cbd5e1}
.public-footer a:hover{color:#fff}
.footer-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:1.5rem;padding-bottom:1.25rem;border-bottom:1px solid #1e293b;margin-bottom:1.25rem}
.footer-bottom{display:flex;justify-content:space-between;flex-wrap:wrap;gap:.5rem;color:#64748B;font-size:.8rem}
.footer-ship-icon{opacity:.6;margin-bottom:.5rem}

.pwa-banner{position:fixed;bottom:1rem;left:50%;transform:translateX(-50%);background:#fff;border:1px solid var(--border-gray);
  border-radius:.75rem;padding:.75rem 1rem;box-shadow:0 10px 30px rgba(0,0,0,.15);display:none;align-items:center;gap:.85rem;
  z-index:50;width:calc(100% - 2rem);max-width:460px;box-sizing:border-box}
.pwa-banner.show{display:flex}
.pwa-banner > div{flex:1;min-width:0;white-space:normal;font-size:.85rem;line-height:1.35}
.pwa-banner .btn{flex-shrink:0;padding:.45rem .9rem;font-size:.85rem;white-space:nowrap}
#pwaDismiss{padding:.45rem .6rem}

@media (max-width:520px){
  .pwa-banner{flex-wrap:wrap;gap:.6rem;padding:.75rem}
  .pwa-banner > div{flex:1 1 100%}
  .pwa-banner #pwaInstall{flex:1}
}


/* ===================================================================
   Tracking journey (full status progression with current/done/pending)
   =================================================================== */
.journey-card{background:#fff;border:1px solid var(--border-gray);border-radius:var(--radius-lg);
  box-shadow:var(--shadow-md);padding:1.5rem 1.75rem;margin-bottom:1.5rem;animation:fadeIn .35s ease-out}
.journey-card h3{font-size:1.05rem;font-weight:700;font-family:'Poppins';color:var(--brand-black);margin-bottom:1.25rem}

.journey-steps{position:relative;display:grid;grid-template-columns:repeat(var(--steps,5),1fr);gap:0;align-items:flex-start}
.journey-steps .progress-track{position:absolute;top:19px;left:8%;right:8%;height:4px;background:var(--border-gray);z-index:0;border-radius:99px}
.journey-steps .progress-fill{position:absolute;top:19px;left:8%;height:4px;z-index:1;border-radius:99px;width:0;
  background:linear-gradient(90deg,#16A34A,#3E87FB,#16A34A);background-size:200% 100%;
  transition:width 1.2s cubic-bezier(.4,0,.2,1);animation:journeyFlow 2.5s linear infinite}
@keyframes journeyFlow{0%{background-position:0% 50%}100%{background-position:200% 50%}}

.journey-step{position:relative;z-index:2;text-align:center;display:flex;flex-direction:column;align-items:center;gap:.5rem;padding:0 .25rem}
.journey-step .dot{width:40px;height:40px;border-radius:50%;background:#fff;border:3px solid var(--border-gray);
  display:flex;align-items:center;justify-content:center;font-size:1.05rem;color:var(--text-muted);transition:all .35s;flex-shrink:0}
.journey-step .label{font-size:.75rem;font-weight:600;color:var(--text-muted);line-height:1.25;text-transform:uppercase;letter-spacing:.02em}
.journey-step .when{font-size:.68rem;color:var(--text-muted);font-weight:500}

/* Per-status theme colors (steps are children 3..7 after the 2 progress bars) */
.journey-step:nth-child(3){--step-color:#3E87FB}   /* brand blue   */
.journey-step:nth-child(4){--step-color:#0EA5E9}   /* sky          */
.journey-step:nth-child(5){--step-color:#6366F1}   /* indigo       */
.journey-step:nth-child(6){--step-color:#14B8A6}   /* teal         */
.journey-step:nth-child(7){--step-color:#16A34A}   /* green (final)*/

.journey-step.completed .dot{background:var(--step-color,#16A34A);border-color:var(--step-color,#16A34A);color:#fff}
.journey-step.completed .label{color:var(--step-color,#15803D)}

.journey-step.current .dot{background:var(--step-color,var(--brand-blue));border-color:var(--step-color,var(--brand-blue));color:#fff;
  animation:pulseRing 1.6s infinite;width:46px;height:46px;font-size:1.2rem}
.journey-step.current .label{color:var(--step-color,var(--brand-blue));font-weight:700}

.journey-step.pending .dot{opacity:.55}

@keyframes pulseRing{
  0%   { box-shadow: 0 0 0 0 rgba(62,135,251,.45); }
  70%  { box-shadow: 0 0 0 14px rgba(62,135,251,0); }
  100% { box-shadow: 0 0 0 0 rgba(62,135,251,0); }
}

/* 🎉 Delivered celebration — infinite party on the final step when reached */
.journey-step:last-child.current .dot,
.journey-step:last-child.completed .dot{
  animation:celebratePop 1.4s ease-in-out infinite;
  box-shadow:0 0 0 0 rgba(22,163,74,.5);
}
.journey-step:last-child.current .dot i,
.journey-step:last-child.completed .dot i{
  animation:celebrateSpin 1.4s ease-in-out infinite;
  display:inline-block;
}
@keyframes celebratePop{
  0%,100%{ transform:scale(1);   box-shadow:0 0 0 0 rgba(22,163,74,.5) }
  50%    { transform:scale(1.18); box-shadow:0 0 0 12px rgba(22,163,74,0) }
}
@keyframes celebrateSpin{
  0%{ transform:rotate(0) scale(1) } 25%{ transform:rotate(-12deg) scale(1.1) }
  50%{ transform:rotate(0) scale(1.15) } 75%{ transform:rotate(12deg) scale(1.1) }
  100%{ transform:rotate(0) scale(1) }
}

/* text wrapper (chip) — on desktop it's plain, on mobile it becomes a solid card */
.journey-step .step-text{display:flex;flex-direction:column;align-items:center;gap:.15rem}

/* ---- Mobile: rounded "Z" snake (5 fixed steps, 2-column grid) ----
   The circular dots act as the rounded corners; connectors run BEHIND the
   text chips (which have a solid background) so nothing overlaps.          */
@media (max-width: 720px){
  .journey-card{overflow:hidden}
  .journey-steps{grid-template-columns:1fr 1fr;row-gap:34px;column-gap:0;align-items:start}
  .journey-steps .progress-track,.journey-steps .progress-fill{display:none}

  .journey-step{position:relative;padding:0;min-height:96px}
  .journey-step .dot{width:44px !important;height:44px !important;font-size:1.05rem !important;position:relative;z-index:3}

  /* text chip: solid background so connector lines hide behind it */
  .journey-step .step-text{position:relative;z-index:3;margin-top:.5rem;padding:.45rem .6rem;
    background:#fff;border:1px solid var(--border-gray);border-radius:.7rem;
    box-shadow:0 3px 10px rgba(15,23,42,.06);min-width:84%;max-width:96%;min-height:44px;justify-content:center}
  .journey-step .label{font-size:.72rem;line-height:1.2;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
  .journey-step .when{font-size:.66rem}
  .journey-step.completed .step-text{border-color:var(--step-color)}
  .journey-step.current .step-text{border-color:var(--step-color);box-shadow:0 4px 14px rgba(62,135,251,.18)}

  /* snake placement:  r1: 1 → 2   |   r2: 4 ← 3   |   r3: 5 */
  .journey-step:nth-child(3){grid-row:1;grid-column:1}   /* step1 */
  .journey-step:nth-child(4){grid-row:1;grid-column:2}   /* step2 */
  .journey-step:nth-child(5){grid-row:2;grid-column:2}   /* step3 (below step2) */
  .journey-step:nth-child(6){grid-row:2;grid-column:1}   /* step4 (left of step3) */
  .journey-step:nth-child(7){grid-row:3;grid-column:1}   /* step5 (below step4) */

  /* connector segments — anchored at the dot centre (22px), rounded caps, behind chips */
  .journey-step::before,.journey-step::after{content:'';position:absolute;z-index:1;border-radius:99px;
    background:linear-gradient(90deg,#3E87FB,#0EA5E9,#6366F1);background-size:200% 100%;animation:journeyFlow 2.5s linear infinite}

  /* horizontal: step1 → step2 (points right) — sits at dot centre, behind the dots */
  .journey-step:nth-child(3)::after{top:19px;left:50%;width:100%;height:5px}
  /* vertical turn: step2 ↓ step3 (same column). Overshoot is covered by step3's dot/chip. */
  .journey-step:nth-child(4)::after{top:22px;left:calc(50% - 2.5px);width:5px;height:150px;
    background:linear-gradient(180deg,#0EA5E9,#6366F1)}
  /* horizontal: step3 ← step4 (points left) */
  .journey-step:nth-child(5)::after{top:19px;right:50%;width:100%;height:5px;
    background:linear-gradient(270deg,#6366F1,#14B8A6)}
  /* vertical turn: step4 ↓ step5 (same column) */
  .journey-step:nth-child(6)::after{top:22px;left:calc(50% - 2.5px);width:5px;height:150px;
    background:linear-gradient(180deg,#14B8A6,#16A34A)}
}

/* History panel */
.history-list{list-style:none;margin:1rem 0 0;padding:0;border-top:1px dashed var(--border-gray);padding-top:1rem}
.history-list li{display:flex;gap:.85rem;padding:.6rem 0;border-bottom:1px dashed var(--border-gray)}
.history-list li:last-child{border-bottom:0}
.history-list .h-dot{width:30px;height:30px;border-radius:50%;background:#16A34A;color:#fff;flex-shrink:0;
  display:flex;align-items:center;justify-content:center;font-size:.85rem}
.history-list .h-body{flex:1}
.history-list .h-title{font-size:.92rem;font-weight:600;color:var(--brand-black);margin:0}
.history-list .h-meta{font-size:.78rem;color:var(--text-muted);margin-top:.1rem}
.history-list .h-remarks{margin-top:.3rem;padding:.4rem .75rem;background:#F8FAFC;border-left:3px solid var(--brand-blue);border-radius:0 .35rem .35rem 0;font-size:.82rem;color:var(--text-main)}

/* External provider events panel */
.ext-events{margin-top:1.25rem;border-top:1px dashed var(--border-gray);padding-top:1.25rem}
.ext-events h4{font-size:.95rem;font-weight:700;color:var(--brand-black);margin-bottom:.85rem;display:flex;align-items:center;gap:.5rem}
.ext-events .badge{font-size:.65rem}

/* ===================================================================
   Simplified public footer (only WhatsApp + social links)
   =================================================================== */
.public-footer-min{background:#000;color:#cbd5e1;padding:1.5rem 1.5rem 1.25rem;text-align:center;margin-top:auto}
.public-footer-min .social-row{display:flex;justify-content:center;align-items:center;gap:.85rem;flex-wrap:wrap;margin-bottom:.85rem}
.public-footer-min .social-icon{width:42px;height:42px;border-radius:50%;background:rgba(255,255,255,.06);
  display:inline-flex;align-items:center;justify-content:center;color:#cbd5e1;font-size:1.05rem;transition:all .25s;border:1px solid rgba(255,255,255,.08)}
.public-footer-min .social-icon:hover{background:var(--brand-blue);color:#fff;transform:translateY(-2px);text-decoration:none}
.public-footer-min .social-icon.whatsapp:hover{background:#25D366}
.public-footer-min .copyright{font-size:.78rem;color:#64748B}


/* ===================================================================
   Public mobile responsiveness — keep logo + language toggle on one line
   =================================================================== */
@media (max-width: 640px) {
  .public-header{
    padding: .65rem .85rem;
    flex-wrap: nowrap;          /* prevent wrapping to a second row */
    gap: .5rem;
    align-items: center;
  }
  .public-header .logo-wrap{ flex-shrink: 1; min-width: 0; }
  .public-header .logo-wrap img{ max-height: 38px !important; max-width: 60vw; object-fit: contain }

  .lang-toggle{ padding: .22rem; flex-shrink: 0 }
  .lang-option{ padding: .35rem .6rem; font-size: .72rem }

  .announcement-bar{ font-size: .78rem; padding: .45rem .8rem }

  .public-main{ padding: 1.25rem .85rem 2rem }
  .search-card{ padding: 1.25rem 1rem }
  .search-card h1{ font-size: 1.25rem }
  .search-card .lead{ font-size: .88rem }
  .search-form .input{ padding: .9rem 1rem; font-size: 1rem }
  .search-form .btn-primary{ padding: .9rem 1rem; font-size: .95rem }

  .result-header{ padding: 1rem 1.1rem }
  .result-title{ font-size: 1.05rem }
  .result-body{ padding: 1rem 1.1rem }
  .kv-grid{ grid-template-columns: 1fr; gap: .65rem }
  .kv-item{ padding: .8rem .9rem }

  .journey-card{ padding: 1rem 1.1rem }
  .journey-card h3{ font-size: .95rem; margin-bottom: .85rem }

  .qr-card{ flex-direction: column; text-align: center; padding: 1rem }
  .qr-card .qr-text h5{ margin-top: .5rem }

  .public-footer-min{ padding: 1.25rem 1rem 1rem }
  .public-footer-min .social-icon{ width: 38px; height: 38px; font-size: .95rem }
}

@media (max-width: 380px) {
  .public-header .logo-wrap img{ max-height: 32px !important }
  .lang-option{ padding: .3rem .5rem; font-size: .68rem }
}


/* ===================================================================
   Floating WhatsApp widget (brand-themed, bottom-right)
   =================================================================== */
.wa-widget{position:fixed;right:1.25rem;bottom:1.25rem;z-index:60;display:flex;flex-direction:column;align-items:flex-end;gap:.75rem}
.wa-fab{width:58px;height:58px;border-radius:50%;border:none;cursor:pointer;
  background:linear-gradient(135deg,var(--brand-blue),#1E40AF);color:#fff;font-size:1.7rem;
  display:flex;align-items:center;justify-content:center;
  box-shadow:0 10px 26px -6px rgba(62,135,251,.6);transition:transform .25s, box-shadow .25s;
  animation:waPulse 2.6s ease-in-out infinite}
.wa-fab:hover{transform:scale(1.07)}
.wa-fab.active{transform:rotate(8deg) scale(1.05)}
@keyframes waPulse{0%,100%{box-shadow:0 10px 26px -6px rgba(62,135,251,.6)}50%{box-shadow:0 10px 34px 2px rgba(62,135,251,.85)}}

.wa-panel{width:300px;max-width:78vw;background:#fff;border:1px solid var(--border-gray);border-radius:1rem;
  box-shadow:0 18px 50px -12px rgba(15,23,42,.35);overflow:hidden;transform-origin:bottom right;
  opacity:0;transform:scale(.85) translateY(12px);pointer-events:none;transition:opacity .22s, transform .22s}
.wa-panel.open{opacity:1;transform:scale(1) translateY(0);pointer-events:auto}
.wa-panel-head{display:flex;align-items:center;gap:.65rem;padding:1rem 1.1rem;
  background:linear-gradient(135deg,var(--brand-blue),#1E40AF);color:#fff}
.wa-panel-head i{font-size:1.6rem}
.wa-panel-head strong{display:block;font-size:.98rem;font-family:'Baloo 2','Poppins',sans-serif}
.wa-panel-head small{display:block;font-size:.76rem;opacity:.85}
.wa-panel-body{max-height:320px;overflow-y:auto;padding:.5rem}
.wa-member{display:flex;align-items:center;gap:.7rem;padding:.6rem .65rem;border-radius:.6rem;text-decoration:none;color:var(--text-main);transition:background .15s}
.wa-member:hover{background:var(--surface-gray);text-decoration:none}
.wa-avatar{width:40px;height:40px;border-radius:50%;flex-shrink:0;display:flex;align-items:center;justify-content:center;
  background:linear-gradient(135deg,var(--brand-blue),#0EA5E9);color:#fff;font-weight:700;font-size:1.05rem;text-transform:uppercase}
.wa-info{flex:1;min-width:0}
.wa-name{display:block;font-weight:600;font-size:.92rem;color:var(--brand-black)}
.wa-desg{display:block;font-size:.78rem;color:var(--text-muted)}
.wa-go{color:var(--brand-blue);font-size:1.2rem;flex-shrink:0}

@media (max-width:640px){
  .wa-widget{right:.85rem;bottom:.85rem}
  .wa-fab{width:52px;height:52px;font-size:1.5rem}
}


/* ===================================================================
   Animated external (Other-source) timeline — tick = done, hourglass = active
   =================================================================== */
.ext-timeline{position:relative;border-top:0;padding-top:0;margin-top:.5rem}
.ext-timeline li{position:relative}
.ext-timeline .h-dot{width:30px;height:30px;border-radius:50%;display:flex;align-items:center;justify-content:center;
  color:#fff;font-size:.85rem;flex-shrink:0;transition:all .3s}
.ext-timeline li.evt-done .h-dot{background:#16A34A}
.ext-timeline li.evt-current .h-dot{background:var(--brand-blue);animation:pulseRing 1.6s infinite}
.ext-timeline li.evt-current .h-dot i{animation:waSpin 2s linear infinite}
.ext-timeline li.evt-current .h-title{color:var(--brand-blue);font-weight:700}
@keyframes waSpin{0%{transform:rotate(0)}50%{transform:rotate(180deg)}100%{transform:rotate(360deg)}}

/* connecting line between timeline dots */
.ext-timeline li::before{content:'';position:absolute;left:14px;top:30px;bottom:-.6rem;width:3px;
  background:linear-gradient(180deg,#16A34A,#3E87FB);background-size:100% 200%;
  animation:journeyFlowV 2.5s linear infinite;z-index:0}
.ext-timeline li:last-child::before{display:none}
.ext-timeline .h-dot{position:relative;z-index:1}
