/* ==============================================
   Simple Category Rating - Frontend Styles
   ============================================== */

/* Основной контейнер рейтинга */
.scr-rating-widget {
    display: inline-block;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    text-align: center;
    margin: 15px 0;
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.scr-rating-widget:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

/* Контейнер звезд */
.scr-stars-container {
    display: inline-block;
    font-size: 28px;
    line-height: 1;
    margin-bottom: 8px;
    position: relative;
}

/* Отдельная звезда */
.scr-star {
    position: relative;
    display: inline-block;
    margin: 0 2px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #ddd;
}

.scr-rating-active .scr-star:hover {
    transform: scale(1.1);
}

/* Пустая звезда */
.scr-star-empty {
    color: #e0e0e0;
    display: block;
}

/* Заполненная звезда */
.scr-star-filled {
    position: absolute;
    top: 0;
    left: 0;
    color: #ffa500;
    overflow: hidden;
    width: 0%;
    transition: width 0.3s ease;
    display: block;
}

/* Эффекты при наведении для активного рейтинга */
.scr-rating-active .scr-star:hover .scr-star-filled,
.scr-rating-active .scr-star:hover ~ .scr-star .scr-star-filled {
    width: 0% !important;
}

.scr-rating-active .scr-star:hover .scr-star-filled {
    width: 100% !important;
}

.scr-rating-active .scr-star:hover ~ .scr-star .scr-star-empty {
    color: #e0e0e0;
}

/* Подсветка звезд при наведении */
.scr-rating-active .scr-stars-container:hover .scr-star {
    color: #e0e0e0;
}

.scr-rating-active .scr-star:hover,
.scr-rating-active .scr-star:hover ~ .scr-star {
    color: #e0e0e0;
}

.scr-rating-active .scr-star:hover {
    color: #ffa500;
}

.scr-rating-active .scr-star:hover .scr-star-empty {
    color: #ffa500;
}

/* Текстовая информация о рейтинге */
.scr-rating-text {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
    line-height: 1.4;
}

.scr-average {
    font-weight: bold;
    font-size: 16px;
    color: #333;
}

.scr-separator {
    margin: 0 2px;
    color: #999;
}

.scr-max {
    color: #999;
}

.scr-count-wrapper {
    margin-left: 8px;
    font-size: 13px;
}

.scr-count {
    font-weight: 600;
    color: #555;
}

/* Сообщения */
.scr-message {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
}

.scr-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.scr-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Сообщение для проголосовавших */
.scr-voted-message {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
    font-style: italic;
    opacity: 0.8;
}

/* Стили для уже проголосовавших */
.scr-rating-voted .scr-star {
    cursor: default;
}

.scr-rating-voted .scr-stars-container:hover .scr-star {
    transform: none;
}

/* Адаптивность */
@media (max-width: 600px) {
    .scr-rating-widget {
        padding: 12px;
        margin: 10px 0;
    }
    
    .scr-stars-container {
        font-size: 24px;
    }
    
    .scr-rating-text {
        font-size: 13px;
    }
    
    .scr-average {
        font-size: 15px;
    }
}

/* Темная тема (если поддерживается) */
@media (prefers-color-scheme: dark) {
    .scr-rating-widget {
        background: #2a2a2a;
        color: #e0e0e0;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .scr-star-empty {
        color: #555;
    }
    
    .scr-rating-text {
        color: #ccc;
    }
    
    .scr-average {
        color: #fff;
    }
    
    .scr-count {
        color: #ddd;
    }
}

/* Анимация появления */
.scr-rating-widget {
    animation: scrFadeIn 0.5s ease-out;
}

@keyframes scrFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Дополнительные утилитарные классы */
.scr-rating-small {
    font-size: 0.8em;
    padding: 8px;
}

.scr-rating-large {
    font-size: 1.2em;
    padding: 20px;
}

.scr-rating-small .scr-stars-container {
    font-size: 20px;
}

.scr-rating-large .scr-stars-container {
    font-size: 36px;
}

/* Состояние загрузки */
.scr-rating-loading {
    opacity: 0.6;
    pointer-events: none;
}

.scr-rating-loading .scr-stars-container::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ffa500;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: scrSpin 1s linear infinite;
}

@keyframes scrSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
