/* ================= GLOBAL ================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Tahoma, sans-serif;
}

body {
  background: #f5f5f5;
}

/* ================= TOP BAR ================= */
.topbar {
  height: 56px;
  background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 16px;
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

.menu-btn {
  font-size: 22px;
  cursor: pointer;
  margin-right: 14px;
  transition: transform 0.4s ease;
}

.menu-btn:hover {
  transform: rotate(90deg);
}

#page-title {
  font-size: 18px;
  font-weight: 600;
}

/* ================= SIDEBAR ================= */
#sidebar {
  position: fixed;
  top: 56px;
  left: 0;
  width: 240px;
  height: calc(100% - 56px);
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  transform: translateX(-100%);
  transition: transform 0.45s cubic-bezier(.4,0,.2,1);
  z-index: 1001;
  padding-top: 20px;
  box-shadow: 5px 0 25px rgba(0, 0, 0, 0.3);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

#sidebar.open {
  transform: translateX(0);
}

/* Sidebar links */
#sidebar a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  color: #cbd5e1;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border-radius: 12px;
  margin: 0 12px 8px 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(5px);
}

/* Icon */
#sidebar a i {
  font-size: 18px;
  color: #38bdf8;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 2;
}

/* Text */
#sidebar a span {
  position: relative;
  z-index: 2;
  transition: all 0.3s ease;
  font-weight: 500;
}

/* Hover - تأثيرات رائعة */
#sidebar a:hover {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6, #ec4899);
  color: #fff;
  transform: translateX(8px) scale(1.02);
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.4);
}

#sidebar a:hover i {
  transform: scale(1.4) rotate(12deg);
  color: #fff;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.8));
}

#sidebar a:hover span {
  transform: translateX(4px);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.7);
}

/* تأثير الخلفية المتوهجة */
#sidebar a::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(139, 92, 246, 0.2));
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 1;
  border-radius: 12px;
}

#sidebar a:hover::before {
  opacity: 1;
}

/* الشريط الجانبي المتحرك */
#sidebar a::after {
  content: "";
  position: absolute;
  left: -100%;
  top: 0;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.7s ease;
  z-index: 1;
}

#sidebar a:hover::after {
  left: 100%;
}

/* Active/focus bar */
#sidebar a.active::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, #22c55e, #3b82f6);
  border-radius: 2px;
  opacity: 1;
  box-shadow: 0 0 10px #22c55e;
  z-index: 3;
}

/* Focus */
#sidebar a:focus {
  outline: none;
  background: linear-gradient(135deg, #16a34a, #22c55e);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
}

/* ================= OVERLAY ================= */
#overlay {
  position: fixed;
  top: 56px;
  left: 0;
  width: 100%;
  height: calc(100% - 56px);
  background: linear-gradient(135deg, rgba(0,0,0,0.7), rgba(0,0,0,0.85));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 1000;
  backdrop-filter: blur(3px);
}

#overlay.show {
  opacity: 1;
  pointer-events: all;
}

/* ================= CONTENT ================= */
#content {
  margin-top: 70px;
  padding: 24px;
  animation: none;
}

/* Fade animation */
.fade {
  animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* تأثير إضافي للقائمة عند الفتح */
@keyframes slideInItem {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

#sidebar.open a {
  animation: slideInItem 0.5s ease forwards;
}

#sidebar.open a:nth-child(1) { animation-delay: 0.1s; }
#sidebar.open a:nth-child(2) { animation-delay: 0.2s; }
#sidebar.open a:nth-child(3) { animation-delay: 0.3s; }
#sidebar.open a:nth-child(4) { animation-delay: 0.4s; }
#sidebar.open a:nth-child(5) { animation-delay: 0.5s; }
#sidebar.open a:nth-child(6) { animation-delay: 0.6s; }

/* ================= RESPONSIVE ================= */
@media (max-width: 768px) {
  #sidebar {
    width: 220px;
  }

  #page-title {
    font-size: 16px;
  }
  
  #sidebar a:hover {
    transform: translateX(4px) scale(1.02);
  }
}