/* ============================================================
   LeilãoFácil - Estilos Principais
   ============================================================ */

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* ---- Botões de filtro ---- */
.filtro-btn {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid #e5e7eb;
  background: white;
  color: #6b7280;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.filtro-btn.active {
  background: #1e40af;
  border-color: #1e40af;
  color: white;
}
.filtro-btn:hover:not(.active) {
  border-color: #93c5fd;
  color: #1d4ed8;
  background: #eff6ff;
}

.filtro-mini {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  border: 1.5px solid #e5e7eb;
  background: white;
  color: #9ca3af;
  cursor: pointer;
  transition: all .15s;
}
.filtro-mini.active { background: #f3f4f6; color: #374151; border-color: #9ca3af; }
.filtro-mini.viavel.active { background: #dcfce7; color: #16a34a; border-color: #86efac; }
.filtro-mini.nao_viavel.active { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }
.filtro-mini.pendente.active { background: #fef9c3; color: #ca8a04; border-color: #fde047; }

/* ---- Cards de imóvel ---- */
.imovel-card {
  background: white;
  border-radius: 16px;
  border: 1.5px solid #e5e7eb;
  padding: 16px;
  cursor: pointer;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.imovel-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 20px rgba(59,130,246,.12);
  transform: translateY(-1px);
}
.imovel-card:active { transform: scale(.98); }

.imovel-card.viavel { border-left: 4px solid #22c55e; }
.imovel-card.nao_viavel { border-left: 4px solid #ef4444; }
.imovel-card.encerrado { opacity: .7; background: #f9fafb; }

/* Badge de viabilidade no card */
.card-viab-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: .5px;
}
.card-viab-badge.viavel { background: #dcfce7; color: #15803d; }
.card-viab-badge.nao_viavel { background: #fee2e2; color: #b91c1c; }

/* ---- Badges de estágio ---- */
.estagio-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
}
.estagio-badge.primeira_praca { background: #dbeafe; color: #1d4ed8; }
.estagio-badge.segunda_praca  { background: #e0e7ff; color: #4338ca; }
.estagio-badge.licitacao      { background: #fef3c7; color: #d97706; }
.estagio-badge.venda_online   { background: #d1fae5; color: #059669; }
.estagio-badge.venda_direta   { background: #ede9fe; color: #7c3aed; }
.estagio-badge.encerrado      { background: #f1f5f9; color: #64748b; }

/* ---- Stat cards ---- */
.stat-card {
  background: white;
  border-radius: 12px;
  border: 1.5px solid #e5e7eb;
  padding: 10px 16px;
  text-align: center;
  min-width: 80px;
  flex-shrink: 0;
}

/* ---- Modais ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  backdrop-filter: blur(2px);
  animation: fadeIn .15s;
}
@media (min-width: 640px) {
  .modal-overlay { align-items: center; padding: 16px; }
}

.modal-card {
  background: white;
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  padding: 20px 16px;
  animation: slideUp .2s ease-out;
  -webkit-overflow-scrolling: touch;
}
@media (min-width: 640px) {
  .modal-card {
    border-radius: 20px;
    max-width: 520px;
    max-height: 88vh;
    padding: 24px;
  }
  .modal-large { max-width: 600px; }
}

.modal-card.hidden { display: none; }
.modal-overlay.hidden { display: none; }

/* ---- Estágio radio ---- */
.estagio-radio {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  font-weight: 600;
  color: #6b7280;
  transition: all .15s;
  text-align: center;
}
.estagio-radio.selected {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

/* ---- Botão ícone ---- */
.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s;
  font-size: 15px;
}
.btn-icon:hover { background: rgba(255,255,255,.2); }

/* ---- Viabilidade botões ---- */
.viab-btn.active-viavel {
  background: #16a34a !important;
  color: white !important;
  border-color: #16a34a !important;
}
.viab-btn.active-nao_viavel {
  background: #dc2626 !important;
  color: white !important;
  border-color: #dc2626 !important;
}

/* ---- Eventos card ---- */
.evento-card {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 8px;
}
.evento-card.editavel { cursor: pointer; }
.evento-card.editavel:hover { border-color: #93c5fd; background: #eff6ff; }

/* ---- Info item ---- */
.info-item {
  background: #f8fafc;
  border-radius: 8px;
  padding: 8px 10px;
}
.info-item .label { font-size: 10px; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: .5px; }
.info-item .value { font-size: 13px; font-weight: 600; color: #374151; margin-top: 2px; }

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  z-index: 200;
  max-width: calc(100vw - 32px);
  text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
  animation: slideUp .2s;
}
.toast.success { background: #16a34a; }
.toast.error   { background: #dc2626; }
.toast.warning { background: #d97706; }

/* ---- Chip de data urgente ---- */
.urgente { color: #dc2626; animation: pulseRed 1.5s infinite; }
@keyframes pulseRed {
  0%, 100% { opacity: 1; }
  50% { opacity: .6; }
}

/* ---- Animações ---- */
@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ---- Scrollbar ---- */
.modal-card::-webkit-scrollbar { width: 4px; }
.modal-card::-webkit-scrollbar-track { background: transparent; }
.modal-card::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* ---- Encerrado chip ---- */
.chip-encerrado {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

/* ---- Badge de fonte ---- */
.fonte-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: .3px;
}
.fonte-badge.smart {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}
.fonte-badge.caixa {
  background: #dbeafe;
  color: #1e40af;
}

/* Card foto miniatura */
.card-foto {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  border: 1.5px solid #e5e7eb;
  flex-shrink: 0;
}

/* Responsive grid */
@media (min-width: 640px) {
  #listaImoveis { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
  #listaImoveis { grid-template-columns: 1fr 1fr 1fr; }
}
