/* ============================================
   bz2api.js - Landing & Docs Custom Styles
   Bootstrap 5.3 Overrides + Modern Effects
   ============================================ */

/* ============ Theme Variables ============ */
[data-bs-theme="dark"] {
  /* Background colors */
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  
  /* Text colors */
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  
  /* Accent colors */
  --accent-blue: #58a6ff;
  --accent-green: #3fb950;
  --accent-purple: #bc8cff;
  --accent-orange: #d29922;
  --accent-red: #f85149;
  --accent-cyan: #39c5cf;
  
  /* Borders */
  --border-color: #30363d;
  --border-subtle: rgba(255, 255, 255, 0.1);
  
  /* Glassmorphism */
  --glass-bg: rgba(22, 27, 34, 0.8);
  --glass-bg-hover: rgba(33, 38, 45, 0.9);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  
  /* Gradients */
  --gradient-hero: linear-gradient(135deg, #0d1117 0%, #161b22 50%, #1f2937 100%);
  --gradient-accent: linear-gradient(135deg, #58a6ff 0%, #bc8cff 100%);
  --gradient-card: linear-gradient(145deg, rgba(22, 27, 34, 0.9), rgba(13, 17, 23, 0.9));
  
  /* Code blocks */
  --code-bg: #161b22;
  --code-border: #30363d;
}

[data-bs-theme="light"] {
  /* Background colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f6f8fa;
  --bg-tertiary: #eaeef2;
  
  /* Text colors */
  --text-primary: #1f2328;
  --text-secondary: #656d76;
  --text-muted: #8c959f;
  
  /* Accent colors */
  --accent-blue: #0969da;
  --accent-green: #1a7f37;
  --accent-purple: #8250df;
  --accent-orange: #bf8700;
  --accent-red: #cf222e;
  --accent-cyan: #0891b2;
  
  /* Borders */
  --border-color: #d0d7de;
  --border-subtle: rgba(0, 0, 0, 0.1);
  
  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-bg-hover: rgba(255, 255, 255, 0.95);
  --glass-border: rgba(0, 0, 0, 0.1);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  
  /* Gradients */
  --gradient-hero: linear-gradient(135deg, #f0f6fc 0%, #ffffff 50%, #f6f8fa 100%);
  --gradient-accent: linear-gradient(135deg, #0969da 0%, #8250df 100%);
  --gradient-card: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(246, 248, 250, 0.9));
  
  /* Code blocks */
  --code-bg: #f6f8fa;
  --code-border: #d0d7de;
}

/* ============ Base Styles ============ */
html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  padding-top: 60px; /* Account for fixed navbar */
}

/* ============ Typography ============ */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 600;
}

.text-gradient {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-accent { color: var(--accent-blue); }
.text-muted-custom { color: var(--text-muted); }

/* ============ Navigation ============ */
.navbar-custom {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  padding: 0.75rem 0;
  transition: all 0.3s ease;
}

.navbar-custom .navbar-brand {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-weight: 700;
  color: var(--accent-blue);
  font-size: 1.1rem;
}

.navbar-custom .nav-link {
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.navbar-custom .nav-link:hover,
.navbar-custom .nav-link.active {
  color: var(--text-primary);
  background: var(--glass-bg-hover);
}

/* Theme Toggle Button */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1.1rem;
}

.theme-toggle:hover {
  background: var(--glass-bg-hover);
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

/* ============ Hero Section ============ */
.hero-section {
  background: var(--gradient-hero);
  min-height: 80vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 80%, rgba(88, 166, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(188, 140, 255, 0.1) 0%, transparent 50%);
  pointer-events: none;
}

.hero-title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin-bottom: 2rem;
}

/* ============ Glassmorphism Cards ============ */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--glass-shadow);
  transition: all 0.3s ease;
}

.glass-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  border-color: var(--accent-blue);
}

.glass-card-static {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--glass-shadow);
}

/* ============ Feature Cards ============ */
.feature-card {
  padding: 2rem;
  height: 100%;
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
  background: var(--gradient-accent);
  color: white;
}

.feature-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.feature-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0;
}

