/* ============================================================
   TBG Reviews Pro - CSS
   ============================================================ */

:root {
    --tbg-gold:     #f5a623;
    --tbg-gold-dk:  #d4881a;
    --tbg-blue:     #1a73e8;
    --tbg-text:     #1a1a1a;
    --tbg-muted:    #777;
    --tbg-border:   #e5e5e5;
    --tbg-bg:       #fafafa;
    --tbg-white:    #fff;
    --tbg-radius:   8px;
    --tbg-shadow:   0 2px 12px rgba(0,0,0,.08);
}

/* ============================================================
   WRAPPER TỔNG
   ============================================================ */
.tbg-reviews-wrap {
    font-family: inherit;
    color: var(--tbg-text);
    margin-top: 20px;
}

.tbg-section-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--tbg-text);
    border-left: 3px solid var(--tbg-gold);
    padding-left: 12px;
    margin: 0 0 18px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tbg-review-count { color: var(--tbg-muted); font-weight: 400; font-size: .9rem; }

/* ============================================================
   GRID 3 Ô
   ============================================================ */
.tbg-grid-wrap {
    display: flex;
    border: 1px solid var(--tbg-border);
    border-radius: var(--tbg-radius);
    overflow: hidden;
    margin-bottom: 28px;
    background: var(--tbg-white);
    box-shadow: var(--tbg-shadow);
}

.tbg-col { padding: 18px 20px; box-sizing: border-box; }

/* Ô 1 - Điểm TB */
.tbg-col-avg {
    flex: 0 0 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-right: 1px solid var(--tbg-border);
    text-align: center;
    gap: 4px;
    background: linear-gradient(160deg, #fffdf7 0%, #fff8e7 100%);
}
.tbg-avg-num {
    font-size: 2.8rem;
    font-weight: 900;
    color: var(--tbg-gold);
    line-height: 1;
    letter-spacing: -1px;
}
.tbg-avg-stars { display: flex; gap: 1px; }
.tbg-s         { font-size: 1rem; line-height: 1; }
.tbg-s-full    { color: var(--tbg-gold); }
.tbg-s-half    { color: var(--tbg-gold); opacity: .5; }
.tbg-s-empty   { color: #ddd; }
.tbg-avg-label { font-size: .6rem; font-weight: 700; color: var(--tbg-muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }
.tbg-avg-total { font-size: .7rem; color: var(--tbg-muted); }

/* Ô 2 - Thanh thống kê */
.tbg-col-bars {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    border-right: 1px solid var(--tbg-border);
    padding: 16px 24px;
}
.tbg-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.tbg-bar-label {
    flex: 0 0 24px;
    font-size: .82rem;
    font-weight: 700;
    color: var(--tbg-text);
    text-align: right;
}
.tbg-bar-star { color: var(--tbg-gold); }

.tbg-bar-track {
    flex: 1 1 auto;
    height: 10px;
    background: #ebebeb;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
}
.tbg-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 20px;
    background: #ebebeb;
    transition: width 1s cubic-bezier(.4,0,.2,1);
    display: block;
}
.tbg-bar-fill.tbg-bar-has-value {
    background: linear-gradient(90deg, var(--tbg-gold), var(--tbg-gold-dk));
}

.tbg-bar-pct { flex: 0 0 32px; font-size: .78rem; font-weight: 700; color: var(--tbg-text); text-align: right; }
.tbg-bar-sep { font-size: .75rem; color: #ccc; }
.tbg-bar-cnt { font-size: .75rem; color: var(--tbg-muted); min-width: 68px; }

/* Ô 3 - CTA */
.tbg-col-cta {
    flex: 0 0 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tbg-btn-cta {
    background: var(--tbg-white);
    border: 2px solid var(--tbg-blue);
    border-radius: var(--tbg-radius);
    color: var(--tbg-blue);
    font-size: .82rem;
    font-weight: 800;
    padding: 12px 16px;
    cursor: pointer;
    text-align: center;
    line-height: 1.6;
    letter-spacing: .3px;
    transition: all .2s;
}
.tbg-btn-cta:hover { background: var(--tbg-blue); color: var(--tbg-white); }

/* ============================================================
   MODAL
   ============================================================ */
.tbg-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}
.tbg-modal-overlay.is-open { display: flex; }

.tbg-modal-inner {
    background: var(--tbg-white);
    border-radius: 12px;
    padding: 32px 36px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 24px 60px rgba(0,0,0,.22);
    animation: tbgModalIn .25s ease;
    box-sizing: border-box;
}
@keyframes tbgModalIn {
    from { opacity:0; transform:translateY(-16px) scale(.97); }
    to   { opacity:1; transform:translateY(0) scale(1); }
}
.tbg-modal-close {
    position: absolute;
    top: 12px; right: 14px;
    background: none; border: none;
    font-size: 1.2rem; cursor: pointer;
    color: #999; padding: 4px 8px;
    border-radius: 4px;
    transition: all .15s;
}
.tbg-modal-close:hover { color: #333; background: #f0f0f0; }

/* Form bên trong modal */
#tbg-modal-form-wrap .comment-reply-title {
    font-size: 1.05rem !important;
    font-weight: 800 !important;
    border-left: 3px solid var(--tbg-gold);
    padding-left: 12px;
    margin-bottom: 20px !important;
    display: block;
}
#tbg-modal-form-wrap .comment-reply-title small { display: none !important; }
#tbg-modal-form-wrap label {
    font-size: .85rem;
    font-weight: 700;
    display: block;
    margin-bottom: 6px;
    color: var(--tbg-text);
}
#tbg-modal-form-wrap input[type="text"],
#tbg-modal-form-wrap input[type="email"],
#tbg-modal-form-wrap textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1.5px solid var(--tbg-border);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: .9rem;
    font-family: inherit;
    transition: border-color .2s;
    background: var(--tbg-white);
}
#tbg-modal-form-wrap input:focus,
#tbg-modal-form-wrap textarea:focus {
    border-color: var(--tbg-gold);
    outline: none;
    box-shadow: 0 0 0 3px rgba(245,166,35,.12);
}
#tbg-modal-form-wrap textarea { resize: vertical; min-height: 90px; }

