/* General Styling & Performance */
:root {
  --primary-color: #8a2be2; /* BlueViolet */
  --secondary-color: #00b3ff; /* DeepSkyBlue */
  --background-color: #0a0a0a;
  --card-background: rgba(10, 10, 10, 0.9);
  --text-color: #f1faee;
  --text-muted-color: #d3dcea;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 100px;
  background: var(--background-color);
}

body {
  font-family: 'Poppins', 'Segoe UI', Arial, sans-serif;
  background: var(--background-color);
  color: var(--text-color);
  overflow-x: hidden;
  line-height: 1.6;
}

/* Animated Background */
.animated-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: linear-gradient(45deg, #0a0a0a, #1a1a2e, #16213e, #0f3460);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
}
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.stars, .twinkling {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-repeat: repeat;
  animation: twinkle 5s ease-in-out infinite;
}
.stars {
  background-image: radial-gradient(2px 2px at 20px 30px, #eee, transparent), radial-gradient(1px 1px at 90px 40px, #fff, transparent);
  background-size: 200px 100px;
}
.twinkling {
  background-image: radial-gradient(1px 1px at 50px 50px, #fff, transparent), radial-gradient(1px 1px at 150px 150px, #fff, transparent);
  background-size: 300px 300px;
  animation-duration: 7s;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* Header */
header {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  padding: 15px 0;
  z-index: 1000;
  background: transparent;
}
.nav-container {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 0 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo {
  font-size: 1.5em;
  color: var(--text-color);
  font-weight: 700;
  text-decoration: none;
  text-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
}
nav {
  background: rgba(20, 20, 20, 0.9);
  backdrop-filter: blur(15px);
  padding: 10px 20px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
nav a {
  font-size: 0.9em;
  color: var(--text-color);
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s ease;
  padding: 6px 12px;
  border-radius: 20px;
}
nav a:hover {
  color: var(--primary-color);
  transform: translateY(-2px);
}
.nav-link.active {
  background: rgba(138, 43, 226, 0.3);
  color: var(--primary-color);
  box-shadow: 0 4px 20px rgba(138, 43, 226, 0.4);
  transform: translateY(-2px);
  border: 1px solid rgba(138, 43, 226, 0.5);
}

/* Section Styling */
section {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 120px 40px;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
  will-change: opacity, transform;
}
section.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Home Section */
.home {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 50px;
}
.home p {
  text-align: left;
  font-size: 2.2em;
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  line-height: 1.4;
  flex: 1;
}
.home1 {
  width: 400px;
  height: 600px;
  background-image: url("portfolio_pic/profile_compressed.jpeg"); /* Use a relative path */
  background-size: cover;
  background-position: center;
  border-radius: 20px;
  box-shadow: 0 0 20px var(--primary-color), 0 0 40px var(--secondary-color);
  animation: spaceGlow 4s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes spaceGlow {
  50% { box-shadow: 0 0 30px var(--primary-color), 0 0 60px var(--secondary-color), 0 0 80px var(--primary-color); }
}

/* About Section */
.about { max-width: 1200px; }
.text {
 font-size: 1.5em;
 padding: 30px;
 background: var(--card-background);
 backdrop-filter: blur(15px);
 border: 1px solid rgba(138, 43, 226, 0.3);
 border-radius: 20px;
 margin: 50px 0;
 position: relative;
 overflow: hidden;
}
.about-intro .highlight {
  color: var(--primary-color);
  font-weight: 600;
}
.about-intro::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  transform: translateX(-120%);
  pointer-events: none;
}
section#about.visible .about-intro::before {
  animation: aboutShimmer 2.2s ease-out forwards;
}
section#about .about-intro {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
section#about.visible .about-intro {
  opacity: 1;
  transform: translateY(0);
}
@keyframes aboutShimmer {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(120%); }
}
.timeline-container {
  max-width: 800px;
  margin: 40px auto;
  position: relative;
}
.timeline-container::before {
  content: '';
  position: absolute;
  left: 50%; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
  transform: translateX(-50%);
  z-index: 1;
}
.timeline-item {
  position: relative;
  margin-bottom: 40px;
  width: 50%;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
  transition-delay: calc(var(--delay-index, 0) * 150ms);
}
.timeline-item.visible {
  opacity: 1;
  transform: translateY(0);
}
.timeline-item:nth-child(odd) { left: 0; padding-right: 30px; text-align: right; }
.timeline-item:nth-child(even) { left: 50%; padding-left: 30px; text-align: left; }
.timeline-dot {
  position: absolute;
  top: 20px;
  width: 16px;
  height: 16px;
  background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(138, 43, 226, 0.6);
  z-index: 2;
}
.timeline-item:nth-child(odd) .timeline-dot { right: -8px; }
.timeline-item:nth-child(even) .timeline-dot { left: -8px; }
.timeline-content {
  background: var(--card-background);
  border: 1px solid rgba(138, 43, 226, 0.3);
  border-radius: 15px;
  padding: 20px;
  transition: transform 0.3s, box-shadow 0.3s;
}
.timeline-content:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(138, 43, 226, 0.4);
}
.timeline-content h3 { color: var(--primary-color); }
.icon { display: flex; margin: 100px auto 0; gap: 30px; justify-content: center; }
.icon a { font-size: 2em; color: #aaa; transition: transform 0.3s, color 0.3s; }
.icon a:hover { transform: scale(1.5); }
.icon .instagram:hover { color: #cf1ea9; }
.icon .linkedin:hover, .icon .twitter:hover { color: #0d98e8; }
.icon .git:hover { color: #45d415; }

/* Work Section */
.proj1 {
  font-size: 2.5em;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  margin-bottom: 40px;
}
.carousel-container-horizontal {
  display: flex;
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
  align-items: flex-start;
}
.card-animation-wrapper, .info-animation-wrapper { flex: 1; }
.card-animation-wrapper.fade-in, .info-animation-wrapper.fade-in { animation: fadeInSide 0.8s ease-out; }
@keyframes fadeInSide { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
#slider {
  width: 100%;
  height: 400px;
  position: relative;
  border-radius: 15px;
  background-size: cover;
  background-position: center;
  transition: background-image 0.5s ease-in-out;
}
.project-card-title {
  width: 100%;
  text-align: center;
  color: var(--text-color);
  font-size: 1.2em;
  font-weight: 600;
  background: var(--card-background);
  border: 1px solid rgba(138, 43, 226, 0.3);
  border-radius: 10px;
  padding: 15px;
  margin-top: 15px;
}
.progress-bar-outer {
  width: 100%;
  height: 4px;
  background: rgba(138, 43, 226, 0.2);
  border-radius: 2px;
  margin-top: 15px;
}
.progress-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  border-radius: 2px;
  width: 0%;
}
#project-info {
  background: var(--card-background);
  border-radius: 15px;
  padding: 20px;
  text-align: left;
  border: 1px solid rgba(138, 43, 226, 0.4);
}
#project-info h2 { color: var(--primary-color); }
#info-functions-container ul { list-style: none; padding: 0; }
#info-functions-container li {
  background: rgba(10, 10, 10, 0.5);
  padding: 10px;
  margin-bottom: 8px;
  border-radius: 8px;
  border-left: 3px solid var(--primary-color);
}
#info-github {
  display: inline-block;
  margin-top: 20px;
  background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
  color: #fff;
  padding: 12px 20px;
  border-radius: 25px;
  text-decoration: none;
  transition: transform 0.3s, box-shadow 0.3s;
}
#info-github:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(138, 43, 226, 0.6);
}
.carousel-nav { display: flex; justify-content: center; gap: 20px; margin-top: 30px; }
.carousel-nav button {
  background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
  color: white; border: none;
  border-radius: 50%;
  width: 50px; height: 50px;
  font-size: 1.2em;
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
}
.carousel-nav button:hover {
  transform: translateY(-3px) scale(1.1);
  box-shadow: 0 10px 25px rgba(138, 43, 226, 0.6);
}

