/* =============================================================================
   SELECTING MOTORS — admin.css
   Painel de cadastro. Paleta e fonte iguais ao site (style.css), mas em
   arquivo próprio: o admin não depende do CSS do site marketing, então uma
   mudança visual lá nunca quebra o painel aqui — e vice-versa.
   ============================================================================ */

:root {
  --paper:  #ffffff;
  --sand:   #f4f3f0;
  --sand-2: #eceae5;
  --line:   #e0ddd7;
  --ink:    #111111;
  --text:   #111111;
  --muted:  #57534d;
  /* #8b867d (o tom do site) dava 3,6:1 sobre branco — reprovava no AA nos dois
     lugares onde vira texto: .card__marca e os h3 do formulário, ambos em
     caixa alta e ~12px. Escurecido para 4,6:1. */
  --faint:  #7a7568;
  --accent:    #8a6f43;
  --accent-lt: #b79a68;
  --danger: #a3382f;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r:    14px;
  --r-sm: 10px;
  --pill: 999px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--sand);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: .95rem; }
.shell { max-width: 1120px; margin-inline: auto; padding-inline: clamp(16px, 4vw, 40px); }


/* ------------------------------------------------------------------ botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--pill);
  padding: 12px 20px; font-size: .92rem; font-weight: 600; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease, opacity .15s ease;
}
.btn--sm { padding: 9px 16px; font-size: .85rem; }
.btn--gold { background: var(--ink); color: #fff; }
.btn--gold:hover { background: #000; }
.btn--line { background: transparent; border-color: var(--line); color: var(--text); }
.btn--line:hover { border-color: var(--faint); }
.btn--danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn--danger:hover { background: var(--danger); color: #fff; }
.btn:disabled { opacity: .5; pointer-events: none; }
.ulink { color: var(--muted); text-decoration: none; font-size: .88rem; font-weight: 600; }
.ulink:hover { color: var(--ink); }


/* -------------------------------------------------------------------- login */
.login {
  min-height: 100svh; display: grid; place-items: center; padding: 24px;
  background: var(--ink);
}
.login__card {
  width: min(400px, 100%); background: var(--paper); border-radius: 20px;
  padding: clamp(28px, 5vw, 40px); display: flex; flex-direction: column; gap: 6px;
  box-shadow: 0 30px 80px rgba(0,0,0,.35);
}
.login__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; color: var(--muted); }
.login__mark { display: block; height: 28px; width: auto; }
.topbar__brand .login__mark { height: 24px; }
.login__h { font-size: 1.4rem; margin-bottom: 6px; }
.login__p { color: var(--muted); font-size: .9rem; margin-bottom: 20px; }
.login__erro {
  margin-top: 12px; color: var(--danger); font-size: .86rem; font-weight: 600;
}
.fld { display: flex; flex-direction: column; gap: 6px; font-size: .82rem; font-weight: 600; color: var(--muted); flex: 1; min-width: 0; }
.fld input, .fld select, .fld textarea {
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px 13px;
  background: var(--paper); color: var(--text); font-weight: 500;
}
.fld input:focus, .fld select:focus, .fld textarea:focus { outline: 2px solid var(--accent-lt); outline-offset: 1px; }
.fld--sm { max-width: 140px; flex: 0 0 auto; }
.fld--check {
  flex-direction: row; align-items: center; gap: 8px; font-weight: 700; color: var(--text);
}
.fld--check input { width: 17px; height: 17px; accent-color: var(--ink); flex: none; }
.login__card .btn { margin-top: 10px; }


/* --------------------------------------------------------------------- app */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 40px);
}
.topbar__brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.topbar__acts { display: flex; align-items: center; gap: 18px; }

.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-block: 28px 18px;
}
.toolbar__count { color: var(--muted); font-size: .9rem; font-weight: 600; }
.toolbar__acts { display: flex; gap: 10px; }
.busca {
  border: 1px solid var(--line); border-radius: var(--pill); padding: 10px 16px;
  min-width: 220px; background: var(--paper);
}
.busca:focus { outline: 2px solid var(--accent-lt); }

.aviso {
  background: #fbeceb; border: 1px solid #f0c9c6; color: var(--danger);
  padding: 12px 16px; border-radius: var(--r-sm); font-size: .88rem; font-weight: 600; margin-bottom: 16px;
}
.aviso--ok { background: #eef6ee; border-color: #cfe3cf; color: #2f6b36; }
.vazio { color: var(--muted); padding: 60px 0; text-align: center; }

.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px; padding-bottom: 60px;
}
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .15s ease;
}
.card:hover { box-shadow: 0 12px 30px rgba(17,17,17,.08); }
.card__ph {
  aspect-ratio: 4/3; background: var(--sand-2); position: relative;
}
.card__ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Status é informação interna do painel — vai pra direita e cede o canto
   superior esquerdo, que é onde a etiqueta aparece de verdade no site. */
.card__status {
  position: absolute; top: 10px; right: 10px; padding: 4px 10px; border-radius: var(--pill);
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  background: rgba(17,17,17,.78); color: #fff;
}
/* Pré-visualização da etiqueta: mesma posição e mesmo desenho do .chip do site
   (09-colecao.css), pra o que se vê aqui ser o que o cliente vai ver. */
