/* Smart Polls — Profile Analytics (frontend) */

.sp-pa-wrap {
  font-family: inherit;
  color: #111827;
  line-height: 1.5;
}

/* ── Filter bar ─────────────────────────────────────────── */
.sp-pa-filter {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.sp-pa-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.sp-pa-fg {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sp-pa-fg label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #6b7280;
}

.sp-pa-fg select,
.sp-pa-fg input[type="date"] {
  height: 34px;
  padding: 0 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  min-width: 135px;
  outline: none;
}

.sp-pa-fg select:focus,
.sp-pa-fg input:focus { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.15); }

#sp-pa-custom-dates {
  display: none;
  gap: 8px;
  align-items: flex-end;
}

.sp-pa-filter-sep { font-size: 12px; color: #9ca3af; padding-bottom: 8px; }

.sp-pa-days-row {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.sp-pa-days-row .sp-pa-days-lbl {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #6b7280;
  margin-right: 4px;
}

.sp-pa-day {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  cursor: pointer;
  padding: 3px 10px;
  border: 1px solid #d1d5db;
  border-radius: 20px;
  background: #fff;
  transition: all .15s;
  user-select: none;
}

.sp-pa-day:has(input:checked),
.sp-pa-day.checked {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.sp-pa-day input { display: none; }

.sp-pa-apply {
  height: 34px;
  padding: 0 18px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-end;
  transition: background .15s;
  white-space: nowrap;
}

.sp-pa-apply:hover { background: #1d4ed8; }

/* ── Loading ─────────────────────────────────────────────── */
.sp-pa-loading {
  display: none;
  text-align: center;
  padding: 30px 0;
}

.sp-pa-spinner {
  display: inline-block;
  width: 36px;
  height: 36px;
  border: 3px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: sp-pa-spin .7s linear infinite;
}

@keyframes sp-pa-spin { to { transform: rotate(360deg); } }

/* ── Summary cards ──────────────────────────────────────── */
.sp-pa-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

@media (max-width: 860px) { .sp-pa-stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .sp-pa-stats { grid-template-columns: 1fr; } }

.sp-pa-stat {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 18px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  position: relative;
  overflow: hidden;
}

.sp-pa-stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 12px 12px 0 0;
}

.sp-pa-stat.c-blue::before   { background: #2563eb; }
.sp-pa-stat.c-green::before  { background: #22c55e; }
.sp-pa-stat.c-orange::before { background: #f59e0b; }
.sp-pa-stat.c-purple::before { background: #8b5cf6; }

.sp-pa-stat-icon  { font-size: 20px; margin-bottom: 6px; }
.sp-pa-stat-val   { font-size: 28px; font-weight: 700; color: #111827; line-height: 1; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-pa-stat-lbl   { font-size: 11px; color: #6b7280; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }

/* ── Charts grid ─────────────────────────────────────────── */
.sp-pa-charts-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

@media (max-width: 700px) { .sp-pa-charts-2 { grid-template-columns: 1fr; } }

.sp-pa-chart-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.sp-pa-chart-title {
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.sp-pa-canvas-wrap {
  position: relative;
  height: 240px;
}

.sp-pa-canvas-wrap.tall { height: 280px; }

.sp-pa-pie-select {
  width: 100%;
  margin-bottom: 10px;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 12px;
  background: #f9fafb;
}

/* ── Table card ─────────────────────────────────────────── */
.sp-pa-table-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  margin-bottom: 4px;
}

.sp-pa-table-head {
  padding: 16px 18px 12px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 7px;
}

#sp-pa-table-wrap { padding: 0; }

.sp-pa-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.sp-pa-table thead th {
  background: #f9fafb;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: #6b7280;
  padding: 9px 14px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

.sp-pa-table tbody td {
  padding: 10px 14px;
  vertical-align: middle;
  border-bottom: 1px solid #f3f4f6;
}

.sp-pa-table tbody tr:last-child td { border-bottom: none; }

.sp-pa-your-pick {
  font-weight: 700;
  color: #2563eb;
}

.sp-pa-correct-pick { font-weight: 700; color: #16a34a; }
.sp-pa-wrong-pick   { font-weight: 700; color: #dc2626; }

.sp-pa-bar-wrap  { background: #f3f4f6; border-radius: 99px; height: 7px; overflow: hidden; min-width: 90px; }
.sp-pa-bar-fill  { height: 100%; border-radius: 99px; background: #d1d5db; }
.sp-pa-bar-fill.your  { background: #2563eb; }
.sp-pa-bar-fill.correct { background: #22c55e; }
.sp-pa-bar-fill.wrong   { background: #ef4444; }

.sp-pa-vis-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}

.sp-pa-vis-badge.public  { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.sp-pa-vis-badge.private { background: #f5f3ff; color: #6d28d9; border: 1px solid #ddd6fe; }

.sp-pa-no-data {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
  font-size: 14px;
}
