/* ==========================================================================
   Befair Base Components & Utilities (bf-base.css)
   统一 .bf-* 前缀，并结合 .bf-app 容器作用域隔离 PeepSo / Gecko 宿主主题样式
   依赖：bf-tokens.css
   ========================================================================== */

/* ---------- 0. 基准字体继承（防止 button/table/label 回落到主题衬线体） ---------- */
.bf-app {
  font-size: 14px;
}

.bf-app,
.bf-app :where(button, input, select, textarea, table, th, td, label, p, span, a) {
  font-family: var(--bf-font-sans) !important;
}

/* ---------- 1. 布局与文本工具类（替代高频内联 style） ---------- */
.bf-flex-center {
  display: flex;
  align-items: center;
}

.bf-flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bf-flex-col-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.bf-shrink-0 {
  flex-shrink: 0;
}

.bf-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bf-truncate-icon {
  max-width: calc(100% - 20px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bf-meta-caption {
  margin: 0;
  line-height: 1.3;
  font-size: 11px;
  color: var(--bf-text-score-muted);
}

.bf-score-line {
  height: 18px;
  line-height: 18px;
  margin: 3px 0;
  font-size: 12px;
  font-weight: 700;
}

.bf-text-brand     { color: var(--bf-brand-primary); }
.bf-text-primary   { color: var(--bf-text-primary); }
.bf-text-secondary { color: var(--bf-text-secondary); }
.bf-text-muted     { color: var(--bf-text-score-muted); }

/* 图表 Tooltip 与高频小部件工具类 */
.bf-tooltip-title {
  font-weight: 700;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--bf-border-subtle);
  padding-bottom: 2px;
  color: var(--bf-text-body);
}

.bf-tooltip-val {
  font-weight: 700;
  margin-left: 12px;
  color: var(--bf-text-primary);
}

.bf-stat-box {
  border: 1px solid var(--bf-border-default);
  width: 30%;
  padding: 5px 10px;
  border-radius: 5px;
  background: var(--bf-bg-muted);
  box-sizing: border-box;
}

.bf-progress-bar {
  width: calc(100% - 6px);
  height: 13px;
  background: var(--bf-brand-tint);
  border: 1px solid var(--bf-brand-border-soft);
  border-radius: var(--bf-radius-xs);
  position: relative;
  overflow: hidden;
  margin: 2px 3px 0 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.bf-progress-bar__text {
  position: relative;
  font-size: 9px;
  color: #c2410c;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transform: scale(0.85);
  z-index: 1;
}

/* ---------- 2. 卡片容器与行卡片 ---------- */
.bf-card {
  background: var(--bf-bg-surface);
  border: 1px solid var(--bf-border-subtle);
  border-radius: var(--bf-radius-md);
  box-shadow: var(--bf-shadow-card);
  padding: var(--bf-space-md) 14px;
  box-sizing: border-box;
}

.bf-card--subtle {
  background: var(--bf-bg-subtle);
  border-color: var(--bf-border-default);
}

.bf-card-row {
  background: var(--bf-bg-surface);
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.bf-card-row:hover {
  background-color: var(--bf-brand-hover-bg);
}

.bf-card-row:active {
  transform: scale(0.98);
  background-color: var(--bf-brand-tint);
}

.bf-card-cell-lead {
  width: 50px;
  color: var(--bf-text-score-muted);
  border-left: 6px solid var(--bf-brand-primary);
  border-radius: var(--bf-radius-md) 0 0 var(--bf-radius-md);
  vertical-align: middle;
}

/* ---------- 3. 表格隔离重置 ---------- */
.bf-app .bf-table,
.bf-table {
  width: 100%;
  font-size: 12px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--bf-font-sans);
}

.bf-app .bf-table th,
.bf-app .bf-table td,
.bf-table :where(th, td) {
  border: none;
  vertical-align: middle;
  background: transparent;
}

.bf-table--truncate :where(th, td) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 4. 按钮、胶囊触发器与切换开关（.bf-app 加固权重，压过 PeepSo） ---------- */
.bf-app .bf-btn,
.bf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--bf-radius-pill);
  border: 1px solid transparent;
  background: var(--bf-bg-surface);
  color: var(--bf-text-body);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s ease;
  box-sizing: border-box;
}

