:root,
[data-bs-theme="light"] {
  --primary-color: #156deb;
  --accent-color: #09a8b1;
  --bs-primary: #156deb;
  --bs-primary-rgb: 21, 109, 235;
  --bs-link-color: #156deb;
  --bs-link-hover-color: #0f57c4;
}

[data-bs-theme="dark"] {
  --primary-color: #09a8b1;
  --bs-primary: #09a8b1;
  --bs-primary-rgb: 9, 168, 177;
}

.btn-primary {
  --bs-btn-bg: #156deb;
  --bs-btn-border-color: #156deb;
  --bs-btn-hover-bg: #0f57c4;
  --bs-btn-hover-border-color: #0f57c4;
  --bs-btn-active-bg: #0d4db0;
  --bs-btn-active-border-color: #0d4db0;
}

.text-bg-primary,
.round.text-bg-primary {
  background-color: #156deb !important;
}

.bg-primary-subtle {
  background-color: rgba(21, 109, 235, 0.1) !important;
}

/* Correct logo for each theme — color on light bg, white on dark bg */
html[data-bs-theme="light"] .brand-logo .dark-logo,
html[data-bs-theme="light"] .topbar .dark-logo {
  display: none !important;
}

html[data-bs-theme="light"] .brand-logo .light-logo,
html[data-bs-theme="light"] .topbar .light-logo {
  display: block !important;
}

html[data-bs-theme="dark"] .brand-logo .light-logo,
html[data-bs-theme="dark"] .topbar .light-logo {
  display: none !important;
}

html[data-bs-theme="dark"] .brand-logo .dark-logo,
html[data-bs-theme="dark"] .topbar .dark-logo {
  display: block !important;
}

.brand-logo .logo-full,
.topbar .logo-img img {
  height: 44px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
}

.brand-logo .logo-mini {
  height: 32px;
  width: 32px;
  object-fit: contain;
}

.login-brand-logo {
  height: 48px;
  width: auto;
  max-width: 240px;
  object-fit: contain;
}

.login-brand-panel-logo {
  height: 52px;
  width: auto;
  max-width: 260px;
  object-fit: contain;
}

.preloader img {
  height: 44px;
  width: auto;
}

