/* NoClass Docs Theme - Complete CSP-Friendly Version */
/* Combined from theme.css and index.html inline styles */

/* ==================== THEME VARIABLES ==================== */
:root {
  --primary-color: #4361ee;
  --secondary-color: #3a0ca3;
  --accent-color: #4cc9f0;
  --light-bg: #f8f9fa;
  --dark-text: #212529;
  --light-text: #6c757d;
  --border-color: #dee2e6;
  --sidebar-width: 280px;
  --header-height: 60px;
  --transition-speed: 0.3s;
  
  /* Theme System Variables */
  --bg: #0b1220;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --surface: #0f172a;
  --surface-2: #111b33;
  --border: rgba(148, 163, 184, 0.22);
  --link: #93c5fd;
  
  --sidebar-bg: #0b1220;
  --sidebar-text: #e5e7eb;
  --sidebar-muted: #94a3b8;
  --sidebar-active: rgba(147,197,253,0.12);
  
  --icon: #ffffff;
  
  --code-bg: #000000;
  --code-text: #e5e7eb;
  --code-border: rgba(255, 255, 255, 0.10);
}

[data-theme="light"] {
  --bg: #ffffff;
  --text: #111827;
  --muted: #4b5563;
  --surface: #f8fafc;
  --surface-2: #ffffff;
  --border: rgba(17, 24, 39, 0.12);
  --link: #1d4ed8;
  
  --sidebar-bg: #0f172a;
  --sidebar-text: #e5e7eb;
  --sidebar-muted: #cbd5e1;
  --sidebar-active: rgba(255,255,255,0.14);
  
  --icon: #ffffff;
  
  --code-bg: #000000;
  --code-text: #e5e7eb;
  --code-border: rgba(255, 255, 255, 0.10);
}

/* ==================== GLOBAL RESET & BASE ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  line-height: 1.6;
  background: var(--bg) !important;
  color: var(--text) !important;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden; /* Prevent horizontal scroll on body */
}

body {
  flex: 1;
  width: 100%;
  overflow-x: hidden; /* Prevent horizontal scroll on body */
}

a { 
  color: var(--link) !important; 
  text-decoration: none;
}

/* ==================== SKIP LINK ==================== */
.skip-link {
  position: absolute;
  left: -999px;
  top: 10px;
  background: #fff;
  color: #000;
  padding: 8px 12px;
  border-radius: 6px;
  z-index: 2000;
  border: 1px solid var(--border-color);
}
.skip-link:focus { 
  left: 20px; 
  color: var(--text) !important;
}

/* ==================== SIDEBAR NAVIGATION ==================== */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: white;
  padding: 20px 0;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 3px 0 15px rgba(0,0,0,0.1);
  background: var(--sidebar-bg) !important;
  color: var(--sidebar-text) !important;
  border-color: rgba(255,255,255,0.08) !important;
}

.sidebar-header {
  padding: 0 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 20px;
}

.sidebar-header h2 {
  font-size: 1.5rem;
  margin-bottom: 5px;
}

.sidebar-header .version {
  font-size: 0.9rem;
  opacity: 0.8;
}

.nav-list {
  list-style: none;
}

.nav-item {
  margin-bottom: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: var(--sidebar-text) !important;
  text-decoration: none;
  transition: all var(--transition-speed);
  border-left: 4px solid transparent;
  font-weight: 500;
  width: 100%;
}

.nav-link:hover {
  background: var(--sidebar-active) !important;
  color: white !important;
  border-left-color: var(--accent-color);
}

.nav-link.active {
  background: var(--sidebar-active) !important;
  color: white !important;
  border-left-color: var(--accent-color);
  font-weight: 600;
}

.nav-section {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.7);
  padding: 15px 20px 8px;
  margin-top: 15px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.menu-icon {
  width: 18px;
  min-width: 18px;
  margin-right: 10px;
  color: #ffffff !important;
  font-size: 14px;
}