.bf-app .bf-btn:hover,
.bf-app .bf-btn:focus {
  text-decoration: none;
}

.bf-app .bf-btn:active,
.bf-btn:active {
  transform: scale(0.97);
}

.bf-app .bf-btn--primary,
.bf-btn--primary {
  background: var(--bf-brand-gradient);
  color: var(--bf-text-inverse);
  box-shadow: 0 4px 14px rgba(255, 123, 84, 0.35);
}

.bf-app .bf-btn--primary:hover,
.bf-btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--bf-brand-glow);
  color: var(--bf-text-inverse);
}

.bf-app .bf-btn--secondary,
.bf-btn--secondary {
  background: #e0e0e0;
  color: #555555;
}

.bf-app .bf-btn--secondary:hover,
.bf-btn--secondary:hover {
  background: #d0d0d0;
  color: #333333;
}

.bf-app .bf-btn--soft,
.bf-btn--soft {
  background: var(--bf-brand-soft);
  color: var(--bf-brand-primary);
}

.bf-app .bf-btn--soft:hover,
.bf-app .bf-btn--soft.is-open,
.bf-btn--soft:hover,
.bf-btn--soft.is-open {
  border-color: var(--bf-brand-primary);
}

.bf-app .bf-btn--outline,
.bf-btn--outline {
  border-color: var(--bf-border-default);
  background: var(--bf-bg-surface);
  color: var(--bf-text-secondary);
}

.bf-app .bf-btn--outline:hover,
.bf-app .bf-btn--outline.is-active,
.bf-btn--outline:hover,
.bf-btn--outline.is-active {
  border-color: var(--bf-brand-hover);
  background: var(--bf-brand-soft);
  color: var(--bf-brand-primary);
}

.bf-app .bf-link-pill,
.bf-link-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--bf-radius-lg);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.bf-app .bf-link-pill:hover,
.bf-app .bf-link-pill:active,
.bf-link-pill:hover,
.bf-link-pill:active {
  background-color: var(--bf-info);
  color: var(--bf-text-inverse);
  text-decoration: none;
}

.bf-app .link-btn.bf-value-pill-highlight,
.bf-app .bf-value-pill-highlight,
.bf-value-pill-highlight {
  background-color: var(--bf-brand-soft) !important;
  color: var(--bf-brand-active) !important;
}

.bf-app .link-btn.bf-value-pill-highlight:hover,
.bf-app .link-btn.bf-value-pill-highlight:active,
.bf-app .bf-value-pill-highlight:hover,
.bf-app .bf-value-pill-highlight:active,
.bf-value-pill-highlight:hover,
.bf-value-pill-highlight:active {
  background-color: var(--bf-brand-primary) !important;
  color: var(--bf-bg-surface) !important;
}

.bf-app .bf-switch,
.bf-switch {
  display: inline-flex;
  background: var(--bf-bg-muted);
  border: 1px solid var(--bf-border-hairline);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}

.bf-app .bf-switch__option,
.bf-switch__option {
  padding: 6px 14px;
  border-radius: var(--bf-radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--bf-text-secondary);
  cursor: pointer;
  user-select: none;
  transition: all 0.18s ease;
}

.bf-app .bf-switch__option.is-active,
.bf-switch__option.is-active {
  background: var(--bf-brand-soft);
  color: var(--bf-brand-primary);
}

/* ---------- 5. Tab 切换栏 ---------- */
.bf-app .bf-tabs,
.bf-tabs {
  display: flex;
  align-items: stretch;
  width: 100%;
  border-bottom: 1px solid var(--bf-border-subtle);
  margin-bottom: 10px;
  font-family: var(--bf-font-sans);
}

