/* ============================================
   UNIFIED SIDEBAR NAVIGATION
   Modern, creative sidebar for all pages
   ============================================ */

:root {
  --sidebar-width: 300px;
  --sidebar-bg: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  --sidebar-border: rgba(99, 102, 241, 0.2);
  --nav-active: #6366f1;
  --nav-hover: rgba(99, 102, 241, 0.1);
  --nav-text: #e2e8f0;
  --nav-text-muted: #94a3b8;
}

/* Layout wrapper for all pages */
.page-with-sidebar {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Sidebar Container */
.unified-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1000;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
}

.unified-sidebar::-webkit-scrollbar {
  width: 8px;
}

.unified-sidebar::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
}

.unified-sidebar::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.5);
  border-radius: 4px;
}

.unified-sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.7);
}

/* Sidebar Header */
.sidebar-header {
  padding: 28px 24px;
  border-bottom: 1px solid var(--sidebar-border);
  background: rgba(99, 102, 241, 0.05);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.sidebar-logo-icon {
  font-size: 2em;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.sidebar-logo-text {
  flex: 1;
}

.sidebar-logo-text h2 {
  color: #ffffff;
  font-size: 1.3em;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 0%, #c7d2fe 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-logo-text p {
  color: var(--nav-text-muted);
  font-size: 0.85em;
  margin: 4px 0 0 0;
}

/* Navigation */
.sidebar-nav {
  padding: 20px 0;
}

.nav-section {
  margin-bottom: 32px;
}

.nav-section-title {
  color: var(--nav-text-muted);
  font-size: 0.7em;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0 24px 12px 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-section-title::before {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--sidebar-border), transparent);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: var(--nav-text);
  text-decoration: none;
  margin: 2px 0;
  transition: all 0.2s ease;
  font-size: 0.95em;
  font-weight: 500;
  position: relative;
  border-left: 3px solid transparent;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: linear-gradient(90deg, var(--nav-active), transparent);
  transition: width 0.3s ease;
  opacity: 0.2;
}

.nav-item:hover {
  background: var(--nav-hover);
  color: #ffffff;
  border-left-color: var(--nav-active);
  transform: translateX(4px);
}

.nav-item:hover::before {
  width: 100%;
}

.nav-item.active {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border-left-color: var(--nav-active);
  font-weight: 600;
}

.nav-item.active::before {
  width: 100%;
  opacity: 0.3;
}

.nav-item-icon {
  font-size: 1.2em;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.nav-item-text {
  flex: 1;
}

.nav-item-badge {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  font-size: 0.75em;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

/* Sub-navigation items */
.nav-sublink {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px 10px 56px;
  color: var(--nav-text-muted);
  text-decoration: none;
  margin: 1px 0;
  transition: all 0.2s ease;
  font-size: 0.9em;
  font-weight: 400;
  position: relative;
}

.nav-sublink::before {
  content: '└';
  position: absolute;
  left: 40px;
  color: var(--sidebar-border);
  font-size: 0.8em;
}

.nav-sublink:hover {
  background: var(--nav-hover);
  color: var(--nav-text);
  transform: translateX(4px);
}

.nav-sublink.active {
  color: #a5b4fc;
  font-weight: 500;
  background: rgba(99, 102, 241, 0.1);
}

/* Main Content Area */
.main-content-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  position: relative;
}

/* For pages that already have main-container */
.main-container {
  position: relative;
  z-index: 1;
}

/* Mobile Toggle Button */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1001;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
  font-size: 1.2em;
  font-weight: 600;
  transition: all 0.3s ease;
}

.sidebar-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.5);
}

.sidebar-toggle:active {
  transform: scale(0.95);
}

/* Mobile Responsive */
@media (max-width: 1024px) {
  html {
    overflow-x: hidden;
  }

  .unified-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 100vw;
    width: 280px;
  }

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

  .main-content-wrapper {
    margin-left: 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .sidebar-toggle {
    display: block;
    max-width: calc(100vw - 20px);
  }

  /* Overlay when sidebar is open on mobile */
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(4px);
    overflow: hidden;
  }

  .sidebar-overlay.active {
    display: block;
  }

  .page-with-sidebar {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }
}

@media (min-width: 1025px) {
  .sidebar-toggle {
    display: none;
  }
}

