/**
 * Top Lô Đề - Toplist Nhà Cái Lô Đề Online
 * Frontend Stylesheet - Hệ Màu Rực Rỡ, Tương Phản Cao, Nổi Bật Tuyệt Đối
 * Bongdalu High-Contrast Style | System Radius 5px | Bold Trọng Tâm | Fit 100%
 */

:root {
  --tld-toplist-radius: 5px;
  --tld-toplist-primary: #ba0000;
  --tld-toplist-primary-bright: #dc2626;
  --tld-toplist-accent: #002581;
  --tld-toplist-live: #dc2626;
  --tld-toplist-gold: #f59e0b;
  --tld-toplist-gold-dark: #d97706;
  --tld-toplist-silver: #64748b;
  --tld-toplist-bronze: #ea580c;
  --tld-toplist-bg: #f8fafc;
  --tld-toplist-border: #cbd5e1;
  --tld-toplist-text: #0f172a;
}

/* ==========================================================================
   1. BASE CONTAINER - BỎ HẲN KHUNG NGOÀI, TÁCH HEADER & ITEM THÀNH TỪNG KHỐI
   ========================================================================== */
.tld-toplist-container {
  width: 100% !important;
  max-width: 100% !important;

  background: transparent !important;
  background-color: transparent !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  font-family: Arial, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif !important;
  font-size: 100%;
  line-height: 1.5;
  color: var(--tld-toplist-text, #0f172a);
  box-sizing: border-box;
  padding: 0 !important;
  overflow: visible !important;
}

.tld-toplist-container * {
  box-sizing: border-box;
  box-shadow: none !important;
  text-shadow: none !important;
}

/* Đồng bộ class preset modern_flat */
.tld-toplist-container.tld-preset-modern_flat,
.tld-toplist-container.tld-style-standard.tld-preset-modern_flat {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
  overflow: visible !important;
}

/* ==========================================================================
   2. HEADER BANNER - TÁCH THÀNH KHỐI RIÊNG BIỆT (BO GÓC 5PX)
   ========================================================================== */
.tld-toplist-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 8px 12px;
  background-color: var(--atr-red, #ba0000) !important;
  border: none !important;
  border-bottom: 2px solid var(--atr-red-dark, #900000) !important;
  border-radius: var(--tld-toplist-radius, 5px) !important;
  margin-bottom: 10px !important;
  line-height: 1.2;
}

.tld-toplist-header .toplode-icon {
  flex-shrink: 0;
}

.tld-toplist-header svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.tld-title {
  margin: 0;
  padding: 0;
  font-size: 15px;
  font-weight: 700 !important;
  color: #ffffff !important;
  line-height: 1.2;
  letter-spacing: 0.3px;
  text-transform: none;
  text-align: left;
}

/* ==========================================================================
   2.1. BODY WRAPPER - TRONG SUỐT, TỪNG KHỐI ITEM RIÊNG BIỆT
   ========================================================================== */
.tld-toplist-body {
  padding: 0 !important;
  background: transparent !important;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ==========================================================================
   3. MATRIX TABLE DESKTOP - PHÂN CẤP MÀU SẮC SẮC NÉT
   ========================================================================== */
.tld-matrix-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* TIÊU ĐỀ BẢNG: XANH ĐEN THAN CHÌ SANG TRỌNG */
.tld-matrix-head {
  display: flex;
  align-items: center;
  background: #1e293b !important;
  border: 1px solid #0f172a !important;
  padding: 10px 16px;
  font-size: 12.5px;
  font-weight: 700 !important;
  color: #ffffff !important;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-radius: var(--tld-toplist-radius) !important;
  margin-bottom: 8px;
}

.tld-matrix-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* CARD TIÊU CHUẨN (TOP 4, 5) */
.tld-matrix-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid #cbd5e1 !important;
  border-left: 5px solid #94a3b8 !important;
  border-radius: var(--tld-toplist-radius) !important;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.25s ease,
              border-color 0.25s ease,
              border-left-width 0.25s ease;
  position: relative;
  cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  .tld-matrix-row:hover {
    border-color: #94a3b8 !important;
    border-left-color: var(--atr-red, #ba0000) !important;
    border-left-width: 8px !important;
    background: linear-gradient(90deg, #f8fafc 0%, #ffffff 100%) !important;
    transform: translateX(5px);
  }
}

/* TOP 1 - HOÀNG GIA VÀNG KIM RỰC RỠ ĐỘC LẠ */
.tld-row-top1 {
  background: linear-gradient(90deg, #fffbeb 0%, #ffffff 100%) !important;
  border: 2px solid #f59e0b !important; /* Viền vàng kim 2px đập vào mắt */
  border-left: 6px solid #d97706 !important; /* Dải vàng cam quyền lực */
}

@media (hover: hover) and (pointer: fine) {
  .tld-row-top1:hover {
    background: linear-gradient(90deg, #fef3c7 0%, #fffbeb 100%) !important;
    border-color: #d97706 !important;
    border-left-color: #b45309 !important;
    border-left-width: 9px !important;
    transform: translateX(5px);
  }
}

/* TOP 2 - DẢI NHẤN MẠ BẠC */
.tld-matrix-row:nth-child(2):not(.tld-row-top1) {
  border: 1px solid #cbd5e1 !important;
  border-left: 5px solid #475569 !important;
}

@media (hover: hover) and (pointer: fine) {
  .tld-matrix-row:nth-child(2):not(.tld-row-top1):hover {
    border-left-color: #1e293b !important;
    border-left-width: 8px !important;
    background: linear-gradient(90deg, #f1f5f9 0%, #ffffff 100%) !important;
    transform: translateX(5px);
  }
}

/* TOP 3 - DẢI NHẤN MẠ ĐỒNG CAM */
.tld-matrix-row:nth-child(3):not(.tld-row-top1) {
  border: 1px solid #cbd5e1 !important;
  border-left: 5px solid #ea580c !important;
}

@media (hover: hover) and (pointer: fine) {
  .tld-matrix-row:nth-child(3):not(.tld-row-top1):hover {
    border-left-color: #c2410c !important;
    border-left-width: 8px !important;
    background: linear-gradient(90deg, #fff7ed 0%, #ffffff 100%) !important;
    transform: translateX(5px);
  }
}

/* CÁC CỘT TRÊN DESKTOP */
.tld-col {
  padding: 0 8px;
  display: flex;
  align-items: center;
}

.tld-col-rank {
  width: 65px;
  flex-shrink: 0;
  justify-content: center;
  padding-left: 0;
}

.tld-col-brand {
  width: 28%;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.tld-col-payout {
  width: 18%;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.tld-col-promo {
  width: 38%;
  align-items: center;
}

.tld-col-action {
  width: 16%;
  flex-shrink: 0;
  justify-content: flex-end;
  padding-right: 0;
}

/* HUY HIỆU THỨ HẠNG VUỐT NHỌN THỂ THAO THEO BẢN VẼ */
.tld-rank-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 52px;
  height: 32px;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 100%, 0 100%);
  padding-left: 2px;
  padding-right: 12px; /* Bù trừ đuôi nhọn bên phải để số nằm chuẩn ở giữa */
  font-size: 16px;
  font-weight: 800 !important;
  color: #ffffff !important;
  border: none !important;
  transition: transform 0.2s ease;
}

.tld-rank-box .tld-rank-num {
  font-size: 16px;
  font-weight: 800 !important;
  line-height: 1;
}

.tld-rank-box .tld-svg-crown {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: #ffffff;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tld-matrix-row:hover .tld-rank-box {
  transform: scale(1.08);
}

.tld-row-top1:hover .tld-rank-gold .tld-svg-crown {
  transform: scale(1.25) rotate(-10deg);
}

.tld-rank-gold {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important; /* Vàng gold bóng bẩy */
}

.tld-rank-silver {
  background: linear-gradient(135deg, #64748b 0%, #475569 100%) !important; /* Bạc sắc sảo */
}

.tld-rank-bronze {
  background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%) !important; /* Đồng cam rực rỡ */
}

.tld-rank-standard {
  background: #334155 !important;
  color: #ffffff !important;
}

/* CỘT THƯƠNG HIỆU */
.tld-brand-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  width: 100%;
}

.tld-brand-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.tld-brand-name {
  color: #002581;
  font-size: 16px;
  font-weight: 800 !important;
  text-decoration: none;
  line-height: 1.2;
  transition: color 0.2s ease;
}

.tld-row-top1 .tld-brand-name {
  color: #b91c1c !important;
  font-size: 17.5px;
}

.tld-matrix-row:hover .tld-brand-name {
  color: var(--atr-red, #ba0000) !important;
}

.tld-row-top1:hover .tld-brand-name {
  color: #b45309 !important;
}

.tld-brand-name:hover {
  text-decoration: underline;
}

/* ĐÁNH GIÁ SAO DƯỚI TÊN NHÀ CÁI */
.tld-brand-rating {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1;
}

.tld-brand-rating .tld-stars {
  display: inline-flex;
  gap: 2px;
  color: #f59e0b; /* Vàng hổ phách rực rỡ */
}

.tld-brand-rating .tld-stars .tld-svg-star {
  width: 12px;
  height: 12px;
}

.tld-rating-val {
  font-size: 11px;
  font-weight: 800 !important;
  color: #854d0e;
  background: #fef9c3;
  border: 1px solid #fde047;
  padding: 1px 5px;
  border-radius: 3px;
  line-height: 13px;
}

/* HUY HIỆU BADGE TƯƠI SÁNG */
.tld-badge-custom {
  font-size: 11px;
  font-weight: 700 !important;
  padding: 2px 7px;
  background: #0284c7 !important;
  color: #ffffff !important;
  border-radius: 4px !important;
  letter-spacing: 0.3px;
}

.tld-badge-top1 {
  background: #dc2626 !important;
  color: #ffffff !important;
  font-weight: 800 !important;
}

/* KHỐI TỶ LỆ ĂN: NỀN ĐỎ TƯƠI, VIỀN ĐỎ, SỐ ĐỎ LỬA */
.tld-payout-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%) !important;
  border: 1.5px solid #f87171 !important; /* Viền đỏ tươi sắc nét */
  padding: 6px 14px;
  border-radius: var(--tld-toplist-radius) !important;
  width: auto;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.tld-payout-value {
  color: #dc2626 !important; /* Đỏ rực lửa */
  font-size: 20px;
  font-weight: 800 !important;
  line-height: 1;
  display: inline-block;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tld-row-top1 .tld-payout-value {
  font-size: 22px;
  color: #b91c1c !important;
}

.tld-matrix-row:hover .tld-payout-box {
  border-color: #dc2626 !important;
  background: linear-gradient(135deg, #fee2e2 0%, #fca5a5 100%) !important;
}

.tld-matrix-row:hover .tld-payout-value {
  transform: scale(1.06);
}

/* KHỐI KHUYẾN MÃI */
.tld-promo-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #cbd5e1 !important;
  padding: 8px 12px;
  border-radius: var(--tld-toplist-radius) !important;
  width: 100%;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.tld-promo-icon {
  color: #ea580c !important;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tld-promo-text {
  font-size: 100%;
  font-weight: 700 !important;
  color: #0f172a;
  line-height: 1.3;
}

.tld-matrix-row:hover .tld-promo-box {
  background: #ffffff !important;
  border-color: #94a3b8 !important;
}

.tld-matrix-row:hover .tld-promo-icon {
  transform: scale(1.22) rotate(12deg);
}

.tld-stars {
  display: flex;
  gap: 2px;
  color: #f59e0b; /* Vàng hổ phách rực rỡ */
}

/* NÚT BẤM CTA: GRADIENT LỬA ĐỎ CAM NỔI BẬT NHẤT */
.tld-btn-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  background: linear-gradient(135deg, #dc2626 0%, #ea580c 100%) !important; /* Đỏ sang Cam Lửa */
  color: #ffffff !important;
  text-decoration: none !important;
  border: 1px solid #b91c1c !important;
  border-radius: var(--tld-toplist-radius) !important;
  font-size: 13.5px;
  font-weight: 800 !important;
  line-height: 18px;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
}

.tld-btn-cta svg {
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tld-matrix-row:hover .tld-btn-cta {
  filter: brightness(1.08);
  transform: scale(1.03);
}

.tld-matrix-row:hover .tld-btn-cta svg {
  transform: translateX(4px);
}

.tld-btn-cta:hover {
  background: linear-gradient(135deg, #b91c1c 0%, #c2410c 100%) !important;
  color: #ffffff !important;
  text-decoration: none !important;
  transform: translateY(-1px) scale(1.05);
}

.tld-label-mobile {
  display: none;
}

/* FOOTER NOTE */
.tld-toplist-footer {
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #cbd5e1 !important;
  font-size: 12px;
  color: #475569;
  border-radius: var(--tld-toplist-radius) !important;
  margin-top: 10px;
}

.tld-security-note {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.3;
}

.tld-security-note .tld-svg-shield {
  color: #16a34a;
  flex-shrink: 0;
}

/* ==========================================================================
   4. COMPACT STYLE (FOR SIDEBAR)
   ========================================================================== */
.tld-style-compact .tld-matrix-head {
  display: none;
}

.tld-style-compact .tld-matrix-row {
  flex-wrap: wrap;
  padding: 10px;
  border-bottom: 1px solid #cbd5e1 !important;
}

.tld-style-compact .tld-col-brand {
  width: calc(100% - 60px);
}

.tld-style-compact .tld-col-payout,
.tld-style-compact .tld-col-promo,
.tld-style-compact .tld-col-rating {
  width: 100%;
  margin-top: 6px;
}

.tld-style-compact .tld-col-action {
  width: 100%;
  margin-top: 8px;
  justify-content: stretch;
}

.tld-style-compact .tld-btn-cta {
  width: 100%;
}

/* ==========================================================================
   5. MOBILE CHUẨN: MÀU SẮC RỰC RỠ & CĂN HÀNG THẲNG TẮP (< 768px)
   ========================================================================== */
@media (max-width: 767px) {
  .tld-toplist-container,
  .tld-toplist-container.tld-preset-modern_flat,
  .tld-toplist-container.tld-style-standard.tld-preset-modern_flat {
    background: transparent !important;
    background-color: transparent !important;
    padding: 0 !important;
    margin: 12px 0 !important;
    border: none !important;
    overflow: visible !important;
  }

  .tld-matrix-head {
    display: none;
  }

  .tld-toplist-header {
    padding: 7px 10px;
    margin-bottom: 8px !important;
    border-radius: var(--tld-toplist-radius, 5px) !important;
    gap: 6px;
  }

  .tld-title {
    font-size: 13.5px;
    font-weight: 700 !important;
  }

  .tld-toplist-body {
    padding: 0 !important;
    background: transparent !important;
    gap: 6px;
  }

  .tld-matrix-body {
    gap: 6px;
  }

  /* KHUNG VIỀN CARD TRÊN MOBILE */
  .tld-matrix-row {
    display: grid !important;
    grid-template-columns: 38px 1fr auto !important;
    grid-template-rows: auto auto !important;
    grid-template-areas:
      "rank brand payout"
      "rank promo action" !important;
    gap: 4px 8px !important;
    align-items: center !important;
    padding: 8px 10px !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-left: 4px solid #94a3b8 !important;
    border-radius: var(--tld-toplist-radius) !important;
    transition: transform 0.15s ease, background 0.15s ease;
  }

  .tld-matrix-row:active {
    transform: scale(0.99) !important;
    background: #f8fafc !important;
  }

  .tld-row-top1 {
    background: linear-gradient(90deg, #fffbeb 0%, #ffffff 100%) !important;
    border: 1.5px solid #f59e0b !important;
    border-left: 5px solid #d97706 !important;
  }

  .tld-row-top1:active {
    background: #fef3c7 !important;
  }

  .tld-matrix-row:nth-child(2):not(.tld-row-top1) {
    border-left: 4px solid #475569 !important;
  }

  .tld-matrix-row:nth-child(3):not(.tld-row-top1) {
    border-left: 4px solid #ea580c !important;
  }

  .tld-col {
    padding: 0 !important;
    width: auto !important;
  }

  /* CỘT 1: RANK BADGE GRADIENT THEO BẢN VẼ */
  .tld-col-rank {
    grid-area: rank !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100% !important;
  }

  .tld-rank-box {
    width: 40px !important;
    height: 30px !important;
    clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 100%, 0 100%) !important;
    padding-left: 2px !important;
    padding-right: 9px !important;
    border-radius: 0 !important;
    font-size: 15px !important;
    font-weight: 800 !important;
    flex-direction: row !important;
    gap: 2px !important;
  }

  .tld-rank-box .tld-rank-num {
    font-size: 15px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
  }

  .tld-rank-box .tld-svg-crown {
    width: 11px !important;
    height: 11px !important;
  }

  /* CỘT 2 - HÀNG 1: BRAND NAME & SAO ĐÁNH GIÁ */
  .tld-col-brand {
    grid-area: brand !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    overflow: hidden !important;
  }

  .tld-brand-wrapper {
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    overflow: hidden !important;
  }

  .tld-brand-main {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    overflow: hidden !important;
    white-space: nowrap !important;
  }

  .tld-brand-name {
    font-size: 100% !important;
    font-weight: 800 !important;
    color: #002581 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .tld-row-top1 .tld-brand-name {
    color: #b91c1c !important;
  }

  .tld-badge-custom {
    font-size: 9.5px !important;
    font-weight: 700 !important;
    padding: 1px 5px !important;
    line-height: 13px !important;
    border-radius: 3px !important;
    white-space: nowrap !important;
  }

  .tld-brand-rating {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    line-height: 1 !important;
  }

  .tld-brand-rating .tld-stars {
    display: inline-flex !important;
    gap: 1.5px !important;
  }

  .tld-brand-rating .tld-stars .tld-svg-star {
    width: 10px !important;
    height: 10px !important;
  }

  .tld-brand-rating .tld-rating-val {
    font-size: 10px !important;
    font-weight: 800 !important;
    color: #854d0e !important;
    background: #fef9c3 !important;
    border: 1px solid #fde047 !important;
    padding: 0 4px !important;
    border-radius: 3px !important;
    line-height: 12px !important;
  }

  /* CỘT 3 - HÀNG 1: PAYOUT CÓ KHUNG PILL ĐỎ RỰC */
  .tld-col-payout {
    grid-area: payout !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    text-align: right !important;
  }

  .tld-label-mobile {
    display: none !important;
  }

  .tld-payout-box {
    display: flex !important;
    flex-direction: row !important;
    align-items: baseline !important;
    background: #fee2e2 !important;
    border: 1px solid #f87171 !important;
    padding: 2px 7px !important;
    border-radius: 4px !important;
    width: auto !important;
  }

  .tld-payout-value {
    font-size: 15px !important;
    font-weight: 800 !important;
    color: #dc2626 !important;
    white-space: nowrap !important;
  }

  /* CỘT 2 - HÀNG 2: PROMO */
  .tld-col-promo {
    grid-area: promo !important;
    display: flex !important;
    align-items: center !important;
    overflow: hidden !important;
    min-width: 0 !important;
  }

  .tld-promo-box {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
  }

  .tld-promo-icon {
    width: 12px !important;
    height: 12px !important;
    flex-shrink: 0 !important;
  }

  .tld-promo-text {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  /* CỘT 3 - HÀNG 2: NÚT CTA GRADIENT LỬA */
  .tld-col-action {
    grid-area: action !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
  }

  .tld-btn-cta {
    padding: 3px 10px !important;
    font-size: 11.5px !important;
    font-weight: 800 !important;
    height: 25px !important;
    line-height: 17px !important;
    border: 1px solid #b91c1c !important;
    border-radius: 4px !important;
  }

  .tld-btn-cta .tld-svg-arrow {
    display: none !important;
  }

  .tld-col-rating {
    display: none !important;
  }

  .tld-toplist-footer {
    padding: 8px 10px !important;
    font-size: 11px !important;
  }
}
