/* Optimized CSS - Non-critical styles loaded async */

body::before { display: none; }

[data-theme="dark"] body::before { display: none; }

@keyframes gradientShift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(5%, 5%) rotate(120deg); }
  66% { transform: translate(-5%, 5%) rotate(240deg); }
}

/* Mobile Menu */
.mobile-menu-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.mobile-menu-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.mobile-menu {
  position: fixed;
  top: 0;
  right: -100%;
  width: 280px;
  height: 100%;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  z-index: 999;
  transition: right 0.3s ease;
  overflow-y: auto;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.3);
}

.mobile-menu.active {
  right: 0;
}

.mobile-menu-header {
  padding: 2rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.mobile-menu-logo {
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--accent-cyan);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.mobile-menu-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.mobile-menu-section {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.mobile-menu-title {
  padding: 0.5rem 1.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.mobile-menu-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s ease;
}

.mobile-menu-link:hover,
.mobile-menu-link:focus {
  background: var(--bg-hover);
  color: var(--text-primary);
  outline: none;
}

.mobile-menu-link i {
  font-size: 1.25rem;
  color: var(--accent-cyan);
}

.mobile-menu-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-dark);
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: all 0.2s ease;
  border: 1px solid var(--border);
}

.mobile-menu-close:hover,
.mobile-menu-close:focus {
  background: var(--bg-hover);
  transform: rotate(90deg);
  outline: 2px solid var(--accent-cyan);
}

.hamburger-btn { display: none; }

.hamburger-btn:hover,
.hamburger-btn:focus {
  background: var(--bg-hover);
  outline: 2px solid var(--accent-cyan);
}

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

.search-box {
  position: relative;
}

.hero-search {
  max-width: 700px;
  margin: 1.5rem auto 0;
  width: 100%;
}

.hero-search .search-input {
  padding: 1.25rem 1.5rem 1.25rem 3.5rem;
  font-size: 1.1rem;
  border-radius: 16px;
  background: var(--bg-card);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.hero-search .search-icon {
  left: 1.5rem;
  font-size: 1.4rem;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 3rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-main) !important;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  font-family: 'Space Grotesk', sans-serif;
}

[data-theme="light"] .search-input {
  color: #1a1a1f !important;
}

/* Fix Prism Background Clash */
code[class*="language-"],
pre[class*="language-"] {
  text-shadow: none !important;
  background: none !important;
}

.snippet-code-preview pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  background: transparent !important;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px var(--glow-cyan);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.2rem;
  pointer-events: none;
}

.theme-toggle {
  width: 42px;
  height: 42px;
  border: none;
  background: var(--bg-card);
  border-radius: 10px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.3s ease;
  border: 1px solid var(--border);
}

.theme-toggle:hover,
.theme-toggle:focus {
  background: var(--bg-hover);
  transform: scale(1.05);
  outline: 2px solid var(--accent-cyan);
}

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

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 3rem 2rem;
  position: relative;
  z-index: 1;
}

.hero {
  text-align: center;
  margin-bottom: 4rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: 4rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

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

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

.tags-cloud {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.tags-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 1rem;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tag:hover,
.tag:focus {
  background: var(--bg-hover);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  transform: translateY(-2px);
  outline: 2px solid var(--accent-cyan);
}

.tag.active {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: var(--bg-dark);
}

.tag i {
  font-size: 1rem;
}

.filters {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-select {
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: 'Space Grotesk', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 160px;
}

.filter-select:hover,
.filter-select:focus {
  border-color: var(--accent-cyan);
  outline: 2px solid var(--glow-cyan);
}

.stats {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
}

.stats i {
  font-size: 1.1rem;
}

/* Tag Groups */
.tag-group {
  grid-column: 1 / -1;
  margin-top: 2.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: fadeIn 0.5s ease;
}

.tag-group:first-child {
  margin-top: 0;
}

.tag-group-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.tag-group i {
  color: var(--accent-cyan);
  font-size: 1.5rem;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.snippets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.snippet-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.snippet-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-cyan);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.snippet-card:hover::before,
.snippet-card:focus-within::before {
  transform: scaleX(1);
}

.snippet-card:hover,
.snippet-card:focus-within {
  border-color: var(--accent-cyan);
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 245, 255, 0.15);
}

.snippet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.snippet-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lock-icon {
  color: var(--accent-orange);
  font-size: 1rem;
}

.language-badge {
  padding: 0.25rem 0.75rem;
  background: var(--bg-dark);
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-cyan);
  text-transform: uppercase;
  white-space: nowrap;
}

.snippet-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* New Snippet Code Preview */
.snippet-code-preview {
  background: #0d0d12;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 1.25rem;
  padding: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: #d1d1e0;
  overflow: hidden;
  position: relative;
  max-height: 120px;
}

.snippet-code-preview pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
}

.snippet-code-preview::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: var(--accent-cyan);
}

.locked-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 80px;
  color: var(--text-muted);
}

/* User Profile Section */
.snippet-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-top: 0.5rem;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.username {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

.snippet-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.snippet-tag {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.snippet-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.snippet-date {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.snippet-action {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent-cyan);
  font-size: 0.9rem;
  font-weight: 500;
  transition: gap 0.2s ease;
}

.snippet-card:hover .snippet-action,
.snippet-card:focus-within .snippet-action {
  gap: 0.75rem;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 2rem;
}

.empty-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.empty-description {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Improved contrast for light theme */
[data-theme="light"] .snippet-card {
  background: var(--bg-card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .snippet-card:hover {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .tag {
  background: var(--bg-dark);
}

[data-theme="light"] .language-badge {
  background: rgba(0, 112, 243, 0.1);
  color: #0070f3;
}

/* Responsive */
@media (max-width: 768px) {
  .hamburger-btn { display: none; }

  .hero-title {
    font-size: 2.5rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .snippets-grid {
    grid-template-columns: 1fr;
  }

  .container {
    padding: 2rem 1rem;
  }

  .filter-select {
    min-width: 140px;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 2rem;
  }

  .search-box {
    max-width: 100%;
  }

  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-group {
    width: 100%;
  }

  .filter-select {
    flex: 1;
    min-width: 0;
  }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  body::before { display: none; }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .snippet-card {
    border-width: 2px;
  }

  .tag,
  .filter-select,
  .theme-toggle,
  .hamburger-btn { display: none; }

  .tag:focus,
  .filter-select:focus,
  .theme-toggle:focus,
  .hamburger-btn:focus,
  .mobile-menu-link:focus,
  .mobile-menu-close:focus {
    outline: 3px solid currentColor;
    outline-offset: 2px;
  }
}

/* Print styles */
@media print {
  .header-wrapper,
  .mobile-menu,
  .mobile-menu-backdrop,
  .filters,
  .theme-toggle,
  .hamburger-btn { display: none; }

  .snippet-card {
    page-break-inside: avoid;
  }
}
\n\n/* Hide Theme Toggle completely */\n.theme-toggle { display: none !important; }\n\n\n/* Navbar fixes */\n.navbar { background: var(--bg-card); border-bottom: 1px solid var(--border); box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }\n