/* Large Screens (1920px and above) */
@media (min-width: 1920px) {
  :root {
    --sidebar-width: 320px;
  }

  .sidebar-header {
    padding: 32px 28px;
  }

  .sidebar-logo-icon {
    width: 56px;
    height: 56px;
    font-size: 2.2em;
  }

  .sidebar-logo-text h2 {
    font-size: 1.5em;
  }

  .sidebar-logo-text p {
    font-size: 0.95em;
  }

  .nav-item {
    padding: 14px 28px;
    font-size: 1.05em;
  }

  .nav-item-icon {
    font-size: 1.3em;
    width: 28px;
  }

  .nav-section-title {
    padding: 0 28px 14px 28px;
    font-size: 0.75em;
  }

  .nav-item-badge {
    font-size: 0.8em;
    padding: 3px 10px;
  }
}

/* Extra Large Screens (2560px and above) */
@media (min-width: 2560px) {
  :root {
    --sidebar-width: 360px;
  }

  .sidebar-header {
    padding: 40px 32px;
  }

  .sidebar-logo-icon {
    width: 64px;
    height: 64px;
    font-size: 2.5em;
  }

  .sidebar-logo-text h2 {
    font-size: 1.7em;
  }

  .sidebar-logo-text p {
    font-size: 1em;
  }

  .nav-item {
    padding: 16px 32px;
    font-size: 1.1em;
  }

  .nav-item-icon {
    font-size: 1.4em;
    width: 32px;
  }

  .nav-section-title {
    padding: 0 32px 16px 32px;
    font-size: 0.8em;
  }
}

/* Large Laptops and Desktops (1440px - 1919px) */
@media (min-width: 1440px) and (max-width: 1919px) {
  :root {
    --sidebar-width: 310px;
  }

  .sidebar-header {
    padding: 28px 24px;
  }

  .sidebar-logo-icon {
    width: 52px;
    height: 52px;
    font-size: 2em;
  }

  .sidebar-logo-text h2 {
    font-size: 1.4em;
  }

  .nav-item {
    padding: 13px 26px;
    font-size: 1em;
  }
}

/* Smooth scroll */
html {
  scroll-behavior: smooth;
}

/* Active section highlighting */
.docs-content-body h2:target,
.docs-content-body h3:target {
  animation: highlight 2s ease-out;
}

@keyframes highlight {
  0% {
    background: rgba(99, 102, 241, 0.3);
  }
  100% {
    background: transparent;
  }
}

/* Special styling for index page content */
.main-content-wrapper .main-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* Docs content styling (for guide pages) */
.docs-content {
  flex: 1;
  padding: 40px 60px;
  max-width: 1000px;
  position: relative;
}

/* Large Screens (1920px and above) */
@media (min-width: 1920px) {
  .main-content-wrapper .main-container {
    max-width: 1800px;
    padding: 30px;
  }

  .docs-content {
    padding: 50px 80px;
    max-width: 1400px;
  }

  .docs-content-header {
    margin-bottom: 50px;
    padding-bottom: 30px;
  }

  .docs-content-header h1 {
    font-size: 3em;
    margin-bottom: 16px;
  }

  .docs-content-header .subtitle {
    font-size: 1.4em;
    line-height: 1.7;
  }

  .docs-content-body {
    font-size: 1.1em;
    line-height: 1.9;
  }

  .docs-content-body h2 {
    font-size: 2.2em;
    margin-top: 60px;
    margin-bottom: 30px;
    padding-bottom: 16px;
  }

  .docs-content-body h3 {
    font-size: 1.7em;
    margin-top: 45px;
    margin-bottom: 20px;
  }

  .docs-content-body h4 {
    font-size: 1.4em;
    margin-top: 35px;
    margin-bottom: 16px;
  }

  .docs-content-body p {
    margin-bottom: 24px;
    line-height: 1.9;
  }

  .docs-content-body ul,
  .docs-content-body ol {
    margin-left: 35px;
    margin-bottom: 28px;
    line-height: 1.9;
  }

  .docs-content-body li {
    margin-bottom: 14px;
  }

  .docs-content-body code {
    font-size: 0.95em;
    padding: 4px 9px;
  }

  .docs-content-body pre {
    padding: 28px;
    border-radius: 16px;
    margin: 28px 0;
    font-size: 0.95em;
  }
}

