/* ==========================================================================
   npm.dijitalevrak.com - Modern shadcn/ui Theme & Base Styles
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Light Theme (Zinc) */
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;
  --card: 0 0% 100%;
  --card-foreground: 240 10% 3.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 240 10% 3.9%;
  --primary: 240 5.9% 10%;
  --primary-foreground: 0 0% 98%;
  --secondary: 240 4.8% 95.9%;
  --secondary-foreground: 240 5.9% 10%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --accent: 240 4.8% 95.9%;
  --accent-foreground: 240 5.9% 10%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 0 0% 98%;
  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --ring: 240 5.9% 10%;
  --radius: 0.5rem;

  --code-bg: 240 4.8% 96.5%;
  --code-border: 240 5.9% 88%;
  --preview-bg: 0 0% 100%;
  --header-bg: rgba(255, 255, 255, 0.82);
  --grid-line: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] {
  /* Dark Theme (Zinc / Obsidian) */
  --background: 240 10% 3.9%;
  --foreground: 0 0% 98%;
  --card: 240 10% 3.9%;
  --card-foreground: 0 0% 98%;
  --popover: 240 10% 3.9%;
  --popover-foreground: 0 0% 98%;
  --primary: 0 0% 98%;
  --primary-foreground: 240 5.9% 10%;
  --secondary: 240 3.7% 15.9%;
  --secondary-foreground: 0 0% 98%;
  --muted: 240 3.7% 15.9%;
  --muted-foreground: 240 5% 64.9%;
  --accent: 240 3.7% 15.9%;
  --accent-foreground: 0 0% 98%;
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 0 0% 98%;
  --border: 240 3.7% 15.9%;
  --input: 240 3.7% 15.9%;
  --ring: 240 4.9% 83.9%;

  --code-bg: 240 10% 5%;
  --code-border: 240 3.7% 17%;
  --preview-bg: 240 10% 5%;
  --header-bg: rgba(9, 9, 11, 0.82);
  --grid-line: rgba(255, 255, 255, 0.035);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  min-height: 100vh;
  line-height: 1.6;
  font-size: 0.9375rem;
  background-image: 
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: center top;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Custom modern scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: hsl(var(--muted-foreground) / 0.3);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--muted-foreground) / 0.5);
}

/* Header & Navigation Bar */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  border-bottom: 1px solid hsl(var(--border));
  background-color: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 0.2s ease;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  height: 3.75rem;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: hsl(var(--foreground));
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  transition: opacity 0.15s;
}
.brand-logo:hover {
  opacity: 0.85;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 9999px;
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  border: 1px solid hsl(var(--border));
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.nav-links {
  display: none;
  align-items: center;
  gap: 1.25rem;
}
@media (min-width: 768px) {
  .nav-links {
    display: flex;
  }
}

.nav-link {
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  transition: color 0.15s ease;
}
.nav-link:hover, .nav-link.active {
  color: hsl(var(--foreground));
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Command Search Trigger Button in Header */
.search-trigger {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--secondary) / 0.5);
  color: hsl(var(--muted-foreground));
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 220px;
  max-width: 100%;
}
@media (max-width: 640px) {
  .search-trigger {
    width: auto;
    padding: 0.45rem;
  }
  .search-trigger span {
    display: none;
  }
}
.search-trigger:hover {
  background-color: hsl(var(--secondary));
  color: hsl(var(--foreground));
  border-color: hsl(var(--muted-foreground) / 0.4);
}
.search-trigger kbd {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.125rem 0.35rem;
  border-radius: 4px;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
}

/* Action Icon Buttons */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--border));
  background-color: transparent;
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
  text-decoration: none;
}
.icon-btn:hover {
  background-color: hsl(var(--secondary));
}

/* Main Documentation Layout */
.app-layout {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  min-height: calc(100vh - 3.75rem);
}

/* Left Sidebar */
.sidebar {
  width: 270px;
  flex-shrink: 0;
  border-right: 1px solid hsl(var(--border));
  padding: 1.5rem 1rem 3rem 1.25rem;
  position: sticky;
  top: 3.75rem;
  height: calc(100vh - 3.75rem);
  overflow-y: auto;
  transition: transform 0.25s ease, background-color 0.2s ease;
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 3.75rem;
    bottom: 0;
    z-index: 45;
    background-color: hsl(var(--background));
    transform: translateX(-100%);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
    width: 280px;
  }
  .sidebar.open {
    transform: translateX(0);
  }
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  top: 3.75rem;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 40;
}
.sidebar-overlay.active {
  display: block;
}

.sidebar-group {
  margin-bottom: 1.75rem;
}

.sidebar-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.5rem;
  padding: 0 0.5rem;
}

.sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.sidebar-item a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.65rem;
  border-radius: calc(var(--radius) - 2px);
  text-decoration: none;
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease;
}
.sidebar-item a:hover {
  color: hsl(var(--foreground));
  background-color: hsl(var(--secondary) / 0.6);
}
.sidebar-item a.active {
  color: hsl(var(--foreground));
  background-color: hsl(var(--secondary));
  font-weight: 600;
}

.item-badge {
  font-size: 0.6875rem;
  font-family: 'JetBrains Mono', monospace;
  padding: 0.1rem 0.4rem;
  border-radius: 9999px;
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  border: 1px solid hsl(var(--border));
}
.sidebar-item a.active .item-badge {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: transparent;
}

/* Main Content Area */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 2.25rem 2.5rem 5rem 2.5rem;
  max-width: 980px;
}
@media (max-width: 768px) {
  .main-content {
    padding: 1.5rem 1rem 4rem 1rem;
  }
}

/* Typography & Headings */
.page-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid hsl(var(--border));
  padding-bottom: 1.5rem;
}

.page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.page-title {
  font-size: 2.15rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: hsl(var(--foreground));
}

.page-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.page-desc {
  font-size: 1.05rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.65;
  max-width: 720px;
}

/* Links inside doc */
.text-link {
  color: hsl(var(--foreground));
  text-decoration: underline;
  text-underline-offset: 4px;
  font-weight: 500;
  transition: opacity 0.15s;
}
.text-link:hover {
  opacity: 0.75;
}

/* Code & pre in docs */
code:not(pre code) {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
}

/* Responsive Hamburger Toggle Button */
.mobile-nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background: transparent;
  color: hsl(var(--foreground));
  cursor: pointer;
}
@media (min-width: 901px) {
  .mobile-nav-toggle {
    display: none;
  }
}
