:root {
  --sidebar-width: 280px;

  --sb-bg: #f2f5f9;
  --sb-card: #ffffff;
  --sb-menu: #e7edf5;
  --sb-hover: #d8dee8;

  --sb-navy: #0b1f3a;
  --sb-navy2: #102f55;
  --sb-silver: #c0c7d1;
  --sb-text: #0b1f3a;
  --sb-muted: #526173;

  --transition-speed: 0.3s;
  --border-radius: 16px;
}

body.dark-mode {
  --sb-bg: #071526;
  --sb-card: #0b1f3a;
  --sb-menu: #102f55;
  --sb-hover: #1b456f;

  --sb-text: #eef3f8;
  --sb-muted: #c0c7d1;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.sidebar {
  position: fixed;
  top: 0;
  right: calc(-1 * var(--sidebar-width));
  width: var(--sidebar-width);
  height: 100dvh;
  max-height: 100dvh;

  background: var(--sb-bg);
  color: var(--sb-text);

  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;

  border-left: 4px solid var(--sb-silver);
  border-radius: 22px 0 0 22px;

  box-shadow: -8px 0 28px rgba(0,0,0,0.35);
  transition: right 0.3s ease;
}

.sidebar.active {
  right: 0;
}

/* كرت المستخدم */
.user-info {
  text-align: center;
  padding: 20px 16px;
  margin: 16px;
  border-radius: 22px;

  background: var(--sb-card);
  border: 1px solid rgba(120,130,145,0.22);

  box-shadow: 0 8px 18px rgba(0,0,0,0.12);
}

body.dark-mode .user-info {
  box-shadow: 0 8px 22px rgba(0,0,0,0.42);
}

/* الصورة */
.user-avatar {
  width: 82px;
  height: 82px;
  border-radius: 22px;
  background: var(--sb-menu);
  border: 3px solid var(--sb-silver);
  overflow: hidden;
  margin: 0 auto 12px;

  display: flex;
  align-items: center;
  justify-content: center;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-initial {
  font-size: 36px;
  font-weight: 900;
  color: var(--sb-navy);
}

body.dark-mode .avatar-initial {
  color: #ffffff;
}

.user-info h4 {
  margin: 8px 0 4px;
  font-size: 18px;
  color: var(--sb-text);
  font-weight: 800;
}

.user-email {
  color: var(--sb-muted);
  font-size: 13px;
}

/* ID + VIP */
.user-meta-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.user-id-badge {
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--sb-navy);
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.user-level-badge {
  padding: 5px 11px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffffff, #c0c7d1);
  color: #071526;
  font-size: 12px;
  font-weight: 900;
}

/* الرصيد */
.user-balance-card {
  margin-top: 12px;
  min-height: 50px;
  padding: 0 12px;
  border-radius: 16px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: linear-gradient(135deg, var(--sb-navy), var(--sb-navy2));
  border: 1px solid rgba(192,199,209,0.35);
}

.user-balance {
  margin: 0;
  color: #ffffff;
  font-size: 18px;
  font-weight: 900;
}

/* أزرار القلب والبروفايل والخروج */
.user-quick-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}

.quick-action {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: flex !important;
  align-items: center;
  justify-content: center;

  background: var(--sb-menu);
  border: 1px solid rgba(120,130,145,0.20);

  font-size: 18px;
  cursor: pointer;
  transition: 0.2s ease;
}

.quick-action:hover {
  transform: translateY(-2px);
  background: var(--sb-hover);
}

.quick-fav {
  color: #d9365e !important;
}

.quick-profile {
  color: var(--sb-navy2) !important;
}

.quick-logout {
  color: #d93636 !important;
}

body.dark-mode .quick-profile {
  color: #d8dee8 !important;
}

/* القائمة */
.sidebar-menu {
  list-style: none;
  padding: 0 12px 12px;
  flex-grow: 1;
}

.sidebar-menu li {
  margin: 8px 0;
  border-radius: 16px;
  overflow: hidden;
  background: var(--sb-menu);
  border: 1px solid rgba(120,130,145,0.14);
}

.sidebar-menu li:hover {
  background: var(--sb-hover);
}

.sidebar-menu a {
  display: flex;
  align-items: center;
  padding: 12px 15px;

  color: var(--sb-text);
  text-decoration: none;

  font-size: 15px;
  font-weight: 800;

  border-radius: 16px;
  transition: 0.2s ease;
}

.sidebar-menu a:hover {
  color: var(--sb-navy);
  transform: translateX(-4px);
}

body.dark-mode .sidebar-menu a:hover {
  color: #ffffff;
}