/* ============ Buttons ============ */
.btn-primary-custom {
  background: var(--gradient-accent);
  border: none;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(88, 166, 255, 0.3);
}

.btn-primary-custom:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(88, 166, 255, 0.4);
  color: white;
}

.btn-outline-custom {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-outline-custom:hover {
  background: var(--glass-bg-hover);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-ghost:hover {
  background: var(--glass-bg-hover);
  color: var(--text-primary);
}

/* ============ Code Blocks ============ */
.code-block {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 12px;
  padding: 1.5rem;
  overflow-x: auto;
}

.code-block pre {
  margin: 0;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.875rem;
  line-height: 1.6;
}

.code-block code {
  color: inherit;
  background: transparent;
}

/* Syntax highlighting */
.code-keyword { color: var(--accent-purple); }
.code-string { color: var(--accent-green); }
.code-function { color: var(--accent-blue); }
.code-comment { color: var(--text-muted); font-style: italic; }
.code-number { color: var(--accent-orange); }

/* Inline code */
code:not(pre code) {
  background: var(--bg-tertiary);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 0.875em;
  color: var(--accent-purple);
}

/* ============ Section Styles ============ */
.section-padding {
  padding: 5rem 0;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 600px;
}

/* ============ Footer ============ */
.footer-custom {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 3rem 0 2rem;
  color: var(--text-secondary);
}

.footer-custom a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-custom a:hover {
  color: var(--accent-blue);
}

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

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out forwards;
}

.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }

.animate-float {
  animation: float 3s ease-in-out infinite;
}

/* Initially hidden for animation */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============ Docs-Specific Styles ============ */
.docs-sidebar {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.docs-nav .nav-link {
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
}

.docs-nav .nav-link:hover,
.docs-nav .nav-link.active {
  color: var(--accent-blue);
  background: var(--glass-bg);
  border-left-color: var(--accent-blue);
}

.docs-content h2 {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

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

/* API Reference Tables */
.api-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.api-table th,
.api-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.api-table th {
  background: var(--bg-tertiary);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.api-table td code {
  background: var(--bg-secondary);
}

/* ============ Hero Logo ============ */
.hero-logo {
  height: 56px;
}

/* ============ Responsive Adjustments ============ */

/* Tablet and below */
@media (max-width: 991px) {
  .hero-section {
    min-height: auto;
    padding: 4rem 0;
  }
  
  .hero-title {
    font-size: 2rem;
  }
  
  .hero-logo {
    height: 40px;
  }
  
  .docs-sidebar {
    position: static;
    max-height: none;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
  }
  
  .section-title {
    font-size: 1.75rem;
  }
}

/* Mobile */
@media (max-width: 767px) {
  .hero-section {
    padding: 3rem 0;
  }
  
  .hero-title {
    font-size: 1.75rem;
  }
  
  .hero-logo {
    height: 32px;
  }
  
  .hero-subtitle {
    font-size: 1rem;
  }
  
  .section-padding {
    padding: 3rem 0;
  }
  
  .section-title {
    font-size: 1.5rem;
  }
  
  .section-subtitle {
    font-size: 0.95rem;
  }
  
  .glass-card {
    border-radius: 12px;
  }
  
  .feature-card {
    padding: 1.5rem;
  }
  
  .feature-icon {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
  }
  
  /* Code blocks scroll on mobile */
  .code-block {
    font-size: 0.8rem;
  }
  
  .code-block pre {
    overflow-x: auto;
  }
  
  /* Navbar adjustments */
  .navbar-custom .navbar-brand {
    font-size: 1rem;
  }
  
  /* Footer */
  .footer-custom {
    padding: 2rem 0;
  }
}

/* Small mobile */
@media (max-width: 575px) {
  .hero-title {
    font-size: 1.5rem;
  }
  
  .hero-logo {
    height: 28px;
  }
  
  .btn-primary-custom,
  .btn-outline-custom,
  .btn-ghost {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }
  
  .code-block {
    font-size: 0.75rem;
    padding: 1rem;
    border-radius: 8px;
  }
}

/* ============ Scrollbar Styling ============ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============ Selection ============ */
::selection {
  background: rgba(88, 166, 255, 0.3);
  color: var(--text-primary);
}
