/* ============================================================
   OPERACOES.CSS — CSS específico da página de operações
   ------------------------------------------------------------
   Para mudar variáveis globais (cores, fontes, sidebar),
   edite estilo.css.
   ============================================================ */


/* ============================================
   TOPBAR — Título + botão nova operação
   ============================================ */

.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2rem; padding-bottom: 1.25rem; border-bottom: 0.5px solid var(--border2); }
.topbar h1 { font-size: 20px; font-weight: 600; }

.new-btn { font-size: 13px; font-family: var(--sans); padding: 7px 16px; background: var(--accent-dim); border: 0.5px solid var(--accent-border); border-radius: var(--radius-sm); color: var(--accent); cursor: pointer; font-weight: 500; transition: all .15s; text-decoration: none; }
.new-btn:hover { background: rgba(74,222,128,0.18); }


/* ============================================
   FILTROS
   ============================================ */

.filters { display: flex; gap: 6px; margin-bottom: 1.5rem; }
.filter-btn { font-size: 12px; font-family: var(--mono); padding: 5px 14px; border: 0.5px solid var(--border2); border-radius: 4px; background: transparent; color: var(--text3); cursor: pointer; transition: all 0.12s; }
.filter-btn.on { background: var(--bg3); color: var(--text); }


/* ============================================
   CARDS DE OPERAÇÃO
   Verde = aberta  |  Vermelho = finalizada
   ============================================ */

.cards { display: flex; flex-direction: column; gap: 10px; }
.empty { text-align: center; padding: 4rem 1rem; color: var(--text3); font-size: 14px; line-height: 2; }

.card { background: var(--bg2); border-radius: var(--radius); padding: 1.25rem; border: 0.5px solid var(--border); transition: border-color .15s; cursor: pointer; }
.card:hover      { border-color: var(--border2); }
.card.aberta     { border-left: 3px solid var(--accent); }
.card.finalizada { border-left: 3px solid var(--red); }

.card-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 0.75rem; }
.card-ativo { font-size: 18px; font-weight: 600; color: var(--text); font-family: var(--mono); }
.card-tipo  { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* Selo de tipo de registro — aparece só em retroativo / fora_criterio */
.card-marcador {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
}
.card-marcador i { font-size: 12px; }

.marcador-retroativo {
  background: var(--blue-dim);
  border: 0.5px solid var(--blue-border);
  color: var(--blue);
}
.marcador-fora {
  background: var(--red-dim);
  border: 0.5px solid var(--red-border);
  color: var(--red);
}

/* Lado direito do topo do card: lixeira + badge de status */
.card-top-right { display: flex; align-items: center; gap: 8px; }

/* Botão de excluir (lixeira) */
.btn-lixeira {
  background: transparent;
  border: 0.5px solid var(--border2);
  border-radius: 4px;
  color: var(--text3);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.12s;
  flex-shrink: 0;
}
.btn-lixeira:hover { background: var(--red-dim); border-color: var(--red-border); color: var(--red); }
.btn-lixeira i { font-size: 15px; }

.card-badge { font-size: 11px; font-weight: 500; font-family: var(--mono); padding: 3px 9px; border-radius: 4px; }
.badge-aberta    { background: var(--accent-dim); border: 0.5px solid var(--accent-border); color: var(--accent); }
.badge-finalizada{ background: var(--red-dim);    border: 0.5px solid var(--red-border);    color: var(--red); }
.badge-cancelada { background: var(--bg4);        border: 0.5px solid var(--border2);       color: var(--text3); }

.card-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px 12px; margin-bottom: 0.75rem; }
.card-field label { font-size: 11px; color: var(--text3); display: block; margin-bottom: 2px; }
.card-field span  { font-size: 13px; color: var(--text); font-family: var(--mono); }

.card-resultado { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius-sm); margin-bottom: 0.75rem; font-size: 13px; }
.res-ganho    { background: var(--accent-dim); border: 0.5px solid var(--accent-border); color: var(--accent); }
.res-perda    { background: var(--red-dim);    border: 0.5px solid var(--red-border);    color: var(--red); }
.res-cancelada{ background: var(--bg4);        border: 0.5px solid var(--border2);       color: var(--text3); }

.card-footer { display: flex; align-items: center; justify-content: space-between; }
.card-date   { font-size: 11px; color: var(--text3); font-family: var(--mono); }

.close-btn { font-size: 12px; font-family: var(--mono); padding: 5px 14px; background: transparent; border: 0.5px solid var(--accent-border); border-radius: 4px; color: var(--accent); cursor: pointer; transition: all 0.12s; }
.close-btn:hover { background: var(--accent-dim); }


/* ============================================
   MODAL DE ENCERRAMENTO — só campos específicos
   --------------------------------------------
   O padrão base de modal (.overlay, .modal, h2, .modal-aviso*,
   .modal-actions, .btn-cancel, .btn-perigo) vive em estilo.css.
   Aqui ficam só os campos editáveis e o botão de confirmar.
   ============================================ */

.field { margin-bottom: 1rem; }
.field label { font-size: 12px; color: var(--text2); display: block; margin-bottom: 5px; }
.field input, .field textarea { width: 100%; background: var(--bg3); border: 0.5px solid var(--border2); border-radius: var(--radius-sm); padding: 7px 11px; color: var(--text); font-family: var(--sans); font-size: 14px; }
.field input:focus, .field textarea:focus { outline: none; border-color: rgba(74,222,128,0.4); }
.field textarea { resize: vertical; min-height: 70px; }

