/**
 * RATING SYSTEM - SHARED STYLES
 * Dùng chung cho cả ProductDetail và ProductReviews
 */

/* ===== Star Rating (CHỈ cho modal đánh giá) ===== */
#modalRating .rating-star {
    cursor: pointer;
    transition: transform .1s ease, color .08s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    line-height: 1;
    font-size: 28px;
    color: #ced4da;
}

#modalRating .rating-star.is-on,
#modalRating .rating-star.active,
#modalRating .rating-star.hover {
    color: #ffc107;
}

#modalRating .rating-star:hover {
    transform: scale(1.08);
}

#modalRating #ratingStars {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: nowrap;
    white-space: nowrap;
    user-select: none;
}

#modalRating #ratingLabel {
    min-height: 1.25rem;
}

#modalRating #chosenStars i {
    font-size: 18px;
}

/* ===== Image Uploader (CHỈ cho modal đánh giá) ===== */
#modalRating .uploader {
    border: 1px dashed #dee2e6;
    border-radius: 12px;
    padding: 14px;
    background: #fafafa;
}

#modalRating .uploader.is-dragover {
    background: #f1f3f5;
}

#modalRating .uploader .hint {
    font-size: .875rem;
    color: #6c757d;
}

#modalRating .thumb-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

#modalRating .thumb {
    position: relative;
    width: 84px;
    height: 84px;
    border-radius: 12px;
    overflow: hidden;
    background: #e9ecef;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
}

#modalRating .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#modalRating .thumb .remove {
    position: absolute;
    top: 6px;
    right: 6px;
    border: none;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #00000088;
    color: #fff;
    cursor: pointer;
}

#modalRating .uploader .toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 8px;
}

#modalRating .uploader .counter {
    font-size: .875rem;
    color: #6c757d;
}

#modalRating .uploader .error {
    font-size: .875rem;
    color: #dc3545;
    display: none;
}

/* ===== Rating Items (Danh sách đánh giá) ===== */
.rating-item {
    padding: 20px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    margin-bottom: 0;
}

.rating-item + .rating-item {
    border-top: none;
}

.rating-item:first-child {
    border-top: none;
}

.rating-item:last-child {
    margin-bottom: 16px;
}

/* ===== Helpful Button ===== */
.btn-like-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.btn-like-icon i {
    font-size: 14px;
    color: #666;
    transition: color 0.2s ease;
}

.btn-like-icon:hover {
    border-color: #0d6efd;
    background: #f8f9fa;
}

.btn-like-icon:hover i {
    color: #0d6efd;
}

.btn-like-icon.active {
    background: #0d6efd;
    border-color: #0d6efd;
}

.btn-like-icon.active i {
    color: #fff;
}

.btn-like-icon[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.like-text {
    font-size: 13px;
    font-weight: 400;
    color: #555;
}

.like-count {
    font-size: 13px;
    font-weight: 400;
    color: #888;
}

.used-days-text {
    font-size: 12px;
    font-weight: 400;
    color: #666;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.used-days-text i {
    font-size: 11px;
    color: #888;
}

/* ===== Review Detail Modal ===== */
#reviewDetailModal.modal {
    overflow-y: auto !important;
    padding-right: 0 !important;
}

#reviewDetailModal.modal.show {
    display: block !important;
}

#reviewDetailModal .modal-dialog {
    margin: 1.75rem auto !important;
    position: relative;
    max-width: 980px;
}

#reviewDetailModal .modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

#reviewDetailModal .modal-body {
    padding: 20px 24px;
}

body.modal-open {
    overflow: hidden !important;
    padding-right: 0 !important;
    height: 100vh !important;
}

/* ===== Image Frame ===== */
.t-frame {
    position: relative;
    width: 520px;
    max-width: 100%;
    height: 360px;
    margin: 0 auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .06);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#modalMainImage {
    max-width: 92%;
    max-height: 92%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.nav-circle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .06);
    border: 1px solid #e5e7eb;
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .12);
    cursor: pointer;
    transition: background 0.2s;
}

