/* Dark Matdash panel for BoofeGame — Yekan Bakh everywhere, teal/gold on a near-black canvas. */
@font-face { font-family: "Yekan Bakh"; src: url("/static/fonts/yekan-bakh/YekanBakh-Light.woff2") format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Yekan Bakh"; src: url("/static/fonts/yekan-bakh/YekanBakh-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Yekan Bakh"; src: url("/static/fonts/yekan-bakh/YekanBakh-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Yekan Bakh"; src: url("/static/fonts/yekan-bakh/YekanBakh-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Yekan Bakh"; src: url("/static/fonts/yekan-bakh/YekanBakh-ExtraBold.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Yekan Bakh"; src: url("/static/fonts/yekan-bakh/YekanBakh-Black.woff2") format("woff2"); font-weight: 900; font-display: swap; }

:root,
[data-bs-theme="dark"] {
  --bs-font-sans-serif: "Yekan Bakh", Tahoma, sans-serif;
  --bs-body-font-family: "Yekan Bakh", Tahoma, sans-serif;

  --brand-gold: #d8b45a;
  --brand-teal: #0d7a84;
  --panel-bg: #0a0f16;
  --panel-surface: #111a24;
  --panel-surface-2: #16212d;
  --panel-border: #23303f;
  --panel-text: #e8eef5;
  --panel-muted: #a8b8c8;
  --sidebar-width: 272px;

  --bs-body-bg: var(--panel-bg);
  --bs-body-color: var(--panel-text);
  --bs-border-color: var(--panel-border);
  --bs-secondary-color: var(--panel-muted);
  --bs-emphasis-color: #fff;
  --bs-link-color: #58b8c2;
  --bs-link-hover-color: var(--brand-gold);
}

body,
h1, h2, h3, h4, h5, h6,
.card, .table, .btn, .badge, .form-control, .form-select, .form-label,
.navbar, .dropdown-menu, .list-group-item, .alert, .pagination {
  font-family: "Yekan Bakh", Tahoma, sans-serif;
}

body {
  /* Matdash ships body{font-family:Manrope!important}; the house font wins here. */
  font-family: "Yekan Bakh", Tahoma, sans-serif !important;
  background:
    radial-gradient(1100px 500px at 100% -10%, rgba(13, 122, 132, .16), transparent 60%),
    radial-gradient(900px 420px at 0% 0%, rgba(216, 180, 90, .08), transparent 55%),
    var(--panel-bg);
  color: var(--panel-text);
  min-height: 100vh;
}

/* ---------- shell ---------- */
.panel-sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #0c161f 0%, #0a1119 100%);
  border-inline-end: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  z-index: 1030;
}

.panel-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #fff;
  text-decoration: none;
  padding: 2px 6px 12px;
}
.panel-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: linear-gradient(150deg, rgba(184, 151, 62, .26), rgba(184, 151, 62, .06));
  border: 1px solid rgba(216, 180, 90, .38);
}
.panel-brand-mark .ti { color: var(--brand-gold); font-size: 1.06rem; }
.panel-brand-text b {
  display: inline-block;
  font-size: 1.22rem;
  font-weight: 900;                    /* Yekan Bakh Black */
  letter-spacing: 0;
  line-height: 1.4;
  transform: skewX(-5deg);             /* the «italic» lean, Persian-style */
  transform-origin: right center;
}
.panel-brand-text b .w1 { color: #ffffff; }
/* «گیم» carries the brand gold: the word reads as two tones, not one block. */
.panel-brand-text b .w2 { color: #e0bb63; }
.panel-brand-text small {
  display: block;
  margin-top: 5px;
  font-size: .72rem;
  font-weight: 400;
  letter-spacing: .01em;
  color: #8b9dae;
}
.panel-brand-rule {
  height: 1px;
  margin: 0 6px 6px;
  background: linear-gradient(to left, rgba(216, 180, 90, .34), rgba(216, 180, 90, 0));
}

.panel-nav { display: flex; flex-direction: column; gap: .35rem; overflow-y: auto; }
.panel-nav::-webkit-scrollbar { width: 6px; }
.panel-nav::-webkit-scrollbar-thumb { background: #22303f; border-radius: 3px; }

.panel-cap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
  color: #6b7f94;
  margin: 18px 10px 7px;
}
.panel-cap::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to left, rgba(255, 255, 255, .09), rgba(255, 255, 255, 0));
}

