/* 
  GLOBAL RESET & BASE
*/
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

:root {
  /* Light Theme Colors */
  --bg-gradient: linear-gradient(100deg, #ffffff, #f0f0f0, #e0e0e0);
  --text-color: #000000;
  --nav-bg: rgba(255, 255, 255, 0.85);
  --nav-text: #1abc9c;
  --nav-hover: #16a085;
  --section-bg: rgba(255, 255, 255, 0.7);
  --button-bg: #1abc9c;
  --button-hover: #16a085;
  --footer-bg: rgba(255, 255, 255, 0.5);
  --link-color: #1abc9c;
}

body {
  background: var(--bg-gradient);
  color: var(--text-color);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  padding-top: 60px; /* To accommodate fixed navbar */
  transition: background 0.5s ease, color 0.5s ease;
}

/* Dark Theme Overrides */
body.dark-mode {
  --bg-gradient: linear-gradient(100deg, #1a1a2e, #16213e, #0f3460);
  --text-color: #ffffff;
  --nav-bg: rgba(0, 0, 0, 0.85);
  --nav-text: #1abc9c;
  --nav-hover: #16a085;
  --section-bg: rgba(0, 0, 0, 0.7);
  --button-bg: #1abc9c;
  --button-hover: #16a085;
  --footer-bg: rgba(0, 0, 0, 0.5);
  --link-color: #1abc9c;
}

/* Scroll Progress Bar */
#scrollProgress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 5px;
  background-color: var(--nav-text);
  z-index: 1500;
  transition: width 0.25s ease-out;
}

/* Back to Top Button */
#backToTopBtn {
  display: none; /* Hidden by default */
  position: fixed;
  bottom: 40px;
  right: 40px;
  z-index: 99;
  font-size: 18px;
  border: none;
  outline: none;
  background-color: var(--button-bg);
  color: white;
  cursor: pointer;
  padding: 15px;
  border-radius: 50%;
  transition: background-color 0.3s, transform 0.3s;
}

#backToTopBtn:hover {
  background-color: var(--button-hover);
  transform: scale(1.1);
}

/* Navigation Bar */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  background: var(--nav-bg); /* Updated to use CSS variable */
  padding: 10px 20px;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 1.8rem; /* Increased font size */
  font-weight: bold;
  color: var(--nav-text); /* Updated to use CSS variable */
}

.nav-toggle {
  display: none;
  font-size: 1.8rem; /* Increased size for better visibility */
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 30px;
}

.nav-links li a {
  color: var(--nav-text); /* Updated to use CSS variable */
  text-decoration: none;
  font-weight: bold;
  font-size: 1.1rem;
  position: relative;
  transition: color 0.3s;
}

.nav-links li a::after {
  content: '';
  display: block;
  width: 0%;
  height: 2px;
  background: var(--nav-text); /* Updated to use CSS variable */
  transition: width 0.3s;
}

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

.nav-links li a:hover {
  color: var(--nav-hover); /* Updated to use CSS variable */
}

/* Light/Dark Mode Toggle Button */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  margin-left: 20px;
  color: var(--nav-text); /* Matches the nav text color */
  transition: transform 0.3s;
  display: flex;
  align-items: center;
}

.theme-toggle:hover {
  transform: rotate(20deg);
}

.theme-toggle svg,
.theme-toggle i {
  width: 24px;
  height: 24px;
  transition: transform 0.3s ease;
}

.theme-toggle .bi-moon {
  display: none; /* Hide moon icon by default */
}

body.dark-mode .bi-sun {
  display: none; /* Hide sun icon in dark mode */
}

body.dark-mode .bi-moon {
  display: inline; /* Show moon icon in dark mode */
}

/* Responsive Navigation */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    position: absolute;
    top: 60px; /* Adjusted to match navbar height */
    left: 0;
    width: 100%;
    background: var(--nav-bg); /* Updated to use CSS variable */
    flex-direction: column;
    align-items: center;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
  }

  .nav-links.active {
    max-height: 300px; /* Adjust as needed */
  }

  .nav-links li {
    margin: 15px 0;
  }

  .nav-links li a {
    font-size: 1.2rem; /* Larger font for mobile */
  }
}

/* HERO / INTRO SECTION */
.hero-section {
  text-align: center;
  padding: 120px 20px 60px; /* Increased top padding to accommodate navbar */
  background: var(--section-bg); /* Updated to use CSS variable */
  position: relative;
}

.hero-section h1 {
  font-size: 2.8rem;
  margin-bottom: 10px;
  text-shadow: 0 0 10px var(--nav-text), 0 0 20px var(--nav-text), 0 0 30px var(--nav-text);
}

.hero-section h2 {
  font-size: 1.8rem;
  margin-bottom: 20px;
  text-shadow: 0 0 10px var(--nav-text), 0 0 20px var(--nav-text), 0 0 30px var(--nav-text);
}

.hero-section #typed-text {
  font-size: 1.2rem;
  color: var(--nav-text); /* Updated to use CSS variable */
  margin-top: 10px;
  min-height: 30px; /* To prevent layout shift */
}

/* SECTION HEADINGS */
section h2 {
  font-size: 2rem;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--nav-text); /* Updated to use CSS variable */
  display: inline-block;
  padding-bottom: 5px;
}

