/**
 * Estilos complementares ao Tailwind CSS
 * Inclui regras de impressão para o Relatório do Proprietário
 */

/* Botão primário — verde Cananéia */
.btn-primary {
  background-color: #2E7D32;
  transition: background-color 0.2s;
}
.btn-primary:hover {
  background-color: #1B5E20;
}

/* Campos de formulário */
.input {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus {
  border-color: #43A047;
  box-shadow: 0 0 0 3px rgba(67, 160, 71, 0.15);
}

/* Lista suspensa de busca (combobox) */
.combo-lista {
  position: absolute;
  z-index: 50;
  left: 0;
  right: 0;
  margin-top: 0.25rem;
  max-height: 12rem;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}
.combo-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  border-bottom: 1px solid #f3f4f6;
  transition: background-color 0.15s;
}
.combo-item:last-child {
  border-bottom: none;
}
.combo-item:hover,
.combo-item:focus {
  background-color: #f0fdf4;
  outline: none;
}
.combo-item-vazio {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: #9ca3af;
}
.combo-item-cadastro {
  color: #15803d;
  font-weight: 600;
  border-top: 1px solid #e5e7eb;
}
.combo-item-cadastro:hover,
.combo-item-cadastro:focus {
  background-color: #ecfdf5;
}

/* Chips de imóveis no novo atendimento (multi-seleção) */
.imoveis-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.imovel-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  padding: 0.35rem 0.5rem 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #14532d;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 9999px;
}
.imovel-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.imovel-chip-remover {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  line-height: 1;
  color: #166534;
  background: #dcfce7;
}
.imovel-chip-remover:hover {
  background: #bbf7d0;
  color: #14532d;
}
.combo-item-ja-selecionado {
  opacity: 0.55;
  pointer-events: none;
}

.label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #4b5563;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Badges de status */
.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-green  { background: #dcfce7; color: #166534; }
.badge-gray   { background: #f3f4f6; color: #4b5563; }
.badge-teal   { background: #d1fae5; color: #065f46; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-orange { background: #ffedd5; color: #9a3412; }

.alerta-duplicidade {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
}
.link-duplicidade {
  display: block;
  width: 100%;
  text-align: left;
  font-size: 0.8125rem;
  color: #92400e;
  padding: 0.25rem 0;
}
.link-duplicidade:hover {
  color: #78350f;
  text-decoration: underline;
}
tr.row-duplicidade {
  background: #fffbeb;
}
tr.row-duplicidade:hover {
  background: #fef3c7;
}
.badge-duplicidade-lista {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #92400e;
  background: #ffedd5;
  border: 1px solid #fdba74;
  border-radius: 0.375rem;
  padding: 0.125rem 0.5rem;
  white-space: nowrap;
}

/* Botão de matchmaking */
.btn-match {
  color: #2E7D32;
  font-weight: 600;
}
.btn-match:hover {
  color: #1B5E20;
  text-decoration: underline;
}

/* Radar — seções por finalidade */
.radar-filtro-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: 9999px;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 0.8rem;
  font-weight: 500;
  color: #374151;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.radar-filtro-pill:hover {
  border-color: #43A047;
  color: #1B5E20;
}
.radar-filtro-pill.ativo {
  background: #2E7D32;
  border-color: #2E7D32;
  color: #fff;
}
.radar-filtro-n {
  display: inline-flex;
  min-width: 1.25rem;
  justify-content: center;
  padding: 0 0.3rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  background: rgba(0, 0, 0, 0.08);
}
.radar-filtro-pill.ativo .radar-filtro-n {
  background: rgba(255, 255, 255, 0.25);
}
.radar-secao {
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}
.radar-secao-cabecalho {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #e5e7eb;
}
.radar-secao-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  margin-left: 0.4rem;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.08);
  vertical-align: middle;
}
.radar-sec-venda .radar-secao-cabecalho {
  background: #FFF7ED;
  border-left: 4px solid #EA580C;
}
.radar-sec-avaliacao .radar-secao-cabecalho {
  background: #F5F3FF;
  border-left: 4px solid #7C3AED;
}
.radar-sec-compra .radar-secao-cabecalho {
  background: #ECFDF5;
  border-left: 4px solid #059669;
}
.radar-sec-locacao .radar-secao-cabecalho {
  background: #EFF6FF;
  border-left: 4px solid #2563EB;
}
.radar-sec-permuta .radar-secao-cabecalho,
.radar-sec-outro .radar-secao-cabecalho {
  background: #F8FAFC;
  border-left: 4px solid #64748B;
}

