/* תפריט ניווט ימני - ממשק LibreChat */

:root {
  --nav-sidebar-width: 260px;
  --nav-sidebar-collapsed-width: 80px;
  --brand-dark: #16213f;
  --brand-medium: #25408f;
  --brand-light: #7dd2ef;
}

/* קונטיינר ראשי לתפריט הניווט */
.nav-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--nav-sidebar-width);
  height: 100vh;
  background-color: var(--brand-dark);
  color: white;
  display: flex;
  flex-direction: column;
  z-index: 45; /* נמוך יותר מ-z-50 של LibreChat כדי שמודלים יופיעו מעל */
  transition: width 0.3s ease, transform 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
}

/* מצב מכווץ */
.nav-sidebar.collapsed {
  width: var(--nav-sidebar-collapsed-width);
}

/* הסתרת טקסטים במצב מכווץ */
.nav-sidebar.collapsed .nav-sidebar-logo span,
.nav-sidebar.collapsed .nav-sidebar-user-info,
.nav-sidebar.collapsed .nav-sidebar-item span,
.nav-sidebar.collapsed .nav-sidebar-parent-link span {
  display: none;
}

/* כותרת התפריט עם לוגו */
.nav-sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(125, 210, 239, 0.2);
}

.nav-sidebar.collapsed .nav-sidebar-header {
  padding: 1rem 0;
  display: flex;
  justify-content: center;
}

.nav-sidebar-logo {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--brand-light);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.2s;
}

.nav-sidebar-logo:hover {
  color: white;
}

.nav-sidebar-logo img {
  width: 24px;
  height: 24px;
}

.nav-sidebar.collapsed .nav-sidebar-logo {
  justify-content: center;
}

.nav-sidebar.collapsed .nav-sidebar-logo img {
  height: 45px;
  max-width: 60px;
  margin: 0 auto;
}

/* מידע משתמש */
.nav-sidebar-user {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(125, 210, 239, 0.2);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-sidebar.collapsed .nav-sidebar-user {
  justify-content: center;
  padding: 1rem 0.5rem;
}

.nav-sidebar-user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--brand-light);
  flex-shrink: 0;
  background: var(--brand-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
}

.nav-sidebar.collapsed .nav-sidebar-user-avatar {
  width: 40px;
  height: 40px;
  margin: 0 auto;
}

.nav-sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.nav-sidebar-user-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--brand-light);
}

.nav-sidebar-user-role {
  font-size: 0.75rem;
  color: var(--brand-light);
  opacity: 0.7;
}

/* תפריט ניווט */
.nav-sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* פריט תפריט */
.nav-sidebar-item {
  display: block;
  padding: 0.75rem 1.5rem;
  color: var(--brand-light);
  text-decoration: none;
  transition: all 0.2s;
  border-right: 3px solid transparent;
  opacity: 0.85;
  cursor: pointer;
  position: relative;
}

.nav-sidebar-item:hover {
  background-color: rgba(125, 210, 239, 0.1);
  color: white;
  opacity: 1;
}

.nav-sidebar-item.active {
  background-color: rgba(125, 210, 239, 0.15);
  color: white;
  border-right-color: var(--brand-light);
  opacity: 1;
  font-weight: 500;
}

