/* ============================================
   Spec Viewer Side Menu Styles - Specifys.ai
   ============================================
   Side menu navigation styles for spec-viewer.html
   Extracted from main-compiled.css.backup.old
*/

/* Side Menu Container */
.side-menu {
  position: fixed;
  left: 0;
  top: 60px; /* Header height */
  bottom: 0;
  width: 60px;
  background: #f5f5f5;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

/* Menu floats over content - doesn't push it */
.side-menu:hover {
  width: 280px;
  z-index: 101; /* Higher z-index when expanded to float over content */
}

.side-menu:hover {
  width: 280px;
}

/* User Section */
.side-menu-user {
  padding: 16px 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #e0e0e0;
  min-height: 60px;
}

.side-menu-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #FF6B35;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 18px;
  flex-shrink: 0;
}

.side-menu-user-name {
  font-weight: 600;
  color: #333;
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.side-menu:hover .side-menu-user-name {
  opacity: 1;
  max-width: 200px;
}

.side-menu-divider {
  height: 1px;
  background: #e0e0e0;
  margin: 8px 0;
}

/* Search Box */
.side-menu-search {
  padding: 8px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.side-menu-search-input {
  width: 100%;
  padding: 8px 32px 8px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--font-primary, "Inter", sans-serif);
  background: white;
  color: #333;
  transition: all 0.3s ease;
  opacity: 0;
  max-width: 0;
  overflow: hidden;
}

.side-menu:hover .side-menu-search-input {
  opacity: 1;
  max-width: 100%;
}

.side-menu-search-input:focus {
  outline: none;
  border-color: #FF6B35;
  box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.1);
}

.side-menu-search-icon {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: #666;
  font-size: 16px;
  pointer-events: none;
  opacity: 1;
  transition: all 0.3s ease;
}

.side-menu:hover .side-menu-search-icon {
  left: auto;
  right: 16px;
  transform: none;
  font-size: 12px;
}

/* Navigation */
.side-menu-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.side-menu-item {
  margin-bottom: 4px;
  list-style: none;
}

.side-menu-button {
  width: 100%;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-family: var(--font-primary, "Inter", sans-serif);
  font-weight: 500;
  font-size: 15px;
  color: #666;
  position: relative;
  justify-content: flex-start;
  flex-wrap: nowrap;
  height: auto;
  min-height: 44px;
  box-sizing: border-box;
  text-align: left;
}

.side-menu-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.7);
  color: #333;
}

.side-menu-button.active {
  background: white;
  color: #333;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.side-menu-button.active i,
.side-menu-button.active .fa {
  color: #FF6B35;
}

/* Icon turns orange when spec is viewed/exists */
.side-menu-button.viewed i,
.side-menu-button.viewed .fa,
.side-menu-item.viewed .side-menu-button i,
.side-menu-item.viewed .side-menu-button .fa {
  color: #FF6B35;
}

.side-menu-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.side-menu-button i {
  font-size: 20px;
  flex-shrink: 0;
  min-width: 20px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  height: auto;
  position: relative;
}

.side-menu-notification-dot {
  position: absolute;
  top: 7px;
  left: 27px;
  width: 10px;
  height: 10px;
  background: #FF6B35;
  border-radius: 50%;
  border: 2px solid #f5f5f5;
  z-index: 10;
  flex-shrink: 0;
  pointer-events: none;
  display: none;
}

/* Generating state - blinking dot */
.side-menu-notification-dot.generating {
  display: block;
  animation: pulseBlink 1.5s ease-in-out infinite;
}

/* Notification state - solid dot (new/unread) */
.side-menu-notification-dot.notification {
  display: block;
  animation: none;
}

/* Chat notification - blinking orange dot */
.side-menu-notification-dot.chat-notification {
  display: block;
  animation: pulseBlink 1.5s ease-in-out infinite;
  background: #FF6B35;
}

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

@keyframes pulseBlink {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(0.9);
  }
}

.side-menu-text {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex: 1;
  text-align: left;
  white-space: nowrap;
  display: flex;
  align-items: center;
  line-height: 1.5;
  margin: 0;
  padding: 0;
  height: auto;
}

.side-menu:hover .side-menu-text {
  opacity: 1;
  max-width: 200px;
}

.side-menu-expand-sub {
  opacity: 0;
  width: 0;
  height: 0;
  overflow: hidden;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-left: auto;
  margin-right: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 0;
  min-height: 0;
  align-self: center;
  margin-top: 0;
  margin-bottom: 0;
  line-height: 1;
}

.side-menu:hover .side-menu-expand-sub {
  opacity: 1;
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
}

.side-menu-expand-sub:hover {
  opacity: 0.8;
}

