/**
 * ============================================
 * RATING SYSTEM CSS v4.0
 * Inline klikalne gwiazdki + popup
 * WCAG 2.1 compliant contrast ratios
 * ============================================
 */

/* ============================================
   RATING WIDGET (w post-meta)
   ============================================ */

.blog-post__rating-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.blog-post__rating-stars {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

/* Individual star button */
.blog-post__star {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  transition: transform 0.15s ease;
  line-height: 0;
  border-radius: 2px;
}

.blog-post__star svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* Hover preview (scale up) */
.blog-post__star--preview {
  transform: scale(1.15);
}

/* Focus visible (WCAG 2.2) */
.blog-post__star:focus-visible {
  outline: 3px solid var(--color-focus, #d946ef);
  outline-offset: 1px;
  border-radius: 4px;
}

/* Rated state (disabled) */
.blog-post__star--rated {
  cursor: default;
  pointer-events: none;
}

/* Rating value text */
.blog-post__rating-value {
  font-size: 0.875rem;
  color: var(--color-text-light, #555);
}

.blog-post__rating-value strong {
  color: var(--color-text, #000);
  font-weight: 600;
}

/* Inline error message */
.blog-post__rating-error {
  font-size: 0.8125rem;
  color: var(--color-error, #8e323b);
  opacity: 0;
  transition: opacity 0.3s ease;
  margin-left: 4px;
  white-space: nowrap;
}

.blog-post__rating-error--visible {
  opacity: 1;
}

/* Inline success message */
.blog-post__rating-success {
  font-size: 0.8125rem;
  color: var(--color-text-light, #555);
  opacity: 0;
  transition: opacity 0.3s ease;
  margin-left: 4px;
  white-space: nowrap;
}

.blog-post__rating-success--visible {
  opacity: 1;
}

.blog-post__rating-success a {
  color: var(--color-link, #18752f);
  text-decoration: underline;
  font-size: 0.8125rem;
}

.blog-post__rating-success a:hover {
  color: var(--color-link-hover, #145f26);
}

/* ============================================
   RATING POPUP
   ============================================ */

.rating-popup {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  max-width: 350px;
}

.rating-popup--visible {
  opacity: 1;
  transform: translateY(0);
}

.rating-popup__content {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 1.5rem;
  min-width: 300px;
  max-width: 100%;
  position: relative;
}

.rating-popup__close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #767676;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color 0.2s;
}

.rating-popup__close:hover {
  color: #333;
}

.rating-popup__close:focus-visible {
  outline: 3px solid var(--color-focus, #d946ef);
  outline-offset: 2px;
}

.rating-popup__icon {
  display: flex;
  justify-content: center;
  margin-bottom: 0.5rem;
  line-height: 0;
}

.rating-popup__icon svg {
  width: 40px;
  height: 40px;
}

.rating-popup__title {
  font-size: 1.125rem;
  font-weight: 600;
  text-align: center;
  margin: 0 0 0.5rem 0;
  color: #333;
}

.rating-popup__subtitle {
  font-size: 0.875rem;
  text-align: center;
  margin: 0 0 1rem 0;
  color: #555;
}

.rating-popup__stars {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 1rem;
}

.rating-star {
  background: none;
  border: none;
  font-size: 2rem;
  color: #767676;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s;
  line-height: 1;
}

.rating-star:hover,
.rating-star--hover {
  color: #B8860B;
  transform: scale(1.1);
}

.rating-star:focus-visible {
  outline: 3px solid var(--color-focus, #d946ef);
  outline-offset: 2px;
  border-radius: 4px;
}

.rating-popup__later {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: #767676;
  font-size: 0.875rem;
  padding: 0.5rem;
  cursor: pointer;
  transition: color 0.2s;
}

.rating-popup__later:hover {
  color: #555;
}

.rating-popup__later:focus-visible {
  outline: 3px solid var(--color-focus, #d946ef);
  outline-offset: 2px;
}

.rating-popup__error {
  background: #fee;
  color: #c00;
  padding: 0.5rem;
  border-radius: 6px;
  font-size: 0.875rem;
  text-align: center;
  margin-top: 0.5rem;
}

/* Privacy note in popup */
.rating-popup__privacy {
  font-size: 0.75rem;
  color: #999;
  text-align: center;
  margin: 0.75rem 0 0;
}

.rating-popup__privacy a {
  color: #777;
  text-decoration: underline;
}

.rating-popup__privacy a:hover {
  color: #555;
}

/* ============================================
   MOBILE
   ============================================ */

@media (max-width: 768px) {
  .rating-popup {
    bottom: 10px;
    right: 10px;
    left: 10px;
    max-width: calc(100vw - 20px);
  }

  .rating-popup__content {
    min-width: auto;
    max-width: 100%;
    padding: 1.25rem;
  }

  .blog-post__star svg {
    width: 16px;
    height: 16px;
  }

  .rating-popup__stars {
    gap: 6px;
  }

  .rating-star {
    font-size: 1.75rem;
  }
}

@media (max-width: 480px) {
  .rating-popup__content {
    padding: 1rem;
  }

  .rating-popup__title {
    font-size: 1rem;
  }

  .rating-popup__stars {
    gap: 4px;
  }

  .rating-star {
    font-size: 1.5rem;
  }
}