.bf-app .bf-tab,
.bf-tab {
  flex: 1;
  text-align: center;
  padding: 9px 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--bf-text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  transition: color 0.18s ease, background-color 0.18s ease;
}

.bf-app .bf-tab:hover,
.bf-tab:hover {
  color: var(--bf-brand-primary);
}

.bf-app .bf-tab.is-active,
.bf-tab.is-active {
  color: var(--bf-text-primary);
  font-weight: 600;
}

.bf-app .bf-tab.is-active::after,
.bf-tab.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 30px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--bf-brand-accent);
}

/* ---------- 6. 状态徽章与圆点标签 ---------- */
.bf-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: var(--bf-radius-md);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
}

.bf-badge--brand   { background: var(--bf-brand-tint); color: var(--bf-brand-primary); }
.bf-badge--info    { background: var(--bf-info-soft); color: var(--bf-info-strong); }
.bf-badge--success { background: var(--bf-success-soft); color: var(--bf-success-strong); }
.bf-badge--danger  { background: var(--bf-danger-soft); color: var(--bf-danger); }

.bf-dot-badge {
  margin-left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bf-brand-primary);
  color: var(--bf-text-inverse);
  font-size: 9px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--bf-shadow-xs);
}

/* ---------- 7. 时间轴节点与 PSO 进度（跨 4 个模板通用组件） ---------- */
.bf-timeline-node {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 4;
}

.bf-timeline-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bf-bg-surface);
  border: 2px solid var(--bf-text-muted);
  box-sizing: border-box;
  transition: all 0.3s ease;
}

.bf-timeline-node.node-start .bf-timeline-dot {
  background: var(--bf-text-primary);
  border-color: var(--bf-text-primary);
}

.bf-timeline-node.is-active .bf-timeline-dot {
  background: var(--bf-success);
  border-color: var(--bf-success);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}

.bf-timeline-info {
  position: absolute;
  top: 13px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}

.bf-timeline-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--bf-text-secondary);
  line-height: 1.2;
}

.bf-timeline-node.is-active .bf-timeline-label {
  color: var(--bf-text-primary);
  font-weight: 700;
}

.bf-timeline-pso-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: 0;
}

.bf-timeline-pso-track {
  width: 38px;
  height: 3px;
  position: relative;
}

.bf-timeline-pso-track-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background-color: var(--bf-border-strong);
  border-radius: 2px;
}

.bf-timeline-pso-track-fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 3px;
  background-color: var(--bf-success);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.bf-timeline-pso-track-fill.is-filled {
  width: 100%;
}

.bf-timeline-pso-wrapper.is-inplay .bf-timeline-pso-track-fill {
  background-color: var(--bf-warning);
  animation: bfPsoTrackPulse 1.5s infinite;
}

.bf-timeline-node.node-pso.is-pulsing .bf-timeline-dot {
  background: var(--bf-warning);
  border-color: var(--bf-warning);
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.4);
  animation: bfPsoDotPulse 1.2s infinite ease-in-out;
}

@keyframes bfPsoTrackPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes bfPsoDotPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.4); }
  50% { transform: scale(1.25); box-shadow: 0 0 0 6px rgba(249, 115, 22, 0.15); }
}

@media (max-width: 768px) {
  .bf-timeline-dot {
    width: 7.5px;
    height: 7.5px;
    border-width: 1.5px;
  }
  .bf-timeline-info {
    top: 10px;
  }
  .bf-timeline-label {
    font-size: 9px;
  }
  .bf-timeline-pso-track {
    width: 26px;
  }
}

/* ---------- 8. 弹窗遮罩与底部抽屉 ---------- */
.bf-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bf-bg-backdrop);
  backdrop-filter: blur(4px);
  z-index: var(--bf-z-modal);
  display: none;
  align-items: center;
  justify-content: center;
}

