/* ============================================
   MEUS PEDIDOS — Layout Lista Organizada
   ============================================ */

.mp-main {
  min-height: 100vh;
  padding-top: 100px;
  padding-bottom: 60px;
  background: var(--bg);
}

/* ─── Page Header ─────────────────────────── */
.mp-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.mp-page-title h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.mp-page-title h1 i {
  color: var(--primary);
  font-size: 24px;
}

.mp-page-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 2px;
}

/* ─── Stats Row ───────────────────────────── */
.mp-stats-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mp-stat-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.mp-stat-chip i { font-size: 12px; }
.mp-stat-pago { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.mp-stat-pago i { color: #059669; }
.mp-stat-pendente { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.mp-stat-pendente i { color: #d97706; }

/* ─── Toolbar: Search + Sort ──────────────── */
.mp-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.mp-search {
  position: relative;
  flex: 1;
  max-width: 320px;
}

.mp-search input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  border: 1px solid var(--border);
  border-radius: 50px;
  background: var(--bg-card);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  transition: var(--transition);
  outline: none;
}

.mp-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}

.mp-search input::placeholder { color: var(--text-muted); }

.mp-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: var(--text-muted);
  pointer-events: none;
}

.mp-sort-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 50px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.mp-sort-btn:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}

/* ─── Filter Bar ──────────────────────────── */
.mp-filter-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.mp-filter-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: 50px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.mp-filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: #f0fdf4;
}

.mp-filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.25);
}
.mp-filter-btn.active i { color: white; }

/* ─── Loading ─────────────────────────────── */
.mp-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 80px 0;
  color: var(--text-secondary);
  font-size: 15px;
}

.mp-loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: mpSpin 0.8s linear infinite;
}

@keyframes mpSpin { to { transform: rotate(360deg); } }

/* ─── Empty State ─────────────────────────── */
.mp-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 80px 24px;
  gap: 10px;
}

.mp-empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), #d1fae5);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.mp-empty-icon i { font-size: 28px; color: var(--primary-dark); }
.mp-empty-state h3 { font-size: 18px; font-weight: 700; color: var(--text); }
.mp-empty-state p { color: var(--text-secondary); font-size: 14px; max-width: 360px; }

.mp-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 26px;
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 14px;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  margin-top: 8px;
}
.mp-btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3);
  transform: translateY(-1px);
}

/* ============================================
   LIST TABLE
   ============================================ */

.mp-list-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* ─── Table Header ────────────────────────── */
.mp-list-header {
  display: grid;
  grid-template-columns: 44px 1fr 140px 100px 110px 100px 44px;
  align-items: center;
  gap: 0;
  padding: 0 20px;
  height: 44px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.mp-list-header span {
  padding: 0 8px;
}

/* ─── List Row ────────────────────────────── */
.mp-row {
  display: grid;
  grid-template-columns: 44px 1fr 140px 100px 110px 100px 44px;
  align-items: center;
  gap: 0;
  padding: 0 20px;
  min-height: 64px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s ease;
}

.mp-row:last-child {
  border-bottom: none;
}

.mp-row:hover {
  background: #f8fdf9;
}

.mp-row:active {
  background: #f0fdf4;
}

/* Status indicator dot */
.mp-row-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin: 0 auto;
  flex-shrink: 0;
}