.side-menu-expand-sub i {
  font-size: 12px;
  transition: transform 0.3s ease;
  color: #FF6B35;
  line-height: 1;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.side-menu-item:has(.side-menu-submenu.expanded) .side-menu-expand-sub i {
  transform: rotate(180deg);
}

/* Submenu */
.side-menu-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding-left: 44px;
  margin-top: 0;
}

.side-menu-submenu.expanded {
  max-height: 500px;
}

.side-menu-submenu .subsection-item {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  border-radius: 6px;
  font-size: 13px;
  color: #666;
  transition: all 0.2s ease;
  margin-bottom: 2px;
}

.side-menu-submenu .subsection-item:hover {
  background: rgba(255, 255, 255, 0.7);
  color: #333;
}

.side-menu-submenu .subsection-item.active {
  background: white;
  color: #FF6B35;
  font-weight: 500;
}

/* Content area adjustment for side menu */
/* On desktop, content should stay fixed - menu floats over it */
.content {
  flex: 1;
  min-width: 0;
  margin-left: 60px; /* Side menu collapsed width */
  transition: none; /* No transition - content stays fixed */
  position: relative;
  z-index: 1;
  width: calc(100% - 60px);
  max-width: calc(1200px - 60px);
  margin-right: auto;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Content should never move when menu expands - menu is overlay */
.side-menu:hover ~ .content,
.content.with-side-menu {
  margin-left: 60px; /* Keep same margin - menu floats over */
}

/* On mobile, content should never move - menu is overlay */
@media (max-width: 768px) {
  .content {
    margin-left: 0;
    width: 100%;
    max-width: 100vw;
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    overflow-x: hidden;
    min-width: 0;
    transition: none; /* No transition - content should never move */
    contain: layout; /* Isolate content to prevent layout shifts */
    isolation: isolate; /* Create new stacking context */
  }
  
  .side-menu:hover ~ .content,
  .content.with-side-menu,
  .side-menu.active ~ .content,
  .content.menu-open {
    margin-left: 0;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
    contain: layout; /* Ensure containment in all states */
    isolation: isolate; /* Maintain isolation */
  }
}

/* Mobile Toggle Button */
.side-menu-toggle-mobile {
  display: none;
}

/* Mobile responsive */
@media (max-width: 768px) {
  /* Toggle Button - Visible on mobile, stays fixed when scrolling */
  .side-menu-toggle-mobile {
    display: flex;
    position: fixed;
    left: 0;
    top: 60px;
    width: 44px;
    height: 44px;
    background: #FF6B35;
    color: white;
    border: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Stays in place when scrolling */
    will-change: transform;
  }
  
  .side-menu-toggle-mobile:hover {
    background: #FF8551;
  }
  
  .side-menu-toggle-mobile i {
    font-size: 18px;
    transition: transform 0.3s ease;
  }
  
  .side-menu-toggle-mobile[aria-expanded="true"] i {
    transform: rotate(180deg);
  }
  
  /* Side Menu - Collapsed by default on mobile */
  .side-menu {
    width: 0;
    overflow: hidden;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  /* Side Menu - Expanded when active */
  .side-menu.active {
    width: 280px;
    max-width: 85vw; /* Prevent overflow on very small screens */
    transform: translateX(0);
    z-index: 1000;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.2);
    overflow-x: hidden;
  }
  
  /* Show text labels when menu is active on mobile */
  .side-menu.active .side-menu-text {
    opacity: 1;
    max-width: 200px;
  }
  
  .side-menu.active .side-menu-user-name {
    opacity: 1;
    max-width: 200px;
  }
  
  .side-menu.active .side-menu-search-input {
    opacity: 1;
    max-width: 100%;
  }
  
  .side-menu.active .side-menu-search-icon {
    left: auto;
    right: 16px;
    transform: none;
    font-size: 12px;
  }
  
  .side-menu.active .side-menu-expand-sub {
    opacity: 1;
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
  }
  
  /* Disable hover effect on mobile - menu should only open via toggle button */
  .side-menu:hover {
    width: 0;
    transform: translateX(-100%);
  }
  
  /* Content - No margin on mobile, always full width */
  .content {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    transition: none; /* No transition - content should never move */
    position: relative;
    z-index: 1;
    contain: layout; /* Isolate content to prevent layout shifts */
    isolation: isolate; /* Create new stacking context */
  }
  
  /* Content stays full width even when menu is open (menu is overlay) */
  .content.menu-open {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    contain: layout; /* Ensure containment even when menu is open */
    isolation: isolate; /* Maintain isolation */
  }
  
  /* Overlay when menu is open */
  .side-menu-overlay {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    touch-action: pan-y; /* Allow vertical scrolling on overlay */
  }
  
  .side-menu-overlay.active {
    display: block;
    opacity: 1;
  }
  
  /* Ensure content can scroll even when menu is open on mobile */
  body:has(.side-menu.active) {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Allow scrolling on main content area */
  .container,
  .page-intro-section,
  .content {
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }
}

