/* Arquivo: public_html/tecar/assets/css/style.css */
/* ... (Todo o CSS anterior permanece igual) ... */

body {
  background: #0f172a;
  color: #e2e8f0;
  font-family: 'Inter', sans-serif;
  margin: 0;
}
* { box-sizing: border-box; }
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px;
}
.flex { display: flex; }
.gap { gap: 12px; }
.wrap { flex-wrap: wrap; }
.muted { color: #94a3b8; }

/* Header */
.bar {
  display: flex;
  flex-direction: column;
  gap: 16px; 
  margin-bottom: 16px;
}

.header-top-row {
  display: flex;
  justify-content: space-between; 
  align-items: center;
}
.bar h1 {
  font-size: 24px;
  margin: 0;
  color: white;
  font-weight: 700; 
}
.user-greeting {
  font-size: 24px;
  font-weight: 700;
  color: white; 
  white-space: nowrap; 
}

/* NOVO: Botão de Admin */
.btn-admin {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: #374151; /* Cinza escuro */
    color: #e2e8f0;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid #4b5563;
    transition: all 0.2s;
}
.btn-admin:hover {
    background-color: #4b5563;
    color: white;
    border-color: #6b7280;
}

/* Barra de Filtros */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Inputs e Selects */
input, select, button {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  transition: all .2s;
  height: 40px;
  line-height: 38px;
}
input::placeholder { color: #94a3b8; }

.filter-bar select {
  flex-grow: 1;
  min-width: 120px;
  max-width: 200px;
  cursor: pointer;
}

.filter-bar input.date {
  width: 110px; 
  text-align: center;
}

/* Botões de Data */
.button-group {
  display: flex;
  gap: 4px;
}
.button-group button {
  background: #0f172a;
  border: 1px solid #334155;
  color: #94a3b8;
  padding: 0 16px;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}
.button-group button:hover {
  background: #1e293b;
  color: white;
}
.button-group button.active {
  background: #2563eb;
  border-color: #2563eb;
  color: white;
}

/* Botão Excel */
button.btn-success {
  background: #16a34a; 
  border-color: #16a34a;
  color: white;
  font-weight: 600;
  padding: 0 16px;
  cursor: pointer;
}
button.btn-success:hover { background: #22c55e; }

.filters { min-height: 16px; }
#loading { display: none; }

/* Cards KPI */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.card {
  background: #1e293b;
  border-radius: 12px;
  padding: 24px;
  border: 1px solid #334155;
}
.card .label { font-size: 14px; color: #94a3b8; margin-bottom: 8px; }
.card .value { font-size: 32px; font-weight: 700; color: white; }

/* Layout Grids */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr; 
  gap: 16px;
  margin-bottom: 16px;
  align-items: start; 
}

/* Grid específico para Rankings (3 colunas) */
.grid.rankings.three-columns {
    grid-template-columns: 1fr 1fr 1fr;
}

.panel {
  background: #1e293b;
  border-radius: 12px;
  padding: 24px;
  border: 1px solid #334155;
  margin-bottom: 16px;
}

.grid .panel {
  margin-bottom: 0;
}

.panel h3 { margin: 0 0 16px 0; color: white; font-size: 18px; }
.canvas-wrap { height: 350px; position: relative; }

.no-data {
  position: absolute; inset: 44px 16px 16px 16px;
  display: grid; place-items: center; opacity: .7; font-size: 14px;
}

/* Rankings List */
.ranking-list { display: flex; flex-direction: column; gap: 10px; }
.ranking-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px; background: #0f172a; border-radius: 8px; border: 1px solid #334155;
}
.ranking-item.loading { color: #94a3b8; font-style: italic; justify-content: center; }
.rank-info { display: flex; align-items: center; gap: 12px; }
.rank-pos { font-size: 24px; line-height: 1; }
.rank-name { font-weight: 600; color: #e2e8f0; font-size: 15px; }
.rank-value { font-weight: 700; color: #60a5fa; font-size: 16px; }

/* Tabelas */
#table-empresa-wrap, #panel-empresa .table-wrap, .ranking-panel .table-wrap {
  max-height: 350px; overflow-y: auto; overflow-x: hidden;
}
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; padding: 12px 10px; color: #94a3b8; font-size: 13px; border-bottom: 1px solid #334155;
}
tbody td {
  padding: 12px 10px; border-bottom: 1px solid #334155; font-size: 14px;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #334155; }

.pagination {
  display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 16px;
}
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }
.container > .panel:last-child { margin-bottom: 0; }

/* Tooltip Flutuante */
#zap-tooltip {
    position: absolute;
    display: none;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 12px;
    width: 250px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    z-index: 1000;
    font-size: 13px;
    color: #e2e8f0;
    pointer-events: none;
}
#zap-tooltip .tooltip-title {
    font-weight: 700;
    color: #60a5fa;
    margin-bottom: 8px;
    border-bottom: 1px solid #334155;
    padding-bottom: 4px;
}
#zap-tooltip ul { list-style: none; padding: 0; margin: 0; }
#zap-tooltip li { margin-bottom: 4px; color: #94a3b8; }
#zap-tooltip li strong { color: #cbd5e1; }
.tooltip-loading { font-style: italic; color: #94a3b8; }
.tooltip-empty { font-style: italic; color: #64748b; }

/* Botão Flutuante WhatsApp (FAB) */
.zap-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: #22c55e;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    z-index: 2000;
}
.zap-fab:hover { transform: scale(1.1); background-color: #16a34a; }

/* Modal Ranking Flutuante */
.zap-ranking-modal {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 300px;
    background-color: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    z-index: 1999;
    padding: 16px;
    display: none;
    animation: slideUp 0.3s ease-out;
}
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.zap-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px; border-bottom: 1px solid #334155; padding-bottom: 8px;
}
.zap-header h3 { margin: 0; font-size: 16px; color: #22c55e; }
#close-zap-modal {
    background: none; border: none; color: #94a3b8; font-size: 24px;
    cursor: pointer; padding: 0; line-height: 1;
}
#close-zap-modal:hover { color: white; }

/* Badge de Contagem no Ícone WhatsApp */
.zap-count-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #2563eb; /* Azul */
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
    line-height: 1;
    border: 1px solid #0f172a; /* Borda escura para contraste */
    z-index: 10;
}

/* Responsividade */
@media (max-width: 1024px) {
  .container { padding: 12px; }
  .header-top-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .filter-bar { gap: 10px; }
  .filter-bar select { width: 100%; max-width: 100%; }
  .filter-bar input.date { width: 48%; }
  .button-group { width: 100%; justify-content: space-between; }
  .button-group button { flex-grow: 1; }
  button#export { width: 100%; }
  .grid, .grid.rankings.three-columns { grid-template-columns: 1fr; }
}