.login-bg .radial-gradient::before {
  background: linear-gradient(135deg, #09a8b1 0%, #0f8dc9 45%, #156deb 100%) 0 0 / 100% 100%;
}

.login-subtitle {
  color: #64748b;
  font-size: 0.95rem;
  margin-top: -0.5rem;
  margin-bottom: 1.5rem;
}

.admin-login-shell {
  min-height: 100vh;
}

body.login-bg.admin-login-shell {
  background-image: none !important;
  background-color: #fff;
}

.admin-login-brand {
  background: linear-gradient(135deg, #09a8b1 0%, #0f8dc9 45%, #156deb 100%);
}

.admin-login-brand-copy {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.95rem;
  max-width: 22rem;
  line-height: 1.6;
}

.fixed-profile-color {
  color: #09a8b1 !important;
}

/* ========== Admin panel layout (reference-style) ========== */
body.admin-panel {
  background: #eef1f5;
  font-family: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
}

body.admin-panel .left-sidebar {
  background: #1a2332 !important;
  border-right: none !important;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.08);
}

body.admin-panel .brand-logo {
  height: auto;
  min-height: 72px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

body.admin-panel .brand-logo .logo-full {
  height: 38px;
  max-width: 190px;
  filter: none;
}

body.admin-panel .left-sidebar .scroll-sidebar {
  padding: 12px 16px;
  height: calc(100vh - 210px);
}

body.admin-panel .nav-small-cap {
  color: rgba(255, 255, 255, 0.45) !important;
  font-size: 11px;
  letter-spacing: 0.08em;
  margin-top: 8px;
  padding-left: 12px;
}

body.admin-panel .sidebar-nav ul .sidebar-item .sidebar-link {
  color: rgba(255, 255, 255, 0.78) !important;
  border-radius: 8px;
  margin-bottom: 4px;
  padding: 11px 14px;
  border-left: 4px solid transparent;
  background: transparent !important;
  transition: background 0.2s, color 0.2s;
}

body.admin-panel .sidebar-nav ul .sidebar-item .sidebar-link i,
body.admin-panel .sidebar-nav ul .sidebar-item .sidebar-link .hide-menu {
  color: inherit !important;
}

body.admin-panel .sidebar-nav ul .sidebar-item .sidebar-link:hover:not(.active) {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.06) !important;
}

body.admin-panel .sidebar-nav ul .sidebar-item > .sidebar-link.active,
body.admin-panel .sidebar-nav ul .sidebar-item.selected > .sidebar-link,
body.admin-panel .sidebar-nav ul .sidebar-item.selected > .sidebar-link.active {
  color: #fff !important;
  background: rgba(9, 168, 177, 0.18) !important;
  border-left-color: #09a8b1 !important;
}

body.admin-panel .sidebar-nav ul .sidebar-item > .sidebar-link.active .hide-menu,
body.admin-panel .sidebar-nav ul .sidebar-item > .sidebar-link.active i,
body.admin-panel .sidebar-nav ul .sidebar-item.selected > .sidebar-link .hide-menu,
body.admin-panel .sidebar-nav ul .sidebar-item.selected > .sidebar-link i {
  color: #fff !important;
}

body.admin-panel .fixed-profile {
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

body.admin-panel .fixed-profile .john-title h6 {
  color: #fff;
}

body.admin-panel .fixed-profile-color,
body.admin-panel .fixed-profile .ti-power {
  color: #09a8b1 !important;
}

body.admin-panel .topbar.admin-topbar {
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: none;
  min-height: 64px;
}

body.admin-panel .admin-menu-toggle {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #475569 !important;
  background: transparent;
}

body.admin-panel .admin-menu-toggle:hover {
  background: #eef2f7;
  color: #1e293b !important;
}

body.admin-panel .body-wrapper,
body.admin-panel .admin-dashboard-body {
  background: #eef1f5;
}

body.admin-panel .page-wrapper {
  background: #eef1f5;
}

body.admin-panel .container-fluid {
  padding-left: 24px;
  padding-right: 24px;
}

/* Dashboard content */
.admin-page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #1e293b;
}

.admin-stat-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  border: 1px solid #edf2f7;
  padding: 22px 24px;
  min-height: 118px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  position: relative;
}

.admin-stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: #156deb;
  line-height: 1.1;
}

.admin-stat-label {
  margin-top: 6px;
  font-size: 0.92rem;
  color: #64748b;
  font-weight: 500;
}

.admin-stat-icon {
  font-size: 3.4rem;
  color: #cbd5e1;
  opacity: 0.55;
  line-height: 1;
}

.admin-chart-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  border: 1px solid #edf2f7;
  padding: 22px 24px 18px;
  height: 100%;
}

.admin-chart-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 4px;
}

.admin-chart-subtitle {
  font-size: 0.82rem;
  color: #94a3b8;
  margin-bottom: 16px;
}

.admin-chart-wrap {
  position: relative;
  height: 280px;
}

/* Inner pages keep readable cards on grey bg */
body.admin-panel .card {
  border: 1px solid #edf2f7;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  border-radius: 12px;
}

body.admin-panel .card .card-body {
  background: #fff;
}

@media (max-width: 991.98px) {
  body.admin-panel .admin-chart-wrap {
    height: 240px;
  }
}

/* Admin page header & zone tabs */
.admin-page-header {
  background: #fff;
}

.admin-page-heading {
  font-size: 1.35rem;
  font-weight: 700;
  color: #1e293b;
}

.admin-page-subtitle {
  font-size: 0.88rem;
  color: #64748b;
}

.admin-zone-tabs .nav-link {
  color: #475569;
  font-weight: 500;
  border-radius: 8px;
  padding: 8px 18px;
  margin-right: 6px;
}

.admin-zone-tabs .nav-link.active {
  background: #156deb;
  color: #fff !important;
}

.quiz-zone-section-nav .nav-link {
  color: #475569;
  font-weight: 600;
  border-radius: 8px;
  padding: 8px 20px;
  margin-right: 8px;
  border: 1px solid #e2e8f0;
}

