/* ============================================================
   Tracking Armevo — Style public (fully responsive)
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:      #0b0e14;
  --surface: #111520;
  --card:    #161b27;
  --border:  #1e2535;
  --accent:  #4f7aff;
  --text:    #e8eaf0;
  --muted:   #6b7590;
  --danger:  #ef4444;
  --radius:  14px;
  --font:    'Sora', sans-serif;
  --mono:    'JetBrains Mono', monospace;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container { width: 100%; max-width: 860px; margin: 0 auto; padding: 0 16px; }

/* ---- Header ---- */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
}
.logo strong { color: var(--accent); font-weight: 600; }
.logo-icon   { color: var(--accent); font-size: 1.2rem; }

/* ---- Main ---- */
.site-main { flex: 1; padding: 20px 0 20px; }

/* ---- Hero ---- */
.hero { text-align: center; margin-bottom: 20px; }
.hero-title {
  font-size: clamp(1.6rem, 5vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #e8eaf0 0%, #8b99cc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
  line-height: 1.2;
}
.hero-sub {
  color: var(--muted);
  font-size: clamp(.85rem, 2.5vw, 1rem);
  margin-bottom: 15px;
  padding: 0 8px;
}

/* ---- Search box ---- */
.search-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 520px;
  margin: 0 auto;
}
@media (min-width: 480px) { .search-box { flex-direction: row; } }

.search-input {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 1rem;
  padding: 14px 18px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  letter-spacing: .05em;
  width: 100%;
  min-width: 0;
}
.search-input::placeholder { color: var(--muted); font-family: var(--font); letter-spacing: 0; }
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,122,255,.12); }

.search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 14px 22px;
  font-family: var(--font);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s, transform .1s;
  width: 100%;
}
@media (min-width: 480px) { .search-btn { width: auto; } }
.search-btn:hover  { background: #3d66ee; }
.search-btn:active { transform: scale(.98); }

/* ---- Error ---- */
.track-error {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.2);
  color: #f87171;
  border-radius: 10px;
  padding: 12px 18px;
  margin-top: 16px;
  font-size: .88rem;
  max-width: 100%;
  text-align: left;
}

/* ---- Result section ---- */
.result-section { display: flex; flex-direction: column; gap: 16px; }

