/* ============================================================================
   의정활동지수 v4.0 — Component Styles
   ============================================================================ */

/* ─── Legislator Photo Avatar ─── */
.leg-photo {
  width: 44px; height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--border-light);
  background: var(--bg-tertiary);
  transition: all var(--duration-fast);
}
.leg-photo:hover {
  border-color: var(--brand-300);
  box-shadow: 0 0 0 3px rgba(14, 135, 233, 0.08);
}
.leg-photo-sm {
  width: 36px; height: 36px;
}
.leg-photo-lg {
  width: 64px; height: 64px;
}
.leg-photo-xl {
  width: 96px; height: 96px;
  border-width: 3px;
}
.leg-photo-xxl {
  width: 120px; height: 120px;
  border-width: 3px;
}
/* Fallback avatar with initials */
.leg-avatar {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  font-weight: 800;
  font-size: 0.9375rem;
  color: #fff;
  border: 2px solid rgba(255,255,255,0.2);
  transition: all var(--duration-fast);
}
.leg-avatar-sm { width: 36px; height: 36px; font-size: 0.8125rem; }
.leg-avatar-lg { width: 64px; height: 64px; font-size: 1.25rem; }
.leg-avatar-xl { width: 96px; height: 96px; font-size: 1.75rem; border-width: 3px; }
.leg-avatar-xxl { width: 120px; height: 120px; font-size: 2rem; border-width: 3px; }

/* ─── Cards ─── */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
}
.card:hover {
  box-shadow: var(--shadow-md);
}
.card-interactive {
  cursor: pointer;
}
.card-interactive:hover {
  border-color: var(--brand-300);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}
[data-theme="dark"] .card-interactive:hover {
  border-color: var(--brand-600);
}
.card-compact {
  padding: var(--space-md);
  border-radius: var(--radius-md);
}
.card-flat {
  border: none;
  background: var(--bg-tertiary);
}
.card-accent {
  border-left: 3px solid var(--brand-500);
}

/* ─── Badge / Grade ─── */
.badge-img { width: 48px; height: 48px; object-fit: contain; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.15)); }
.badge-img-sm { width: 32px; height: 32px; }
.badge-img-lg { width: 64px; height: 64px; }
.badge-img-xl { width: 80px; height: 80px; }

.grade-badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-weight: 700; font-size: 0.7rem; letter-spacing: 0.04em;
  line-height: 1.4;
}
.grade-badge-lg {
  padding: 5px 14px; font-size: 0.8rem;
}

/* ─── Score Bar ─── */
.score-bar-track {
  height: 8px; background: var(--bg-tertiary);
  border-radius: var(--radius-full); overflow: hidden;
  position: relative;
}
.score-bar-fill {
  height: 100%; border-radius: var(--radius-full);
  transition: width 1s var(--ease-out);
  animation: progressFill 1s var(--ease-out);
  position: relative;
}
.score-bar-fill::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%);
  border-radius: inherit;
}

/* ─── Heart Button ─── */
.heart-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: var(--radius-full);
  border: 2px solid rgba(190, 24, 93, 0.2);
  background: rgba(190, 24, 93, 0.04);
  color: var(--score-likes);
  cursor: pointer; font-size: 0.875rem; font-weight: 600;
  transition: all var(--duration-normal) var(--ease-out);
  user-select: none;
  position: relative; overflow: hidden;
}
.heart-btn:hover {
  border-color: rgba(190, 24, 93, 0.4);
  background: rgba(190, 24, 93, 0.1);
  transform: scale(1.03);
}
.heart-btn:active { transform: scale(0.97); }
.heart-btn.hearted {
  border-color: var(--score-likes);
  background: rgba(190, 24, 93, 0.12);
}
.heart-btn.hearted .heart-icon { animation: heartBeat 0.6s ease-in-out; }
.heart-btn.disabled { opacity: 0.6; cursor: default; pointer-events: none; }
.heart-btn .heart-icon { font-size: 1.1em; transition: transform var(--duration-fast); }
.heart-btn:hover .heart-icon { transform: scale(1.15); }
.heart-count-animate { animation: countUp 0.3s var(--ease-out); }
.heart-float { 
  position: absolute; pointer-events: none; 
  font-size: 1.3rem; animation: heartFloat 1s ease-out forwards; 
}

/* ─── Navigation Links ─── */
.nav-link {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-md);
  font-size: 0.875rem; font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--duration-fast);
  white-space: nowrap;
  position: relative;
}
.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}
.nav-link.active {
  color: var(--brand-600);
  background: var(--brand-50);
  font-weight: 600;
}
[data-theme="dark"] .nav-link.active {
  color: var(--brand-400);
  background: rgba(14, 135, 233, 0.12);
}
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 50%; transform: translateX(-50%);
  width: 20px; height: 2px;
  background: var(--brand-500);
  border-radius: var(--radius-full);
  display: none;
}

/* ─── Tabs ─── */
.tab-btn {
  padding: 7px 14px; border-radius: var(--radius-md);
  font-size: 0.8125rem; font-weight: 500;
  color: var(--text-tertiary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--duration-fast);
  white-space: nowrap;
}
.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}
.tab-btn.active {
  color: var(--brand-600);
  background: var(--brand-50);
  border-color: var(--brand-200);
  font-weight: 600;
}
[data-theme="dark"] .tab-btn.active {
  color: var(--brand-400);
  background: rgba(14, 135, 233, 0.1);
  border-color: rgba(14, 135, 233, 0.2);
}