.seg-group { display: flex; gap: 5px; flex-wrap: wrap; }
.seg-btn { font-size: 13px; font-family: var(--sans); padding: 6px 14px; border: 0.5px solid var(--border2); border-radius: var(--radius-sm); background: transparent; color: var(--text2); cursor: pointer; transition: all 0.12s; }
.seg-btn:hover { background: var(--bg3); color: var(--text); }
.seg-btn.active-ganho    { background: var(--accent-dim); border-color: var(--accent-border); color: var(--accent); font-weight: 500; }
.seg-btn.active-perda    { background: var(--red-dim);    border-color: var(--red-border);    color: var(--red);    font-weight: 500; }
.seg-btn.active-cancelada{ background: var(--bg4);        border-color: var(--border2);       color: var(--text2);  font-weight: 500; }

/* Botão verde de confirmação (ação primária) */
.btn-confirm { flex: 1; padding: 10px; background: var(--accent-dim); border: 0.5px solid var(--accent-border); border-radius: var(--radius-sm); color: var(--accent); font-family: var(--mono); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.btn-confirm:hover { background: rgba(74,222,128,0.18); }


/* ============================================
   MODAL DE DETALHES DA OPERAÇÃO  (Etapa 1: só leitura)
   ============================================ */

/* Largura e scroll vêm da variante estruturada (.modal-largo
   + .modal:has(>.modal-header) em estilo.css). Aqui só zeramos o
   gap padrão do .modal-corpo — as .detalhe-secao filhas já trazem
   margin-bottom própria. */
.modal-detalhes .modal-corpo { gap: 0; }

.detalhe-secao { margin-bottom: 1.25rem; }
.detalhe-secao:last-of-type { margin-bottom: 0; }

.detalhe-secao-titulo {
  font-size: 11px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text3);
  margin-bottom: 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 0.5px solid var(--border);
}

.detalhe-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 14px;
}

.detalhe-item label {
  font-size: 11px;
  color: var(--text3);
  display: block;
  margin-bottom: 2px;
}
.detalhe-item span {
  font-size: 13px;
  color: var(--text);
  font-family: var(--mono);
}

/* Itens largos (comentários, emoções) ocupam a linha inteira */
.detalhe-item.largo { margin-top: 10px; }
.detalhe-item.largo span {
  font-family: var(--sans);
  line-height: 1.5;
  white-space: pre-wrap;
}

/* Campos editáveis do modal (Etapa 2) — inputs, selects e textareas */
.det-input {
  width: 100%;
  background: var(--bg3);
  border: 0.5px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
}
.det-input:focus { outline: none; border-color: rgba(74,222,128,0.4); }
select.det-input   { font-family: var(--sans); cursor: pointer; }
textarea.det-input { font-family: var(--sans); resize: vertical; min-height: 64px; }


/* Imagens do encerramento: .dropzone, .imagens-grid e
   .imagem-thumb vivem em estilo.css (componentes
   compartilhados). O modal usa os modificadores
   .dropzone-compacto e .imagens-grid-compacto. */


/* ============================================
   IMAGENS DENTRO DO MODAL DE DETALHES
   --------------------------------------------
   Mini-grid de miniaturas dentro de cada seção
   ("Imagens de entrada" / "Imagens de saída").
   ============================================ */

.detalhe-imagens-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 6px;
  margin-top: 0.5rem;
}

.detalhe-imagem-thumb-wrap {
  position: relative;
}

.detalhe-imagem-thumb {
  display: block;
  width: 100%;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: zoom-in;
  background: var(--bg3);
  padding: 0;
  aspect-ratio: 4 / 3;
  transition: border-color 0.12s;
}
.detalhe-imagem-thumb:hover { border-color: var(--border2); }
.detalhe-imagem-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Botão X no canto da miniatura (só no modo edição) */
.detalhe-imagem-x {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  transition: background 0.12s;
}
.detalhe-imagem-x:hover { background: var(--red); }


/* ============================================
   LIGHTBOX — Visualização ampliada com navegação
   --------------------------------------------
   z-index acima dos outros overlays (100) pra
   ficar por cima do modal de detalhes.
   ============================================ */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.lightbox.open { display: flex; }

.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  user-select: none;
}

.lightbox-btn {
  position: absolute;
  background: rgba(255,255,255,0.08);
  border: 0.5px solid rgba(255,255,255,0.15);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  transition: background 0.12s;
}
.lightbox-btn:hover { background: rgba(255,255,255,0.18); }

.lightbox-fechar {
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 20px;
}
.lightbox-prev,
.lightbox-next {
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 60px;
  border-radius: var(--radius-sm);
  font-size: 28px;
}
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

.lightbox-info {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  background: rgba(0,0,0,0.6);
  padding: 6px 14px;
  border-radius: 20px;
  border: 0.5px solid var(--border2);
}


/* ============================================
   RESPONSIVO ESPECÍFICO DA PÁGINA DE OPERAÇÕES
   ============================================ */

@media (max-width: 768px) {
  .topbar { flex-direction: column; align-items: flex-start; gap: 12px; }
  .topbar h1 { font-size: 18px; }
  .card { padding: 1rem; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .card-ativo { font-size: 16px; }
}
