/* CONTAINER CHÍNH */
.asr-container {
    display: inline-flex; /* Bắt buộc để span hoạt động như flex container */
    align-items: center;
    gap: 10px;
    font-family: Arial, sans-serif;
    background: transparent;
    padding: 0;
    position: relative;
    z-index: 10;
    vertical-align: middle; /* Căn giữa so với chữ Đánh Giá */
    margin-top: -2px; 
}

/* KHỐI SAO */
.asr-stars {
	display: inline-flex;
    align-items: center;
}

/* WRAPPER SAO */
.asr-star-wrap {
    position: relative;
    width: 20px; 
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Sao nền (Màu xám) - Luôn hiển thị trọn vẹn */
.asr-star-base {
    width: 20px;
    height: 20px;
    fill: #d7d7d7; /* Màu xám nhạt */
    position: absolute;
    left: 0;
    top: 0;
}
/* Sao màu vàng - Luôn full size bên trong container fill */
.asr-star-top {
    width: 20px;
    height: 20px;
    min-width: 20px; /* Bắt buộc để không bị co méo */
    fill: #ebbf03;   /* Màu vàng */
}
/* Container cắt lớp (Mask) - Chứa sao màu vàng */
.asr-star-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    overflow: hidden; /* Cắt phần thừa để tạo hiệu ứng 1/2 sao */
    width: 0%; /* Giá trị này sẽ được PHP điền vào */
    pointer-events: none; /* Để click xuyên qua vào wrapper */
    
    will-change: width;
    transition: width 0.1s ease-out; /* Hiệu ứng mượt khi thay đổi */
}

/* KHI HOVER (Class này do JS thêm vào) */
/* Dùng !important để đè lên style inline (style="width: ...%") */
.asr-star-wrap.hover-active .asr-star-fill {
    width: 100% !important;
}
.asr-star-wrap.hover-inactive .asr-star-fill {
    width: 0% !important;
}

/* KHỐI HEADER (BÊN PHẢI) */
.asr-header {
    display: inline-flex;       /* Dùng Flexbox để căn nội dung bên trong */
    align-items: center;        /* Căn giữa theo chiều dọc (trục Y) */
    height: 20px;               /* Bắt buộc: Khớp chiều cao với ngôi sao (20px) */
    line-height: 1;             /* Reset line-height để không bị khoảng trắng thừa */
    vertical-align: middle;
    
    /* Mẹo nhỏ: Đôi khi font chữ hiển thị hơi cao so với icon, 
       bạn có thể dùng translateY để đẩy xuống 1px hoặc 2px cho vừa mắt */
    transform: translateY(1px); 
}

.asr-score {
    font-size: 16px;
    font-weight: bold;
    color: #fff; 
    display: inline-block;      /* Để trình duyệt hiểu căn chỉnh khối */
    margin-right: 2px;          /* Khoảng cách nhỏ giữa điểm số và số lượng */
}

.asr-count {
    color: #bbb;
    font-size: 13px;
    display: inline-block;
    
    /* Nếu muốn số (1) nhỏ hơn nằm cao lên một chút thì dùng:
       vertical-align: text-top; 
       hoặc giữ nguyên để nó nằm giữa: */
    margin-top: 1px; 
}

/* TOOLTIP & TOAST & LOADER (Giữ nguyên như cũ) */
.asr-tooltip {
    position: absolute; bottom: 100%; left: 50%;
    transform: translateX(-50%); background: #333; color: #fff;
    padding: 4px 8px; font-size: 11px; border-radius: 4px;
    white-space: nowrap; opacity: 0; visibility: hidden;
    transition: opacity 0.2s, bottom 0.2s; pointer-events: none;
    margin-bottom: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.5); z-index: 10;
}
.asr-tooltip::after {
    content: ''; position: absolute; top: 100%; left: 50%;
    margin-left: -4px; border-width: 4px; border-style: solid;
    border-color: #333 transparent transparent transparent;
}
.asr-star-wrap:hover .asr-tooltip { opacity: 1; visibility: visible; bottom: 115%; }