.sidebar-menu i {
  margin-left: 13px;
  width: 24px;
  font-size: 19px;

  color: var(--sb-navy2) !important;
}

body.dark-mode .sidebar-menu i {
  color: #d8dee8 !important;
}

/* الرسائل غير المقروءة */
.unread-badge {
  margin-right: auto;
  background: linear-gradient(135deg, #ffffff, #c0c7d1);
  color: #071526;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

/* السوشيال */
.sidebar-menu li.social-icons {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 12px 0;
  background: linear-gradient(135deg, var(--sb-navy), var(--sb-navy2));
}

.sidebar-menu li.social-icons a {
  padding: 0;
}

.sidebar-menu li.social-icons a:hover {
  transform: none;
}

.sidebar-menu li.social-icons a i {
  width: 44px;
  height: 44px;
  line-height: 44px;
  border-radius: 14px;
  text-align: center;
  font-size: 22px;

  background: #ffffff;
  color: var(--sb-navy) !important;
}

/* زر الوضع الليلي */
.theme-toggle {
  position: absolute;
  top: 14px;
  left: 14px;

  width: 38px;
  height: 38px;
  border-radius: 14px;

  background: linear-gradient(135deg, #ffffff, #c0c7d1);
  color: #071526;

  border: none;
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 17px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

/* معلومات الشركة */
.company-info {
  padding: 14px 12px;
  text-align: center;
  background: var(--sb-card);
  border-top: 1px solid rgba(120,130,145,0.18);
}

.company-logo {
  height: 58px;
  max-width: 120px;
  object-fit: contain;
  border-radius: 12px;
}

/* العملات */
.currency-dropdown-trigger {
  padding: 0;
  margin: 12px 0 0;
}

.currency-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;

  background: linear-gradient(135deg, var(--sb-navy), var(--sb-navy2));
  color: #ffffff;

  border: 1px solid rgba(192,199,209,0.35);
  padding: 9px 12px;
  border-radius: 14px;

  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

.dropdown-portal {
  position: fixed;
  display: none;
  z-index: 2000;
}

.dropdown-portal.open {
  display: block;
}

.dropdown-content {
  background: #071526;
  border: 1px solid rgba(192,199,209,0.35);
  border-radius: 14px;
  max-height: 210px;
  overflow-y: auto;
  width: 200px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.45);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  color: #ffffff;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.dropdown-item:hover,
.dropdown-item.active {
  background: #102f55;
}

.dropdown-item i {
  color: #d8dee8 !important;
}

.exchange-rate {
  background: #d8dee8;
  color: #071526;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 900;
}

/* الموبايل */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 76vw;
  }

  .sidebar {
    right: calc(-1 * var(--sidebar-width));
    width: var(--sidebar-width);
    max-width: 320px;
    min-width: 260px;
    height: 100dvh;
    top: 0;
    border-radius: 20px 0 0 20px;
  }

  .sidebar.active {
    right: 0;
  }

  .user-info {
    margin: 14px;
    padding: 18px 14px;
  }

  .user-avatar {
    width: 74px;
    height: 74px;
  }

  .user-info h4 {
    font-size: 17px;
  }

  .sidebar-menu a {
    font-size: 14px;
    padding: 11px 13px;
  }

  .company-logo {
    height: 50px;
  }
}


/* ===== زر العملات ===== */

.currency-dropdown-trigger {
    margin-top: 12px;
}

.currency-btn {
    width: 100%;
    background: linear-gradient(135deg, #0b1f3a, #102f55);
    color: #fff;
    border: 1px solid rgba(216,222,232,.3);
    border-radius: 16px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    cursor: pointer;
    transition: .25s;
}

.currency-btn:hover {
    background: linear-gradient(135deg, #12385f, #0b1f3a);
}

.dropdown-arrow {
    transition: .3s;
}

.dropdown-portal {
    position: fixed;
    z-index: 9999;
}

.dropdown-content {
    background: #0b1f3a;
    border: 1px solid rgba(216,222,232,.25);
    border-radius: 18px;
    overflow: hidden;
    min-width: 220px;
    box-shadow: 0 10px 30px rgba(0,0,0,.4);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    cursor: pointer;
    color: #d8dee8;
    transition: .2s;
}

.dropdown-item:hover {
    background: #12385f;
}

.dropdown-item.active {
    background: #1b456f;
    color: white;
}

.exchange-rate {
    margin-right: auto;
    color: #aeb8c6;
    font-size: 12px;
}

@media (max-width: 380px) {
  :root {
    --sidebar-width: 82vw;
  }

  .sidebar {
    min-width: 250px;
  }

  .quick-action {
    width: 36px;
    height: 36px;
  }
}