.bf-backdrop.is-open,
.bf-backdrop.active {
  display: flex;
}

.bf-sheet {
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  background: var(--bf-bg-surface);
  border-radius: var(--bf-radius-xl) var(--bf-radius-xl) 0 0;
  box-shadow: var(--bf-shadow-modal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bf-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px var(--bf-space-xl) 12px;
  border-bottom: 1px solid var(--bf-border-subtle);
}

.bf-sheet__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--bf-text-heading);
}

.bf-sheet__body {
  padding: var(--bf-space-sm) var(--bf-space-lg);
  overflow-y: auto;
  flex: 1;
}

/* ---------- 9. 开关标签与单选组统一样式 ---------- */
.bf-switch-label {
  font-family: var(--bf-font-sans);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--bf-text-secondary);
  margin-left: 6px;
  line-height: 1.25;
  white-space: nowrap;
  user-select: none;
}

body .bf-radio-group,
.bf-radio-group {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px !important;
  font-family: var(--bf-font-sans) !important;
}

body .bf-radio-group label,
.bf-radio-group label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--bf-font-sans) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--bf-text-secondary) !important;
  cursor: pointer;
  margin: 0;
  padding: 0;
  transition: color 0.18s ease;
}

body .bf-radio-group label:hover,
.bf-radio-group label:hover {
  color: var(--bf-brand-primary) !important;
}

body .bf-radio-group label span,
.bf-radio-group label span {
  font-family: var(--bf-font-sans) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
}

