/* ============================================================================
   WEB TOOLS DOCUMENTATION - MODERN LIGHT MODE
   Modern, responsive design with clean typography and smooth animations
   ============================================================================ */

/* ===== DESIGN TOKENS ===== */
:root {
  /* Colors */
  --primary: #0ea5e9;
  --primary-50: #f0f9ff;
  --primary-100: #e0f2fe;
  --primary-200: #bae6fd;
  --primary-300: #7dd3fc;
  --primary-500: #0ea5e9;
  --primary-600: #0284c7;
  --primary-700: #0369a1;
  --primary-800: #075985;
  
  --secondary: #64748b;
  --secondary-50: #f8fafc;
  --secondary-100: #f1f5f9;
  --secondary-200: #e2e8f0;
  --secondary-300: #cbd5e1;
  --secondary-400: #94a3b8;
  --secondary-500: #64748b;
  --secondary-600: #475569;
  --secondary-700: #334155;
  --secondary-800: #1e293b;
  --secondary-900: #0f172a;
  
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #06b6d4;
  
  /* Surfaces */
  --white: #ffffff;
  --surface: #fefefe;
  --surface-alt: #f8fafc;
  --surface-muted: #f1f5f9;
  --surface-elevated: #ffffff;
  
  /* Text */
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-tertiary: #64748b;
  --text-muted: #94a3b8;
  
  /* Borders */
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --border-strong: #cbd5e1;
  
  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  
  /* Radius */
  --radius-xs: 0.125rem;
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-2xl: 1rem;
  --radius-3xl: 1.5rem;
  --radius-full: 9999px;
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  
  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  
  /* Animations */
  --transition-fast: 0.15s ease-out;
  --transition-normal: 0.25s ease-out;
  --transition-slow: 0.4s ease-out;
  
  /* Focus */
  --focus-ring: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

/* ===== BASE STYLES ===== */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: clamp(14px, 0.8vw + 0.7rem, 16px);
  height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-primary);
  background: 
    radial-gradient(circle at 25% 25%, rgba(14, 165, 233, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(56, 178, 172, 0.05) 0%, transparent 50%),
    linear-gradient(135deg, #f8fafc 0%, #f1f5f9 50%, #e2e8f0 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100%;
  position: relative;
}

/* Subtle background pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(circle at 2px 2px, rgba(14, 165, 233, 0.08) 1px, transparent 0);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: -1;
  opacity: 0.3;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin-top: 0;
  margin-bottom: 1rem;
}

.page-title {
  font-size: clamp(2rem, 3vw + 1rem, 3.5rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--primary-600), var(--primary-500), var(--primary-400));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
}

.page-title::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -0.5rem;
  width: 4rem;
  height: 0.25rem;
  background: linear-gradient(90deg, var(--primary-500), var(--primary-400));
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
}

.page-intro {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  max-width: 65ch;
  line-height: 1.6;
}

/* ===== LAYOUT ===== */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 768px) {
  .container {
    padding: 0 2rem;
  }
}

.layout-docs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

@media (min-width: 1024px) {
  .layout-docs {
    grid-template-columns: 280px 1fr;
    gap: 3rem;
    align-items: start;
  }
}

@media (min-width: 1280px) {
  .layout-docs {
    grid-template-columns: 320px 1fr;
    gap: 4rem;
  }
}

/* ===== HEADER ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px) saturate(180%);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

.header-inner {
  padding: 1rem 0;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  transition: transform var(--transition-fast);
}

.navbar-brand:hover {
  transform: scale(1.02);
  text-decoration: none;
}

.logo {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-md);
}

/* ===== SIDEBAR ===== */
.docs-sidebar-wrapper {
  position: sticky;
  top: 6rem;
  height: fit-content;
  max-height: calc(100vh - 7rem);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-300) transparent;
}

.docs-sidebar-wrapper::-webkit-scrollbar {
  width: 6px;
}

.docs-sidebar-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.docs-sidebar-wrapper::-webkit-scrollbar-thumb {
  background: var(--primary-300);
  border-radius: var(--radius-full);
}

.docs-sidebar-wrapper::-webkit-scrollbar-thumb:hover {
  background: var(--primary-400);
}

.sidebar-nav {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem 0;
  box-shadow: var(--shadow-sm);
}

.sidebar .nav-link {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0.625rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 0;
  transition: all var(--transition-fast);
}

.sidebar .nav-link:hover {
  color: var(--text-primary);
  background: var(--surface-alt);
  text-decoration: none;
}

