/* The web admin panel (/admin) inside the player layout: the admin screens are still built by app.js with the
   old class names (x1-*), so this file dresses them in Midnight Navy. Two parts:
   1. The old palette variables those screens use are pointed at the new colours (this also recolours the
      inline styles in app.js, which use var(--x1-navy-deep) and friends).
   2. The main building blocks (header, tabs, cards, tables, buttons, inputs, tags) get the new shapes. */

body.ps-mode {
  --x1-navy-deep: var(--ps-panel);
  --x1-navy-main: var(--ps-panel-2);
  --x1-navy-bar: #1a2550;
  --x1-blue-btn: var(--ps-blue);
  --x1-blue-light: #5B9DFF;
  --x1-green: #17b85a;
  --x1-green-hover: #22cf68;
  --x1-red: var(--ps-red);
  --cyber--75-bg: #08090C;
  --cyber--60-bg: var(--ps-bg);
  --cyber--45-bg: var(--ps-panel);
  --cyber--40-bg: var(--ps-panel);
  --cyber--35-bg: var(--ps-panel);
  --cyber--25-bg: var(--ps-panel-2);
  --cyber--10-bg: var(--ps-panel-2);
  --cyber-0-bg: #1b2650;
  --cyber-10-bg: #262B36;
  --cyber-15-bg: #333A48;
  --cyber-sep: var(--ps-line);
  --cyber-primary: var(--ps-blue);
  --cyber-strong: #9cc3ff;
  --cyber-decent: var(--ps-dim);
  --cyber-good: var(--ps-green);
  --cyber-bad: var(--ps-red);
  --cyber-accent-gradient: linear-gradient(135deg, #2F6FEB 0%, #5B9DFF 100%);
  --cyber-toggled-gradient: linear-gradient(135deg, #2F6FEB 0%, #2F6FEB 100%);
  --radius: 12px;
}

/* ---------- page ---------- */
body.ps-mode #view-admin { color: var(--ps-text); font-size: 13.5px; gap: 14px; }
body.ps-mode #view-admin .x1-admin-back { display: none; }
body.ps-mode #view-admin .x1-page-header {
  background: linear-gradient(160deg, rgba(45, 123, 255, 0.2) 0%, var(--ps-panel) 55%);
  border: 1px solid var(--ps-line);
  border-radius: 18px;
  padding: 16px 18px;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}
body.ps-mode #view-admin .x1-page-header h2 { font-size: 20px; font-weight: 900; color: #fff; letter-spacing: -0.2px; }
body.ps-mode #view-admin .x1-page-header p { color: var(--ps-dim); font-size: 12.5px; margin-top: 4px; }

/* Section tabs: the same chips as the match list; scroll sideways on phones, wrap on PC */
body.ps-mode #view-admin .x1-admin-tabs {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 8px;
  margin: 0 -18px -16px;
  padding: 4px 18px 16px;
  scrollbar-width: none;
}
body.ps-mode #view-admin .x1-admin-tabs::-webkit-scrollbar { display: none; }
body.ps-mode #view-admin .x1-filter-group { gap: 8px; }
body.ps-mode #view-admin .x1-filter-btn {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 14px;
  border-radius: 18px;
  border: 1px solid var(--ps-line);
  background: var(--ps-panel-2);
  color: var(--ps-text);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease;
}
body.ps-mode #view-admin .x1-filter-btn:hover { border-color: rgba(77, 157, 255, 0.5); }
body.ps-mode #view-admin .x1-filter-btn.active { background: #fff; border-color: #fff; color: #0A0C10; }
@media (min-width: 768px) {
  body.ps-mode #view-admin .x1-admin-tabs { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
}

/* ---------- KPI boxes ---------- */
body.ps-mode #view-admin .x1-kpi-grid { gap: 10px; }
body.ps-mode #view-admin .x1-kpi-card {
  background: linear-gradient(160deg, var(--ps-panel-2) 0%, var(--ps-panel) 70%);
  border: 1px solid var(--ps-line);
  border-left: 4px solid var(--ps-blue);
  border-radius: 14px;
  padding: 12px 14px;
}
body.ps-mode #view-admin .x1-kpi-label { color: var(--ps-dim); letter-spacing: 0.4px; }
body.ps-mode #view-admin .x1-kpi-val { font-size: 22px; letter-spacing: -0.3px; }

