/* ==========================================================================
   navbar-sidebar.css - القائمة الجانبية والشريط العلوي للمنظومة
   مؤسسة اللؤلؤة العقارية - PEARL REAL ESTATE
   ========================================================================== */

/* تخطيط التطبيق الكامل */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* القائمة الجانبية (Sidebar) */
.sidebar {
  width: 275px;
  background: linear-gradient(180deg, #3d050d 0%, #500a16 35%, #680e1e 70%, #7b1123 100%);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  z-index: 100;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.25);
  transition: transform var(--transition-smooth), width var(--transition-smooth);
  overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.sidebar-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: rgba(0, 0, 0, 0.2);
}

.brand-logo-container {
  width: 100%;
  max-width: 230px;
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 4px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  border: 1.5px solid rgba(226, 149, 120, 0.6);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: all var(--transition-fast);
  cursor: pointer;
}
.brand-logo-container:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  border-color: #e29578;
}

.brand-logo-img {
  width: 100%;
  height: 52px;
  object-fit: contain;
  background: #ffffff;
  padding: 2px 6px;
  border-radius: calc(var(--radius-md) - 3px);
  display: block;
}

.brand-subtitle {
  font-size: 0.78rem;
  color: var(--accent-gold-light);
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* روابط القائمة الجانبية */
.sidebar-nav {
  padding: 14px 12px 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-section-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 10px 12px 4px;
  margin-top: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: #f1f5f9;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  color: var(--accent-gold-light);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  transform: translateX(-3px);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(229, 184, 146, 0.25) 0%, rgba(255, 255, 255, 0.15) 100%);
  color: #ffffff;
  border-color: rgba(229, 184, 146, 0.4);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  font-weight: 800;
}

.nav-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.nav-badge.badge-urgent {
  background: #ef4444;
  color: #ffffff;
  animation: pulseBadge 2s infinite;
}

/* فوتر القائمة الجانبية (معلومات المستخدم) */
.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-mini-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-role {
  font-size: 0.72rem;
  color: var(--accent-gold-light);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.btn-logout {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-logout:hover {
  background: #ef4444;
  border-color: #ef4444;
  transform: scale(1.05);
}

/* ================== الشريط العلوي (Navbar) ================== */
.main-wrapper {
  flex: 1;
  margin-right: 275px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-right var(--transition-smooth);
}

.navbar {
  height: 68px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.menu-toggle-btn {
  display: none;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
}

.global-search-box {
  position: relative;
  width: 320px;
}

.global-search-box input {
  width: 100%;
  padding: 9px 38px 9px 14px;
  background: var(--bg-subtle);
  border: 1.5px solid transparent;
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-size: 0.85rem;
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
}

.global-search-box input:focus {
  background: #ffffff;
  border-color: var(--primary-burgundy);
  box-shadow: 0 0 0 3px var(--primary-burgundy-soft);
  width: 380px;
}

.search-icon-pos {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
}

/* أزرار التنقل الموحد بين البوابات */
.hub-switch-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-hub-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.btn-hub-home {
  background: rgba(123, 17, 35, 0.08);
  color: var(--primary-burgundy);
  border: 1px solid rgba(123, 17, 35, 0.2);
}
.btn-hub-home:hover {
  background: var(--primary-burgundy);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-hub-lawyer {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #f8fafc;
  border: 1px solid rgba(197, 141, 96, 0.4);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);
}
.btn-hub-lawyer:hover {
  background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
  color: var(--accent-gold-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(197, 141, 96, 0.25);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* جرس التنبيهات */
.notifications-trigger {
  position: relative;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.notifications-trigger:hover {
  background: var(--primary-burgundy-soft);
  color: var(--primary-burgundy);
  border-color: var(--primary-burgundy);
}

.notification-count {
  position: absolute;
  top: -4px;
  left: -4px;
  background: #ef4444;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

/* القائمة المنسدلة للتنبيهات */
.notifications-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 360px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.15);
  display: none;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
  animation: slideToast 0.25s ease;
}

.notifications-dropdown.active {
  display: flex;
}

.notifications-header {
  padding: 14px 16px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notifications-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.notifications-list {
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.notification-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.notification-item:hover {
  background: var(--bg-subtle);
}

.notification-item-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.notification-item-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}

.notification-item-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ================== استجابة الشاشات (Responsive) ================== */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(100%);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-right: 0;
  }
  .menu-toggle-btn {
    display: flex;
  }
  .global-search-box {
    width: 200px;
  }
  .global-search-box input:focus {
    width: 240px;
  }
}

@media (max-width: 640px) {
  .navbar {
    padding: 0 12px;
  }
  .global-search-box {
    display: none;
  }
  .hub-switch-group {
    display: none;
  }
  .notifications-dropdown {
    left: 10px;
    right: 10px;
    width: auto;
  }
}
