/**
 * Стили для модального окна статистики рейтинга
 *
 * @package     Advanced Rating
 * @since       1.0.0
 */

/* Показ модального окна без Bootstrap (собственный overlay) */
#advrating-stats-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1060;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    outline: 0;
}
#advrating-stats-modal.show {
    display: block !important;
}
#advrating-stats-modal .modal-dialog {
    position: relative;
    width: auto;
    max-width: 800px;
    margin: 1.75rem auto;
    pointer-events: none;
}
#advrating-stats-modal.show .modal-dialog {
    pointer-events: auto;
}
#advrating-stats-modal .modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100% - 3.5rem);
}
.advrating-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1055;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

/* Кнопка показа статистики */
.rating-show-stats {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    transition: all 0.2s;
    font-size: 13px;
    color: #666;
}

.rating-show-stats:hover {
    background: #f8f9fa;
    border-color: #999;
    color: #333;
}

/* Модальное окно */
#advrating-stats-modal .modal-content {
    border-radius: 12px;
}

#advrating-stats-modal .modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

#advrating-stats-modal .modal-header .btn-close {
    filter: brightness(0) invert(1);
}

/* Заголовок статистики */
.rating-modal-stats .stats-header {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 8px;
}

.rating-modal-stats .overall-rating {
    margin-top: 15px;
}

.rating-modal-stats .rating-value {
    font-size: 48px;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1;
}

.rating-modal-stats .rating-stars {
    font-size: 24px;
    margin: 10px 0;
}

.rating-modal-stats .rating-count {
    font-size: 14px;
}

/* Распределение оценок */
.distribution-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.distribution-row {
    display: grid;
    grid-template-columns: 60px 1fr 100px;
    align-items: center;
    gap: 15px;
}

.distribution-row .rating-label {
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.distribution-row .progress-container {
    position: relative;
}

.distribution-row .progress {
    height: 24px;
    background-color: #e9ecef;
    border-radius: 12px;
    overflow: hidden;
}

.distribution-row .progress-bar {
    transition: width 0.6s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.distribution-row .rating-count {
    text-align: right;
    font-size: 13px;
    color: #666;
}

/* Критерии */
.stats-criterias h4,
.stats-recent h4,
.stats-distribution h4 {
    color: #2c3e50;
    font-weight: 600;
    font-size: 18px;
}

/* Список критериев — столбцом (один под другим) */
.stats-criterias .criterias-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.criteria-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: all 0.2s;
}

.criteria-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.criteria-header strong {
    color: #34495e;
}

.criteria-stars {
    font-size: 16px;
}

.criteria-stars .icon-star,
.criteria-stars .icon-star-half {
    color: #f39c12;
}

.criteria-stars .icon-star-empty {
    color: #bdc3c7;
}

/* Блок «Оценить» и звёзды голосования в модалке по критериям */
.advrating-modal-vote-label {
    font-size: 0.9em;
    color: #666;
    margin-right: 6px;
}
#advrating-stats-modal .advrating-modal-criteria-vote {
    cursor: pointer;
    display: inline-flex;
    gap: 2px;
}
#advrating-stats-modal .advrating-modal-criteria-vote .star {
    cursor: pointer;
    pointer-events: auto;
    font-size: 1.25rem;
    color: transparent;
    -webkit-text-stroke: 1.5px var(--advrating-star-outline, #ddd);
    transition: color 0.15s, -webkit-text-stroke 0.15s;
}
#advrating-stats-modal .advrating-modal-criteria-vote .star:hover {
    color: var(--advrating-star-hover, #FFD700);
    -webkit-text-stroke-color: var(--advrating-star-hover, #FFD700);
}
#advrating-stats-modal .advrating-modal-criteria-vote .star.filled,
#advrating-stats-modal .advrating-modal-criteria-vote .star.preview {
    color: var(--advrating-star-filled, var(--advrating-star-color, #FFD700));
    -webkit-text-stroke-color: var(--advrating-star-filled, #FFD700);
}

/* Последние голоса */
.recent-votes-list {
    max-height: 300px;
    overflow-y: auto;
}

.recent-vote-item {
    padding: 10px;
    transition: background 0.2s;
}

.recent-vote-item:hover {
    background: #f8f9fa;
}

/* Звезды */
.stars-display .icon-star,
.stars-display .icon-star-half {
    color: #f39c12;
}

.stars-display .icon-star-empty {
    color: #bdc3c7;
}

/* Адаптивность */
@media (max-width: 768px) {
    .distribution-row {
        grid-template-columns: 50px 1fr 80px;
        gap: 10px;
    }
    
    .rating-modal-stats .rating-value {
        font-size: 36px;
    }
    
    .rating-modal-stats .rating-stars {
        font-size: 20px;
    }
    
    .criteria-item {
        padding: 10px;
    }
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rating-modal-stats > div {
    animation: fadeIn 0.4s ease-out;
}

.rating-modal-stats > div:nth-child(2) {
    animation-delay: 0.1s;
}

.rating-modal-stats > div:nth-child(3) {
    animation-delay: 0.2s;
}

.rating-modal-stats > div:nth-child(4) {
    animation-delay: 0.3s;
}

/* Темная тема */
@media (prefers-color-scheme: dark) {
    #advrating-stats-modal .modal-content {
        background: #2d2d2d;
        color: #e0e0e0;
    }
    
    .rating-modal-stats .stats-header {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    }
    
    .rating-modal-stats .rating-value {
        color: #e0e0e0;
    }
    
    .distribution-row .progress {
        background-color: #3d3d3d;
    }
    
    .criteria-item {
        background: #3d3d3d;
    }
    
    .criteria-item:hover {
        background: #4d4d4d;
    }
    
    .recent-vote-item:hover {
        background: #3d3d3d;
    }
}
