:root {
  --neon-green: #00ff6a;
  --dark-background: #0a0b1a;
  --card-background: #131625;
  --input-background: #1e2433;
}

body {
  background-color: var(--dark-background);
  color: #e2e8f0;
  font-family: "Inter", sans-serif;
  overflow-x: hidden;
}

/* Subtle Matrix Rain Background */
.min-h-screen {
  position: relative;
  background-color: var(--dark-background);
  z-index: 0;
  overflow: hidden;
}

.min-h-screen::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  z-index: -100; /* Extremely low z-index to stay behind all content */
  pointer-events: none; /* Ensures clicks pass through */
  opacity: 0.15; /* Very faint */
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="200" viewBox="0 0 100 200"><g fill="%2300ff6a" opacity="0.7"><text x="10" y="10" font-family="monospace" font-size="10">01</text><text x="30" y="70" font-family="monospace" font-size="10">10</text><text x="50" y="40" font-family="monospace" font-size="10">01</text><text x="70" y="90" font-family="monospace" font-size="10">10</text><text x="90" y="30" font-family="monospace" font-size="10">01</text><text x="15" y="50" font-family="monospace" font-size="10">00</text><text x="35" y="20" font-family="monospace" font-size="10">11</text><text x="55" y="80" font-family="monospace" font-size="10">00</text><text x="75" y="60" font-family="monospace" font-size="10">11</text><text x="5" y="100" font-family="monospace" font-size="10">10</text><text x="25" y="120" font-family="monospace" font-size="10">01</text><text x="45" y="150" font-family="monospace" font-size="10">10</text><text x="65" y="180" font-family="monospace" font-size="10">01</text><text x="85" y="130" font-family="monospace" font-size="10">10</text></g></svg>');
  animation: matrixRain 120s linear infinite;
}

.min-h-screen::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%; 
  background: radial-gradient(circle at 50% 50%, 
              rgba(0, 255, 106, 0.02) 0%, 
              transparent 70%);
  z-index: -99; 
  pointer-events: none;
}

@keyframes matrixRain {
  0% {
    background-position: 0 -1000px;
  }
  100% {
    background-position: 500px 1000px; /* Diagonal movement */
  }
}

.section-pop {
  box-shadow: 0 0 10px rgba(0, 255, 106, 0.2), 0 0 20px rgba(0, 255, 106, 0.1);
  border: 1px solid rgba(0, 255, 106, 0.1);
  position: relative;
  overflow: hidden;
}

.section-pop::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(0, 255, 106, 0.1) 0%,
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.5s ease;
}

.section-pop:hover::before {
  opacity: 1;
}

.glass-card {
  background: rgba(19, 22, 37, 0.7);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(0, 255, 106, 0.1);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.glass-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    120deg,
    transparent,
    rgba(0, 255, 106, 0.2),
    transparent
  );
  transition: all 0.6s ease;
}

.glass-card:hover::after {
  left: 100%;
}

.neon-text {
  text-shadow: 0 0 2px var(--neon-green), 0 0 5px var(--neon-green),
    0 0 10px rgba(0, 255, 106, 0.5), 0 0 20px rgba(0, 255, 106, 0.3);
  transition: all 0.3s ease;
}

.neon-text:hover {
  text-shadow: 0 0 4px var(--neon-green), 0 0 8px var(--neon-green),
    0 0 15px rgba(0, 255, 106, 0.7), 0 0 25px rgba(0, 255, 106, 0.5);
}

.input-style {
  background-color: var(--input-background);
  border-color: rgba(0, 255, 106, 0.2);
  transition: all 0.3s ease;
}

.input-style:focus {
  border-color: var(--neon-green);
  box-shadow: 0 0 10px rgba(0, 255, 106, 0.2), 0 0 20px rgba(0, 255, 106, 0.1);
}

.hover-lift {
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hover-lift:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 15px 30px rgba(0, 255, 106, 0.2);
}

