html {
  scroll-padding-top: 70px; /* Add extra padding for anchor links to account for fixed header */
  scroll-behavior: smooth; /* Enable smooth scrolling */
}

body {
  font-family: 'Poppins', sans-serif;
  padding-top: 60px; /* Add padding to account for the fixed header height */
}

/* Main background gradient */
.futuristic-bg {
  background: linear-gradient(135deg, #0f2027 0%, #2c5364 50%, #232526 100%);
  min-height: 100vh;
}

/* Glassmorphism effect for cards */
.glassmorphism-card {
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Apple-style fullscreen mobile menu */
#mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999 !important; /* Highest z-index to ensure it's on top */
  isolation: isolate; /* Creates a new stacking context */
  width: 100vw !important; /* Force full viewport width */
  height: 100vh !important; /* Force full viewport height */
  transform: translateY(0);
  transition: opacity 0.3s ease, visibility 0.3s ease;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.glow-btn {
  box-shadow: 0 0 16px 4px #f472b6, 0 0 32px 8px #06b6d4;
}

.animate-fade-in {
  animation: fadeIn 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(40px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Loading spinner */
.loader {
  border: 4px solid rgba(0, 0, 0, 0.1);
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border-left-color: #3490dc;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Background blob animations */
@keyframes pulse-slow {

  0%,
  100% {
    opacity: 0.2;
    transform: scale(1);
  }

  50% {
    opacity: 0.3;
    transform: scale(1.05);
  }
}

@keyframes pulse-slower {

  0%,
  100% {
    opacity: 0.15;
    transform: scale(0.95);
  }

  50% {
    opacity: 0.25;
    transform: scale(1);
  }
}

@keyframes pulse-slowest {

  0%,
  100% {
    opacity: 0.1;
    transform: scale(1);
  }

  50% {
    opacity: 0.2;
    transform: scale(1.03);
  }
}

.animate-pulse-slow {
  animation: pulse-slow 8s infinite ease-in-out;
}

.animate-pulse-slower {
  animation: pulse-slower 10s infinite ease-in-out;
}

.animate-pulse-slowest {
  animation: pulse-slowest 12s infinite ease-in-out;
}

.animation-delay-2000 {
  animation-delay: 2s;
}

.animation-delay-4000 {
  animation-delay: 4s;
}

/* Icon hover animations */
@keyframes icon-pop {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.4);
  }
}

.animate-icon-pop {
  animation: icon-pop 0.3s ease-in-out;
}

/* Custom scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #1f2937;
}

::-webkit-scrollbar-thumb {
  background: #3b82f6;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #2563eb;
}

/* Blinking cursor animation */
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

.animate-blink {
  animation: blink 1s step-end infinite;
}

/* Terminal styling */
.terminal-header,
.terminal-body {
  width: 100%;
  box-shadow: 0 0 15px rgba(0, 100, 255, 0.3);
  border: 1px solid rgba(0, 140, 255, 0.3);
}

/* Enhanced terminal text responsiveness */
.terminal-body {
  min-height: 60px;
}

#typed-text {
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  line-height: 1.2;
}

/* Responsive font sizes for terminal text */
@media (max-width: 640px) {
  .terminal-body {
    font-size: 1.75rem;
  }
  
  .terminal-body .text-2xl {
    font-size: 1.75rem;
  }
  
  .terminal-body .text-green-500 {
    font-size: 1.75rem;
  }
}

@media (min-width: 641px) and (max-width: 768px) {
  .terminal-body {
    font-size: 2rem;
  }
  
  .terminal-body .text-2xl {
    font-size: 2rem;
  }
  
  .terminal-body .text-green-500 {
    font-size: 2rem;
  }
}

@media (min-width: 769px) {
  .terminal-body {
    font-size: 2.5rem;
  }
  
  .terminal-body .text-3xl {
    font-size: 2.75rem;
  }
  
  .terminal-body .text-green-500 {
    font-size: 2.5rem;
  }
}

/* Light mode specific styles */
:root:not(.dark) .terminal-header {
  background-color: rgba(30, 41, 59, 0.95);
  color: #10b981;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(30, 41, 59, 0.8);
}

:root:not(.dark) .terminal-body {
  background-color: rgba(30, 41, 59, 0.9);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(30, 41, 59, 0.8);
  border-top: none;
}

:root:not(.dark) #typed-text {
  background: linear-gradient(to right, #60a5fa, #93c5fd);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

:root:not(.dark) #cursor {
  color: #60a5fa;
}

/* Windows terminal controls */
.win-controls {
  display: flex;
  gap: 1px;
}

.win-control {
  width: 46px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.win-control:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.win-control.close:hover {
  background-color: #e81123;
}

.win-control.close:hover i {
  color: white;
}

.terminal-title {
  font-family: 'Consolas', monospace;
  font-size: 0.9em;
  font-weight: normal;
  letter-spacing: 0.5px;
}

/* Terminal icon */
.terminal-icon {
  margin-right: 6px;
  margin-left: 10px;
  font-size: 0.9em;
}

/* Additional animation for the terminal elements */
.terminal-header,
.terminal-body {
  position: relative;
  overflow: hidden;
}

.terminal-header::before,
.terminal-body::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 3px;
  background: linear-gradient(to right, transparent, #3b82f6, transparent);
  animation: scan-line 3s linear infinite;
}

/* Enhanced scan-line for light mode */
:root:not(.dark) .terminal-header::before,
:root:not(.dark) .terminal-body::before {
  background: linear-gradient(to right, transparent, #2563eb, transparent);
  height: 2px;
  box-shadow: 0 0 8px #2563eb;
}

@keyframes scan-line {
  0% {
    left: -100%;
  }

  100% {
    left: 100%;
  }
}

/* Enhanced Light Mode Styles */
:root:not(.dark) body {
  background: linear-gradient(135deg, #f0f9ff 0%, #e6f7ff 50%, #f0f4ff 100%);
}

/* Light mode section enhancements */
:root:not(.dark) #about {
  background: linear-gradient(120deg, #f0f9ff 0%, #e1f1ff 35%, #dce8ff 100%);
  position: relative;
  overflow: hidden;
}

:root:not(.dark) #about::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%233b82f6' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
  z-index: -1;
}

:root:not(.dark) #skills,
:root:not(.dark) #education,
:root:not(.dark) #experience,
:root:not(.dark) #contact {
  background: linear-gradient(120deg, #ffffff 0%, #f8faff 100%);
  position: relative;
}

:root:not(.dark) #projects {
  background: linear-gradient(120deg, #f0f7ff 0%, #e6f0ff 100%);
  position: relative;
}

/* Enhanced card styling for light mode */
:root:not(.dark) .glassmorphism-card {
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.18);
  backdrop-filter: blur(7px);
}

/* Patterned backgrounds for light mode sections */
:root:not(.dark) #skills::before,
:root:not(.dark) #education::before,
:root:not(.dark) #experience::before,
:root:not(.dark) #contact::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.4;
  z-index: 0;
}

/* Enhanced light mode buttons */
:root:not(.dark) .glow-btn {
  box-shadow: 0 0 16px 4px rgba(59, 130, 246, 0.4), 0 0 32px 8px rgba(6, 182, 212, 0.2);
}

/* Enhanced light mode animations */
:root:not(.dark) .animate-pulse-slow,
:root:not(.dark) .animate-pulse-slower,
:root:not(.dark) .animate-pulse-slowest {
  opacity: 0.7;
}

/* Enhanced background blobs for light mode */
:root:not(.dark) .bg-blue-300 {
  background: linear-gradient(120deg, #93c5fd, #60a5fa);
}

:root:not(.dark) .bg-purple-300 {
  background: linear-gradient(120deg, #c4b5fd, #a78bfa);
}

:root:not(.dark) .bg-pink-300 {
  background: linear-gradient(120deg, #f9a8d4, #f472b6);
}

/* Fix button border glitches in dark mode */
.dark .glow-btn {
  border: 2px solid rgba(59, 130, 246, 0.4);
  box-shadow: 0 0 16px 4px rgba(147, 197, 253, 0.4), 0 0 32px 8px rgba(6, 182, 212, 0.2);
}

/* Fix for dark mode toggle button border */
.dark #darkModeToggle {
  border: 4px solid rgba(59, 130, 246, 0.4);
}

/* Enhanced button styling to fix border glitches */
.btn-primary {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: inherit;
  border-radius: inherit;
  z-index: -1;
}

/* Enhanced header styling */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(59, 130, 246, 0.2);
  z-index: 50;
}

/* Header background pattern */
header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%233B82F6' fill-opacity='0.05'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.8;
  z-index: -1;
}

/* Site title animations */
.site-title {
  position: relative;
  overflow: hidden;
  display: inline-block;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 100%;
}

.site-title::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shine 5s infinite;
}

@keyframes shine {
  0% { left: -100%; }
  20% { left: 100%; }
  100% { left: 100%; }
}

/* Nav links with animated bottom border on hover */
.nav-link {
  position: relative;
  padding-bottom: 2px;
}

.nav-link::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-image: linear-gradient(to right, #3b82f6, #60a5fa);
  transition: width 0.3s ease-in-out;
}

.dark .nav-link::after {
  background-image: linear-gradient(to right, #60a5fa, #93c5fd);
}

.nav-link:hover::after {
  width: 100%;
}

/* Custom styles for screens around 641px wide */
@media (min-width: 636px) and (max-width: 646px) {
  #mobile-menu {
    width: 100vw !important;
    right: auto !important;
    left: 0 !important;
  }
  
  .header-container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* Make sure the mobile menu displays correctly on small screens */
@media (max-width: 640px) {
  #mobile-menu {
    width: 100vw !important;
    height: 100vh !important;
    left: 0 !important;
    top: 0 !important;
    border: none;
    max-height: 100vh;
    overflow-y: auto;
  }
  
  /* Prevent text overflow on small screens */
  h1, h2, h3, p, span, a, div {
    overflow-wrap: break-word;
    word-wrap: break-word;
    -ms-word-break: break-all;
    word-break: break-word;
    hyphens: auto;
  }
}

/* Mobile menu animations and styling */
#mobile-menu {
  z-index: 9999 !important; /* Higher than other elements */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

#mobile-menu.visible {
  opacity: 1;
  visibility: visible;
}

