/* ===== CSS Variables ===== */
:root {
  --background: hsl(220, 20%, 7%);
  --foreground: hsl(210, 20%, 95%);
  --card: hsl(220, 18%, 10%);
  --card-foreground: hsl(210, 20%, 95%);
  --primary: hsl(158, 64%, 52%);
  --primary-foreground: hsl(220, 20%, 7%);
  --secondary: hsl(220, 18%, 16%);
  --secondary-foreground: hsl(210, 20%, 90%);
  --muted: hsl(220, 15%, 15%);
  --muted-foreground: hsl(215, 15%, 55%);
  --accent: hsl(35, 100%, 60%);
  --accent-foreground: hsl(220, 20%, 7%);
  --border: hsl(220, 15%, 18%);
  --ring: hsl(158, 64%, 52%);
  --radius: 0.75rem;
  --shadow-glow: 0 0 40px hsla(158, 64%, 52%, 0.15);
  --shadow-card: 0 8px 32px hsla(0, 0%, 0%, 0.4);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

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

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

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

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

/* ===== Typography ===== */
.mono-text {
  font-family: 'JetBrains Mono', monospace;
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 288px;
  height: 100vh;
  background: linear-gradient(180deg, var(--card) 0%, hsla(220, 18%, 8%, 0.95) 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 40;
  overflow: hidden;
}

.sidebar-header {
  padding: 2rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sidebar-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.sidebar-title h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--foreground);
}

.sidebar-title p {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.sidebar-nav {
  flex: 1;
  padding: 1.5rem 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  color: var(--muted-foreground);
  font-size: 0.9rem;
  font-weight: 500;
  border-left: 2px solid transparent;
}

.nav-item:hover {
  color: var(--foreground);
  background: var(--secondary);
  padding-left: 1.25rem;
  border-left-color: var(--primary);
}

.nav-item.active {
  color: var(--primary);
  background: hsla(158, 64%, 52%, 0.1);
  padding-left: 1.25rem;
  border-left-color: var(--primary);
}

.nav-item-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.sidebar-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border);
}

.sidebar-footer p {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* ===== Mobile Header ===== */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: hsla(220, 18%, 10%, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid hsla(220, 15%, 18%, 0.5);
  z-index: 50;
  padding: 0 1rem;
  align-items: center;
  justify-content: space-between;
}

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

.mobile-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.mobile-title {
  font-weight: 600;
  color: var(--foreground);
}

.menu-toggle {
  padding: 0.5rem;
  background: var(--secondary);
  border: none;
  border-radius: var(--radius);
  color: var(--foreground);
  cursor: pointer;
  transition: all 0.2s ease;
}

.menu-toggle:hover {
  background: var(--muted);
}

.menu-icon, .close-icon {
  width: 20px;
  height: 20px;
}

.hidden {
  display: none !important;
}

/* ===== Mobile Menu ===== */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 45;
  padding-top: 64px;
}

.mobile-menu-backdrop {
  position: absolute;
  inset: 0;
  background: hsla(220, 20%, 7%, 0.8);
  backdrop-filter: blur(4px);
}

.mobile-menu-content {
  position: relative;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  max-height: 60vh;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  animation: slideDown 0.3s ease-out;
}

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

/* ===== Main Content ===== */
.main-content {
  margin-left: 288px;
  min-height: 100vh;
  position: relative;
}

/* ===== Top Bar ===== */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: hsla(220, 20%, 7%, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid hsla(220, 15%, 18%, 0.5);
  padding: 1rem 2.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.search-container {
  position: relative;
  flex: 1;
  max-width: 28rem;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted-foreground);
}

.search-input {
  width: 100%;
  padding: 0.625rem 1rem 0.625rem 2.75rem;
  background: hsla(220, 18%, 16%, 0.5);
  border: 1px solid hsla(220, 15%, 18%, 0.5);
  border-radius: 0.75rem;
  font-size: 0.875rem;
  color: var(--foreground);
  outline: none;
  transition: all 0.3s ease;
}

.search-input::placeholder {
  color: var(--muted-foreground);
}

.search-input:focus {
  border-color: hsla(158, 64%, 52%, 0.5);
  box-shadow: 0 0 0 3px hsla(158, 64%, 52%, 0.1);
}

.results-count {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.count-badge {
  padding: 0.25rem 0.5rem;
  background: var(--secondary);
  border-radius: 0.375rem;
  font-size: 0.875rem;
}

/* ===== Category Header ===== */
.category-header {
  padding: 2rem 2.5rem 0;
  opacity: 0;
  animation: fadeUp 0.5s ease-out forwards;
}

.category-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--foreground);
  margin-bottom: 0.5rem;
}

.category-description {
  color: var(--muted-foreground);
  font-size: 1rem;
}

/* ===== Projects Grid ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
  padding: 2rem 2.5rem;
}

/* ===== Project Card ===== */
.project-card {
  background: hsla(220, 18%, 10%, 0.8);
  backdrop-filter: blur(20px);
  border: 1px solid hsla(220, 15%, 18%, 0.5);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  animation: fadeUp 0.5s ease-out forwards;
}

.project-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 20px 60px hsla(0, 0%, 0%, 0.5), var(--shadow-glow);
}

.card-image-container {
  position: relative;
  height: 180px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--secondary) 0%, var(--muted) 100%);
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.project-card:hover .card-image {
  transform: scale(1.1);
}

.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, hsla(220, 20%, 7%, 0.8) 0%, transparent 50%);
}

.card-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  background: hsla(220, 20%, 7%, 0.7);
  backdrop-filter: blur(8px);
  border-radius: 9999px;
  font-size: 0.75rem;
  color: var(--primary);
}

.badge-icon {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
}

.card-content {
  padding: 1.5rem;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 0.5rem;
}

.card-description {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  line-height: 1.6;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.tag {
  padding: 0.25rem 0.625rem;
  background: var(--secondary);
  border-radius: 0.375rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  font-family: 'JetBrains Mono', monospace;
  transition: all 0.2s ease;
}

.tag:hover {
  background: var(--muted);
  color: var(--foreground);
}

.card-actions {
  display: flex;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 8px 20px hsla(158, 64%, 52%, 0.25);
}

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

.btn-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: hsla(220, 18%, 16%, 0.8);
  border-color: hsla(158, 64%, 52%, 0.5);
}

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

.btn-icon {
  width: 16px;
  height: 16px;
}

/* ===== Background Decorations ===== */
.bg-decoration {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: -1;
}

.bg-decoration-1 {
  top: 0;
  right: 0;
  width: 600px;
  height: 600px;
  background: hsla(158, 64%, 52%, 0.05);
}

.bg-decoration-2 {
  bottom: 0;
  left: 288px;
  width: 400px;
  height: 400px;
  background: hsla(35, 100%, 60%, 0.05);
}

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

/* Stagger animations */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .sidebar {
    display: none;
  }

  .mobile-header {
    display: flex;
  }

  .main-content {
    margin-left: 0;
    padding-top: 64px;
  }

  .top-bar {
    padding: 1rem 1.5rem;
  }

  .category-header {
    padding: 1.5rem 1.5rem 0;
  }

  .projects-grid {
    padding: 1.5rem;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }

  .results-count {
    display: none;
  }

  .bg-decoration-2 {
    left: 0;
  }
}

@media (max-width: 640px) {
  .projects-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .category-title {
    font-size: 1.5rem;
  }

  .card-actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}
