/**
 * نظام التقييم بالنجوم
 * Star Rating System Component
 */

/* =============== Star Rating Input =============== */
.star-rating-input {
    display: flex;
    flex-direction: row-reverse;
    gap: 5px;
    justify-content: center;
}

.star-rating-input input {
    display: none;
}

.star-rating-input label {
    cursor: pointer;
    font-size: 2rem;
    color: #d1d5db;
    transition: all 0.2s ease;
}

.star-rating-input label:hover,
.star-rating-input label:hover~label,
.star-rating-input input:checked~label {
    color: #f59e0b;
    transform: scale(1.1);
}

.star-rating-input label:active {
    transform: scale(0.9);
}

/* =============== Rating Modal =============== */
.rating-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.rating-modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.rating-modal {
    background: var(--card-bg, #fff);
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.rating-modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rating-modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary, #1f2937);
    display: flex;
    align-items: center;
    gap: 10px;
}

.rating-modal-header h3 i {
    color: #f59e0b;
}

.rating-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted, #6b7280);
    transition: color 0.2s;
}

.rating-modal-close:hover {
    color: var(--text-primary, #1f2937);
}

.rating-modal-body {
    padding: 24px;
}

/* =============== Rating Form =============== */
.rating-form-group {
    margin-bottom: 24px;
}

.rating-form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary, #1f2937);
    text-align: center;
}

.rating-main-section {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(251, 191, 36, 0.1));
    border-radius: 16px;
    margin-bottom: 24px;
}

.rating-main-section h4 {
    margin-bottom: 15px;
    color: var(--text-primary, #1f2937);
}

.rating-sub-ratings {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 24px;
}

.sub-rating-item {
    text-align: center;
    padding: 15px;
    background: var(--bg-secondary, #f9fafb);
    border-radius: 12px;
}

.sub-rating-item label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted, #6b7280);
    margin-bottom: 8px;
}

.mini-star-rating {
    display: flex;
    flex-direction: row-reverse;
    justify-content: center;
    gap: 3px;
}

.mini-star-rating input {
    display: none;
}

.mini-star-rating label {
    cursor: pointer;
    font-size: 1.2rem;
    color: #d1d5db;
    transition: color 0.2s;
}

.mini-star-rating label:hover,
.mini-star-rating label:hover~label,
.mini-star-rating input:checked~label {
    color: #f59e0b;
}

.rating-comment {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color, #e5e7eb);
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.2s;
}

.rating-comment:focus {
    outline: none;
    border-color: #f59e0b;
}

.rating-submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

.rating-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(245, 158, 11, 0.4);
}

.rating-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* =============== Stars Display =============== */
.stars-display {
    display: inline-flex;
    gap: 2px;
}

.stars-display i {
    color: #f59e0b;
}

/* =============== Rating Card =============== */
.rating-card {
    background: var(--card-bg, #fff);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.rating-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.rating-card-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
}

.rating-card-info h4 {
    font-size: 0.95rem;
    margin-bottom: 3px;
}

.rating-card-info span {
    font-size: 0.8rem;
    color: var(--text-muted, #6b7280);
}

.rating-card-stars {
    margin-right: auto;
}

.rating-card-comment {
    padding: 12px;
    background: var(--bg-secondary, #f9fafb);
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary, #1f2937);
}

/* =============== User Badges =============== */
.user-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.badge-item {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
}

.badge-item.gold {
    background: linear-gradient(135deg, #D4AF37, #B8860B);
}

.badge-item.silver {
    background: linear-gradient(135deg, #C0C0C0, #A0A0A0);
}

/* =============== Rating Summary =============== */
.rating-summary {
    display: flex;
    gap: 30px;
    padding: 20px;
    background: var(--card-bg, #fff);
    border-radius: 16px;
    margin-bottom: 20px;
}

.rating-summary-score {
    text-align: center;
    min-width: 120px;
}

.rating-summary-score .big-number {
    font-size: 3rem;
    font-weight: 800;
    color: #f59e0b;
}

.rating-summary-score .total {
    font-size: 0.85rem;
    color: var(--text-muted, #6b7280);
}

.rating-summary-bars {
    flex: 1;
}

.rating-bar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.rating-bar-item .star-num {
    font-size: 0.85rem;
    min-width: 20px;
}

.rating-bar-item .bar {
    flex: 1;
    height: 8px;
    background: var(--bg-secondary, #e5e7eb);
    border-radius: 4px;
    overflow: hidden;
}

.rating-bar-item .bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.rating-bar-item .count {
    font-size: 0.8rem;
    color: var(--text-muted, #6b7280);
    min-width: 30px;
}

/* =============== Responsive =============== */
@media (max-width: 600px) {
    .rating-sub-ratings {
        grid-template-columns: 1fr;
    }

    .rating-summary {
        flex-direction: column;
        gap: 20px;
    }

    .star-rating-input label {
        font-size: 1.5rem;
    }
}