/* public/style.css */
body:before {
  content: "";
  position: fixed;
  z-index: 0;
  pointer-events: none;
  will-change: transform;
  background: radial-gradient(circle at 20%, #a855f70d 0%, #0000 50%), radial-gradient(circle at 80% 80%, #00f5ff0d 0%, #0000 50%), radial-gradient(circle at 40% 20%, #ec489908 0%, #0000 50%);
  width: 200%;
  height: 200%;
  top: -50%;
  left: -50%;
}

[data-theme="dark"] body:before {
  animation: gradientShift 20s ease infinite;
}

@keyframes gradientShift {
  0%, 100% {
    transform: translate(0)rotate(0);
  }

  33% {
    transform: translate(5%, 5%)rotate(120deg);
  }

  66% {
    transform: translate(-5%, 5%)rotate(240deg);
  }
}

.mobile-menu-backdrop {
  position: fixed;
  backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  background: #0009;
  width: 100%;
  height: 100%;
  transition: all .3s;
  top: 0;
  left: 0;
}

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

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

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

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

.mobile-menu-logo {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  -webkit-text-fill-color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  margin-bottom: .5rem;
  font-size: 1.5rem;
  font-weight: 700;
}

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

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

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

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

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

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

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

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

.hamburger-btn {
  display: none;
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  border: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  justify-content: center;
  align-items:  center;
  width: 42px;
  height: 42px;
  transition: all .2s;
  font-size: 1.25rem;
}

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

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

.search-box {
  position: relative;
  flex: 1;
  max-width: 500px;
}

.search-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 12px;
  width: 100%;
  padding: .75rem 1rem .75rem 3rem;
  transition: all .3s;
  font-family: Space Grotesk, sans-serif;
  font-size: .95rem;
}

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

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

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

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

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

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

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

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

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

.gradient-text {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  -webkit-text-fill-color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.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);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  padding: 1.5rem;
  transition: all .3s;
}

.snippet-card:before {
  content: "";
  position: absolute;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
  transform-origin: left;
  height: 3px;
  transition: transform .3s;
  top: 0;
  left: 0;
  right: 0;
  transform: scaleX(0);
}

.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 #00f5ff26;
}

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

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

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

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

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

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

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

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

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

.snippet-action {
  display: flex;
  color: var(--accent-cyan);
  align-items:  center;
  gap: .5rem;
  transition: gap .2s;
  font-size: .9rem;
  font-weight: 500;
}

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

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

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

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

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

[data-theme="light"] .snippet-card {
  background: var(--bg-card);
  box-shadow: 0 1px 3px #0000001a;
}

[data-theme="light"] .snippet-card:hover {
  box-shadow: 0 8px 16px #00000026;
}

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

[data-theme="light"] .language-badge {
  color: #0070f3;
  background: #0070f31a;
}

@media (max-width: 768px) {
  .hamburger-btn {
    display: flex;
  }

  .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;
  }
}

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

  body:before {
    animation: none;
  }
}

@media (prefers-contrast: high) {
  .snippet-card, .tag, .filter-select, .theme-toggle, .hamburger-btn {
    border-width: 2px;
  }

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

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

  .snippet-card {
    page-break-inside: avoid;
  }
}
