/* ============================================================
 *  Peerly — Poll Message Bubble
 *  v1.0.0
 * ============================================================ */

.poll-bubble {
  padding: 14px 16px;
  min-width: 240px;
  max-width: 340px;
  cursor: default;
}

.poll-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  opacity: 0.65;
}
.poll-header i { font-size: 13px; line-height: 1; }

.poll-question {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 12px;
  word-break: break-word;
}

.poll-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.poll-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid;
  cursor: pointer;
  overflow: hidden;
  transition:
    border-color 150ms var(--md-sys-motion-easing-standard),
    background 150ms var(--md-sys-motion-easing-standard),
    transform 100ms var(--md-sys-motion-easing-standard);
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  min-height: 40px;
  background: transparent;
}
.poll-option:active { transform: scale(0.98); }

/* Fill de progression (derrière le texte) */
.poll-option-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  transition: width 400ms cubic-bezier(0.22, 1.2, 0.36, 1);
  pointer-events: none;
}

.poll-option-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.poll-option-text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
  font-weight: 500;
}

.poll-option-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  opacity: 0.75;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.poll-option-check {
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 150ms;
}
.poll-option.voted .poll-option-check { opacity: 1; }

/* ---------- Sent (par moi) ---------- */
.chat-bubble.sent .poll-option {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--md-sys-color-on-primary);
}
.chat-bubble.sent .poll-option:hover {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.10);
}
.chat-bubble.sent .poll-option.voted {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.14);
}
.chat-bubble.sent .poll-option-fill {
  background: rgba(255, 255, 255, 0.10);
}

/* ---------- Received ---------- */
.chat-bubble.received .poll-option {
  border-color: var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}
.chat-bubble.received .poll-option:hover {
  border-color: var(--md-sys-color-outline);
  background: var(--md-sys-color-surface-container-highest);
}
.chat-bubble.received .poll-option.voted {
  border-color: var(--md-sys-color-primary);
  background: color-mix(in srgb, var(--md-sys-color-primary) 12%, var(--md-sys-color-surface-container-high));
}
.chat-bubble.received .poll-option.voted .poll-option-text {
  color: var(--md-sys-color-primary);
  font-weight: 600;
}
.chat-bubble.received .poll-option-fill {
  background: color-mix(in srgb, var(--md-sys-color-primary) 18%, transparent);
}

/* ---------- Footer ---------- */
.poll-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid;
  font-size: 11px;
  opacity: 0.7;
}
.chat-bubble.sent .poll-footer { border-color: rgba(255, 255, 255, 0.15); }
.chat-bubble.received .poll-footer { border-color: var(--md-sys-color-outline-variant); }

.poll-total {
  font-weight: 600;
}

.poll-hint {
  font-style: italic;
  font-size: 10px;
}

@media (max-width: 599px) {
  .poll-bubble { min-width: 200px; max-width: 280px; padding: 12px 14px; }
  .poll-question { font-size: 13px; }
  .poll-option { padding: 8px 10px; font-size: 12px; min-height: 36px; }
}