/* ==========================================================================
   Painel do corretor

   Reaproveita os tokens de cor do site (estilo.css é carregado antes deste
   arquivo), então trocar a paleta lá reflete aqui também.

   A prioridade do painel é ser usado no celular, no meio da rua, entre uma
   visita e outra: alvos de toque grandes, uma coluna, nada de tabela larga.
   ========================================================================== */

body.admin { background: var(--fundo-alt); }

/* ============================== Login ============================== */

.login-tela {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-caixa {
  width: 100%; max-width: 380px;
  background: var(--fundo);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  padding: 34px;
  box-shadow: var(--sombra);
}
.login-logo { height: 118px; width: auto; display: block; margin: 0 auto 28px; }
.login-caixa h1 { font-size: 1.3rem; margin-bottom: 6px; text-align: center; }
.login-caixa > p { color: var(--texto-suave); font-size: 0.92rem; margin-bottom: 24px; text-align: center; }

/* ============================== Estrutura ============================== */

.admin-topo {
  background: var(--marca-escura);
  color: var(--texto-inverso);
  padding: 0;
  position: sticky; top: 0; z-index: 50;
}
.admin-topo-interno { display: flex; align-items: center; gap: 16px; min-height: 62px; }
.admin-topo .marca-logo img { height: 46px; }
/* Separador vertical entre a logo e o rótulo, pra "Painel" não parecer parte
   do nome do corretor. */
.admin-rotulo {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, 0.22);
}
.admin-topo-acoes { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.btn-topo {
  background: rgba(255, 255, 255, 0.12);
  color: #fff; border: none;
  border-radius: 999px; padding: 9px 16px;
  font-size: 0.86rem; font-weight: 700;
  display: inline-flex; align-items: center; gap: 7px;
  transition: background 0.15s;
}
.btn-topo:hover { background: rgba(255, 255, 255, 0.24); }

.btn-menu { padding: 0; width: 44px; height: 44px; justify-content: center; }

/* O recuo lateral tem que ser repetido: este padding sobrescreve o do
   .container, e com "0" nas laterais o conteúdo colava na borda do celular. */
.admin-corpo { padding: 28px var(--gutter) 80px; }

.painel-cabeca {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 22px;
}
.painel-cabeca h2 { font-size: 1.35rem; }
.painel-cabeca p { color: var(--texto-suave); font-size: 0.92rem; margin-top: 4px; }

.cartao {
  background: var(--fundo);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  padding: 22px;
  margin-bottom: 18px;
}
.cartao > h3 { font-size: 1.05rem; margin-bottom: 4px; }
.cartao > h3 + p { color: var(--texto-suave); font-size: 0.88rem; margin-bottom: 18px; }

/* ============================== Formulários ============================== */

.campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.campo { display: flex; flex-direction: column; gap: 7px; }
.campo.largo { grid-column: 1 / -1; }

.campo > label { font-size: 0.83rem; font-weight: 700; color: var(--texto); }
.campo .dica { font-size: 0.78rem; color: var(--texto-suave); font-weight: 500; }

.campo input[type="text"],
.campo input[type="number"],
.campo input[type="password"],
.campo input[type="search"],
.campo input[type="tel"],
.campo input[type="email"],
.campo select,
.campo textarea {
  /* 16px: abaixo disso o iPhone dá zoom sozinho ao tocar no campo. */
  font-family: inherit; font-size: 1rem;
  padding: 11px 13px;
  border: 1px solid var(--borda); border-radius: var(--raio-pequeno);
  background: var(--fundo); color: var(--texto);
  outline: none; width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.campo textarea { resize: vertical; min-height: 110px; line-height: 1.55; }
.campo input:focus, .campo select:focus, .campo textarea:focus {
  border-color: var(--marca);
  box-shadow: 0 0 0 3px var(--marca-clara);
}
.campo input:disabled { background: var(--fundo-alt); color: var(--texto-suave); }

/* Link do catálogo: endereço em texto de verdade, pra selecionar e copiar à
   mão, com o botão de copiar ao lado. No celular o botão vai pra linha de
   baixo em vez de espremer o endereço. */
.linha-copia { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.linha-copia input {
  flex: 1 1 260px; min-width: 0;
  /* 16px: abaixo disso o iPhone dá zoom sozinho ao tocar no campo. */
  font-family: inherit; font-size: 1rem;
  padding: 11px 13px;
  border: 1px solid var(--borda); border-radius: var(--raio-pequeno);
  background: var(--fundo-alt); color: var(--texto);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.linha-copia input:focus { border-color: var(--marca); box-shadow: 0 0 0 3px var(--marca-clara); }
.linha-copia .btn { flex: none; white-space: nowrap; }
.linha-copia .btn-copiado {
  background: var(--verde-wpp); border-color: var(--verde-wpp); color: var(--texto-inverso);
}

/* Checkbox com área de toque grande o suficiente pro dedo. */
.marcador {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--borda); border-radius: var(--raio-pequeno);
  background: var(--fundo); cursor: pointer;
  font-size: 0.92rem; font-weight: 600;
  transition: border-color 0.15s, background 0.15s;
}
.marcador:hover { border-color: var(--marca); }
.marcador input { width: 18px; height: 18px; accent-color: var(--marca); cursor: pointer; flex: none; }
.marcador.ativo { border-color: var(--marca); background: var(--marca-clara); }

.checklist { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 9px; }

.form-acoes {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-top: 22px; padding-top: 20px;
  border-top: 1px solid var(--borda);
}

.btn-perigo { background: transparent; color: var(--vermelho); border-color: #f0d2ce; }
.btn-perigo:hover { background: #fdf2f0; border-color: var(--vermelho); }

.btn-pequeno { padding: 8px 14px; font-size: 0.84rem; }

/* ============================== Fotos ============================== */

.zona-fotos {
  border: 2px dashed var(--borda);
  border-radius: var(--raio);
  padding: 26px;
  text-align: center;
  color: var(--texto-suave);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.zona-fotos:hover, .zona-fotos.arrastando { border-color: var(--marca); background: var(--marca-clara); }
.zona-fotos .icone { color: var(--marca); opacity: 0.6; margin-bottom: 8px; }
.zona-fotos strong { display: block; color: var(--texto); font-size: 0.95rem; margin-bottom: 4px; }
.zona-fotos small { font-size: 0.8rem; }

.fotos-grade {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 11px; margin-top: 15px;
}
.foto-item {
  position: relative; aspect-ratio: 1;
  border-radius: var(--raio-pequeno); overflow: hidden;
  border: 1px solid var(--borda); background: var(--fundo-alt);
}
.foto-item img { width: 100%; height: 100%; object-fit: cover; }

/* A primeira foto é a capa do card no site — vale deixar isso explícito. */
.foto-item.capa { border-color: var(--destaque); border-width: 2px; }
.foto-capa-selo {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--destaque); color: #fff;
  font-size: 0.67rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em;
  text-align: center; padding: 3px;
}

.foto-acoes { position: absolute; top: 5px; right: 5px; display: flex; gap: 4px; }
.foto-botao {
  width: 26px; height: 26px; padding: 0;
  border: none; border-radius: 6px;
  background: rgba(10, 43, 65, 0.78); color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.foto-botao:hover { background: var(--marca-escura); }
.foto-botao.remover:hover { background: var(--vermelho); }
.foto-botao:disabled { opacity: 0.35; cursor: not-allowed; }

/* Baixar fica embaixo: em cima, ao lado de mover e remover, não cabe no
   celular. Na capa sobe pra não cobrir o selo. */
.foto-baixar { position: absolute; bottom: 5px; right: 5px; }
.foto-item.capa .foto-baixar { bottom: 27px; }
.foto-botao.preparando { opacity: 0.6; cursor: progress; }
.foto-botao.pronto { width: auto; padding: 0 10px; font-size: 0.8rem; font-weight: 700; background: var(--destaque); }
.btn-baixar-todas { margin-top: 11px; }
.btn-baixar-todas.preparando { cursor: progress; }
.btn-baixar-todas.pronto { background: var(--destaque); border-color: var(--destaque); color: #fff; }

.foto-enviando {
  display: flex; flex-direction: column; gap: 2px; align-items: center; justify-content: center;
  height: 100%; font-size: 0.75rem; font-weight: 700; color: var(--texto-suave);
  text-align: center; padding: 8px;
}

/* ============================== Listas ============================== */

.lista-itens { display: flex; flex-direction: column; gap: 10px; }

.item-linha {
  display: flex; align-items: center; gap: 14px;
  background: var(--fundo);
  border: 1px solid var(--borda); border-radius: var(--raio);
  padding: 12px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.item-linha:hover { border-color: var(--marca); box-shadow: var(--sombra); }

.item-foto {
  width: 76px; height: 58px; flex: none;
  border-radius: var(--raio-pequeno); overflow: hidden;
  background: var(--marca-clara);
  display: flex; align-items: center; justify-content: center;
  color: var(--marca);
}
.item-foto img { width: 100%; height: 100%; object-fit: cover; }

.item-info { flex: 1; min-width: 0; }
.item-info strong { display: block; font-size: 0.97rem; margin-bottom: 3px; }
.item-info .meta {
  font-size: 0.83rem; color: var(--texto-suave);
  display: flex; flex-wrap: wrap; gap: 5px 12px; align-items: center;
}
.item-acoes { display: flex; gap: 7px; flex: none; }
/* Imóvel tem quatro ações; quando falta largura, elas quebram de linha em vez
   de espremer o título. */
.item-acoes-imovel { flex-wrap: wrap; justify-content: flex-end; }
.btn-seta { padding-left: 11px; padding-right: 11px; }
.btn-seta[disabled] { opacity: 0.35; cursor: default; }

.etiqueta {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em;
}
.etiqueta-disponivel { background: #e6f6ec; color: #1a7a42; }
.etiqueta-reservado { background: #fdf3e0; color: #97640f; }
.etiqueta-vendido { background: #fdeceb; color: #a53225; }
.etiqueta-destaque { background: var(--destaque-clara); color: #8a6519; }

/* ============================== Avisos ============================== */

.aviso {
  border-radius: var(--raio-pequeno);
  padding: 13px 16px;
  font-size: 0.9rem; font-weight: 600;
  margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
}
.aviso-erro { background: #fdf2f0; border: 1px solid #f3d3cd; color: #8c2c1e; }
.aviso-ok { background: #e9f8ee; border: 1px solid #c4e8d1; color: #1a7a42; }
.aviso-info { background: var(--marca-clara); border: 1px solid #cadfec; color: var(--marca-escura); }

/* Faixa de confirmação que sobe no canto depois de salvar. */
.torrada {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--marca-escura); color: #fff;
  padding: 13px 24px; border-radius: 999px;
  font-size: 0.9rem; font-weight: 700;
  box-shadow: var(--sombra-alta);
  z-index: 200;
  display: flex; align-items: center; gap: 9px;
  animation: subir 0.22s ease-out;
  /* O aviso só informa: o toque atravessa. Sem isso, nos ~3s em que ele fica
     na tela, cobria o "Editar" da última linha da lista e o toque se perdia. */
  pointer-events: none;
}
.torrada.erro { background: var(--vermelho); }
@keyframes subir { from { opacity: 0; transform: translate(-50%, 14px); } }

/* ============================== Modal ============================== */

.modal-fundo {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(8, 20, 29, 0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px; overflow-y: auto; overscroll-behavior: contain;
}
.modal-fundo[hidden] { display: none; }
.modal {
  background: var(--fundo);
  border-radius: var(--raio);
  width: 100%; max-width: 720px;
  margin: auto;
  box-shadow: var(--sombra-alta);
}
.modal-cabeca {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--borda);
  position: sticky; top: 0; background: var(--fundo);
  border-radius: var(--raio) var(--raio) 0 0;
  z-index: 2;
}
.modal-cabeca h3 { font-size: 1.12rem; }
.modal-fechar {
  background: none; border: none; color: var(--texto-suave);
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.modal-fechar:hover { background: var(--fundo-alt); color: var(--texto); }
.modal-corpo { padding: 24px; }

/* ============================== Seletor de ícone ============================== */

.icones-grade {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 7px; max-height: 190px; overflow-y: auto;
  padding: 10px; border: 1px solid var(--borda); border-radius: var(--raio-pequeno);
  background: var(--fundo-alt);
}
.icone-opcao {
  aspect-ratio: 1; border: 1px solid var(--borda); border-radius: 8px;
  background: var(--fundo); color: var(--texto-suave);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.icone-opcao:hover { border-color: var(--marca); color: var(--marca); }
.icone-opcao[aria-pressed="true"] { border-color: var(--marca); background: var(--marca-clara); color: var(--marca); border-width: 2px; }

/* ============================== Janelas (menu ☰) ============================== */

/* Folha que sobe de baixo no celular e fica centralizada no computador. Fica
   abaixo do #modal (150): o formulário aberto de dentro de uma janela aparece
   por cima dela. A rolagem é do .janela-corpo, nunca de um elemento grudado. */
.janela-fundo {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(8, 20, 29, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.janela-fundo[hidden] { display: none; }
.janela {
  background: var(--fundo-alt);
  border-radius: var(--raio);
  width: 100%; max-width: 820px;
  max-height: 88vh; max-height: 88dvh;
  display: flex; flex-direction: column;
  box-shadow: var(--sombra-alta);
  animation: janela-subir 0.2s ease-out;
}
.janela-estreita { max-width: 520px; }
@keyframes janela-subir { from { opacity: 0; transform: translateY(18px); } }
.janela-cabeca {
  flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 20px;
  background: var(--fundo);
  border-bottom: 1px solid var(--borda);
  border-radius: var(--raio) var(--raio) 0 0;
}
.janela-cabeca h2 { font-size: 1.12rem; }
.janela-corpo {
  flex: 1; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 20px;
}
/* O título já está na cabeça da janela: o h2 das antigas abas ficaria repetido. */
.janela-corpo .painel-cabeca h2 { display: none; }
.janela-corpo .painel-cabeca p { margin-top: 0; }

.config-bloco {
  background: var(--fundo);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  padding: 16px;
  margin-bottom: 12px;
}
.config-bloco h3 { display: flex; align-items: center; gap: 9px; font-size: 1rem; }
.config-bloco h3 .icone { color: var(--marca); }
.config-bloco p { color: var(--texto-suave); font-size: 0.88rem; margin: 4px 0 14px; }
.config-sair { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--borda); }
.config-sair .btn { color: var(--texto-suave); border-color: var(--borda); }

/* Ajuda: <details> nativo — abre e fecha ao toque sem JavaScript. */
.ajuda-intro { color: var(--texto-suave); font-size: 0.9rem; margin-bottom: 14px; }
.ajuda-lista { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.ajuda-item {
  background: var(--fundo);
  border: 1px solid var(--borda);
  border-radius: var(--raio-pequeno);
}
.ajuda-item summary {
  list-style: none; cursor: pointer;
  touch-action: manipulation;
  min-height: 48px; padding: 13px 44px 13px 16px;
  font-weight: 700; font-size: 0.95rem;
  position: relative;
}
.ajuda-item summary::-webkit-details-marker { display: none; }
.ajuda-item summary::after {
  content: ""; position: absolute; right: 18px; top: 50%;
  width: 8px; height: 8px; margin-top: -6px;
  border-right: 2px solid var(--texto-suave); border-bottom: 2px solid var(--texto-suave);
  transform: rotate(45deg); transition: transform 0.15s;
}
.ajuda-item[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.ajuda-item[open] summary { color: var(--marca); }
.ajuda-resposta { padding: 0 16px 14px; font-size: 0.92rem; line-height: 1.6; color: var(--texto); }
.ajuda-resposta p + p, .ajuda-resposta ul + p, .ajuda-resposta p + ul { margin-top: 9px; }
.ajuda-resposta ul { padding-left: 20px; }
.ajuda-resposta li + li { margin-top: 5px; }

/* ============================== Responsivo ============================== */

@media (max-width: 720px) {
  .admin-corpo { padding: 18px var(--gutter) 60px; }
  .cartao { padding: 17px; }
  .campos { grid-template-columns: 1fr; }
  .modal-fundo { padding: 0; }
  /* dvh: no iPhone, 100vh conta a altura SEM a barra de endereço, e o fim do
     formulário (com o botão Salvar) ficava escondido atrás dela. */
  .modal { border-radius: 0; min-height: 100vh; min-height: 100dvh; }
  .modal-cabeca { border-radius: 0; }

  .janela-fundo { padding: 0; align-items: flex-end; }
  .janela { max-height: 92vh; max-height: 92dvh; border-radius: var(--raio) var(--raio) 0 0; }
  .janela-corpo { padding: 16px var(--gutter) 28px; }

  .item-linha { flex-wrap: wrap; }
  .item-foto { width: 100%; height: 130px; }
  .item-acoes { width: 100%; }
  .item-acoes .btn { flex: 1; }
  /* Duas linhas: "Ver no site" | "Copiar link" em cima, "Editar" largo e a
     lixeira pequena embaixo — lixeira grande é convite a toque errado. */
  .item-acoes-imovel .btn { flex: 1 1 calc(50% - 4px); }
  .item-acoes-imovel .btn-perigo { flex: 0 0 auto; }

  .form-acoes .btn { flex: 1 1 100%; }
}

/* Dedo, não mouse: alvos de pelo menos 44px. Os botões sobre a foto tinham
   26px — difícil acertar "remover" sem tocar em "mover" do lado. */
@media (pointer: coarse) {
  .btn-pequeno { min-height: 44px; }
  .btn-topo { min-height: 44px; min-width: 44px; justify-content: center; }
  .modal-fechar { width: 44px; height: 44px; }
  .foto-acoes { gap: 6px; }
  .foto-botao { width: 40px; height: 40px; border-radius: 8px; }
  .link-voltar { display: inline-block; padding: 12px 8px; }
}