/* Extra Large Screens (2560px and above) */
@media (min-width: 2560px) {
  .main-content-wrapper .main-container {
    max-width: 2400px;
    padding: 50px;
  }

  .docs-content {
    padding: 60px 100px;
    max-width: 1800px;
  }

  .docs-content-header {
    margin-bottom: 60px;
    padding-bottom: 40px;
  }

  .docs-content-header h1 {
    font-size: 3.5em;
    margin-bottom: 20px;
  }

  .docs-content-header .subtitle {
    font-size: 1.6em;
  }

  .docs-content-body {
    font-size: 1.2em;
    line-height: 2;
  }

  .docs-content-body h2 {
    font-size: 2.5em;
    margin-top: 70px;
    margin-bottom: 35px;
    padding-bottom: 20px;
  }

  .docs-content-body h3 {
    font-size: 1.9em;
    margin-top: 55px;
    margin-bottom: 25px;
  }

  .docs-content-body h4 {
    font-size: 1.6em;
    margin-top: 45px;
    margin-bottom: 20px;
  }

  .docs-content-body p {
    margin-bottom: 28px;
  }

  .docs-content-body ul,
  .docs-content-body ol {
    margin-left: 40px;
    margin-bottom: 32px;
  }

  .docs-content-body pre {
    padding: 36px;
    border-radius: 20px;
    margin: 32px 0;
    font-size: 1em;
  }
}

/* Large Laptops and Desktops (1440px - 1919px) */
@media (min-width: 1440px) and (max-width: 1919px) {
  .main-content-wrapper .main-container {
    max-width: 1600px;
    padding: 25px;
  }

  .docs-content {
    padding: 45px 70px;
    max-width: 1200px;
  }

  .docs-content-header h1 {
    font-size: 2.8em;
  }

  .docs-content-header .subtitle {
    font-size: 1.3em;
  }

  .docs-content-body {
    font-size: 1.05em;
  }

  .docs-content-body h2 {
    font-size: 2em;
    margin-top: 50px;
  }

  .docs-content-body h3 {
    font-size: 1.6em;
    margin-top: 40px;
  }

  .docs-content-body h4 {
    font-size: 1.3em;
    margin-top: 30px;
  }
}

@media (max-width: 768px) {
  .sidebar-toggle {
    top: 12px;
    left: 12px;
    padding: 10px 14px;
    font-size: 1.1em;
    border-radius: 10px;
  }

  .unified-sidebar {
    width: 280px;
  }

  .sidebar-header {
    padding: 20px 16px;
  }

  .sidebar-logo-icon {
    width: 40px;
    height: 40px;
    font-size: 1.6em;
  }

  .sidebar-logo-text h2 {
    font-size: 1.2em;
  }

  .sidebar-logo-text p {
    font-size: 0.8em;
  }

  .nav-item {
    padding: 10px 16px;
    font-size: 0.9em;
  }

  .nav-item-icon {
    font-size: 1.1em;
    width: 20px;
  }

  .nav-section-title {
    padding: 0 16px 10px 16px;
    font-size: 0.65em;
  }

  .main-content-wrapper .main-container {
    padding: 12px;
  }

  .docs-content {
    padding: 16px;
  }

  .docs-content-header {
    margin-bottom: 24px;
    padding-bottom: 12px;
  }

  .docs-content-header h1 {
    font-size: 1.6em;
  }

  .docs-content-header .subtitle {
    font-size: 0.95em;
  }

  .docs-content-body {
    font-size: 0.95em;
  }

  .docs-content-body h2 {
    font-size: 1.4em;
    margin-top: 24px;
    margin-bottom: 16px;
    padding-bottom: 8px;
  }

  .docs-content-body h3 {
    font-size: 1.15em;
    margin-top: 20px;
    margin-bottom: 12px;
  }

  .docs-content-body h4 {
    font-size: 1.05em;
    margin-top: 18px;
    margin-bottom: 10px;
  }

  .docs-content-body p {
    margin-bottom: 14px;
    line-height: 1.7;
  }

  .docs-content-body ul,
  .docs-content-body ol {
    margin-left: 20px;
    margin-bottom: 16px;
  }

  .docs-content-body li {
    margin-bottom: 8px;
    line-height: 1.7;
  }

  .docs-content-body code {
    font-size: 0.85em;
    padding: 2px 6px;
  }

  .docs-content-body pre {
    padding: 12px;
    border-radius: 8px;
    margin: 16px 0;
    font-size: 0.85em;
  }
}