.sidebar .nav-link.active {
  color: var(--primary-600);
  background: var(--primary-50);
  font-weight: 600;
}

.sidebar .nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0.25rem;
  background: var(--primary-500);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.sidebar-sub {
  padding-left: 0 !important;
}

.sidebar-sub .nav-link {
  padding-left: 2.75rem;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-tertiary);
}

.sidebar-sub .nav-link.active {
  font-weight: 500;
}

/* ===== MOBILE SIDEBAR ===== */
@media (max-width: 1023px) {
  .docs-sidebar-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    height: 100vh;
    max-height: none;
    background: var(--white);
    padding: 6rem 0 2rem;
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    box-shadow: var(--shadow-xl);
    z-index: 50;
  }
  
  body.sidebar-open .docs-sidebar-wrapper {
    transform: translateX(0);
  }
  
  body.sidebar-open {
    overflow: hidden;
  }
  
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
    z-index: 40;
  }
  
  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: all;
  }
}

.sidebar-toggle {
  display: none;
  position: relative;
  width: 2.5rem;
  height: 2.5rem;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
}

@media (max-width: 1023px) {
  .sidebar-toggle {
    display: flex;
  }
}

.sidebar-toggle:hover {
  background: var(--surface-alt);
  box-shadow: var(--shadow-md);
}

.sidebar-toggle .bar {
  width: 1.25rem;
  height: 0.125rem;
  background: var(--text-primary);
  border-radius: var(--radius-full);
  transition: all var(--transition-normal);
}

.sidebar-toggle .bar:nth-child(2) {
  margin: 0.25rem 0;
}

body.sidebar-open .sidebar-toggle .bar:first-child {
  transform: rotate(45deg) translate(0.3rem, 0.3rem);
}

body.sidebar-open .sidebar-toggle .bar:nth-child(2) {
  opacity: 0;
}

body.sidebar-open .sidebar-toggle .bar:last-child {
  transform: rotate(-45deg) translate(0.3rem, -0.3rem);
}

/* ===== CONTENT AREAS ===== */
.docs-content {
  max-width: 800px;
}

.docs-content section {
  scroll-margin-top: 7rem;
  min-height: 300px; /* Ensure sections have minimum height for intersection observer */
  padding-bottom: 2rem; /* Add bottom padding for better spacing */
}

/* Specific section visibility fix */
#payment-processors {
  scroll-margin-top: 6rem;
  padding-top: 2rem;
  padding-bottom: 2rem;
  min-height: 700px; /* Ensure sufficient height for this large section */
  position: relative;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Ensure all payment processor blocks are visible */
#payment-processors .block {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  margin-bottom: 2rem;
}

#payment-processors h2,
#payment-processors h3,
#payment-processors p,
#payment-processors ol,
#payment-processors li {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Ensure section content is properly visible */
.docs-content section .block {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
}

.docs-content section .block:last-child {
  margin-bottom: 1rem;
}

/* Ensure all sections have proper spacing for intersection observer */
section[id] {
  position: relative;
  padding-top: 0.5rem;
}

section[id]:target {
  scroll-margin-top: 6rem;
  animation: highlightSection 2s ease-out;
}

@keyframes highlightSection {
  0% {
    background: rgba(14, 165, 233, 0.1);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.2);
  }
  100% {
    background: transparent;
    box-shadow: none;
  }
}

/* Fix navigation active states */
.sidebar .nav-link.active {
  color: var(--primary-600) !important;
  background: var(--primary-50) !important;
  font-weight: 600 !important;
  border-left: 3px solid var(--primary-500) !important;
}

/* Ensure payment-processors navigation link works */
a[href="#payment-processors"] {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

a[href="#payment-processors"].active {
  background: var(--primary-50) !important;
  color: var(--primary-600) !important;
  font-weight: 600 !important;
  border-left: 3px solid var(--primary-500) !important;
}

/* Force payment-processors section to be detectable */
#payment-processors.active-section {
  background: rgba(14, 165, 233, 0.05);
}

/* Debug helper for section visibility */
.debug-mode section[id] {
  border: 2px dashed #ccc;
  margin: 10px 0;
}

.debug-mode section[id]::before {
  content: "Section: " attr(id);
  background: #0ea5e9;
  color: white;
  padding: 4px 8px;
  font-size: 0.75rem;
  position: absolute;
  top: -25px;
  left: 0;
  z-index: 1000;
}

/* Force debug visibility for payment-processors */
body.debug #payment-processors {
  border: 3px solid red !important;
  background: rgba(255, 0, 0, 0.1) !important;
}

