/*
 * Frontend CSS for Nerkhito Rating Plugin
 * This is a basic structure and should be customized to match Nerkhito's design.
 */
*{
    font-family: 'IRANSansX';
}
.nr-rating-container h4 {
    font-size: 18px!important;
    margin: 30px 0 20px 0;
    text-decoration: underline;
}

.nr-rating-simple,
.nr-rating-detailed-list,
.nr-comment-ratings-container {
    width: 100%;
    font-family: 'IRANSansX';
    direction: rtl;
    text-align: right;
    max-width: 100%;
    margin: 10px 0;
}

/* 2. Color Coding */
.nr-score-high {
    color: #4CAF50 !important; /* Green */
}

.nr-score-medium {
    color: #FF9800 !important; /* Orange */
}

.nr-score-low {
    color: #F44336 !important; /* Red */
}
.nr-rating-error-single {
    color: #F44336 !important;
}

/* Apply color coding to overall score in simple/detailed view */
.nr-rating-simple .nr-overall-score-value,
.nr-rating-detailed-list .nr-overall-score-value {
    font-weight: bold;
}

/* Revert Elementor Simple Style to original look */
.nr-rating-simple {
    display: inline-block;
    font-size: 1.2em;
    font-weight: bold;
}

.nr-rating-simple .nr-overall-score-value {
    font-size: 1em;
}

/* Apply color coding to criterion scores */
.nr-criterion-score,
.nr-criterion-value,
.nr-comment-ratings-list .nr-criterion-rating-value {
    font-weight: bold;
}

/* Elementor Card Style */
.nr-rating-card {
    background-color: var(--rank-widget-bg);
    color: #ffffff;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.nr-card-title {
    font-size: 1.5em;
    margin-bottom: 15px;
    color: #ffc107;
}

.nr-card-criteria-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.nr-criterion-item {
    background-color: #fff;
    padding: 10px;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
}

.nr-criterion-label {
    font-weight: normal;
    color: #2c2b2b;
}

.nr-rate-button {
    background-color: #00c853;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s;
    text-decoration: none; /* Added for anchor tag */
    display: inline-block; /* Added for anchor tag */
}

.nr-rate-button:hover {
    background-color: #00a044;
}

.nr-total-votes {
    display: block;
    margin-top: 10px;
    font-size: 0.8em;
    color: #cccccc;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .nr-card-criteria-grid {
        grid-template-columns: 1fr;
    }
}

/* Other styles */
.nr-rating-form h4 {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    font-size: 18px; /* Request 5: Set font size to 18px */
}

.nr-criteria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* 4 columns for large screens, responsive */
    gap: 10px;
    margin-bottom: 15px;
}

.nr-criterion-rating {
    /* Styles for Issue 3: Box with border and background */
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    padding: 10px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 70px; /* Ensure a minimum height for rectangular shape */
}

.nr-criterion-rating label {
    display: block;
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 14px;
}

.nr-star-rating {
    display: inline-block;
    direction: rtl; /* Important for right-to-left star display */
    font-size: 0; /* Hide default text */
}

.nr-star-rating input[type="radio"] {
    display: none;
}

.nr-star-rating label {
    font-size: 2em;
    color: #ccc;
    cursor: pointer;
    transition: color 0.2s;
    display: inline-block;
    position: relative;
    z-index: 1;
    float: right; /* Added to make stars align horizontally */
}

.nr-star-rating label:before {
    content: '\2605'; /* Use a standard star character for better compatibility */
    font-size: 24px; /* Adjust size */
    color: #ccc;
    display: inline-block;
    width: 24px;
    height: 24px;
    vertical-align: middle;
}

/* Fix star rating functionality */
.nr-star-rating input[type="radio"]:checked ~ label:before,
.nr-star-rating label:hover:before,
.nr-star-rating label:hover ~ label:before {
    color: #ffc107; /* Filled star color */
}

.nr-star-rating input[type="radio"]:checked ~ label,
.nr-star-rating label:hover,
.nr-star-rating label:hover ~ label {
    color: #ffc107; /* Fallback for older browsers/systems */
}

.nr-comment-ratings-container {
    margin-top: 15px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
}

.nr-comment-ratings-container h4 {
    font-size: 16px!important; /* Request 1: Font size for title */
}

.nr-comment-ratings-list {
    list-style: none;
    padding: 0;
    display: flex; /* Horizontal layout */
    flex-wrap: wrap;
    gap: 10px; /* Spacing between items */
    justify-content: flex-start; /* Align items to the start */
}

.nr-comment-ratings-list li {
    padding: 5px 10px;
    border: 1px solid var(--bg-color); /* Use CSS variable for border color */
    border-radius: 5px;
    background-color: var(--bg-color); /* Use CSS variable for background color */
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px; /* Minimum width for card */
    text-align: center;
}

.nr-comment-ratings-list .nr-criterion-title {
    font-weight: normal;
    font-size: 0.8em; /* Smaller font for title */
    margin-bottom: 3px;
}

.nr-comment-ratings-list .nr-criterion-rating-value {
    font-size: 1em; /* Normal font for score */
    font-weight: bold;
}

/* Restore form style to card-like appearance */
.nr-criteria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* 4 columns for large screens, responsive */
    gap: 10px;
    margin-bottom: 15px;
}

.nr-criterion-rating label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}

.nr-star-rating {
    display: inline-block;
    margin-top: 7px;
}

.nr-message {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
}

.nr-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.nr-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