/* ---------- cards ---------- */
body.ps-mode #view-admin .x1-admin-card {
  background: var(--ps-panel);
  border: 1px solid var(--ps-line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}
body.ps-mode #view-admin .x1-admin-card h3,
body.ps-mode #view-admin .x1-admin-log-head h3 { color: #fff; font-size: 15px; font-weight: 800; }
body.ps-mode #view-admin .x1-admin-card h3,
body.ps-mode #view-admin .x1-admin-log-head { border-bottom-color: var(--ps-line); }
body.ps-mode #view-admin .x1-admin-collapsible > summary h3::after { color: var(--ps-dim); }
body.ps-mode #view-admin .x1-admin-result {
  background: rgba(31, 220, 106, 0.1);
  border: 1px solid rgba(31, 220, 106, 0.35);
  border-radius: 12px;
}

/* ---------- tables ---------- */
body.ps-mode #view-admin .data-table-wrap { border: 1px solid var(--ps-line); border-radius: 12px; }
body.ps-mode #view-admin .data-table { font-size: 12.5px; }
body.ps-mode #view-admin .data-table th {
  background: var(--ps-panel-2);
  color: var(--ps-dim);
  font-size: 11px;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--ps-line);
}
body.ps-mode #view-admin .data-table td { border-bottom: 1px solid rgba(35, 47, 88, 0.7); }
body.ps-mode #view-admin .data-table tr:last-child td { border-bottom: none; }
body.ps-mode #view-admin .data-table tbody tr:hover td { background: rgba(45, 123, 255, 0.06); }
body.ps-mode #view-admin .x1-table-empty { color: var(--ps-dim); text-align: center; padding: 22px 10px; }
body.ps-mode #view-admin .x1-queue-first td { background: rgba(31, 220, 106, 0.07); }
body.ps-mode #view-admin .x1-queue-no { background: #262B36; }
body.ps-mode #view-admin .x1-queue-first .x1-queue-no { background: var(--ps-green); color: #04140a; }