/* Log de atualizações do atendimento */
.atend-log-box {
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
  background: #fafafa;
}
.atend-log-lista {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.atend-log-item {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-left: 3px solid #2E7D32;
  border-radius: 0.5rem;
  padding: 0.65rem 0.75rem;
}
.atend-log-item.evento-conclusao {
  border-left-color: #0F766E;
  background: #F0FDFA;
}
.atend-log-item.evento-reaberto {
  border-left-color: #B45309;
  background: #FFFBEB;
}
.atend-log-evento {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 0.25rem;
  background: #CCFBF1;
  color: #0F766E;
  margin-bottom: 0.35rem;
}
.atend-log-evento.reaberto {
  background: #FEF3C7;
  color: #92400E;
}
.atend-conclusao-banner {
  font-size: 0.8rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.5rem;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  color: #065F46;
}

/* Menu de configurações (engrenagem) */
.config-dropdown {
  animation: fadeIn 0.15s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Barra de navegação */
.nav-bar-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 4rem;
  padding: 0.35rem 0;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.nav-links::-webkit-scrollbar {
  height: 4px;
}

.nav-links::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.35);
  border-radius: 4px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  margin-left: auto;
  padding-left: 0.5rem;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 11rem;
}

.nav-user-text {
  text-align: right;
  min-width: 0;
  overflow: hidden;
}

.nav-user-text p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .nav-user-text {
    display: none;
  }

  .nav-user {
    max-width: none;
  }
}

/* Tela de login */
.login-tagline {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #2E7D32;
}

.login-features {
  font-size: 0.75rem;
  color: #6b7280;
  letter-spacing: 0.02em;
  margin-top: 0.35rem;
}

/* Coluna de observações nos relatórios */
.cell-observacoes {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.8125rem;
  color: #374151;
}

/* Tabela de movimentações — dá mais espaço às observações */
.tabela-gerencial-mov {
  table-layout: fixed;
  width: 100%;
}
.tabela-gerencial-mov th,
.tabela-gerencial-mov td {
  vertical-align: top;
  word-break: break-word;
}
.tabela-gerencial-mov th:nth-child(1),
.tabela-gerencial-mov td:nth-child(1) { width: 8%; }
.tabela-gerencial-mov th:nth-child(2),
.tabela-gerencial-mov td:nth-child(2) { width: 6%; }
.tabela-gerencial-mov th:nth-child(3),
.tabela-gerencial-mov td:nth-child(3) { width: 8%; }
.tabela-gerencial-mov th:nth-child(4),
.tabela-gerencial-mov td:nth-child(4) { width: 8%; }
.tabela-gerencial-mov th:nth-child(5),
.tabela-gerencial-mov td:nth-child(5) {
  width: 7%;
  word-break: keep-all;
  overflow-wrap: normal;
  white-space: nowrap;
}
.tabela-gerencial-mov th:nth-child(6),
.tabela-gerencial-mov td:nth-child(6) { width: 6%; }
.tabela-gerencial-mov th:nth-child(7),
.tabela-gerencial-mov td:nth-child(7) { width: 7%; }
.tabela-gerencial-mov th:nth-child(8),
.tabela-gerencial-mov td:nth-child(8) { width: 7%; }
.tabela-gerencial-mov th:nth-child(9),
.tabela-gerencial-mov td:nth-child(9) { width: 7%; }
.tabela-gerencial-mov th:nth-child(10),
.tabela-gerencial-mov td:nth-child(10) { width: 36%; }
.tabela-gerencial-mov td.cell-codigo-imovel {
  word-break: keep-all !important;
  overflow-wrap: normal !important;
  white-space: nowrap !important;
}
.tabela-gerencial-mov td.whitespace-nowrap {
  white-space: normal;
}

/* Cards com leve animação */
.card {
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

/* Scrollbar customizada */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 3px; }

/* Cabeçalho com logo nos relatórios */
.relatorio-logo {
  height: 4.5rem;
  width: auto;
  object-fit: contain;
}

.relatorio-cabecalho {
  page-break-inside: avoid;
}

.contato-oculto {
  display: none;
}

.rel-prop-telefones-ocultos .contato-visivel {
  display: none;
}

.rel-prop-telefones-ocultos .contato-oculto {
  display: inline;
}

.rel-prop-nota-ocultos {
  display: none;
}

.rel-prop-telefones-ocultos .rel-prop-nota-ocultos {
  display: block;
}

/* ------------------------------------------------------------------ */
/* Estilos de IMPRESSÃO — Relatórios                                  */
/* ------------------------------------------------------------------ */
@page {
  margin: 10mm;
}

@page gerencial-landscape {
  size: A4 landscape;
  margin: 8mm;
}

