/* =========================
   VARIABLES
========================= */
:root {
  --bg-main: #121212;
  --bg-header: #1e1e1e;
  --accent: #4CAF50;
  --text-main: white;
  --text-secondary: #aaa;
  --border-dark: #333;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: Arial, sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
  text-align: center;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

ul {
  list-style: none;
}

ul li {
  font-size: 1.2em;
  margin: 10px 0;
}

/* =========================
   HEADER
========================= */
.top-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 18px 40px;
  background: var(--bg-header);
  box-shadow: 0 4px 15px rgba(0,0,0,0.6);
  position: sticky;
  top: 0;
  z-index: 1200;
  gap: 15px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
}

.header-text h1 {
  font-size: 1.2em;
  margin: 0;
}

.header-text span {
  font-size: 0.8em;
  color: var(--text-secondary);
}

.header-nav {
  display: flex;
  gap: 25px;
}

.header-nav a {
  color: var(--text-main);
  font-size: 0.9em;
  text-decoration: none;
  position: relative;
  transition: 0.25s;
}

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

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

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-link img {
  width: 22px;
  height: 22px;
  filter: brightness(0) invert(1);
  transition: 0.3s;
}

.icon-link img:hover {
  transform: scale(1.2);
  filter: brightness(0) saturate(100%) invert(63%) sepia(83%) saturate(329%) hue-rotate(85deg);
}

.header-cv {
  padding: 6px 14px;
  background: var(--accent);
  color: var(--bg-main);
  border-radius: 8px;
  font-size: 0.85em;
  font-weight: bold;
  text-decoration: none;
  transition: 0.25s;
}

.header-cv:hover {
  background: #3b8d40;
}

/* =========================
   ACHIEVEMENT BUTTON - STYLE AMÉLIORÉ
========================= */
.achievement-btn {
  position: fixed;
  top: 110px; /* juste sous le header */
  right: 30px;

  width: 50px;
  height: 50px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: linear-gradient(145deg, #1f1f1f, #151515);
  border: 2px solid var(--accent);
  border-radius: 50%;

  box-shadow: 
      0 4px 15px rgba(0,0,0,0.4),
      0 0 15px rgba(76,175,80,0.3);
  transition: all 0.3s ease;
  z-index: 1300; /* au-dessus de tout */
  cursor: pointer;
}

.achievement-btn img {
  width: 28px;
  height: 28px;
  transition: all 0.3s ease;
  filter: brightness(1) invert(1);
}

.achievement-btn:hover {
  transform: scale(1.05);
  background: linear-gradient(145deg, #242424, #1a1a1a);
}

.achievement-btn:hover img {
  filter: brightness(0) saturate(100%) invert(63%) sepia(83%) saturate(329%) hue-rotate(85deg);
}

/* =========================
   SECTIONS
========================= */
.section {
  padding: 90px 20px;
  max-width: 1100px;
  margin: auto;
}

h2 {
  font-size: 2.2em;
  margin-bottom: 25px;
}

/* =========================
   ABOUT
========================= */
.about-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  margin-top: 30px;
  flex-direction: row;
}

.about-img {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--accent);
  box-shadow: 0 10px 25px rgba(0,0,0,0.6);
}

.about-text {
  max-width: 500px;
  text-align: left;
  font-size: 1.1em;
  line-height: 1.6;
}

/* =========================
   SKILLS TAGS
========================= */
.skills-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin: 35px auto 0;
  max-width: 800px;
}

.skill-tag {
  min-width: 140px;
  text-align: center;
  padding: 12px 16px;
  background: var(--bg-header);
  border: 2px solid var(--accent);
  border-radius: 10px;
  font-size: 0.95em;
  font-weight: 500;
  letter-spacing: 0.5px;
  transition: all 0.25s ease;
}

.skill-tag:hover {
  background: var(--accent);
  color: var(--bg-main);
  transform: translateY(-4px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.5);
}

