/**
 * Star Rating Component Styles
 * 
 * Responsive and accessible star rating component
 */

/* Main component container */
.star-rating-component {
    padding: 1rem;
    border-radius: 8px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.star-rating-component:hover {
    border-color: #dee2e6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Rating header */
.rating-header .rating-title {
    color: #495057;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.rating-header .rating-subtitle {
    color: #6c757d;
    font-size: 0.875rem;
}

/* Stars container */
.star-rating-container {
    position: relative;
}

.stars-input {
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.5rem;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.stars-input:hover {
    border-color: #ffc107;
    box-shadow: 0 0 0 0.1rem rgba(255, 193, 7, 0.25);
}

/* Individual star styling */
.star-label {
    cursor: pointer;
    display: inline-block;
    position: relative;
    margin: 0;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.star-label:hover {
    background: rgba(255, 193, 7, 0.1);
    transform: scale(1.1);
}

.star-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.star-icon {
    font-size: 1.5rem;
    color: #dee2e6;
    transition: all 0.2s ease;
    display: block;
}

/* Star states */
.star-label:hover .star-icon,
.star-label.hover .star-icon {
    color: #ffc107;
    text-shadow: 0 0 4px rgba(255, 193, 7, 0.3);
}

.star-input:checked ~ .star-icon,
.star-label.selected .star-icon {
    color: #ffc107;
}

.star-input:focus + .star-icon {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Hover effect for all stars up to hovered one */
.stars-input:hover .star-label:hover ~ .star-label .star-icon {
    color: #dee2e6;
}

/* Rating feedback */
.rating-feedback {
    min-height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rating-text {
    font-weight: 500;
    color: #495057;
}

/* Action buttons */
.rating-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
}

.rating-actions .btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
}

.rating-actions .btn-link {
    color: #6c757d;
    text-decoration: none;
    padding: 0.375rem 0.5rem;
}

.rating-actions .btn-link:hover {
    color: #495057;
    text-decoration: underline;
}

/* Rating statistics */
.rating-stats {
    padding-top: 0.75rem;
    border-top: 1px solid #e9ecef;
}

.stars-display .fa-star {
    margin-right: 0.125rem;
}

.stars-display .fas.fa-star {
    color: #ffc107;
}

.stars-display .far.fa-star {
    color: #dee2e6;
}

.stats-text {
    color: #6c757d;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Success message */
.rating-success {
    padding: 0.5rem;
    animation: fadeInScale 0.3s ease-out;
}

.success-text {
    font-weight: 500;
    font-size: 0.875rem;
}

/* Rating submitted state */
.rating-submitted .star-rating-component {
    animation: pulse 0.3s ease-out;
}

/* Thank you message (legacy - keeping for compatibility) */
.star-rating-thank-you {
    padding: 1.5rem 1rem;
    background: #d1edff;
    border: 1px solid #b8daff;
    border-radius: 8px;
    animation: fadeInScale 0.5s ease-out;
}

.thank-you-icon {
    animation: bounceIn 0.6s ease-out 0.2s both;
}

.thank-you-message {
    color: #0c5460;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Loading state */
.rating-loading {
    padding: 1rem;
}

.loading-text {
    color: #6c757d;
}

/* Error state */
.rating-error {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 4px;
}

/* Animations */
@keyframes fadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

/* Responsive design */
@media (max-width: 576px) {
    .star-rating-component {
        padding: 0.75rem;
    }
    
    .star-icon {
        font-size: 1.25rem;
    }
    
    .star-label {
        padding: 0.2rem;
    }
    
    .rating-actions {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .rating-actions .btn {
        width: 100%;
        max-width: 150px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .star-rating-component {
        border-color: #000;
        background: #fff;
    }
    
    .stars-input {
        border-color: #000;
    }
    
    .star-icon {
        color: #666;
    }
    
    .star-label:hover .star-icon,
    .star-input:checked ~ .star-icon {
        color: #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .star-rating-component,
    .stars-input,
    .star-label,
    .star-icon {
        transition: none;
    }
    
    .star-rating-thank-you,
    .thank-you-icon {
        animation: none;
    }
    
    .star-label:hover {
        transform: none;
    }
}

/* Print styles */
@media print {
    .star-rating-component {
        border: 1px solid #000;
        background: #fff;
    }
    
    .rating-actions,
    .rating-loading {
        display: none !important;
    }
}

/* Focus styles for accessibility */
.star-label:focus-within {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
    border-radius: 4px;
}

/* 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;
}