#asr-toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 99999;
    display: flex; flex-direction: column; gap: 10px;
}
.asr-toast {
    background: #222;
    color: #fff;
    padding: 12px 20px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    font-size: 14px;
    display: flex;
    align-items: center;
    min-width: 200px;
    
    border-left: 4px solid #16cb00; /* Đổi sang màu xanh lá #16cb00 */
    
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}
.asr-toast.show { opacity: 1; transform: translateX(0); }
.asr-toast.error { border-left-color: #ff3333; }

@keyframes asr-shake {
  0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); }
}
.asr-container.shake { animation: asr-shake 0.4s ease-in-out; }

.asr-loader {
    display: none; width: 16px; height: 16px; border: 2px solid #888;
    border-top-color: #fff; border-radius: 50%; animation: asr-spin 0.6s linear infinite;
}
@keyframes asr-spin { to { transform: rotate(360deg); } }
.asr-container.loading .asr-loader { display: block; }
.asr-container.loading .asr-score, .asr-container.loading .asr-count { display: none; }


/* ==========================================
   CSS CHO BẢNG ĐÁNH GIÁ EMOJI
========================================== */
.asr-emoji-card {
    display: block; /* Ghi đè inline-flex của container cũ */
    width: 100%;
    max-width: 100%;
    background: #1b1b1b;
    overflow: hidden;
    font-family: Arial, sans-serif;
    color: #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.asr-emoji-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1b1b1b;
    padding: 10px 20px;
}

.asr-emoji-score-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
    font-size: 18px;
}

.asr-emoji-vote-text {
    color: #ebbf03;
    font-weight: bold;
    font-size: 14px;
}

.asr-emoji-body {
    padding: 1px 35px 20px;
    text-align: center;
}

.asr-emoji-title {
    margin-bottom: 25px;
    font-size: 15px;
    color: #ddd;
}

.asr-emojis-list {
    display: flex;
    justify-content: space-between; /* Trải đều ra 2 bên */
    gap: 10px;
}

.asr-emoji-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

/* Hiệu ứng phóng to nhẹ khi rê chuột vào Emoji */
.asr-emoji-item:hover {
    transform: scale(1.15);
}

.asr-emoji-item img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
}

.asr-emoji-item span {
    font-size: 12px;
    color: #bbb;
}

/* Xử lý trạng thái Loading cho Emoji Card */
.asr-emoji-card.loading .asr-emojis-list {
    opacity: 0.5;
    pointer-events: none;
}
.asr-emoji-card.loading .asr-loader {
    display: block !important;
}

/* XÓA VIỀN/NỀN TRẮNG CỦA ẢNH */
.asr-emoji-item img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    
    /* Ép buộc bỏ mọi viền và màu nền do theme tự thêm vào */
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    
    transition: all 0.3s ease;
}

/* LÀM NỔI BẬT ICON ĐÃ CHỌN */
.asr-emoji-item.asr-emoji-selected img {
    transform: scale(1.3); /* Phóng to 30% */
    filter: drop-shadow(0 0 8px rgba(235, 191, 3, 0.8)); /* Phát sáng màu vàng xung quanh */
}

.asr-emoji-item.asr-emoji-selected span {
    color: #ebbf03; /* Chữ chuyển sang màu vàng */
    font-weight: bold;
}

/* LÀM MỜ CÁC ICON KHÁC KHI ĐÃ CÓ VOTE */
/* Khi container có class has-voted, các icon không được chọn sẽ bị mờ và xám đi */
.asr-container.has-voted .asr-emoji-item:not(.asr-emoji-selected) {
    opacity: 0.4;
    filter: grayscale(100%);
}

/* Khi rê chuột vào các icon bị mờ, chúng sẽ sáng lại để dễ chọn lại */
.asr-container.has-voted .asr-emoji-item:not(.asr-emoji-selected):hover {
    opacity: 1;
    filter: grayscale(0%);
    transform: scale(1.1);
}