* {
  box-sizing: border-box
}

body {
  margin: 0;
  font-family: system-ui, Tahoma;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

.center {
  display: flex;
  align-items: center;
  justify-content: center
}

.wrap {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  border-left: 1px solid var(--line); 
  padding: 18px;
  position: fixed !important; /* Force fixed to avoid overrides */
  right: 0;
  top: 0;
  bottom: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 2000; /* Extremely high to stay above everything */
}

.sidebar .logo {
  font-weight: 900;
  letter-spacing: 2px;
  margin-bottom: 14px;
  color: var(--accent);
  position: relative;
  z-index: 50;
}

.sidebar a {
  display: block;
  padding: 10px 10px;
  border-radius: 10px;
  margin: 6px 0;
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .06);
}

.sidebar a:hover {
  border-color: rgba(199, 122, 58, .35)
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-right: 260px; /* Offset for the fixed sidebar */
  min-height: 100vh;
  position: relative;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 18px;
  height: 70px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  position: fixed !important;
  top: 0;
  right: 260px; /* Leave space for the fixed sidebar */
  left: 0;
  z-index: 1900;
  backdrop-filter: blur(10px);
}

.topbar .title {
  font-weight: 800;
  letter-spacing: 1px
}

.content {
  padding: 18px;
  flex: 1;
  margin-top: 70px; /* Offset for the fixed topbar */
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px
}

.tbl {
  width: 100%;
  border-collapse: collapse;
  background: var(--table-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.tbl th,
.tbl td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left
}

.tbl th {
  color: var(--muted);
  font-weight: 700
}

input,
select {
  width: 100%;
  padding: 10px 12px;
  margin: 8px 0;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(0, 0, 0, .35);
  color: var(--text);
}

.btn {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--text);
  cursor: pointer;
}

.err {
  color: #ffb3b3
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none
}

.modal-card {
  width: 420px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
}

.sidebar .logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
}

.logo-img {
  max-width: 120px;
  max-height: 60px;
  object-fit: contain;
}

.logo-img.animated {
  animation: pulse 2s infinite;
}

.logo-text {
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--accent);
  font-size: 14px;
  text-align: center;
}

.logo-link {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
  min-height: 60px; /* Ensure height even if img is rendering */
}

.logo-img {
  max-width: 100%;
  max-height: 80px;
  object-fit: contain;
  cursor: pointer;
  display: block; /* Remove inline issues */
  position: relative;
  z-index: 50; /* Force above background */
}

.logo-img.animated {
  animation: pulse 2s infinite;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar .title {
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--accent);
  font-size: 18px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* تم نقل تعريف خلفية الموقع إلى branding-style.ejs */

/* اللوقو */
.logo-img {
  max-width: 100%;
  max-height: 60px;
  object-fit: contain;
}

/* أنيميشن */
.logo-img.animated {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
  }
}

.top-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.top-box {
  background: var(--card-bg); /* Use variable for transparency */
  backdrop-filter: blur(5px); /* Enhance readability over banner */
  border-radius: 12px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.top-box h2 {
  margin-bottom: 12px;
}

.section-title {
  font-size: 22px;
  font-weight: bold;
}

.section-subtitle {
  opacity: .7;
  margin-bottom: 20px;
}

.admin-search {
  width: 100%;
  padding: 12px;
  margin-bottom: 25px;
  border-radius: 10px;
  border: none;
  background: #111827;
  color: #fff;
}

/* ===============================
   ADMIN CARD – FINAL CLEAN GRID
================================ */

/*
الفكرة:
- Grid = العناصر الكبيرة
- Flex = التكت + التحذير
- لا margins عشوائية
- كل عنصر يتحرك لوحده
*/

.admin-card {
  display: grid;
  grid-template-columns:
    auto
    /* الاسم + الرقم */
    auto
    /* Active */
    auto
    /* Points */
    auto
    /* Tickets */
    auto;
  /* Warns */

  align-items: center;
  column-gap: 28px;

  padding: 18px 22px;
  border-radius: 16px;

  background: var(--card-bg);
  border: 1px solid var(--line);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .6);
}

/* ===============================
   1️⃣ الاسم + الرقم (قطعة وحدة)
================================ */

.admin-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-rank {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #1f2937;
  color: #fbbf24;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-name-role {
  display: flex;
  flex-direction: column;
}

.admin-name {
  font-weight: 800;
  font-size: 15px;
  color: #e9e6e2;
}

.admin-role {
  font-size: 12px;
  color: rgba(255, 255, 255, .7);
  margin-top: 2px;
  background: var(--btn-bg);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text);
}

/* ===============================
   2️⃣ الحالة Active
   🔧 تحكم مستقل
================================ */

.admin-status {
  justify-self: start;
  /* أقرب للاسم */
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--accent);
  font-size: 15px;
}

/*
لو تبي تحركها:
justify-self: center;
justify-self: end;
*/

/* ===============================
   3️⃣ النقاط Points
   🔧 تحكم مستقل
================================ */

.admin-points {
  text-align: center;
  justify-self: center;
}

.admin-points .stat-number {
  font-size: 20px;
  font-weight: 900;
  color: #e0b77f;
  /* ذهبي */
}


.admin-points .stat-label {
  font-size: 11px;
  opacity: .6;
  color: rgba(224, 183, 127, .6);
}

/* ===============================
   الفاصل
================================ */

.admin-divider {
  width: 1px;
  height: 42px;
  background:
    linear-gradient(180deg,
      transparent,
      #c77a3a,
      transparent);
}

/* ===============================
   4️⃣ + 5️⃣ التكتات + التحذيرات
================================ */

.admin-stats-group {
  display: flex;
  align-items: center;
  gap: 14px;
  /* 🔧 المسافة بين التكت والتحذير */
}