/* ─── Search Input ─── */
.search-input {
  width: 100%; padding: 12px 16px 12px 44px;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 0.9375rem; font-family: inherit;
  outline: none;
  transition: all var(--duration-fast);
}
.search-input:focus {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px rgba(14, 135, 233, 0.1);
}
.search-input::placeholder { color: var(--text-muted); }

/* ─── Filter Chips ─── */
.filter-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 14px; border-radius: var(--radius-full);
  font-size: 0.8125rem; font-weight: 500;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  background: var(--bg-elevated);
  cursor: pointer; white-space: nowrap;
  transition: all var(--duration-fast);
}
.filter-chip:hover {
  border-color: var(--brand-300);
  color: var(--brand-600);
}
.filter-chip.active {
  border-color: var(--brand-500);
  background: var(--brand-50);
  color: var(--brand-600);
  font-weight: 600;
}
[data-theme="dark"] .filter-chip.active {
  background: rgba(14, 135, 233, 0.12);
  color: var(--brand-400);
}

/* ─── Custom Select ─── */
.custom-select {
  padding: 8px 32px 8px 12px;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.8125rem; font-family: inherit;
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: all var(--duration-fast);
  min-width: 120px;
}
.custom-select:focus {
  border-color: var(--brand-400);
  outline: none;
  box-shadow: 0 0 0 3px rgba(14, 135, 233, 0.1);
}

/* ─── Pagination ─── */
.page-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  font-size: 0.8125rem; font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
  cursor: pointer;
  transition: all var(--duration-fast);
}
.page-btn:hover:not(:disabled) {
  color: var(--brand-600);
  border-color: var(--brand-300);
  background: var(--brand-50);
}
.page-btn.active {
  color: #fff;
  border-color: var(--brand-500);
  background: var(--brand-500);
  font-weight: 700;
}
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ─── Toast ─── */
.toast {
  padding: 14px 20px; border-radius: var(--radius-md);
  font-size: 0.875rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.3s var(--ease-out);
  max-width: 380px;
  display: flex; align-items: center; gap: 8px;
}
.toast-success { background: var(--success-light); border: 1px solid rgba(22, 163, 74, 0.2); color: var(--success); }
.toast-error { background: var(--danger-light); border: 1px solid rgba(220, 38, 38, 0.2); color: var(--danger); }
.toast-info { background: var(--info-light); border: 1px solid rgba(2, 132, 199, 0.2); color: var(--info); }
.toast-heart { background: rgba(190, 24, 93, 0.08); border: 1px solid rgba(190, 24, 93, 0.2); color: var(--score-likes); }

/* ─── Tooltip ─── */
.tooltip { position: relative; }
.tooltip::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  padding: 6px 12px; 
  background: var(--gray-800); color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.75rem; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity var(--duration-fast);
  z-index: 50;
  box-shadow: var(--shadow-md);
}
.tooltip:hover::after { opacity: 1; }

/* ─── Data Table ─── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 12px 16px; text-align: left;
  font-size: 0.75rem; font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 2px solid var(--border-default);
  background: var(--bg-tertiary);
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.875rem;
}
.data-table tr:hover td { 
  background: var(--brand-50);
}
[data-theme="dark"] .data-table tr:hover td {
  background: rgba(14, 135, 233, 0.04);
}

/* ─── Skeleton Loading ─── */
.skeleton { border-radius: var(--radius-sm); }
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-circle { border-radius: 50%; }

/* ─── Stat Value Displays ─── */
.stat-highlight {
  font-size: 2.5rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.stat-label {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  font-weight: 500;
  margin-top: 4px;
}

/* ─── Empty State ─── */
.empty-state {
  text-align: center; padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-state-text { font-size: 1rem; margin-bottom: 0.5rem; color: var(--text-secondary); }
.empty-state-sub { font-size: 0.875rem; color: var(--text-muted); }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-md);
  font-size: 0.875rem; font-weight: 600; font-family: inherit;
  cursor: pointer; border: none;
  transition: all var(--duration-fast);
  white-space: nowrap;
}
.btn-primary {
  background: var(--brand-600); color: #fff;
}
.btn-primary:hover { background: var(--brand-500); box-shadow: var(--shadow-sm); }
.btn-secondary {
  background: var(--bg-tertiary); color: var(--text-primary);
  border: 1px solid var(--border-default);
}
.btn-secondary:hover { background: var(--bg-secondary); border-color: var(--border-strong); }
.btn-ghost {
  background: transparent; color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.btn-sm { padding: 6px 12px; font-size: 0.8125rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius-lg); }

/* ─── Dividers ─── */
.divider {
  height: 1px; background: var(--border-default);
  margin: var(--space-lg) 0;
}

/* ─── Tag / Chip ─── */
.tag {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 0.75rem; font-weight: 600;
  line-height: 1.4;
}
.tag-party {
  letter-spacing: 0.02em;
}
