/**
 * Follow Button Styles
 *
 * Uses CSS custom properties for dark mode compatibility.
 * Light mode is the default; dark mode activates via [data-bs-theme="dark"].
 */

/* ==========================================================================
   Hero Actions Container (wraps social + follow button)
   ========================================================================== */

.profile-hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

/* ==========================================================================
   Page Header Wrappers (title + follow button alignment)
   ========================================================================== */

/* Force flex layout for header wrappers - higher specificity to override theme styles */
.profile-hero .profile-hero__header,
.city-hero .city-hero__header,
.county-hero .county-hero__header,
.district-hero .district-hero__header,
.profile-hero__header,
.city-hero__header,
.county-hero__header,
.district-hero__header {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

/* Prevent h1 from expanding to full width */
.profile-hero__header h1,
.city-hero__header h1,
.county-hero__header h1,
.district-hero__header h1,
.profile-hero__header .profile-hero__name,
.city-hero__header .city-hero__name,
.county-hero__header .county-hero__name,
.district-hero__header .district-hero__name {
  margin: 0 !important;
  flex: 0 0 auto;
  width: auto;
}

.bill-header__actions,
.election-header__actions {
  margin-bottom: 1rem;
}

/* ==========================================================================
   Manage Follows Page - Modern Card Layout
   ========================================================================== */

.bp-manage-follows {
  max-width: 800px;
}

.bp-manage-follows__intro {
  margin-bottom: 1.5rem;
  color: var(--bp-text-secondary, #4B5563);
}

.bp-manage-follows__list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.bp-manage-follows__actions {
  padding-top: 1rem;
  border-top: 1px solid #E5E7EB;
}

/* Explicit styles for unfollow button to prevent Bootstrap overrides */
.bp-manage-follows__actions .btn-outline-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: #dc3545;
  background-color: transparent;
  border-color: #dc3545;
}

.bp-manage-follows__actions .btn-outline-danger svg {
  flex-shrink: 0;
}

.bp-manage-follows__actions .btn-outline-danger:hover,
.bp-manage-follows__actions .btn-outline-danger:focus {
  color: #fff;
  background-color: #dc3545;
  border-color: #dc3545;
}

[data-bs-theme="dark"] .bp-manage-follows__actions .btn-outline-danger {
  color: #ea868f;
  background-color: transparent;
  border-color: #ea868f;
}

[data-bs-theme="dark"] .bp-manage-follows__actions .btn-outline-danger:hover,
[data-bs-theme="dark"] .bp-manage-follows__actions .btn-outline-danger:focus {
  color: #fff;
  background-color: #dc3545;
  border-color: #dc3545;
}

.bp-manage-follows__pagination {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #E5E7EB;
}

/* Subscription Card */
.bp-subscription-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 0.5rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.bp-subscription-card:hover {
  border-color: #D1D5DB;
}

.bp-subscription-card:has(.bp-subscription-card__checkbox:checked) {
  border-color: #C62828;
  background: #FEF2F2;
}

.bp-subscription-card__select {
  flex-shrink: 0;
}

.bp-subscription-card__checkbox {
  width: 1.25rem !important;
  height: 1.25rem !important;
  min-width: auto !important;
  min-height: auto !important;
  cursor: pointer;
  accent-color: #C62828;
}

.bp-subscription-card__content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.bp-subscription-card__avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.bp-subscription-card__avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F3F4F6;
  color: #9CA3AF;
}

.bp-subscription-card__info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.bp-subscription-card__name {
  font-weight: 600;
  color: #111827;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bp-subscription-card__name:hover {
  color: #8B1538;
}

.bp-subscription-card__date {
  font-size: 0.875rem;
  color: #6B7280;
}

.bp-subscription-card__action {
  flex-shrink: 0;
  font-size: 0.875rem;
  color: #6B7280;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  border-radius: 0.25rem;
  transition: background 0.15s ease;
  min-width: auto !important;
  min-height: auto !important;
}

.bp-subscription-card__action:hover {
  background: #F3F4F6;
  color: #374151;
}

/* Empty State */
.bp-manage-follows--empty,
.bp-manage-follows--login {
  text-align: center;
  padding: 3rem 1.5rem;
  background: #F9FAFB;
  border-radius: 0.75rem;
}

.bp-manage-follows__empty-icon,
.bp-manage-follows__login-icon {
  color: #9CA3AF;
  margin-bottom: 1rem;
}

.bp-manage-follows__empty-title,
.bp-manage-follows__login-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #111827;
}