body.debug #payment-processors * {
  border: 1px dotted blue !important;
}

/* Emergency visibility fix */
.emergency-fix #payment-processors,
.emergency-fix #payment-processors * {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: static !important;
  height: auto !important;
  width: auto !important;
  overflow: visible !important;
}

.docs-content h2 {
  font-size: clamp(1.5rem, 2vw + 1rem, 2rem);
  margin-top: 3rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-light);
}

.docs-content h2:first-child {
  margin-top: 0;
}

.docs-content h3 {
  font-size: clamp(1.25rem, 1.5vw + 0.8rem, 1.5rem);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.docs-content h4 {
  font-size: 1.125rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
}

.docs-content p {
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
  max-width: 70ch;
}

.docs-content ul, 
.docs-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.docs-content li {
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.docs-content li::marker {
  color: var(--primary-500);
}

/* ===== CARDS & SECTIONS ===== */
.card {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-normal);
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--primary-200);
}

.card-body {
  padding: 2rem;
}

@media (max-width: 768px) {
  .card-body {
    padding: 1.5rem;
  }
}

.block {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-light);
}

.block:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

/* ===== TABLES ===== */
.table-responsive {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin: 2rem 0;
}

.table {
  margin: 0;
  background: var(--white);
  border-collapse: separate;
  border-spacing: 0;
}

.table thead {
  background: var(--surface-muted);
}

.table th {
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 1rem 1.25rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}

.table tbody tr:hover {
  background: var(--surface-alt);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* ===== CODE BLOCKS ===== */
pre {
  background: var(--secondary-900);
  color: #e2e8f0;
  padding: 1.5rem;
  border-radius: var(--radius-xl);
  margin: 1.5rem 0;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
  border: 1px solid var(--secondary-800);
  box-shadow: var(--shadow-lg);
  position: relative;
}

pre::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0.25rem;
  background: linear-gradient(90deg, var(--primary-500), var(--primary-400));
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

code {
  background: var(--primary-50);
  color: var(--primary-700);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: var(--font-mono);
  border: 1px solid var(--primary-200);
}

pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  border: none;
  border-radius: 0;
}

/* ===== ALERTS ===== */
.alert {
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: var(--radius-lg);
  border: 1px solid;
  font-size: 0.9rem;
  line-height: 1.6;
}