/* ---- Status card ---- */
.status-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}
.status-left  { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.status-icon  { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.status-info  { min-width: 0; }
.status-label { font-size: 1.05rem; font-weight: 600; margin-bottom: 2px; }
.status-number { color: var(--muted); font-size: .82rem; }
.status-number span { font-family: var(--mono); color: var(--text); }
.status-updated { color: var(--muted); font-size: .74rem; margin-top: 2px; }

/* ---- Steps card ---- */
.steps-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}
.steps-track { display: flex; flex-direction: column; }

.step-item {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.step-item:last-child { border-bottom: none; }
.step-item.reached    { background: rgba(57,255,120,.03); }

.step-badge {
  width: 13px; height: 13px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #252a38;
  border: 2px solid #353c50;
  transition: all .3s;
}
.step-item.reached .step-badge,
.step-item.current .step-badge {
  background: #39ff78;
  border-color: #39ff78;
  box-shadow: 0 0 8px rgba(57,255,120,.7), 0 0 18px rgba(57,255,120,.25);
}
.step-item.current .step-badge { animation: glowPulse 2s infinite; }

@keyframes glowPulse {
  0%,100% { box-shadow: 0 0 8px rgba(57,255,120,.7), 0 0 18px rgba(57,255,120,.25); }
  50%      { box-shadow: 0 0 14px rgba(57,255,120,1), 0 0 28px rgba(57,255,120,.4); }
}

.step-sep {
  width: 1px; height: 22px;
  background: var(--border);
  margin: 0 16px;
  flex-shrink: 0;
}

.step-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  gap: 10px;
  min-width: 0;
}
.step-name {
  font-size: .86rem;
  color: var(--muted);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.step-item.reached .step-name { color: var(--text); font-weight: 500; }
.step-item.current .step-name { color: #fff; font-weight: 600; }

.step-date {
  font-size: .7rem;
  color: #39ff78;
  font-family: var(--mono);
  opacity: .85;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---- Anomaly card ---- */
.anomaly-card {
  display: flex;
  align-items: center;
  background: rgba(239,68,68,.06);
  border: 1px solid rgba(239,68,68,.2);
  border-radius: var(--radius);
  padding: 14px 20px;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}
.anomaly-badge {
  width: 13px; height: 13px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #ef4444;
  border: 2px solid #ef4444;
  box-shadow: 0 0 8px rgba(239,68,68,.7), 0 0 18px rgba(239,68,68,.25);
  animation: redPulse 2s infinite;
}
@keyframes redPulse {
  0%,100% { box-shadow: 0 0 8px rgba(239,68,68,.7), 0 0 18px rgba(239,68,68,.25); }
  50%      { box-shadow: 0 0 14px rgba(239,68,68,1), 0 0 28px rgba(239,68,68,.4); }
}
.anomaly-sep {
  width: 1px; height: 24px;
  background: rgba(239,68,68,.3);
  margin: 0 16px;
  flex-shrink: 0;
}
.anomaly-content { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.anomaly-title {
  font-size: .78rem;
  font-weight: 600;
  color: #f87171;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.anomaly-desc {
  font-size: .86rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- No events ---- */
.no-events {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
  font-size: .88rem;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}
.no-events small { font-size: .78rem; opacity: .7; }

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 16px 0;
  text-align: center;
  color: var(--muted);
  font-size: .78rem;
}

/* ---- Tablette ---- */
@media (min-width: 600px) {
  .container    { padding: 0 24px; }
  .site-main    { padding: 30px 0 30px; }
  .status-card  { padding: 24px 28px; }
  .step-item    { padding: 15px 28px; }
  .step-sep     { margin: 0 20px; }
  .anomaly-card { padding: 16px 28px; }
  .anomaly-sep  { margin: 0 20px; }
}

/* ---- Desktop ---- */
@media (min-width: 860px) {
  .container { padding: 0 32px; }
}

/* ---- Estimate card ---- */
.estimate-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(79,122,255,.06);
  border: 1px solid rgba(79,122,255,.18);
  border-radius: var(--radius);
  padding: 13px 20px;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
  flex-wrap: wrap;
}
.estimate-icon { font-size: 1rem; flex-shrink: 0; }
.estimate-text {
  flex: 1;
  font-size: .86rem;
  color: var(--text);
  min-width: 0;
}
.estimate-text strong { color: #fff; }
.estimate-badge {
  font-size: .68rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(79,122,255,.12);
  border: 1px solid rgba(79,122,255,.2);
  border-radius: 20px;
  padding: 2px 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

@media (min-width: 600px) {
  .estimate-card { padding: 13px 28px; flex-wrap: nowrap; }
}

/* ---- Step message ---- */
.step-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.step-msg {
  font-size: .72rem;
  color: var(--muted);
  font-style: italic;
}
.step-item.current .step-msg { color: rgba(255,255,255,.6); }
.step-item.reached .step-msg { color: var(--muted); }

/* ---- Carriers ---- */
.carriers-card {
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
  padding: 20px 20px 8px;
  text-align: center;
}
.carriers-label {
  font-size: .7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 14px;
}
.carriers-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}
.carrier-item {
  opacity: .4;
  transition: opacity .2s;
  filter: grayscale(100%) brightness(2);
}
.carrier-item:hover { opacity: .7; }
.carrier-img {
  height: 22px;
  width: auto;
  max-width: 80px;
  display: block;
  object-fit: contain;
}

/* ---- Footer link ---- */
.footer-link {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: .75rem;
  text-decoration: none;
  transition: color .2s;
}
.footer-link:hover { color: var(--accent); }

/* ---- Header inner ---- */
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ---- Lang selector ---- */
.lang-selector {
  display: flex;
  align-items: center;
}

.lang-flag {
  text-decoration: none;
  opacity: .4;
  transition: opacity .2s, transform .15s;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.lang-flag:hover  { opacity: .85; }
.lang-flag.active { opacity: 1; }

.flag-img {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: block;
  object-fit: cover;
}

/* ============================================================
   Mode clair
   ============================================================ */
body.light-mode {
  --bg:      #f4f6fb;
  --surface: #ffffff;
  --card:    #ffffff;
  --card2:   #f0f3fa;
  --border:  #dde2ef;
  --text:    #1a1f36;
  --muted:   #7b87a8;
  --accent:  #4f7aff;
}

body.light-mode .site-header { box-shadow: 0 1px 0 var(--border); }
body.light-mode .search-input { background: #fff; }
body.light-mode .hero-title {
  background: linear-gradient(135deg, #1a1f36 0%, #4f7aff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
body.light-mode .step-item.reached    { background: rgba(57,255,120,.06); }
body.light-mode .step-name            { color: #7b87a8; }
body.light-mode .step-item.reached .step-name { color: #1a1f36; }
body.light-mode .step-item.current .step-name { color: #1a1f36; }
body.light-mode .estimate-card        { background: rgba(79,122,255,.07); }
body.light-mode .anomaly-card         { background: rgba(239,68,68,.05); }
body.light-mode .no-events            { background: #fff; }
body.light-mode .status-card          { background: #fff; }
body.light-mode .steps-card           { background: #fff; }
body.light-mode .estimate-text strong { color: #f59e0b; }
body.light-mode .carriers-card        { background: transparent; }
body.light-mode .carrier-item         { filter: grayscale(100%) brightness(.6); }
body.light-mode .track-error          { background: rgba(239,68,68,.08); }

/* Toggle bouton */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, color .2s;
  flex-shrink: 0;
}
.theme-toggle:hover { background: var(--card); color: var(--text); }
.theme-toggle svg   { width: 16px; height: 16px; }
.icon-sun  { display: none; }
.icon-moon { display: block; }
body.light-mode .icon-sun  { display: block; }
body.light-mode .icon-moon { display: none; }

/* Thème clair appliqué via html (évite le flash au chargement) */
html.light-mode body {
  --bg:      #f4f6fb;
  --surface: #ffffff;
  --card:    #ffffff;
  --border:  #dde2ef;
  --text:    #1a1f36;
  --muted:   #7b87a8;
}

/* Language dropdown */
.lang-select {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: .82rem;
  cursor: pointer;
  outline: none;
  max-width: 140px;
}
.lang-select:focus { border-color: var(--accent); }

@media (max-width: 480px) {
  .lang-select { max-width: 110px; font-size: .75rem; padding: 5px 6px; }
}

/* Share section */
.share-section {
  max-width: 560px;
  margin: 0 auto 32px;
  padding: 0 20px;
  text-align: center;
}
.share-title {
  font-size: .78rem;
  color: var(--muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.share-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: .8rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: opacity .15s;
}
.share-btn:hover { opacity: .85; }
.share-btn.whatsapp { background: #25d366; color: #fff; }
.share-btn.email { background: var(--card); border: 1px solid var(--border); color: var(--text); }
.share-btn.copy { background: var(--card); border: 1px solid var(--border); color: var(--text); }

.header-right {
  overflow: hidden;
  min-width: 0;
}

.carrier-name-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  padding: 8px;
}

/* Subscribe section */
.subscribe-section {
  max-width: 560px;
  margin: 0 auto 32px;
  padding: 0 20px;
}
.subscribe-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.subscribe-icon { font-size: 1.6rem; flex-shrink: 0; }
.subscribe-content { flex: 1; min-width: 140px; }
.subscribe-title { font-size: .88rem; font-weight: 600; margin-bottom: 3px; }
.subscribe-desc { font-size: .75rem; color: var(--muted); line-height: 1.4; }
.subscribe-form { display: flex; gap: 6px; flex-shrink: 0; }
.subscribe-input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: .82rem;
  outline: none;
  width: 180px;
}
.subscribe-input:focus { border-color: var(--accent); }
.subscribe-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.subscribe-btn:hover { opacity: .9; }
@media (max-width: 480px) {
  .subscribe-form { width: 100%; }
  .subscribe-input { flex: 1; width: auto; }
}

/* Étape en échec */
.step-item.current.failed .step-badge {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 4px rgba(239,68,68,.15) !important;
}
.step-item.current.failed {
    background: rgba(239,68,68,.06) !important;
    border-color: rgba(239,68,68,.2) !important;
}
.step-item.current.failed .step-name {
    color: #ef4444 !important;
    font-weight: 700;
}
.step-item.current.failed .step-msg {
    color: rgba(239,68,68,.8) !important;
}
.step-item.current.failed .step-time,
.step-item.current.failed .step-date {
    color: rgba(239,68,68,.6) !important;
}
.step-item.current.relay .step-badge {
    background: #f59e0b !important;
    border-color: #f59e0b !important;
    box-shadow: 0 0 0 4px rgba(245,158,11,.15) !important;
}
.step-item.current.relay {
    background: rgba(245,158,11,.06) !important;
    border-color: rgba(245,158,11,.2) !important;
}
.step-item.current.relay .step-name {
    color: #f59e0b !important;
    font-weight: 700;
}
.step-item.current.relay .step-msg {
    color: rgba(245,158,11,.8) !important;
}
.step-item.current.relay .step-date {
    color: rgba(245,158,11,.6) !important;
}
.step-item.current.relay .step-sep {
    background: #f59e0b !important;
}
.step-item.current.delayed .step-badge {
    background: #f472b6 !important;
    border-color: #f472b6 !important;
    box-shadow: 0 0 0 4px rgba(244,114,182,.15) !important;
}
.step-item.current.delayed {
    background: rgba(244,114,182,.06) !important;
    border-color: rgba(244,114,182,.2) !important;
}
.step-item.current.delayed .step-name {
    color: #f472b6 !important;
    font-weight: 700;
}
.step-item.current.delayed .step-msg {
    color: rgba(244,114,182,.8) !important;
}
.step-item.current.delayed .step-date {
    color: rgba(244,114,182,.6) !important;
}
.step-item.current.delayed .step-sep {
    background: #f472b6 !important;
}