.admin-stat {
  position: relative;
  text-align: center;
  min-width: 70px;
}

.admin-stat.warn .stat-number {
  color: #e1b564;
}

.admin-stat.warn .stat-label {
  color: rgba(225, 100, 100, .6);
}

/* أيقونة التكت */
.admin-stat.ticket .stat-number {
  color: #b9915d;
}

.admin-stat.ticket .stat-label {
  color: rgba(139, 114, 80, 0.55);
}

.ticket-icon,
.warn-icon {
  position: absolute;
  top: 4px;
  right: 8px;
  width: 16px;
  height: 16px;
  opacity: .9;
  background-repeat: no-repeat;
  background-size: contain;
}

/* أرقام وتسميات */
.stat-number {
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
}

.stat-label {
  font-size: 11px;
  opacity: .6;
}

/* ===============================
   كرت لوحة الصدارة
================================ */

.leaderboard-card {
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 18px 22px;
  border-radius: 18px;
  margin-bottom: 20px;

  background:
    linear-gradient(90deg,
      rgba(199, 122, 58, .45),
      rgba(199, 122, 58, .18));

  border: 1px solid rgba(199, 122, 58, .45);
  box-shadow: 0 12px 35px rgba(199, 122, 58, .18);
}

.admin-stat.warn {
  cursor: pointer;
  user-select: none;
}

.admin-stat.warn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.modal.hidden {
  display: none;
}

.admin-name.clickable {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  z-index: 5;
  position: relative;
}

.admin-name.clickable:hover {
  color: #f0c27b;
  text-decoration: underline;
}

.admin-card {
  pointer-events: auto;
}

.admin-card * {
  pointer-events: auto;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: 480px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .6);
}



/* ===== Audit Profile Modal ===== */

.profile-header {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--accent);
}

.profile-meta {
  display: flex;
  flex-direction: column;
}

.profile-name {
  font-weight: 900;
  font-size: 18px;
}

.profile-role {
  font-size: 13px;
  opacity: .7;
}

.profile-status {
  margin-top: 4px;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(199, 122, 58, .25);
  width: fit-content;
}

.profile-kpis {
  display: flex;
  gap: 14px;
  margin-bottom: 18px;
}

.kpi {
  flex: 1;
  text-align: center;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .04);
}

.kpi strong {
  font-size: 20px;
  display: block;
}

.kpi span {
  font-size: 11px;
  opacity: .6;
}

.profile-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.profile-tabs .tab {
  flex: 1;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.profile-tabs .tab.active {
  background: rgba(199, 122, 58, .25);
}

#tab-content {
  margin-top: 12px;
  font-size: 14px;
}

#tab-content h4 {
  margin-bottom: 8px;
}

.chip {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(199, 122, 58, .25);
  margin: 4px;
  font-size: 12px;
}


.sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.section-card {
  background: #111;
  border: 1px solid #222;
  border-radius: 12px;
  padding: 16px;
}

.section-stats {
  display: flex;
  justify-content: space-between;
  margin: 8px 0;
}

.section-actions {
  margin-top: 12px;
}

.section-meta {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  color: #aaa;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-card.fancy {
  background: #111;
  padding: 20px;
  border-radius: 14px;
  width: 420px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.close-btn {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #aaa;
}

.form-group {
  margin-bottom: 12px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}


.section-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 30px;
}

.hero-stats {
  display: flex;
  gap: 20px;
  margin-top: 15px;
}

.stat {
  background: #111;
  padding: 10px 16px;
  border-radius: 12px;
  text-align: center;
  min-width: 90px;
}

.stat strong {
  font-size: 20px;
  display: block;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.stat-card strong {
  font-size: 26px;
}

.mono {
  font-family: monospace;
  opacity: .9;
}

.empty {
  text-align: center;
  opacity: .6;
}

.badge.role-manager {
  background: #7c3aed;
}

.badge.role-assistant {
  background: #2563eb;
}

.badge.role-member {
  background: #16a34a;
}

.warning-card {
  border: 1px solid #3b1d1d;
}


/* ===== Members Table ===== */
.member-row {
  transition: background .2s ease;
}

.member-row:hover {
  background: rgba(255, 255, 255, .03);
}

.avatar-cell {
  width: 50px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #444, #222);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* Discord ID */
.mono {
  font-family: monospace;
  font-size: 13px;
  opacity: .85;
}

/* Centered numbers */
.center {
  text-align: center;
}

/* Role badges */
.role-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: bold;
}

/* Role colors */
.role-badge.manager {
  background: rgba(255, 170, 0, .15);
  color: #ffb300;
}

.role-badge.assistant {
  background: rgba(0, 140, 255, .15);
  color: #4da3ff;
}

.role-badge.member {
  background: rgba(0, 200, 120, .15);
  color: #3ddc97;
}


.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stats-row {
  display: flex;
  gap: 15px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.04);
  padding: 14px 18px;
  border-radius: 12px;
  text-align: center;
  min-width: 110px;
}

.stat-card.warning {
  border: 1px solid #ffb020;
}

.members-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
}

.search-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  background: #111;
  border: 1px solid #222;
  color: #fff;
}

.filter-select {
  padding: 10px;
  background: #111;
  border-radius: 10px;
  color: #fff;
}

.advanced-table {
  width: 100%;
  border-collapse: collapse;
}

.advanced-table thead {
  background: #0f0f0f;
}

.advanced-table th,
.advanced-table td {
  padding: 14px;
  border-bottom: 1px solid #1f1f1f;
}

.advanced-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.role-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.role-badge.manager {
  background: #6d28d9;
}

.role-badge.assistant {
  background: #2563eb;
}

.role-badge.member {
  background: #16a34a;
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #aaa;
}

.icon-btn.danger {
  color: #ef4444;
}