.alert-info {
  background: var(--info);
  background: linear-gradient(135deg, #e0f2fe 0%, #b3e5fc 100%);
  color: #0c4a6e;
  border-color: #7dd3fc;
}

.alert-success {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  color: #064e3b;
  border-color: #6ee7b7;
}

.alert-warning {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  color: #92400e;
  border-color: #fbbf24;
}

.alert-danger {
  background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
  color: #991b1b;
  border-color: #f87171;
}

/* ===== ACCORDION (FAQ) ===== */
.accordion {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.accordion .card {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  transition: none;
}

.accordion .card:hover {
  transform: none;
  box-shadow: none;
}

.accordion .card + .card {
  border-top: 1px solid var(--border-light);
}

.accordion .card-header {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
}

.accordion .btn-link {
  width: 100%;
  text-align: left;
  padding: 1.25rem 1.5rem;
  color: var(--text-primary);
  font-weight: 600;
  text-decoration: none;
  background: transparent;
  border: none;
  border-radius: 0;
  transition: all var(--transition-fast);
  position: relative;
}

.accordion .btn-link:hover {
  background: var(--surface-alt);
  color: var(--primary-600);
  text-decoration: none;
}

.accordion .btn-link[aria-expanded="true"] {
  color: var(--primary-600);
  background: var(--primary-50);
}

.accordion .btn-link::after {
  content: '+';
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.25rem;
  font-weight: 300;
  color: var(--primary-500);
  transition: transform var(--transition-fast);
}

.accordion .btn-link[aria-expanded="true"]::after {
  transform: translateY(-50%) rotate(45deg);
}

.accordion .card-body {
  padding: 0 1.5rem 1.5rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.accordion .collapse.show .card-body {
  animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn-primary {
  background: var(--primary-500);
  color: white;
  border-color: var(--primary-500);
}

.btn-primary:hover {
  background: var(--primary-600);
  border-color: var(--primary-600);
  color: white;
}

.btn-secondary {
  background: var(--secondary-100);
  color: var(--secondary-700);
  border-color: var(--secondary-200);
}

.btn-secondary:hover {
  background: var(--secondary-200);
  border-color: var(--secondary-300);
  color: var(--secondary-800);
}

/* ===== LINKS ===== */
a {
  color: var(--primary-600);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-700);
  text-decoration: underline;
}

a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* ===== HEADING ANCHORS ===== */
.heading-anchor {
  opacity: 0;
  margin-left: 0.5rem;
  font-size: 0.8em;
  color: var(--primary-400);
  text-decoration: none;
  transition: opacity var(--transition-fast);
}

.docs-content h2:hover .heading-anchor,
.docs-content h3:hover .heading-anchor,
.docs-content h4:hover .heading-anchor {
  opacity: 1;
}

.heading-anchor:focus-visible {
  opacity: 1;
}

/* ===== FOOTER ===== */
.site-footer {
  margin-top: 4rem;
  padding: 2rem 0;
  background: var(--surface-muted);
  border-top: 1px solid var(--border);
}

.footer-inner {
  text-align: center;
}

.footer-meta {
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

.footer-meta p {
  margin: 0.25rem 0;
}

/* ===== UTILITIES ===== */
.text-muted {
  color: var(--text-tertiary) !important;
}

.shadow-sm {
  box-shadow: var(--shadow-sm) !important;
}

.mb-5 {
  margin-bottom: 3rem !important;
}

.font-weight-bold {
  font-weight: 600 !important;
}

.list-style-none {
  list-style: none !important;
}

/* Spacing utilities */
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }

/* Display utilities */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-flex { display: flex !important; }
.d-grid { display: grid !important; }

/* Flex utilities */
.flex-row { flex-direction: row !important; }
.flex-column { flex-direction: column !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-nowrap { flex-wrap: nowrap !important; }

.justify-content-start { justify-content: flex-start !important; }
.justify-content-end { justify-content: flex-end !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-around { justify-content: space-around !important; }

.align-items-start { align-items: flex-start !important; }
.align-items-end { align-items: flex-end !important; }
.align-items-center { align-items: center !important; }
.align-items-stretch { align-items: stretch !important; }

/* Text utilities */
.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

.text-lowercase { text-transform: lowercase !important; }
.text-uppercase { text-transform: uppercase !important; }
.text-capitalize { text-transform: capitalize !important; }

.fw-light { font-weight: 300 !important; }
.fw-normal { font-weight: 400 !important; }
.fw-medium { font-weight: 500 !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-bold { font-weight: 700 !important; }

/* Size utilities */
.w-25 { width: 25% !important; }
.w-50 { width: 50% !important; }
.w-75 { width: 75% !important; }
.w-100 { width: 100% !important; }
.w-auto { width: auto !important; }

.h-25 { height: 25% !important; }
.h-50 { height: 50% !important; }
.h-75 { height: 75% !important; }
.h-100 { height: 100% !important; }
.h-auto { height: auto !important; }

/* Border utilities */
.border { border: 1px solid var(--border) !important; }
.border-0 { border: 0 !important; }
.border-top { border-top: 1px solid var(--border) !important; }
.border-bottom { border-bottom: 1px solid var(--border) !important; }
.border-start { border-left: 1px solid var(--border) !important; }
.border-end { border-right: 1px solid var(--border) !important; }

/* Border radius utilities */
.rounded { border-radius: var(--radius-md) !important; }
.rounded-sm { border-radius: var(--radius-sm) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-xl { border-radius: var(--radius-xl) !important; }
.rounded-pill { border-radius: var(--radius-full) !important; }
.rounded-circle { border-radius: 50% !important; }

/* Shadow utilities */
.shadow-none { box-shadow: none !important; }
.shadow-xs { box-shadow: var(--shadow-xs) !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }
.shadow-xl { box-shadow: var(--shadow-xl) !important; }

/* Position utilities */
.position-static { position: static !important; }
.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }
.position-fixed { position: fixed !important; }
.position-sticky { position: sticky !important; }

/* Overflow utilities */
.overflow-auto { overflow: auto !important; }
.overflow-hidden { overflow: hidden !important; }
.overflow-visible { overflow: visible !important; }
.overflow-scroll { overflow: scroll !important; }

/* Responsive display utilities */
@media (max-width: 767px) {
  .d-sm-none { display: none !important; }
  .d-sm-block { display: block !important; }
  .d-sm-flex { display: flex !important; }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .d-md-none { display: none !important; }
  .d-md-block { display: block !important; }
  .d-md-flex { display: flex !important; }
}

@media (min-width: 1024px) {
  .d-lg-none { display: none !important; }
  .d-lg-block { display: block !important; }
  .d-lg-flex { display: flex !important; }
}

/* ===== FOCUS & ACCESSIBILITY ===== */
*:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 1rem;
  background: var(--primary-600);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  z-index: 1000;
  transition: top var(--transition-normal);
}

.skip-link:focus {
  top: 1rem;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 480px) {
  .page-title {
    font-size: 2rem;
    margin-bottom: 1rem;
  }
  
  .page-intro {
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .docs-content h2 {
    font-size: 1.4rem;
    margin-top: 1.5rem;
  }
  
  .docs-content h3 {
    font-size: 1.2rem;
  }
  
  .table th,
  .table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.8rem;
  }
  
  pre {
    padding: 1rem;
    font-size: 0.8rem;
  }
  
  .copy-btn {
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.375rem 0.5rem;
    font-size: 0.7rem;
  }
}

@media (max-width: 768px) {
  .page-title {
    margin-bottom: 1rem;
  }
  
  .page-intro {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }
  
  .docs-content h2 {
    margin-top: 2rem;
  }
  
  .container {
    padding: 0 1rem;
  }
  
  .header-inner {
    padding: 0.75rem 0;
  }
  
  .sidebar-nav {
    padding: 1rem 0;
  }
  
  .sidebar .nav-link {
    padding: 0.5rem 1rem;
  }
  
  .alert {
    padding: 1rem;
    margin: 1rem 0;
  }
  
  .accordion .btn-link {
    padding: 1rem;
  }
  
  .accordion .card-body {
    padding: 0 1rem 1rem;
  }
}

@media (min-width: 769px) and (max-width: 1023px) {
  .layout-docs {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .docs-sidebar-wrapper {
    position: static;
    max-height: none;
    height: auto;
  }
  
  .sidebar-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
    padding: 1rem;
  }
  
  .sidebar .nav-link {
    text-align: center;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
  }
}

@media (min-width: 1024px) {
  .layout-docs {
    align-items: start;
  }
}

/* ===== DARK MODE SUPPORT (User Preference) ===== */
@media (prefers-color-scheme: dark) {
  /* Keep light mode as default but add subtle dark hints for accessibility */
  .card:hover {
    box-shadow: var(--shadow-lg);
  }
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
  :root {
    --border: #000000;
    --border-light: #333333;
    --text-secondary: #000000;
  }
  
  .card {
    border: 2px solid var(--border);
  }
  
  .btn {
    border-width: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .card:hover {
    transform: none;
  }
}

/* ===== COPY BUTTON STYLES ===== */
.copy-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all var(--transition-fast);
  z-index: 10;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.copy-btn:active {
  transform: scale(0.95);
}

.copy-btn.copied {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.copy-btn span {
  display: inline-block;
  transition: transform var(--transition-fast);
}

.copy-btn:hover span {
  transform: scale(1.05);
}

/* ===== ENHANCED ANIMATIONS ===== */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(14, 165, 233, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(14, 165, 233, 0);
  }
}

.card {
  animation: slideInUp 0.4s ease-out;
}

.sidebar .nav-link {
  animation: slideInLeft 0.3s ease-out;
  position: relative;
}

.sidebar .nav-link:nth-child(2) { animation-delay: 0.05s; }
.sidebar .nav-link:nth-child(3) { animation-delay: 0.1s; }
.sidebar .nav-link:nth-child(4) { animation-delay: 0.15s; }
.sidebar .nav-link:nth-child(5) { animation-delay: 0.2s; }

/* Micro-interactions */
.sidebar .nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background: var(--primary-500);
  transition: width var(--transition-fast);
}

.sidebar .nav-link:hover::after {
  width: 100%;
}

.copy-btn {
  animation: bounceIn 0.5s ease-out;
  animation-delay: 0.2s;
  opacity: 0;
  animation-fill-mode: forwards;
}

.copy-btn:hover {
  animation: pulse 1.5s infinite;
}

/* Button hover effects */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

/* Card entrance animations */
.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }
.card:nth-child(4) { animation-delay: 0.4s; }
.card:nth-child(5) { animation-delay: 0.5s; }

/* Heading animations */
.page-title {
  animation: slideInUp 0.6s ease-out;
}

.page-intro {
  animation: slideInUp 0.6s ease-out 0.2s both;
}

/* Interactive elements */
.table tbody tr {
  transition: all var(--transition-fast);
}

.table tbody tr:hover {
  transform: scale(1.01);
  box-shadow: var(--shadow-sm);
}

/* Alert animations */
.alert {
  animation: slideInLeft 0.4s ease-out;
  position: relative;
}

.alert::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1)
  );
  animation: alertShine 2s ease-in-out infinite;
}

@keyframes alertShine {
  0% {
    width: 0;
    right: 0;
  }
  50% {
    width: 100%;
    right: 0;
  }
  100% {
    width: 0;
    right: 100%;
  }
}

/* ===== LOADING STATES ===== */
.loading {
  position: relative;
  overflow: hidden;
}

.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* ===== ENHANCED FOCUS STYLES ===== */
.sidebar .nav-link:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--primary-500);
  background: var(--primary-50);
}

