:root {
  --primary-color: #35d6ff;
  --secondary-color: #071b3a;
  --accent-color: #0b8fc2;
  --text-color: #071b3a;
  --heading-color: #071b3a;
  --sidebar-width: 292px;
  --transition-speed: 0.35s;
  --dragon-bg: url('/assets/images/dragon-sidebar.webp');
}

body.dark-mode {
  --text-color: #ffffff;
  --heading-color: #ffffff;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.sidebar {
  position: fixed;
  top: 12px;
  right: -320px;
  width: var(--sidebar-width);
  height: calc(100vh - 24px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 12px;
  border-radius: 32px 0 0 32px;
  transition: right var(--transition-speed) ease;
  background:
    radial-gradient(circle at top right, rgba(53,216,255,.18), transparent 34%),
    linear-gradient(180deg, #eafbff, #ffffff);
  border: 1px solid rgba(53,216,255,.18);
  box-shadow:
    -18px 18px 45px rgba(7,27,58,.18),
    inset 0 1px 0 rgba(255,255,255,.85);
}

body.dark-mode .sidebar {
  background:
    radial-gradient(circle at top right, rgba(53,216,255,.16), transparent 35%),
    linear-gradient(180deg, #03050b, #071b3a 55%, #000);
  border-color: rgba(53,216,255,.25);
  box-shadow:
    -20px 20px 50px rgba(0,0,0,.58),
    0 0 28px rgba(53,216,255,.12);
}

.sidebar.active {
  right: 0;
}

/* ==================== User Dragon Card ==================== */

.user-info {
  position: relative;
  min-height: 340px;
  padding: 94px 12px 14px;
  margin: 0 0 14px;
  text-align: center;
  border-radius: 30px;
  overflow: hidden;

  background:
    linear-gradient(180deg, rgba(0,0,0,.08), rgba(0,0,0,.38)),
    radial-gradient(circle at 18% 10%, rgba(53,216,255,.20), transparent 32%),
    var(--dragon-bg),
    linear-gradient(160deg, #02040a, #071b3a 55%, #000);

  background-size:
    cover,
    cover,
    90% 100%,
    cover;

  background-position:
    center,
    center,
    center center,
    center;

  background-repeat: no-repeat;

  border: 1px solid rgba(53,216,255,.44);

  box-shadow:
    0 0 24px rgba(53,216,255,.26),
    inset 0 0 26px rgba(53,216,255,.12),
    0 18px 36px rgba(0,0,0,.48);
}

.user-info::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, transparent 16%, rgba(53,216,255,.12) 46%, transparent 72%),
    radial-gradient(circle at 26% 28%, rgba(53,216,255,.14), transparent 28%);
  opacity: .55;
  pointer-events: none;
  z-index: 0;
}

.user-info::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 25px;
  border: 1px solid rgba(53,216,255,.48);
  box-shadow:
    0 0 18px rgba(53,216,255,.35),
    inset 0 0 18px rgba(53,216,255,.12);
  pointer-events: none;
  z-index: 1;
}

.user-info > * {
  position: relative;
  z-index: 2;
}

.user-avatar {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle, #102b55, #02040a);
  border: 2px solid rgba(53,216,255,.82);
  overflow: hidden;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 0 5px rgba(53,216,255,.12),
    0 0 30px rgba(53,216,255,.48),
    inset 0 0 18px rgba(255,255,255,.08);
  z-index: 3;
}

.user-avatar:hover {
  transform: translateX(-50%) scale(1.04);
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-initial {
  color: #35d6ff;
  font-size: 34px;
  font-weight: 900;
  text-shadow: 0 0 18px rgba(53,216,255,.75);
}

.user-info h4 {
  margin: 0 0 5px;
  font-size: 19px;
  color: #fff;
  font-weight: 900;
  text-shadow: 0 0 12px rgba(53,216,255,.55);
}

.user-email {
  color: rgba(255,255,255,.72);
  font-size: 12px;
  font-weight: 700;
}

.user-meta-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex-wrap: wrap;
  margin: 6px 0;
}

.user-id-badge,
.user-level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  color: #fff;
  background: rgba(0,0,0,.36);
  border: 1px solid rgba(53,216,255,.36);
  box-shadow:
    0 0 14px rgba(53,216,255,.18),
    inset 0 0 12px rgba(53,216,255,.10);
}