.nav-circle:hover {
    background: rgba(0, 0, 0, .12);
}

.nav-circle.disabled {
    opacity: .4;
    pointer-events: none;
}

.nav-circle.left {
    left: 0;
    transform: translate(-50%, -50%);
}

.nav-circle.right {
    right: 0;
    transform: translate(50%, -50%);
}

.nav-circle i {
    font-size: 18px;
}

/* ===== Image Preview ===== */
.image-preview {
    cursor: pointer;
    transition: transform 0.2s;
}

.image-preview:hover {
    transform: scale(1.05);
}

/* ===== Rating Overview Progress Bars ===== */
.rating-overview-listdetail-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    padding: 4px 0;
}

.rating-overview-listdetail-item-rating {
    flex: 0 0 auto;
    width: 70px;
    display: flex;
    gap: 1px;
    font-size: 13px;
}

.rating-overview-listdetail-item-rating .fas.fa-star {
    color: #ffc107;
}

.rating-overview-listdetail-item-rating .far.fa-star {
    color: #e4e5e7;
}

.rating-overview-listdetail-item-progress {
    flex: 1;
    min-width: 200px;
    height: 10px;
    margin: 0 10px;
    border-radius: 5px;
    background-color: #f0f0f0;
}

.rating-overview-listdetail-item-progress .progress-bar {
    background-color: #60A5FA;
    border-radius: 5px;
    transition: width 0.3s ease;
}

.rating-overview-listdetail-item-text {
    flex: 0 0 auto;
    width: 80px;
    color: #333;
    font-weight: 500;
    white-space: nowrap;
    text-align: right;
    font-size: 14px;
}

/* ===== Mobile Responsive ===== */
@media (max-width: 767px) {
    .rating-overview-listdetail-item {
        gap: 6px;
        margin-bottom: 6px;
    }

    .rating-overview-listdetail-item-rating {
        width: 55px;
        font-size: 11px;
        gap: 0px;
    }

    .rating-overview-listdetail-item-progress {
        min-width: 0;
        margin: 0 6px;
        height: 8px;
    }

    .rating-overview-listdetail-item-text {
        width: 65px;
        font-size: 12px;
    }
}

/* ===== TOAST Z-INDEX FIX - Hiển thị toast trên modal ===== */
/* SweetAlert2 toast container */
.swal2-container.swal-toast-above-modal {
    z-index: 99999 !important;
}

/* ===== TOAST NOTIFICATIONS - Z-INDEX CAO NHẤT ===== */
.swal2-container {
    z-index: 999999 !important;
}

.swal2-popup.swal2-toast {
    z-index: 999999 !important;
}

/* Custom class cho rating toast */
.rating-toast-container {
    z-index: 999999 !important;
}

/* Đảm bảo backdrop modal không che toast */
.modal-backdrop {
    z-index: 1050 !important;
}

.modal {
    z-index: 1055 !important;
}

/* Simple toast fallback (khi SweetAlert2 không có) */
#simpleToast {
    position: fixed !important;
    top: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 999999 !important;
    pointer-events: auto !important;
}

/* Mobile responsive cho toast */
@media (max-width: 768px) {
    .swal2-popup.swal2-toast {
        top: 10px !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        max-width: calc(100vw - 20px) !important;
        font-size: 13px !important;
    }
    
    #simpleToast {
        top: 10px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        max-width: calc(100vw - 20px) !important;
    }
}

/* ===== RATING IMAGES IN RATING-LIST ===== */
/* Ảnh đánh giá có thể click để mở full màn hình */
.rating-images .image-preview {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.rating-images .image-preview:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #007bff;
}

.rating-images .rating-image-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

/* Mobile: tăng kích thước ảnh cho dễ click */
@media (max-width: 768px) {
    .rating-images .rating-image-item {
        width: 100px !important;
        height: 100px !important;
    }
}