@media print {
  /* Oculta navegação, botões e elementos interativos */
  .no-print,
  nav,
  #toast {
    display: none !important;
  }

  /* Exibe apenas a área de impressão */
  body {
    background: white !important;
    margin: 0;
    padding: 0;
  }

  body.print-gerencial {
    page: gerencial-landscape;
  }

  main {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Esconde abas inativas; exibe só a aba aberta no momento */
  .tab-content {
    display: none !important;
  }

  .tab-content:not(.hidden) {
    display: block !important;
  }

  /* Relatório gerencial — tabela larga cabe em paisagem */
  body.print-gerencial .overflow-x-auto,
  body.print-gerencial .tabela-gerencial-wrap {
    overflow: visible !important;
  }

  body.print-gerencial .relatorio-gerencial .grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 12px !important;
  }

  body.print-gerencial .relatorio-gerencial .grid > div {
    box-shadow: none !important;
    border: 1px solid #d1d5db !important;
    padding: 8px 12px !important;
    border-radius: 0 !important;
  }

  body.print-gerencial .relatorio-gerencial .grid p.text-3xl {
    font-size: 18pt !important;
  }

  body.print-gerencial .tabela-gerencial-mov {
    table-layout: fixed !important;
    width: 100% !important;
    font-size: 7pt !important;
    border-collapse: collapse !important;
  }

  body.print-gerencial .tabela-gerencial-mov th,
  body.print-gerencial .tabela-gerencial-mov td {
    padding: 2px 4px !important;
    vertical-align: top !important;
    word-break: break-word !important;
    overflow: visible !important;
    white-space: normal !important;
    border: 1px solid #d1d5db !important;
  }

  body.print-gerencial .tabela-gerencial-mov th:nth-child(1),
  body.print-gerencial .tabela-gerencial-mov td:nth-child(1) { width: 7% !important; }
  body.print-gerencial .tabela-gerencial-mov th:nth-child(2),
  body.print-gerencial .tabela-gerencial-mov td:nth-child(2) { width: 5% !important; }
  body.print-gerencial .tabela-gerencial-mov th:nth-child(3),
  body.print-gerencial .tabela-gerencial-mov td:nth-child(3) { width: 7% !important; }
  body.print-gerencial .tabela-gerencial-mov th:nth-child(4),
  body.print-gerencial .tabela-gerencial-mov td:nth-child(4) { width: 7% !important; }
  body.print-gerencial .tabela-gerencial-mov th:nth-child(5),
  body.print-gerencial .tabela-gerencial-mov td:nth-child(5) {
    width: 7% !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
    white-space: nowrap !important;
  }
  body.print-gerencial .tabela-gerencial-mov th:nth-child(6),
  body.print-gerencial .tabela-gerencial-mov td:nth-child(6) { width: 5% !important; }
  body.print-gerencial .tabela-gerencial-mov th:nth-child(7),
  body.print-gerencial .tabela-gerencial-mov td:nth-child(7) { width: 7% !important; }
  body.print-gerencial .tabela-gerencial-mov th:nth-child(8),
  body.print-gerencial .tabela-gerencial-mov td:nth-child(8) { width: 6% !important; }
  body.print-gerencial .tabela-gerencial-mov th:nth-child(9),
  body.print-gerencial .tabela-gerencial-mov td:nth-child(9) { width: 6% !important; }
  body.print-gerencial .tabela-gerencial-mov th:nth-child(10),
  body.print-gerencial .tabela-gerencial-mov td:nth-child(10) {
    width: 43% !important;
    max-width: none !important;
  }

  body.print-gerencial .cell-observacoes {
    max-width: none !important;
    font-size: 7pt !important;
    white-space: pre-wrap !important;
  }

  body.print-gerencial .cell-codigo-imovel {
    white-space: nowrap !important;
    word-break: keep-all !important;
  }

  body.print-gerencial .tabela-gerencial-mov td.whitespace-nowrap {
    white-space: normal !important;
  }

  .relatorio-logo {
    height: 56px;
  }

  .relatorio-cabecalho p {
    font-size: 9pt;
  }

  .relatorio-print {
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
  }

  .relatorio-print table {
    page-break-inside: auto;
  }

  .relatorio-print tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  .relatorio-print thead {
    display: table-header-group;
  }

  .relatorio-print th,
  .relatorio-print td {
    font-size: 10pt;
    padding: 4px 8px;
  }

  .relatorio-print h2 {
    font-size: 16pt;
  }

  .relatorio-print h3 {
    font-size: 12pt;
  }

  .relatorio-print .badge {
    border: 1px solid #ccc;
    color: #000 !important;
    background: #f3f4f6 !important;
  }

  /* Força cores de fundo na impressão (cards do radar) */
  body.print-gerencial .tabela-gerencial-mov tbody tr {
    background: white !important;
  }
}