.panel-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  overflow-wrap: anywhere;
  padding: .7rem .9rem;
  border-radius: .85rem;
  color: #c4d1de;
  text-decoration: none;
  font-size: .925rem;
  font-weight: 600;
  line-height: 1.5;
  border: 1px solid transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.panel-link .ti { font-size: 1.5rem; opacity: .92; }
.panel-link:hover { background: #14202b; color: #fff; border-color: #1e2c3a; }
.panel-link.active {
  background: linear-gradient(90deg, rgba(13, 122, 132, .28), rgba(13, 122, 132, .06));
  color: #fff;
  border-color: rgba(13, 122, 132, .45);
  box-shadow: inset 3px 0 0 var(--brand-gold);
}
.panel-link.active .ti { color: var(--brand-gold); opacity: 1; }

.panel-sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--panel-border);
  padding-top: 12px;
  font-size: .78rem;
  color: var(--panel-muted);
}

/* ---------- main ---------- */
.panel-main {
  margin-inline-start: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.panel-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 22px;
  background: rgba(12, 18, 26, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--panel-border);
}
.panel-topbar h1 { font-size: 1.02rem; margin: 0; font-weight: 700; color: #f1f6fa; }

.panel-content { padding: 22px; flex: 1; }

/* ---------- surfaces ---------- */
.card {
  background: var(--panel-surface);
  border: 1px solid var(--panel-border) !important;
  border-radius: 14px;
}
.card-header,
.card-footer {
  background: var(--panel-surface-2);
  border-color: var(--panel-border);
  font-weight: 600;
  color: #e8eef5;
}
.card-header a, .card-footer a { color: #58b8c2; text-decoration: none; }
.card-header a:hover, .card-footer a:hover { color: var(--brand-gold); }

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--panel-text);
  --bs-table-border-color: var(--panel-border);
  --bs-table-hover-bg: #16222e;
  --bs-table-hover-color: #fff;
}
.table > :not(caption) > * > * { padding: .7rem .8rem; border-color: var(--panel-border); }
.table thead th {
  background: #0f1a24 !important;
  color: #8fa2b6;
  font-weight: 600;
  font-size: .8rem;
  white-space: nowrap;
  border-bottom: 1px solid var(--panel-border);
}
.table tbody td { vertical-align: middle; }
.table a { text-decoration: none; color: #6fc7d1; }
.table a:hover { color: var(--brand-gold); }
.table tbody tr:hover a { color: var(--brand-gold); }

.stat-card .stat-icon {
  width: 46px; height: 46px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; font-size: 1.35rem;
}
.stat-card .stat-value { font-size: 1.85rem; font-weight: 700; line-height: 1.1; color: #fff; }
.stat-card .stat-label { color: var(--panel-muted); font-size: .84rem; }

/* soft tints that still read on a dark canvas */
.bg-primary-subtle   { background: rgba(13, 122, 132, .2) !important; }
.bg-success-subtle   { background: rgba(46, 160, 108, .18) !important; }
.bg-warning-subtle   { background: rgba(216, 180, 90, .16) !important; }
.bg-danger-subtle    { background: rgba(214, 88, 88, .16) !important; }
.bg-secondary-subtle { background: rgba(122, 140, 160, .16) !important; }
.text-primary { color: #5ec4ce !important; }
.text-success { color: #55c98f !important; }
.text-warning { color: #e3c072 !important; }
.text-danger  { color: #ef8f8f !important; }

.badge.bg-light { background: #23303f !important; color: #cfdcea !important; }

/* ---------- forms ---------- */
.form-control, .form-select {
  background: #0d1620;
  border: 1px solid var(--panel-border);
  color: var(--panel-text);
  border-radius: 10px;
}
.form-control:focus, .form-select:focus {
  background: #0d1620;
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 .18rem rgba(13, 122, 132, .25);
  color: #fff;
}
.form-control::placeholder { color: #5f7288; }
.form-label { font-size: .85rem; font-weight: 600; color: #b9c7d6; margin-bottom: .3rem; }
.form-text, .helptext { font-size: .76rem; color: #7286a0; }

.btn-brand { background: var(--brand-teal); border-color: var(--brand-teal); color: #fff; }
.btn-brand:hover { background: #0f8f9a; border-color: #0f8f9a; color: #fff; }
.btn-outline-secondary { border-color: #2b3a4b; color: #b9c7d6; }
.btn-outline-secondary:hover { background: #1b2735; border-color: #35475c; color: #fff; }
.btn-outline-primary { border-color: #24636b; color: #6fc7d1; }
.btn-outline-primary:hover { background: #12454b; border-color: #2c7f88; color: #fff; }
.btn-outline-danger { border-color: #6a3232; color: #ef8f8f; }
.btn-outline-danger:hover { background: #3a1d1d; border-color: #8c4141; color: #ffd7d7; }

.alert { border-radius: 12px; border-width: 1px; }
.alert-success { background: rgba(46, 160, 108, .14); border-color: rgba(46, 160, 108, .35); color: #9fe3c2; }
.alert-danger  { background: rgba(214, 88, 88, .14); border-color: rgba(214, 88, 88, .35); color: #f3b3b3; }
.alert-warning { background: rgba(216, 180, 90, .14); border-color: rgba(216, 180, 90, .35); color: #ecd6a2; }
.alert-info    { background: rgba(13, 122, 132, .14); border-color: rgba(13, 122, 132, .35); color: #a8dde2; }

.pagination .page-link { background: var(--panel-surface-2); border-color: var(--panel-border); color: #b9c7d6; }
.pagination .page-link:hover { background: #1c2a38; color: #fff; }
.pagination .page-item.disabled .page-link { background: #0f1720; color: #56687e; }

code { color: #e3c072; background: rgba(216, 180, 90, .1); padding: .1rem .35rem; border-radius: 6px; }
hr { border-color: var(--panel-border); }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(900px 500px at 50% -20%, rgba(13, 122, 132, .35), transparent 60%),
    radial-gradient(700px 400px at 100% 100%, rgba(216, 180, 90, .12), transparent 60%),
    #070b11;
}
.login-card {
  width: 100%; max-width: 400px; border-radius: 18px;
  background: var(--panel-surface);
  border: 1px solid var(--panel-border) !important;
}
.login-card .login-brand { color: #fff; font-weight: 800; font-size: 1.3rem; }
.login-card .login-brand .ti { color: var(--brand-gold); }

@media (max-width: 991.98px) {
  .panel-sidebar { transform: translateX(100%); transition: transform .2s ease; }
  .panel-sidebar.open { transform: translateX(0); }
  .panel-main { margin-inline-start: 0; }
}

/* ---------- forms (the part the user reads as "lively") ---------- */
html { color-scheme: dark; }

.form-card .card-header { border-radius: 14px 14px 0 0; }
.sec-icon {
  width: 34px; height: 34px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(13, 122, 132, .18);
  color: #6fc7d1; font-size: 1.05rem;
}
.form-card .card-body { padding: 20px 22px 22px; }

.input-shell { position: relative; }
.input-shell .form-control,
.input-shell .form-select { height: 44px; }
.input-shell input[type="number"], .input-shell input[type="time"] { font-variant-numeric: tabular-nums; }

.form-control:hover, .form-select:hover { border-color: #31445a; }
.form-control:focus, .form-select:focus { background: #0f1b26; }
.form-control.is-invalid, .form-select.is-invalid { border-color: #8c4141; }

.switch-row {
  display: flex; align-items: center; gap: .6rem;
  background: #0f1b26; border: 1px solid var(--panel-border);
  border-radius: 12px; padding: .6rem .9rem;
}
.switch-row .form-check-input { margin: 0; width: 2.4em; height: 1.25em; background-color: #22303f; border-color: #2c3d50; }
.switch-row .form-check-input:checked { background-color: var(--brand-teal); border-color: var(--brand-teal); }
.switch-row .form-check-label { font-weight: 600; color: #cfdcea; }

.side-card .side-title { font-weight: 700; color: #fff; margin-bottom: .25rem; }
.side-card { position: sticky; top: 84px; }
.side-card .btn { padding: .6rem 1rem; border-radius: 11px; }

.form-text { padding-inline-start: 2px; }

/* ---------- dashboard sections & tables ---------- */
.section-head {
  display: flex; justify-content: space-between; align-items: center;
  margin: 24px 2px 12px; font-weight: 700; color: #cfdcea;
}
.section-head span { font-size: .95rem; }
.section-head a { color: #58b8c2; text-decoration: none; font-size: .82rem; }
.section-head a:hover { color: var(--brand-gold); }

.game-card .card-header { padding: 14px 18px; }
.game-card .card-footer { padding: 10px 18px; }

.empty-state {
  display: flex; align-items: center; gap: 10px;
  color: #7286a0; font-size: .88rem; padding: 8px 4px;
}
.empty-state .ti { font-size: 1.3rem; color: #3d5568; }

.row-title { font-weight: 600; color: #eef4f9; margin-inline-end: .35rem; }
.row-link { color: #58b8c2; text-decoration: none; font-size: .82rem; }
.row-link:hover { color: var(--brand-gold); }

.rank-pill {
  display: inline-flex; min-width: 28px; justify-content: center;
  padding: 2px 9px; border-radius: 999px;
  background: rgba(216, 180, 90, .14); color: #e3c072;
  font-weight: 700; font-size: .8rem;
}

.table-responsive { border-radius: 0 0 14px 14px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table td, .table th { font-variant-numeric: tabular-nums; }
.table thead th:first-child, .table tbody td:first-child { padding-inline-start: 18px; }
.table thead th:last-child, .table tbody td:last-child { padding-inline-end: 18px; }
.table tbody tr { transition: background .12s ease; }

/* ---------- layout sanity ---------- */
.panel-content { max-width: 1340px; margin-inline: auto; width: 100%; padding: 24px 26px 48px; }
.panel-topbar h1 {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw;
}
.panel-topbar { padding: 14px 26px; }

.card-header { padding: 14px 18px; }
.card-body { padding: 18px; }
.card-body.p-0, .card-body.px-0 { padding: 0 !important; }
.card-footer { padding: 12px 18px; }

/* label/value rows that survive RTL (the dl+col grid does not) */
.field-list { list-style: none; margin: 0; padding: 0; }
.field-list li {
  display: flex; align-items: baseline; gap: 14px;
  padding: 10px 0; border-bottom: 1px dashed rgba(255, 255, 255, .07);
}
.field-list li:last-child { border-bottom: 0; }
.field-list .k { flex: 0 0 42%; color: #8fa2b6; font-size: .85rem; white-space: nowrap; }
.field-list .v { flex: 1 1 auto; color: #eef4f9; font-weight: 600; text-align: start; word-break: break-word; }
.field-list .v.mono { direction: ltr; font-size: .82rem; color: #cfdcea; }
.field-list .v .badge { font-weight: 600; }

/* empty tables become a quiet block instead of a stretched skeleton */
.table-empty { padding: 34px 18px; text-align: center; color: #7286a0; font-size: .88rem; }
.table-empty .ti { display: block; font-size: 1.5rem; color: #3d5568; margin-bottom: 6px; }

/* ---------- readability & rhythm ---------- */
.text-muted, .text-secondary { color: var(--panel-muted) !important; }
small, .small { font-size: .82rem; }
.table th, .table td { white-space: nowrap; }
.table td.wrap { white-space: normal; }
.table thead th { font-size: .76rem; letter-spacing: .02em; color: #93a6ba; }
.badge { font-size: .72rem; padding: .32em .62em; border-radius: 7px; }

/* Matdash paints .text-dark white in dark mode, which leaves the yellow
   «به‌زودی» chip unreadable. On a warning badge the ink has to stay dark. */
.badge.bg-warning,
.badge.bg-warning.text-dark,
[data-bs-theme="dark"] .badge.bg-warning,
[data-bs-theme="dark"] .badge.bg-warning.text-dark {
  color: #2a2107 !important;
}
.card-header .fw-semibold { font-size: .93rem; }
.stat-card .stat-value { font-size: 1.7rem; }
.stat-card .stat-label { font-size: .8rem; }
.row.g-3 { --bs-gutter-y: 1rem; }

.side-card { position: sticky; top: 88px; }
.switch-help { margin-inline-start: 0; margin-top: .35rem; }
.switch-row .form-check-label { margin-inline-start: .55rem; }
input[type="time"] { direction: ltr; text-align: center; }
.side-card .btn-outline-secondary { border-color: transparent; }

/* ---------- form page: one column, sticky action bar ---------- */
.form-wrap { max-width: 940px; }
.form-actions {
  position: sticky; bottom: 14px; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  margin-top: 18px; padding: 12px 16px;
  background: rgba(20, 31, 43, .94);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  backdrop-filter: blur(10px);
}
.form-actions .btn { padding: .55rem 1.1rem; border-radius: 11px; }
textarea.form-control { min-height: 84px; height: auto; }

/* ---- reports & access levels (added with the analytics page) ---- */
.stat-card .stat-hint { margin-top: 2px; font-size: .72rem; color: #7286a0; }
.panel-role { margin-top: 2px; font-size: .72rem; color: var(--brand-gold); opacity: .85; }

.role-badge { font-size: .78rem; padding: .4em .7em; border-radius: 8px; font-weight: 600; }
.role-manager { background: rgba(216, 180, 90, .16); color: #e6c777; border: 1px solid rgba(216, 180, 90, .4); }
.role-operator { background: rgba(13, 122, 132, .18); color: #6fc7d1; border: 1px solid rgba(13, 122, 132, .45); }
.role-observer { background: rgba(255, 255, 255, .05); color: #93a6ba; border: 1px solid rgba(255, 255, 255, .1); }

.rpt-table th { font-size: .78rem; color: #93a6ba; font-weight: 600; }
.rpt-table td { padding-top: .45rem; padding-bottom: .45rem; }
.rpt-num { font-variant-numeric: tabular-nums; }
.rpt-track-head, .rpt-track { width: 34%; }
.rpt-track { min-width: 110px; }
.rpt-track .rpt-fill {
  display: block; height: 7px; min-width: 2px; border-radius: 6px;
  background: linear-gradient(90deg, var(--brand-teal), var(--brand-gold));
}
.funnel-row + .funnel-row { margin-top: 14px; }
.funnel-row .rpt-track { width: 100%; margin-top: 6px; }
.funnel-row .rpt-fill { height: 8px; }

.mini-stat { border: 1px solid var(--panel-border); border-radius: 12px; padding: 10px 12px; background: rgba(255, 255, 255, .02); }
.mini-stat .value { font-size: 1.35rem; font-weight: 700; }
.mini-stat .label { font-size: .76rem; color: #8fa2b6; }

/* Sidebar footer: who is logged in, at which level, and the way out. */
.panel-user-name { font-size: .92rem; font-weight: 600; color: #e8eff6; line-height: 1.5; }
.panel-sidebar-footer .btn { font-size: .8rem; padding: .38rem .6rem; }
