/* ============================================
   Sidebar Navigation
   ============================================ */

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: var(--color-sidebar-bg);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-brand {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.sidebar-brand-logo {
  max-width: 100%;
  max-height: 36px;
  flex-shrink: 0;
}

.sidebar-default-logo {
  width: 120px;
  height: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 80'%3E%3Crect width='300' height='80' rx='8' fill='black'/%3E%3Ctext x='150' y='55' font-size='42' font-weight='bold' fill='white' text-anchor='middle' font-family='Arial,sans-serif'%3EManabu%3C/text%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

.sidebar-custom-logo {
  max-height: 36px;
  width: auto;
  object-fit: contain;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3) 0;
}

.sidebar-section {
  padding: 0 var(--space-3);
  margin-bottom: var(--space-2);
}

.sidebar-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-text-muted);
  padding: var(--space-2) var(--space-3) var(--space-1);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-2-5);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  cursor: pointer;
  text-decoration: none;
  width: 100%;
  text-align: left;
}

.sidebar-item:hover {
  background: var(--color-sidebar-hover);
  color: var(--color-text);
  text-decoration: none;
}

.sidebar-item.active {
  background: var(--color-sidebar-active);
  color: var(--color-text);
  font-weight: 600;
}

.sidebar-item-icon {
  width: 20px;
  text-align: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: var(--space-3);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

/* Collapsible parent/child groups */
.sidebar-group {}

.sidebar-parent-row {
  display: flex;
  align-items: center;
  border-radius: var(--radius);
  transition: all var(--transition-fast);
}

.sidebar-parent-row:hover {
  background: var(--color-sidebar-hover);
}

.sidebar-parent-row .sidebar-item {
  flex: 1;
  min-width: 0;
}

.sidebar-parent-row .sidebar-item:hover {
  background: transparent;
}

.sidebar-parent-row:has(.sidebar-item.active) {
  background: var(--color-sidebar-active);
}

.sidebar-parent-row .sidebar-item.active {
  background: transparent;
}

.sidebar-expand-toggle {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-right: var(--space-1);
}

.sidebar-expand-toggle:hover {
  background: var(--color-sidebar-hover);
  color: var(--color-text);
}

.sidebar-expand-toggle svg {
  transition: transform 0.2s ease;
}

.sidebar-group.expanded .sidebar-expand-toggle svg {
  transform: rotate(180deg);
}

.sidebar-children {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.sidebar-group.expanded .sidebar-children {
  max-height: 200px;
}

/* Child items */
.sidebar-child {
  padding-left: var(--space-6);
  font-size: 0.85rem;
}

/* Sidebar collapse (learner dashboard) */
.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
  position: fixed;
  z-index: 100;
  height: 100vh;
  transition: transform 0.3s ease;
}

.sidebar-collapsed .sidebar.open {
  transform: translateX(0);
  box-shadow: var(--shadow-lg);
}

.sidebar-reveal {
  position: fixed;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #ffffff;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition), box-shadow var(--transition);
}

.sidebar-reveal svg {
  animation: arrowBounce 1.5s ease-in-out infinite;
}

.sidebar-reveal:hover {
  transform: translateY(-50%) scale(1.1);
  box-shadow: var(--shadow-lg);
}

@keyframes arrowBounce {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(3px); }
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.08);
  z-index: 99;
  animation: overlay-fade-in 0.2s ease;
}

@keyframes overlay-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Sidebar toggle (hamburger) */
.sidebar-toggle {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  flex-shrink: 0;
}

.sidebar-toggle:hover { background: var(--color-accent-light); }

/* Show hamburger when sidebar is collapsed (learner dashboard) */
.sidebar-collapsed .sidebar-toggle { display: flex; }

@media (max-width: 768px) {
  .sidebar-toggle { display: flex; }
  .sidebar { display: none; }
  .sidebar.open { display: flex; position: fixed; z-index: 100; height: 100vh; }
}