.bp-manage-follows__empty-text,
.bp-manage-follows__login-text {
  color: #6B7280;
  margin-bottom: 1.5rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.bp-manage-follows__login-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ==========================================================================
   Manage Follows - Dark Mode
   ========================================================================== */

[data-bs-theme="dark"] .bp-manage-follows__intro {
  color: #B3B3B3;
}

[data-bs-theme="dark"] .bp-subscription-card {
  background: #1E1E1E;
  border-color: #2A2A2A;
}

[data-bs-theme="dark"] .bp-subscription-card:hover {
  border-color: #404040;
}

[data-bs-theme="dark"] .bp-subscription-card:has(.bp-subscription-card__checkbox:checked) {
  border-color: #EF5350;
  background: rgba(239, 83, 80, 0.1);
}

[data-bs-theme="dark"] .bp-subscription-card__avatar--placeholder {
  background: #2A2A2A;
  color: #757575;
}

[data-bs-theme="dark"] .bp-subscription-card__name {
  color: #FFFFFF;
}

[data-bs-theme="dark"] .bp-subscription-card__name:hover {
  color: #C94661;
}

[data-bs-theme="dark"] .bp-subscription-card__date {
  color: #B3B3B3;
}

[data-bs-theme="dark"] .bp-subscription-card__action {
  color: #B3B3B3;
}

[data-bs-theme="dark"] .bp-subscription-card__action:hover {
  background: #2A2A2A;
  color: #FFFFFF;
}

[data-bs-theme="dark"] .bp-manage-follows__actions {
  border-color: #2A2A2A;
}

[data-bs-theme="dark"] .bp-manage-follows__pagination {
  border-color: #2A2A2A;
}

[data-bs-theme="dark"] .bp-manage-follows--empty,
[data-bs-theme="dark"] .bp-manage-follows--login {
  background: #121212;
}

[data-bs-theme="dark"] .bp-manage-follows__empty-icon,
[data-bs-theme="dark"] .bp-manage-follows__login-icon {
  color: #757575;
}

[data-bs-theme="dark"] .bp-manage-follows__empty-title,
[data-bs-theme="dark"] .bp-manage-follows__login-title {
  color: #FFFFFF;
}

[data-bs-theme="dark"] .bp-manage-follows__empty-text,
[data-bs-theme="dark"] .bp-manage-follows__login-text {
  color: #B3B3B3;
}

/* Legacy fix - kept for backwards compatibility */
.wpstp_subscriptions_list .form-check-input {
  min-width: auto !important;
  min-height: auto !important;
  width: 1em;
  height: 1em;
}

.wpstp_subscriptions_list .form-check-label {
  min-width: auto !important;
  min-height: auto !important;
}

/* ==========================================================================
   Base Styles (Light Mode) - Primary CTA style for header placement
   ========================================================================== */

.bp-follow-button {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.5;
  color: #FFFFFF;
  background-color: #8B1538;
  border: 2px solid #8B1538;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.bp-follow-button:hover {
  color: #FFFFFF;
  background-color: #6B0F2A;
  border-color: #6B0F2A;
}

.bp-follow-button:focus {
  color: #FFFFFF;
  background-color: #6B0F2A;
  border-color: #6B0F2A;
}

.bp-follow-button:focus-visible {
  box-shadow: 0 0 0 3px rgba(139, 21, 56, 0.25);
  outline: none;
}

.bp-follow-button:focus:not(:focus-visible) {
  outline: none;
}

/* Following State - Outline style to differentiate from "Follow" */
.bp-follow-button.is-following {
  color: #8B1538;
  background-color: transparent;
  border-color: #8B1538;
}

.bp-follow-button.is-following:hover,
.bp-follow-button.is-following:focus {
  color: #FFFFFF;
  background-color: #8B1538;
  border-color: #8B1538;
}

/* Loading State */
.bp-follow-button.is-loading {
  opacity: 0.7;
  pointer-events: none;
}

.bp-follow-button.is-loading .bp-follow-button__icon {
  animation: bp-pulse 1s ease-in-out infinite;
}

@keyframes bp-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Error State */
.bp-follow-button.has-error {
  color: #C62828;
  background-color: #FFEBEE;
  border-color: #C62828;
}

/* ==========================================================================
   Button Elements
   ========================================================================== */

.bp-follow-button__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bp-follow-button__icon svg {
  width: 1rem;
  height: 1rem;
}

.bp-follow-button__text {
  white-space: nowrap;
}

.bp-follow-button__count {
  padding-left: 0.25rem;
  border-left: 1px solid currentColor;
  margin-left: 0.25rem;
  opacity: 0.7;
  font-size: 0.75rem;
}

/* ==========================================================================
   Login Link Variant - Subtle style for non-authenticated users
   ========================================================================== */

.bp-follow-button--login {
  color: #6B7280;
  background-color: #F3F4F6;
  border-color: #E5E7EB;
}

.bp-follow-button--login:hover,
.bp-follow-button--login:focus {
  color: #8B1538;
  background-color: #FCE8EC;
  border-color: #8B1538;
  text-decoration: none;
}

/* ==========================================================================
   Dark Mode
   ========================================================================== */

[data-bs-theme="dark"] .bp-follow-button {
  color: #FFFFFF;
  background-color: #C94661;
  border-color: #C94661;
}

[data-bs-theme="dark"] .bp-follow-button:hover,
[data-bs-theme="dark"] .bp-follow-button:focus {
  color: #FFFFFF;
  background-color: #D45A73;
  border-color: #D45A73;
}

[data-bs-theme="dark"] .bp-follow-button:focus-visible {
  box-shadow: 0 0 0 3px rgba(201, 70, 97, 0.25);
}

/* Following State - Dark (outline style) */
[data-bs-theme="dark"] .bp-follow-button.is-following {
  color: #C94661;
  background-color: transparent;
  border-color: #C94661;
}

[data-bs-theme="dark"] .bp-follow-button.is-following:hover,
[data-bs-theme="dark"] .bp-follow-button.is-following:focus {
  color: #FFFFFF;
  background-color: #C94661;
  border-color: #C94661;
}

/* Error State - Dark */
[data-bs-theme="dark"] .bp-follow-button.has-error {
  color: #EF5350;
  background-color: rgba(239, 83, 80, 0.15);
  border-color: #EF5350;
}

/* Login Link - Dark */
[data-bs-theme="dark"] .bp-follow-button--login {
  color: #B3B3B3;
  background-color: #1E1E1E;
  border-color: #2A2A2A;
}

[data-bs-theme="dark"] .bp-follow-button--login:hover,
[data-bs-theme="dark"] .bp-follow-button--login:focus {
  color: #C94661;
  background-color: rgba(201, 70, 97, 0.15);
  border-color: #C94661;
}