/* Apple-style menu link animations */
#mobile-menu a {
  position: relative;
  display: inline-block;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), color 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0.9;
  transform: translateY(10px);
}

#mobile-menu.visible a {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.1s;
}

#mobile-menu a:nth-child(2) { transition-delay: 0.15s; }
#mobile-menu a:nth-child(3) { transition-delay: 0.2s; }
#mobile-menu a:nth-child(4) { transition-delay: 0.25s; }
#mobile-menu a:nth-child(5) { transition-delay: 0.3s; }
#mobile-menu a:nth-child(6) { transition-delay: 0.35s; }
#mobile-menu a:nth-child(7) { transition-delay: 0.4s; }

#mobile-menu a:hover {
  transform: translateX(10px);
  transition-delay: 0s;
}

#mobile-menu a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-image: linear-gradient(to right, #3b82f6, #60a5fa);
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#mobile-menu a:hover::after {
  width: 100%;
}

/* Extra small screens fixes */
@media (max-width: 478px) {
  .header-container {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  
  .site-title {
    font-size: 1rem;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  /* Handle any text that might overflow in the header */
  .header-text-container {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100% - 120px); /* Account for buttons on the right */
  }
  
  #mobile-menu-button, 
  #mobile-achievements-button {
    position: relative;
    z-index: 51; /* Below mobile menu but above other content */
  }
  
  /* Apple-style mobile menu for small screens */
  #mobile-menu {
    padding: 1rem;
    width: 100vw !important;
    height: 100vh !important;
    left: 0 !important;
    top: 0 !important;
  }
  
  #mobile-menu a {
    font-size: 1.5rem;
    padding: 0.75rem 0;
  }
}
