/* Rating Stars Block Styles */

.rating-stars-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rating-stars-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.stars-display {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  line-height: 1;
}

/* Star base styles */
.star {
  display: inline-block;
  font-family: inherit;
  font-style: normal;
  font-weight: normal;
  line-height: 1;
  text-rendering: auto;
  -webkit-font-smoothing: antialiased;
  transition: color 0.2s ease;
}

/* Star sizes */
.rating-stars-wrapper.size-small .star {
  font-size: 16px;
}

.rating-stars-wrapper.size-medium .star {
  font-size: 20px;
}

.rating-stars-wrapper.size-large .star {
  font-size: 24px;
}

.rating-stars-wrapper.size-xl .star {
  font-size: 32px;
}

/* Star states */
.star.filled {
  color: var(--star-color, #ffd700);
}

.star.empty {
  color: var(--empty-star-color, #e4e5e9);
}

/* Partial star styling using clip-path */
.star.partial {
  position: relative;
  color: var(--empty-star-color, #e4e5e9);
}

.star.partial::before {
  content: "★";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--star-color, #ffd700);
  width: var(--fill-percentage, 50%);
  overflow: hidden;
  clip-path: inset(0 calc(100% - var(--fill-percentage, 50%)) 0 0);
}

/* Rating value text */
.rating-value-text {
  display: flex;
  align-items: baseline;
  gap: 0.125rem;
  font-weight: 600;
  color: inherit;
}

.rating-number {
  font-size: 1em;
}

.rating-separator {
  font-size: 0.9em;
  opacity: 0.7;
}

.max-rating {
  font-size: 0.9em;
  opacity: 0.7;
}

/* Rating description text */
.rating-description {
  font-size: 0.875em;
  color: inherit;
  opacity: 0.8;
  white-space: nowrap;
}

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Alignment support */
.has-text-align-left .rating-stars-container {
  justify-content: flex-start;
}

.has-text-align-center .rating-stars-container {
  justify-content: center;
}

.has-text-align-right .rating-stars-container {
  justify-content: flex-end;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .rating-stars-wrapper {
    gap: 0.375rem;
  }

  .stars-display {
    gap: 0.1rem;
  }

  .rating-description {
    font-size: 0.8em;
  }

  /* Slightly smaller stars on mobile for better fit */
  .rating-stars-wrapper.size-xl .star {
    font-size: 28px;
  }

  .rating-stars-wrapper.size-large .star {
    font-size: 22px;
  }
}

@media (max-width: 480px) {
  .rating-stars-wrapper {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .rating-description {
    font-size: 0.75em;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .star.filled {
    color: #000000;
  }

  .star.empty {
    color: #666666;
  }

  .star.partial::before {
    color: #000000;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .star {
    transition: none;
  }
}

/* Hover effects for interactive contexts */
.rating-stars-container:hover .star.filled {
  transform: scale(1.05);
}

.rating-stars-container:hover .star.partial::before {
  transform: scale(1.05);
}

/* Focus styles for accessibility */
.rating-stars-container:focus-within {
  outline: 2px solid currentColor;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Print styles */
@media print {
  .rating-stars-container {
    color: #000000 !important;
  }

  .star.filled,
  .star.partial::before {
    color: #000000 !important;
  }

  .star.empty {
    color: #999999 !important;
  }
}