.card__etq {
  position: absolute; top: 10px; left: 10px; z-index: 3;
  padding: 5px 11px; border-radius: var(--pill);
  font-size: .66rem; font-weight: 600; letter-spacing: .06em;
  color: var(--muted); background: rgba(255,255,255,.9); backdrop-filter: blur(6px);
}
.card__status--reservado { background: #8a6f43; }
.card__status--vendido { background: #57534d; }
.card__bd { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card__marca { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
.card__modelo { font-weight: 700; font-size: 1rem; }
.card__meta { font-size: .82rem; color: var(--muted); }
.card__preco { font-weight: 700; margin-top: 6px; }
.card__acts { display: flex; gap: 8px; margin-top: 12px; align-items: stretch; }
.card__acts .btn { flex: 1; }
/* lixeira: exclui direto do card, sem abrir o painel (ver painel.js) */
.card__del {
  flex: none; width: 38px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--pill);
  background: transparent; color: var(--faint);
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.card__del:hover { background: #fbeceb; border-color: #f0c9c6; color: var(--danger); }


/* ---------------------------------------------------------------- painel */
.veil {
  position: fixed; inset: 0; background: rgba(17,17,17,.45); z-index: 40;
  opacity: 0; transition: opacity .2s ease;
}
.veil.on { opacity: 1; }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41;
  width: min(560px, 100vw); background: var(--paper);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .25s var(--ease, ease);
  box-shadow: -20px 0 60px rgba(0,0,0,.2);
}
.panel.on { transform: translateX(0); }
.panel form { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.panel__hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--line); flex: none;
}
.panel__x { border: none; background: var(--sand); width: 34px; height: 34px; border-radius: 50%; font-size: 1rem; }
.panel__bd { padding: 20px 24px 40px; overflow-x: hidden; overflow-y: auto; flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 26px; }
.panel__ft {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 16px 24px;
  border-top: 1px solid var(--line); flex: none; flex-wrap: wrap;
}

.grupo { display: flex; flex-direction: column; gap: 12px; }
.grupo h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row--col { flex-direction: column; gap: 6px; }
.row--col .dica { margin-top: 0; }
.dica { font-size: .82rem; color: var(--muted); margin-top: -4px; }

/* Pergunta "qual destaque sai?" — some sozinha quando resolvida. Fica no
   fluxo do formulário de propósito: um alert() era engolido por quem tinha
   desligado os diálogos do navegador, e a caixa voltava sem explicação. */
/* display de autor vence o [hidden] do navegador — sem esta linha a caixa
   fica no ar vazia, só a borda, mesmo com hidden no elemento. */
.troca[hidden] { display: none; }
.troca {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-top: 10px; padding: 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--sand, #f7f6f4);
}
.troca__t { flex: 1 0 100%; margin: 0; font-size: .84rem; color: var(--text); }
/* O .btn é nowrap, e nome de carro aqui é longo ("Land Rover Range Rover
   Evoque Prestige Diesel"): num painel de 375px um botão desses estourava a
   largura. Dentro da caixa eles quebram linha e nunca passam do painel. */
.troca .btn { max-width: 100%; white-space: normal; text-align: left; }
.troca__x { margin-left: auto; color: var(--muted); }

.fotos { display: flex; flex-wrap: wrap; gap: 10px; }
.foto {
  position: relative; width: 88px; height: 88px; border-radius: var(--r-sm); overflow: hidden;
  border: 1px solid var(--line); background: var(--sand-2);
  cursor: grab; touch-action: none; /* touch-action:none = o navegador não rouba o gesto pra rolar a página */
}
.foto img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
/* o item original vira só o "buraco" de onde a foto saiu — quem se move de
   verdade atrás do ponteiro é o .foto--ghost (ver painel.js) */
.foto.is-dragging { opacity: .28; }
.foto--ghost {
  position: fixed; z-index: 60; pointer-events: none; cursor: grabbing;
  transform: scale(1.06); box-shadow: 0 14px 30px rgba(17,17,17,.35);
}
.foto__capa {
  position: absolute; bottom: 3px; left: 3px; background: rgba(17,17,17,.78); color: #fff;
  font-size: .6rem; font-weight: 700; text-transform: uppercase; padding: 2px 6px; border-radius: 5px;
}
.foto__del {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: rgba(17,17,17,.78); color: #fff; border: none; font-size: .68rem; line-height: 1;
}
.upload {
  display: grid; place-items: center; border: 1.5px dashed var(--line); border-radius: var(--r-sm);
  padding: 20px; color: var(--muted); font-size: .88rem; font-weight: 600; cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.upload:hover, .upload.is-over { border-color: var(--accent-lt); background: var(--sand); }
.aviso--upload { margin-top: -4px; }

.lista { display: flex; flex-direction: column; gap: 8px; }
.lista__item { display: flex; gap: 8px; align-items: flex-start; }
.lista__item input,
.lista__item textarea {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 9px 12px; font-size: .95rem;
}
/* textarea que cresce com o texto (ver crescer() em painel.js): sem barra de
   rolagem, sem alça de resize, altura controlada pelo JS */
.lista__item textarea {
  font-family: inherit; line-height: 1.45; resize: none; overflow: hidden;
  min-height: 38px;
}
.lista__item .del {
  border: none; background: var(--sand); width: 30px; height: 30px; border-radius: 50%; flex: none;
  color: var(--muted); font-size: .8rem; margin-top: 4px;
}
.lista__item .del:hover { background: #fbeceb; color: var(--danger); }
.lista--docs .lista__item input:first-child { flex: 0 0 34%; }

/* painel estreito: o par rótulo/valor da documentação empilha — o rótulo
   ocupa a linha toda e o valor + lixeira descem para a linha de baixo */
@media (max-width: 560px) {
  .lista--docs .lista__item { flex-wrap: wrap; }
  .lista--docs .lista__item input:first-child { flex: 1 0 100%; }
}


/* -------------------------------------------------------------- responsivo */
@media (max-width: 640px) {
  .panel { width: 100vw; }
  .row { flex-direction: column; }
  .fld--sm { max-width: none; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar__acts { flex-direction: column; }
  .busca { width: 100%; }
}