/* GENERAL SECTION STYLES */
section {
  padding: 40px 20px;
  max-width: 900px;
  margin: 0 auto;
}

section p, section ul, section ol {
  font-size: 1.05rem;
  color: #d1d1d1;
}

section ul, section ol {
  margin-left: 20px;
  margin-top: 10px;
}

/* TECH STACK ICON GRID */
.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  margin-top: 20px;
}

.tech-icon {
  width: 60px;
  height: 60px;
  transition: transform 0.3s;
}

.tech-icon:hover {
  transform: scale(1.1);
}

/* PROJECTS SECTION */
.project {
  margin-bottom: 40px;
  background: rgba(0, 0, 0, 0.6); /* Slightly different background */
  padding: 20px;
  border-radius: 8px;
  position: relative;
}

.project-image {
  width: 100%;
  max-width: 600px; /* Reduced from 800px to 600px */
  height: auto;
  max-height: 300px; /* Constrain height */
  object-fit: contain; /* Maintain aspect ratio without cropping */
  border: 2px solid var(--nav-text); /* Updated to use CSS variable */
  border-radius: 8px;
  margin-bottom: 10px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-image:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.project-links {
  margin-top: 10px;
}

.project-links a,
.project-links button {
  display: inline-block;
  background-color: var(--button-bg); /* Updated to use CSS variable */
  color: #ffffff;
  padding: 10px 20px;
  margin-right: 10px;
  text-decoration: none;
  border-radius: 4px;
  transition: background-color 0.3s, box-shadow 0.3s, transform 0.2s;
  cursor: pointer;
  border: none;
  font-size: 1rem;
}

.project-links a:hover,
.project-links button:hover {
  background-color: var(--button-hover); /* Updated to use CSS variable */
  box-shadow: 0 0 10px var(--nav-text), 0 0 20px var(--nav-text); /* Updated to use CSS variable */
  transform: translateY(-2px);
}

/* CTA SECTION */
#cta {
  text-align: center;
  padding: 40px 20px;
  background-color: #16213e; /* Darker shade for distinction */
}

#cta h2 {
  font-size: 2rem;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--nav-text); /* Updated to use CSS variable */
  display: inline-block;
  padding-bottom: 5px;
}

#cta p {
  max-width: 600px;
  margin: 0 auto 30px;
  font-size: 1.05rem;
  color: #d1d1d1;
}

.cta-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
}

/* BUTTONS */
.btn {
  display: inline-block;
  background-color: var(--button-bg); /* Updated to use CSS variable */
  color: #ffffff;
  padding: 10px 20px;
  margin: 10px;
  text-decoration: none;
  border-radius: 4px;
  transition: background-color 0.3s, box-shadow 0.3s;
}

.btn:hover {
  background-color: var(--button-hover); /* Updated to use CSS variable */
  box-shadow: 0 0 10px var(--nav-text), 0 0 20px var(--nav-text); /* Updated to use CSS variable */
}

/* CONTACT SECTION */
#contact a {
  color: var(--link-color); /* Updated to use CSS variable */
  text-decoration: none;
}

#contact a:hover {
  text-decoration: underline;
}

/* Contact Form Styles */
.contact-form {
  display: flex;
  flex-direction: column;
  max-width: 600px;
  margin: 20px auto;
}

.contact-form label {
  margin-bottom: 5px;
  font-weight: bold;
}

.contact-form input,
.contact-form textarea {
  padding: 10px;
  margin-bottom: 15px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--nav-text); /* Updated to use CSS variable */
  outline: none;
  background-color: rgba(255, 255, 255, 0.2);
}

.contact-form button {
  align-self: flex-start;
  cursor: pointer;
}

/* FOOTER */
footer {
  text-align: center;
  padding: 20px;
  background: var(--footer-bg); /* Updated to use CSS variable */
  color: #aaaaaa;
  font-size: 0.9rem;
}

.social-icons {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 10px;
}

.social-icon {
  width: 30px;
  height: 30px;
  transition: transform 0.3s ease;
}

.social-icon:hover {
  transform: scale(1.1);
}

/* RESPONSIVE MEDIA QUERIES */
@media (max-width: 768px) {
  .nav-links {
    flex-direction: column;
    gap: 15px;
  }

  .hero-section {
    padding: 100px 20px 60px; /* Adjusted padding for smaller screens */
  }

  .hero-section h1 {
    font-size: 2rem;
  }
  
  .hero-section h2 {
    font-size: 1.5rem;
  }
  
  .hero-section p {
    font-size: 1rem;
  }

  .tech-stack {
    gap: 15px;
  }

  .tech-icon {
    width: 50px;
    height: 50px;
  }

  .project-image {
    max-width: 100%;
    max-height: 250px; /* Further constrain height on smaller screens */
  }

  .project-links a,
  .project-links button {
    padding: 8px 16px;
    font-size: 0.9rem;
  }

  .cta-buttons {
    flex-direction: column;
  }
  
  .cta-buttons .btn {
    margin: 5px 0;
    width: 100%;
    max-width: 300px;
  }
  
  .contact-form {
    padding: 0 20px;
  }
}

