/* css/gymrats.css v21 — z-index alto, overflow visível e pointer-events */

:root{
  --border-color:#e6e6ef;
  --text-color:#1f2937;
  --text-color-light:#94a3b8;
  --color-black:#111827;
}

/* Controle de exibição de colunas por tipo de ranking */
/* Ranking Pessoas: mostra Nome e Equipe, esconde Pessoas Ativas */
body[data-rank-type="pessoas"] .col-team-only { display: table-cell !important; }
body[data-rank-type="pessoas"] .col-pessoas-ativas { display: none !important; }
body[data-rank-type="pessoas"] td.col-team-only { display: table-cell !important; }
body[data-rank-type="pessoas"] td.col-pessoas-ativas { display: none !important; }

/* Ranking Equipes: esconde coluna Equipe, mostra Pessoas Ativas */
body[data-rank-type="equipes"] .col-team-only { display: none !important; }
body[data-rank-type="equipes"] .col-pessoas-ativas { display: table-cell !important; }
body[data-rank-type="equipes"] td.col-team-only { display: none !important; }
body[data-rank-type="equipes"] td.col-pessoas-ativas { display: table-cell !important; }

header{
  display:flex; align-items:flex-start; justify-content:space-between;
  gap:16px; position:relative; z-index: 3000; /* bem alto */
  overflow: visible; pointer-events: auto;
}
.header-left h1{ margin:0; font-size:24px; font-weight:700; }
.header-left p{ margin:4px 0 0; color:#6b7280; }

.header-actions{
  margin-left:auto; display:flex; align-items:center; gap:12px;
  flex-wrap: wrap; min-height: 36px;
  overflow: visible; pointer-events: auto; position: relative; z-index: 3001;
}

/* Pódio */
.podium{ display:grid; grid-template-columns: repeat(3,1fr); gap:16px; margin: 6px 0 14px; align-items:end; }
.podium-card{ background:#fff; border:1px solid var(--border-color); border-radius:12px; padding:12px; text-align:center; position:relative; }
.podium-avatar{ width:82.8px; height:82.8px; border-radius:50%; background:#e5e7ff; margin:0 auto 8px; display:flex; align-items:center; justify-content:center; border:4px solid transparent; }
.podium .first .podium-avatar{ width:96.6px; height:96.6px; background:#ffe9a6; border-color:#d4af37; }
.podium .second .podium-avatar{ width:87.4px; height:87.4px; border-color:#c0c0c0; }
.podium .third .podium-avatar{ border-color:#cd7f32; }
.podium .podium-avatar{ background-size: cover; background-position: center; }
.podium-name{ font-weight:600; font-size:13px; }
.podium-score{ font-weight:700; font-size:14px; }
.podium-laurel{ margin-top:6px; display:flex; justify-content:center; pointer-events:none; }

/* Ações à direita dentro do header do widget */
.widget-actions-right{
  margin-left:auto; display:flex; align-items:center; gap:10px;
}

/* alinhar ao nível do título, como na paginação de outros widgets */
.widget .widget-header { display:flex; justify-content:space-between; align-items:center; flex-wrap:nowrap; position: relative; z-index: 3000; }

.widget .widget-header .widget-title {
    line-height: 1;
}

.widget .widget-header .filter-btn,
.widget .widget-header .btn-history { align-self:center; }

/* Pequeno ajuste fino para os pills ficarem exatamente na mesma linha visual */
.widget .widget-header .filter-btn,
.widget .widget-header .btn-history{ align-self:center; height:36px !important; }

/* garante alinhamento do container de ações */
.widget .widget-header > .widget-actions-right{ display:flex; align-items:center; gap:10px; }

/* Histórico: garantir que o header fique idêntico ao GymRats */
.widget .widget-header .widget-title-wrap{ display:flex; align-items:center; gap:var(--header-gap, 6px); }

/* CORREÇÃO CRÍTICA: anular o translateY(-12px) do index.css que desloca o título */
.widget .widget-header .widget-title-wrap{ transform: translateY(0) !important; }
.widget .widget-header .widget-actions-right{ transform: translateY(0) !important; }

/* Garantir alinhamento e tamanho idênticos entre filtros e botão Ranking */
.widget .widget-header .btn-history,
.widget .widget-header .filter-btn{
  height: 36px !important;
  padding: 8px 16px !important;
  display: inline-flex; align-items: center; vertical-align: middle;
}
.widget .widget-header .btn-history{ transform: translateY(0) !important; margin: 0 !important; }

/* SUPER ESPECÍFICO: garantir altura e alinhamento contra sales-efficiency.css */
.widget .widget-header .widget-actions-right .filter-btn{ height: 36px !important; }
.widget .widget-header .widget-actions-right .btn-history{ height: 36px !important; }

/* Filtros + botão Histórico */
#filters-bar.table-filters{
  display:flex !important; flex-wrap:nowrap; gap:10px;
  background:transparent !important; padding:0 !important; border-radius:0 !important;
  box-shadow:none !important; transform:none !important;
  align-items: center; visibility: visible !important; opacity: 1 !important;
  position: relative; z-index: 3500; pointer-events: auto; overflow: visible;
}
.filter-group { position: relative; pointer-events: auto; }

.filter-btn,
.btn-history {
  border-radius: 20px !important; padding: 8px 16px !important; font-size: 13px; font-weight: 600; line-height: 1; height: 36px !important;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; cursor: pointer; transition: all .2s ease;
  border: 1px solid var(--border-color); user-select: none;
  pointer-events: auto; position: relative; z-index: 3003;
}
.filter-btn { background: #f8f9fa; color: var(--text-color); }
.filter-btn:hover { border-color: #cbd5e0; background-color: #f1f5f9; }
.filter-btn.active { background: #e9d8ff; border-color: #a369d1; color: #553c9a; font-weight: 700; }
.filter-btn span { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.filter-group.open .filter-btn { background: #f8f9fa; border-color: var(--text-color-light); }
.filter-btn i{ font-size: 10px; }

.btn-history{
  background: var(--color-black); color:#fff; text-decoration:none;
  border-color: var(--color-black);
  height: 36px !important; padding: 8px 16px !important; border-radius: 20px !important;
  display:inline-flex; align-items:center; gap:8px; line-height:1; vertical-align:middle;
}
.btn-history:hover{ filter: brightness(0.95); }
.btn-history i{ font-size:10px; }

/* dropdown */
.filter-dropdown {
  display: none; position: absolute; top: 110%; left: 0; min-width: 220px;
  background: #fff; border: 1px solid #eee; border-radius: 10px;
  box-shadow: 0 14px 34px rgba(0,0,0,0.18); max-height: 300px; overflow-y: auto;
  z-index: 5000; animation: gr-fade .18s; pointer-events: auto;
}
.filter-group.open .filter-dropdown { display: block; }
@keyframes gr-fade { from { opacity: 0; transform: translateY(-7px); } to { opacity: 1; transform: translateY(0); } }

.filter-dropdown-list label { display: flex; align-items: center; padding: 10px 15px; font-size: 14px; color: var(--text-color); cursor: pointer; border-radius: 6px; margin: 5px; transition: background-color 0.2s; }
.filter-dropdown-list label:hover { background-color: #f5f5f5; }

.filter-dropdown-list input { -webkit-appearance: none; appearance: none; background-color: #fff; margin: 0 12px 0 0; color: var(--border-color); width: 1.2em; height: 1.2em; border: 2px solid var(--border-color); transform: translateY(-0.075em); display: grid; place-content: center; transition: border-color 0.2s, background-color 0.2s; }
.filter-dropdown-list input::before { content: ""; width: 0.65em; height: 0.65em; transform: scale(0); transition: 120ms transform ease-in-out; }
.filter-dropdown-list input[type="checkbox"] { border-radius: 4px; }
.filter-dropdown-list input[type="checkbox"]::before { clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); background-color: white; }
.filter-dropdown-list input[type="radio"] { border-radius: 50%; }
.filter-dropdown-list input[type="radio"]::before { border-radius: 50%; background: #7F3F98; }
.filter-dropdown-list input[type="radio"]:checked { border-color: #7F3F98; }
.filter-dropdown-list input:checked { border-color: #7F3F98; }
.filter-dropdown-list input[type="checkbox"]:checked { background-color: #7F3F98; }
.filter-dropdown-list input:checked::before { transform: scale(1); }

/* busca */
.name-search-container {
    position: relative;
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.name-search-input{ 
    width: 100%; 
    padding: 8px 32px 8px 10px; 
    border: 1px solid #e3e3e8; 
    border-radius: 8px; 
    font-size: 14px; 
}

.name-search-btn {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    padding: 4px;
}

/* utilitário: esconder itens do dropdown via JS */
.gr-hide { display: none !important; }

/* "Selecionar apenas este" */
.select-only-btn { background: none; border: none; cursor: pointer; margin-left: auto; padding: 2px 6px; border-radius: 50%; font-size: 16px; line-height: 1; color: #a0aec0; opacity: 0; transition: opacity 0.2s, background-color 0.2s; }
.filter-dropdown-list label:hover .select-only-btn { opacity: 1; }
.select-only-btn:hover { background-color: #edf2f7; color: #4a5568; }

/* Tabela */
.modern-table-container{ overflow-x: auto; position: relative; z-index: 1; }
/* Evita que elementos do widget se sobreponham ao menu do usuário */
header{ position: relative; z-index: 20000; }
#gymrats .modern-table-container, /* caso seja usado um id */
#history .modern-table-container { position: relative; z-index: 1; }
#gymrats-table{ width:100%; border-collapse:separate; border-spacing:0; table-layout:auto; }
#gymrats-table thead th{
  text-align:center; padding:10px 12px;
  border-bottom:1.5px solid var(--border-color) !important;
}
#gymrats-table th, #gymrats-table td{ border:none !important; }
#gymrats-table tbody td{ text-align:center; vertical-align:middle; padding:10px 12px; }
#gymrats-table .td-name{ text-align:center; }

/* display tabela */
#gymrats-table thead, #gymrats-table tbody{ display:table-row-group !important; }
#gymrats-table tr{ display:table-row !important; }
#gymrats-table th, #gymrats-table td{ display:table-cell !important; }

/* ranking */
.rank-badge{ font-weight:700; }
.rank-badge::after{ content: attr(data-medal); margin-left:4px; }

/* células métricas */
.metric-cell{ position:relative; display:flex; flex-direction:column !important; align-items:center; line-height:1.1; gap:2px; }
.metric-line{ font-size:12px; display:block; }
.metric-line .meta{ color:#888; font-weight:600; }
.metric-pct{ font-size:10px; display:block; }

/* badges de porcentagem como marcatexto */
.pct-badge{ padding:2px 6px; border-radius:6px; font-weight:800; color:#fff; }
.pct-low{ background:#e53935; }
.pct-mid{ background:#f6ad55; color:#1a1a1a; }
.pct-high{ background:#2f855a; color:#fff; }
.pct-over{ background:#2f855a; }

/* tooltip */
.gr-tooltip{
  position:fixed; max-width:280px; background:rgba(0,0,0,.92); color:#fff;
  font-size:12px; line-height:1.45; padding:10px 12px; border-radius:12px;
  white-space:pre-line; box-shadow:0 10px 30px rgba(0,0,0,.25); z-index:99999;
  pointer-events:none; transform:translate(10px,10px);
}

/* Responsivo */
@media (max-width: 980px){
  .header-actions{ gap:8px; }
  #filters-bar.table-filters{ flex-wrap:wrap; }
  .filter-btn span{ max-width:100px; }
}
@media (max-width: 640px){
  .podium{ grid-template-columns: 1fr; }
}

.photo-cell {
    padding-left: 40px !important;
}

/* GymRats: forçar 7 chips na mesma linha com estilo compacto */
#gr-summary.metrics-row{
  grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
  gap: 8px !important;
}
#gr-summary .metric-chip{
  padding: 6px 8px !important;
}
#gr-summary .metric-chip__value{ font-size: 13px !important; }
#gr-summary .metric-chip__label{ font-size: 9px !important; }

/* Sublegenda nos cabeçalhos (Feito/Ideal/Meta) */
.th-sub{ display:block; font-size:10px; color:#9aa0a6; font-weight:500; margin-top:2px; text-transform:none; }

/* Ícones de equipe (usando Font Awesome já incluído) */
.team-icon-wrap{ width:35px; height:35px; display:flex; align-items:center; justify-content:center; margin:0 auto; border-radius:8px; background:#f5f5f8; box-shadow:0 0 0 1px rgba(0,0,0,.06) inset; }
.team-icon-wrap i{ font-size:18px; color:#7f3f98; }
.podium-icon{ font-size:40px; color:#7f3f98; line-height:1; }
.podium .first .podium-icon{ font-size:48px; }
.podium .second .podium-icon{ font-size:44px; }
.podium .third .podium-icon{ font-size:40px; }

/* Ajuste para evitar corte do texto no botão 'Tipo de Ranking' */
.widget .widget-header .filter-btn span{ max-width: 220px !important; overflow: visible !important; text-overflow: clip !important; }
.widget .widget-header .filter-btn{ padding-right: 18px !important; }

/* Ajuste extra para o botão de Tipo de Ranking */
#filters-bar-access{ overflow: visible; }
#filters-bar-access .filter-btn span{ max-width: 260px !important; white-space: nowrap !important; overflow: visible !important; text-overflow: clip !important; }