.accordion .btn-link:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--primary-500);
  background: var(--primary-50);
}

/* ===== TOOLTIP STYLES ===== */
[data-tooltip] {
  position: relative;
}

.tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--secondary-900);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  white-space: nowrap;
  visibility: hidden;
  opacity: 0;
  transition: all var(--transition-fast);
  z-index: 1000;
  pointer-events: none;
  margin-bottom: 0.25rem;
  box-shadow: var(--shadow-lg);
}

.tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--secondary-900);
}

/* Tooltip variations */
[data-tooltip-position="top"] .tooltip {
  bottom: 100%;
  margin-bottom: 0.25rem;
}

[data-tooltip-position="bottom"] .tooltip {
  top: 100%;
  bottom: auto;
  margin-top: 0.25rem;
  margin-bottom: 0;
}

[data-tooltip-position="bottom"] .tooltip::after {
  top: -8px;
  border-top-color: transparent;
  border-bottom-color: var(--secondary-900);
}

[data-tooltip-position="left"] .tooltip {
  bottom: auto;
  top: 50%;
  left: auto;
  right: 100%;
  transform: translateY(-50%);
  margin-right: 0.25rem;
  margin-bottom: 0;
}

[data-tooltip-position="left"] .tooltip::after {
  top: 50%;
  left: 100%;
  right: auto;
  transform: translateY(-50%);
  border-top-color: transparent;
  border-left-color: var(--secondary-900);
}

