@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes fadeOut {
  0% {
    opacity: 1;
    visibility: visible;
  }
  90% {
    opacity: 1;
    visibility: visible;
  }
  100% {
    opacity: 0;
    visibility: hidden;
  }
}

.loader {
  width: 80px;
  height: 80px;
  border: 5px solid rgba(79, 70, 229, 0.3);
  border-radius: 50%;
  border-top-color: #4f46e5;
  animation: spin 1s linear infinite;
}

.loading-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #121212;
  z-index: 9999;
  animation: fadeOut 10s forwards;
}

:root {
  --bg-primary: #121212;
  --bg-secondary: #1e1e1e;
  --text-primary: #ffffff;
  --text-secondary: #b3b3b3;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --card-bg: #252525;
  --border: #333333;
}

.light-mode {
  --bg-primary: #f8f9fa;
  --bg-secondary: #ffffff;
  --text-primary: #333333;
  --text-secondary: #555555;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --card-bg: #ffffff;
  --border: #e5e7eb;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
  transition: background-color 0.3s, color 0.3s;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header & Navigation */
header {
  background-color: var(--bg-secondary);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

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

.nav-links a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  position: relative;
  padding: 5px 0;
}

.nav-links a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--accent);
  transition: width 0.3s;
}

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

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--text-primary);
}

.download-btn {
  background-color: var(--accent);
  color: white;
  padding: 10px 20px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: 500;
  transition: background-color 0.3s;
}

.download-btn:hover {
  background-color: var(--accent-hover);
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--text-primary);
}

/* Main Content */
main {
  padding-top: 80px;
}

section {
  padding: 100px 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Home Section */
#home .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}

.home-content {
  flex: 1;
}

.greeting {
  font-size: 1.5rem;
  margin-bottom: 10px;
  color: var(--text-secondary);
}

.name {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.profession {
  font-size: 2rem;
  font-weight: 600;
  color: var(--accent);
  height: 50px;
  margin-bottom: 30px;
}

.home-buttons {
  display: flex;
  gap: 20px;
  margin-top: 30px;
}

.btn {
  padding: 12px 25px;
  border-radius: 5px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s;
}

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

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

.btn-secondary {
  background-color: transparent;
  color: var(--text-primary);
  border: 2px solid var(--accent);
}

.btn-secondary:hover {
  background-color: var(--accent);
  color: white;
}

.home-image {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.profile-img-container {
  position: relative;
  width: 350px;
  height: 350px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
  animation: float 6s ease-in-out infinite;
}

.profile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}

.profile-img-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, rgba(99, 102, 241, 0.3), transparent);
  z-index: 1;
}

.profile-img-container::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 30%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent);
  z-index: 1;
}

.profile-img-container:hover .profile-img {
  transform: scale(1.05);
}

.profile-frame {
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  border: 2px solid var(--accent);
  border-radius: 25px;
  z-index: -1;
  opacity: 0.7;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

/* Section Title */
.section-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 60px;
  text-align: center;
  position: relative;
}

.section-title::after {
  content: "";
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background-color: var(--accent);
}