/* Certificates Carousel */
.certificates-carousel-work {
  width: 100%;
  max-width: 1200px;
  margin-top: 40px;
  overflow: hidden;
  position: relative;
  -webkit-mask-image: linear-gradient(to right, transparent, black 20%, black 80%, transparent);
  mask-image: linear-gradient(to right, transparent, black 20%, black 80%, transparent);
}
.certificates-carousel-work-inner {
  display: flex;
  width: fit-content;
  animation: certs-slide-loop 40s linear infinite;
}
.certificates-carousel-work:hover .certificates-carousel-work-inner { animation-play-state: paused; }
@keyframes certs-slide-loop {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.certificate-card-work {
  width: 300px;
  margin: 0 15px;
  background: rgba(20, 20, 40, 0.9);
  border: 1.5px solid var(--primary-color);
  border-radius: 18px;
  padding: 22px;
  flex-shrink: 0;
  transition: transform 0.3s, box-shadow 0.3s;
}
.certificate-card-work:hover {
  transform: translateY(-10px) scale(1.05);
  box-shadow: 0 12px 40px rgba(138, 43, 226, 0.3);
}
.certificate-card-work h3 { color: var(--primary-color); }
.view-certificate-work {
  display: inline-block;
  background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
  color: #fff;
  padding: 10px 18px;
  border-radius: 22px;
  text-decoration: none;
  font-weight: 600;
  margin-top: auto;
}

/* Tools Section */
.tech-icons .icon-row { display: flex; justify-content: center; gap: 48px; margin-bottom: 30px; }
.tool-item { position: relative; cursor: pointer; transition: transform 0.3s, filter 0.3s, opacity 0.3s; }
.tool-item i { font-size: 4.5rem; }
.tool-item img { height: 60px; filter: grayscale(1); transition: filter 0.3s; }
.tech-icons:hover .tool-item:not(:hover) { filter: blur(2px); opacity: 0.5; }
.tool-item:hover { transform: scale(1.2) translateY(-10px); }
.tool-item:hover img { filter: grayscale(0); }
.tool-item::before, .tool-item::after {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-background);
  padding: 8px 12px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.tool-item::before { content: attr(data-tool); top: -35px; color: var(--primary-color); font-weight: 600; }
.tool-item::after { content: attr(data-description); top: 100%; margin-top: 15px; width: max-content; max-width: 200px; color: var(--text-muted-color); }
.tool-item:hover::before, .tool-item:hover::after { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(-5px); }
.tool-item:hover::after { transform: translateX(-50%) translateY(5px); }

/* Contact Section */
.contact-container { display: flex; justify-content: center; align-items: center; width: 100%; max-width: 1200px; gap: 60px; flex-wrap: wrap; }
.contact-form-section, .animation-card-section { flex: 1; max-width: 500px; min-width: 320px; }
.contact-form-section { background: var(--card-background); border: 1px solid rgba(138, 43, 226, 0.3); border-radius: 25px; padding: 40px; }
.contact-title { color: var(--primary-color); font-size: 2.5em; }
.form-group { position: relative; }
.form-group input, .form-group textarea {
  width: 100%;
  padding: 15px 20px;
  background: rgba(10, 10, 10, 0.8);
  border: 2px solid rgba(138, 43, 226, 0.3);
  border-radius: 10px;
  color: #fff;
  font-size: 1em;
  transition: border-color 0.3s, box-shadow 0.3s;
  outline: none;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--primary-color); box-shadow: 0 0 20px rgba(138, 43, 226, 0.4); }
