/**
 * Sidebar Navigation Styles
 * Collapsible sidebar with categorized navigation
 */

/* ========================================
   SIDEBAR CONTAINER
   ======================================== */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 240px;
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
  border-right: 2px solid #00d4ff;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease, transform 0.3s ease;
  box-shadow: 4px 0 20px rgba(0, 212, 255, 0.15);
  overflow: hidden;
  pointer-events: auto;
}

.sidebar.collapsed {
  width: 56px;
}

.sidebar.collapsed .nav-label,
.sidebar.collapsed .category-label,
.sidebar.collapsed .badge,
.sidebar.collapsed .sidebar-footer-stats {
  opacity: 0;
  visibility: hidden;
}

.sidebar.collapsed .category-header {
  justify-content: center;
  padding: 10px 0;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 10px 0;
}

.sidebar.collapsed .category-items {
  display: none;
}

/* ========================================
   SIDEBAR TOGGLE BUTTON
   ======================================== */

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 50px;
  background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
  border: none;
  color: #0a0a0a;
  font-size: 1.4rem;
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: linear-gradient(135deg, #33ddff 0%, #00bbee 100%);
}

.sidebar-toggle .toggle-icon {
  transition: transform 0.3s ease;
}

.sidebar.collapsed .sidebar-toggle .toggle-icon {
  transform: rotate(180deg);
}

/* ========================================
   SIDEBAR CONTENT
   ======================================== */

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
}

.sidebar-content::-webkit-scrollbar {
  width: 4px;
}

.sidebar-content::-webkit-scrollbar-track {
  background: #0f0f23;
}

.sidebar-content::-webkit-scrollbar-thumb {
  background: #00d4ff;
  border-radius: 2px;
}

/* ========================================
   CATEGORY SECTIONS
   ======================================== */

.sidebar-category {
  margin-bottom: 4px;
}

.sidebar-category.hidden {
  display: none;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  background: rgba(0, 212, 255, 0.08);
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
  user-select: none;
}

.category-header:hover {
  background: rgba(0, 212, 255, 0.15);
  border-left-color: #00d4ff;
}

.category-header.expanded {
  background: rgba(0, 212, 255, 0.12);
  border-left-color: #00d4ff;
}

.category-icon {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.category-label {
  flex: 1;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #00d4ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-arrow {
  font-size: 0.7rem;
  color: #666;
  transition: transform 0.2s ease;
}

.category-header.expanded .category-arrow {
  transform: rotate(90deg);
}

/* ========================================
   CATEGORY ITEMS
   ======================================== */

.category-items {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: rgba(0, 0, 0, 0.2);
}

.category-header.expanded + .category-items {
  max-height: 500px;
}

/* ========================================
   NAVIGATION ITEMS
   ======================================== */

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 10px 24px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
  position: relative;
}

.nav-item:hover {
  background: rgba(0, 212, 255, 0.1);
  border-left-color: #00a8cc;
}

.nav-item.active {
  background: rgba(0, 212, 255, 0.2);
  border-left-color: #00d4ff;
}

.nav-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.nav-item.hidden {
  display: none;
}

.nav-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.nav-label {
  flex: 1;
  font-size: 0.9rem;
  color: #e0e0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item:hover .nav-label {
  color: #fff;
}

.nav-item.active .nav-label {
  color: #00d4ff;
  font-weight: 600;
}

/* ========================================
   BADGES
   ======================================== */

.badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #ff4757;
  border-radius: 9px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.badge.success {
  background: #2ed573;
}

.badge.warning {
  background: #ffa502;
}

.badge.info {
  background: #00d4ff;
  color: #0a0a0a;
}

.badge:empty {
  display: none;
}

/* ========================================
   SIDEBAR FOOTER
   ======================================== */

.sidebar-footer {
  flex-shrink: 0;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid rgba(0, 212, 255, 0.2);
}

.sidebar-footer-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.75rem;
}

.footer-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #888;
}

.footer-stat-icon {
  font-size: 0.9rem;
}

.footer-stat-value {
  color: #00d4ff;
  font-weight: 600;
}

.sidebar.collapsed .sidebar-footer {
  padding: 8px;
}

.sidebar.collapsed .footer-stat {
  justify-content: center;
}

.sidebar.collapsed .footer-stat-value {
  display: none;
}

