:root {
  --primary-color: #8B4513;   /* بني متوسط */
  --secondary-color: #A0522D; /* بني غامق */
  --accent-color: #D2B48C;    /* بيج فاتح */
  --text-color: #3E2723;      /* نص بني غامق */
  --heading-color: #5C4033;
  --sidebar-bg: #ffffff;      /* أبيض */
  --card-bg: #FFF8E7;         /* بيج فاتح */
  --hover-bg: #F5E1C9;        /* بيج شفاف */
  --sidebar-width: 380px;
  --transition-speed: 0.35s;
  --border-radius: 16px;
}

body.dark-mode {
  --primary-color: #5C4033;   /* بني غامق */
  --secondary-color: #8B4513; /* بني متوسط */
  --accent-color: #A0522D;    /* بني فاتح */
  --text-color: #F5EBDD;      /* نص فاتح */
  --heading-color: #EDE0D4;
  --sidebar-bg: #3E2723;      /* بني غامق */
  --card-bg: #5D4037;         /* بني متوسط */
  --hover-bg: #7B4F37;        /* بني شفاف */
}


.sidebar {
  position: fixed;
  top: 0;
  right: -380px;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 2000;
  transition: right var(--transition-speed) ease;
  overflow-y: auto;
  backdrop-filter: blur(12px);
  padding: 20px;
  box-sizing: border-box;
}

.sidebar.active {
  right: 0;
}

.user-info {
  text-align: center;
  margin-bottom: 30px;
  padding: 20px;
  border-radius: var(--card-radius);
  background: linear-gradient(45deg, var(--accent-color), var(--primary-color));
  box-shadow: 0 8px 25px rgba(92, 64, 51, 0.5);
  transition: transform 0.4s, box-shadow 0.4s;
}

.user-info:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 35px rgba(210, 180, 140, 0.7);
}

.user-avatar {
  width: 100px;
  height: 100px;
  margin: 0 auto 12px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(210, 180, 140, 0.5);
  transition: transform 0.3s, box-shadow 0.3s;
}

.user-avatar:hover {
  transform: scale(1.1);
  box-shadow: 0 0 25px rgba(210, 180, 140, 0.8);
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.avatar-initial {
  font-size: 48px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 10px var(--accent-color);
}

.user-info h4 {
  margin: 10px 0 4px;
  font-size: 20px;
  color: var(--text-color);
  font-weight: 700;
}

.user-balance {
  font-weight: 700;
  font-size: 16px;
  color: #FFD700;
  margin-top: 8px;
}

.sidebar-menu {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  padding: 0;
  flex-grow: 1;
}

.sidebar-menu li {
  list-style: none;
}

.sidebar-menu a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-color);
  text-decoration: none;
  border-radius: var(--card-radius);
  background: rgba(210, 180, 140, 0.1);
  transition: transform 0.3s, box-shadow 0.3s, background 0.3s;
  box-shadow: 0 5px 15px rgba(92, 64, 51, 0.2);
}

.sidebar-menu a i {
  font-size: 28px;
  margin-bottom: 8px;
  transition: transform 0.3s, color 0.3s;
}

.sidebar-menu a:hover {
  background: var(--hover-bg);
  transform: translateY(-5px);
  box-shadow: 0 12px 25px rgba(92, 64, 51, 0.4);
}

.sidebar-menu a:hover i {
  transform: scale(1.3);
  color: #FFD700;
}

.company-info {
  margin-top: 20px;
  padding: 15px;
  text-align: center;
  border-radius: var(--card-radius);
  background: rgba(210, 180, 140, 0.1);
}

.company-logo {
  height: 60px;
  margin-bottom: 10px;
  border-radius: 12px;
  box-shadow: 0 0 15px var(--primary-color);
}

.unread-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #FFD700;
  color: #000;
  padding: 5px 8px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 900;
}

.theme-toggle {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 44px;
  height: 44px;
  background: var(--primary-color);
  border: none;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(210, 180, 140, 0.5);
  transition: background 0.3s;
}

.theme-toggle:hover {
  background: var(--accent-color);
}

/* أيقونات التواصل تبقى أفقياً وتتماشى مع باقي البطاقات */
.social-icons-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px; /* المسافة عن البطاقة فوق */
    gap: 40px; /* المسافة بين الأيقونات */
}

.social-icons-container a {
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(45deg, #25D366, #0088cc);
    color: #fff;
    font-size: 32px;
    box-shadow: 0 0 15px rgba(92, 64, 51, 0.3);
    transition: transform 0.3s, box-shadow 0.3s;
}

.social-icons-container a:hover {
    transform: scale(1.15);
    box-shadow: 0 0 25px rgba(0,0,0,0.5);
}

@media (max-width: 768px) {
  .sidebar { width: 75vw; right: -75vw; }
  .sidebar.active { right: 0; }
  .user-avatar { width: 90px; height: 90px; }
  .user-info h4 { font-size: 18px; }
  .sidebar-menu a { font-size: 13px; padding: 16px; }
  .sidebar-menu i { font-size: 24px; }
  .sidebar-menu.guest {
    display: flex;
    flex-direction: column;
    gap: 12px; /* المسافة بينهم */
}
}


/* زر العملات في السايدبار */
.currency-dropdown-trigger {
    padding: 0 24px;
    margin: 12px 0;
}

.currency-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: black;
    border: none;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.3);
    transition: all 0.2s ease;
}

.currency-btn:hover {
    transform: translateY(-1px);
}

.dropdown-arrow {
    transition: transform 0.3s ease;
    font-size: 0.9rem;
}

/* البوابة (Portal) - تظهر خارج السايدبار */
.dropdown-portal {
    position: fixed;
    display: none;
    z-index: 2000;
}

.dropdown-portal.open {
    display: block;
}

.dropdown-content {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 10px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 6px 15px rgba(92, 64, 51, 0.5);
    width: 200px; /* عرض ثابت */
    min-width: unset; /* إلغاء الحد الأدنى */
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #2a2a2a;
    cursor: pointer;
    font-size: 0.85rem;
    color: #fff;
}

.dropdown-item:hover {
    background: #2c2c2c;
}

.dropdown-item.active {
    background: #252525;
    border-left: 3px solid #FFD700;
}

.dropdown-item i {
    font-size: 1rem;
    color: #FFD700;
}

.dropdown-item small {
    color: #aaa;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.exchange-rate {
    background: #0d1b0d;
    color: #77b300;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}