.mp-row-dot.PENDENTE { background: #f59e0b; box-shadow: 0 0 0 3px #fef3c7; }
.mp-row-dot.PAGO { background: #22c55e; box-shadow: 0 0 0 3px #d1fae5; }
.mp-row-dot.PROCESSANDO { background: #3b82f6; box-shadow: 0 0 0 3px #dbeafe; }
.mp-row-dot.CONCLUIDO { background: #8b5cf6; box-shadow: 0 0 0 3px #ede9fe; }
.mp-row-dot.CANCELADO { background: #ef4444; box-shadow: 0 0 0 3px #fecaca; }
.mp-row-dot.EXPIRADO { background: #9ca3af; box-shadow: 0 0 0 3px #f3f4f6; }

/* Principal cell: tipo + placa + id */
.mp-row-principal {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  min-width: 0;
}

.mp-row-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.mp-row-icon.RECURSO {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  color: #1d4ed8;
}
.mp-row-icon.COBRANCA {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #b45309;
}

.mp-row-info {
  min-width: 0;
  flex: 1;
}

.mp-row-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mp-row-placa {
  display: inline-block;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  padding: 1px 7px;
  font-weight: 800;
  font-size: 11px;
  font-family: monospace;
  color: var(--text);
  letter-spacing: 0.8px;
  vertical-align: middle;
  flex-shrink: 0;
}

.mp-row-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Veículo cell */
.mp-row-veiculo {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Valor cell */
.mp-row-valor {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary-dark);
  padding: 0 8px;
  white-space: nowrap;
  line-height: 1.3;
}

/* Coupon badge */
.mp-coupon-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #dcfce7;
  color: #16a34a;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 6px;
  margin-left: 4px;
  vertical-align: middle;
}

/* Status badge */
.mp-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.mp-badge.PENDENTE { background: #fef3c7; color: #92400e; }
.mp-badge.PAGO { background: #d1fae5; color: #065f46; }
.mp-badge.AGUARDANDO_DOCS { background: #fef3c7; color: #92400e; }
.mp-badge.PROCESSANDO { background: #dbeafe; color: #1e40af; }
.mp-badge.CONCLUIDO { background: #ede9fe; color: #5b21b6; }
.mp-badge.CANCELADO { background: #fecaca; color: #991b1b; }
.mp-badge.EXPIRADO { background: #f3f4f6; color: #4b5563; }

/* Chip Acompanhar */
.mp-chip-acompanhar {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 600;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 4px rgba(16, 185, 129, 0.25);
}
.mp-chip-acompanhar:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(16, 185, 129, 0.35);
  color: #fff;
  text-decoration: none;
}
.mp-chip-acompanhar i {
  font-size: 10px;
}
.mp-row-badge-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

/* Date cell */
.mp-row-date {
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 8px;
  white-space: nowrap;
}

/* Arrow / chevron */
.mp-row-arrow {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  transition: var(--transition);
}

.mp-row:hover .mp-row-arrow {
  color: var(--primary);
  transform: translateX(2px);
}

/* ─── List Footer / Pagination ────────────── */
.mp-list-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  font-size: 12px;
  color: var(--text-muted);
}

.mp-list-count {
  font-weight: 600;
}

.mp-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.mp-page-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.mp-page-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: #f0fdf4;
}

.mp-page-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.mp-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============================================
   MODAL
   ============================================ */

.mp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.mp-modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: mpModalIn 0.25s ease;
}

@keyframes mpModalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.mp-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}

.mp-modal-header h2 {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mp-modal-close {
  width: 34px;
  height: 34px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  font-size: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.mp-modal-close:hover { background: #fee2e2; color: var(--danger); }

.mp-modal-body { padding: 24px; }

/* Modal sections */
.mp-detail-section { margin-bottom: 24px; }
.mp-detail-section:last-child { margin-bottom: 0; }

.mp-detail-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.mp-detail-section-title i { font-size: 13px; color: var(--primary); }

/* Detail info grid */
.mp-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mp-detail-item {
  background: var(--bg);
  padding: 10px 12px;
  border-radius: var(--radius-xs);
}

.mp-detail-item-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.3px;
  margin-bottom: 3px;
}

.mp-detail-item-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  word-break: break-all;
}
.mp-detail-item-value.mp-green { color: var(--primary-dark); }

/* Timeline */
.mp-timeline {
  position: relative;
  padding-left: 28px;
}

.mp-timeline::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border);
}

.mp-timeline-item {
  position: relative;
  padding-bottom: 14px;
}
.mp-timeline-item:last-child { padding-bottom: 0; }

.mp-timeline-dot {
  position: absolute;
  left: -28px;
  top: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.mp-timeline-dot i { font-size: 8px; color: var(--text-muted); }
.mp-timeline-dot.active { border-color: var(--primary); background: #ecfdf5; }
.mp-timeline-dot.active i { color: var(--primary); }
.mp-timeline-dot.done { border-color: var(--primary); background: var(--primary); }
.mp-timeline-dot.done i { color: white; }

.mp-timeline-label { font-size: 13px; font-weight: 600; color: var(--text); }
.mp-timeline-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

/* Multas list in modal */
.mp-multa-list { display: flex; flex-direction: column; gap: 8px; }

.mp-multa-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--border);
}
.mp-multa-item.GRAVE { border-left-color: #f59e0b; }
.mp-multa-item.GRAVISSIMA { border-left-color: #ef4444; }
.mp-multa-item.MEDIA { border-left-color: #3b82f6; }
.mp-multa-item.LEVE { border-left-color: #22c55e; }

.mp-multa-info { flex: 1; min-width: 0; }

.mp-multa-desc {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-multa-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.mp-multa-valor {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary-dark);
  white-space: nowrap;
}

/* ─── Modal Actions ───────────────────────── */
.mp-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.mp-btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: 2px solid var(--border);
  border-radius: 50px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}
.mp-btn-outline:hover { border-color: var(--primary); color: var(--primary-dark); background: #f0fdf4; }

.mp-btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: 2px solid #fecaca;
  border-radius: 50px;
  background: transparent;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.mp-btn-danger:hover { background: #fef2f2; border-color: var(--danger); }

/* ─── Footer ──────────────────────────────── */
.mp-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 24px 0;
}

.mp-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mp-footer-inner p {
  font-size: 13px;
  color: var(--text-muted);
}

/* ============================================
   RESPONSIVO
   ============================================ */

@media (max-width: 768px) {
  .mp-main { padding-top: 88px; }
  .mp-page-header { flex-direction: column; }
  .mp-page-title h1 { font-size: 22px; }

  .mp-list-header { display: none; }

  .mp-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .mp-search { max-width: none; }

  .mp-filter-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .mp-filter-btn { white-space: nowrap; flex-shrink: 0; }

  /* Converter row em mini-card compacto */
  .mp-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 14px 16px;
    gap: 8px;
    min-height: initial;
  }

  .mp-row-dot { order: 0; margin: 0; }

  .mp-row-principal {
    order: 1;
    flex: 1;
    padding: 0;
    min-width: 0;
  }

  .mp-row-badge-cell { order: 2; }
  .mp-row-veiculo { display: none; }

  .mp-row-valor {
    order: 3;
    padding: 0;
    font-size: 15px;
    margin-left: auto;
  }

  .mp-row-date {
    order: 5;
    padding: 0;
    width: 100%;
    border-top: 1px solid var(--border);
    padding-top: 8px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .mp-row-arrow { display: none; }

  .mp-list-footer {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .mp-detail-grid { grid-template-columns: 1fr; }

  .mp-modal {
    max-height: 90vh;
    margin: 10px;
  }

  .mp-modal-actions { flex-direction: column; }

  .mp-footer-inner {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .mp-stats-row { flex-direction: column; }
  .mp-stat-chip { width: fit-content; }
  .mp-row-icon { width: 30px; height: 30px; font-size: 13px; border-radius: 8px; }
}