/* ========================================
   CATEGORY COLORS
   ======================================== */

/* Progression - Gold */
.sidebar-category[data-category="progression"] .category-label {
  color: #ffd700;
}
.sidebar-category[data-category="progression"] .category-header:hover,
.sidebar-category[data-category="progression"] .category-header.expanded {
  border-left-color: #ffd700;
}

/* Research - Blue */
.sidebar-category[data-category="research"] .category-label {
  color: #00d4ff;
}

/* Goals - Green */
.sidebar-category[data-category="goals"] .category-label {
  color: #2ed573;
}
.sidebar-category[data-category="goals"] .category-header:hover,
.sidebar-category[data-category="goals"] .category-header.expanded {
  border-left-color: #2ed573;
}

/* Advanced - Purple */
.sidebar-category[data-category="advanced"] .category-label {
  color: #a855f7;
}
.sidebar-category[data-category="advanced"] .category-header:hover,
.sidebar-category[data-category="advanced"] .category-header.expanded {
  border-left-color: #a855f7;
}

/* Endgame - Red/Dark */
.sidebar-category[data-category="endgame"] .category-label {
  color: #ff4757;
}
.sidebar-category[data-category="endgame"] .category-header:hover,
.sidebar-category[data-category="endgame"] .category-header.expanded {
  border-left-color: #ff4757;
}

/* Menu - Gray */
.sidebar-category[data-category="menu"] .category-label {
  color: #888;
}
.sidebar-category[data-category="menu"] .category-header:hover,
.sidebar-category[data-category="menu"] .category-header.expanded {
  border-left-color: #888;
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar.collapsed {
    width: 280px;
    transform: translateX(-100%);
  }

  .sidebar.collapsed.mobile-open {
    transform: translateX(0);
  }

  .mobile-sidebar-toggle {
    display: flex;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 999;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    border: none;
    border-radius: 8px;
    color: #0a0a0a;
    font-size: 1.4rem;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 212, 255, 0.3);
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
  }

  .sidebar-backdrop.visible {
    display: block;
  }
}

@media (min-width: 769px) {
  .mobile-sidebar-toggle,
  .sidebar-backdrop {
    display: none !important;
  }
}

/* ========================================
   LAYOUT ADJUSTMENTS
   ======================================== */

body.sidebar-active #ui-overlay {
  margin-left: 240px;
  width: calc(100% - 240px);
  transition: margin-left 0.3s ease, width 0.3s ease;
}

body.sidebar-active.sidebar-collapsed #ui-overlay {
  margin-left: 56px;
  width: calc(100% - 56px);
}

@media (max-width: 768px) {
  body.sidebar-active #ui-overlay,
  body.sidebar-active.sidebar-collapsed #ui-overlay {
    margin-left: 0;
    width: 100%;
  }
}

/* ========================================
   TOOLTIP FOR COLLAPSED STATE
   ======================================== */

.sidebar.collapsed .nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  background: #1a1a2e;
  border: 1px solid #00d4ff;
  color: #fff;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.85rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
  z-index: 1001;
  margin-left: 8px;
}

.sidebar.collapsed .nav-item:hover::after {
  opacity: 1;
  visibility: visible;
}

.sidebar.collapsed .category-header::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  background: #1a1a2e;
  border: 1px solid #00d4ff;
  color: #00d4ff;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
  z-index: 1001;
  margin-left: 8px;
}

.sidebar.collapsed .category-header {
  position: relative;
}

.sidebar.collapsed .category-header:hover::after {
  opacity: 1;
  visibility: visible;
}

/* ========================================
   NEW/HIGHLIGHT INDICATOR
   ======================================== */

.nav-item.new::before {
  content: '';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: #ff4757;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}

/* ========================================
   QUICK ACTION BAR (optional future feature)
   ======================================== */

.sidebar-quick-actions {
  display: flex;
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid rgba(0, 212, 255, 0.1);
  flex-shrink: 0;
}

.quick-action-btn {
  flex: 1;
  padding: 8px;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 4px;
  color: #00d4ff;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quick-action-btn:hover {
  background: rgba(0, 212, 255, 0.2);
  border-color: #00d4ff;
}

.sidebar.collapsed .sidebar-quick-actions {
  flex-direction: column;
}