/* =========================
   PROJECTS
========================= */
.project-container {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.project {
  display: flex;
  gap: 20px;
  align-items: center;
  background: var(--bg-header);
  padding: 20px;
  border-radius: 15px;
  border: 2px solid var(--border-dark);
}

.project.reverse {
  flex-direction: row-reverse;
}

.project-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.project-text {
  width: 50%;
  text-align: left;
}

.project h3 {
  font-size: 1.6em;
  margin-bottom: 10px;
}

.project-card {
  background: var(--bg-header);
  padding: 15px;
  border-radius: 15px;
  border: 2px solid var(--border-dark);
  text-align: left;
  cursor: pointer;
  opacity: 1;
  transform: scale(1);
  transition: 
    opacity 0.35s ease,
    transform 0.35s ease,
    box-shadow 0.3s;
}

.project-card.hidden {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
}

.project-card.removed {
  visibility: hidden;
  position: absolute;
}

.project-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  margin-bottom: 10px;
  object-fit: cover;
}

.project-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.6);
}

.project-card h3 {
  font-size: 1.3em;
  margin-bottom: 5px;
}

.project-card p {
  font-size: 0.95em;
  margin-bottom: 10px;
}

/* =========================
   TAGS
========================= */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.tags span {
  background: #333;
  border: 1px solid var(--accent);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75em;
}

/* =========================
   FORM
========================= */
form {
  margin-top: 30px;
  background: var(--bg-header);
  padding: 25px;
  border-radius: 10px;
}

input, textarea {
  width: 100%;
  margin-bottom: 15px;
  padding: 10px;
  background: #333;
  border: 1px solid #555;
  color: var(--text-main);
}

button {
  background: var(--accent);
  color: black;
  padding: 10px 20px;
  border: none;
  cursor: pointer;
  transition: 0.25s;
}

button:hover {
  background: #3b8d40;
}

/* =========================
   FILTERS
========================= */
.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 30px;
}

.filter-btn {
  padding: 8px 14px;
  border-radius: 20px;
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--text-main);
  cursor: pointer;
  transition: 0.3s;
}

.filter-btn.active,
.filter-btn:hover {
  background: var(--accent);
  color: var(--bg-main);
}

/* =========================
   PROJECT GRID
========================= */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 25px;
  grid-auto-flow: dense;
  transition: all 0.35s ease;
}

/* =========================
   ANIMATIONS
========================= */
.flip-mode {
  animation: spin 1s ease;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* =========================
   ACHIEVEMENTS POPUP
========================= */

#achievementPopup {
  position: fixed; /* ON GARDE FIXED */

  top: 100px;
  right: 30px;

  width: 360px;
  max-height: 500px;
  overflow-y: auto;

  background: linear-gradient(145deg, #1f1f1f, #151515);
  color: #f1f1f1;

  padding: 20px;
  border-radius: 20px;

  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 
    0 20px 40px rgba(0,0,0,0.7),
    0 0 20px rgba(76,175,80,0.08);

  transform: translateY(-30px) scale(0.95);
  opacity: 0;
  pointer-events: none;

  transition: all 0.35s ease;
  z-index: 10000;
}

/* Animation ouverture */
#achievementPopup.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* =========================
   HEADER
========================= */

.achievement-header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
  position: relative;
}

.achievement-header h3 {
  font-size: 1.2rem;
  letter-spacing: 1px;
  opacity: 0.9;
}

/* =========================
   CLOSE BUTTON
========================= */

.achievement-close {
  position: absolute;
  top: 0;
  right: 0;

  width: 30px;
  height: 30px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50%;

  color: #aaa;
  font-size: 14px;
  cursor: pointer;

  transition: all 0.25s ease;
}

.achievement-close:hover {
  background: var(--accent);
  color: black;
  transform: scale(1.1);
  box-shadow: 0 0 12px rgba(76,175,80,0.6);
}

/* =========================
   ACHIEVEMENT ITEMS
========================= */

.achievement-item {
  padding: 15px;
  margin-bottom: 14px;

  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);

  transition: all 0.25s ease;
}

.achievement-item:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,0.05);
}

.achievement-item.completed {
  border: 1px solid rgba(76,175,80,0.6);
  background: rgba(76,175,80,0.08);
  box-shadow: 0 0 15px rgba(76,175,80,0.1);
}

.achievement-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.achievement-desc {
  font-size: 0.85rem;
  opacity: 0.75;
  margin-top: 6px;
}

/* =========================
   PROGRESS BAR
========================= */

.progress-bar {
  width: 100%;
  height: 6px;
  background: #2a2a2a;
  border-radius: 6px;
  margin-top: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #00ff88);
  width: 0%;
  transition: width 0.4s ease;
}

