/* ===== Global ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background-color: #F4F4F4;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

/* ===== Header ===== */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background-color: #F4F4F4;
  color: black;
}

.header-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

nav {
  display: flex;
  align-items: center;
}

nav a {
  color: black;
  text-decoration: none;
  margin-left: 15px;
  font-weight: 500;
}

nav a:hover {
  color: grey;
}

.white-space {
  height: 30px;
  background-color: white;
  width: 100%;
}

/* ===== Intro + AI ===== */
.main-section {
  display: flex;
  gap: 20px;
  padding: 20px;
}

.intro-content {
  flex: 2;
}

.intro-section {
  flex: 4;
  display: flex;
  gap: 20px;
  padding: 20px;
  border: 1px solid #ccc;
  align-items: center;
  background-color: white;
  border-radius: 12px;
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease-in-out;
  height: 400px;
}

.intro-section h1 {
  font-size: 32px;
}

.black-text { color: black !important; }
.grey-text { color: gray !important; }

.intro-section p {
  color: gray;
  font-size: 16px;
}

.intro-section:hover { transform: scale(1.05); }

.project-links {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 15px;
  margin-top: 10px;
}

.icon-button {
  width: 40px;
  height: auto;
  transition: transform 0.3s ease-in-out;
}

.icon-button:hover {
  transform: scale(1.1);
}

.ai-section {
  flex: 2;
  padding: 20px;
  border: 1px solid #ccc;
  text-align: center;
  background-color: black;
  border-radius: 12px;
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease-in-out;
  width: 100%;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

#ai-animation-container {
  width: 100%;
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
  min-height: 250px;
}

.ai-button {
  padding: 10px 20px;
  background-color: white;
  color: black;
  border: 2px solid black;
  border-radius: 5px;
  cursor: pointer;
  position: relative;
  top: -35px;
  font-weight: bold;
  transition: all 0.3s ease-in-out;
}

.ai-button:hover {
  background-color: black;
  color: white;
}

.ai-section:hover { transform: scale(1.05); }