.menu-label {
  display: inline-block;
  color: var(--sidebar-text) !important;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 40px;
  max-width: 900px;
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
  width: 100%;
  box-sizing: border-box;
}

.content-section {
  margin-bottom: 60px;
  scroll-margin-top: 20px;
  width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

.content-section h2 {
  color: var(--primary-color);
  font-size: 2rem;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--accent-color);
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.content-section h3 {
  color: var(--secondary-color);
  font-size: 1.5rem;
  margin: 25px 0 15px;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.content-section h4 {
  color: var(--dark-text);
  font-size: 1.2rem;
  margin: 20px 0 10px;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.content-section p {
  margin-bottom: 15px;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.content-section ul, .content-section ol {
  margin-left: 20px;
  margin-bottom: 20px;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.content-section li {
  margin-bottom: 8px;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* ==================== CODE BLOCKS ==================== */
.code-block {
  background: transparent !important;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 20px;
  margin: 20px 0;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.9rem;
  overflow-x: auto;
  width: 100%;
  box-sizing: border-box;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 10px;
}

.code-title {
  font-weight: 600;
  color: var(--primary-color);
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.copy-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background var(--transition-speed);
  white-space: nowrap;
}

.copy-btn:hover {
  background: var(--secondary-color);
}

pre {
  margin: 0;
  line-height: 1.5;
  background: var(--code-bg) !important;
  border: 1px solid var(--code-border) !important;
  border-radius: 12px !important;
  padding: 14px 16px !important;
  overflow-x: auto !important;
  width: 100%;
  box-sizing: border-box;
}

code {
  background: rgba(148, 163, 184, 0.15);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.9rem;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

pre code {
  background: transparent !important;
  color: var(--code-text) !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
  font-size: 13px !important;
  line-height: 1.55 !important;
  padding: 0 !important;
  white-space: pre;
  overflow-x: auto;
  display: block;
}

/* ==================== SYNTAX HIGHLIGHTING ==================== */
.tok-comment { color: #7c8aa5; }
.tok-string  { color: #22c55e; }
.tok-keyword { color: #f472b6; font-weight: 600; }
.tok-func    { color: #a78bfa; }
.tok-var     { color: #93c5fd; }
.tok-num     { color: #f59e0b; }
.tok-op      { color: #cbd5e1; }

/* ==================== INFO BOXES ==================== */
.info-box, .warning-box, .success-box {
  padding: 15px 20px;
  margin: 20px 0;
  border-radius: 0 4px 4px 0;
  overflow-wrap: break-word;
  word-wrap: break-word;
  width: 100%;
  box-sizing: border-box;
}

.info-box {
  background: #e7f4ff;
  border-left: 4px solid var(--accent-color);
}

.warning-box {
  background: #fff3cd;
  border-left: 4px solid #ffc107;
}

.success-box {
  background: #d1e7dd;
  border-left: 4px solid #198754;
}

/* ==================== TABLES ==================== */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  display: block;
  overflow-x: auto;
  box-sizing: border-box;
}

th {
  background: var(--light-bg);
  padding: 12px 15px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

td {
  padding: 10px 15px;
  border-bottom: 1px solid var(--border-color);
  overflow-wrap: break-word;
  word-wrap: break-word;
}

tr:hover {
  background: rgba(67, 97, 238, 0.05);
}

/* ==================== VERSION BANNER ==================== */
.version-banner {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 20px;
  font-size: 14px;
  color: #1f2937;
  background: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
  width: 100%;
  box-sizing: border-box;
}

.version-banner .vb-meta {
  margin-left: 10px;
  color: var(--muted) !important;
  font-weight: normal;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* ==================== THEME TOGGLE ==================== */
.top-actions {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 9999;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.75);
  color: var(--text);
  cursor: pointer;
  backdrop-filter: blur(8px);
  white-space: nowrap;
}

[data-theme="light"] .theme-toggle {
  background: rgba(248, 250, 252, 0.85);
}

.theme-toggle:hover {
  border-color: rgba(148, 163, 184, 0.50);
}

.theme-label { 
  font-size: 13px; 
}

/* ==================== NAV TOGGLE ==================== */
.nav-toggle {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.15);
  color: var(--text);
  cursor: pointer;
  backdrop-filter: blur(8px);
}

[data-theme="dark"] .nav-toggle {
  background: rgba(15, 23, 42, 0.75);
}

/* ==================== NAV OVERLAY ==================== */
.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 9997;
  display: none;
}

html.nav-open .nav-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* ==================== SCROLL PROGRESS ==================== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: 3px;
  background: var(--accent-color);
  transform-origin: 0%;
  z-index: 999;
}

/* ==================== FOOTER ==================== */
.footer {
  margin-top: 60px;
  padding-top: 30px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--light-text);
  font-size: 0.9rem;
  width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* ==================== FOCUS STATES ==================== */
a:focus, button:focus {
  outline: 3px solid rgba(76, 201, 240, 0.7);
  outline-offset: 2px;
}

/* ==================== MOBILE RESPONSIVENESS ==================== */
@media (max-width: 900px) {
  html, body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
  }
  
  /* Main content adjustments */
  .main-content {
    width: 100% !important;
    margin: 0 !important;
    padding: 16px !important;
    padding-top: 70px !important;
    max-width: 100% !important;
    overflow-x: hidden;
  }
  
  /* Content section adjustments */
  .content-section {
    width: 100%;
    overflow-x: hidden;
  }
  
  .content-section h2 {
    font-size: 1.5rem;
    padding-right: 0;
  }
  
  .content-section h3 {
    font-size: 1.25rem;
  }
  
  .content-section h4 {
    font-size: 1.1rem;
  }
  
  /* Sidebar becomes off-canvas */
  .sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    height: 100vh !important;
    width: 280px !important;
    max-width: 85vw !important;
    transform: translateX(-110%);
    transition: transform 0.25s ease;
    z-index: 9998;
    overflow-y: auto !important;
    padding-top: 56px !important;
  }
  
  html.nav-open .sidebar {
    transform: translateX(0);
  }
  
  .nav-overlay {
    display: block !important;
  }
  
  .scroll-progress {
    left: 0 !important;
  }
  
  /* Tables - Force horizontal scroll on mobile */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }
  
  th, td {
    min-width: 100px; /* Ensure cells don't get too small */
  }
  
  /* Code blocks */
  .code-block {
    padding: 12px !important;
    margin: 15px 0;
    font-size: 0.85rem;
  }
  
  pre {
    font-size: 12px !important;
    padding: 12px !important;
  }
  
  pre code {
    font-size: 12px !important;
  }
  
  /* Info boxes */
  .info-box, .warning-box, .success-box {
    padding: 12px 15px;
    margin: 15px 0;
  }
  
  /* Version banner */
  .version-banner {
    padding: 8px 12px;
    font-size: 13px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
  }
  
  .version-banner .vb-meta {
    margin-left: 0;
    font-size: 12px;
  }
  
  /* Fix for long text in buttons */
  .theme-toggle {
    padding: 8px 10px;
  }
  
  .theme-label {
    font-size: 12px;
  }
  
  /* Ensure no horizontal overflow */
  .content-section > * {
    max-width: 100%;
    overflow-x: hidden;
  }
  
  /* Force break long words */
  .content-section p, .content-section li, .content-section td {
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  
  /* Make sure inline code doesn't cause overflow */
  code:not(pre code) {
    word-break: break-all;
    white-space: normal;
  }
}

@media (min-width: 901px) {
  .nav-toggle { 
    display: none; 
  }
  
  .nav-overlay { 
    display: none !important; 
  }
}

/* ==================== PRINT STYLES ==================== */
@media print {
  .nav-toggle, .top-actions, .nav-overlay, .scroll-progress {
    display: none !important;
  }
  
  .sidebar {
    display: none !important;
  }
  
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 20px !important;
  }
}