.user-level-badge {
  color: #35d6ff;
}

.user-level-badge::before {
  content: "\f521";
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free";
  font-weight: 900;
  color: #ffd84d;
  margin-left: 6px;
  text-shadow: 0 0 10px rgba(255,216,77,.75);
}

/* Balance Card */
.user-balance-card {
  margin: 10px 0 0;
  height: 52px;
  padding: 0 10px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;

  background: rgba(0,0,0,.30);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);

  border: 1px solid rgba(53,216,255,.42);

  box-shadow:
    0 0 20px rgba(53,216,255,.26),
    inset 0 0 14px rgba(53,216,255,.08);
}

.user-balance-card::before {
  content: "\f555";
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free";
  font-weight: 900;
  width: 30px;
  height: 30px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #35d6ff;
  background: rgba(255,255,255,.08);
  margin-left: 8px;
  box-shadow:
    0 0 14px rgba(53,216,255,.20),
    inset 0 0 10px rgba(53,216,255,.08);
}

.user-balance {
  margin: 0;
  line-height: 1;
  font-size: 18px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 14px rgba(53,216,255,.60);
}

/* Quick Actions */
.user-quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.quick-action {
  height: 44px;
  border-radius: 16px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  transition: .22s ease;

  background: rgba(0,0,0,.26);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);

  border: 1px solid rgba(53,216,255,.30);

  box-shadow:
    0 0 14px rgba(53,216,255,.16),
    inset 0 0 12px rgba(53,216,255,.08);
}

.quick-action:hover {
  transform: translateY(-3px);
  box-shadow:
    0 0 24px rgba(53,216,255,.40),
    inset 0 0 18px rgba(53,216,255,.14);
}

.quick-fav { color: #ff4d8d; }
.quick-profile { color: #35d6ff; }
.quick-logout { color: #ff4d6d; }

/* ==================== Menu Buttons Fantasy ==================== */

.sidebar-menu {
  list-style: none;
  padding: 0;
  flex-grow: 1;
}

.sidebar-menu li {
  margin: 9px 0;
  border-radius: 20px;
  overflow: visible;
}

.sidebar-menu a {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 54px;
  padding: 9px 12px 9px 14px;
  color: #eafaff;
  text-decoration: none;
  font-size: 15.5px;
  font-weight: 900;
  border-radius: 20px;
  background: transparent;
  border: none;
  box-shadow: 0 10px 22px rgba(0,0,0,.28);
  transition: .25s ease;
  user-select: none;
  overflow: hidden;
  isolation: isolate;
}

/* الشريط الأزرق المتحرك حول الزر */
.sidebar-menu a::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    transparent 58deg,
    rgba(53,216,255,.30) 82deg,
    #35d6ff 112deg,
    rgba(53,216,255,.30) 142deg,
    transparent 168deg,
    transparent 360deg
  );
  animation: rotateBlueLine 1.6s linear infinite;
  z-index: -2;
}

.sidebar-menu a::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(2,4,10,.96), rgba(7,27,58,.90));
  z-index: -1;
}

.sidebar-menu a:hover {
  transform: translateX(-7px) scale(1.01);
  color: #fff;
  box-shadow:
    0 0 28px rgba(53,216,255,.42),
    0 16px 30px rgba(0,0,0,.34);
}