/* ---------- buttons ---------- */
body.ps-mode #view-admin .x1-btn-accent,
body.ps-mode .x1-modal-box .x1-btn-accent,
body.ps-mode #view-admin .x1-btn-blue,
body.ps-mode .x1-modal-box .x1-btn-blue {
  height: 34px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
  text-transform: none;
  letter-spacing: 0;
  transition: filter 0.15s ease, transform 0.1s ease;
}
body.ps-mode #view-admin .x1-btn-accent,
body.ps-mode .x1-modal-box .x1-btn-accent { background: #17b85a; color: #fff; box-shadow: 0 4px 12px rgba(31, 220, 106, 0.22); }
body.ps-mode #view-admin .x1-btn-blue,
body.ps-mode .x1-modal-box .x1-btn-blue { background: var(--ps-blue); color: #fff; box-shadow: 0 4px 12px rgba(45, 123, 255, 0.3); }
body.ps-mode #view-admin .x1-btn-accent:hover,
body.ps-mode .x1-modal-box .x1-btn-accent:hover,
body.ps-mode #view-admin .x1-btn-blue:hover,
body.ps-mode .x1-modal-box .x1-btn-blue:hover { filter: brightness(1.12); }
body.ps-mode #view-admin .x1-btn-accent:active,
body.ps-mode #view-admin .x1-btn-blue:active { transform: scale(0.97); }
body.ps-mode #view-admin .x1-btn-undo,
body.ps-mode .x1-modal-box .x1-btn-undo { border-radius: 10px; }
body.ps-mode #view-admin .x1-link-btn,
body.ps-mode .x1-modal-box .x1-link-btn { color: #5B9DFF; }

/* ---------- inputs ---------- */
body.ps-mode #view-admin input:not([type="checkbox"]):not([type="radio"]),
body.ps-mode #view-admin select,
body.ps-mode #view-admin textarea,
body.ps-mode .x1-modal-box input:not([type="checkbox"]):not([type="radio"]),
body.ps-mode .x1-modal-box select,
body.ps-mode .x1-modal-box textarea {
  background: var(--ps-bg) !important;
  border: 1px solid var(--ps-line) !important;
  border-radius: 10px !important;
  color: #fff;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
body.ps-mode #view-admin input:focus,
body.ps-mode #view-admin select:focus,
body.ps-mode #view-admin textarea:focus,
body.ps-mode .x1-modal-box input:focus,
body.ps-mode .x1-modal-box select:focus,
body.ps-mode .x1-modal-box textarea:focus {
  outline: none;
  border-color: var(--ps-blue) !important;
  box-shadow: 0 0 0 3px rgba(45, 123, 255, 0.22);
}
body.ps-mode #view-admin .form-group label { color: var(--ps-dim); }
body.ps-mode #view-admin .form-hint,
body.ps-mode .x1-modal-box .form-hint { color: var(--ps-dim); }

/* ---------- tags ---------- */
body.ps-mode #view-admin .x1-status-tag,
body.ps-mode .x1-modal-box .x1-status-tag { border-radius: 999px; padding: 3px 9px; }
body.ps-mode #view-admin .x1-status-tag.PENDING, body.ps-mode .x1-modal-box .x1-status-tag.PENDING { background: rgba(255, 197, 61, 0.16); color: var(--ps-gold); }
body.ps-mode #view-admin .x1-status-tag.WON, body.ps-mode .x1-modal-box .x1-status-tag.WON { background: rgba(31, 220, 106, 0.16); color: var(--ps-green); }
body.ps-mode #view-admin .x1-status-tag.LOST, body.ps-mode .x1-modal-box .x1-status-tag.LOST { background: rgba(255, 77, 94, 0.16); color: #ff8a95; }
body.ps-mode #view-admin .x1-status-tag.VOID, body.ps-mode .x1-modal-box .x1-status-tag.VOID { background: rgba(141, 151, 196, 0.16); color: var(--ps-dim); }
body.ps-mode .x1-mkt-status { border-radius: 999px; padding: 2px 8px; background: rgba(141, 151, 196, 0.16); color: var(--ps-dim); }
body.ps-mode .x1-mkt-status--OPEN { background: rgba(31, 220, 106, 0.16); color: var(--ps-green); }
body.ps-mode .x1-mkt-status--LOCKED { background: rgba(255, 197, 61, 0.14); color: var(--ps-gold); border-color: rgba(255, 197, 61, 0.3); }
body.ps-mode .x1-mkt-status--SETTLED { background: rgba(45, 123, 255, 0.18); color: #9cc3ff; }
body.ps-mode #view-admin .x1-log-tag { border-radius: 999px; padding: 3px 9px; }

/* ---------- modals (the admin's popups) ---------- */
body.ps-mode .x1-modal-box .modal-header { border-bottom: 1px solid var(--ps-line); }
body.ps-mode .x1-modal-box .modal-close { color: var(--ps-dim); }
body.ps-mode .x1-modal-box .x1-admin-result { background: rgba(31, 220, 106, 0.1); border: 1px solid rgba(31, 220, 106, 0.35); border-radius: 12px; }
body.ps-mode .x1-modal-box .x1-player-box,
body.ps-mode .x1-modal-box .x1-player-stats > div { background: var(--ps-panel-2); border: 1px solid var(--ps-line); border-radius: 12px; }

/* Admin shortcut in the top bar on phones (the top tabs only show on wider screens) */
.ps-admin-btn { color: var(--ps-gold); }
@media (min-width: 768px) { .ps-admin-btn { display: none !important; } }

/* 1xBet copy: add matches table, what-to-copy boxes, list of changes */
.onex-teams { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.onex-teams .onex-team { max-width: 220px; }
.onex-warn { color: var(--ps-amber, #F5C76A) !important; }
.onex-parts { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 6px; }
.onex-parts label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ps-text); cursor: pointer; }
.onex-list { margin: 4px 0 12px; padding-left: 18px; max-height: 240px; overflow-y: auto; font-size: 12.5px; line-height: 1.5; color: var(--ps-soft, #C9CFDB); }
.onex-link-box { margin-top: 10px; }
.onex-link-box summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ps-label, #9AA2B4); }
.onex-link-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.onex-link-row input { flex: 1; min-width: 0; }
.onex-link-row .x1-btn-blue { flex: none; min-height: 44px; padding: 0 14px; }
.onex-sync { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--ps-edge, #1C2029); }
.onex-sync-on { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: var(--ps-blue-bg, #13203A); color: var(--ps-blue-soft, #8AB8FF); font-size: 13px; }
.onex-sync-on .x1-btn-blue { flex: none; min-height: 36px; }

/* 1xBet preview: bets 1xBet doesn't show right now, each with a "lock ours too" tick */
.x1-modal-overlay .onex-closed, #view-admin .onex-closed { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.x1-modal-overlay .onex-closed__row, #view-admin .onex-closed__row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: rgba(255, 90, 95, 0.08); border: 1px solid rgba(255, 90, 95, 0.25); font-size: 13px; color: var(--ps-text); cursor: pointer; }
.x1-modal-overlay .onex-closed__row span, #view-admin .onex-closed__row span { flex: 1; min-width: 0; }
.x1-modal-overlay .onex-closed__row b, #view-admin .onex-closed__row b { font-size: 11.5px; font-weight: 600; color: #fca5a5; white-space: nowrap; }
.x1-modal-overlay .onex-closed__row input, #view-admin .onex-closed__row input { width: 16px; height: 16px; flex: 0 0 auto; accent-color: #ef4444; }

/* ---------- ⚡ 1xBet tab ---------- */
#view-admin .onex-hero { background: linear-gradient(150deg, rgba(47, 111, 235, 0.2) 0%, var(--ps-panel) 62%); }
#view-admin .onex-hero__top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; }
#view-admin .onex-hero h3 { margin: 0 0 4px; padding: 0; border: 0; font-size: 18px; }
#view-admin .onex-hero p { margin: 0; max-width: 560px; color: var(--ps-dim); font-size: 13px; line-height: 1.45; }
.onex-pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 999px; background: rgba(61, 214, 140, 0.12); color: var(--ps-green); font-size: 12px; font-weight: 700; white-space: nowrap; }
.onex-pill.is-warn { background: rgba(245, 199, 106, 0.14); color: #F5C76A; }
.onex-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.onex-steps li { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 8px; border-radius: 12px; background: var(--ps-panel-2); border: 1px solid var(--ps-line); font-size: 12px; font-weight: 600; line-height: 1.2; color: var(--ps-soft, #C9CFDB); }
.onex-steps b { display: grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--ps-blue); color: #fff; font-size: 12px; }

#view-admin .onex-card h3.onex-h { margin: 0 0 2px; padding: 0; border: 0; font-size: 15px; }
.onex-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; margin-bottom: 12px; }
.onex-sub { margin: 0; color: var(--ps-dim); font-size: 12px; line-height: 1.45; }
.onex-empty { margin: 6px 0 12px; color: var(--ps-dim); font-size: 13px; }
.onex-muted { color: var(--ps-dim); font-size: 12.5px; }
.onex-small { margin-top: 4px; font-size: 12px; }
.onex-good { color: var(--ps-green); font-weight: 700; font-size: 12.5px; }
.onex-bad { color: #ff8a8e; font-size: 12.5px; }
.onex-chips { display: flex; gap: 8px; }
.onex-chip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 999px; background: var(--ps-panel-2); border: 1px solid var(--ps-line); color: var(--ps-text); font-size: 13px; font-weight: 700; cursor: pointer; }
.onex-chip input, .onex-league input, .onex-row__pick input, .onex-apply input { width: 18px; height: 18px; margin: 0; accent-color: var(--ps-blue); cursor: pointer; }
.onex-selbar { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; color: var(--ps-dim); font-size: 12.5px; }
.onex-selbar b { color: #fff; }
.onex-selbar .x1-link-btn { padding: 6px 0; font-size: 12.5px; }

.onex-league { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 8px; }
.onex-league label { display: inline-flex; align-items: center; gap: 9px; color: #fff; font-size: 13.5px; font-weight: 800; cursor: pointer; }
.onex-league span { color: var(--ps-dim); font-size: 12px; }
.onex-rows { display: flex; flex-direction: column; gap: 8px; }
.onex-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-radius: 14px; background: var(--ps-panel-2); border: 1px solid var(--ps-line); transition: opacity 0.15s ease, border-color 0.15s ease; }
.onex-row.is-off { opacity: 0.5; }
.onex-row.is-checking, .onex-row.is-applying { border-color: rgba(47, 111, 235, 0.6); }
.onex-row.is-ok { border-color: rgba(47, 111, 235, 0.35); }
.onex-row.is-applied { border-color: rgba(61, 214, 140, 0.45); }
.onex-row.is-error { border-color: rgba(255, 90, 95, 0.45); }
.onex-row__pick { display: flex; padding-top: 2px; cursor: pointer; }
.onex-row__body { flex: 1; min-width: 0; }
.onex-row__teams { color: #fff; font-size: 14px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.onex-row__teams span { margin: 0 4px; color: var(--ps-dim); font-weight: 500; font-size: 12px; }
.onex-row__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 5px; color: var(--ps-dim); font-size: 12px; }
.onex-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; background: rgba(141, 151, 196, 0.14); color: var(--ps-dim); font-size: 11px; font-weight: 700; white-space: nowrap; }
.onex-tag--LOCKED { background: rgba(245, 199, 106, 0.14); color: #F5C76A; }
.onex-tag--LIVE { background: rgba(255, 90, 95, 0.16); color: #ff8a8e; }
.onex-tag--UPCOMING { background: rgba(61, 214, 140, 0.12); color: var(--ps-green); }
.onex-tag.is-ok { background: rgba(47, 111, 235, 0.16); color: #8AB8FF; }
.onex-tag.is-sync { background: rgba(47, 111, 235, 0.22); color: #BBD5FF; }

.onex-res { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--ps-line); }
.onex-res__line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.onex-apply { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px; border-radius: 9px; background: rgba(23, 184, 90, 0.14); color: #7ee2a8; font-size: 12.5px; font-weight: 800; cursor: pointer; }
.onex-apply input { accent-color: #17b85a; }
.onex-count { color: #fff; font-size: 12.5px; font-weight: 700; }
.onex-count.is-warn { color: #F5C76A; }
.onex-more { margin-left: auto; padding: 6px 0; font-size: 12.5px; }
.onex-details { margin-top: 10px; }
.onex-dl { margin: 8px 0 2px; color: var(--ps-label, #9AA2B4); font-size: 11.5px; font-weight: 800; letter-spacing: 0.3px; text-transform: uppercase; }
.onex-spin { display: inline-block; width: 13px; height: 13px; margin-right: 7px; vertical-align: -2px; border: 2px solid rgba(138, 184, 255, 0.3); border-top-color: #8AB8FF; border-radius: 50%; animation: onex-spin 0.8s linear infinite; }
@keyframes onex-spin { to { transform: rotate(360deg); } }

/* The action bar stays at the bottom of the screen while scrolling the list */
.onex-bar { position: sticky; bottom: calc(76px + var(--ps-safe-bottom, 0px)); z-index: 5; margin: 14px -6px -6px; padding: 12px; border-radius: 14px; background: rgba(18, 21, 27, 0.94); border: 1px solid var(--ps-line); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.35); }
.onex-bar__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#view-admin .onex-bar .x1-btn-blue, #view-admin .onex-bar .x1-btn-accent { flex: 1 1 200px; height: 44px; font-size: 13.5px; }
#view-admin .onex-bar .x1-btn-blue:disabled, #view-admin .onex-bar .x1-btn-accent:disabled { opacity: 0.45; box-shadow: none; cursor: default; }
#view-admin .onex-btn-ghost { flex: 0 0 auto !important; background: var(--ps-panel-2) !important; border: 1px solid var(--ps-line); box-shadow: none !important; }
.onex-progress { height: 6px; margin-bottom: 10px; border-radius: 3px; background: var(--ps-panel-2); overflow: hidden; }
.onex-progress div { height: 100%; border-radius: 3px; background: linear-gradient(90deg, #2F6FEB, #5B9DFF); transition: width 0.3s ease; }
.onex-bar__row > .onex-muted { flex: 1; }

.onex-sync-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--ps-blue-bg, #13203A); border: 1px solid rgba(47, 111, 235, 0.35); }
#view-admin .onex-btn-stop { flex: none; height: 36px; background: #b91c1c; box-shadow: none; }
.onex-sync-start { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--ps-line); color: var(--ps-soft, #C9CFDB); font-size: 13px; }
.onex-sync-start__ctl { display: flex; gap: 8px; }
#view-admin .onex-sync-start select { height: 36px; min-width: 88px; }
#view-admin .onex-sync-start .x1-btn-blue { height: 36px; }
@media (min-width: 768px) {
  .onex-bar { bottom: 12px; }
}
