/* ==========================================================================
   BAUKO DS — estados visuais que não cabem em style inline
   (hover/focus/transições dos componentes de hub-components/bauko-ds-*.js)
   Requer que o elemento pai tenha a classe .bds-scope (ver hub-tokens.css).
   ========================================================================== */

/* ---- Card genérico (base de KpiCard, painéis, DataTable wrapper) ---- */
.bds-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.bds-card--hoverable { transition: box-shadow var(--t-fast) var(--ease); cursor: pointer; }
.bds-card--hoverable:hover { box-shadow: var(--shadow-2); }

/* ---- DataTable — hover de linha em CSS puro (era onMouseEnter no React) ---- */
.bds-table { width: 100%; border-collapse: collapse; font-family: var(--ff-body); }
.bds-table thead th {
  position: sticky; top: 0;
  font-size: var(--fs-table-head);
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
  color: var(--tx-3);
  font-weight: 700;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
}
.bds-table thead th.bds-align-right { text-align: right; }
.bds-table thead th.bds-align-center { text-align: center; }
.bds-table tbody tr { transition: background var(--t-fast) var(--ease); }
.bds-table tbody tr:hover { background: var(--grn-050); }
.bds-table tbody td {
  font-size: 13px;
  color: var(--tx);
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
}
.bds-table tbody td.bds-align-right { text-align: right; }
.bds-table tbody td.bds-align-center { text-align: center; }
.bds-table tbody td.bds-mono { font-family: var(--ff-mono); }
.bds-table--loose thead th, .bds-table--loose tbody td { padding: 12px 14px; }

/* ---- Tabs — underline verde 3px na ativa ---- */
.bds-tabs {
  display: flex; gap: var(--s-6);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 0 var(--s-6);
}
.bds-tab {
  background: none; border: none; cursor: pointer;
  padding: 14px 2px;
  font-family: var(--ff-body); font-size: 13px; font-weight: 600;
  color: var(--tx-3);
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  display: flex; align-items: center; gap: 6px;
  transition: color var(--t-fast) var(--ease);
}
.bds-tab.is-active { color: var(--tx); border-bottom-color: var(--grn); }
.bds-tab__badge {
  font-family: var(--ff-mono); font-size: 10px; font-weight: 700;
  color: var(--warn); letter-spacing: .04em; margin-left: 4px;
}

