/* ============================================================
   COMPONENTS.CSS — Componentes Adicionais do Dashboard
   ============================================================ */

/* --- DataTables Override (dark theme) --- */
.dataTables_wrapper {
  color: var(--text-primary);
  font-size: 0.84rem;
}

.dataTables_filter input,
.dataTables_length select {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-sm) !important;
  padding: 5px 10px !important;
  outline: none !important;
}

.dataTables_info,
.dataTables_filter label,
.dataTables_length label { color: var(--text-secondary); }

.dataTables_paginate .paginate_button {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-secondary) !important;
  border-radius: var(--radius-sm) !important;
  padding: 4px 10px !important;
  margin: 0 2px !important;
}

.dataTables_paginate .paginate_button.current,
.dataTables_paginate .paginate_button:hover {
  background: var(--blue) !important;
  border-color: var(--blue) !important;
  color: #fff !important;
}

/* --- Flatpickr Override --- */
.flatpickr-calendar {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow) !important;
}

.flatpickr-day {
  color: var(--text-primary) !important;
  border-radius: var(--radius-sm) !important;
}

.flatpickr-day:hover,
.flatpickr-day.selected {
  background: var(--blue) !important;
  border-color: var(--blue) !important;
  color: #fff !important;
}

.flatpickr-day.inRange {
  background: rgba(24,119,242,0.2) !important;
  border-color: transparent !important;
}

.flatpickr-months, .flatpickr-weekdays {
  background: var(--bg-surface) !important;
  color: var(--text-secondary) !important;
}

.flatpickr-month, .flatpickr-weekday,
.flatpickr-current-month input,
.flatpickr-current-month select,
.numInputWrapper { color: var(--text-primary) !important; }

.flatpickr-prev-month svg, .flatpickr-next-month svg { fill: var(--text-secondary) !important; }

/* --- Miniatura de Criativo --- */
.creative-thumb {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

.creative-thumb-placeholder {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* --- Hook Rate / Video Progress Bar --- */
.progress-bar-wrap {
  width: 100%;
  background: var(--bg-surface);
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  transition: width 0.8s ease;
}

.progress-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 3px;
}

/* --- Semáforo de Métricas --- */
.metric-light {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.84rem;
  font-weight: 600;
}

.metric-light::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.metric-green::before  { background: var(--green); }
.metric-yellow::before { background: var(--yellow); }
.metric-red::before    { background: var(--red); }

/* --- Heatmap --- */
.heatmap-grid {
  display: grid;
  gap: 3px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.heatmap-cell {
  min-width: 80px;
  padding: 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  cursor: default;
}

.heat-5 { background: rgba(0,200,81,0.8); color: #000; }
.heat-4 { background: rgba(0,200,81,0.5); color: var(--text-primary); }
.heat-3 { background: rgba(255,179,0,0.5); color: var(--text-primary); }
.heat-2 { background: rgba(249,115,22,0.5); color: var(--text-primary); }
.heat-1 { background: rgba(255,68,68,0.5); color: var(--text-primary); }
.heat-0 { background: var(--bg-surface); color: var(--text-muted); }

/* --- Badge Top Criativo --- */
.badge-top {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* --- Badge Fadiga --- */
.badge-fatigue {
  background: rgba(255,68,68,0.15);
  color: var(--red);
  border: 1px solid rgba(255,68,68,0.3);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 12px;
}

/* --- Confidence Badge (Associação FB×CRM) --- */
.conf-alta     { color: var(--green);  font-weight: 600; font-size: 0.75rem; }
.conf-media    { color: var(--yellow); font-weight: 600; font-size: 0.75rem; }
.conf-estimada { color: var(--orange); font-weight: 600; font-size: 0.75rem; }
.conf-nenhuma  { color: var(--text-muted); font-size: 0.75rem; }

/* --- Table Action Buttons --- */
.btn-action {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-action:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: rgba(24,119,242,0.08);
}

/* --- Empty State --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  color: var(--text-muted);
  gap: 12px;
}

.empty-state i { font-size: 2.5rem; opacity: 0.4; }
.empty-state p { font-size: 0.9rem; text-align: center; max-width: 300px; }

/* --- Drawer Detalhes --- */
.drawer-section {
  margin-bottom: 22px;
}

.drawer-section h4 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.drawer-kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.drawer-kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.drawer-kpi .label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.drawer-kpi .value {
  font-size: 1.1rem;
  font-weight: 700;
}

/* --- Alert Cards no Dashboard --- */
.alert-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.83rem;
  line-height: 1.5;
  transition: background var(--transition);
}

.alert-card:hover { background: var(--bg-hover); }

.alert-card i { margin-top: 1px; }
.alert-text { flex: 1; color: var(--text-secondary); }
.alert-time { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }

/* --- Scrollbars customizadas --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* --- Spin animation --- */
@keyframes spin { to { transform: rotate(360deg); } }
.fa-spin { animation: spin 1s linear infinite; }

/* --- Tooltip simples --- */
[data-tooltip] { position: relative; cursor: help; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 0.75rem;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 999;
  max-width: 240px;
  white-space: normal;
  text-align: center;
}

[data-tooltip]:hover::after { opacity: 1; }
