/* ===== GRID ===== */
.yt-grid-qtass{
  --gap: 36px;
  --radius: 24px;
  --blue: #18BDFA;
  display: grid;
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  gap: var(--gap);
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 12px 28px;
  box-sizing: border-box;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ===== CARD ===== */
.yt-thumb-card{
  position: relative;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 20px 44px rgba(0,0,0,.12);
  overflow: hidden;
  aspect-ratio: 16/9;
  transform: translateZ(0);
  transition: box-shadow .25s ease, transform .25s ease;
  cursor: pointer
}

.yt-thumb-card:hover{
  box-shadow: 0 28px 64px rgba(0,0,0,.16);
  transform: translateY(-2px);
}

/* Thumbnail làm nền */
.yt-thumb-card .thumb{
  position:absolute; inset:0;
  width:100%; height:100%;
  object-fit: cover;
  transition: transform .35s ease;
  z-index: 1;
}
.yt-thumb-card:hover .thumb{ transform: scale(1.035); }

/* Lớp mờ nhẹ giúp bar/ chữ nổi hơn */
.yt-thumb-card::after{
  content:"";
  position:absolute; inset:0;
  background: linear-gradient(180deg, rgba(0,0,0,.06) 0%, rgba(0,0,0,.18) 60%, rgba(0,0,0,.22) 100%);
  pointer-events:none;
  z-index: 2;
}

/* ===== BLUE BAR chứa TITLE ===== */
.yt-thumb-card .bar{
  position:absolute;
  left:0; bottom:0;
  height: 56px;
  width: min(68%, 520px);
  background: var(--blue);
  border-top-right-radius: 16px;
  display:flex; align-items:center;
  padding: 0 18px;
  transition: width .25s ease;
  z-index: 3; /* cao hơn gradient và thumbnail */
}

/* tiêu đề trong khung xanh: container cho tooltip */
.yt-thumb-card .bar .title{
  position: relative;     /* cho tooltip định vị theo title */
  color:#fff;
  font-size: clamp(14px, 1.15vw, 19px);
  letter-spacing:.2px;
  line-height: 1;
  width: 100%;
  cursor: help;
  overflow: visible;      /* QUAN TRỌNG: để tooltip không bị cắt */
}

/* span con hiển thị 1 dòng + ellipsis */
.yt-thumb-card .bar .title .txt{
  display:block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Hover: vạch xanh dài ra tí cho cảm giác tương tác */
.yt-thumb-card:hover .bar{
  width: min(84%, 660px);
}

/* ==== Tooltip custom ==== */
.yt-thumb-card .title::after{
  content: attr(data-tooltip);
  position: absolute;
  left: 0;
  bottom: 110%;                       /* nằm phía trên chữ */
  background: rgba(0,0,0,.85);
  color: #fff;
  font-size: 12px;
  line-height: 1.3;
  padding: 6px 8px;
  border-radius: 6px;
  max-width: 280px;
  white-space: normal;                 /* cho phép xuống dòng */
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 999;                        /* đảm bảo nổi trên mọi thứ trong card */
}

/* Mũi tên nhỏ */
.yt-thumb-card .title::before{
  content: "";
  position: absolute;
  left: 12px;
  bottom: 100%;
  border-width: 6px;
  border-style: solid;
  border-color: transparent transparent rgba(0,0,0,.85) transparent;
  opacity: 0;
  transition: opacity .2s ease;
  z-index: 999;
}

.yt-thumb-card .title:hover::after,
.yt-thumb-card .title:hover::before{
  opacity: 1;
  transform: translateY(0);
}

/* ==== Responsive ==== */
@media (max-width: 1200px){
  .yt-grid-qtass{ gap: 28px; }
  .yt-thumb-card .bar{ height:52px; }
}
@media (max-width: 1024px){
  .yt-grid-qtass{ grid-template-columns: repeat(2, minmax(260px, 1fr)); }
}
@media (max-width: 640px){
  .yt-grid-qtass{ grid-template-columns: 1fr; gap: 22px; }
  .yt-thumb-card .bar{ width: 86%; }
  .yt-thumb-card:hover .bar{ width: 92%; }
}

/* (Tuỳ chọn) Tôn trọng người dùng giảm motion */
@media (prefers-reduced-motion: reduce){
  .yt-thumb-card,
  .yt-thumb-card .thumb,
  .yt-thumb-card .bar,
  .yt-thumb-card .title::after{
    transition: none !important;
  }
}
