/*
 * Tema v2 do PAINEL DO SELLER: ajustes da casca do seller por cima do kit
 * (tki.css + componentes/, copias do adm). Carregado depois de componentes/ e
 * antes de kit-web.css e paginas/. So' o que e' diferente do admin mora aqui:
 * recuo e camada do menu, topo (saldo) e rodape do menu.
 * Escopo obrigatorio: html.tki-layout (escuro: [data-bs-theme='dark']).
 */

/* ---------- Recuo do menu ----------
   A v1 do seller empurra topo e conteudo com margin-left (partials/topbar.php);
   o kit empurra com left/padding-left, como no admin. Fica so' o do kit. */
@media (min-width: 1200px) {
  html.tki-layout body[data-sidebar-size] .topbar,
  html.tki-layout body[data-sidebar-size] .page-wrapper .page-content {
    margin-left: 0 !important;
  }
}

/* ---------- Camadas ----------
   O menu do seller fica em z-index 1100 no computador (acima do fundo dos
   modais, da gaveta e da busca). Na v2 fica onde o admin fica (1005): modal,
   gaveta e busca Ctrl/Cmd+K cobrem o menu tambem. */
@media (min-width: 1200px) {
  html.tki-layout .startbar { z-index: 1005 !important; }
}

/* ---------- Rodape do menu ----------
   Na v1 tema e perfil ficam no rodape do menu (computador). Na v2 estao no
   topo (partials/v2/topbar.php), como no admin. */
html.tki-layout .startbar .sidebar-user-section { display: none !important; }

/* Cartao "Ative sua conta" (conta sem documentos) no fim do menu. */
html.tki-layout .startbar .tki-menu-ativar {
  list-style: none;
  margin: 16px 12px 0;
  padding: 16px;
  border: 1px solid var(--tki-border);
  border-radius: var(--tki-radius-card, 16px);
  background: var(--tki-card);
  display: grid;
  gap: 8px;
  justify-items: start;
}
html.tki-layout .startbar .tki-menu-ativar strong { color: var(--tki-fg); font-size: 15px; }
html.tki-layout .startbar .tki-menu-ativar p { color: var(--tki-muted); font-size: 13px; margin: 0; line-height: 1.45; white-space: normal; }
html.tki-layout body[data-sidebar-size='collapsed'] .startbar .tki-menu-ativar { display: none; }

/* ---------- Topo: "Seu saldo" ---------- */
html.tki-layout .topbar .topbar-right { display: flex; align-items: center; }
html.tki-layout .topbar .tki-saldo-topo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 4px 0 14px;
  border: 1px solid var(--tki-border);
  border-radius: 999px;
  background: var(--tki-card);
  white-space: nowrap;
}
html.tki-layout .topbar .tki-saldo-texto { display: grid; line-height: 1.15; }
html.tki-layout .topbar .tki-saldo-texto span { font-size: 11px; color: var(--tki-muted); font-weight: 500; }
html.tki-layout .topbar .tki-saldo-texto strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--tki-fg);
  font-variant-numeric: tabular-nums;
  min-width: 84px;
}
html.tki-layout .topbar .tki-saldo-olho {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--tki-muted);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}
html.tki-layout .topbar .tki-saldo-olho:hover { background: var(--tki-hover); color: var(--tki-fg); }
html.tki-layout .topbar .tki-saldo-olho:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tki-primary) 25%, transparent);
}
html.tki-layout .topbar .tki-saldo-olho svg { width: 18px; height: 18px; }

/* Menu do perfil: icones do Lucide alinhados ao texto. */
html.tki-layout .topbar .dropdown-menu .dropdown-item svg,
html.tki-layout .topbar .dropdown-menu .dropdown-item-text svg {
  width: 16px;
  height: 16px;
  margin-right: 6px;
  vertical-align: -3px;
}
html.tki-layout .topbar .dropdown-menu .dropdown-item-text svg { margin-right: 2px; }

/* Tablet: o saldo fica so' com o valor; celular: so' o olho, e o valor
   aparece ao lado quando o seller pede para ver. */
@media (max-width: 991.98px) {
  html.tki-layout .topbar .tki-saldo-topo { padding-left: 12px; height: 36px; }
  html.tki-layout .topbar .tki-saldo-texto span { display: none; }
  html.tki-layout .topbar .tki-saldo-texto strong { min-width: 0; font-size: 13px; }
}
@media (max-width: 575.98px) {
  html.tki-layout .topbar .tki-saldo-topo { padding: 0; border: 0; background: transparent; height: 36px; }
  html.tki-layout .topbar .tki-saldo-topo:not(.is-visivel) .tki-saldo-texto { display: none; }
  html.tki-layout .topbar .tki-saldo-olho { width: 36px; height: 36px; border: 1px solid var(--tki-border); background: var(--tki-card); }
}

/* ---------- CSS global da v1 do seller (head-css.php) ----------
   No celular a v1 empilha os botoes do rodape dos modais (column-reverse).
   Na v2 fica como no admin: lado a lado, largura dividida, toque >= 44px. */
@media (max-width: 575.98px) {
  html.tki-layout .modal-footer { flex-direction: row; flex-wrap: nowrap; }
  html.tki-layout .modal-footer > :is(.btn, .tki-btn) { width: auto; margin: 0; }
}

/* Foto de perfil no avatar do topo e do menu do perfil (shared/FotoPerfil.php).
   Sem foto continua o circulo com as iniciais do tki.css. */
html.tki-layout .topbar .profile-avatar.tem-foto {
  overflow: hidden;
  padding: 0;
  background: var(--tki-subtle) !important;
}
html.tki-layout .topbar .profile-avatar.tem-foto img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

/* Topo no celular: o seller tem um botao a mais (olho do saldo); a saudacao
   encolhe com reticencias em vez de passar por baixo dos botoes, e some nas
   telas bem estreitas. */
@media (max-width: 575.98px) {
  html.tki-layout .topbar .topbar-left { min-width: 0; flex: 1 1 auto; overflow: hidden; }
  html.tki-layout .topbar .topbar-left h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px !important; }
  html.tki-layout .topbar .topbar-right { flex: 0 0 auto; gap: 6px !important; }
  html.tki-layout .topbar :is(.nav-icon, .tki-busca-gatilho, .tki-saldo-olho) { width: 36px !important; height: 36px !important; }
  html.tki-layout .topbar .profile-avatar { width: 34px !important; height: 34px !important; }
}
@media (max-width: 374.98px) {
  html.tki-layout .topbar .topbar-left { visibility: hidden; }
}

/* Celular: o menu lateral so' aparece quando a pagina fica pronta (antes do
   JS do template ele pintava aberto por cima do esqueleto). */
@media (max-width: 1199.98px) {
  html.tki-layout:not(.tki-pronto) .startbar { visibility: hidden; }
}

/* Cabecalho no celular: quando as acoes sao so' o menu "...", ele fica no
   canto do titulo (antes sobrava sozinho numa linha, ex.: Assinatura #1). */
@media (max-width: 767.98px) {
  html.tki-layout .tki-page-header:has(> .tki-page-actions > .tki-menu:only-child) { position: relative; }
  html.tki-layout .tki-page-header:has(> .tki-page-actions > .tki-menu:only-child) > .tki-page-heading { padding-right: 48px; }
  html.tki-layout .tki-page-actions:has(> .tki-menu:only-child) { position: absolute; top: 0; right: 0; width: auto; }
}