.progress-text {
  font-size: 0.75rem;
  opacity: 0.6;
  margin-top: 4px;
  text-align: right;
}

/* Badge ✔ */
.badge {
  background: var(--accent);
  color: black;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: bold;
}

/* =========================
   GLOBAL PROGRESSION
========================= */

.achievement-global {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.9rem;
  text-align: center;
  opacity: 0.8;
}

/* =========================
   SCROLLBAR DARK STYLE
========================= */

#achievementPopup::-webkit-scrollbar {
  width: 8px;
}

#achievementPopup::-webkit-scrollbar-track {
  background: #1a1a1a;
  border-radius: 10px;
}

#achievementPopup::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 10px;
  transition: background 0.3s;
}

#achievementPopup::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* Firefox */
#achievementPopup {
  scrollbar-width: thin;
  scrollbar-color: #333 #1a1a1a;
}

/* =========================
   TOAST
========================= */

.achievement-toast {
  position: fixed;
  bottom: 25px;
  right: 25px;

  display: flex;
  align-items: center;
  gap: 12px;

  background: rgba(25,25,25,0.95);
  backdrop-filter: blur(8px);

  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);

  color: #f1f1f1;
  font-size: 0.9rem;

  box-shadow: 0 10px 25px rgba(0,0,0,0.4);

  opacity: 0;
  transform: translateY(15px);
  transition: all 0.3s ease;

  z-index: 20000;
}

.achievement-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-icon {
  font-size: 1.4rem;
}

.toast-title {
  font-size: 0.75rem;
  opacity: 0.6;
}

.toast-name {
  font-weight: 600;
  font-size: 0.9rem;
}

/* =========================
   TOGGLE CONTAINER
========================= */

#retroToggleContainer {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: monospace;
  color: #33ff33;
}

/* =========================
   SWITCH
========================= */

.retro-switch {
  position: relative;
  width: 50px;
  height: 26px;
}

.retro-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #222;
  border: 2px solid #33ff33;
  border-radius: 30px;
  transition: 0.3s;
}

.slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 2px;
  background-color: #33ff33;
  border-radius: 50%;
  transition: 0.3s;
}

.retro-switch input:checked + .slider {
  background-color: #003300;
}

.retro-switch input:checked + .slider::before {
  transform: translateX(22px);
}

.retro-label {
  font-size: 14px;
  letter-spacing: 2px;
}

/* =========================
   RETRO MODE
========================= */

body.retro-mode {
  background-color: #001100;
  color: #33ff33;
  font-family: "Courier New", monospace;
  position: relative;
}

/* Scanlines */

body.retro-mode::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,255,0,0.12) 0px,
    rgba(0,255,0,0.12) 1px,
    transparent 1px,
    transparent 3px
  );
  z-index: 9998;
}

/* Vignette */

body.retro-mode::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    circle at center,
    transparent 60%,
    rgba(0,0,0,0.6) 100%
  );
  z-index: 9997;
}

/* =========================
   LOADING SCREEN
========================= */

#retroLoader {
  position: fixed;
  inset: 0;
  background: black;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 20000;
  color: #33ff33;
  font-family: monospace;
}

.retro-loader-box {
  text-align: center;
}

.retro-bar {
  width: 250px;
  height: 20px;
  border: 2px solid #33ff33;
  margin-top: 10px;
  overflow: hidden;
}

.retro-bar-fill {
  height: 100%;
  width: 0%;
  background: #33ff33;
  animation: loadBar 2.3s linear forwards;
}

body.retro-mode .filter-btn {
  font-family: "Courier New", monospace;
  color: #33ff33;
  border: 2px solid #33ff33;
  background: transparent;
}

body.retro-mode .filter-btn:hover,
body.retro-mode .filter-btn.active {
  background: #003300;
  color: #33ff33;
}

@keyframes loadBar {
  to { width: 100%; }
}

/* =========================
   MEDIA QUERIES
========================= */
@media (max-width: 1024px) {
  .project-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .header-nav { display: none; }
}

@media (max-width: 768px) {
  .project, .project.reverse {
    flex-direction: column;
  }
  .project-card img,
  .project-text {
    width: 100%;
  }
  .about-container {
    flex-direction: column;
    text-align: center;
  }
  .about-text {
    text-align: center;
  }
}

@media (max-width: 600px) {
  .project-grid {
    grid-template-columns: 1fr;
  }
}
