:root {
    --bg: #f9fafb;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #d1d5db;
    --green: #166534;
    --blue: #2563eb;
}
.divider {
    margin: 4px 0;
    border-top: 1px dashed var(--border);
}

.rating-section {
    padding: 4px 0;
    clear: both;
}

.rating-section * {
    box-sizing: border-box;
}

.rating-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin: 0;
}

.rating-row .label {
    color: var(--muted);
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 5px;
    align-self: flex-start;
}

.rating-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 0;
    margin-bottom: 0;
}

.rating-buttons.has-user-interacted {
    padding-bottom: 19px;
}

.rating-btn {
    position: relative;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    font-size: 22px;
    transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease, filter 0.2s ease;
    padding: 0px;
}

/* Nhãn mức đánh giá bên dưới khi hover / focus / đã chọn (is-exact) */
.rating-btn::after {
    content: attr(data-level-label);
    position: absolute;
    left: 50%;
    top: calc(100% + 5px);
    transform: translateX(-50%) translateY(2px);
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--muted);
    transition: opacity 0.15s ease, transform 0.15s ease, color 0.15s ease;
    z-index: 3;
}

.rating-btn:hover::after,
.rating-btn:focus-visible::after,
.rating-btn.is-exact::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.rating-btn:hover {
    transform: scale(1.12);
}

.rating-btn:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}

/* Hover: sáng màu theo từng mức (chưa chọn) */
.rating-btn.rating-1:hover:not(.is-active) {
    color: #f87171;
    background: rgba(239, 68, 68, 0.14);
}
.rating-btn.rating-2:hover:not(.is-active) {
    color: #fb923c;
    background: rgba(249, 115, 22, 0.14);
}
.rating-btn.rating-3:hover:not(.is-active) {
    color: #eab308;
    background: rgba(234, 179, 8, 0.18);
}
.rating-btn.rating-4:hover:not(.is-active) {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.16);
}
.rating-btn.rating-5:hover:not(.is-active) {
    color: #34d399;
    background: rgba(16, 185, 129, 0.16);
}

.rating-btn.rating-1:hover:not(.is-active)::after,
.rating-btn.rating-1:focus-visible:not(.is-active)::after {
    color: #b91c1c;
}
.rating-btn.rating-2:hover:not(.is-active)::after,
.rating-btn.rating-2:focus-visible:not(.is-active)::after {
    color: #c2410c;
}
.rating-btn.rating-3:hover:not(.is-active)::after,
.rating-btn.rating-3:focus-visible:not(.is-active)::after {
    color: #a16207;
}
.rating-btn.rating-4:hover:not(.is-active)::after,
.rating-btn.rating-4:focus-visible:not(.is-active)::after {
    color: #15803d;
}
.rating-btn.rating-5:hover:not(.is-active)::after,
.rating-btn.rating-5:focus-visible:not(.is-active)::after {
    color: #047857;
}

/* Ô đã chọn: hover làm sáng nhẹ nền */
.rating-btn.is-active:hover,
.rating-btn.is-active:focus-visible {
    filter: brightness(1.12);
}

.rating-btn.rating-1.is-active:hover::after,
.rating-btn.rating-1.is-active:focus-visible::after {
    color: #b91c1c;
}
.rating-btn.rating-2.is-active:hover::after,
.rating-btn.rating-2.is-active:focus-visible::after {
    color: #c2410c;
}
.rating-btn.rating-3.is-active:hover::after,
.rating-btn.rating-3.is-active:focus-visible::after {
    color: #a16207;
}
.rating-btn.rating-4.is-active:hover::after,
.rating-btn.rating-4.is-active:focus-visible::after {
    color: #15803d;
}
.rating-btn.rating-5.is-active:hover::after,
.rating-btn.rating-5.is-active:focus-visible::after {
    color: #047857;
}

.rating-btn.is-active {
    color: #fff;
}

.rating-btn.is-exact {
    box-shadow: 0 0 0 2px #d1d5db;
}

.rating-btn.rating-1.is-exact::after {
    color: #b91c1c;
}
.rating-btn.rating-2.is-exact::after {
    color: #c2410c;
}
.rating-btn.rating-3.is-exact::after {
    color: #a16207;
}
.rating-btn.rating-4.is-exact::after {
    color: #15803d;
}
.rating-btn.rating-5.is-exact::after {
    color: #047857;
}

/*.rating-1.is-active { background: #ef4444; }
.rating-2.is-active { background: #f97316; }
.rating-3.is-active { background: #facc15; color: #111827; }
.rating-4.is-active { background: #4ade80; color: #064e3b; }
.rating-5.is-active { background: #10b981; }*/

.rt-1.is-active { background: #ef4444; }
.rt-2.is-active { background: #f97316; }
.rt-3.is-active { background: #facc15; color: #111827; }
.rt-4.is-active { background: #4ade80; color: #064e3b; }
.rt-5.is-active { background: #10b981; }
.meta {
    color: #9ca3af;
    font-size: 14px;
}

.feedback-form {
    margin-top: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 5px;
    background: #f3f4f6;
    padding: 4px 8px;
    position: relative;
}

.avatar {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    background: #f97316;
    color: #fff;
}

.feedback-form div.h3 {
    margin: 5px 0;
    font-size: 14px !important;
    font-weight: bold;
}

.reasons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.reason-btn {
    border: 1px solid #d1d5db;
    border-radius: 999px;
    background: #fff;
    color: #4b5563;
    padding: 8px 14px;
    font-size: 14px;
    cursor: pointer;
}

.reason-btn.is-selected {
    border-color: #3b82f6;
    color: #1d4ed8;
    background: #eff6ff;
    font-weight: 600;
}

.comment-input,
.contact-field-input {
    border-radius: 5px !important;
    border: 1px solid #d1d5db;
    padding: 15px !important;
    font-size: 14px !important;
    line-height: 1.45;
    outline: none;
    font-family: inherit;
    color: var(--text);
    background-color: #fff;
    box-sizing: border-box;
}

.comment-input {
    width: 100%;
    min-height: 80px;
    resize: vertical;
}

.comment-input:focus,
.contact-field-input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.3);
}

.contact-inputs-row {
    display: flex;
    gap: 12px;
    margin-top: 4px;
    margin-bottom: 4px;
}

.contact-field-input {
    flex: 1 1 0;
    min-width: 0;
}

.actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
    margin-bottom: 12px;
}

.submit-btn {
    border: 0;
    border-radius: 5px;
    background: var(--blue);
    color: #fff;
    padding: 9px 16px;
    cursor: pointer;
    font-weight: 600;
}

.submit-btn:hover {
    background: #1d4ed8;
}

.success-message {
    margin-top: 16px;
    border: 1px solid #bbf7d0;
    border-radius: 5px;
    padding: 12px;
    text-align: center;
    background: #f0fdf4;
    color: #15803d;
    font-weight: 600;
}

@media (max-width: 640px) {
    .rating-section {
        padding-left: 16px;
        padding-right: 16px;
    }

    .divider {
        margin: 4px 0;
    }

    .contact-inputs-row {
        flex-direction: column;
    }
}
