.timeline {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 60px 0;
}

.timeline-container {
  position: relative;
  width: 80%;
  max-width: 1200px;
  padding: 30px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timeline-line {
  position: absolute;
  width: 6px;
  height: 100%;
  background: linear-gradient(to bottom, transparent, var(--timeline-line), transparent);
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  z-index: 0;
  border-radius: 3px;
}

.timeline-item {
  width: 80%;
  margin: 40px 0;
  opacity: 0;
  transform: translateY(100px);
  animation: fadeInUp 1s ease-out forwards;
  position: relative;
}

.timeline-item.left {
  animation-delay: 0.2s;
  display: flex;
  justify-content: flex-start;
}

.timeline-item.right {
  animation-delay: 0.4s;
  display: flex;
  justify-content: flex-end;
}

.cadre {
  background-color: var(--card-bg);
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 10px 30px var(--card-shadow);
  position: relative;
  width: 100%;
  max-width: 500px;
  box-sizing: border-box;
  border-left: 5px solid var(--sidebar-active);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 1px solid var(--border-color);
}

.cadre h3 {
  color: var(--heading-color);
  font-size: 1.8rem;
  margin-bottom: 15px;
  font-weight: 600;
}

.cadre h4 {
  color: var(--timeline-date);
  font-size: 1.2rem;
  margin-bottom: 15px;
  font-weight: 500;
  opacity: 0.9;
}

.cadre p {
  color: var(--text-color);
  font-size: 1.1rem;
  line-height: 1.6;
}

.timeline-item.left .cadre {
  margin-left: -100px;
  transform: translateX(-100px);
}

.timeline-item.right .cadre {
  margin-right: -100px;
  transform: translateX(100px);
}

.timeline-item:hover .cadre {
  transform: translateY(-15px) scale(1.05);
  box-shadow: 0 20px 40px rgba(0, 123, 255, 0.2);
  cursor: pointer;
}

.timeline-item.left .cadre:before,
.timeline-item.right .cadre:before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  background-color: var(--timeline-dot);
  border-radius: 50%;
  top: 30px;
  z-index: 2;
  box-shadow: 0 0 0 5px rgba(0, 123, 255, 0.2);
}

.timeline-item.left .cadre:before {
  right: -60px;
}

.timeline-item.right .cadre:before {
  left: -60px;
}

@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(100px) translateX(-50px);
  }
  50% {
    opacity: 0.5;
    transform: translateY(20px) translateX(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) translateX(0);
  }
}

/* Section principale */
.certif-section {
  padding: 60px 10%;
  text-align: center;
}

.certif-section h2 {
  font-size: 2.5rem;
  color: var(--heading-color);
  margin-bottom: 50px;
  position: relative;
  display: inline-block;
  padding-bottom: 15px;
}

.certif-section h2:after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: var(--sidebar-active);
  border-radius: 2px;
}

/* Conteneur des cartes */
.certif-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 40px;
  justify-items: center;
}

/* Cartes */
.certif-card {
  background-color: var(--card-bg);
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 10px 30px var(--card-shadow);
  text-align: center;
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  max-width: 400px;
  width: 100%;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.certif-card:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(90deg, var(--sidebar-active), var(--sidebar-hover));
}

.certif-card:hover {
  transform: translateY(-15px);
  box-shadow: 0 20px 40px rgba(0, 123, 255, 0.3);
}

.certif-card h3 {
  color: var(--heading-color);
  font-size: 1.6rem;
  margin-bottom: 15px;
  font-weight: 600;
}

.certif-card p {
  color: var(--text-color);
  font-size: 1.1rem;
  margin-bottom: 25px;
}

.certif-popup-btn {
  padding: 12px 25px;
  background-color: var(--sidebar-active);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
}

.certif-popup-btn:hover {
  background-color: var(--sidebar-hover);
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0, 123, 255, 0.4);
}

/* Pop-up */
.certif-popup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--popup-bg);
  justify-content: center;
  align-items: center;
  z-index: 9999;
  backdrop-filter: blur(8px);
  overflow-y: auto; /* Permettre le défilement */
  padding: 20px 0;
}

.certif-popup-content {
  background-color: var(--popup-content-bg);
  padding: 30px;
  border-radius: 15px;
  width: 90%;
  max-width: 800px;
  text-align: center;
  animation: fadeInScale 0.5s ease forwards;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  max-height: 90vh; /* Hauteur maximale */
  overflow-y: auto; /* Permettre le défilement à l'intérieur */
  margin: 20px auto; /* Centrer horizontalement */
  border: 1px solid var(--border-color);
}

.certif-popup-content img {
  max-width: 100%;
  margin-bottom: 25px;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.certif-popup-content h3 {
  color: var(--heading-color);
  margin-bottom: 25px;
  font-size: 1.8rem;
}

.certif-popup-content p {
  color: var(--text-color);
  font-size: 1.1rem;
  line-height: 1.6;
}

.certif-close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 30px;
  cursor: pointer;
  color: var(--text-color);
  transition: color 0.3s ease, transform 0.3s ease;
}