nav ul li a {
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

nav ul li a::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(0, 255, 106, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease;
}

nav ul li a:hover::before {
  width: 200%;
  height: 200%;
}

nav ul li a:hover {
  box-shadow: 0 0 10px rgba(0, 255, 106, 0.2), 0 0 20px rgba(0, 255, 106, 0.1);
  border: 1px solid rgba(0, 255, 106, 0.1);
  background-color: var(--neon-green);
  color: var(--dark-background);
}

#projects .glass-card:hover,
#skills .glass-card:hover,
#blog .glass-card:hover,
#recent-blogs .glass-card:hover,
#why-connect .glass-card:hover {
  background: rgba(0, 255, 106, 0.2);
  box-shadow: 0 0 15px rgba(0, 255, 106, 0.3), 0 0 25px rgba(0, 255, 106, 0.2),
    0 0 35px rgba(0, 255, 106, 0.1);
  transform: translateY(-5px) rotate(1deg);
}

#contact svg {
  transition: all 0.3s ease;
}

#contact svg:hover {
  transform: scale(1.2) rotate(5deg);
  filter: drop-shadow(0 0 10px rgba(0, 255, 106, 0.5));
}

footer {
  position: relative;
}

footer p {
  transition: all 0.3s ease;
}

footer p:hover {
  transform: scale(1.05);
  text-shadow: 0 0 10px rgba(0, 255, 106, 0.5);
}

header svg {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.hacker-card {
  background: #0a0e1a;
  border: 1px solid rgba(0, 255, 106, 0.3);
  box-shadow: 0 0 10px rgba(0, 255, 106, 0.2),
    0 0 20px rgba(0, 255, 106, 0.1);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.hacker-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
      0deg,
      transparent,
      transparent 10px,
      rgba(0, 255, 106, 0.05) 10px,
      rgba(0, 255, 106, 0.05) 11px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 10px,
      rgba(0, 255, 106, 0.05) 10px,
      rgba(0, 255, 106, 0.05) 11px
    );
  opacity: 0.5;
  pointer-events: none;
}

.hacker-card:hover {
  transform: scale(1.02);
  box-shadow: 0 0 15px rgba(0, 255, 106, 0.4),
    0 0 30px rgba(0, 255, 106, 0.2);
  border-color: rgba(0, 255, 106, 0.5);
}

.hacker-card h1,
.hacker-card h2,
.hacker-card h3 {
  text-shadow: 0 0 5px rgba(0, 255, 106, 0.5), 0 0 10px rgba(0, 255, 106, 0.3);
}

.hacker-card pre {
  background: #1a1e2b;
  border: 1px solid rgba(0, 255, 106, 0.2);
  box-shadow: inset 0 0 10px rgba(0, 255, 106, 0.1);
  font-family: "Roboto Mono", monospace;
}

.prose-invert {
  --tw-prose-body: #d1d5db;
  --tw-prose-headings: #ffffff;
  --tw-prose-links: var(--neon-green);
  --tw-prose-code: #00ff6a;
  --tw-prose-pre-bg: #1a1e2b;
  --tw-prose-pre-code: #d1d5db;
  --tw-prose-bullets: #9ca3af;
}

.page-wrapper {
  background-color: var(--dark-background, #0a0e1a);
  min-height: 100vh;
}

/* Navigation Menu Styles for Mobile */
.nav-menu {
  position: fixed;
  top: 0;
  right: -100%;
  height: 100vh;
  width: 75%;
  background: #0a0e1a;
  border-left: 1px solid rgba(0, 255, 106, 0.3);
  box-shadow: -5px 0 15px rgba(0, 255, 106, 0.2);
  transition: right 0.3s ease-in-out, opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
  z-index: 50;
  padding: 2rem;
  display: none;
  opacity: 0;
  transform: scale(0.95);
}

.nav-menu.open {
  right: 0;
  display: block;
  opacity: 1;
  transform: scale(1);
}

.nav-menu ul {
  margin-top: 1.5rem;
  padding: 0;
}

.nav-menu li {
  margin-bottom: 0.75rem;
  position: relative;
}

.nav-menu li:not(:last-child)::after {
  content: '';
  position: absolute;
  bottom: -0.25rem;
  left: 1rem;
  right: 1rem;
  height: 1px;
  background: rgba(0, 255, 106, 0.1);
}

.nav-menu a {
  color: #d1d5db;
  font-size: 1.25rem;
  transition: color 0.3s ease, background 0.3s ease;
  display: block;
  padding: 0.75rem 1rem;
  border-radius: 0.25rem;
}

.nav-menu a:hover {
  color: var(--neon-green);
  background: rgba(0, 255, 106, 0.1);
}

/* Hamburger Icon Animation */
#menu-toggle {
  position: relative;
  width: 2rem;
  height: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.4rem;
}

