/* 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; }