/* ================================
   STAR RATING COMPONENT (SVG Version)
   ================================ */

/* ---- Container ---- */
.star-rating {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.star-rating.large { gap: 0; }
.star-rating.small { gap: 3px; }

/* ---- Star base ---- */
.star {
    position: relative;
    display: inline-block;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    background: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -0.5 33 33'>\
<polygon fill='%23E0E0E0' points='27.865 31.83 17.615 26.209 7.462 32.009 9.553 20.362 0.99 12.335 12.532 10.758 17.394 0 22.436 10.672 34 12.047 25.574 20.22'/>\
</svg>") center / contain no-repeat;
}

/* Size variants */
.star-rating.large .star {
    width: 24px;
    height: 24px;
}
.star-rating.small .star {
    width: 16px;
    height: 16px;
}

/* ---- Filled Layer ---- */
.star .star-fill {
    position: absolute;
    inset: 0;
    display: block;
}

/* Always render full-size star, but mask color to fractional width */
.star .star-fill::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 -0.5 33 33'>\
<polygon fill='%237D5CA4' points='27.865 31.83 17.615 26.209 7.462 32.009 9.553 20.362 0.99 12.335 12.532 10.758 17.394 0 22.436 10.672 34 12.047 25.574 20.22'/>\
</svg>") center / contain no-repeat;

    color: #7D5CA4;
    -webkit-mask-image: linear-gradient(to right, #000 calc(var(--fill, 100%) * 1%), transparent 0);
    mask-image: linear-gradient(to right, #000 calc(var(--fill, 100%) * 1%), transparent 0);
}

/* Custom property set inline via Blade */
.star-fill {
    --fill: attr(data-fill percentage, 100);
}

/* ---- Type variants (optional future use) ---- */
.star-rating.primary .star-fill::before { color: #7D5CA4; }
.star-rating.secondary .star-fill::before { color: #6B7280; }
.star-rating.default .star-fill::before { color: #FFB800; }

/* ---- Rating number ---- */
.rating-number {
    font-weight: 600;
    font-size: 18px;
    color: #191221;
    margin-left: 8px;
}

.ratings.large .rating-number {
    font-size: 20px;
    font-weight: 500;
    font-family: 'Nunito Sans', sans-serif;
    margin-top: 3px;
}

/* ================================
   RESPONSIVE BEHAVIOR
   ================================ */

@media (max-width: 768px) {
    .star-rating.large .star {
        width: 20px;
        height: 20px;
    }

    .ratings.large .rating-number {
        font-size: 20px;
    }
}

@media (max-width: 576px) {
    .star-rating.small .star {
        width: 14px;
        height: 14px;
    }
}
