/* /css/upvotes.css */

.upvote-container {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.25rem 0.5rem 0.25rem 0;
}

.upvote-btn {
  background: transparent;
  border: 2px solid #ddd;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #666;
  font-size: 14px;
  position: relative;
  overflow: hidden;
}

.upvote-btn:hover:not(:disabled) {
  border-color: #e91e63;
  color: #e91e63;
  transform: scale(1.05);
}

.upvote-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.upvote-btn.upvoted {
  background: linear-gradient(135deg, #e91e63, #f06292);
  border-color: #e91e63;
  color: white;
  box-shadow: 0 2px 8px rgba(233, 30, 99, 0.3);
}

.upvote-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  border-color: #ddd;
  color: #999;
  pointer-events: none;
}

.upvote-btn:disabled.upvoted {
  opacity: 0.8;
  background: linear-gradient(135deg, #e91e63, #f06292);
  border-color: #e91e63;
  color: white;
}

/* Disabled state for logged-out users (no loading animation) */
.upvote-btn.upvote-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: #ddd;
  color: #999;
  pointer-events: none;
}

.upvote-btn.upvote-disabled:hover {
  transform: none;
  border-color: #ddd;
  color: #999;
}

/* Loading state animation (only for logged-in users during API calls) */
.upvote-btn:disabled:not(.upvote-disabled)::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  opacity: 0.6;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.upvote-count {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  min-width: 20px;
  text-align: center;
}

/* Size variations */
.upvote-btn-small .upvote-btn {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

.upvote-btn-small .upvote-count {
  font-size: 12px;
}

.upvote-btn-large .upvote-btn {
  width: 44px;
  height: 44px;
  font-size: 16px;
}

.upvote-btn-large .upvote-count {
  font-size: 16px;
  font-weight: 700;
}

/* Animation effects */
.upvote-container.upvote-added .upvote-btn {
  animation: upvoteAdded 0.6s ease;
}

.upvote-container.upvote-removed .upvote-btn {
  animation: upvoteRemoved 0.4s ease;
}

@keyframes upvoteAdded {
  0% { transform: scale(1); }
  30% { transform: scale(1.3); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes upvoteRemoved {
  0% { transform: scale(1); }
  50% { transform: scale(0.8); }
  100% { transform: scale(1); }
}

/* Pulse effect for feedback */
.upvote-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(233, 30, 99, 0.4);
  transform: translate(-50%, -50%);
  transition: all 0.3s ease;
}

.upvote-btn.upvoted::before {
  width: 120%;
  height: 120%;
  opacity: 0;
}

/* Tooltip styles */
.upvote-tooltip {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 1000;
  opacity: 0;
  animation: tooltipShow 2s ease;
}

.upvote-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #333;
}

@keyframes tooltipShow {
  0%, 90% { opacity: 0; }
  10%, 80% { opacity: 1; }
  100% { opacity: 0; }
}

/* Integration with existing card styles */
.card .upvote-container {
  margin-top: 0.5rem;
  justify-content: flex-start;
}

.article-card .upvote-container {
  margin-top: 0.5rem;
}

.article-meta .upvote-container {
  margin-left: auto;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .upvote-btn {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }
  
  .upvote-btn-large .upvote-btn {
    width: 40px;
    height: 40px;
    font-size: 15px;
  }
  
  .upvote-count {
    font-size: 13px;
  }
  
  .upvote-container {
    gap: 0.375rem;
  }
}

@media (max-width: 480px) {
  .upvote-btn {
    width: 30px;
    height: 30px;
    font-size: 12px;
  }
  
  .upvote-btn-large .upvote-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }
  
  .upvote-count {
    font-size: 12px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .upvote-btn {
    border-color: #555;
    color: #ccc;
  }
  
  .upvote-btn:hover:not(:disabled) {
    border-color: #e91e63;
    color: #e91e63;
  }
  
  .upvote-count {
    color: #ccc;
  }
  
  .upvote-tooltip {
    background: #555;
  }
  
  .upvote-tooltip::after {
    border-top-color: #555;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .upvote-btn {
    border-width: 3px;
  }
  
  .upvote-btn.upvoted {
    background: #d81b60;
    border-color: #d81b60;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .upvote-btn {
    transition: none;
  }
  
  .upvote-container.upvote-added .upvote-btn,
  .upvote-container.upvote-removed .upvote-btn {
    animation: none;
  }
  
  .upvote-tooltip {
    animation: none;
    opacity: 1;
  }
}

/* Homepage article cards upvote styling */
.card article .upvote-container {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #eee;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.card article .upvote-btn {
  width: 32px;
  height: 32px;
  font-size: 13px;
}

.card article .upvote-count {
  font-size: 0.8rem;
}

/* Individual article page upvote styling */
.article-meta .upvote-container {
  margin-left: auto;
}

.article-meta .upvote-btn {
  width: 40px;
  height: 40px;
  font-size: 16px;
}

.article-meta .upvote-count {
  font-size: 0.9rem;
  font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .card article .upvote-container {
    justify-content: center;
  }
  
  .article-meta .upvote-container {
    margin-left: 0;
    margin-top: 0.5rem;
  }
} 