.ofs-standings-widget {
  --ofs-bg: #ffffff;
  --ofs-border: #e5e7eb;
  --ofs-text: #111827;
  --ofs-muted: #6b7280;
  --ofs-soft: #f8fafc;
  --ofs-points-bg: #eff6ff;
  --ofs-points-text: #1d4ed8;
  --ofs-shadow: 0 8px 28px rgba(15, 23, 42, 0.07);
  margin: 18px 0;
  background: var(--ofs-bg);
  border: 1px solid var(--ofs-border);
  border-radius: 18px;
  box-shadow: var(--ofs-shadow);
  overflow: visible;
  color: var(--ofs-text);
  font-family: Arial, Helvetica, sans-serif;
}

.ofs-standings-widget * {
  box-sizing: border-box;
}

.ofs-standings-header {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #166534;
  background: var(--ofs-header-bg, linear-gradient(180deg, #4bb071 0%, #369763 100%));
  color: var(--ofs-header-text, #ffffff);
}

.ofs-standings-header-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.ofs-league-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
  flex: 0 0 38px;
}

.ofs-league-title {
  font-size: 18px;
  line-height: 1.2;
  font-weight: 700;
}

.ofs-league-meta {
  color: rgba(255,255,255,.86);
  font-size: 13px;
  margin-top: 2px;
}

.ofs-header-flag-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
}

.ofs-header-side {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.ofs-cache-indicator {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  box-shadow: 0 0 0 3px rgba(255,255,255,.16);
}

.ofs-cache-indicator.is-cached {
  background: var(--ofs-cache-on, #22c55e);
}

.ofs-cache-indicator.is-live {
  background: var(--ofs-cache-off, #ef4444);
}

.ofs-country-flag {
  width: 28px;
  height: auto;
  object-fit: contain;
  border-radius: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.ofs-country-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.16);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.ofs-table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  position: relative;
  z-index: 20;
}

.ofs-standings-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 760px;
  background: #fff;
}

.ofs-standings-table thead th {
  overflow: visible;
  position: sticky;
  top: 0;
  z-index: 21;
  background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e3a8a;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
  font-weight: 700;
  padding: 12px 10px;
  border-bottom: 1px solid var(--ofs-border);
  text-align: center;
}

.ofs-standings-table thead th.ofs-col-team {
  text-align: left;
}

.ofs-standings-table tbody td {
  padding: 12px 10px;
  border-bottom: 1px solid #eef2f7;
  font-size: 14px;
  overflow: visible;
  text-align: center;
  vertical-align: middle;
}

.ofs-standings-table tbody tr:nth-child(even) {
  background: var(--ofs-table-even, #f3fbf5);
}

.ofs-standings-table tbody tr:hover {
  background: #e8f7ec;
}

.ofs-col-rank,
.ofs-col-points {
  font-weight: 700;
}

.ofs-col-points {
  color: var(--ofs-points-text);
  background: var(--ofs-points-bg);
}

.ofs-col-team {
  text-align: left !important;
  min-width: 250px;
}

.ofs-team-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ofs-team-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex: 0 0 24px;
}

.ofs-team-name {
  font-weight: 600;
  line-height: 1.25;
}

.ofs-form-badges {
  display: flex;
  justify-content: center;
  gap: 4px;
  flex-wrap: nowrap;
}

.ofs-form-badge {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.ofs-form-win { background: var(--ofs-form-win, #16a34a); }
.ofs-form-draw { background: var(--ofs-form-draw, #f59e0b); }
.ofs-form-loss { background: var(--ofs-form-loss, #dc2626); }
.ofs-form-neutral { background: #64748b; }
.ofs-no-form { color: var(--ofs-muted); }

.ofs-style-compact .ofs-standings-table {
  min-width: 640px;
}

.ofs-style-compact .ofs-standings-table thead th,
.ofs-style-compact .ofs-standings-table tbody td {
  padding: 10px 8px;
  font-size: 13px;
}

.ofs-compact-columns .ofs-col-team {
  min-width: 200px;
}

.ofs-standings-notice {
  border-radius: 12px;
  padding: 12px 14px;
  margin: 12px 0;
  font-family: Arial, Helvetica, sans-serif;
  border: 1px solid transparent;
}
.ofs-standings-notice-warning { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
.ofs-standings-notice-error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.ofs-standings-notice-info { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

@media (max-width: 767px) {
  .ofs-standings-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .ofs-cache-badge {
    align-self: flex-start;
  }

  .ofs-league-title {
    font-size: 16px;
  }

  .ofs-standings-table {
    min-width: 700px;
  }
}


.ofs-standings-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 14px 18px 16px;
  border-top: 1px solid #93c5fd;
  background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e3a8a;
  font-size: 13px;
}

.ofs-legend-title {
  color: #1e3a8a;
  font-weight: 700;
}

.ofs-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ofs-legend-note {
  color: var(--ofs-muted);
}


/* Tooltip hover should not look clickable */
.ofs-standings-table th[title],
.ofs-standings-table td[title],
.ofs-form-badge[title],
.ofs-standings-legend[title],
.ofs-legend-item [title] {
  cursor: default !important;
}

/* Admin preview hardening */
.wp-admin .ofs-preview-box .ofs-standings-widget {
  max-width: 100%;
}

.wp-admin .ofs-preview-box .ofs-standings-widget img,
.wp-admin .ofs-preview-box .ofs-team-logo,
.wp-admin .ofs-preview-box .ofs-league-logo {
  max-width: none;
}


/* Custom tooltips */
.ofs-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: default !important;
}

.ofs-tip-anchor {
  min-width: 18px;
}

.ofs-tip::after,
.ofs-tip::before {
  position: absolute;
  left: 50%;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
  z-index: 99999;
}

.ofs-tip::after {
  content: attr(data-ofs-tooltip);
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(4px);
  background: rgba(15, 23, 42, 0.96);
  color: #fff;
  padding: 8px 10px;
  border-radius: 10px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.18);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}

.ofs-tip::before {
  content: "";
  bottom: calc(100% + 4px);
  transform: translateX(-50%) translateY(4px);
  border: 6px solid transparent;
  border-top-color: rgba(15, 23, 42, 0.96);
}

.ofs-tip:hover::after,
.ofs-tip:hover::before,
.ofs-tip:focus-visible::after,
.ofs-tip:focus-visible::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.ofs-standings-table thead th,
.ofs-standings-table tbody td,
.ofs-form-badges,
.ofs-standings-legend {
  overflow: visible;
}

.ofs-standings-table thead .ofs-tip::after {
  max-width: 220px;
  white-space: normal;
  min-width: 86px;
}

.ofs-col-form .ofs-tip::after,
.ofs-col-form.ofs-tip::after {
  min-width: 170px;
  white-space: normal;
}

.ofs-form-badge.ofs-tip::after {
  min-width: 82px;
  text-align: center;
}

.ofs-legend-note.ofs-tip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ofs-legend-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

@media (max-width: 767px) {
  .ofs-tip::after {
    font-size: 11px;
    padding: 7px 9px;
  }
}


.ofs-selector-widget {
  margin: 18px 0;
}

.ofs-selector-form {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.07);
  padding: 18px;
}

.ofs-selector-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.ofs-selector-field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 6px;
}

.ofs-selector-field select,
.ofs-selector-field input {
  width: 100%;
  height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 14px;
  background: #fff;
  color: #111827;
}

.ofs-selector-field select:focus,
.ofs-selector-field input:focus {
  outline: none;
  border-color: #2f8f5b;
  box-shadow: 0 0 0 3px rgba(47, 143, 91, 0.14);
}

.ofs-selector-field-wide {
  grid-column: span 1;
}

.ofs-selector-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.ofs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.ofs-btn-primary {
  background: #2f8f5b;
  color: #fff;
}

.ofs-btn-primary:hover {
  background: #26764b;
}

.ofs-btn-secondary {
  background: #f8fafc;
  color: #1f2937;
  border-color: #cbd5e1;
}

.ofs-btn-secondary:hover {
  background: #eef2f7;
}

.ofs-selector-results {
  margin-top: 14px;
}

@media (max-width: 767px) {
  .ofs-selector-grid {
    grid-template-columns: 1fr;
  }
}


.ofs-standings-widget,
.ofs-standings-header,
.ofs-standings-header-main,
.ofs-standings-header-main > div,
.ofs-table-wrap,
.ofs-standings-table,
.ofs-standings-table thead,
.ofs-standings-table thead tr,
.ofs-standings-table thead th,
.ofs-standings-table tbody td {
  overflow: visible;
}


.ofs-tip, .ofs-tip-anchor { position: relative; z-index: 100; }
.ofs-tip::after, .ofs-tip-anchor::after { background: var(--ofs-tooltip-bg, #1e1e1e); color: var(--ofs-tooltip-text, #ffffff); z-index: 9999; }
.ofs-standings-legend { background: var(--ofs-legend-bg, #d9e8fb); }
.ofs-selector-form select, .ofs-selector-form input[type="number"] { line-height: 1.4; min-height: 44px; padding-top: 10px; padding-bottom: 10px; }
.ofs-selector-form select { appearance: auto; -webkit-appearance: menulist; background-position: right 10px center; }