/* ---- FilterBar ---- */
.bds-filterbar {
  display: flex; align-items: flex-end; gap: var(--s-5);
  padding: var(--s-4) var(--s-6);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.bds-filterbar__clear {
  background: none; border: 1px solid var(--danger); color: var(--danger);
  border-radius: var(--r-md); padding: 9px 12px; font-size: 12px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; gap: 4px;
}

/* ---- Button ---- */
.bds-btn {
  font-family: var(--ff-body); font-weight: 600; font-size: 13px;
  border: 1px solid transparent; border-radius: var(--r-md);
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  line-height: 1;
}
.bds-btn[disabled] { opacity: .5; cursor: not-allowed; }
.bds-btn--sm { padding: 6px 10px; font-size: 12px; }
.bds-btn--md { padding: 9px 14px; font-size: 13px; }
.bds-btn--lg { padding: 12px 18px; font-size: 14px; }
.bds-btn--primary   { background: var(--grn);     color: var(--primary-tx); border-color: var(--grn); }
.bds-btn--primary:hover:not([disabled])   { background: var(--grn-600); border-color: var(--grn-600); }
.bds-btn--secondary { background: var(--surface); color: var(--tx);       border-color: var(--border-2); }
.bds-btn--secondary:hover:not([disabled]) { background: var(--surface-2); }
.bds-btn--ghost      { background: transparent; color: var(--tx-2); border-color: transparent; }
.bds-btn--ghost:hover:not([disabled])      { background: var(--gry-100); }
.bds-btn--danger    { background: var(--danger);  color: #fff; border-color: var(--danger); }
.bds-btn--danger:hover:not([disabled])    { background: #b23c3c; }
.bds-btn--warn      { background: var(--warn);    color: var(--tx); border-color: var(--warn); }
.bds-btn--warn:hover:not([disabled])      { background: #d99200; }

/* ---- IconButton ---- */
.bds-iconbtn {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-md); border: 1px solid var(--border-2);
  background: var(--surface); color: var(--tx-2);
  cursor: pointer; transition: background var(--t-fast) var(--ease);
}
.bds-iconbtn:hover { background: var(--gry-100); }

/* ---- Select / Input — foco em anel verde ---- */
.bds-field {
  width: 100%; font-family: var(--ff-body); font-size: 13px; color: var(--tx);
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--r-md); padding: 9px 11px; outline: none;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.bds-field:focus { border-color: var(--grn); box-shadow: 0 0 0 3px var(--grn-050); }
.bds-field[disabled] { background: var(--gry-050); opacity: .6; }
.bds-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23706f6f'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

/* ---- Checkbox / Radio / Switch ---- */
.bds-check-label, .bds-radio-label {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
}
.bds-check-label.is-disabled, .bds-radio-label.is-disabled { cursor: not-allowed; opacity: .5; }
.bds-checkbox {
  width: 18px; height: 18px; border-radius: var(--r-xs);
  border: 1px solid var(--border-2); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--t-fast) var(--ease);
}
.bds-checkbox.is-checked { border-color: var(--grn); background: var(--grn); }
.bds-radio {
  width: 18px; height: 18px; border-radius: 999px;
  border: 1px solid var(--border-2); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
}
.bds-radio.is-checked { border-color: var(--grn); }
.bds-radio__dot { width: 10px; height: 10px; border-radius: 999px; background: var(--grn); }
.bds-switch {
  width: 38px; height: 22px; border-radius: 999px; border: none;
  background: var(--gry-300); position: relative; cursor: pointer;
  transition: background var(--t-fast) var(--ease); padding: 0;
}
.bds-switch.is-checked { background: var(--grn); }
.bds-switch[disabled] { opacity: .5; cursor: not-allowed; }
.bds-switch__thumb {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  border-radius: 999px; background: #fff; box-shadow: var(--shadow-1);
  transition: left var(--t-fast) var(--ease);
}
.bds-switch.is-checked .bds-switch__thumb { left: 18px; }

/* ---- Toggle — segmentado N-botões (réplica de .pmp-tog/.pmp-tb do simulador) ---- */
.bds-toggle {
  display: flex; border: 1px solid var(--border-2); border-radius: var(--r-md); overflow: hidden;
}
.bds-toggle__btn {
  flex: 1; padding: 9px 8px; text-align: center;
  font-family: var(--ff-mono); font-size: 12px; font-weight: 600;
  cursor: pointer; background: var(--bg); color: var(--tx-3); border: none;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.bds-toggle__btn.is-active { background: var(--grn); color: #fff; }

/* ---- Dialog ---- */
.bds-dialog-scrim {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.bds-dialog {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-3);
  width: 420px; max-width: 90vw; padding: var(--s-6);
  display: flex; flex-direction: column; gap: var(--s-4);
}

/* ---- Toast ---- */
.bds-toast-stack {
  position: fixed; top: var(--s-6); right: var(--s-6); z-index: 200;
  display: flex; flex-direction: column; gap: var(--s-2);
}
.bds-toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-radius: var(--r-lg); box-shadow: var(--shadow-2);
  font-family: var(--ff-body); font-size: 13px; font-weight: 600; min-width: 260px;
}

/* ---- Tooltip (balão custom — pode ficar por baixo/clipado; ver InfoDica) ---- */
.bds-tooltip-wrap { position: relative; display: inline-flex; }
.bds-tooltip {
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--gry-900); color: #fff; font-size: 11px; font-family: var(--ff-body);
  padding: 5px 9px; border-radius: var(--r-sm); white-space: nowrap; z-index: 50;
  display: none;
}
.bds-tooltip-wrap:hover .bds-tooltip { display: block; }

/* ---- InfoDica — selo "ⓘ" com tooltip NATIVO (BaukoDS.infoDica / KpiCard info) ----
   Usa o title do navegador de propósito: nunca fica por baixo nem é clipado por
   overflow:hidden (o balão do SO é renderizado acima de toda a página). Réplica
   do .kpi-info de chamados.html no padrão de tokens do BaukoDS. */
.bds-infodica {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--tx-3);
  font-family: var(--ff-mono); font-size: 10px; font-weight: 700; line-height: 1;
  cursor: help; user-select: none; flex-shrink: 0; vertical-align: middle;
  text-transform: none; letter-spacing: 0; margin-left: 5px;
}
.bds-infodica:hover { background: var(--grn-050); color: var(--grn); border-color: var(--grn); }
/* variante para o canto de um card (KpiCard info) — card precisa position:relative */
.bds-infodica--corner { position: absolute; top: 8px; right: 8px; margin-left: 0; z-index: 2; }

/* ---- Multiselect (delegado ao BaukoMS — ver bauko-ds-overlay.js) ---- */
/* Estilo vem de /bauko-multiselect.css; nada a declarar aqui. */

/* ---- HelpDrawer — roteiro de ajuda do módulo (slide-in, mesmo molde do drawer de ficha) ---- */
.bds-help-drawer {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: none; z-index: 640; justify-content: flex-end;
}
.bds-help-drawer.bds-show { display: flex; }
.bds-help-box {
  background: var(--surface); width: min(520px, 100%); height: 100%;
  overflow-y: auto; box-shadow: -8px 0 30px rgba(0,0,0,.25);
  display: flex; flex-direction: column;
}
.bds-help-head {
  position: sticky; top: 0; background: var(--surface);
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
  font-family: var(--ff-display); font-size: 20px; color: var(--tx); z-index: 1;
}
.bds-help-close { background: none; border: none; font-size: 22px; color: var(--tx-3); cursor: pointer; line-height: 1; }
.bds-help-content { padding: 6px 20px 20px; flex: 1; }
.bds-help-section { margin: 16px 0; }
.bds-help-section h4 {
  font-family: var(--ff-body); font-size: 12px; font-weight: 700; color: var(--grn-600);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px;
}
.bds-help-body { font-size: 13px; color: var(--tx-2); line-height: 1.55; }
.bds-help-body p { margin-bottom: 8px; }
.bds-help-body ul { padding-left: 18px; margin-bottom: 8px; }
.bds-help-body li { margin-bottom: 4px; }
.bds-help-body b { color: var(--tx); }
.bds-help-foot {
  padding: 12px 20px; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--tx-3); font-family: var(--ff-mono);
}