.quiz-zone-section-nav .nav-link.active {
  background: #09a8b1;
  border-color: #09a8b1;
  color: #fff !important;
}

.quiz-zone-page .card-title {
  font-size: 1rem;
  font-weight: 600;
  color: #334155;
}

body.admin-panel .sidebar-nav ul ul.first-level.in {
  display: block;
}

body.admin-panel .sidebar-nav ul ul.first-level .sidebar-link {
  padding-left: 3.25rem;
  font-size: 0.82rem;
}

body.admin-panel .sidebar-nav ul ul.first-level .sidebar-link.active {
  background: rgba(9, 168, 177, 0.12) !important;
  color: #09a8b1 !important;
}

.admin-contests-page .card-title {
  font-size: 1rem;
  font-weight: 600;
  color: #334155;
}

.admin-contests-table thead th {
  font-size: 0.78rem;
  white-space: nowrap;
}

.admin-contests-table td {
  font-size: 0.85rem;
  vertical-align: middle;
}

.contest-create-form .form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
}

.contest-create-form small.text-muted {
  font-size: 0.75rem;
}

.contest-banner-preview,
.contest-table-banner {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.contest-banner-preview {
  max-width: 180px;
  max-height: 120px;
  width: auto;
  height: auto;
}

.contest-blueprint-card {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.contest-sections-table th {
  font-size: 0.78rem;
  white-space: nowrap;
}

.contest-sections-table td {
  vertical-align: middle;
  font-size: 0.85rem;
}

.contest-sections-table .form-control-sm {
  min-width: 72px;
}

.admin-coding-zone-page .coding-code-editor {
  font-size: 0.8rem;
  background: #0f172a;
  color: #e2e8f0;
  border-color: #334155;
}

.admin-coding-zone-page .coding-testcases-table textarea {
  font-size: 0.78rem;
  min-height: 52px;
}

.admin-coding-table td {
  font-size: 0.85rem;
  vertical-align: middle;
}

body.admin-panel .table thead th {
  background: #f8fafc;
  font-weight: 600;
  font-size: 0.85rem;
  color: #475569;
}

body.admin-panel .font-monospace {
  font-size: 0.85rem;
}

/* Users / Leaderboard — compact layout */
.admin-users-page .container-fluid,
.admin-leaderboard-page .container-fluid {
  padding-top: 12px !important;
  padding-bottom: 12px !important;
}

.admin-users-page .admin-users-header .admin-page-heading,
.admin-leaderboard-page .admin-users-header .admin-page-heading {
  font-size: 1.15rem;
  line-height: 1.2;
}

.admin-users-page .admin-page-subtitle,
.admin-leaderboard-page .admin-page-subtitle {
  font-size: 0.78rem;
  margin-top: 2px;
}

.admin-users-card .card-body {
  padding: 10px 12px !important;
}

.admin-users-page:has(.admin-users-table) .admin-users-table-wrap,
.admin-leaderboard-page .admin-users-table-wrap {
  max-height: calc(100vh - 195px);
  overflow: auto;
}

.admin-leaderboard-page .admin-leaderboard-table-wrap {
  max-height: calc(100vh - 280px);
}

.admin-users-table {
  font-size: 0.8rem;
  margin-bottom: 0 !important;
}

.admin-users-table thead th {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 8px !important;
  white-space: nowrap;
  background: #f1f5f9;
  position: sticky;
  top: 0;
  z-index: 2;
}

.admin-users-table tbody td {
  padding: 4px 8px !important;
  vertical-align: middle !important;
  line-height: 1.25;
}

.admin-users-table .user-name-cell {
  font-weight: 600;
  max-width: 130px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-users-table .user-email-cell {
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #475569;
}

.admin-users-table .user-date-cell {
  white-space: nowrap;
  font-size: 0.76rem;
  line-height: 1.15;
}

.admin-users-table .user-date-time {
  color: #94a3b8;
  font-size: 0.72rem;
}

.admin-dt-top .dataTables_length,
.admin-dt-top .dataTables_filter,
.admin-dt-bottom .dataTables_info,
.admin-dt-bottom .dataTables_paginate {
  font-size: 0.78rem;
  margin: 0;
}

.admin-dt-top .dataTables_length label,
.admin-dt-top .dataTables_filter label {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
}

.admin-dt-top .dataTables_filter input {
  max-width: 220px;
  height: 30px;
  padding: 4px 10px;
  font-size: 0.78rem;
}

.admin-dt-top .dataTables_length select {
  height: 30px;
  padding: 2px 8px;
  font-size: 0.78rem;
}

.admin-dt-bottom .pagination {
  margin: 0;
}

.admin-dt-bottom .page-link {
  padding: 0.2rem 0.5rem;
  font-size: 0.78rem;
}

body.admin-panel:has(.admin-users-page) .topbar.admin-topbar {
  min-height: 52px;
}

body.admin-panel .admin-users-page {
  padding-top: 0;
}

.admin-users-toolbar .dataTables_filter {
  margin: 0;
}

.admin-users-toolbar .dataTables_filter label {
  margin: 0;
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
}

.user-type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 700;
}

.user-type-google {
  background: #ea4335;
  color: #fff;
}

.user-type-local {
  background: #e2e8f0;
  color: #475569;
}

.user-status-badge {
  font-weight: 600;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 3px;
}

.user-status-active {
  background: #22c55e !important;
  color: #fff !important;
}

.user-status-deactive {
  background: #94a3b8 !important;
  color: #fff !important;
}

.user-operate-btns {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
}

.btn-operate {
  width: 26px;
  height: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 3px;
  color: #fff;
  font-size: 0.72rem;
}

.btn-operate-edit { background: #156deb; }
.btn-operate-exams { background: #09a8b1; }
.btn-operate-contrib { background: #f59e0b; }
.btn-operate-status { background: #ef4444; }

.btn-operate:hover,
.btn-operate:focus,
.btn-operate:active,
.btn-operate:focus-visible {
  opacity: 0.92;
  color: #fff !important;
  box-shadow: none !important;
  outline: none !important;
}

.btn-operate-edit:hover,
.btn-operate-edit:focus,
.btn-operate-edit:active { background: #156deb !important; }

.btn-operate-exams:hover,
.btn-operate-exams:focus,
.btn-operate-exams:active { background: #09a8b1 !important; }

.btn-operate-contrib:hover,
.btn-operate-contrib:focus,
.btn-operate-contrib:active { background: #f59e0b !important; }

.btn-operate-status:hover,
.btn-operate-status:focus,
.btn-operate-status:active { background: #ef4444 !important; }

body.admin-panel .modal {
  z-index: 1060 !important;
}

body.admin-panel .modal-backdrop {
  z-index: 1055 !important;
}

body.admin-panel .modal-content {
  background: #fff;
  color: #1e293b;
  border: none;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
}

body.admin-panel .modal-header,
body.admin-panel .modal-body,
body.admin-panel .modal-footer {
  background: #fff;
  color: #1e293b;
}

.admin-status-modal .modal-title {
  font-size: 1rem;
}

.admin-status-toggle .btn-check:checked + .btn-outline-primary {
  background: #156deb;
  border-color: #156deb;
  color: #fff;
}

.admin-status-toggle .btn-check:checked + .btn-outline-secondary {
  background: #64748b;
  border-color: #64748b;
  color: #fff;
}

.btn-accent {
  background: #09a8b1;
  color: #fff;
  border: none;
}

.btn-accent:hover {
  background: #088990;
  color: #fff;
}

.contrib-stat-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}

.contrib-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #156deb;
}

.contrib-stat-label {
  font-size: 0.8rem;
  color: #64748b;
}

/* Leaderboard page */
.admin-leaderboard-filters .form-label {
  color: #64748b;
}

.admin-leaderboard-filters .form-select-sm {
  height: 32px;
  font-size: 0.82rem;
}

.leaderboard-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #e2e8f0;
  color: #475569;
}

.leaderboard-rank-top {
  background: #156deb;
  color: #fff;
}

body.admin-panel:has(.admin-leaderboard-page) .topbar.admin-topbar {
  min-height: 52px;
}
