/**
 * Rating Input Component Styles
 *
 * Supports progressive (fill 1→N) and single (show selected only) modes.
 *
 * @package YayReviews
 */

/* CSS Custom Properties for theme customization */
.yayrev-rating-input {
    --yayrev-rating-gap: 0.25rem;
    --yayrev-rating-icon-size: 1.5rem;
    --yayrev-rating-dimmed-opacity: 0.35;
    --yayrev-rating-hover-scale: 1.15;
    --yayrev-rating-transition: 0.15s ease;
}

.yayrev-rating-input {
    display: flex;
    align-items: center;
    gap: var(--yayrev-rating-gap);
    flex-wrap: wrap;
}

.yayrev-rating-input__option {
    background: none;
    border: 2px solid transparent;
    border-radius: 0.375rem;
    padding: 0.25rem;
    cursor: pointer;
    transition: transform var(--yayrev-rating-transition), opacity var(--yayrev-rating-transition), border-color var(--yayrev-rating-transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.yayrev-rating-input__option:focus {
    outline: 2px solid var(--yayrev-primary, #111111);
    outline-offset: 2px;
}

.yayrev-rating-input__option:focus:not(:focus-visible) {
    outline: none;
}

.yayrev-rating-input__icon {
    font-size: var(--yayrev-rating-icon-size);
    line-height: 1;
    display: block;
    width: var(--yayrev-rating-icon-size);
    height: var(--yayrev-rating-icon-size);
    max-height: var(--yayrev-rating-icon-size);
}

.yayrev-rating-input__icon-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.yayrev-rating-input__option[data-tooltip]:hover::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: #fff;
    padding: 0.375rem 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.6875rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

/* Progressive mode - dimmed by default */
.yayrev-rating-input--progressive .yayrev-rating-input__option {
    opacity: var(--yayrev-rating-dimmed-opacity);
}

.yayrev-rating-input--progressive .yayrev-rating-input__option--filled,
.yayrev-rating-input--progressive .yayrev-rating-input__option:hover {
    opacity: 1;
    transform: scale(var(--yayrev-rating-hover-scale));
}

/* Single mode - border highlight on hover/select */
.yayrev-rating-input--single .yayrev-rating-input__option:hover {
    border-color: var(--yayrev-primary, #111111);
}

.yayrev-rating-input--single .yayrev-rating-input__option[aria-checked="true"] {
    border-color: var(--yayrev-primary, #111111);
    background: rgba(37, 99, 235, 0.1);
}

/* Hide non-selected in single mode after selection */
.yayrev-rating-input--single.yayrev-rating-input--has-selection
    .yayrev-rating-input__option:not([aria-checked="true"]) {
    display: none;
}

/* Change button */
.yayrev-rating-input__change {
    background: none;
    border: none;
    color: var(--yayrev-primary, #111111);
    cursor: pointer;
    font-size: 0.75rem;
    text-decoration: underline;
    padding: 0.25rem 0.5rem;
    margin-left: 0.5rem;
}

.yayrev-rating-input__change:hover {
    text-decoration: none;
}

/* Selected label display */
.yayrev-rating-input__selected-label {
    display: block;
    font-size: 0.875rem;
    color: var(--yayrev-text-muted, #6b7280);
    margin-top: 0.25rem;
    min-height: 1.25em;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .yayrev-rating-input__option {
        transition: none;
    }
}
