/* Sidebar Navigation Styles - shadcN UI inspired */

:root {
  --sidebar-width: 240px;
  --sidebar-width-collapsed: 60px;
  --sidebar-bg: white;
  --sidebar-hover: rgba(0, 113, 227, 0.05);
  --sidebar-active: rgba(0, 113, 227, 0.1);
  --sidebar-text: #1d1d1f;
  --sidebar-muted: #6e6e73;
  --sidebar-accent: #0071e3;
  --sidebar-border: #d2d2d7;
  --sidebar-shadow: rgba(0, 0, 0, 0.08);
}

/* Sidebar Container */
.sidebar {
  position: fixed;
  width: var(--sidebar-width);
  height: 60vh; /* Reduced height */
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--sidebar-bg);
  border-radius: 12px;
  border: 1px solid var(--sidebar-border);
  overflow-y: hidden;
  overflow-x: hidden;
  transition: all 0.3s ease;
  z-index: 50;
  padding-top: 20px; /* Reduced top padding */
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
  margin-left: 16px; /* Give some space from the edge */
}

/* Responsive Sidebar Height - Mobile */
@media (max-width: 768px) {
  .sidebar {
    height: 40vh; /* Reduced height for mobile */
    top: auto;
    bottom: 20px; /* Pin it near the bottom if desired */
    transform: none; /* Remove vertical centering */
  }
}


/* Push main content to make room for sidebar - Mobile only */
@media (max-width: 768px) {
  .sidebar-active .main-content {
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    
  }
}

/* Style Feather icons */
.sidebar-nav-icon svg,
.sidebar-footer-nav-icon svg,
.sidebar-toggle svg {
  stroke-width: 1.5;
  width: 18px;
  height: 18px;
  color: var(--sidebar-text);
}

/* Align icons when sidebar is not hovered (collapsed) */
@media (min-width: 769px) {
  .sidebar:not(:hover) .sidebar-nav-link,
  .sidebar:not(:hover) .sidebar-footer-nav-link {
    justify-content: center;
    padding: 10px 0;
  }

  .sidebar:not(:hover) .sidebar-nav-icon,
  .sidebar:not(:hover) .sidebar-footer-nav-icon {
    margin-right: 0;
  }
}

/* Add hover functionality for sidebar */
.sidebar {
  /* Existing styles plus: */
  transition: width 0.3s ease;
}

/* Collapse sidebar by default on desktop */
@media (min-width: 769px) {
  .sidebar:not(:hover) {
    width: var(--sidebar-width-collapsed);
  }
  
  .sidebar:not(:hover) .sidebar-nav-text,
  .sidebar:not(:hover) .sidebar-footer-nav-text {
    display: none;
  }
  
  /* Main content margin when sidebar is hovered/expanded */
  .sidebar-active.sidebar-hovered .main-content {
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
  }
  
  /* Main content margin when sidebar is not hovered/collapsed */
  .sidebar-active:not(.sidebar-hovered) .main-content {
    margin-left: var(--sidebar-width-collapsed);
    transition: margin-left 0.3s ease;
  }
}

/* Navigation Menu */
.sidebar-nav {
  list-style: none;
  padding: 12px 0 0 0; /* Add some top padding since we removed the header */
  margin: 0;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px); /* Leave room for footer */
}

.sidebar-nav-item {
  margin: 1px 8px;
  border-radius: 6px;
  overflow: hidden;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-weight: 500;
  transition: background-color 0.2s ease, color 0.2s ease;
  font-size: 13px;
  border-radius: 6px;
}

.sidebar-nav-link:hover {
  background-color: var(--sidebar-hover);
}

.sidebar-nav-link.active {
  background-color: var(--sidebar-active);
  color: var(--sidebar-accent);
}

.sidebar-nav-icon {
  margin-right: 12px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
  font-size: 18px;
}

.sidebar-nav-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Footer for FAQ and Privacy links */
.sidebar-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 8px 16px 8px;
  border-top: 1px solid rgba(210, 210, 215, 0.3);
  background-color: var(--sidebar-bg);
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

.sidebar-footer-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-footer-nav-item {
  margin: 1px 8px;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  justify-content: center;
}

.sidebar-footer-nav-link {
  display: flex;
  align-items: center;
  justify-content: center; /* Center the icons when collapsed */
  padding: 8px 12px;
  color: var(--sidebar-muted);
  text-decoration: none;
  font-weight: 400;
  transition: background-color 0.2s ease, color 0.2s ease;
  font-size: 12px;
  border-radius: 6px;
}

.sidebar-footer-nav-link:hover {
  background-color: var(--sidebar-hover);
  color: var(--sidebar-text);
}

.sidebar-footer-nav-icon {
  margin-right: 12px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  font-size: 16px;
}

.sidebar-footer-nav-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Special styles for the Upgrade link - just icon color */
.sidebar-nav-link.upgrade .sidebar-nav-icon {
  color: var(--sidebar-accent);
}

/* Sidebar Toggle for mobile */
.sidebar-toggle {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 100;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background-color: var(--sidebar-bg);
  border: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: none; /* Hidden by default on desktop */
}

/* Mobile styles */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(calc(-100% - 16px)); /* Account for margin */
    height: 90vh; /* Taller on mobile */
    top: 5vh; /* Position near the top on mobile */
    transform-origin: left center;
    margin-left: 0; /* Reset margin */
  }
  
  .sidebar.open {
    transform: translateX(0);
    width: var(--sidebar-width) !important; /* Always full width on mobile */
  }
  
  .sidebar.open .sidebar-nav-text,
  .sidebar.open .sidebar-footer-nav-text {
    display: block !important; /* Always show text on mobile when open */
  }
  
  .sidebar-active .main-content {
    margin-left: 0;
  }
  
  .sidebar-toggle {
    display: flex;
    top: 5vh; /* Align with top of sidebar */
  }
  
  .sidebar-footer {
    border-top: 1px solid rgba(210, 210, 215, 0.3);
    padding-bottom: 16px;
  }
  
  /* Add overlay when sidebar is open on mobile */
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }
  
  .sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
  }
}