.sidebar-menu i {
  position: relative;
  z-index: 2;
  margin-left: 12px;
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 15px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #ffffff;

  background:
    radial-gradient(circle at 35% 25%, rgba(255,255,255,.28), transparent 35%),
    linear-gradient(135deg, #071b3a, #0b8fc2);

  border: 1px solid rgba(53,216,255,.24);

  box-shadow:
    0 0 16px rgba(53,216,255,.30),
    inset 0 0 12px rgba(255,255,255,.10);

  transition: .25s ease;
}

.sidebar-menu a:hover i {
  transform: rotate(-7deg) scale(1.08);
  box-shadow:
    0 0 22px rgba(53,216,255,.48),
    inset 0 0 14px rgba(255,255,255,.12);
}

.sidebar-menu a > * {
  position: relative;
  z-index: 2;
}

/* icon override للأزرار العادية فقط */
.sidebar-menu li:not(.social-icons):nth-child(1) i::before { content: "\f015"; }
.sidebar-menu li:not(.social-icons):nth-child(2) i::before { content: "\f2bd"; }
.sidebar-menu li:not(.social-icons):nth-child(3) i::before { content: "\f555"; }
.sidebar-menu li:not(.social-icons):nth-child(4) i::before { content: "\f09d"; }
.sidebar-menu li:not(.social-icons):nth-child(5) i::before { content: "\f290"; }
.sidebar-menu li:not(.social-icons):nth-child(6) i::before { content: "\f0c0"; }
.sidebar-menu li:not(.social-icons):nth-child(7) i::before { content: "\f084"; }
.sidebar-menu li:not(.social-icons):nth-child(8) i::before { content: "\f0e0"; }
.sidebar-menu li:not(.social-icons):nth-child(9) i::before { content: "\f51e"; }
.sidebar-menu li:not(.social-icons):nth-child(10) i::before { content: "\f05a"; }
.sidebar-menu li:not(.social-icons):nth-child(11) i::before { content: "\f013"; }
.sidebar-menu li:not(.social-icons):nth-child(12) i::before { content: "\f590"; }

@keyframes rotateBlueLine {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ==================== Currency ==================== */

.currency-dropdown-trigger {
  padding: 0;
  margin: 9px 0 2px;
}

.currency-btn {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: #ffffff;
  padding: 9px 10px;
  border-radius: 18px;
  font-size: .86rem;
  font-weight: 900;
  cursor: pointer;

  background: rgba(0,0,0,.28);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);

  border: 1px solid rgba(53,216,255,.34);

  box-shadow:
    0 0 18px rgba(53,216,255,.22),
    inset 0 0 14px rgba(53,216,255,.08);

  transition: .22s ease;
}

.currency-btn::before {
  content: "\f53a";
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free";
  font-weight: 900;
  width: 30px;
  height: 30px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(53,216,255,.12);
  color: #35d6ff;
  box-shadow: inset 0 0 10px rgba(53,216,255,.10);
}

.currency-btn > i:first-child {
  display: none;
}

.currency-btn span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.currency-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 24px rgba(53,216,255,.32),
    inset 0 0 16px rgba(53,216,255,.10);
}

.dropdown-arrow {
  transition: transform .3s ease;
  font-size: .8rem;
}

.dropdown-portal {
  position: fixed;
  display: none;
  z-index: 2000;
}

.dropdown-portal.open {
  display: block;
}

.dropdown-content {
  background: #03050b;
  border: 1px solid rgba(53,216,255,.25);
  border-radius: 18px;
  max-height: 210px;
  overflow-y: auto;
  box-shadow: 0 12px 28px rgba(0,0,0,.52);
  width: 210px;
  min-width: unset;
  padding: 6px;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 10px;
  border-bottom: 1px solid rgba(53,216,255,.08);
  border-radius: 12px;
  cursor: pointer;
  font-size: .85rem;
  color: #ffffff;
}

.dropdown-item:hover {
  background: rgba(53,216,255,.12);
}

.dropdown-item.active {
  background: rgba(53,216,255,.16);
  border-left: 3px solid #35d6ff;
}

.dropdown-item i {
  font-size: 1rem;
  color: #35d6ff;
}

.dropdown-item small {
  color: rgba(255,255,255,.70);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.exchange-rate {
  background: rgba(53,216,255,.13);
  color: #35d6ff;
  padding: 3px 6px;
  border-radius: 7px;
  font-size: .78rem;
  font-weight: 900;
}

/* ==================== Company ==================== */

.company-info {
  margin-top: 10px;
  padding: 18px 14px;
  text-align: center;
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(2,4,10,.92), rgba(7,27,58,.82));
  border: 1px solid rgba(53,216,255,.26);
  box-shadow:
    0 0 20px rgba(53,216,255,.18),
    inset 0 0 14px rgba(53,216,255,.08);
}

.company-logo {
  height: 82px;
  max-width: 180px;
  object-fit: contain;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 14px rgba(53,216,255,.38));
}

.company-name {
  color: #35d6ff;
  font-size: 17px;
  font-weight: 900;
}

