/* ============================================================
   MyCodex Lite 1.7 – Sidebar CSS
   Vertical navigation sidebar with responsive design
   ============================================================ */

/* Sidebar Container */
.mycodex-sidebar {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: auto;
  background: var(--clr-surface);
  border-left: 1px solid var(--clr-border);
  display: flex;
  flex-direction: column;
  gap: 0;
  z-index: 9999;
  visibility: visible;
  opacity: 1;
  pointer-events: auto;

  transition: transform 0.3s ease, opacity 0.3s ease;
  box-shadow: -2px 0 8px rgba(124, 58, 237, 0.1);
}

.mycodex-sidebar.sidebar-hidden {
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
}

/* Button Container */
.sidebar-buttons {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0.5rem 0;
}

/* Individual Sidebar Button */
.sidebar-btn {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border: none;
  background: transparent;
  color: var(--clr-text);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition), color var(--transition), transform var(--transition);
  border-bottom: 1px solid var(--clr-border);
  outline: none;
  position: relative;
}

.sidebar-btn:hover {
  background: rgba(124, 58, 237, 0.2);
  color: var(--clr-accent);
  transform: scale(1.05);
}

.sidebar-btn:active {
  background: rgba(124, 58, 237, 0.3);
  transform: scale(0.98);
}

.sidebar-btn:focus-visible {
  outline: 2px solid var(--clr-primary);
  outline-offset: -2px;
}

/* Stateful Button (Format) */
.sidebar-btn-stateful[data-state="on"] {
  background: rgba(124, 58, 237, 0.25);
  color: var(--clr-accent);
  border-left: 3px solid var(--clr-primary);
}

.sidebar-btn-stateful[data-state="on"]:hover {
  background: rgba(124, 58, 237, 0.35);
}

/* Last Button */
.sidebar-btn:last-child {
  border-bottom: none;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .mycodex-sidebar {
    right: 0;
    top: 30px;
    width: 48px;
    height: calc(100vh - 30px);
  }

  .sidebar-btn {
    width: 48px;
    height: 48px;
    font-size: 1.1rem;
  }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
  .mycodex-sidebar {
    width: 44px;
    height: calc(100vh - 20px);
    top: 20px;
  }

  .sidebar-btn {
    width: 44px;
    height: 44px;
    font-size: 1rem;
    min-height: 44px; /* Touch target minimum */
  }
}

/* Tablet (Landscape) */
@media (max-width: 1024px) and (orientation: landscape) {
  .mycodex-sidebar {
    height: 100vh;
    top: 0;
  }
}

/* Touch Device Enhancements */
.touch-device .sidebar-btn {
  min-height: 44px;
  min-width: 44px;
}

.touch-device .sidebar-btn:active {
  background: rgba(124, 58, 237, 0.4);
}

/* Dark Mode (already dark, but for consistency) */
@media (prefers-color-scheme: dark) {
  .mycodex-sidebar {
    background: var(--clr-surface);
    border-left-color: var(--clr-border);
  }

  .sidebar-btn:hover {
    background: rgba(124, 58, 237, 0.25);
  }
}

/* High Contrast Mode Support */
@media (prefers-contrast: more) {
  .mycodex-sidebar {
    border-left-width: 2px;
  }

  .sidebar-btn {
    border-bottom-width: 2px;
  }

  .sidebar-btn:focus-visible {
    outline-width: 3px;
  }
}

/* Reduce Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
  .mycodex-sidebar,
  .sidebar-btn {
    transition: none;
  }
}