#menu-toggle svg {
  display: none; /* Hide the default SVG */
}

#menu-toggle span {
  display: block;
  width: 100%;
  height: 3px;
  background: var(--neon-green);
  transition: all 0.3s ease;
  position: relative;
  box-shadow: 0 0 5px rgba(0, 255, 106, 0.5);
}

#menu-toggle span:nth-child(2) {
  width: 70%; /* Middle line slightly shorter for visual appeal */
}

#menu-toggle.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
  box-shadow: 0 0 10px rgba(0, 255, 106, 0.7);
}

#menu-toggle.open span:nth-child(2) {
  opacity: 0;
}

#menu-toggle.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
  box-shadow: 0 0 10px rgba(0, 255, 106, 0.7);
}

/* Navigation Menu Styles with Glow Effect */
.nav-menu {
  position: fixed;
  top: 0;
  right: -100%;
  height: 100vh;
  width: 75%;
  background: #0a0e1a;
  border-left: 1px solid rgba(0, 255, 106, 0.3);
  box-shadow: -5px 0 15px rgba(0, 255, 106, 0.2);
  transition: right 0.3s ease-in-out, opacity 0.3s ease-in-out, transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
  z-index: 50;
  padding: 2rem;
  display: none;
  opacity: 0;
  transform: scale(0.95);
}

.nav-menu.open {
  right: 0;
  display: block;
  opacity: 1;
  transform: scale(1);
  box-shadow: -10px 0 25px rgba(0, 255, 106, 0.4), -15px 0 35px rgba(0, 255, 106, 0.2);
  border-left: 2px solid var(--neon-green);
}

/* Navigation Link Effects for Mobile */
.nav-menu a {
  position: relative;
  transition: transform 0.3s ease, color 0.3s ease, background 0.3s ease, text-shadow 0.3s ease;
}

.nav-menu a:hover {
  transform: scale(1.05);
  color: var(--neon-green);
  background: rgba(0, 255, 106, 0.1);
  text-shadow: 0 0 5px rgba(0, 255, 106, 0.5);
}

/* Desktop Styles with Glowing Underline Effect */
@media (min-width: 768px) {
  .nav-menu {
    position: static;
    width: auto;
    height: auto;
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
    display: flex;
    opacity: 1;
    transform: none;
    transition: none;
  }

  .nav-menu.open {
    right: auto;
    display: flex;
  }

  .nav-menu ul {
    margin-top: 0;
  }

  .nav-menu li {
    margin-bottom: 0;
  }

  .nav-menu li:not(:last-child)::after {
    display: none;
  }

  .nav-menu a {
    font-size: 1rem;
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.3s ease, text-shadow 0.3s ease;
  }

  /* Glowing Underline Effect on Hover */
  .nav-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--neon-green);
    box-shadow: 0 0 5px var(--neon-green), 0 0 10px rgba(0, 255, 106, 0.5);
    transition: width 0.3s ease;
  }

  .nav-menu a:hover::after {
    width: 100%;
  }

  .nav-menu a:hover {
    color: var(--neon-green);
    background: none; /* Remove background for desktop */
    text-shadow: 0 0 5px rgba(0, 255, 106, 0.5);
    transform: none; /* No scale effect on desktop */
  }

  /* Fallback to hide hamburger menu on desktop */
  #menu-toggle {
    display: none !important; /* Ensure hamburger menu is hidden on desktop */
  }
}

/* Backdrop Styles with Gradient Fade */
.menu-backdrop {
  opacity: 0;
  backdrop-filter: blur(0px);
  pointer-events: none;
  transition: opacity 0.3s ease-in-out, backdrop-filter 0.3s ease-in-out;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 255, 106, 0.1) 100%);
}