@media (max-width: 480px) {
  .sidebar-toggle {
    top: 10px;
    left: 10px;
    padding: 8px 12px;
    font-size: 1em;
    border-radius: 8px;
  }

  .unified-sidebar {
    width: 260px;
  }

  .sidebar-header {
    padding: 16px 12px;
  }

  .sidebar-logo-icon {
    width: 36px;
    height: 36px;
    font-size: 1.4em;
  }

  .sidebar-logo-text h2 {
    font-size: 1.1em;
  }

  .sidebar-logo-text p {
    font-size: 0.75em;
  }

  .nav-item {
    padding: 8px 12px;
    font-size: 0.85em;
  }

  .nav-item-icon {
    font-size: 1em;
    width: 18px;
  }

  .nav-section-title {
    padding: 0 12px 8px 12px;
    font-size: 0.6em;
  }

  .main-content-wrapper .main-container {
    padding: 8px;
  }

  .docs-content {
    padding: 12px;
  }

  .docs-content-header {
    margin-bottom: 20px;
    padding-bottom: 10px;
  }

  .docs-content-header h1 {
    font-size: 1.4em;
  }

  .docs-content-header .subtitle {
    font-size: 0.9em;
  }

  .docs-content-body {
    font-size: 0.9em;
  }

  .docs-content-body h2 {
    font-size: 1.3em;
    margin-top: 20px;
    margin-bottom: 12px;
  }

  .docs-content-body h3 {
    font-size: 1.1em;
    margin-top: 18px;
    margin-bottom: 10px;
  }

  .docs-content-body h4 {
    font-size: 1em;
    margin-top: 16px;
    margin-bottom: 8px;
  }

  .docs-content-body p {
    margin-bottom: 12px;
  }

  .docs-content-body ul,
  .docs-content-body ol {
    margin-left: 18px;
    margin-bottom: 14px;
  }

  .docs-content-body pre {
    padding: 10px;
    font-size: 0.8em;
  }
}

@media (max-width: 375px) {
  .unified-sidebar {
    width: 240px;
  }

  .docs-content {
    padding: 10px;
  }

  .docs-content-header h1 {
    font-size: 1.3em;
  }

  .docs-content-body h2 {
    font-size: 1.2em;
  }

  .docs-content-body h3 {
    font-size: 1.05em;
  }
}

.docs-content-header {
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--glass-border);
}

.docs-content-header h1 {
  color: var(--text-primary);
  font-size: 2.5em;
  margin-bottom: 10px;
  font-weight: 700;
}

.docs-content-header .subtitle {
  color: var(--text-secondary);
  font-size: 1.1em;
  line-height: 1.6;
}

.docs-content-body {
  line-height: 1.8;
  color: var(--text-secondary);
}

.docs-content-body h2 {
  color: var(--text-primary);
  font-size: 1.8em;
  margin-top: 50px;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid rgba(99, 102, 241, 0.3);
  font-weight: 600;
  scroll-margin-top: 100px;
}

.docs-content-body h3 {
  color: var(--text-primary);
  font-size: 1.4em;
  margin-top: 35px;
  margin-bottom: 15px;
  font-weight: 600;
  scroll-margin-top: 100px;
}

.docs-content-body h4 {
  color: var(--text-primary);
  font-size: 1.2em;
  margin-top: 25px;
  margin-bottom: 12px;
  font-weight: 600;
}

.docs-content-body p {
  margin-bottom: 18px;
  color: var(--text-secondary);
}

.docs-content-body ul,
.docs-content-body ol {
  margin-left: 25px;
  margin-bottom: 20px;
  color: var(--text-secondary);
}

.docs-content-body ul a,
.docs-content-body ol a,
.docs-content-body li a {
  color: #60a5fa;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
}

.docs-content-body ul a:hover,
.docs-content-body ol a:hover,
.docs-content-body li a:hover {
  color: #93c5fd;
  text-decoration: underline;
}

.docs-content-body li {
  margin-bottom: 10px;
  line-height: 1.8;
}

.docs-content-body code {
  background: rgba(99, 102, 241, 0.2);
  padding: 3px 8px;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.4);
}

.docs-content-body a {
  color: #60a5fa;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  border-bottom: 1px solid transparent;
}

.docs-content-body a:hover {
  color: #93c5fd;
  border-bottom-color: #93c5fd;
  text-decoration: none;
}

.docs-content-body pre {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 12px;
  padding: 20px;
  overflow-x: auto;
  margin: 20px 0;
}

.docs-content-body pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text-secondary);
  font-size: 0.9em;
}
