/* voting.css - リアルタイム投票ツール */

/* ── 共通レイアウト ── */
.voting-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

.voting-title {
  text-align: center;
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.voting-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

/* ── カード ── */
.voting-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.voting-card h2 {
  font-size: 1.05rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

/* ── 接続ステータス ── */
.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-weight: 600;
}

.connection-status.connected {
  background: #d1fae5;
  color: #065f46;
}

.connection-status.disconnected {
  background: #fee2e2;
  color: #991b1b;
}

.connection-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ── 参加者数バッジ ── */
.participant-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.9rem;
  font-weight: 600;
}

/* ── 質問フォーム ── */
.option-input-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  align-items: center;
}

.option-input-row input {
  flex: 1;
}

.btn-remove-option {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.6rem;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}

.btn-remove-option:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

.btn-add-option {
  background: none;
  border: 1.5px dashed var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  width: 100%;
  margin-top: 0.25rem;
}

.btn-add-option:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: none;
}

/* ── 投票コントロール ── */
.voting-controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.voting-controls button {
  flex: 1;
  min-width: 120px;
  padding: 0.75rem 1rem;
}

/* ── 結果グラフ ── */
.result-option-row {
  margin-bottom: 1rem;
}

.result-option-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.result-vote-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
}

.result-bar-track {
  height: 28px;
  background: var(--bg-muted);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
}

.result-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-md);
  transition: width 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 0.5rem;
}

.result-bar-fill.winner {
  background: var(--success, #10b981);
}

.result-bar-pct {
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
  opacity: 0;
  transition: opacity 0.3s ease 0.3s;
  white-space: nowrap;
}

.result-bar-fill.visible .result-bar-pct {
  opacity: 1;
}

.result-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 0;
  font-size: 0.95rem;
}

/* ── 勝者ハイライト（終了後） ── */
.result-option-row.is-winner .result-option-label {
  color: var(--success, #10b981);
}

.result-option-row.is-winner::before {
  content: '🏆 ';
}

/* ── 共有カード ── */
.share-info-row {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.share-url-block {
  flex: 1;
  min-width: 200px;
}

.share-url-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  font-weight: 600;
}

.share-url-copy {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.share-url-input {
  flex: 1;
  font-size: 0.85rem;
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  color: var(--text-muted);
}

.btn-copy-url {
  background: var(--primary);
  color: white;
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

.btn-copy-url:hover {
  background: var(--primary-hover);
}

#voting-qrcode {
  width: 100px;
  height: 100px;
  flex-shrink: 0;
}

#voting-qrcode img,
#voting-qrcode canvas {
  width: 100px !important;
  height: 100px !important;
}

/* ── 投票状態バナー ── */
.voting-status-banner {
  text-align: center;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.voting-status-banner.open {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.voting-status-banner.closed {
  background: var(--bg-muted);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.voting-status-banner.finished {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* ── 参加者ページ ── */
.participant-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

.participant-status-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  margin-bottom: 1rem;
}

.participant-status-icon {
  font-size: 3.5rem;
  margin-bottom: 0.75rem;
}

.participant-question {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.participant-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.btn-vote-option {
  width: 100%;
  padding: 1rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  background: var(--bg-muted);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-main);
  text-align: left;
  transition: all 0.15s ease;
}

.btn-vote-option:hover:not(:disabled) {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, var(--card-bg));
  color: var(--primary);
  transform: translateY(-1px);
}

.btn-vote-option.selected {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, var(--card-bg));
  color: var(--primary);
}

.btn-vote-option.winner-opt {
  border-color: var(--success, #10b981);
  background: color-mix(in srgb, #10b981 10%, var(--card-bg));
  color: var(--success, #10b981);
}

.btn-vote-option:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

/* 参加者ページの結果バー */
.participant-result-bar-track {
  height: 8px;
  background: var(--bg-muted);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.4rem;
}

.participant-result-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.5s ease;
}

.participant-result-bar-fill.winner {
  background: var(--success, #10b981);
}

.participant-vote-pct {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  text-align: right;
}

/* ── hidden ── */
.hidden {
  display: none !important;
}
