/* ============================================================
   TRACKING — Estilos exclusivos del resultado de seguimiento
   NO incluye estilos de login, form-section ni visual-section.
   Depende de: shared.css (variables) y colors.css (--color-status-*)
   ============================================================ */

/* Turbo-frame contenedor del resultado */
turbo-frame#tracking_result {
  display: block;
  width: 100%;
}

/* ============================================================
   Estado vacío / instrucciones / no encontrado
   Fondo siempre gris claro → colores oscuros, nunca blancos
   ============================================================ */
.tracking-empty-state,
.tracking-not-found {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.5rem;
  height: 100%;
  color: #374151;
}

.tracking-empty-icon,
.tracking-not-found-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 1rem;
  opacity: 0.7;
}

.tracking-empty-icon svg,
.tracking-not-found-icon svg {
  width: 100%;
  height: 100%;
  stroke: #9ca3af;
}

.tracking-empty-state h3,
.tracking-not-found h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 0.5rem;
}

.tracking-empty-state p,
.tracking-not-found p {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0.25rem;
}

.tracking-empty-hint,
.tracking-not-found-hint {
  font-size: 0.75rem !important;
  color: #9ca3af !important;
  margin-top: 0.5rem;
}

.tracking-empty-state code {
  background: #e5e7eb;
  color: #374151;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.8rem;
}

/* ============================================================
   TRACKING RESULT — Diseño estilo Stitch
   ============================================================ */

/* Wrapper principal del resultado */
.tr-wrap {
  display: flex;
  flex-direction: column;
  background: #f8f9fb;
  height: 100%;
  overflow-y: auto;
}

/* ── Header ── */
.tr-header {
  padding: 1.5rem 1.5rem 1rem;
  background: white;
  border-bottom: 1px solid #f1f2f4;
}

.tr-header-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #9ca3af;
  text-transform: uppercase;
  margin: 0 0 0.25rem;
}

.tr-header-code {
  font-size: 1.375rem;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.02em;
  margin: 0 0 0.625rem;
  font-family: 'Outfit', monospace;
  word-break: break-all;
}

.tr-header-meta {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.tr-header-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.6875rem;
  font-weight: 600;
}

.tr-header-receiver {
  font-size: 0.8125rem;
  color: #6b7280;
}

/* ── Variables de color por estado ── */
.tr-status--pending_pickup {
  --tr-color: var(--color-status-pending);
  --tr-bg:    var(--color-status-pending-bg);
  --tr-text:  var(--color-status-pending-text);
}
.tr-status--in_warehouse {
  --tr-color: var(--color-status-warehouse);
  --tr-bg:    var(--color-status-warehouse-bg);
  --tr-text:  var(--color-status-warehouse-text);
}
.tr-status--in_transit {
  --tr-color: var(--color-status-transit);
  --tr-bg:    var(--color-status-transit-bg);
  --tr-text:  var(--color-status-transit-text);
}
.tr-status--rescheduled {
  --tr-color: var(--color-status-rescheduled);
  --tr-bg:    var(--color-status-rescheduled-bg);
  --tr-text:  var(--color-status-rescheduled-text);
}
.tr-status--delivered {
  --tr-color: var(--color-status-delivered);
  --tr-bg:    var(--color-status-delivered-bg);
  --tr-text:  var(--color-status-delivered-text);
}
.tr-status--return {
  --tr-color: var(--color-status-return);
  --tr-bg:    var(--color-status-return-bg);
  --tr-text:  var(--color-status-return-text);
}
.tr-status--cancelled {
  --tr-color: var(--color-status-cancelled);
  --tr-bg:    var(--color-status-cancelled-bg);
  --tr-text:  var(--color-status-cancelled-text);
}

/* ── Card estado actual ── */
.tr-card {
  margin: 0.875rem 1rem;
  background: white;
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);
  flex-shrink: 0;
}

.tr-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.tr-card-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tr-card-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

.tr-status-name {
  color: var(--tr-color, #6b7280);
}

.tr-card-subtitle {
  font-size: 0.75rem;
  color: #9ca3af;
  margin: 0 0 0.625rem;
}

.tr-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background-color: var(--tr-bg, #f9fafb);
  color: var(--tr-color, #6b7280);
}

.tr-card-icon svg {
  width: 18px;
  height: 18px;
}

.tr-card-message {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  line-height: 1.5;
  font-weight: 500;
  background-color: var(--tr-bg, #f9fafb);
  color: var(--tr-text, #374151);
}

.tr-card-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
  background-color: var(--tr-color, #6b7280);
}

.tr-card-motive {
  opacity: 0.75;
  font-size: 0.78em;
}

/* ── Timeline ── */
.tr-timeline {
  padding: 0.5rem 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tr-entry {
  display: flex;
  gap: 0.875rem;
  align-items: flex-start;
}

/* Columna izquierda: icono + línea vertical */
.tr-entry-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 32px;
}

.tr-entry-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  background-color: var(--tr-bg, #f3f4f6);
  border: 2px solid var(--tr-color, #9ca3af);
  color: var(--tr-color, #9ca3af);
}

.tr-entry-icon svg {
  width: 14px;
  height: 14px;
}

.tr-entry-line {
  width: 2px;
  flex: 1;
  min-height: 20px;
  background: #e5e7eb;
  margin: 4px 0;
}

/* Columna derecha: contenido */
.tr-entry-content {
  flex: 1;
  padding: 3px 0 1.25rem;
}

.tr-entry-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.125rem;
}

.tr-entry-badge {
  font-size: 0.6875rem;
  line-height: 1;
}

.tr-entry-time {
  font-size: 0.6875rem;
  color: #9ca3af;
  white-space: nowrap;
  flex-shrink: 0;
}

.tr-entry-location {
  font-size: 0.75rem;
  color: #6b7280;
  margin: 0.125rem 0 0;
}

/* ============================================================
   Tracking search form
   ============================================================ */
.tracking-search-form {
  flex: 1;
}

.tracking-code-input {
  text-transform: uppercase;
  letter-spacing: 0.025em;
  font-family: monospace, monospace;
}

/* ============================================================
   Error messages
   ============================================================ */
.error-messages {
  background: #fef2f2;
  border: 2px solid #fecaca;
  border-radius: 11px;
  padding: 0.875rem;
  margin-bottom: 1.25rem;
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

.error-messages h2 {
  color: #991b1b;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
}

.error-messages ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.error-messages li {
  color: #dc2626;
  font-size: 0.75rem;
  padding: 0.25rem 0;
}

/* ============================================================
   Responsive — Mobile (≤ 768px)
   Solo ajustes de tracking, sin referencias a login
   ============================================================ */
@media (max-width: 768px) {
  /* Timeline: crece con el contenido, el card padre se encarga del scroll */
  .tracking-timeline {
    max-height: none;
    overflow-y: visible;
  }

  /* Empty state / not found: altura ajustada para mobile */
  .tracking-empty-state,
  .tracking-not-found {
    height: auto;
    min-height: 180px;
  }

  /* Turbo-frame en mobile */
  turbo-frame#tracking_result {
    min-height: 180px;
    background: #f9fafb;
  }
}