/* chat styles (kept) */
.chat-container { display: flex; flex-direction: column; width: 100%; height: 100%; padding: 10px; border-radius: 12px; background: rgba(0, 0, 0, 0.85); overflow: hidden; }
.chat-messages { flex-grow: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; color: white; text-align: left; }
.ai-message, .user-message { max-width: 80%; padding: 10px; border-radius: 8px; word-wrap: break-word; }
.ai-message { align-self: flex-start; color: white; }
.user-message { background-color: #333; align-self: flex-end; color: white; }
.chat-input-container { display: flex; gap: 10px; padding: 10px; border-top: 1px solid #ccc; }
.chat-input { flex-grow: 1; padding: 8px; border-radius: 6px; border: 1px solid #ccc; background: white; font-size: 16px; }
.send-button { padding: 8px 12px; border: none; border-radius: 6px; background: #007BFF; color: white; font-weight: bold; cursor: pointer; transition: 0.3s; }
.send-button:hover { background: #0056b3; }
/* ============================
   Chat UI: fixed height + scroll
   ============================ */

/* Make sure the AI section is a fixed "card" height */
.ai-section {
  height: 400px;           /* match your intro-section height */
  display: flex;
  flex-direction: column;
}

/* Chat container should fill the AI card, not expand it */
.chat-container {
  width: 100%;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;        /* prevents growing outside */
}

/* Messages area scrolls */
.chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;           /* IMPORTANT: enables proper flex scrolling */
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Input stays pinned at bottom */
.chat-input-container {
  flex: 0 0 auto;
  margin-top: 0;
}

/* Optional: smoother scroll */
.chat-messages {
  scroll-behavior: smooth;
}
/* ===== AI stats under the button ===== */
.ai-stats {
  width: 100%;
  margin-top: -20px;         /* pulls it up a bit because your button uses top:-35px */
  padding: 8px 12px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}

.ai-stat-line {
  display: flex;
  justify-content: center;
  gap: 8px;
}

#ragTopScore {
  font-weight: 700;
}


/* ===== Projects ===== */
.projects-title {
  font-weight: bold;
  text-align: left;
  margin-bottom: 30px;
  padding-left: 2%;
  font-size: 32px;
  color: black;
}

.projects-wrapper {
  position: relative;
  overflow: hidden;

  /* make the wrapper actually be the full row */
  width: calc(100% - 4%);
  margin-left: 2%;
  margin-right: 2%;

  display: flex;
  align-items: center;
}

.projects-grid {
  /* THIS is the key: force the grid to occupy the full width */
  width: 100%;
  flex: 1;
  min-width: 0;

  display: flex;
  gap: 15px;
  transition: transform 0.5s ease-in-out;
}

.project-card {
  /* instead of 33.33% of an "unclear" width, compute exact 3 cards */
  flex: 0 0 calc((100% - (15px * 2)) / 3);

  background: white;
  padding: 20px;
  text-align: left;
  border-radius: 8px;
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease-in-out;

  height: 450px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.project-card h3 {
  font-size: 32px;
  font-weight: bold;
  color: black;
  margin: 0 0 12px 0;
  text-decoration: none;
}

.project-card h3 a {
  text-decoration: none;
  color: black;
}

.project-card p {
  font-size: 16px;
  color: grey;
  margin: 0 0 15px 0;
  height: 350px;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
}

.project-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 5px;
  margin-top: auto;
}

.project-card:hover { transform: scale(1.05); }

.arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0, 0, 0, 0.2);
  color: white;
  border: none;
  font-size: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease, background-color 0.3s ease;
}

.arrow:hover { background-color: rgba(0, 0, 0, 0.4); }
#left-arrow { left: 10px; z-index: 10; }
#right-arrow { right: 10px; z-index: 10; }
.projects-wrapper:hover .arrow { opacity: 1; }

/* ===== ABOUT ME (FIXED) ===== */
.about-me-title {
  font-size: 32px;
  font-weight: bold;
  text-align: left;
  margin-bottom: 30px;
  padding-left: 2%;
  color: black;
}

.about-container {
  display: flex;
  align-items: stretch;
  width: 100%;
  padding: 20px 2%;   /* instead of margin-left hacks */
  gap: 20px;
}

/* LEFT column card */
.about-description {
  flex: 2;            /* makes it equal width with right column */
  width: auto;        /* remove width: 68% */
  margin-left: 0;     /* remove margin-left: 2% */
  display: flex;
  gap: 20px;
  background: white;
  border-radius: 12px;
  padding: 20px;
  text-align: left;
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
  font-size: 16px;
  color: grey;
  height: auto;
}

.about-text {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  min-width: 0;
}

.about-title {
  font-size: 24px;
  font-weight: bold;
  color: black;
  margin-bottom: 10px;
}

/* KEY FIX: treat it as an <img>, not background-image */
.about-image {
  flex: 0 0 32%;      /* was flex: 1 + max-width:45% */
  max-width: 32%;
  height: 240px;      /* controls visible size */
  border-radius: 12px;
  object-fit: cover;
  align-self: center; /* keeps it vertically centered */
}


.about-description:hover { transform: scale(1.03); }

.download-cv-button {
  background: #e0e0e0;
  border: none;
  padding: 10px 20px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
}

.download-cv-button:hover { background: #d0d0d0; }

/* Right column cards */
.score-cards-container {
  flex: 1;            /* equal width with about-description */
  width: auto;        /* remove width: 30% */
  margin-left: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: auto;
}

.score-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
  color: grey;
  font-size: 14px;
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.score-card:hover {
  transform: scale(1.03);
  box-shadow: 0px 6px 15px rgba(0, 0, 0, 0.15);
}

/* ===== Hire Me ===== */
.space {
  height: 30px;
  width: 100%;
}

.hire-me-title {
  text-align: center;
  font-size: 2rem;
  margin-top: 50px;
  margin-bottom: 20px;
}

.hire-me-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 20px;
  background-color: #f4f4f4;
  border-radius: 15px;
  box-shadow: 0 0 15px rgba(0,0,0,0.1);
}

.hire-me-text {
  margin-bottom: 20px;
  text-align: center;
}

.hire-me-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.hire-me-form input,
.hire-me-form textarea {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 1rem;
}

.send-message-button {
  padding: 12px 20px;
  background-color: black;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  cursor: pointer;
  transition: 0.3s ease;
}
.hp-field {
  display: none;
}
.send-message-button:hover { background-color: grey; }

/* ===== Popup ===== */
.popup {
  position: fixed;
  top: 20px;
  right: 20px;
  background-color: #28a745;
  color: white;
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.5s ease;
}

/* ===== Footer ===== */
.footer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: white;
  width: 100%;
  border-top: 1px solid #ddd;
}

.footer-links {
  display: flex;
  gap: 30px;
  font-size: 18px;
}

.footer-links a {
  text-decoration: none;
  color: black;
  font-weight: bold;
  transition: color 0.3s ease;
}

.footer-links a:hover { color: grey; }

.popup {
  opacity: 1;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.popup.hide {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}
/* ===== Responsive Fixes ===== */
@media (max-width: 1024px) {
  .main-section {
    flex-direction: column;
    padding: 10px;
    align-items: center;
  }

  .intro-section,
  .ai-section {
    width: 100%;
    height: auto;
    flex-direction: column;
    text-align: center;
    padding: 15px;
  }

  .intro-section h1 { font-size: 26px; }

  .intro-section p,
  .project-card p { font-size: 14px; }

  .project-card h3 { font-size: 20px; }

  .project-links {
    justify-content: center;
    margin-top: 15px;
  }

  /* ✅ ABOUT ME stacks properly */
  .about-container {
    flex-direction: column;
    padding: 10px;
    gap: 15px;
  }

  .about-description {
    width: 100%;
    height: 100%;
    margin-left: 0;
    flex-direction: column;
    height: auto;
  }

  .score-cards-container {
    width: 100%;
    height: 100%;
  }

  /* prevent hover scaling overlap on touch */
  .about-description:hover,
  .score-card:hover {
    transform: none;
  }

  .score-cards-container {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

  .score-card {
    width: 45%;
    margin: 10px 0;
    flex: 1
  }
}
/* Floating "How does it work?" button */
.how-it-works-in-ai {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 50;

  color: white;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;

  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  box-shadow: none;

  opacity: 0.9;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.how-it-works-in-ai:hover {
  opacity: 1;
  text-decoration: underline;
  transform: translateY(-1px);
}

@media (max-width: 600px) {
  .intro-section { padding: 15px; }
  .intro-section h1 { font-size: 22px; }
  .intro-section p { font-size: 13px; }

  .project-links {
    flex-wrap: wrap;
    justify-content: center;
  }

  .icon-button { width: 30px; }

  .ai-section {
    padding: 10px;
    min-height: 250px;
  }

  .ai-button {
    font-size: 14px;
    padding: 8px 16px;
    top: -20px;
  }

  .chat-input { font-size: 14px; }

  .projects-wrapper {
    margin-left: 0;
    padding: 0 10px;        /* small padding so cards don't touch edges */
  }

  .projects-grid {
    flex-direction: row;    /* IMPORTANT: keep horizontal */
    overflow: hidden;
    width: 100%;
  }

  .project-card {
    flex: 0 0 100%;         /* one card visible */
    width: 100%;
    height: auto;
  }

  /* keep arrows usable on mobile */
  .arrow {
    opacity: 1;             /* always visible */
    background-color: rgba(0,0,0,0.35);
  }


  .project-card {
    width: 90%;
    height: auto;
  }

  .projects-grid {
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  }

  .project-card {
    scroll-snap-align: start;
  }


  .score-card { width: 90%; }

  /* About image a bit smaller on tiny screens */
  .about-image { height: 220px; }
}