.form-group label {
  position: absolute;
  top: 15px; left: 20px;
  color: #ccc;
  transition: all 0.3s ease;
  pointer-events: none;
}
.form-group input:focus + label, .form-group input:valid + label,
.form-group textarea:focus + label, .form-group textarea:valid + label {
  top: -10px; left: 15px;
  font-size: 0.8em;
  color: var(--primary-color);
  background: #151528; /* Match form background */
  padding: 0 5px;
}
.submit-btn {
  background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
  color: white; padding: 15px 30px;
  border: none; border-radius: 10px;
  font-size: 1.1em; font-weight: 600;
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
}
.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(138, 43, 226, 0.6);
}
.flip-card { width: 100%; height: 500px; perspective: 1000px; }
.flip-card-inner { position: relative; width: 100%; height: 100%; transition: transform 0.8s; transform-style: preserve-3d; }
.flip-card.flipped .flip-card-inner { transform: rotateY(180deg); }
.flip-card-front, .flip-card-back {
  position: absolute;
  width: 100%; height: 100%;
  backface-visibility: hidden;
  border-radius: 25px;
  border: 1px solid rgba(138, 43, 226, 0.3);
  background: var(--card-background);
}
/* FIXED: Styles for the image on the front of the card */
.flip-card-front {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Removed padding to prevent overflow */
}
.flip-card-image {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Ensures aspect ratio is maintained */
  border-radius: 25px; /* Match parent's border-radius */
}
.flip-card-back { transform: rotateY(180deg); padding: 40px; }
.info-title { color: var(--primary-color); }
.info-item { display: flex; align-items: flex-start; gap: 15px; margin-bottom: 20px; }
.info-item i { color: var(--primary-color); margin-top: 5px; }

/* Success Dialog */
.success-dialog {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center; align-items: center;
  z-index: 2000;
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}
.success-dialog.show { opacity: 1; visibility: visible; }
.dialog-content {
  background: var(--card-background);
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  transform: scale(0.8);
  transition: transform 0.3s;
  border: 2px solid rgba(138, 43, 226, 0.5);
}
.success-dialog.show .dialog-content { transform: scale(1); }
.dialog-content i { font-size: 3em; color: var(--primary-color); }
.dialog-close {
  background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
  color: white; padding: 12px 25px;
  border: none; border-radius: 8px;
  cursor: pointer; margin-top: 20px;
}

/* Responsive Layout */
@media (max-width: 900px) {
  .nav-container {
    padding: 0 20px;
  }
  nav {
    position: static;
    transform: none;
    margin-top: 10px;
  }
  section {
    padding: 110px 20px 60px;
  }
  .home {
    flex-direction: column;
    text-align: center;
  }
  .home p {
    text-align: center;
    font-size: 1.8em;
  }
  .home1 {
    width: 260px;
    height: 380px;
  }
  .carousel-container-horizontal {
    flex-direction: column;
  }
  .tech-icons .icon-row {
    flex-wrap: wrap;
    gap: 24px;
  }
  .timeline-container::before {
    left: 8px;
  }
  .timeline-item {
    width: 100%;
    padding-left: 30px;
    padding-right: 0;
    text-align: left;
    left: 0 !important;
  }
  .timeline-item .timeline-dot {
    left: 0;
  }
}

@media (max-width: 600px) {
  .logo {
    font-size: 1.2em;
  }
  nav a {
    font-size: 0.8em;
    padding: 4px 8px;
  }
  .proj1 {
    font-size: 2em;
  }
  #slider {
    height: 260px;
  }
  .contact-form-section {
    padding: 25px;
  }
  .flip-card {
    height: 360px;
  }
}