.nav-sidebar-item i {
  margin-left: 0.75rem;
  width: 1.25rem;
  text-align: center;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.nav-sidebar.collapsed .nav-sidebar-item {
  padding: 0.875rem 0;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  border-right: none;
}

.nav-sidebar.collapsed .nav-sidebar-item i {
  margin: 0;
  font-size: 1.25rem;
}

/* תפריט הורה עם תת-פריטים */
.nav-sidebar-parent {
  display: block;
  background-color: transparent;
  border-right: 3px solid transparent;
  transition: all 0.2s;
  position: relative;
  padding: 0 !important;
}

.nav-sidebar-parent.active {
  background-color: rgba(125, 210, 239, 0.15);
  border-right-color: var(--brand-light);
}

.nav-sidebar-parent-header {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  padding-left: 2.5rem;
  cursor: pointer;
  transition: all 0.2s;
  opacity: 0.85;
  position: relative;
}

.nav-sidebar-parent-header:hover {
  background-color: rgba(125, 210, 239, 0.1);
  opacity: 1;
}

.nav-sidebar-parent.active .nav-sidebar-parent-header {
  opacity: 1;
}

.nav-sidebar-parent-link {
  display: flex;
  align-items: center;
  color: var(--brand-light);
  text-decoration: none;
  padding: 0;
  min-width: 0;
  flex: 1;
}

.nav-sidebar-parent-link i {
  margin-left: 0.75rem;
  width: 1.25rem;
  text-align: center;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

.nav-sidebar-parent-link span {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

span.nav-sidebar-parent-link {
  cursor: default;
}

.nav-sidebar-toggle-btn {
  background: none;
  border: none;
  color: var(--brand-light);
  cursor: pointer;
  padding: 0;
  border-radius: 0.375rem;
  transition: all 0.2s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  position: absolute;
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
}

.nav-sidebar-toggle-btn:hover {
  background-color: rgba(125, 210, 239, 0.2);
  border-radius: 0.375rem;
}

.nav-sidebar-toggle-btn i {
  font-size: 0.75rem;
  transition: transform 0.3s ease;
}

.nav-sidebar-parent.expanded .nav-sidebar-toggle-btn i {
  transform: rotate(180deg);
}

/* תת-תפריט */
.nav-sidebar-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background-color: rgba(0, 0, 0, 0.1);
}

.nav-sidebar-parent.expanded .nav-sidebar-submenu {
  max-height: 500px;
}

.nav-sidebar-subitem {
  display: block;
  padding: 0.625rem 1.5rem 0.625rem 3rem;
  color: var(--brand-light);
  text-decoration: none;
  transition: all 0.2s;
  border-right: 3px solid transparent;
  opacity: 0.8;
  font-size: 0.9375rem;
  cursor: pointer;
}

.nav-sidebar-subitem:hover {
  background-color: rgba(125, 210, 239, 0.15);
  opacity: 1;
}

.nav-sidebar-subitem.active {
  background-color: rgba(125, 210, 239, 0.2);
  border-right-color: var(--brand-light);
  opacity: 1;
  font-weight: 500;
}

.nav-sidebar-subitem i {
  margin-left: 0.5rem;
  width: 1rem;
  font-size: 0.875rem;
  text-align: center;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

/* מצב מכווץ - תפריט הורה */
.nav-sidebar.collapsed .nav-sidebar-parent {
  border-right: none;
}

.nav-sidebar.collapsed .nav-sidebar-parent-header {
  padding: 0.875rem 0;
  justify-content: center;
  display: flex;
}

.nav-sidebar.collapsed a.nav-sidebar-parent-link,
.nav-sidebar.collapsed span.nav-sidebar-parent-link {
  justify-content: center;
  padding: 0;
  flex: 0;
  display: flex !important;
  align-items: center;
}

.nav-sidebar.collapsed .nav-sidebar-toggle-btn {
  display: none;
}

.nav-sidebar.collapsed .nav-sidebar-submenu {
  display: none;
}

.nav-sidebar.collapsed .nav-sidebar-parent-link > span {
  display: none !important;
}

.nav-sidebar.collapsed .nav-sidebar-parent-link i {
  margin: 0;
  font-size: 1.25rem;
  display: inline-flex !important;
}

/* קו הפרדה */
.nav-sidebar-divider {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 1rem 0;
}

.nav-sidebar.collapsed .nav-sidebar-divider {
  margin: 0.5rem 0;
  border-top: none !important;
}

/* כפתור כיווץ/הרחבה */
.nav-sidebar-collapse-btn {
  position: fixed;
  right: calc(var(--nav-sidebar-width) - 12px);
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-medium);
  border: 2px solid var(--brand-light);
  color: var(--brand-light);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 46; /* מעל הסיידבר אבל מתחת למודלים של LibreChat */
  font-size: 0.85rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.nav-sidebar-collapse-btn:hover {
  background: var(--brand-light);
  border-color: var(--brand-light);
  color: var(--brand-dark);
  transform: translateY(-50%) scale(1.15);
  box-shadow: 0 4px 12px rgba(125, 210, 239, 0.4);
}

.nav-sidebar.collapsed ~ .nav-sidebar-collapse-btn {
  right: calc(var(--nav-sidebar-collapsed-width) - 12px);
}

.nav-sidebar.collapsed ~ .nav-sidebar-collapse-btn i {
  transform: rotate(180deg);
}

/* Tooltips במצב מכווץ */
.nav-sidebar.collapsed .nav-sidebar-item::after,
.nav-sidebar.collapsed .nav-sidebar-parent::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  background: var(--brand-medium);
  color: var(--brand-light);
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  margin-right: 0.5rem;
  z-index: 47; /* מעט מעל כפתור הכיווץ */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.nav-sidebar.collapsed .nav-sidebar-item:hover::after,
.nav-sidebar.collapsed .nav-sidebar-parent:hover::after {
  opacity: 1;
}

/* התאמה למסכים קטנים */
@media (max-width: 768px) {
  .nav-sidebar {
    transform: translateX(100%);
  }
  
  .nav-sidebar.mobile-open {
    transform: translateX(0);
  }
  
  .nav-sidebar-collapse-btn {
    display: none;
  }
}

/* דחיפת הממשק הכולל של LibreChat - כל התוכן */
body:has(.nav-sidebar) {
  padding-right: var(--nav-sidebar-width) !important;
  transition: padding-right 0.3s ease !important;
}

body:has(.nav-sidebar.collapsed) {
  padding-right: var(--nav-sidebar-collapsed-width) !important;
}

/* דחיפת הסיידבר של LibreChat */
body:has(.nav-sidebar) [data-testid="nav"] {
  margin-right: 0 !important;
  transition: margin-right 0.3s ease !important;
}

body:has(.nav-sidebar.collapsed) [data-testid="nav"] {
  margin-right: 0 !important;
}

/* גלילה חלקה */
.nav-sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.nav-sidebar-nav::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

.nav-sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(125, 210, 239, 0.3);
  border-radius: 3px;
}

.nav-sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(125, 210, 239, 0.5);
}

/* שינוי רקע סיידבר היסטוריית השיחות של LibreChat */
[data-testid="nav"] {
  background-color: rgba(125, 210, 239, 0.7) !important; /* #7dd2ef עם 70% שקיפות */
}

/* התאמת צבעי טקסט ואלמנטים בסיידבר */
[data-testid="nav"] * {
  color: #16213f !important;
}

/* מיכל שדה החיפוש - עיצוב מינימליסטי */
[data-testid="nav"] .group.relative.mt-1 {
  background-color: rgba(255, 255, 255, 0.95) !important;
  border: 1.5px solid rgba(22, 33, 63, 0.3) !important;
  border-radius: 0.5rem !important;
  padding: 0.5rem 0.75rem !important;
  transition: all 0.25s ease !important;
}

[data-testid="nav"] .group.relative.mt-1:hover {
  border-color: #16213f !important;
  background-color: rgba(255, 255, 255, 1) !important;
  box-shadow: 0 2px 8px rgba(22, 33, 63, 0.15) !important;
}

[data-testid="nav"] .group.relative.mt-1:focus-within {
  border-color: #25408f !important;
  background-color: rgba(255, 255, 255, 1) !important;
  box-shadow: 0 2px 12px rgba(37, 64, 143, 0.2) !important;
}

/* שדה חיפוש */
[data-testid="nav"] input {
  background-color: transparent !important;
  color: #16213f !important;
}

[data-testid="nav"] input::placeholder {
  color: rgba(22, 33, 63, 0.6) !important;
}

/* אייקון חיפוש */
[data-testid="nav"] .lucide-search {
  color: rgba(22, 33, 63, 0.6) !important;
  stroke: rgba(22, 33, 63, 0.6) !important;
}

[data-testid="nav"] .group:hover .lucide-search,
[data-testid="nav"] .group:focus-within .lucide-search {
  color: #16213f !important;
  stroke: #16213f !important;
}

/* כפתור משתמש */
[data-testid="nav"] button[data-testid="nav-user"] {
  background-color: rgba(255, 255, 255, 0.2) !important;
}

[data-testid="nav"] button[data-testid="nav-user"]:hover {
  background-color: rgba(255, 255, 255, 0.3) !important;
}

/* פריטי שיחות */
[data-testid="nav"] a,
[data-testid="nav"] button {
  color: #16213f !important;
}

[data-testid="nav"] a:hover,
[data-testid="nav"] button:hover {
  background-color: rgba(255, 255, 255, 0.3) !important;
}

