:root { --r1-star: #f59e0b; /* cam */ --r1-star-muted:#d9dee5; }

/* Single product: rating nằm dưới price */
.summary .wc-r1-toprating--single{
  display:flex;
  margin-top:8px;  /* khoảng cách với price */
  line-height:1;
}
.summary .wc-r1-toprating--single .star-rating{ margin:0; }
.summary .wc-r1-toprating--single .wc-r1-avg-link{
  margin-left:6px;
  text-decoration:underline;
  font-size:16px;
}

/* Link "4.67 out of 5" */
.wc-r1-toprating .wc-r1-outof5,
.wc-r1-looprating .wc-r1-outof5 {
  color: #0C486B;
  text-decoration: underline;
  font-weight: 500;
}

/* Loop: khối dưới title */
.products .wc-r1-looprating {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wc-r1 .r1-country { display:flex; align-items:center; gap:6px; margin-top:2px; }
.wc-r1 .r1-flag { font-size:16px; line-height:1; }



.wc-r1 { font-size:16px; color:#0f2137; }
.wc-r1 .r1-title { font-size:34px; text-align:center; margin:6px 0 22px; font-family:Georgia,'Times New Roman',serif; }
.wc-r1 .r1-wrap { display:grid; grid-template-columns:0.8fr 1.2fr 1fr; gap:40px; align-items:center; }
.wc-r1 .r1-col { padding:8px 0; padding-left: 30px; }
.wc-r1 .r1-divider { border-left:1px solid #e6ebf0; }
.wc-r1 .r1-stars { color: var(--r1-star); margin-bottom:6px; }
.wc-r1 .r1-avg { font-size:28px; font-weight:700; }
.wc-r1 .r1-based { color:#667085; font-size:14px; display:flex; align-items:center; gap:6px; }
.wc-r1 .r1-bars .row { display:flex; align-items:center; gap:18px; margin:8px 0; }
.wc-r1 .r1-bars .lab { min-width:100px; display:flex; align-items:center; gap:4px; color: var(--r1-star);}
.wc-r1 .r1-bars .lab svg { width:16px; height:16px; display:block; }
.wc-r1 .bar-outer { flex:1; height:12px; background:#eef2f7; border-radius:18px; overflow:hidden; }
.wc-r1 .bar-inner { height:100%; background:var(--r1-star); }
.wc-r1 .bar-pct { width:24px; text-align:right; color:#77839a; font-size:13px; }
.wc-r1 .r1-actions { display:flex; flex-direction:column; gap:12px; max-width:260px; margin-left: 20px; }
.wc-r1 .btn { background: var(--r1-star); color:#fff; border:none; padding:12px 16px; border-radius:6px; cursor:pointer; text-align:center; font-weight:600; }
.wc-r1 .btn.outline { background:#fff; color:#111; border:1px solid #e6ebf0; }
.wc-r1 .r1-search { margin:16px 0 8px; }
.wc-r1 .r1-search input { width:100%; padding:10px 12px; border:1px solid #e6ebf0; border-radius:6px; }
.wc-r1 .review-item { border-top:1px solid #eef2f7; padding:18px 0; }
.wc-r1 .review-meta { font-size:13px; color:#667085; margin-bottom:6px; display:flex; gap:12px; align-items:center; flex-wrap:wrap; }
.wc-r1 .review-stars { color: var(--r1-star); }
.wc-r1 .empty { color:#6b7280; }

.r1-rating-inline {
  display: flex;
  align-items: center;
  gap: 8px; /* khoảng cách giữa sao và số */
}
/* Đặt 2 nút Cancel + Submit trên cùng 1 hàng, căn giữa */
.r1-actions-1 > p{
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 16px 0 0;
}
.r1-actions-1 > p br{ display:none; }              /* bỏ xuống dòng cưỡng bức */
.r1-actions-1 .wpcf7-spinner{ margin-left: 8px; }  /* spinner không phá layout */

:root{ --r1-btn-h: 44px; --r1-btn-br: 8px; }

.r1-actions-1 .btn-cancel,
.r1-actions-1 .btn-submit,
.r1-actions-1 input.wpcf7-submit.btn-submit {
  min-width:160px;
  height: var(--r1-btn-h);
  padding: 0 18px !important;   /* bỏ padding 5px 40px */
  border-radius: var(--r1-btn-br) !important;
  border: 2px solid #0C486B !important;
  font-weight:600;
  font-size:15px;
  line-height:1;                /* cùng chiều cao thực tế */
  display:inline-flex; align-items:center; justify-content:center;
  box-sizing:border-box;
  cursor:pointer;
  -webkit-appearance:none; appearance:none;
  margin:0 !important;
}

a.btn-cancel.js-close-question {
    text-decoration: unset !important;
}

/* Spinner CF7: đừng đẩy lệch nút */
.r1-actions-1 .wpcf7-spinner{ margin-left:8px; position:static; }

/* Cancel */
.r1-actions-1 .btn-cancel {
  background: #fff;
  color: #0C486B;
}

.r1-actions-1 .btn-submit {
  background: #0C486B;
  color: #fff;
}

/* Hover effects */
.r1-actions-1 .btn-cancel:hover {
  background: #f0f4f8;
}
.r1-actions-1 .btn-submit:hover {
  background: #093655;
}

.r1-rating-inline .r1-stars {
  line-height: 1;
}

.r1-rating-inline .r1-avg {
  font-size: 13px; /* bạn chỉnh lại cỡ cho đẹp */
  font-weight: 400;
  color: #0C486B; /* giữ cam hoặc inherit */
  margin-bottom: 4px;
  text-decoration: underline;
}

/* ===== Modal ===== */
.r1-modal { position: fixed; inset: 0; display: none; z-index: 9999; }
.r1-modal.is-open { display: block; }
.r1-modal .r1-backdrop { position:absolute; inset:0; background:rgba(15,33,55,.45); }
.r1-modal .r1-dialog {
  position:relative; max-width:720px; margin:6vh auto; background:#fff;
  border-radius:10px; box-shadow:0 20px 60px rgba(0,0,0,.2);
  padding:18px 22px;
}
.r1-dialog-hd { display:flex; justify-content:center; align-items:center; position:relative; margin-bottom:10px; }
.r1-dialog-hd h3 { margin:0; font-size:22px; color:#0C486B; }
.r1-close { position:absolute; right:8px; top:4px; font-size:26px; background:none; border:0; cursor:pointer; line-height:1; }
.r1-dialog-bd { padding:8px 10px 6px; }

/* CF7 fields trong modal */
.r1-dialog-bd .wpcf7 form p { margin:12px 0; }
.r1-dialog-bd input[type="text"],
.r1-dialog-bd input[type="email"],
.r1-dialog-bd textarea {
  width:100%; padding:12px 14px; border:1px solid #dfe6ee; border-radius:6px; outline:none;
}
.r1-dialog-bd textarea { min-height:140px; resize:vertical; }
.r1-dialog-bd input[type="submit"] {
  background: var(--r1-star); color:#fff; border:0; border-radius:8px; padding:12px 16px; cursor:pointer;
}

/* Nút Cancel trong form (nếu có) */
.r1-dialog-bd .btn-cancel {
  display:flex; margin-right:10px; padding:10px 16px;
  border:1px solid #dfe6ee; border-radius:8px; background:#f4f6f9; color:#0f2137;
  justify-content: center;
}

/* Thông báo sau gửi */
.r1-modal.sent .wpcf7 form .wpcf7-response-output {
  border-color:#0C486B; color:#0C486B; text-align:center; border-radius:8px;
}

input.wpcf7-form-control.wpcf7-submit.has-spinner.btn-submit {
    border-radius: 8px !important;
    margin-top: unset;
}

/* Success UI */
.r1-success {
  text-align: center;
  padding: 22px 10px 10px;
}
.r1-success-icon {
  display: inline-flex;
  width: 48px; height: 48px;
  align-items: center; justify-content: center;
  margin-bottom: 8px;
}
.r1-success-title {
  font-weight: 700; font-size: 20px; color: #0C486B;
  margin-bottom: 6px;
}
.r1-success-sub {
  color: #4b5f73; font-size: 14px;
}

/* ==== List layout giống mẫu ==== */
.r1-item{
  display:grid;
  grid-template-columns: 240px 1fr 120px; /* trái / giữa / phải */
  gap:20px;
  padding:20px 0;
  border-top:1px solid #eef2f7;
}
.r1-item:first-child{ border-top:0; }

.r1-left .r1-user{ display:flex; gap:12px; align-items:center; }
.r1-avatar{ width:40px; height:40px; border-radius:50%; object-fit:cover; }
.r1-name{ font-weight:600; display:flex; gap:8px; align-items:center; }
.r1-badge{ background:#0C486B; color:#fff; font-size:12px; border-radius:6px; padding:2px 6px; }
.r1-sub{ color:#667085; font-size:13px; margin-top:2px; }

.r1-stars-line{ color: var(--r1-star); margin-bottom:6px; }
.r1-title-sm{ margin:2px 0 6px; font-size:16px; font-weight:700; color:#0f2137; }
.r1-content{ color:#223; }
.r1-pill{ display:inline-block; margin-top:10px; background:#f2f5f9; border:1px solid #e1e7ef; border-radius:6px; padding:6px 10px; font-size:13px; color:#445; }

.r1-share{ display:flex; gap:14px; margin-top:10px; }
.r1-share a{ color:#0C486B; text-decoration:none; font-weight:700; }

.r1-right{ text-align:right; display:flex; flex-direction:column; gap:12px; align-items:flex-end; }
.r1-date{ color:#8a97a8; font-size:12px; }

.r1-votes{ display:flex; gap:16px; }
.r1-vote{ background:#f6f8fb; border:1px solid #dfe6ee; border-radius:6px; padding:6px 10px; cursor:pointer; }
.r1-vote .r1-count{ margin-left:6px; color:#0f2137; font-weight:600; }



/* Responsive */
@media (max-width: 980px){
  .r1-item{ grid-template-columns:1fr; }
  .r1-right{ align-items:flex-start; text-align:left; }
}


/* ========= Mobile tweaks ========= */
@media (max-width: 768px){

  .r1-modal .r1-dialog { margin:4vh 12px; padding:16px; }

  /* xếp dọc, giảm gap */
  .wc-r1 .r1-wrap{
    grid-template-columns: 1fr;
    gap: 14px;
    align-items: stretch;
  }

  /* bỏ viền dọc & padding trái từng cột */
  .wc-r1 .r1-divider{ border: none; padding-top: 0; }
  .wc-r1 .r1-col{ padding-left: 0; }

  /* cụm rating: thu nhỏ, căn trái */
  .r1-rating-inline,
  .wc-r1 .r1-col .r1-based{
    gap: 6px;
    justify-content: center;   /* căn giữa ngang */
    text-align: center;
  }
  .r1-rating-inline .r1-avg{
    font-size: 14px;        /* dễ đọc trên mobile */
    text-underline-offset: 2px;
  }
  .wc-r1 .r1-stars {
    font-size: 18px !important;   /* bật lại kích thước */
    line-height: 1;
    display: inline-block;
    margin-right: 8px;
  }
  .wc-r1 .r1-stars .star-rating { 
    float: none; 
    margin: 0; 
    display: inline-block; 
    height: 1em;
  }
  .wc-r1 .r1-stars .star-rating,
  .wc-r1 .r1-stars .star-rating::before,
  .wc-r1 .r1-stars .star-rating span::before {
    font-size: 18px;
  }

  /* nền sao rỗng & sao đã tô */
  .wc-r1 .r1-stars .star-rating::before { color: var(--r1-star-muted); }
  .wc-r1 .r1-stars .star-rating span::before { color: var(--r1-star); }

  /* hàng sao + progress */
  .wc-r1 .r1-bars .row{
    gap: 8px;
    margin: 6px 0;
  }
  .wc-r1 .r1-bars .lab{
    min-width: auto;        /* bỏ cố định 110px để không vỡ hàng */
    padding-left: 0;        /* sát trái */
  }
  .wc-r1 .r1-bars .lab svg{
    width: 14px; height: 14px;
  }
  .wc-r1 .bar-outer{ height: 10px; }
  .wc-r1 .bar-pct{ width: 28px; font-size: 12px; }

  /* nút hành động: full width, dễ bấm */
  .wc-r1 .r1-actions{
    max-width: none;
    margin-left: 0;
    flex-direction: row;
    gap: 10px;
  }
  .wc-r1 .r1-actions .btn,
  .wc-r1 .r1-actions .btn.outline{
    flex: 1 1 0;
    padding: 12px;
  }

  /* ô search: thu lề */
  .wc-r1 .r1-search{ margin: 12px 0 6px; }
  .wc-r1 .r1-search input{ padding: 10px; }

  /* danh sách review: khoảng cách gọn */
  .wc-r1 .review-item{ padding: 14px 0; }
  .wc-r1 .review-meta{ gap: 8px; font-size: 12.5px; }
}

@media (max-width: 480px){
  /* nhỏ hơn nữa: co icon/thanh */
  .wc-r1 .r1-bars .lab svg{ width: 12px; height: 12px; }
  .wc-r1 .bar-outer{ height: 8px; }
  .wc-r1 .bar-pct{ width: 22px; font-size: 11.5px; }
  .r1-rating-inline .r1-avg{ font-size: 13px; }
  .wc-r1 .r1-actions {
    display: flex;
    flex-direction: column;    /* xếp dọc */
    gap: 12px;
    width: 100%;
  }

  .r1-actions-1 {
    flex-direction: column;   /* từ ngang sang dọc */
    align-items: stretch;     /* full width mỗi nút */
    gap: 10px;
  }

  .r1-actions-1 > p{
    flex-direction: column;   /* từ ngang sang dọc */
    align-items: stretch;     /* full width mỗi nút */
    gap: 10px;
    margin: 16px 0 0;
  }

  .wc-r1 .r1-actions .btn,
  .wc-r1 .r1-actions .btn.outline {
    width: 100%;               /* mỗi button chiếm hết chiều ngang */
    text-align: center;
  }
}

.r1-media video.r1-media-thumb {
  object-fit: cover;
  border-radius: 6px;
  background: #000;
}
.r1-media-thumb.is-video {
  position: relative;
}
.r1-media-thumb.is-video::after {
  content: '▶';
  position: absolute;
  inset: 0;
  display:flex;
  align-items:center;
  justify-content:center;
  color: #fff;
  font-size: 20px;
  background: rgba(0,0,0,0.25);
  border-radius: 6px;
  pointer-events: none;
}
