/* ============================================================
   KORE NEXTUS · VISTA PÚBLICA DE RASTREO (COMPRADOR)
   Integración con API / Webhook de Melhor Envio
   ============================================================ */

:root {
  --bg:           linear-gradient(135deg, #f7f9ff 0%, #fefdf8 50%, #f2f5fd 100%);
  --surface:      rgba(255, 255, 255, 0.94);
  --border:       rgba(14, 57, 176, 0.14);
  --text:         #0e2760;
  --text-muted:   #4b5f88;
  --text-faint:   #8898b8;
  --brand:        #0E39B0;
  --brand-hover:  #092780;
  --brand-soft:   rgba(14, 57, 176, 0.08);
  --success:      #10b981;
  --success-bg:   #dcfce7;
  --danger:       #ef4444;
  --danger-bg:    #fee2e2;
  --warn:         #f59e0b;
  --warn-bg:      #fef3c7;
  --info:         #3b82f6;
  --info-bg:      #dbeafe;
  --radius:       20px;
  --radius-sm:    12px;
  --shadow:       0 12px 36px rgba(14, 39, 96, 0.08);
  --shadow-lg:    0 20px 50px rgba(14, 39, 96, 0.14);
  --max:          780px;
  --font:         'Montserrat', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Header */
header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 20px;
}
.hdr-inner {
  max-width: var(--max);
  margin: 0 auto;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo img { height: 40px; width: auto; object-fit: contain; }
.back-btn { font-size: 13px; font-weight: 600; color: var(--text-muted); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.back-btn:hover { color: var(--brand); }

/* Main layout */
main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 32px 20px 64px;
}

/* Card base */
.card {
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 24px;
  transition: box-shadow 0.3s ease;
}
.card:hover { box-shadow: var(--shadow-lg); }

/* Search Box */
.search-header { text-align: center; margin-bottom: 24px; }
.search-header h1 { font-size: 22px; font-weight: 700; color: var(--brand); margin-bottom: 6px; }
.search-header p { font-size: 14px; color: var(--text-muted); }

.search-form { display: flex; gap: 12px; }
.search-form input {
  flex: 1;
  padding: 14px 18px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  outline: none;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  text-transform: uppercase;
}
.search-form input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(14, 57, 176, 0.12);
}
.search-form button {
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #0e39b0 0%, #082984 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(14, 57, 176, 0.28);
  transition: transform 0.2s, box-shadow 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.search-form button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(14, 57, 176, 0.38);
}
.sample-codes { font-size: 12.5px; color: var(--text-muted); margin-top: 12px; text-align: center; }
.sample-codes span { color: var(--brand); font-weight: 600; cursor: pointer; text-decoration: underline; }

/* Status Summary Banner */
.status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: rgba(14, 57, 176, 0.035);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
}
.status-info-main h2 { font-size: 16px; font-weight: 700; color: var(--text); }
.status-info-main p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* Dynamic Status Badges */
.badge-status {
  padding: 8px 16px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.badge-status.delivered { background: var(--success-bg); color: var(--success); }
.badge-status.in_transit, .badge-status.shipped { background: var(--info-bg); color: var(--info); }
.badge-status.packing, .badge-status.posted { background: var(--warn-bg); color: var(--warn); }
.badge-status.critical, .badge-status.delayed, .badge-status.undelivered {
  background: var(--danger-bg);
  color: var(--danger);
  animation: pulseBg 2s infinite;
}

@keyframes pulseBg {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Timeline Vertical Component */
.timeline-title { font-size: 15px; font-weight: 700; color: var(--brand); margin-bottom: 20px; text-transform: uppercase; letter-spacing: .04em; }
.timeline-v {
  position: relative;
  padding-left: 32px;
  margin-bottom: 24px;
}
.timeline-v::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: rgba(14, 57, 176, 0.12);
  border-radius: 2px;
}
.t-step-item {
  position: relative;
  margin-bottom: 28px;
}
.t-step-item:last-child { margin-bottom: 0; }

.t-dot {
  position: absolute;
  left: -32px;
  top: 0;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--text-faint);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-faint);
  transition: all 0.3s ease;
}
.t-step-item.done .t-dot {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.t-step-item.active .t-dot {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(14, 57, 176, 0.2);
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(14, 57, 176, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(14, 57, 176, 0); }
  100% { box-shadow: 0 0 0 0 rgba(14, 57, 176, 0); }
}

.t-content h4 { font-size: 14.5px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.t-content p { font-size: 13px; color: var(--text-muted); }
.t-content .t-date { font-size: 12px; color: var(--text-faint); margin-top: 4px; font-weight: 500; }

/* Detail Events Table */
.events-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 12px; }
.event-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.event-row:last-child { border-bottom: none; }
.event-msg { font-weight: 600; color: var(--text); }
.event-meta { font-size: 12px; color: var(--text-muted); text-align: right; }

@media (max-width: 600px) {
  .search-form { flex-direction: column; }
  .status-banner { flex-direction: column; align-items: flex-start; gap: 12px; }
  .card { padding: 20px; }
}
