/* Rastreamento de pedidos - UX mobile clean + accordions */

:root {
  --ph-bg: #f6f7fb;
  --ph-card: #ffffff;
  --ph-text: #111827;
  --ph-muted: #667085;
  --ph-border: #e6eaf2;
  --ph-border-2: #eef2f7;

  --ph-primary: #f0a309;
  --ph-primary-600: #d18d00;
  --ph-primary-50: #fff7e6;

  --ph-radius-lg: 18px;
  --ph-radius-md: 14px;
  --ph-radius-sm: 10px;

  --ph-shadow-sm: 0 8px 18px rgba(17, 24, 39, 0.06);
  --ph-shadow-md: 0 14px 34px rgba(17, 24, 39, 0.1);

  --ph-focus: 0 0 0 3px rgba(240, 163, 9, 0.25);
}

.phooto-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.phooto-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.phooto-title {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ph-text);
}

.phooto-sub {
  margin: 8px 0 0;
  color: #6b7280;
  font-size: 14px;
}

/* Grid */
.phooto-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 980px) {
  .phooto-grid {
    grid-template-columns: 1fr;
  }
}

/* Card */
.card {
  background: var(--ph-card);
  border: 1px solid var(--ph-border);
  border-radius: var(--ph-radius-lg);
  box-shadow: var(--ph-shadow-sm);
  overflow: hidden;
}
.card-h {
  padding: 14px 16px;
  border-bottom: 1px solid var(--ph-border-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ph-text);
}
.card-b {
  padding: 14px 16px;
}

/* Card como accordion (Seus pedidos no mobile) */
details.card > summary {
  list-style: none;
  cursor: pointer;
}
details.card > summary::-webkit-details-marker {
  display: none;
}
.card--orders .card-h h2,
.card--orders .card-h .card-title {
  margin: 0;
}
.card-toggle-hint {
  font-size: 12px;
  font-weight: 800;
  color: var(--ph-muted);
}
details.card .card-toggle-hint--open {
  display: none;
}
details.card[open] .card-toggle-hint--closed {
  display: none;
}
details.card[open] .card-toggle-hint--open {
  display: inline;
}
@media (min-width: 981px) {
  .card-toggle-hint {
    display: none;
  }
}

@media (max-width: 980px) {
  /* dá mais cara de "clicável" */
  details.card.card--orders > summary.card-h {
    user-select: none;
  }
}

/* Helpers */
.muted {
  color: var(--ph-muted);
  font-size: 13px;
  margin: 0;
}

/* Form */
.field {
  margin: 0 0 12px;
}
.label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #475467;
  margin-bottom: 6px;
}
.input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--ph-border);
  border-radius: 12px;
  padding: 0 12px;
  font-size: 14px;
  color: var(--ph-text);
  background: #fff;
  outline: none;
  transition:
    box-shadow 0.15s ease,
    border-color 0.15s ease,
    transform 0.05s ease;
}
.input:focus {
  border-color: rgba(240, 163, 9, 0.55);
  box-shadow: var(--ph-focus);
}
.input::placeholder {
  color: #9aa4b2;
}

/* Buttons */
.phooto-btn {
  appearance: none;
  border: 1px solid var(--ph-border);
  background: #fff;
  color: var(--ph-text);
  border-radius: 12px;
  height: 42px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition:
    transform 0.06s ease,
    box-shadow 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    opacity 0.15s ease;
  user-select: none;
  text-decoration: none;
}
.phooto-btn:hover {
  box-shadow: 0 10px 20px rgba(17, 24, 39, 0.08);
  border-color: #d9dee8;
}
.phooto-btn:active {
  transform: translateY(1px);
}
.phooto-btn:focus {
  outline: none;
  box-shadow: var(--ph-focus);
}
.phooto-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}
.phooto-btn--primary {
  background: var(--ph-primary);
  border-color: var(--ph-primary);
  color: #1f2937;
}
.phooto-btn--primary:hover {
  background: var(--ph-primary-600);
  border-color: var(--ph-primary-600);
  box-shadow: 0 12px 24px rgba(240, 163, 9, 0.2);
}

/* Alerts */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  margin: 10px 0 12px;
  font-size: 13px;
  line-height: 1.35;
}
.alert svg {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 1px;
}
.alert--carrier {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #7c2d12;
}

/* Orders toolbar/pagination */
.orders-toolbar {
  margin-bottom: 12px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.orders-toolbar .field {
  margin: 0;
  flex: 1 1 220px;
}
.orders-summary {
  margin-bottom: 10px;
}
.orders-pagination {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  margin-top: 12px;
}
.orders-pagination #page-indicator {
  padding: 0 6px;
}