[data-tooltip-position="right"] .tooltip {
  bottom: auto;
  top: 50%;
  left: 100%;
  right: auto;
  transform: translateY(-50%);
  margin-left: 0.25rem;
  margin-bottom: 0;
}

[data-tooltip-position="right"] .tooltip::after {
  top: 50%;
  left: -8px;
  right: auto;
  transform: translateY(-50%);
  border-top-color: transparent;
  border-right-color: var(--secondary-900);
}

/* ===== SCROLL INDICATORS ===== */
.docs-content {
  position: relative;
}

.scroll-indicator {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--surface-muted);
  z-index: 1000;
}

.scroll-progress {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-500), var(--primary-400));
  width: 0%;
  transition: width 0.1s ease-out;
}

/* ===== IMPROVED TABLE STYLES ===== */
.table-custom-container {
  position: relative;
  background: var(--white);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table-custom {
  margin: 0;
  font-size: 0.9rem;
}

.table-custom thead {
  background: linear-gradient(135deg, var(--surface-muted), var(--surface-alt));
}

.table-custom th {
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border);
}

.table-custom tbody tr {
  transition: background-color var(--transition-fast);
}

.table-custom tbody tr:hover {
  background: linear-gradient(135deg, var(--surface-alt), var(--primary-50));
}

/* ===== ENHANCED ALERT STYLES ===== */
.alert {
  position: relative;
  overflow: hidden;
}

.alert::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: currentColor;
  opacity: 0.6;
}

.alert-info::before {
  background: var(--info);
}

.alert-success::before {
  background: var(--success);
}

.alert-warning::before {
  background: var(--warning);
}

.alert-danger::before {
  background: var(--error);
}

/* ===== PRINT STYLES ===== */
@media print {
  .site-header,
  .docs-sidebar-wrapper,
  .sidebar-toggle,
  .skip-link,
  .copy-btn,
  .sidebar-backdrop {
    display: none !important;
  }
  
  .docs-content {
    max-width: none;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid var(--border);
    break-inside: avoid;
  }
  
  a {
    color: inherit;
    text-decoration: underline;
  }
  
  .page-title::after {
    display: none;
  }
  
  pre {
    background: #f8f9fa !important;
    color: #212529 !important;
    border: 1px solid #dee2e6 !important;
  }
  
  .accordion .btn-link::after {
    display: none;
  }
}