/* VocaGift Reactions Module - Styles */
/* Fail closed: no output if config is empty/missing */

#vg-reactions {
  display: none;
  max-width: 100%;
  margin: 2rem auto;
  padding: 0 1rem;
}

#vg-reactions:empty {
  display: none !important;
}

/* ID specificity must match the #vg-reactions base rule above, otherwise
   the visible state never wins and rendered cards stay hidden. */
#vg-reactions.vg-reactions-visible {
  display: block;
}

.vg-reactions-section {
  position: relative;
}

.vg-reactions-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.vg-reactions-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #F3F4F6;
  margin-bottom: 0.5rem;
}

.vg-reactions-subtitle {
  font-size: 0.875rem;
  color: #9CA3AF;
}

.vg-reactions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  overflow-x: hidden;
}

.vg-reaction-scroll {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 92, 246, 0.3) transparent;
  -ms-overflow-style: -ms-autohide-scrollbar;
  padding: 0.5rem 0;
}

.vg-reaction-scroll::-webkit-scrollbar {
  height: 6px;
}

.vg-reaction-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.vg-reaction-scroll::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 3px;
}

.vg-reaction-card {
  position: relative;
  background: rgba(18, 24, 38, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  scroll-snap-align: start;
  min-width: 280px;
  flex-shrink: 0;
}

.vg-reaction-card:hover {
  transform: translateY(-4px);
  border-color: rgba(139, 92, 246, 0.6);
  box-shadow: 0 8px 30px rgba(139, 92, 246, 0.2);
}

.vg-reaction-poster {
  position: relative;
  width: 100%;
  height: 160px;
  background: linear-gradient(135deg, #1e293a 0%, #0f172a 100%);
  overflow: hidden;
}

.vg-reaction-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.8;
}

.vg-reaction-poster::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 50%);
  pointer-events: none;
}

.vg-reaction-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.vg-reaction-play-btn:hover {
  background: #fff;
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.vg-reaction-play-btn svg {
  width: 20px;
  height: 20px;
  fill: #0B0F19;
  margin-left: 3px;
}

.vg-reaction-info {
  padding: 1rem;
}

.vg-reaction-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #F3F4F6;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vg-reaction-meta {
  font-size: 0.75rem;
  color: #9CA3AF;
}

/* Dialog / Modal - Native dialog element */
.vg-reaction-dialog {
  border: none;
  border-radius: 1.25rem;
  background: #0B0F19;
  max-width: 90vw;
  max-height: 90vh;
  width: 100%;
  max-width: 640px;
  overflow: hidden;
  padding: 0;
}

.vg-reaction-dialog::backdrop {
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.vg-reaction-dialog[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.vg-reaction-dialog-content {
  position: relative;
  background: #0B0F19;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1.25rem;
  max-width: 90vw;
  max-height: 90vh;
  width: 100%;
  max-width: 640px;
  overflow: hidden;
}

.vg-reaction-dialog-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 0.5rem;
  color: #F3F4F6;
  cursor: pointer;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.vg-reaction-dialog-close:hover {
  background: rgba(236, 72, 153, 0.3);
  color: #EC4899;
}

.vg-reaction-dialog-close:focus {
  outline: 2px solid #7C3AED;
  outline-offset: 2px;
}

.vg-reaction-video-container {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  background: #000;
  overflow: hidden;
}

.vg-reaction-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.vg-reaction-dialog-body {
  padding: 1.25rem;
}

.vg-reaction-dialog-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  color: #F3F4F6;
  margin-bottom: 0.5rem;
}

.vg-reaction-dialog-meta {
  font-size: 0.8125rem;
  color: #9CA3AF;
  margin-bottom: 1rem;
}

.vg-reaction-dialog-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.vg-reaction-btn {
  padding: 0.625rem 1.25rem;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.vg-reaction-btn-primary {
  background: linear-gradient(135deg, #7C3AED 0%, #EC4899 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.vg-reaction-btn-primary:hover {
  box-shadow: 0 6px 20px rgba(236, 72, 153, 0.6);
  transform: translateY(-1px);
}

.vg-reaction-btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: #F3F4F6;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.vg-reaction-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.vg-reaction-btn:focus {
  outline: 2px solid #7C3AED;
  outline-offset: 2px;
}

/* Captions */
.vg-reaction-captions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
  padding: 1rem;
  pointer-events: none;
}

.vg-reaction-caption {
  color: #fff;
  font-size: 0.875rem;
  text-align: center;
  line-height: 1.5;
}

/* Loading state */
.vg-reaction-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
}

.vg-reaction-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: vg-spin 0.8s linear infinite;
}

@keyframes vg-spin {
  to { transform: rotate(360deg); }
}

/* Error state */
.vg-reaction-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  color: #F3F4F6;
  text-align: center;
  padding: 1rem;
}

.vg-reaction-error-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.vg-reaction-error-msg {
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .vg-reaction-card,
  .vg-reaction-play-btn,
  .vg-reaction-dialog-content,
  .vg-reaction-btn-primary {
    transition: none;
  }
  
  .vg-reaction-card:hover,
  .vg-reaction-play-btn:hover,
  .vg-reaction-btn-primary:hover {
    transform: none;
  }
}

/* Responsive */
@media (max-width: 640px) {
  .vg-reactions-grid {
    display: none;
  }
  
  .vg-reaction-scroll {
    display: flex;
  }
  
  .vg-reaction-card {
    min-width: 240px;
  }
  
  .vg-reaction-poster {
    height: 140px;
  }
  
  .vg-reaction-dialog-content {
    margin: 0.5rem;
  }
}

@media (min-width: 641px) {
  .vg-reaction-scroll {
    display: none;
  }
  
  .vg-reactions-grid {
    display: grid;
  }
}