/* Orders list */
.orders {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.order {
  border: 1px solid var(--ph-border-2);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-decoration: none;
  color: var(--ph-text);
  background: #fff;
  transition:
    box-shadow 0.15s ease,
    transform 0.06s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}
.order:hover {
  box-shadow: var(--ph-shadow-sm);
  border-color: #dfe5ef;
}
.order:active {
  transform: translateY(1px);
}
.order.is-active {
  border-color: rgba(17, 24, 39, 0.65);
  box-shadow: var(--ph-shadow-md);
  background: linear-gradient(
    0deg,
    rgba(240, 163, 9, 0.06),
    rgba(240, 163, 9, 0.06)
  );
}
.order .left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.order .right {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}
.order-id {
  font-weight: 900;
  color: var(--ph-text);
  font-size: 14px;
}
.order-meta {
  font-size: 13px;
  color: var(--ph-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
@media (max-width: 420px) {
  .order-meta {
    max-width: 180px;
  }
}
.order-total {
  font-weight: 900;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid transparent;
  white-space: nowrap;
}

/* Em rota: animação fluida com caminhão */
@keyframes phShimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes phTruckBounce {
  0%,
  100% {
    transform: scaleX(-1) translateY(0);
  }
  50% {
    transform: scaleX(-1) translateY(-2px);
  }
}

@keyframes phDeliveredGlow {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.18);
  }
}

@keyframes phProducingFlow {
  0% {
    background-position: -180% 0;
  }
  100% {
    background-position: 180% 0;
  }
}

.badge.badge--inroute {
  position: relative;
  overflow: hidden;
  background: linear-gradient(
    90deg,
    #fff7ed 0%,
    #ffedd5 25%,
    #fed7aa 50%,
    #ffedd5 75%,
    #fff7ed 100%
  );
  background-size: 200% 100%;
  animation: phShimmer 2.5s ease-in-out infinite;
}

.badge.badge--inroute::after {
  content: "🚚";
  display: inline-block;
  margin-left: 8px;
  font-size: 16px;
  line-height: 1;
  vertical-align: middle;
  animation: phTruckBounce 0.8s ease-in-out infinite;
}

@media (min-width: 681px) {
  .detail-head .badge {
    font-size: 14px;
    padding: 10px 16px;
    gap: 8px;
  }

  .detail-head .badge.badge--inroute::after {
    font-size: 20px;
    margin-left: 12px;
  }
}

/* Entregue */
.detail-head .badge.badge--green {
  animation: phDeliveredGlow 2.1s ease-in-out infinite;
}

/* Em produção */
.detail-head .badge.badge--purple {
  position: relative;
  overflow: hidden;
  background: linear-gradient(
    90deg,
    #f5f3ff 0%,
    #ede9fe 25%,
    #ddd6fe 50%,
    #ede9fe 75%,
    #f5f3ff 100%
  );
  background-size: 200% 100%;
  animation: phProducingFlow 2.2s linear infinite;
}

@media (max-width: 680px) {
  .badge.badge--inroute::after {
    font-size: 18px;
    margin-left: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .badge.badge--inroute {
    animation: none;
    background-position: 0 0;
  }

  .badge.badge--inroute::after {
    animation: none;
    transform: scaleX(-1);
  }

  .detail-head .badge.badge--green,
  .detail-head .badge.badge--purple {
    animation: none;
    background-position: 0 0;
    box-shadow: none;
  }
}

@media (max-width: 680px) {
  .detail-head .badge {
    width: 100%;
    justify-content: center;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.1;
  }
}
.badge--gray {
  background: #f9fafb;
  border-color: #e5e7eb;
  color: #374151;
}
.badge--blue {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}
.badge--purple {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #6d28d9;
}
.badge--orange {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #c2410c;
}
.badge--green {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}
.badge--red {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

/* Detail header */
.detail-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
.detail-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.detail-title h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.01em;
}

/* Status current (essencial) */
.status-current {
  margin-top: 12px;
  border: 1px solid var(--ph-border-2);
  background: #fff;
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.status-current__label {
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #475467;
}
.status-current__value {
  font-weight: 900;
  font-size: 14px;
  color: var(--ph-text);
}

/* KV */
.kv {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.kv > div {
  border: 1px solid var(--ph-border-2);
  border-radius: 14px;
  padding: 10px 12px;
  background: #fff;
}
.kv-item--eta {
  border-color: rgba(240, 163, 9, 0.35);
  background: var(--ph-primary-50);
}
.kv-item--eta .k {
  color: #7c2d12;
}
@media (max-width: 680px) {
  .kv {
    grid-template-columns: 1fr;
  }
}
.kv .k {
  font-size: 11px;
  color: #475467;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.kv .v {
  margin-top: 4px;
  font-size: 14px;
  color: var(--ph-text);
  font-weight: 700;
  line-height: 1.25;
}

/* Accordions */
.acc {
  margin-top: 12px;
  border: 1px solid var(--ph-border-2);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
}
.acc[open] {
  box-shadow: 0 10px 22px rgba(17, 24, 39, 0.06);
}
.acc__sum {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 900;
  color: var(--ph-text);
}
.acc__sum::-webkit-details-marker {
  display: none;
}
.acc__hint {
  font-size: 12px;
  font-weight: 800;
  color: var(--ph-muted);
}
.acc[open] .acc__hint {
  display: none;
}
.acc__body {
  padding: 0 14px 14px;
}

/* NOVO: meta da transportadora (claro e destacado) */
.carrier-meta {
  margin-top: 12px;
  border: 1px solid rgba(240, 163, 9, 0.25);
  background: var(--ph-primary-50);
  border-radius: 14px;
  padding: 10px 12px;
  display: grid;
  gap: 10px;
}
.carrier-meta__row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
}
.carrier-meta__k {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7c2d12;
}
.carrier-meta__v {
  font-size: 14px;
  font-weight: 800;
  color: var(--ph-text);
}

.tracking-copy-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tracking-copy-value,
.tracking-copy-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.tracking-copy-value {
  padding: 0;
  font-weight: 900;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.tracking-copy-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(124, 45, 18, 0.2);
  background: #fff;
  color: #7c2d12;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tracking-copy-value:hover,
.tracking-copy-value:focus-visible {
  color: #7c2d12;
}

.tracking-copy-btn:hover,
.tracking-copy-btn:focus-visible {
  background: #fff7ed;
  border-color: rgba(124, 45, 18, 0.35);
  outline: none;
}

.tracking-copy-value.is-copied,
.tracking-copy-btn.is-copied {
  color: #047857;
  border-color: rgba(4, 120, 87, 0.4);
}

.tracking-copy-value.is-copy-error,
.tracking-copy-btn.is-copy-error {
  color: #b91c1c;
  border-color: rgba(185, 28, 28, 0.35);
}

.tracking-copy-feedback {
  min-width: 64px;
  font-size: 12px;
  font-weight: 800;
  color: #047857;
}

@media (max-width: 680px) {
  .tracking-copy-btn {
    width: 30px;
    height: 30px;
  }
}

/* Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  position: relative;
}
.timeline:before {
  content: "";
  position: absolute;
  left: 5px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: #e5e7eb;
}
.step {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  position: relative;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #e5e7eb;
  margin-top: 6px;
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
}
.step.completed .dot {
  background: var(--ph-primary);
}
.step.disabled {
  opacity: 0.55;
}
.step.completed.conn-full:not(:last-child):after {
  content: "";
  position: absolute;
  left: 5px;
  top: 16px;
  width: 2px;
  height: calc(100% + 10px);
  background: var(--ph-primary);
  z-index: 1;
}
.step.completed.conn-half:not(:last-child):after {
  content: "";
  position: absolute;
  left: 5px;
  top: 16px;
  width: 2px;
  height: calc(50% + 5px);
  background: var(--ph-primary);
  z-index: 1;
}
.step .content {
  background: #fff;
  border: 1px solid var(--ph-border-2);
  border-radius: 14px;
  padding: 10px 12px;
  width: 100%;
}
.step .top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}
.step .name {
  font-weight: 900;
  color: var(--ph-text);
  font-size: 13px;
}
.step .at {
  font-size: 12px;
  color: var(--ph-muted);
  white-space: nowrap;
}
.step .note {
  margin: 6px 0 0;
  color: var(--ph-muted);
  font-size: 12px;
}

/* Empty */
.empty {
  padding: 16px;
  border: 1px dashed #e5e7eb;
  border-radius: 16px;
  color: var(--ph-muted);
  background: #fafafa;
  line-height: 1.35;
}

/* Track actions */
.track-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 10px;
}
.track-actions--top {
  margin-top: 12px;
}

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 8px;
}
@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}
.skeleton-box {
  height: 60px;
  margin: 8px 0;
}

/* Tracking history */
.tracking-history {
  margin-top: 12px;
  padding: 10px;
  border-radius: 14px;
  background: #f9fafb;
  border: 1px solid var(--ph-border-2);
}
.tracking-event {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--ph-border-2);
  border-radius: 12px;
  margin-bottom: 8px;
  align-items: flex-start;
  background: #fff;
  border-left: 4px solid rgba(240, 163, 9, 0.55);
}
.tracking-event .date-col {
  min-width: 130px;
  flex-shrink: 0;
}
.tracking-event .date-time {
  font-size: 13px;
  font-weight: 900;
  color: var(--ph-text);
}
.tracking-event .location {
  font-size: 11px;
  color: var(--ph-muted);
  margin-top: 2px;
}
.tracking-event .description {
  font-size: 13px;
  color: #374151;
  line-height: 1.4;
}
@media (max-width: 520px) {
  .tracking-event {
    flex-direction: column;
  }
  .tracking-event .date-col {
    min-width: 0;
  }
}

/* REMOVIDO: botão flutuante do mobile (não existe mais) */
