/**
 * Comment Rating Styles - Professional & Modern
 * Pro Stone Manager Plugin
 */

/* ============================================
   Comment Rating Wrapper & Container
   ============================================ */
.psm-comment-rating-wrapper {
    margin-bottom: 30px;
    padding: 0;
}

.psm-rating-container {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e7e7e7;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.psm-rating-container:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #d0d0d0;
}

/* ============================================
   Rating Header & Label
   ============================================ */
.psm-rating-header {
    margin-bottom: 16px;
}

.psm-comment-rating-label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    letter-spacing: 0.3px;
    line-height: 1.4;
    margin: 0;
}

/* ============================================
   Stars Display - Modern Style
   ============================================ */
.psm-rating-stars-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}

.psm-stars-display {
    display: flex;
    gap: 8px;
    align-items: center;
}

.psm-star {
    /* Reset button styles */
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0;
    cursor: pointer;
    
    /* Star styling */
    font-size: 32px;
    color: #d4d4d4 !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1;
    text-align: center;
    
    /* Touch device support */
    -webkit-tap-highlight-color: transparent;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.psm-star:hover,
.psm-star:focus-visible {
    color: #ffc107 !important;
    transform: scale(1.15) translateY(-3px);
    text-shadow: 0 2px 4px rgba(255, 193, 7, 0.3);
}

.psm-star.active {
    color: #ffc107 !important;
    text-shadow: 0 2px 6px rgba(255, 193, 7, 0.4);
    animation: psm-star-pop 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Rating Display (Text & Value)
   ============================================ */
.psm-rating-display {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 8px 0;
    min-width: 120px;
}

.psm-rating-value {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1;
    min-width: 30px;
    text-align: left;
}

.psm-rating-text {
    font-size: 13px;
    color: #666;
    font-weight: 500;
    letter-spacing: 0.2px;
}

/* ============================================
   Comment Display Rating (in comments)
   ============================================ */
.psm-comment-rating {
    margin-bottom: 16px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.psm-comment-rating-stars {
    display: flex;
    align-items: center;
    gap: 4px;
}

.psm-comment-rating-stars .psm-star {
    font-size: 18px;
    cursor: default;
    transition: none;
    text-shadow: none;
}

.psm-comment-rating-stars .psm-star:hover {
    transform: none;
    text-shadow: none;
}

.psm-comment-rating-stars .psm-star-filled {
    color: #ffc107;
}

.psm-comment-rating-stars .psm-star-empty {
    color: #e0e0e0;
}

.psm-rating-numeric {
    font-size: 12px;
    color: #888;
    background: #f9f9f9;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
    border: 1px solid #f0f0f0;
}

/* ============================================
   Average Rating Widget
   ============================================ */
.psm-average-rating {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #ffc107;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.1);
}

.psm-average-rating-stars {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}

.psm-average-rating-stars .psm-star {
    font-size: 20px;
    color: #ffc107;
    text-shadow: 0 1px 3px rgba(255, 193, 7, 0.3);
}

.psm-average-rating-text {
    flex: 1;
}

.psm-average-rating-value {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.psm-average-rating-value span {
    display: inline;
}

.psm-average-rating-count {
    font-size: 13px;
    color: #666;
    font-weight: 500;
    margin-top: 4px;
}

/* ============================================
   Rating Distribution Chart
   ============================================ */
.psm-rating-distribution {
    margin-top: 20px;
}

.psm-rating-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding: 10px;
    border-radius: 6px;
    background: #f9f9f9;
    transition: background 0.2s;
}

.psm-rating-bar:hover {
    background: #f3f3f3;
}

.psm-rating-label {
    font-size: 12px;
    min-width: 60px;
    text-align: right;
    font-weight: 600;
    color: #555;
}

.psm-rating-stars {
    color: #ffc107;
    letter-spacing: 2px;
    font-size: 14px;
    min-width: 80px;
}

.psm-rating-progress {
    flex: 1;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    min-width: 100px;
}

.psm-rating-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffc107 0%, #ffb300 100%);
    border-radius: 4px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px rgba(255, 193, 7, 0.3);
}

.psm-rating-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 80px;
    text-align: right;
}

.psm-percentage {
    font-weight: 700;
    color: #1a1a1a;
    font-size: 13px;
    min-width: 35px;
}

.psm-count {
    font-size: 12px;
    color: #888;
    font-weight: 500;
}

/* ============================================
   Animations
   ============================================ */
@keyframes psm-star-pop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.25) translateY(-5px);
    }
    100% {
        transform: scale(1.15) translateY(-3px);
    }
}

@keyframes psm-fade-in {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .psm-rating-container {
        padding: 20px;
    }
    
    .psm-rating-stars-wrapper {
        gap: 16px;
        flex-direction: column;
    }
    
    .psm-rating-display {
        justify-content: center;
        width: 100%;
    }
    
    .psm-stars-display {
        justify-content: center;
        width: 100%;
    }
    
    .psm-star {
        font-size: 28px;
    }
    
    .psm-average-rating {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .psm-rating-label {
        text-align: center;
        min-width: auto;
    }
    
    .psm-rating-bar {
        flex-wrap: wrap;
    }
    
    .psm-rating-stats {
        justify-content: center;
        width: 100%;
    }
    
    .psm-comment-rating {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .psm-rating-container {
        padding: 16px;
        border-radius: 6px;
    }
    
    .psm-comment-rating-label {
        font-size: 14px;
    }
    
    .psm-star {
        font-size: 24px;
    }
    
    .psm-star:hover {
        transform: scale(1.1) translateY(-2px);
    }
    
    .psm-rating-value {
        font-size: 20px;
    }
    
    .psm-comment-rating-stars .psm-star {
        font-size: 16px;
    }
    
    .psm-average-rating {
        padding: 16px;
    }
    
    .psm-average-rating-stars .psm-star {
        font-size: 18px;
    }
}

/* ============================================
   Accessibility
   ============================================ */
.psm-star:focus-visible {
    outline: 2px solid #ffc107;
    outline-offset: 2px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .psm-rating-container {
        background: linear-gradient(135deg, #2a2a2a 0%, #1f1f1f 100%);
        border-color: #444;
    }
    
    .psm-rating-container:hover {
        border-color: #555;
    }
    
    .psm-comment-rating-label {
        color: #e0e0e0;
    }
    
    .psm-rating-value {
        color: #e0e0e0;
    }
    
    .psm-rating-text {
        color: #aaa;
    }
    
    .psm-rating-label {
        color: #aaa;
    }
    
    .psm-rating-progress {
        background: #444;
    }
    
    .psm-average-rating {
        background: linear-gradient(135deg, #1f1f1f 0%, #2a2a2a 100%);
        border-color: #ffc107;
    }
    
    .psm-rating-bar {
        background: #2a2a2a;
    }
    
    .psm-rating-bar:hover {
        background: #333;
    }
}

/* ============================================
   Error States
   ============================================ */
.psm-comment-rating-wrapper.psm-error .psm-rating-container {
    border-color: #e7e7e7;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.psm-error-message {
    color: #666;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
    padding: 8px 12px;
    background: #f0f0f0;
    border: 1px solid #e7e7e7;
    border-radius: 4px;
    animation: psm-fade-in 0.2s ease;
}
