/* Arena E-Sport 0.1.3 - compatibility layer for Arena plugin views.
 * Loaded after the main theme stylesheet so Arena application screens retain
 * readable contrast and can use a wider management layout.
 */

/* Shared semantic tokens. Arena can consume these directly without depending
 * on the theme's internal --bg/--surface names. */
:root{
  --arena-ui-bg:var(--bg,#090b11);
  --arena-ui-surface:var(--surface,#111522);
  --arena-ui-surface-alt:var(--surface2,#171c2b);
  --arena-ui-text:var(--text,#f7f8fb);
  --arena-ui-text-muted:var(--muted,#9aa4b8);
  --arena-ui-border:var(--line,#252c3d);
  --arena-ui-accent:var(--arena-accent,#7c5cff);
  --arena-ui-success:#2fbf71;
  --arena-ui-warning:#d89b2b;
  --arena-ui-danger:#d95555;
  --arena-ui-radius:14px;
}

/* Arena application pages are management screens, not reading pages. */
body.arena-app-view .page-shell{
  width:min(1440px,calc(100% - 36px));
}
body.arena-app-view .single-card{
  padding:clamp(22px,3vw,42px);
}
body.arena-app-view .single-card>header,
body.arena-app-view .entry-content>*{
  max-width:none;
}
body.arena-app-view .entry-content{
  width:100%;
}

/* Keep third-party/app content readable even when it carries light surfaces
 * while the theme itself is in dark mode. These rules target common Arena
 * wrappers only and deliberately avoid generic WordPress/plugin selectors. */
body.arena-theme-dark.arena-plugin-active .entry-content :is(
  .arena-app,
  .arena-dashboard,
  .arena-manager,
  .arena-manager-area,
  .arena-manager-dashboard,
  .arena-my-arena,
  .arena-my-team,
  .arena-team-dashboard,
  .arena-team-manager,
  .arena-frontend,
  .arena-portal
){
  color:var(--arena-ui-text);
}

body.arena-theme-dark.arena-plugin-active .entry-content :is(
  .arena-app,
  .arena-dashboard,
  .arena-manager,
  .arena-manager-area,
  .arena-manager-dashboard,
  .arena-my-arena,
  .arena-my-team,
  .arena-team-dashboard,
  .arena-team-manager,
  .arena-frontend,
  .arena-portal
) :is(h1,h2,h3,h4,h5,h6,p,li,dt,dd,label,legend,summary,span,strong,small){
  color:inherit;
}

/* Common application cards/panels. We only recolour elements carrying an
 * Arena namespace, preventing global overrides of unrelated plugins. */
body.arena-theme-dark.arena-plugin-active .entry-content :is(
  [class^="arena-"][class*="card"],
  [class*=" arena-"][class*="card"],
  [class^="arena-"][class*="panel"],
  [class*=" arena-"][class*="panel"],
  [class^="arena-"][class*="box"],
  [class*=" arena-"][class*="box"],
  [class^="arena-"][class*="summary"],
  [class*=" arena-"][class*="summary"]
){
  background:var(--arena-ui-surface);
  color:var(--arena-ui-text);
  border-color:var(--arena-ui-border);
}

body.arena-theme-dark.arena-plugin-active .entry-content :is(
  [class^="arena-"][class*="tab"],
  [class*=" arena-"][class*="tab"],
  [class^="arena-"][class*="nav"],
  [class*=" arena-"][class*="nav"]
) a{
  color:var(--arena-ui-text-muted);
  border-color:var(--arena-ui-border);
}
body.arena-theme-dark.arena-plugin-active .entry-content :is(
  [class^="arena-"][class*="tab"],
  [class*=" arena-"][class*="tab"],
  [class^="arena-"][class*="nav"],
  [class*=" arena-"][class*="nav"]
) a:hover,
body.arena-theme-dark.arena-plugin-active .entry-content :is(
  [class^="arena-"][class*="tab"],
  [class*=" arena-"][class*="tab"]
) :is(.active,[aria-current="page"]){
  color:var(--arena-ui-text);
}

/* Inputs and tables inside Arena screens should remain usable in both modes. */
body.arena-plugin-active .entry-content :is(
  .arena-app,.arena-dashboard,.arena-manager,.arena-manager-area,
  .arena-manager-dashboard,.arena-my-arena,.arena-my-team,.arena-team-dashboard,
  .arena-team-manager,.arena-frontend,.arena-portal
) :is(input,select,textarea,button){
  font:inherit;
}
body.arena-theme-dark.arena-plugin-active .entry-content :is(
  .arena-app,.arena-dashboard,.arena-manager,.arena-manager-area,
  .arena-manager-dashboard,.arena-my-arena,.arena-my-team,.arena-team-dashboard,
  .arena-team-manager,.arena-frontend,.arena-portal
) :is(input,select,textarea){
  background:var(--arena-ui-surface-alt);
  color:var(--arena-ui-text);
  border-color:var(--arena-ui-border);
}
body.arena-theme-dark.arena-plugin-active .entry-content :is(
  .arena-app,.arena-dashboard,.arena-manager,.arena-manager-area,
  .arena-manager-dashboard,.arena-my-arena,.arena-my-team,.arena-team-dashboard,
  .arena-team-manager,.arena-frontend,.arena-portal
) :is(table,th,td){
  color:var(--arena-ui-text);
  border-color:var(--arena-ui-border);
}
body.arena-theme-dark.arena-plugin-active .entry-content :is(
  .arena-app,.arena-dashboard,.arena-manager,.arena-manager-area,
  .arena-manager-dashboard,.arena-my-arena,.arena-my-team,.arena-team-dashboard,
  .arena-team-manager,.arena-frontend,.arena-portal
) th{
  background:var(--arena-ui-surface-alt);
}

/* If Arena itself exposes the shared tokens, these aliases let its own CSS
 * win cleanly. This is the preferred integration path for future releases. */
body.arena-plugin-active{
  --arena-bg:var(--arena-ui-bg);
  --arena-surface:var(--arena-ui-surface);
  --arena-surface-alt:var(--arena-ui-surface-alt);
  --arena-text:var(--arena-ui-text);
  --arena-text-muted:var(--arena-ui-text-muted);
  --arena-border:var(--arena-ui-border);
  --arena-accent:var(--arena-ui-accent);
  --arena-success:var(--arena-ui-success);
  --arena-warning:var(--arena-ui-warning);
  --arena-danger:var(--arena-ui-danger);
}

@media(max-width:900px){
  body.arena-app-view .page-shell{width:min(100% - 24px,1440px)}
  body.arena-app-view .single-card{padding:18px}
}


/* 0.1.3: definitive contrast boundary for Arena application pages.
 * Arena 0.x can output its UI without a stable wrapper class, so on pages
 * positively detected as Arena views we establish a light application canvas.
 * This is deliberately page-scoped and cannot affect normal posts/pages. */
body.arena-app-view.arena-plugin-active .entry-content{
  --arena-app-bg:#ffffff;
  --arena-app-text:#172033;
  --arena-app-muted:#667085;
  --arena-app-border:#d8dee9;
  --arena-app-soft:#f6f8fb;
  color:var(--arena-app-text) !important;
  color-scheme:light;
}
body.arena-app-view.arena-plugin-active .entry-content :where(
  div,section,article,header,footer,main,aside,nav,p,span,small,strong,b,em,
  ul,ol,li,dl,dt,dd,label,legend,summary,h1,h2,h3,h4,h5,h6
){color:inherit;}
body.arena-app-view.arena-plugin-active .entry-content :where(p,small,.description,.help,.muted,[class*="muted"],[class*="description"]){
  color:var(--arena-app-muted) !important;
  opacity:1 !important;
}
body.arena-app-view.arena-plugin-active .entry-content :where(h1,h2,h3,h4,h5,h6,strong,b){
  color:var(--arena-app-text) !important;
  opacity:1 !important;
}
body.arena-app-view.arena-plugin-active .entry-content :where(a,button,[role="button"],input,select,textarea,th,td){opacity:1;}
body.arena-app-view.arena-plugin-active .entry-content :where(input,select,textarea){
  background:#fff;color:var(--arena-app-text);border-color:var(--arena-app-border);
}
body.arena-app-view.arena-plugin-active .entry-content :where(table,th,td){
  color:var(--arena-app-text);border-color:var(--arena-app-border);
}
/* Arena's current management UI uses a light card. Keep its descendants
 * readable even when the site chrome is dark. */
body.arena-app-view.arena-theme-dark .entry-content > :where(div,section,article){
  color:var(--arena-app-text);
}
/* Prevent the sticky site header from covering application page headings. */
body.arena-app-view .page-shell{
  padding-top:clamp(78px,7vw,108px) !important;
  padding-bottom:56px;
}
body.admin-bar.arena-app-view .site-header{top:32px;}
/* Give management pages a broad working canvas. */
body.arena-app-view .arena-container.page-shell{
  width:min(1500px,calc(100% - 48px));
}
body.arena-app-view .single-card{
  width:100%;
}
body.arena-app-view .entry-content :where(button,.button,[role="button"],input[type="submit"],input[type="button"]){
  cursor:pointer;
}
body.arena-app-view .entry-content :where(button,.button,[role="button"],a):focus-visible{
  outline:3px solid color-mix(in srgb,var(--arena-accent,#7c5cff) 45%,transparent);
  outline-offset:2px;
}
@media(max-width:782px){body.admin-bar.arena-app-view .site-header{top:46px;}}
@media(max-width:600px){
  body.arena-app-view .arena-container.page-shell{width:min(100% - 20px,1500px)}
  body.arena-app-view .page-shell{padding-top:64px !important}
}


/* 0.1.5: scoped Arena application polish.
 * IMPORTANT: never style arbitrary classes containing "manager" or "action".
 * Previous broad substring selectors could match layout wrappers such as
 * arena-manager-* and recolour entire sections. This layer only targets actual
 * interactive elements or explicit helper classes added by our tiny UI bridge.
 */
body.arena-app-view.arena-plugin-active .entry-content{
  --arena-action:#155eef;
  --arena-action-hover:#0b4cd4;
  --arena-pending-bg:#ffd666;
  --arena-pending-text:#3b2b00;
  --arena-closed-bg:#e7ebf0;
  --arena-closed-text:#263247;
  --arena-tab-active:#6f4cff;
  --arena-tab-border:#aeb9cc;
}

/* Keep the Arena application canvas white and calm, while site chrome stays dark. */
body.arena-app-view.arena-plugin-active .entry-content > :where(div,section,article){
  background-color:#fff;
}

/* Real controls only. No class-substring layout selectors. */
body.arena-app-view.arena-plugin-active .entry-content :is(
  a.button,
  button,
  [role="button"],
  input[type="submit"],
  input[type="button"],
  .arena-ui-action-primary,
  .arena-ui-action-secondary
){
  opacity:1 !important;
  text-shadow:none !important;
  font-weight:700 !important;
  border-radius:9px !important;
  min-height:42px;
  padding:9px 15px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  line-height:1.2;
  box-shadow:none !important;
  transition:background-color .16s ease,border-color .16s ease,color .16s ease,transform .16s ease;
}
body.arena-app-view.arena-plugin-active .entry-content :is(
  a.button,
  button,
  [role="button"],
  input[type="submit"],
  input[type="button"],
  .arena-ui-action-primary
):not([disabled]):not([aria-disabled="true"]){
  color:#fff !important;
  background:var(--arena-action) !important;
  border:1px solid var(--arena-action) !important;
}
body.arena-app-view.arena-plugin-active .entry-content :is(
  a.button,
  button,
  [role="button"],
  input[type="submit"],
  input[type="button"],
  .arena-ui-action-primary
):not([disabled]):not([aria-disabled="true"]):hover{
  color:#fff !important;
  background:var(--arena-action-hover) !important;
  border-color:var(--arena-action-hover) !important;
  transform:translateY(-1px);
}
body.arena-app-view.arena-plugin-active .entry-content .arena-ui-action-secondary{
  color:#155eef !important;
  background:#fff !important;
  border:1px solid #b8c4d8 !important;
}
body.arena-app-view.arena-plugin-active .entry-content .arena-ui-action-secondary:hover{
  color:#0b4cd4 !important;
  background:#f7f9fc !important;
  border-color:#8da1bf !important;
}
body.arena-app-view.arena-plugin-active .entry-content :is(
  a.button,
  button,
  [role="button"],
  input[type="submit"],
  input[type="button"]
):is([disabled],[aria-disabled="true"],.disabled,.is-disabled){
  color:#7d8798 !important;
  background:#f4f6f8 !important;
  border:1px solid #d9dee7 !important;
  opacity:1 !important;
  cursor:not-allowed !important;
  transform:none !important;
}

/* Tabs: outlined by default, purple only for the selected one. */
body.arena-app-view.arena-plugin-active .entry-content .arena-ui-tab{
  color:#526078 !important;
  background:#fff !important;
  border:1px solid var(--arena-tab-border) !important;
  border-radius:7px !important;
  padding:10px 15px !important;
  min-height:42px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-weight:500 !important;
}
body.arena-app-view.arena-plugin-active .entry-content .arena-ui-tab:hover{
  color:#172033 !important;
  background:#f7f8fb !important;
  border-color:#8695ad !important;
}
body.arena-app-view.arena-plugin-active .entry-content .arena-ui-tab.arena-ui-tab-active{
  color:#fff !important;
  background:var(--arena-tab-active) !important;
  border-color:var(--arena-tab-active) !important;
  font-weight:800 !important;
  box-shadow:0 0 0 3px rgba(111,76,255,.13) !important;
}

/* Status pills are opt-in classes assigned only to exact status labels. */
body.arena-app-view.arena-plugin-active .entry-content .arena-ui-status{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:30px;
  padding:5px 12px;
  border-radius:999px;
  border:1px solid transparent;
  font-size:.82rem;
  font-weight:800 !important;
  line-height:1;
  opacity:1 !important;
  white-space:nowrap;
}
body.arena-app-view.arena-plugin-active .entry-content .arena-ui-status-pending{
  color:var(--arena-pending-text) !important;
  background:var(--arena-pending-bg) !important;
  border-color:#efbe37 !important;
}
body.arena-app-view.arena-plugin-active .entry-content .arena-ui-status-closed{
  color:var(--arena-closed-text) !important;
  background:var(--arena-closed-bg) !important;
  border-color:#d7dde6 !important;
}

/* Existing match cards remain white, with a light frame and breathing room. */
body.arena-app-view.arena-plugin-active .entry-content :is(
  [class*="match-row"],
  [class*="match-card"],
  [class*="partido-row"],
  [class*="partido-card"]
){
  background:#fff !important;
  border:1px solid #d9dee7 !important;
  border-radius:10px !important;
  color:var(--arena-app-text) !important;
}

/* Page title belongs to the dark site area and must never hide under the sticky header. */
body.arena-app-view .page-shell{
  padding-top:clamp(92px,8vw,126px) !important;
}
body.arena-app-view .single-card > header{
  margin:0 0 34px;
}
body.arena-app-view .single-card > header h1{
  margin:0;
}

@media(max-width:760px){
  body.arena-app-view.arena-plugin-active .entry-content :is(
    a.button,button,[role="button"],input[type="submit"],input[type="button"],
    .arena-ui-action-primary,.arena-ui-action-secondary
  ){
    min-height:42px;
  }
}

/* 0.1.12: semantic polish matching the approved Arena management direction. */
body.arena-app-view.arena-plugin-active .entry-content{
  background:#fff !important;
  border-radius:14px;
}
body.arena-app-view.arena-plugin-active .entry-content .arena-ui-match-row{
  background:#fff !important;
  border:1px solid #d9e0ea !important;
  border-radius:10px !important;
  padding:14px 16px !important;
  margin:10px 0 !important;
  box-shadow:0 1px 0 rgba(16,24,40,.02) !important;
}
body.arena-app-view.arena-plugin-active .entry-content .arena-ui-match-row:hover{
  border-color:#c4cfdd !important;
  background:#fbfcfe !important;
}
/* Tabs remain quiet except the active one. */
body.arena-app-view.arena-plugin-active .entry-content .arena-ui-tab{
  background:#fff !important;color:#526078 !important;border:1px solid #aeb9cc !important;
}
body.arena-app-view.arena-plugin-active .entry-content .arena-ui-tab.arena-ui-tab-active{
  background:#6f4cff !important;color:#fff !important;border-color:#6f4cff !important;
}
/* Primary match action: blue, secondary/detail: outlined. */
body.arena-app-view.arena-plugin-active .entry-content .arena-ui-action-primary:not([disabled]):not([aria-disabled="true"]){
  background:#155eef !important;color:#fff !important;border-color:#155eef !important;
}
body.arena-app-view.arena-plugin-active .entry-content .arena-ui-action-secondary{
  background:#fff !important;color:#155eef !important;border:1px solid #aebbd0 !important;
}
/* Exact status chips. */
body.arena-app-view.arena-plugin-active .entry-content .arena-ui-status-pending{background:#ffd666 !important;color:#3b2b00 !important;border-color:#efbe37 !important;}
body.arena-app-view.arena-plugin-active .entry-content .arena-ui-status-closed{background:#e7ebf0 !important;color:#263247 !important;border-color:#d7dde6 !important;}
/* Do not paint generic app containers. This explicitly neutralises the bad 0.1.4 behaviour. */
body.arena-app-view.arena-plugin-active .entry-content :where([class*="manager"],[class*="dashboard"],[class*="team"]){
  background-color:transparent;
}
body.arena-app-view.arena-plugin-active .entry-content > :where(div,section,article){background:#fff !important;}
@media(max-width:760px){
  body.arena-app-view.arena-plugin-active .entry-content .arena-ui-match-row{padding:12px !important;}
  body.arena-app-view.arena-plugin-active .entry-content .arena-ui-action-primary,
  body.arena-app-view.arena-plugin-active .entry-content .arena-ui-action-secondary{width:100%;margin-top:8px;}
}