.certif-close:hover {
  color: var(--sidebar-active);
  transform: rotate(90deg);
}

/* Animation */
@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Contrôles de zoom pour les documents */
.document-controls {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin: 15px 0;
}

.zoom-button {
  background-color: var(--sidebar-active);
  color: white;
  border: none;
  border-radius: 5px;
  padding: 8px 15px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.zoom-button:hover {
  background-color: var(--sidebar-hover);
  transform: translateY(-2px);
}

/* Animation */
@keyframes fadeIn {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Responsive styles */
@media (max-width: 992px) {
  .certif-container {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .timeline-container {
    width: 90%;
  }

  .timeline-item {
    width: 90%;
  }
}

@media (max-width: 768px) {
  .timeline-line {
    left: 30px;
  }

  .timeline-item.left,
  .timeline-item.right {
    justify-content: flex-start;
    margin-left: 60px;
  }

  .timeline-item.left .cadre,
  .timeline-item.right .cadre {
    margin-left: 0;
    transform: translateX(0);
  }

  .timeline-item.left .cadre:before,
  .timeline-item.right .cadre:before {
    left: -60px;
  }

  .certif-card {
    padding: 25px;
  }
}

@media (max-width: 480px) {
  .timeline-item.left,
  .timeline-item.right {
    width: calc(100% - 60px);
  }

  .cadre {
    padding: 20px;
  }

  .cadre h3 {
    font-size: 1.5rem;
  }

  .certif-section h2 {
    font-size: 2rem;
  }
}

/* Ajustement pour les petits écrans */
@media (max-width: 768px) {
  .certif-popup-content {
    padding: 20px;
    width: 95%;
  }

  .certif-popup-content iframe {
    height: 400px !important;
  }
}

@media (max-height: 600px) {
  .certif-popup-content {
    max-height: 85vh;
    padding: 15px;
  }

  .certif-popup-content iframe {
    height: 300px !important;
  }
}

/* Améliorations pour le mode sombre */
.dark .certif-card {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.dark .certif-card:hover {
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.dark .certif-popup-content {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.dark .timeline-item.left .cadre:before,
.dark .timeline-item.right .cadre:before {
  box-shadow: 0 0 0 5px rgba(74, 192, 238, 0.2);
}

.dark .timeline-item:hover .cadre {
  box-shadow: 0 20px 40px rgba(74, 192, 238, 0.2);
}

/* Améliorations pour le mode sombre dans la section parcours */
.dark .timeline {
  background-color: var(--content-bg);
}

.dark .timeline-container {
  background-color: var(--content-bg);
}

.dark .cadre {
  background-color: var(--card-bg);
  color: var(--text-color);
  border-color: var(--sidebar-active);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.dark .cadre h3 {
  color: var(--heading-color);
}

.dark .cadre h4 {
  color: var(--sidebar-active);
}

.dark .cadre p {
  color: var(--text-color);
}

.dark .timeline-line {
  background: linear-gradient(to bottom, transparent, var(--sidebar-active), transparent);
}

.dark .timeline-item.left .cadre:before,
.dark .timeline-item.right .cadre:before {
  background-color: var(--sidebar-active);
  box-shadow: 0 0 0 5px rgba(74, 192, 238, 0.2);
}

.dark .timeline-item:hover .cadre {
  box-shadow: 0 20px 40px rgba(74, 192, 238, 0.2);
}

.dark .certif-card {
  background-color: var(--card-bg);
  border-color: var(--sidebar-active);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.dark .certif-card h3 {
  color: var(--heading-color);
}

.dark .certif-card p {
  color: var(--text-color);
}

.dark .certif-popup-btn {
  background-color: var(--sidebar-active);
  color: #121212;
}

.dark .certif-popup-btn:hover {
  background-color: var(--sidebar-hover);
}

.dark .certif-popup {
  background-color: rgba(0, 0, 0, 0.8);
}

.dark .certif-popup-content {
  background-color: var(--card-bg);
  border-color: var(--sidebar-active);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.dark .certif-popup-content h3 {
  color: var(--heading-color);
}

.dark .certif-popup-content p {
  color: var(--text-color);
}

.dark .certif-close {
  color: var(--text-color);
}

.dark .certif-close:hover {
  color: var(--sidebar-active);
}

.dark .career-card-front {
  background-color: var(--sidebar-active);
}

.dark .career-card-back {
  background-color: var(--card-bg);
  color: var(--text-color);
}

.dark .career-card-back h3 {
  color: var(--heading-color);
}

.certif-popup-content iframe {
  width: 100%;
  height: 700px;
  border: none;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  background-color: white; /* Toujours blanc pour les documents */
  transition: all 0.3s ease;
}

.dark .zoom-button {
  background-color: var(--sidebar-active);
  color: var(--card-bg);
}

/* Correction pour le parcours */
#parcours {
  background-color: transparent !important;
}

.dark #parcours {
  color: var(--text-color);
}