/* About Section */
.about-content {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.about-text {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 30px;
}

.stats-container {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 40px;
}

.stat-box {
  background-color: var(--card-bg);
  border-radius: 10px;
  padding: 30px;
  text-align: center;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  flex: 1;
  min-width: 200px;
  transition: transform 0.3s;
}

.stat-box:hover {
  transform: translateY(-10px);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
}

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

/* Skills Section */
.skills-container {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
}

.skills-column {
  flex: 1;
  min-width: 300px;
}

.skills-title {
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 30px;
  color: var(--accent);
}

.soft-skills {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.skill-card {
  background-color: var(--card-bg);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s;
}

.skill-card:hover {
  transform: translateY(-5px);
}

.skill-icon {
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 15px;
}

.skill-name {
  font-weight: 600;
  margin-bottom: 10px;
}

.hard-skills {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 30px;
}

.skill-category {
  background-color: var(--card-bg);
  border-radius: 10px;
  padding: 25px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.category-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--accent);
}

.skill-list {
  list-style: none;
}

.skill-list li {
  margin-bottom: 10px;
  padding-left: 20px;
  position: relative;
}

.skill-list li::before {
  content: "•";
  color: var(--accent);
  font-size: 1.2rem;
  position: absolute;
  left: 0;
}

/* Contact Section */
.contact-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.contact-text {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 40px;
  color: var(--text-secondary);
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-top: 40px;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background-color: var(--card-bg);
  color: var(--accent);
  font-size: 1.8rem;
  transition: all 0.3s;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.social-link:hover {
  transform: translateY(-10px);
  background-color: var(--accent);
  color: white;
}

/* Scroll to top button */
.scroll-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background-color: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 999;
}

.scroll-top.active {
  opacity: 1;
  visibility: visible;
}

.scroll-top:hover {
  background-color: var(--accent-hover);
  transform: translateY(-5px);
}

.nav-links {
  display: none; /* Hidden by default on small screens */
  flex-direction: column; /* Stack links vertically when visible */
  position: fixed; /* Positions the menu over content */
  top: 80px; /* Adjust based on your header's actual height */
  left: 0;
  width: 100%;
  background-color: var(--bg-secondary);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  padding: 20px 0;
  border-top: 1px solid var(--border);
  z-index: 999; /* Ensure it's above other content */
}

.nav-links.active {
  display: flex; /* Show when 'active' class is toggled by JavaScript */
}

.nav-links a {
  padding: 10px 20px;
  text-align: center;
  width: 100%;
}

/* IMPORTANT CHANGE FOR DOWNLOAD BUTTON */
/* By default, hide the download button from the main nav bar on small screens. */
.nav-right .download-btn {
  display: none;
}

/* When the mobile menu is active, show the download button INSIDE the menu. */
.nav-links.active + .nav-right .download-btn, /* This specifically targets the btn if it were *after* nav-links */
.nav-links.active .download-btn {
  /* This targets if the button is nested *within* nav-links when open */
  display: block; /* Show the button as a block element */
  width: auto; /* Allow width to be natural */
  margin: 10px auto; /* Center it and add some vertical spacing */
}

/* Ensure the hamburger is always visible on mobile */
.hamburger {
  display: block; /* Show hamburger icon on small mobile screens */
}

/* Home Section Mobile Adjustments */
#home .container {
  flex-direction: column; /* Stack home content and image vertically */
  text-align: center; /* Center text for better mobile readability */
}

.home-image {
  order: -1; /* Place image above text on mobile */
  margin-bottom: 30px;
}

.name {
  font-size: 2.5rem; /* Adjust font size for mobile */
}

.profession {
  font-size: 1.5rem; /* Adjust font size for mobile */
  height: auto; /* Allow height to adjust based on content */
}

.home-buttons {
  flex-direction: column; /* Stack buttons vertically on mobile */
  gap: 15px;
}

/* About Section Mobile Adjustments */
.stats-container {
  flex-direction: column; /* Stack stat boxes vertically on mobile */
}

/* Skills Section Mobile Adjustments */
.skills-container {
  flex-direction: column; /* Stack skill columns (soft/hard) vertically on mobile */
}

.soft-skills,
.hard-skills {
  grid-template-columns: 1fr; /* Make skill categories single column */
}

.skill-card,
.skill-category {
  padding: 15px; /* Reduce padding for mobile */
}

.skills-title {
  text-align: center; /* Center skills titles */
}

/* Contact Section Mobile Adjustments */
.social-links {
  flex-wrap: wrap; /* Allow social links to wrap to next line */
  justify-content: center;
  gap: 15px;
}

.social-link {
  width: 50px; /* Smaller social icons for mobile */
  height: 50px;
  font-size: 1.5rem;
}

