/**
 * REPRESENTATIVE CARDS
 * Version: 37.11.4-PHASE3C
 * Date: 2025-01-14
 * 
 * Representative/politician profile cards with photos, contact info,
 * voting analysis, topic breakdowns, and recent votes display.
 * 
 * Dependencies:
 * - variables.css (design tokens)
 * - buttons.css (button styles)
 * 
 * Components:
 * - .representative-card - Main card container
 * - .rep-header - Photo and basic info section
 * - .rep-photo - Representative photo (circular)
 * - .rep-basic-info - Name, party, district
 * - .rep-contact - Contact links (phone, email, website)
 * - .voting-analysis - Voting pattern charts
 * - .topic-breakdown - Topic-by-topic voting analysis
 * - .recent-votes - Recent vote history
 * - .vote-item - Individual vote display
 * 
 * Features:
 * - Responsive layout (stacked on mobile, side-by-side on desktop)
 * - Interactive charts and progress bars
 * - Hover effects for engagement
 * - Touch-friendly contact buttons (44px minimum)
 */

/* ============================================
   REPRESENTATIVE CARDS
   ============================================ */

.rep-photo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary);
  flex-shrink: 0;
  margin: 0 auto;
}

@media (min-width: 480px) {
  .rep-photo {
    margin: 0;
  }
}

@media (min-width: 768px) {
  .rep-photo {
    width: 120px;
    height: 120px;
  }
}

.rep-party {
  color: var(--text-secondary);
  font-weight: var(--font-weight-medium);
  margin: 0 0 var(--space-xs) 0;
  font-size: var(--font-size-sm);
}

@media (min-width: 768px) {
  .rep-party {
    font-size: var(--font-size-base);
  }
}

.rep-district {
  color: var(--text-light);
  margin: 0 0 var(--space-md) 0;
  font-size: var(--font-size-sm);
}

.rep-contact {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  margin-top: var(--space-md);
}

@media (min-width: 480px) {
  .rep-contact {
    justify-content: flex-start;
  }
}

.contact-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--background);
  border-radius: 50%;
  color: var(--primary);
  text-decoration: none;
  transition: all var(--transition-fast);
  font-size: var(--font-size-lg);
}

.contact-link:hover {
  background: var(--primary);
  color: white;
  transform: scale(1.1);
}

.vote-yes {
  background: rgba(82, 196, 26, 0.1);
  color: var(--success);
}

.vote-no {
  background: rgba(255, 77, 79, 0.1);
  color: var(--error);
}

.vote-date {
  color: var(--text-light);
  font-size: var(--font-size-xs);
  margin: 0 0 var(--space-sm) 0;
}

@media (min-width: 768px) {
  .vote-date {
    font-size: var(--font-size-sm);
  }
}

.bill-summary {
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
  margin: 0 0 var(--space-sm) 0;
  font-size: var(--font-size-sm);
}

@media (min-width: 768px) {
  .bill-summary {
    font-size: var(--font-size-sm);
  }
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
  padding: var(--space-xs) 0;
  transition: color var(--transition-fast);
  min-height: 44px;
  justify-content: center;
}

@media (min-width: 480px) {
  .btn-link {
    justify-content: flex-start;
  }
}

@media (min-width: 768px) {
  .btn-link {
    font-size: var(--font-size-base);
  }
}

.btn-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.btn-link i {
  font-size: 0.9em;
}

/* --------------------------------------------------------------------------
   Representatives tab — cards from `js/modules/representatives.mjs`
   Scoped under `.representatives-display` so legacy civic finder styles
   elsewhere are unaffected.
   -------------------------------------------------------------------------- */
.representatives-display .rep-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem;
  border-radius: 12px;
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.representatives-display .rep-card:hover {
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--accent-purple) 35%, var(--border-light));
}

.representatives-display .rep-avatar {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 50%;
  background: var(--accent-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  letter-spacing: 0.02em;
}

.representatives-display .rep-avatar-wrap {
  width: 48px;
  height: 48px;
  min-width: 48px;
  flex-shrink: 0;
  position: relative;
}

.representatives-display .rep-avatar-wrap .rep-avatar-fallback {
  position: absolute;
  inset: 0;
  width: 48px;
  height: 48px;
  min-width: 48px;
  display: none;
  align-items: center;
  justify-content: center;
}

.representatives-display .rep-avatar-wrap .rep-avatar-fallback.show {
  display: flex;
}

.representatives-display .rep-avatar-placeholder-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  pointer-events: none;
}

.representatives-display .rep-avatar-img {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
  border: 1px solid var(--border-light);
}

.representatives-display .rep-info {
  flex: 1;
  min-width: 0;
}

.representatives-display .rep-info h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}

.representatives-display .rep-info .party {
  margin: 0 0 0.2rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.representatives-display .rep-info .district {
  margin: 0 0 0.35rem;
  font-size: 0.875rem;
  color: var(--text-light);
}

.representatives-display .rep-title-line {
  margin: 0 0 0.35rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.representatives-display .rep-contact {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.representatives-display .contact-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--primary);
  min-height: 40px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.representatives-display .contact-btn:hover {
  background: var(--primary);
  color: var(--text-inverse);
  border-color: var(--primary);
}

.representatives-display .ask-ai-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  min-height: 40px;
  background: var(--accent-purple);
  color: #fff;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.representatives-display .ask-ai-btn:hover {
  filter: brightness(1.06);
}

.representatives-display .ask-ai-btn:active {
  transform: scale(0.98);
}

@media (max-width: 480px) {
  .representatives-display .rep-card {
    flex-direction: column;
    align-items: stretch;
  }

  .representatives-display .rep-avatar,
  .representatives-display .rep-avatar-wrap,
  .representatives-display .rep-avatar-img {
    align-self: flex-start;
  }

  .representatives-display .rep-contact {
    flex-direction: column;
    align-items: stretch;
  }

  .representatives-display .contact-btn,
  .representatives-display .ask-ai-btn {
    width: 100%;
  }
}
