/* ============================================
   SYSTEM REAKCJI - STYLE CSS (Light Theme)
   Komponenty: Reaction Bar + Popular Widget
   ============================================ */

/* ----- REACTION BAR ----- */
.reaction-bar {
  margin: 0 auto;
  padding: 32px 24px;
  background: rgba(0, 0, 0, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  max-width: 800px; /* Taka sama szerokość jak prose content */
}

.reaction-bar__title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 24px;
  text-align: center;
}

.reaction-bar__buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.reaction-bar__total {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  text-align: center;
  font-size: 0.875rem;
  color: rgba(0, 0, 0, 0.7);
}

/* ----- REACTION BUTTON ----- */
.reaction-button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 18px;
  background: rgba(0, 0, 0, 0.03);
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 70px;
  user-select: none;
}

.reaction-button:hover:not(:disabled) {
  transform: translateY(-2px);
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(255, 216, 77, 0.5);
  box-shadow: 0 4px 12px rgba(255, 216, 77, 0.2);
}

.reaction-button:hover:not(:disabled) .reaction-button__emoji {
  transform: scale(1.15);
}

.reaction-button--active {
  background: rgba(255, 216, 77, 0.15);
  border-color: #ffd84d;
  box-shadow: 
    0 0 20px rgba(255, 216, 77, 0.3),
    inset 0 0 20px rgba(255, 216, 77, 0.1);
  animation: pulse-active 2s ease-in-out infinite;
}

.reaction-button--active .reaction-button__emoji {
  transform: scale(1.1);
  filter: drop-shadow(0 0 8px rgba(255, 216, 77, 0.6));
}

.reaction-button--active .reaction-button__count {
  color: #ffd84d;
  font-weight: 700;
}

.reaction-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.reaction-button:active:not(:disabled) {
  transform: scale(0.95);
}

.reaction-button__emoji {
  font-size: 2rem;
  line-height: 1;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.reaction-button__count {
  font-size: 0.875rem;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.7);
  transition: color 0.3s ease;
}

/* ============================================
   ANIMACJE
   ============================================ */

/* Animacja pulsowania dla aktywnej reakcji */
@keyframes pulse-active {
  0%, 100% {
    box-shadow: 
      0 0 20px rgba(255, 216, 77, 0.3),
      inset 0 0 20px rgba(255, 216, 77, 0.1);
  }
  50% {
    box-shadow: 0 0 30px rgba(255, 216, 77, 0.5),
      inset 0 0 30px rgba(255, 216, 77, 0.15);
  }
}

/* 🎯 NOWA: Bounce przy kliknięciu */
@keyframes bounce-click {
  0% { transform: scale(1) translateY(0); }
  40% { transform: scale(1.15) translateY(-4px); }
  60% { transform: scale(0.95) translateY(2px); }
  80% { transform: scale(1.05) translateY(-1px); }
  100% { transform: scale(1) translateY(0); }
}

.reaction-button--clicked {
  animation: bounce-click 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 🎯 NOWA: Emoji spin przy kliknięciu */
@keyframes emoji-spin {
  0% { transform: rotate(0deg) scale(1); }
  20% { transform: rotate(-20deg) scale(1.2); }
  40% { transform: rotate(20deg) scale(1.3); }
  60% { transform: rotate(-10deg) scale(1.25); }
  80% { transform: rotate(5deg) scale(1.15); }
  100% { transform: rotate(0deg) scale(1.1); }
}

.reaction-button--animating .reaction-button__emoji {
  animation: emoji-spin 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

/* 🎯 NOWA: Counter increment animation */
@keyframes count-bump {
  0% { transform: scale(1); }
  50% { 
    transform: scale(1.5);
    color: #ffd84d;
  }
  100% { transform: scale(1); }
}

.reaction-button__count--bump {
  animation: count-bump 0.4s ease-out;
}

/* 🎯 NOWA: Shimmer effect dla active button */
@keyframes shimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

.reaction-button--active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 216, 77, 0.3),
    transparent
  );
  background-size: 200% 100%;
  animation: shimmer 3s infinite;
  border-radius: 12px;
  pointer-events: none;
}

/* ----- POPULAR WIDGET (Dark Theme) ----- */
.popular-widget {
  background: rgba(0, 0, 0, 0.03);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.popular-widget__title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 16px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.popular-widget__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.popular-widget__item {
  margin-bottom: 12px;
  animation: fade-in-up 0.4s ease-out backwards;
}

.popular-widget__item:last-child {
  margin-bottom: 0;
}

/* Staggered animation for list items */
.popular-widget__item:nth-child(1) { animation-delay: 0.1s; }
.popular-widget__item:nth-child(2) { animation-delay: 0.2s; }
.popular-widget__item:nth-child(3) { animation-delay: 0.3s; }
.popular-widget__item:nth-child(4) { animation-delay: 0.4s; }
.popular-widget__item:nth-child(5) { animation-delay: 0.5s; }

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.popular-widget__link {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  text-decoration: none;
  color: #1f2937;
  transition: all 0.2s ease;
}

.popular-widget__link:hover {
  background: rgba(0, 0, 0, 0.05);
  transform: translateX(4px);
}

.popular-widget__rank {
  font-weight: 700;
  color: #ffd84d;
  flex-shrink: 0;
}

.popular-widget__title-text {
  flex: 1;
  font-size: 0.875rem;
  line-height: 1.4;
  opacity: 0.9;
}

.popular-widget__reactions {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.7);
  flex-shrink: 0;
  transition: color 0.2s ease;
}

.popular-widget__link:hover .popular-widget__reactions {
  color: #ffd84d;
}

/* ----- RESPONSIVE ----- */
@media (max-width: 640px) {
  .reaction-bar {
    padding: 24px 16px;
    margin: 24px auto;
  }

  .reaction-bar__title {
    font-size: 1.125rem;
  }

  .reaction-bar__buttons {
    gap: 8px;
  }

  .reaction-button {
    min-width: 60px;
    padding: 12px 14px;
  }

  .reaction-button__emoji {
    font-size: 1.75rem;
  }

  .reaction-button__count {
    font-size: 0.75rem;
  }

  .popular-widget {
    padding: 16px;
  }

  .popular-widget__title {
    font-size: 1rem;
  }
}

/* ----- ACCESSIBILITY ----- */
.reaction-button:focus-visible {
  outline: 2px solid #ffd84d;
  outline-offset: 2px;
}

.popular-widget__link:focus-visible {
  outline: 2px solid #ffd84d;
  outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .reaction-button,
  .reaction-button__emoji,
  .popular-widget__item,
  .popular-widget__link {
    animation: none !important;
    transition: none !important;
  }
  
  .reaction-button--active {
    animation: none !important;
  }
  
  .reaction-button--clicked,
  .reaction-button--animating .reaction-button__emoji {
    animation: none !important;
  }
}
