/* ═══════════════════════════════════════
   TBS — Catálogo
   Estilos exclusivos da página Catálogo
═══════════════════════════════════════ */

/* ─── LAYOUT ─── */
.catalog-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

/* ─── TABELA ─── */
.catalog-table { width: 100%; border-collapse: collapse; }
.catalog-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.catalog-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
.catalog-table tr:last-child td { border-bottom: none; }
.catalog-table tr:hover td      { background: rgba(255,255,255,0.02); cursor: pointer; }

.catalog-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.catalog-cell { display: flex; align-items: center; gap: 12px; }
.catalog-name { font-weight: 600; color: var(--white); }
.catalog-unit { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* ─── FILTROS DE TIPO ─── */
.filtro-cat {
  background: var(--surface2); border: 1px solid var(--border); color: var(--text3);
  border-radius: 7px; padding: 3px 8px; font-size: 10.5px; font-weight: 600;
  cursor: pointer; font-family: 'Plus Jakarta Sans', sans-serif; transition: all .15s;
}
.filtro-cat.active          { background: rgba(109,40,217,0.2); border-color: rgba(109,40,217,0.4); color: var(--accent-light); }
.filtro-cat:hover:not(.active) { color: var(--text); }

/* ─── EMOJI PICKER ─── */
.emoji-opt {
  background: var(--surface2); border: 1px solid var(--border2); color: var(--text2);
  border-radius: 8px; padding: 5px 11px; font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: 'Plus Jakarta Sans', sans-serif; transition: all .15s;
}
.emoji-opt.active              { background: rgba(109,40,217,0.2); border-color: rgba(109,40,217,0.45); color: var(--accent-light); }
.emoji-opt:hover:not(.active)  { background: var(--surface3); color: var(--white); }

.ep-opt {
  font-size: 20px; cursor: pointer; padding: 4px; border-radius: 6px;
  transition: background .12s; display: inline-block;
}
.ep-opt:hover           { background: var(--surface2); }
#emoji-picker-grid      { display: none; }
#emoji-picker-grid.open { display: flex; }

/* ═══════════════════════════════════════
   RESPONSIVIDADE MOBILE
═══════════════════════════════════════ */
@media (max-width: 900px) {

  /* ── Layout principal: 1 coluna ── */
  .catalog-layout {
    grid-template-columns: 1fr;
  }

  /* ── Modal: ocupa quase toda a tela ── */
  #modal-item > div {
    max-width: 100% !important;
    margin: 0 8px !important;
    border-radius: 18px !important;
    max-height: 94vh !important;
  }

  /* ── Tipo + Unidade: 1 coluna ── */
  #modal-item [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* ── 3 preços: empilha em 2+1 ── */
  #modal-item [style*="grid-template-columns:1fr 1fr 1fr"] {
    grid-template-columns: 1fr 1fr !important;
  }
  /* Custo fica sozinho na linha de baixo, largura total */
  #modal-item [style*="grid-template-columns:1fr 1fr 1fr"] .form-group:last-child {
    grid-column: span 2;
  }

  /* ── Emoji picker: abre para cima se necessário, sem cortar ── */
  #emoji-picker-grid {
    position: fixed !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    top: auto !important;
    bottom: 16px !important;
    width: calc(100vw - 32px) !important;
    max-height: 55vh !important;
  }

  /* ── Tabela catálogo → Cards ── */
  .catalog-table thead { display: none; }
  .catalog-table,
  .catalog-table tbody,
  .catalog-table tr,
  .catalog-table td { display: block; width: 100%; }

  .catalog-table tr {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-bottom: 10px;
    padding: 12px 14px;
    position: relative;
    cursor: pointer;
  }
  .catalog-table tr:last-child { margin-bottom: 0; }
  .catalog-table td {
    padding: 3px 0;
    border: none;
    font-size: 12px;
  }
  /* Oculta colunas menos importantes */
  .catalog-table td[data-label="Uso"],
  .catalog-table td[data-label="Categoria"],
  .catalog-table td[data-label="Estoque"] { display: none; }

  /* Nome e ícone em destaque */
  .catalog-table td[data-label="Item"] {
    margin-bottom: 6px;
  }
  /* Preço fica no canto superior direito */
  .catalog-table td[data-label="Preço"] {
    position: absolute;
    top: 14px;
    right: 40px;
    padding: 0;
    font-weight: 800;
    color: var(--green);
    font-size: 14px !important;
  }
  /* Ações (editar/excluir) no canto direito */
  .catalog-table td:last-child {
    position: absolute;
    top: 10px;
    right: 8px;
    padding: 0;
    width: auto;
  }
}

/* ─── CATEGORIA — TAGS DINÂMICAS ─── */
#cat-sugestoes {
  display: none;
  position: absolute;
  z-index: 200;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  margin-top: 2px;
  width: 100%;
  max-height: 180px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

/* ── Tema Claro ── */
[data-tema="light"] .catalog-name { color: var(--text) !important; }
[data-tema="light"] .emoji-opt:hover:not(.active) { color: var(--text) !important; }