.menu-backdrop.open {
  opacity: 1;
  backdrop-filter: blur(4px);
  pointer-events: auto;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  .hacker-card {
    padding: 1.5rem;
  }

  .hacker-card h1 {
    font-size: 2.5rem;
  }

  .hacker-card .prose h2 {
    font-size: 1.5rem;
  }

  .hacker-card .prose h3 {
    font-size: 1.25rem;
  }

  .hacker-card .prose p {
    font-size: 0.9rem;
  }

  .hacker-card pre {
    font-size: 0.875rem;
    overflow-x: auto;
  }

  header {
    padding: 1rem;
  }

  main {
    padding: 1rem;
  }

  .section-pop {
    padding: 1.5rem;
  }

  h1 {
    font-size: 2.5rem;
  }

  h2 {
    font-size: 1.75rem;
  }

  h3 {
    font-size: 1.25rem;
  }

  p {
    font-size: 0.9rem;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .glass-card {
    padding: 0.75rem;
  }

  #contact {
    padding: 1.5rem;
  }

  #contact svg {
    height: 1.25rem;
    width: 1.25rem;
  }

  footer {
    padding: 1rem;
  }

  footer p {
    font-size: 0.875rem;
  }

  .prose-invert {
    --tw-prose-body: #d1d5db;
    --tw-prose-headings: #ffffff;
    --tw-prose-links: var(--neon-green);
    --tw-prose-code: #e5e7eb;
    --tw-prose-pre-bg: #1f2937;
    --tw-prose-pre-code: #d1d5db;
    --tw-prose-bullets: #9ca3af;
  }

  article.glass-card:hover {
    background: rgba(0, 255, 106, 0.2);
    box-shadow: 0 0 15px rgba(0, 255, 106, 0.3), 0 0 25px rgba(0, 255, 106, 0.2),
      0 0 35px rgba(0, 255, 106, 0.1);
    transform: translateY(-5px) rotate(1deg);
  }

  .prose pre {
    font-size: 0.875rem;
    overflow-x: auto;
  }
}

@media (max-width: 480px) {
  .hacker-card {
    padding: 1rem;
  }

  .hacker-card h1 {
    font-size: 2rem;
  }

  .hacker-card .prose h2 {
    font-size: 1.25rem;
  }

  .hacker-card .prose h3 {
    font-size: 1.125rem;
  }

  .hacker-card .prose p {
    font-size: 0.875rem;
  }
}

/* Skill Tree Visualization */
.skill-tree-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 0;
  position: relative;
}

.skill-tree-container::before {
  content: '';
  position: absolute;
  top: 90px; /* Increase this value to start below the main node */
  left: 50%;
  height: calc(100% - 120px); /* Adjust height to match the new starting point */
  width: 4px;
  background: linear-gradient(to bottom, var(--neon-green), rgba(0, 255, 106, 0.1));
  transform: translateX(-50%);
  z-index: 0;
  box-shadow: 0 0 10px rgba(0, 255, 106, 0.5);
}

.skill-branches {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  margin-top: 60px;
  position: relative;
}

.skill-branch {
  width: calc(50% - 2rem);
  margin: 1rem;
  position: relative;
  z-index: 1;
  isolation: isolate; /* Creates a new stacking context */
}

.skill-branch::before {
  content: '';
  position: absolute;
  top: -30px;
  left: 50%;
  width: 2px;
  height: 30px;
  background: var(--neon-green);
  transform: translateX(-50%);
  z-index: 0;
  box-shadow: 0 0 5px rgba(0, 255, 106, 0.5);
}

.skill-node {
  background: rgba(19, 22, 37, 0.8);
  border: 2px solid var(--neon-green);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
  transition: z-index 0.01s step-end, all 0.3s ease; /* Add z-index to transition */
  position: relative;
  z-index: 1; /* Default z-index */
  box-shadow: 0 0 10px rgba(0, 255, 106, 0.3);
  margin-bottom: 0; /* Remove bottom margin as we'll position the tooltip using transform instead */
}

.skill-node:hover {
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(0, 255, 106, 0.6);
  z-index: 20; /* Much higher z-index when hovered */
  cursor: pointer; /* Show pointer cursor to indicate interactivity */
}