.unread-badge {
  position: relative;
  z-index: 3;
  margin-right: 8px;
  background: linear-gradient(135deg, #35d6ff, #0b8fc2);
  color: #ffffff;
  padding: 5px 9px;
  border-radius: 12px;
  font-size: .75rem;
  font-weight: 900;
  display: inline-block;
  min-width: 24px;
  text-align: center;
  box-shadow: 0 0 12px rgba(53,216,255,.35);
}

/* ==================== Social ==================== */

.sidebar-menu li.social-icons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 10px 0;
}

.sidebar-menu li.social-icons a {
  min-height: 52px;
  justify-content: center;
  padding: 0;
  background: transparent;
}

.sidebar-menu li.social-icons a i {
  margin: 0;
  width: 38px;
  height: 38px;
  min-width: 38px;
  font-size: 22px;
  font-family: "Font Awesome 5 Brands", "Font Awesome 6 Brands" !important;
  font-weight: 400 !important;
}

.sidebar-menu li.social-icons a[href*="wa.me"] i::before {
  content: "\f232" !important;
  font-family: "Font Awesome 5 Brands", "Font Awesome 6 Brands" !important;
  font-weight: 400 !important;
}

.sidebar-menu li.social-icons a[href*="t.me"] i::before {
  content: "\f3fe" !important;
  font-family: "Font Awesome 5 Brands", "Font Awesome 6 Brands" !important;
  font-weight: 400 !important;
}

/* ==================== Theme ==================== */

.theme-toggle {
  position: absolute;
  top: 18px;
  left: 18px;
  background: rgba(0,0,0,.44);
  color: #ffffff;
  border: 1px solid rgba(53,216,255,.34);
  border-radius: 16px;
  width: 42px;
  height: 42px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow:
    0 0 18px rgba(53,216,255,.28),
    inset 0 0 12px rgba(53,216,255,.08);
  transition: .25s ease;
  z-index: 20;
}

.theme-toggle:hover {
  transform: rotate(-12deg) scale(1.06);
  box-shadow: 0 0 24px rgba(53,216,255,.42);
}

/* ==================== Mobile ==================== */

@media (max-width: 768px) {
  .sidebar {
    width: 68vw;
    right: -80vw;
    top: 8px;
    height: calc(100vh - 16px);
    border-radius: 28px 0 0 28px;
    padding: 10px;
  }

  .sidebar.active {
    right: 0;
  }

  .user-info {
    min-height: 322px;
    padding: 88px 10px 14px;
    border-radius: 26px;

    background-size:
      cover,
      cover,
      94% 100%,
      cover;

    background-position:
      center,
      center,
      center center,
      center;
  }

  .user-avatar {
    top: 20px;
    width: 68px;
    height: 68px;
  }

  .user-info h4 {
    font-size: 16px;
  }

  .user-balance-card {
    height: 48px;
    border-radius: 16px;
  }

  .user-balance-card::before {
    width: 28px;
    height: 28px;
    border-radius: 11px;
  }

  .user-balance {
    font-size: 16px;
  }

  .quick-action {
    height: 38px;
    font-size: 16px;
    border-radius: 14px;
  }

  .currency-btn {
    min-height: 42px;
    padding: 8px 9px;
    font-size: .78rem;
    border-radius: 16px;
  }

  .currency-btn::before {
    width: 27px;
    height: 27px;
    border-radius: 10px;
  }

  .sidebar-menu li {
    margin: 8px 0;
  }

  .sidebar-menu a {
    font-size: 13.5px;
    min-height: 46px;
    padding: 7px 9px;
    border-radius: 17px;
  }

  .sidebar-menu a::before {
    border-radius: 17px;
  }

  .sidebar-menu a::after {
    inset: 2px;
    border-radius: 15px;
  }

  .sidebar-menu i {
    width: 32px;
    height: 32px;
    min-width: 32px;
    font-size: 14px;
    border-radius: 12px;
    margin-left: 9px;
  }

  .company-logo {
    height: 90px;
    max-width: 190px;
  }
}

@media (max-width: 420px) {
  .sidebar {
    width: 70vw;
    right: -82vw;
  }

  .user-quick-actions {
    gap: 7px;
  }
}