/* --- Tablet and Small Desktop Screens (min-width: 768px) --- */
@media screen and (min-width: 768px) {
  .container {
    padding: 0 30px; /* Slightly more horizontal padding than mobile */
  }

  /* Header & Navigation */
  nav {
    padding: 15px 0; /* Adjust header padding */
  }

  .nav-links {
    display: flex; /* Show nav links */
    flex-direction: row; /* Arrange links horizontally */
    position: static; /* Reset positioning (no longer fixed/absolute) */
    background: none; /* Remove background */
    box-shadow: none; /* Remove shadow */
    padding: 0;
    border-top: none;
    width: auto; /* Allow width to be determined by content */
  }

  .hamburger {
    display: none; /* Hide hamburger icon */
  }

  /* IMPORTANT CHANGE FOR DOWNLOAD BUTTON */
  /* For larger screens, show the download button in its regular nav-right position */
  .nav-right .download-btn {
    display: inline-block; /* Show download button on tablets and larger */
    margin: 0; /* Reset margin if any was applied for mobile */
  }

  /* Home Section */
  #home .container {
    flex-direction: row; /* Arrange content and image side-by-side */
    text-align: left;
  }

  .home-image {
    order: unset; /* Reset image order to default (usually right) */
    margin-bottom: 0;
  }

  .name {
    font-size: 3rem; /* Revert to larger font size */
  }

  .profession {
    font-size: 2rem; /* Revert to larger font size */
  }

  .home-buttons {
    flex-direction: row; /* Buttons side-by-side */
  }

  .profile-img-container {
    width: 300px; /* Adjust image container size for tablets */
    height: 300px;
  }

  /* About Section */
  .stats-container {
    flex-direction: row; /* Display stats in a row */
    justify-content: space-around;
  }

  /* Skills Section */
  .skills-container {
    flex-direction: row; /* Display skill columns side-by-side */
    gap: 30px;
  }

  .soft-skills {
    grid-template-columns: repeat(
      auto-fill,
      minmax(180px, 1fr)
    ); /* More compact grid for soft skills */
  }

  .hard-skills {
    grid-template-columns: repeat(
      auto-fill,
      minmax(220px, 1fr)
    ); /* More compact grid for hard skills */
  }

  .skill-card,
  .skill-category {
    padding: 20px; /* Restore padding */
  }

  /* Contact Section */
  .social-link {
    width: 60px; /* Slightly larger social icons */
    height: 60px;
    font-size: 1.6rem;
  }
}

/* --- Desktop Screens (min-width: 992px) --- */
@media screen and (min-width: 992px) {
  .container {
    max-width: 960px; /* Standard desktop container width */
    padding: 0 20px;
  }

  section {
    padding: 100px 0; /* More vertical padding for desktop sections */
  }

  .profile-img-container {
    width: 350px; /* Restore original image size */
    height: 350px;
  }

  .soft-skills {
    grid-template-columns: repeat(
      auto-fill,
      minmax(200px, 1fr)
    ); /* Original grid layout */
  }

  .hard-skills {
    grid-template-columns: repeat(
      auto-fill,
      minmax(250px, 1fr)
    ); /* Original grid layout */
  }
}

/* --- Large Desktop Screens (min-width: 1200px) --- */
@media screen and (min-width: 1200px) {
  .container {
    max-width: 1140px; /* Your largest desktop container width */
  }

  header {
    padding: 20px 0; /* Adjust header padding for consistency */
  }
}

/* --- Landscape orientation adjustments for very short screens (max-height: 500px) --- */
/* This is for devices like small phones rotated sideways. */
@media screen and (max-height: 500px) and (orientation: landscape) {
  main {
    padding-top: 50px; /* Reduce top padding to account for header */
    padding-bottom: 20px;
  }

  section {
    min-height: auto; /* Allow sections to shrink if content is taller */
    padding: 40px 0; /* Reduce vertical padding */
  }

  #home .container {
    flex-direction: row; /* Ensure side-by-side layout in landscape */
    align-items: center;
  }

  .home-content {
    flex: 1;
    min-width: 50%; /* Give content more space */
  }
  .home-image {
    flex: 1;
    min-width: 50%;
  }

  .profile-img-container {
    width: 200px; /* Further reduce image size for very short screens */
    height: 200px;
  }

  .name {
    font-size: 1.8rem;
  }
  .profession {
    font-size: 1rem;
    height: auto;
  }

  .home-buttons {
    flex-direction: row;
    justify-content: center;
  }
}

/* --- Print styles --- */
/* These styles are specifically for when the page is printed. */
@media print {
  /* Hide elements not relevant for print */
  nav,
  button,
  .no-print {
    display: none;
  }

  /* Ensure text is readable */
  body {
    font-size: 12pt;
    line-height: 1.5;
    color: #000;
    background: #fff;
  }

  /* Make links useful by showing their URL */
  a::after {
    content: " (" attr(href) ")";
    font-size: 0.9em;
  }
}
