/* Purple Voice — Widget Styles */

/* ─── HEADER / LOGO FIX ───────────────────────────────────── */

header.sticky .q_logo img,
.header_top_bottom_holder .q_logo img,
.sticky_header .q_logo img,
header .q_logo a img {
  max-height: 45px !important;
  width: auto !important;
  padding: 8px 0 !important;
  object-fit: contain !important;
}

/* ─── COMMON ──────────────────────────────────────────────── */

[data-pv-widget] {
  font-family: system-ui, -apple-system, sans-serif;
  color: #1a1a2e;
  margin: 1.5em 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
[data-pv-widget] > div { padding: 1em; }
[data-pv-widget] * { box-sizing: border-box; }
[data-pv-widget] h3 { font-size: 1.2em; font-weight: 700; margin: 0 0 0.5em; color: #1a1a2e; }
[data-pv-widget] h4 { font-size: 1.05em; font-weight: 600; margin: 1em 0 0.5em; color: #333; }
.pv-w-subtitle { color: #666; margin: -0.3em 0 0.8em; font-size: 0.85em; }
.pv-w-loading { text-align: center; padding: 2em; color: #999; }
.pv-w-error { text-align: center; padding: 1.5em; color: #b91c1c; background: #fef2f2; border-radius: 8px; }
.pv-w-empty { text-align: center; padding: 1.5em; color: #666; }

/* ─── SCROLL CONTAINER ────────────────────────────────────── */

.pv-w-scroll {
  max-height: 280px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  scrollbar-width: thin;
  scrollbar-color: #c4b5d4 transparent;
}
.pv-w-scroll::-webkit-scrollbar { width: 5px; }
.pv-w-scroll::-webkit-scrollbar-track { background: transparent; }
.pv-w-scroll::-webkit-scrollbar-thumb { background: #c4b5d4; border-radius: 3px; }
.pv-w-scroll::-webkit-scrollbar-thumb:hover { background: #4A1A6B; }

/* Ensure widget content areas are always contained */
.pv-w-votes-list,
.pv-w-bills-list,
.pv-w-absent-list,
.pv-w-pulse-list,
.pv-w-delegation-content,
.pv-w-compare-result {
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #c4b5d4 transparent;
}
.pv-w-bill-detail { max-height: 300px; overflow-y: auto; }

/* ─── TABS ────────────────────────────────────────────────── */

.pv-w-tabs { display: flex; gap: 4px; margin-bottom: 1em; border-bottom: 2px solid #e5e7eb; padding-bottom: 0; }
.pv-w-tab { padding: 5px 12px; border: none; background: none; cursor: pointer; font-size: 0.8em; font-weight: 500; color: #666; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s; }
.pv-w-tab:hover { color: #4A1A6B; }
.pv-w-tab--active { color: #4A1A6B; border-bottom-color: #4A1A6B; font-weight: 600; }

/* ─── BADGES ──────────────────────────────────────────────── */

.pv-w-badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 0.8em; font-weight: 600; }
.pv-w-badge--yea { background: #dcfce7; color: #166534; }
.pv-w-badge--nay { background: #fee2e2; color: #991b1b; }
.pv-w-badge--not-voting { background: #f3f4f6; color: #6b7280; }
.pv-w-badge--present { background: #fef3c7; color: #92400e; }

/* ─── SEARCH ──────────────────────────────────────────────── */

.pv-w-search-input, .pv-w-state-search, .pv-w-picker-input {
  width: 100%; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 6px;
  font-size: 0.9em; outline: none; transition: border-color 0.15s;
}
.pv-w-search-input:focus, .pv-w-state-search:focus, .pv-w-picker-input:focus { border-color: #4A1A6B; }

/* ─── [rep-votes] ─────────────────────────────────────────── */

.pv-w-header { display: flex; justify-content: space-between; align-items: center; gap: 1em; flex-wrap: wrap; }
.pv-w-header h3 { margin: 0; }
.pv-w-search { flex: 0 1 250px; }

.pv-w-vote-header { display: grid; grid-template-columns: 80px 70px 1fr 65px 130px; gap: 6px; padding: 6px 10px; background: #f9fafb; border-radius: 6px 6px 0 0; font-weight: 600; font-size: 0.72em; color: #6b7280; text-transform: uppercase; }
.pv-w-vote-row { display: grid; grid-template-columns: 80px 70px 1fr 65px 130px; gap: 6px; padding: 6px 10px; border-bottom: 1px solid #f3f4f6; align-items: center; font-size: 0.82em; transition: background 0.1s; }
.pv-w-vote-row--wide { grid-template-columns: 150px 80px 70px 1fr 65px 130px; }
.pv-w-vote-row--wide ~ .pv-w-vote-header { grid-template-columns: 180px 100px 80px 1fr 80px 150px; }
.pv-w-vote-member { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.pv-w-mini-photo { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.pv-w-vote-party { color: #6b7280; font-size: 0.85em; font-weight: 400; }
.pv-w-vote-row:hover { background: #f9fafb; }
.pv-w-vote-date { color: #6b7280; font-size: 0.85em; }
.pv-w-vote-bill { font-weight: 600; }
.pv-w-bill-link { color: #4A1A6B; text-decoration: none; }
.pv-w-bill-link:hover { text-decoration: underline; color: #7B3FA0; }
.pv-w-vote-question { color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-w-vote-result { color: #6b7280; font-size: 0.85em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pv-w-pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 1em; padding-top: 1em; border-top: 1px solid #e5e7eb; }
.pv-w-page-info { color: #6b7280; font-size: 0.85em; }
.pv-w-page-buttons { display: flex; gap: 8px; }
.pv-w-page-btn { padding: 6px 16px; border: 1px solid #d1d5db; background: white; border-radius: 6px; cursor: pointer; font-size: 0.85em; transition: all 0.15s; }
.pv-w-page-btn:hover { background: #4A1A6B; color: white; border-color: #4A1A6B; }

/* ─── [rep-bills] ─────────────────────────────────────────── */

.pv-w-bill-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-bottom: 1px solid #f3f4f6; font-size: 0.85em; }
.pv-w-bill-row:hover { background: #f9fafb; }
.pv-w-bill-id { font-weight: 700; color: #4A1A6B; min-width: 80px; }
.pv-w-bill-meta { flex: 1; display: flex; gap: 8px; color: #6b7280; font-size: 0.8em; }
.pv-w-bill-expand { padding: 4px 10px; border: 1px solid #4A1A6B; color: #4A1A6B; background: white; border-radius: 4px; cursor: pointer; font-size: 0.75em; font-weight: 500; transition: all 0.15s; }
.pv-w-bill-expand:hover { background: #4A1A6B; color: white; }

/* ─── SPLIT BARS ──────────────────────────────────────────── */

.pv-w-split { padding: 1.5em; background: #f9fafb; border-radius: 8px; margin-top: 1em; }
.pv-w-split h4 { margin-top: 0; }
.pv-w-split-bars { display: flex; flex-direction: column; gap: 12px; margin: 1em 0; }
.pv-w-split-bar { display: flex; align-items: center; gap: 12px; }
.pv-w-split-label { min-width: 80px; font-weight: 600; font-size: 0.9em; }
.pv-w-split-count { font-size: 0.8em; color: #6b7280; min-width: 80px; }
.pv-w-bar { flex: 1; height: 24px; background: #e5e7eb; border-radius: 4px; display: flex; overflow: hidden; }
.pv-w-bar-d { background: #2563eb; transition: width 0.3s; }
.pv-w-bar-r { background: #dc2626; transition: width 0.3s; }

.pv-w-voter-list { margin-top: 1em; }
.pv-w-voter-list summary { cursor: pointer; color: #4A1A6B; font-weight: 500; }
.pv-w-voter-grid { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.pv-w-voter { padding: 2px 8px; border-radius: 4px; font-size: 0.75em; }
.pv-w-voter--yea { background: #dcfce7; color: #166534; }
.pv-w-voter--nay { background: #fee2e2; color: #991b1b; }
.pv-w-voter--not-voting { background: #f3f4f6; color: #6b7280; }

/* ─── [rep-absent] ────────────────────────────────────────── */

.pv-w-absent-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #f3f4f6; font-size: 0.85em; }
.pv-w-rank { font-weight: 700; color: #6b7280; min-width: 24px; text-align: center; font-size: 0.8em; }
.pv-w-thumb { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.pv-w-thumb-placeholder { width: 30px; height: 30px; border-radius: 50%; background: #e5e7eb; }
.pv-w-absent-info { flex: 1; }
.pv-w-absent-info strong { display: block; font-size: 0.9em; }
.pv-w-absent-info span { font-size: 0.75em; color: #6b7280; }
.pv-w-absent-stats { text-align: right; min-width: 110px; }
.pv-w-missed { font-weight: 700; color: #b91c1c; display: block; font-size: 0.85em; }
.pv-w-attendance { font-size: 0.7em; color: #6b7280; }
.pv-w-attendance-bar { height: 3px; background: #e5e7eb; border-radius: 2px; margin-top: 3px; }
.pv-w-attendance-bar div { height: 100%; background: #4A1A6B; border-radius: 2px; transition: width 0.3s; }

/* ─── [rep-pulse] ─────────────────────────────────────────── */

.pv-w-pulse-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid #f3f4f6; font-size: 0.85em; }
.pv-w-pulse-margin { text-align: center; min-width: 40px; }
.pv-w-margin-num { display: block; font-size: 1.3em; font-weight: 800; color: #4A1A6B; }
.pv-w-margin-label { font-size: 0.6em; color: #999; text-transform: uppercase; }
.pv-w-pulse-info { flex: 1; }
.pv-w-pulse-info strong { display: block; font-size: 0.9em; }
.pv-w-pulse-info span { font-size: 0.8em; color: #6b7280; }
.pv-w-pulse-info time { font-size: 0.75em; color: #999; }
.pv-w-pulse-tally { display: flex; gap: 8px; min-width: 100px; font-size: 0.85em; }
.pv-w-tally-yea { color: #166534; font-weight: 600; }
.pv-w-tally-nay { color: #991b1b; font-weight: 600; }

/* ─── [rep-compare] ───────────────────────────────────────── */

.pv-w-compare-pickers { display: flex; align-items: center; gap: 16px; margin-bottom: 1.5em; }
.pv-w-picker { flex: 1; position: relative; }
.pv-w-vs { font-weight: 700; color: #4A1A6B; font-size: 1.2em; }
.pv-w-picker-results { position: absolute; top: 100%; left: 0; right: 0; background: white; border: 1px solid #d1d5db; border-radius: 0 0 6px 6px; z-index: 10; max-height: 200px; overflow-y: auto; }
.pv-w-picker-option { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; font-size: 0.9em; }
.pv-w-picker-option:hover { background: #f3f4f6; }
.pv-w-picker-option img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.pv-w-compare-cards { display: flex; align-items: center; gap: 1em; justify-content: center; }
.pv-w-compare-card { flex: 1; max-width: 250px; }
.pv-w-compare-score { text-align: center; }
.pv-w-score-circle { width: 80px; height: 80px; border-radius: 50%; background: linear-gradient(135deg, #4A1A6B, #7B3FA0); color: white; display: flex; align-items: center; justify-content: center; font-size: 1.4em; font-weight: 800; margin: 0 auto 8px; }
.pv-w-compare-score span { display: block; font-size: 0.8em; color: #6b7280; }
.pv-w-compare-detail { display: flex; justify-content: center; gap: 2em; margin-top: 1em; color: #6b7280; }

/* ─── MEMBER CARD ─────────────────────────────────────────── */

.pv-w-member-card { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid #e5e7eb; border-radius: 6px; background: white; text-decoration: none; color: inherit; transition: all 0.15s; }
.pv-w-member-card:hover { box-shadow: 0 2px 6px rgba(0,0,0,0.08); border-color: #4A1A6B; }
.pv-w-vote-member { text-decoration: none; color: inherit; }
.pv-w-vote-member:hover strong, .pv-w-vote-member:hover span { color: #4A1A6B; }
.pv-w-absent-link { display: flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; flex: 1; }
.pv-w-absent-link:hover strong { color: #4A1A6B; }
.pv-w-member-photo { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.pv-w-member-info { flex: 1; }
.pv-w-member-info strong { display: block; font-size: 0.82em; }
.pv-w-member-meta { display: block; font-size: 0.72em; color: #6b7280; }
.pv-w-member-role { display: block; font-size: 0.68em; color: #4A1A6B; }
.pv-w-member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }

/* ─── [rep-delegation] ────────────────────────────────────── */

.pv-w-delegation-summary { display: flex; gap: 12px; align-items: center; margin-bottom: 1em; flex-wrap: wrap; }
.pv-w-delegation-summary span { font-size: 0.9em; color: #6b7280; }
.pv-w-party-chip { padding: 2px 10px; border-radius: 12px; font-weight: 600; font-size: 0.8em; }
.pv-w-party-d { background: #dbeafe; color: #1e40af; }
.pv-w-party-r { background: #fee2e2; color: #991b1b; }
.pv-w-party-i { background: #f3f4f6; color: #374151; }

/* ─── [rep-directory] ─────────────────────────────────────── */

.pv-w-dir-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.pv-w-dir-search { flex: 1; min-width: 180px; padding: 7px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.85em; outline: none; }
.pv-w-dir-search:focus { border-color: #4A1A6B; }
.pv-w-dir-filters { display: flex; gap: 3px; align-items: center; }
.pv-w-dir-sep { color: #d1d5db; margin: 0 4px; }
.pv-w-dir-btn { padding: 4px 10px; border: 1px solid #d1d5db; background: #fff; border-radius: 4px; cursor: pointer; font-size: 0.75em; font-weight: 500; transition: all 0.15s; color: #555; }
.pv-w-dir-btn:hover { border-color: #4A1A6B; color: #4A1A6B; }
.pv-w-dir-btn--active { background: #4A1A6B; color: #fff !important; border-color: #4A1A6B; }
.pv-w-dir-btn--d.pv-w-dir-btn--active { background: #2563eb; border-color: #2563eb; }
.pv-w-dir-btn--r.pv-w-dir-btn--active { background: #dc2626; border-color: #dc2626; }
.pv-w-dir-btn--i.pv-w-dir-btn--active { background: #6b7280; border-color: #6b7280; }
.pv-w-dir-count { font-size: 0.8em; color: #6b7280; white-space: nowrap; }

.pv-w-dir-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }

.pv-w-dir-card { display: flex; flex-direction: column; align-items: center; padding: 12px 8px; border-radius: 8px; background: #fff; border: 1px solid #e5e7eb; text-decoration: none; color: inherit; text-align: center; transition: all 0.15s; }
.pv-w-dir-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); transform: translateY(-2px); border-color: #c4b5d4; }
.pv-w-dir-card--d { border-left: 3px solid #2563eb; }
.pv-w-dir-card--r { border-left: 3px solid #dc2626; }
.pv-w-dir-card--i { border-left: 3px solid #6b7280; }

.pv-w-dir-photo { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; margin-bottom: 6px; }
.pv-w-dir-photo--empty { width: 56px; height: 56px; border-radius: 50%; background: #e5e7eb; margin-bottom: 6px; }

.pv-w-dir-info { display: flex; flex-direction: column; gap: 1px; }
.pv-w-dir-info strong { font-size: 0.78em; line-height: 1.2; }
.pv-w-dir-party { font-size: 0.7em; font-weight: 700; }
.pv-w-dir-card--d .pv-w-dir-party { color: #2563eb; }
.pv-w-dir-card--r .pv-w-dir-party { color: #dc2626; }
.pv-w-dir-card--i .pv-w-dir-party { color: #6b7280; }
.pv-w-dir-state { font-size: 0.68em; color: #6b7280; }
.pv-w-dir-role { font-size: 0.65em; color: #4A1A6B; }

.pv-w-dir-paging { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid #e5e7eb; font-size: 0.82em; color: #6b7280; }

/* ─── RESPONSIVE ──────────────────────────────────────────── */

@media (max-width: 768px) {
  .pv-w-vote-header, .pv-w-vote-row { grid-template-columns: 80px 60px 1fr 70px; }
  .pv-w-vote-result { display: none; }
  .pv-w-header { flex-direction: column; }
  .pv-w-search { flex: 1 1 100%; }
  .pv-w-compare-pickers { flex-direction: column; }
  .pv-w-compare-cards { flex-direction: column; }
  .pv-w-vs { display: none; }
  .pv-w-bill-row { flex-direction: column; align-items: flex-start; }
  .pv-w-pulse-row { flex-wrap: wrap; }
  .pv-w-member-grid { grid-template-columns: 1fr; }
}