.main-node {
  background: rgba(0, 255, 106, 0.2);
  margin-bottom: 30px; /* Increase spacing below main node */
  width: 200px;
  position: relative;
  z-index: 2; /* Ensure main node is above the vertical line */
}

.main-node::after {
  content: '';
  position: absolute;
  bottom: -15px; /* Position halfway into the gap */
  left: 50%;
  transform: translateX(-50%);
  width: 15px;
  height: 15px;
  background-color: var(--dark-background);
  border: 2px solid var(--neon-green);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(0, 255, 106, 0.7);
  z-index: 2;
}

.main-node .node-label {
  font-size: 1.25rem;
  font-weight: bold;
  color: var(--neon-green);
  text-shadow: 0 0 5px rgba(0, 255, 106, 0.5);
}

.node-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: white;
}

.skill-level {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.level-indicator {
  height: 100%;
  background: var(--neon-green);
  border-radius: 3px;
  box-shadow: 0 0 5px rgba(0, 255, 106, 0.7);
  animation: glow 2s infinite alternate;
}

@keyframes glow {
  from {
    box-shadow: 0 0 5px rgba(0, 255, 106, 0.7);
  }
  to {
    box-shadow: 0 0 10px rgba(0, 255, 106, 0.9), 0 0 15px rgba(0, 255, 106, 0.5);
  }
}

.skill-node[data-level="beginner"] .node-label::after {
  content: " (Beginner)";
  font-size: 0.75rem;
  opacity: 0.7;
}

.skill-node[data-level="intermediate"] .node-label::after {
  content: " (Intermediate)";
  font-size: 0.75rem;
  opacity: 0.7;
}

.skill-node[data-level="advanced"] .node-label::after {
  content: " (Advanced)";
  font-size: 0.75rem;
  opacity: 0.7;
}

/* Skill Tooltip Styles */
.skill-tooltip {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  min-width: 200px;
  max-width: 80%; 
  background: var(--card-background);
  border: 2px solid var(--neon-green);
  border-radius: 8px;
  padding: 12px 16px;
  color: white;
  font-size: 0.9rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
  z-index: 1000;
  box-shadow: 0 0 20px rgba(0, 255, 106, 0.5);
  text-align: center;
}

.skill-tooltip::before {
  content: attr(data-skill); /* Will display the skill name */
  display: block;
  font-weight: bold;
  margin-bottom: 8px;
  color: var(--neon-green);
  text-shadow: 0 0 5px rgba(0, 255, 106, 0.5);
}

@keyframes tooltipPulse {
  0% { box-shadow: 0 0 10px rgba(0, 255, 106, 0.5); }
  50% { box-shadow: 0 0 20px rgba(0, 255, 106, 0.8); }
  100% { box-shadow: 0 0 10px rgba(0, 255, 106, 0.5); }
}

.skill-node:hover .skill-tooltip {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(-10px);
  animation: tooltipPulse 2s infinite;
}

/* Responsive adjustment for tooltips */
@media (max-width: 768px) {
  .skill-tooltip {
    width: 90%;
    max-width: none;
    left: 5%;
    transform: translateX(0);
  }
  
  .skill-node:hover .skill-tooltip {
    transform: translateY(5px) translateX(0);
  }
  
  .skill-tooltip::before {
    left: 50%;
  }
}

@media (max-width: 768px) {
  .skill-branch {
    width: 100%;
  }
  
  .skill-tree-container::before {
    height: calc(100% - 80px);
  }
}

/* TryHackMe Badge Container */
.thm-badge-container {
  position: relative;
  background-color: rgba(10, 11, 26, 0.8); /* Dark background without glass effect */
  border: 1px solid rgba(0, 255, 106, 0.3);
  border-radius: 8px;
  padding: 1rem;
  margin: 0 auto; /* Center the container */
  max-width: 500px;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
}

.thm-badge-container:hover {
  box-shadow: 0 0 15px rgba(0, 255, 106, 0.6), 0 0 25px rgba(0, 255, 106, 0.2);
  transform: translateY(-5px);
  border-color: var(--neon-green);
}

.thm-badge-container iframe {
  border: none;
  width: 100%;
  height: 120px;
  max-width: 450px;
  display: block;
  margin: 0 auto;
}