/* Upload ảnh trong modal */
.tbg-upload-wrap { margin-top: 12px; }
.tbg-upload-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--tbg-bg);
    border: 1.5px dashed var(--tbg-border);
    border-radius: 6px;
    padding: 8px 16px;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .2s;
}
.tbg-upload-label:hover { border-color: var(--tbg-gold); }
#tbg-img-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tbg-preview-item { position: relative; width: 72px; height: 72px; }
.tbg-preview-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; border: 1px solid var(--tbg-border); }
.tbg-preview-remove {
    position: absolute; top: -6px; right: -6px;
    background: #e74c3c; color: #fff;
    border: none; border-radius: 50%;
    width: 18px; height: 18px;
    font-size: .7rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

/* Star picker trong modal */
.tbg-star-picker { display: flex; flex-direction: row-reverse; justify-content: flex-end; margin-bottom: 14px; }
.tbg-star-picker input[type="radio"] { display: none; }
.tbg-star-picker label {
    font-size: 1.8rem !important;
    color: #ddd !important;
    cursor: pointer !important;
    padding: 0 2px !important;
    transition: color .15s, transform .15s !important;
    display: block !important;
    margin: 0 !important;
}
.tbg-star-picker input:checked ~ label,
.tbg-star-picker label:hover,
.tbg-star-picker label:hover ~ label {
    color: var(--tbg-gold) !important;
    transform: scale(1.2) !important;
}

.tbg-modal-title {
    font-size: 1.1rem;
    font-weight: 800;
    border-left: 3px solid var(--tbg-gold);
    padding-left: 12px;
    margin: 0 0 20px;
}
.tbg-modal-field { margin: 0 0 14px; }
.tbg-field-stars label { margin-bottom: 8px; display: block; font-size:.85rem; font-weight:700; }
.tbg-field-submit { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.tbg-submit-btn {
    background: var(--tbg-gold);
    color: #fff; border: none;
    border-radius: 6px;
    padding: 11px 28px;
    font-size: .95rem; font-weight: 700;
    cursor: pointer; transition: background .2s;
}
.tbg-submit-btn:hover   { background: var(--tbg-gold-dk); }
.tbg-submit-btn:disabled { opacity: .6; cursor: not-allowed; }
.tbg-submit-msg { font-size: .88rem; }
.tbg-msg-success { color: #27ae60; }
.tbg-msg-error   { color: #e74c3c; }

    background: var(--tbg-gold) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 11px 28px !important;
    font-size: .95rem !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: background .2s !important;
}
#tbg-modal-form-wrap input[type="submit"]:hover,
#tbg-modal-form-wrap #submit:hover { background: var(--tbg-gold-dk) !important; }

/* ============================================================
   DANH SÁCH REVIEW
   ============================================================ */
.tbg-comment-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.tbg-review-item  { list-style: none; }

.tbg-review-box {
    display: flex;
    gap: 10px;
    background: var(--tbg-white);
    border: 1px solid var(--tbg-border);
    border-radius: 6px;
    padding: 10px 12px;
    transition: box-shadow .2s;
}
.tbg-review-box:hover { box-shadow: 0 2px 10px rgba(0,0,0,.07); }

.tbg-review-avatar img {
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 1.5px solid var(--tbg-gold);
    flex-shrink: 0;
}

.tbg-review-content { flex: 1; min-width: 0; }

.tbg-review-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
}
.tbg-review-author { font-size: .82rem; font-weight: 700; color: var(--tbg-text); }
.tbg-verified      { font-size: .68rem; color: #27ae60; background: #eafaf1; border-radius: 3px; padding: 1px 6px; }
.tbg-review-stars  { display: flex; gap: 0; }
.tbg-review-stars .tbg-s { font-size: .78rem; }
.tbg-review-date   { font-size: .68rem; color: var(--tbg-muted); }
.tbg-review-text { font-size: .82rem; line-height: 1.55; color: #555; margin-bottom: 6px; }
.tbg-review-text p { margin: 0; }
.tbg-review-images { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.tbg-review-img    { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; border: 1px solid var(--tbg-border); cursor: pointer; transition: opacity .2s; }
.tbg-review-img:hover { opacity: .85; }
.tbg-like-btn {
    background: none; border: 1px solid var(--tbg-border);
    border-radius: 20px; padding: 2px 8px;
    font-size: .72rem; cursor: pointer; color: var(--tbg-muted);
    transition: all .2s; display: inline-flex; align-items: center; gap: 3px;
    margin-left: auto;
}
.tbg-like-btn:hover, .tbg-like-btn.liked {
    border-color: var(--tbg-gold); color: var(--tbg-gold-dk);
    background: #fff8ec;
}
.tbg-like-count { font-weight: 700; }
.tbg-review-footer { display: flex; align-items: center; gap: 8px; }
.tbg-header-actions { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.tbg-reply-wrap a {
    font-size: .72rem; color: var(--tbg-blue);
    text-decoration: none; white-space: nowrap;
}
.tbg-reply-wrap a:hover { text-decoration: underline; }

/* Inline reply form dưới review */
.tbg-inline-reply-wrap {
    margin: 8px 0 0 44px;
    background: var(--tbg-bg);
    border: 1px solid var(--tbg-border);
    border-radius: 6px;
    padding: 10px 12px;
    animation: tbgFadeIn .2s ease;
}
.tbg-inline-reply-form { display: flex; flex-direction: column; gap: 6px; }
.tbg-reply-input {
    border: 1.5px solid var(--tbg-border); border-radius: 5px;
    padding: 7px 10px; font-size: .82rem; font-family: inherit;
    width: 100%; box-sizing: border-box;
}
.tbg-reply-input:focus { border-color: var(--tbg-gold); outline: none; }
.tbg-reply-textarea {
    border: 1.5px solid var(--tbg-border); border-radius: 5px;
    padding: 7px 10px; font-size: .82rem; font-family: inherit;
    resize: vertical; min-height: 64px;
    width: 100%; box-sizing: border-box;
}
.tbg-reply-textarea:focus { border-color: var(--tbg-gold); outline: none; }
.tbg-reply-actions { display: flex; gap: 6px; }
.tbg-reply-submit {
    background: var(--tbg-gold); color: #fff; border: none;
    border-radius: 5px; padding: 6px 16px;
    font-size: .82rem; font-weight: 700; cursor: pointer;
}
.tbg-reply-submit:hover { background: var(--tbg-gold-dk); }
.tbg-reply-cancel {
    background: none; border: 1px solid var(--tbg-border);
    border-radius: 5px; padding: 6px 12px;
    font-size: .82rem; cursor: pointer; color: var(--tbg-muted);
}
.tbg-reply-msg { font-size: .8rem; color: #27ae60; }

/* Reply lồng nhau */
.tbg-comment-list .children {
    list-style: none;
    padding: 0 0 0 44px;
    margin: 4px 0 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.tbg-comment-list .children .tbg-review-box {
    background: #f9f9f9;
    border-color: #ececec;
}

.tbg-no-reviews {
    text-align: center; color: var(--tbg-muted); font-style: italic;
    padding: 32px; border: 2px dashed var(--tbg-border);
    border-radius: var(--tbg-radius); font-size: .9rem;
}

/* ============================================================
   ẢNH KHÁCH HÀNG
   ============================================================ */
.tbg-customer-images { margin-bottom: 20px; }
.tbg-img-title { display: block; font-size: .9rem; margin-bottom: 10px; color: var(--tbg-text); }
.tbg-img-list  { display: flex; flex-wrap: wrap; gap: 8px; }
.tbg-img-item img {
    width: 72px; height: 72px; object-fit: cover;
    border-radius: 6px; border: 1px solid var(--tbg-border);
    cursor: pointer; transition: opacity .2s, transform .2s;
}
.tbg-img-item img:hover { opacity: .85; transform: scale(1.05); }

/* ============================================================
   HỎI ĐÁP
   ============================================================ */
.tbg-qa-wrap { margin-top: 32px; }

.tbg-qa-form-wrap { margin-bottom: 16px; }
.tbg-qa-form      { background: var(--tbg-bg); border: 1px solid var(--tbg-border); border-radius: var(--tbg-radius); padding: 16px 18px; }

.tbg-qa-fields { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.tbg-qa-radio  { display: flex; gap: 12px; align-items: center; }
.tbg-qa-radio label { font-size: .85rem; display: flex; align-items: center; gap: 4px; cursor: pointer; }
.tbg-qa-input  { border: 1.5px solid var(--tbg-border); border-radius: 6px; padding: 8px 12px; font-size: .88rem; font-family: inherit; flex: 1; min-width: 140px; }
.tbg-qa-input:focus { border-color: var(--tbg-gold); outline: none; }

.tbg-qa-content-wrap { position: relative; }
.tbg-qa-textarea {
    width: 100%; box-sizing: border-box;
    border: 1.5px solid var(--tbg-border);
    border-radius: 6px; padding: 10px 12px;
    font-size: .9rem; font-family: inherit;
    resize: vertical; min-height: 80px;
    transition: border-color .2s;
}
.tbg-qa-textarea:focus { border-color: var(--tbg-gold); outline: none; }
.tbg-qa-form-actions { display: flex; gap: 8px; margin-top: 10px; }
.tbg-qa-submit {
    background: var(--tbg-gold); color: #fff;
    border: none; border-radius: 6px;
    padding: 9px 22px; font-size: .88rem;
    font-weight: 700; cursor: pointer;
    transition: background .2s;
}
.tbg-qa-submit:hover { background: var(--tbg-gold-dk); }
.tbg-qa-cancel {
    background: var(--tbg-white); color: var(--tbg-muted);
    border: 1px solid var(--tbg-border); border-radius: 6px;
    padding: 9px 16px; font-size: .85rem; cursor: pointer;
}

.tbg-qa-search-wrap { margin-bottom: 16px; }
.tbg-qa-search-input {
    width: 100%; max-width: 320px; box-sizing: border-box;
    border: 1.5px solid var(--tbg-border);
    border-radius: 20px; padding: 8px 16px;
    font-size: .88rem; font-family: inherit;
    transition: border-color .2s;
}
.tbg-qa-search-input:focus { border-color: var(--tbg-gold); outline: none; }

.tbg-qa-list    { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.tbg-qa-item    { list-style: none; }
.tbg-qa-children { list-style: none; padding: 0 0 0 44px; margin: 10px 0 0; display: flex; flex-direction: column; gap: 10px; }
.tbg-qa-empty   { color: var(--tbg-muted); font-style: italic; font-size: .9rem; text-align: center; padding: 20px; }

.tbg-qa-box {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.tbg-qa-avatar {
    width: 36px; height: 36px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--tbg-gold), var(--tbg-gold-dk));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem; font-weight: 800; color: #fff;
}
.tbg-qa-body    { flex: 1; }
.tbg-qa-name    { font-size: .9rem; font-weight: 700; color: var(--tbg-text); }
.tbg-qa-gender  { font-size: .72rem; border-radius: 3px; padding: 1px 6px; margin-left: 4px; }
.tbg-male       { background: #e8f4fd; color: #1a73e8; }
.tbg-female     { background: #fce4ec; color: #e91e63; }
.tbg-qa-content { font-size: .88rem; line-height: 1.65; color: #444; margin: 6px 0; }
.tbg-qa-meta    { display: flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--tbg-muted); }
.tbg-qa-reply-btn { color: var(--tbg-blue); cursor: pointer; text-decoration: none; font-weight: 600; }
.tbg-qa-reply-btn:hover { text-decoration: underline; }
.tbg-qa-time    { color: var(--tbg-muted); }

/* Reply form inline */
.tbg-qa-reply-form-wrap {
    margin-top: 10px;
    background: var(--tbg-bg);
    border: 1px solid var(--tbg-border);
    border-radius: 6px;
    padding: 12px 14px;
    animation: tbgFadeIn .2s ease;
}
@keyframes tbgFadeIn { from { opacity:0; } to { opacity:1; } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .tbg-grid-wrap  { flex-direction: column; }
    .tbg-col-avg    { border-right: none; border-bottom: 1px solid var(--tbg-border); flex-direction: row; gap: 16px; justify-content: center; }
    .tbg-col-bars   { border-right: none; border-bottom: 1px solid var(--tbg-border); }
    .tbg-col-cta    { border-bottom: none; }
    .tbg-modal-inner { padding: 22px 18px; }
    .tbg-review-box  { flex-direction: column; }
    .tbg-review-header { flex-wrap: wrap; }
    .tbg-review-date { margin-left: 0; width: 100%; }
}