body .bf-radio-group input[type="radio"],
.bf-radio-group input[type="radio"] {
  -webkit-appearance: none !important;
  appearance: none !important;
  background: #ffffff !important;
  border: 1.5px solid #767676 !important;
  border-radius: 50% !important;
  box-shadow: none !important;
  outline: none !important;
  margin: 0 !important;
  padding: 0 !important;
  width: 14px !important;
  height: 14px !important;
  min-width: 14px !important;
  min-height: 14px !important;
  cursor: pointer;
  vertical-align: middle;
  flex-shrink: 0;
  box-sizing: border-box !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

body .bf-radio-group input[type="radio"]:checked,
.bf-radio-group input[type="radio"]:checked {
  border-color: var(--bf-brand-primary, #FF7B54) !important;
  background: #ffffff !important;
  box-shadow: inset 0 0 0 3.5px var(--bf-brand-primary, #FF7B54) !important;
}

body .bf-radio-group input[type="radio"]::before,
.bf-radio-group input[type="radio"]::before,
body .bf-radio-group input[type="radio"]::after,
.bf-radio-group input[type="radio"]::after {
  content: none !important;
  display: none !important;
}

body .bf-radio-group input[type="radio"]:checked + span,
.bf-radio-group input[type="radio"]:checked + span {
  color: #e67e22 !important;
}

/* ---------- 10. 折叠面板兼容规则（替代 Bootstrap .collapse） ---------- */
.collapse {
  display: none;
}

.collapse.in,
.collapse.show {
  display: block;
}

tr.collapse.in,
tr.collapse.show {
  display: table-row;
}

.bf-collapse-caret {
  display: inline-block;
  vertical-align: -2px;
  margin-left: 3px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

[data-toggle="collapse"][aria-expanded="true"] .bf-collapse-caret {
  transform: rotate(180deg);
}

/* ---------- 11. 场均进失球提示徽章统一样式 ---------- */
.bf-avg-goals-tip {
  font-family: var(--bf-font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--bf-text-body);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  padding: 2px 6px;
  border-radius: var(--bf-radius-sm);
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.bf-avg-goals-tip:hover {
  background-color: var(--bf-brand-soft);
  border-color: var(--bf-brand-hover);
  color: var(--bf-brand-active);
}

.bf-wdl-circle {
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.bf-wdl-circle:hover {
  transform: scale(1.12);
  background-color: #6AC8D2 !important;
  box-shadow: 0 2px 6px rgba(106, 200, 210, 0.45);
}

/* ---------- 12. 全局容器、通用工具类与原生 Tooltip ---------- */
#app {
  background: var(--bf-bg-page, #eef1f5);
  padding: 0 10px 10px;
  border-radius: 6px;
  width: 100%;
  box-sizing: border-box;
}

#app p {
  margin: 0;
}

#app .nowrap {
  text-align: left;
  white-space: nowrap;
}

#app .nowrap td {
  padding: 5px;
}

#app .nowrap td p {
  margin: 0;
}

.smallFont {
  font-size: 12px;
  transform-origin: 0 0;
}

.full-width {
  width: 100%;
}

.clickedItem {
  background: #fafafa !important;
}

.linkBox:hover {
  cursor: pointer;
  background-color: #f2f4f7;
}

.gc-header__inner {
  font-size: 128% !important;
}

.bf-native-tooltip {
  position: fixed;
  z-index: 99999;
  max-width: 260px;
  padding: 5px 10px;
  font-size: 12px;
  line-height: 1.4;
  color: #fff;
  background: rgba(17, 24, 39, 0.92);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease;
  word-break: break-word;
  font-family: var(--bf-font-sans);
}

.bf-native-tooltip.is-visible {
  opacity: 1;
  visibility: visible;
}

/* ---------- 13. 布局对齐、隐藏滚动条与表格去边框 ---------- */
.bf-app .pull-left {
  float: left !important;
}

.bf-app .pull-right {
  float: right !important;
}

.bf-app .clearfix::after {
  content: "";
  display: table;
  clear: both;
}

.bf-app .text-center {
  text-align: center !important;
}

.bf-app .text-left {
  text-align: left !important;
}

.bf-app .text-right {
  text-align: right !important;
}

.bf-app .scrollable {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.bf-app .scrollable::-webkit-scrollbar {
  display: none;
}

.bf-app .bottom-left-panel table,
.bf-app .bottom-left-panel thead,
.bf-app .bottom-left-panel tbody,
.bf-app .bottom-left-panel tr,
.bf-app .bottom-left-panel th,
.bf-app .bottom-left-panel td,
.bf-app .h2hTable,
.bf-app .h2hTable thead,
.bf-app .h2hTable tbody,
.bf-app .h2hTable tr,
.bf-app .h2hTable th,
.bf-app .h2hTable td,
.bf-app .teamMatchTable,
.bf-app .teamMatchTable thead,
.bf-app .teamMatchTable tbody,
.bf-app .teamMatchTable tr,
.bf-app .teamMatchTable th,
.bf-app .teamMatchTable td {
  border: none !important;
}

.bf-app .bf-h2h-pane table:not(.h2hTable),
.bf-app .bf-h2h-pane table:not(.h2hTable) tr,
.bf-app .bf-h2h-pane table:not(.h2hTable) th,
.bf-app .bf-h2h-pane table:not(.h2hTable) td,
.bf-app #entity-list-section table:not(.teamMatchTable),
.bf-app #entity-list-section table:not(.teamMatchTable) tr,
.bf-app #entity-list-section table:not(.teamMatchTable) th,
.bf-app #entity-list-section table:not(.teamMatchTable) td {
  border: none !important;
  background: transparent !important;
}

.bf-app .bf-h2h-pane table:not(.h2hTable) tr:hover,
.bf-app .bf-h2h-pane table:not(.h2hTable) tr:hover td,
.bf-app #entity-list-section table:not(.teamMatchTable) tr:hover,
.bf-app #entity-list-section table:not(.teamMatchTable) tr:hover td {
  background: transparent !important;
}

.bf-app tr.card-line td:hover,
.bf-app tr.card-line:hover td {
  background: transparent !important;
}

.bf-app tr.card-line:hover {
  background-color: #f2f4f7 !important;
  cursor: pointer;
}

