/* Qualification.css */
.cert-section {
  min-height: 100vh;
  padding: 6rem 8%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Tab Buttons */
.tab-buttons {
  display: flex;
  justify-content: center;
  gap: 25px;
  margin-bottom: 50px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 15px 32px;
  border-radius: 50px;
  border: 2px solid transparent;
  cursor: pointer;
  font-weight: 700;

  background: var(--card-bg-light);
  color: var(--text-primary);
  box-shadow: var(--shadow);

  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn i {
  font-size: 1.1rem;
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #FFF;
  border-color: 2px solid var(--sec-hover);
  box-shadow: 
          0 0 0 3px rgba(78, 205, 196, 0.2),
          0 8px 24px rgba(78, 205, 196, 0.3);
  transform: translateY(-2px);
}

.tab-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

/* Tab Panels */
.tab-wrapper {
  position: relative;
}

.tab-panel {
  width: 100%;
  opacity: 0;
  visibility: hidden;
  transform: translateY(30px);
  
  position: absolute;
  top: 0;
  left: 0;

  transition: opacity 0.4s ease, 
              transform 0.4s ease,
              visibility 0.4s ease;
}

.tab-panel.active {
  position: relative;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/*Certificate GRID */
.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 40px;
  justify-items: center;

  max-width: 1200px;
  margin: 0 auto;
}

/*Certificate CARD */
.cert-card {
  width: 100%;
  max-width: 360px;
  min-height: 320px;
  height: auto;
  perspective: 1200px;
  cursor: pointer;
  outline: none;

/* Individual card animation */
  opacity: 0;
  transform: translateY(20px);
  animation: cardFadeIn 0.6s ease forwards;
}

/* Staggered animation delays for cards */
.cert-grid .cert-card:nth-child(1) { animation-delay: 0.4s; }
.cert-grid .cert-card:nth-child(2) { animation-delay: 0.8s; }
.cert-grid .cert-card:nth-child(3) { animation-delay: 1.2s; }
.cert-grid .cert-card:nth-child(4) { animation-delay: 1.6s; }
.cert-grid .cert-card:nth-child(5) { animation-delay: 2.0s; }
.cert-grid .cert-card:nth-child(6) { animation-delay: 2.4s; }
.cert-grid .cert-card:nth-child(7) { animation-delay: 2.8s; }
.cert-grid .cert-card:nth-child(8) { animation-delay: 3.2s; }
.cert-grid .cert-card:nth-child(9) { animation-delay: 3.6s; }
.cert-grid .cert-card:nth-child(10) { animation-delay: 4.0s; }


@keyframes cardFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cert-card:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 6px;
  border-radius: var(--radius);
}

.cert-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.7s cubic-bezier(0.4, 0.2, 0.2, 1);
  transform-style: preserve-3d;
}

.cert-card:hover .cert-inner,
.cert-card.active .cert-inner {
  transform: rotateY(180deg);
}

/* Card FACE */
.cert-face {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden; /* Safari fix */

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 30px;
}

/* Front Face */
.cert-front {
  background: var(--card-bg-light);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px); /* Safari fix */

  border-radius: var(--radius);
  border: 1px solid rgba(78, 205, 196, 0.2);
  box-shadow: var(--shadow);

  display: flex; 
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;

  padding: 20px;
  text-align: center;
  
  transition: var(--transition);
}

.cert-card:hover .cert-front {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  border-color: rgba(78, 205, 196, 0.3);
}

  body.dark .cert-front {
  border: 1px solid rgba(78, 205, 196, 0.15);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.cert-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 240px;              /* consistent frame */
  background: #FFFFFF;
  border-radius: 12px;

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

  overflow: hidden;

  /* margin-bottom: 1rem; */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.cert-front img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* keeps full image visible */

  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.15));
  transition: transform 0.3s ease;
}

 .cert-card:hover .cert-front img {
  transform: scale(1.2);
  transition: transform 0.4s ease;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  border-color: rgba(78, 205, 196, 0.3);
}

/* Tittle */
.cert-front h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);

  line-height: 1.2;
  max-width: 100%;

  text-align: center; 
} 

.cert-front span {
  font-size: 0.9rem;
  color: var(--text-light);
  font-weight: 500;
} 

/* BACK Face*/
.cert-back {
  background: linear-gradient(145deg, var(--primary), var(--secondary));
  transform: rotateY(180deg);
  text-align: center;
  color: #FFF;
  padding: 20px 16px;

}

.cert-back h4 {
  margin-bottom: 15px;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.cert-back ul {
  list-style: none;
  margin-bottom: 20px;
  padding: 0;
}

.cert-back li {
  font-size: 1rem;
  margin-bottom: 10px;
  opacity: 0.95;
  line-height: 1.5;
}

.cert-back li::before {
  content: "✓ ";
  font-weight: bold;
  margin-right: 0.5rem;
}


.cert-back time {
  display: block;
  font-size: 0.9rem;
  opacity: 0.9;
  margin-bottom: 20px;
  font-weight: 450;
}

.cert-back a {
  display: inline-block;
  padding: 12px 28px;
  background: #E0E0E0;
  color: var(--neutral);
  border-radius: 50px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;

  transition: transform 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cert-back a:hover,
.cert-back a:focus {

  transform: translateY(-2px) scale(1.1);
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  outline: none;
}

.cert-back a:focus-visible {
  outline: 3px solid #FFFFFF;
  outline-offset: 3px;
}

/*  ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1024px) {
  .cert-section {
    padding: 5rem 6%;
    
  }

  .cert-grid {
    gap: 2.5rem;
  }
}

/* ================= TABLET (768px - 968px) ================= */
@media (max-width: 992px) {

  .cert-section {
    padding: 4rem 5%;
  }

  .cert-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
  }

  .cert-card {
    max-width: 100%;
  }

  .tab-buttons {
    gap: 1rem;
  }
}

/* ===== MOBILE ===== (600px - 768px)*/
@media (max-width: 768px) {
  .cert-section {
    padding: 3.5rem 5%;
  }

  .cert-header h2 {
    font-size: 2.2rem;
  }

  .cert-header p {
    font-size: 1rem;
  }

  .cert-grid {
    gap: 2rem;
  }

  .cert-card {
    max-width: 100%;
    height: 300px;
  }

  .tab-buttons {
    gap: 1rem;
  }

  .tab-btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
  }
}

/*================ SMALL MOBILE (375px - 480px) ================= */
@media (max-width: 480px) {

   .cert-section {
    padding: 3rem 4%;
  }

  .cert-face {
    padding: 1.5rem;
  }

  .cert-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.8rem;
  }
  .cert-image {
    height: 200px;
  }

  .cert-front h3 {
    margin-top: auto;
    font-size: 1.2rem;
  }

  .cert-front span {
    font-size: 0.9rem;
  }
  .cert-back h4 {
    font-size: 1rem;
  }

  .cert-back li {
    font-size: 0.9rem;
  }

  .tab-btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.8rem;
  }
}

/*================= EXTRA SMALL MOBILE (320px - 375px) ================= */
@media (max-width: 375px) {

  .cert-image {
    max-height: 160px;
  }

  .cert-front h3 {
    font-size: 0.9rem;
  }

  .cert-back li {
    font-size: 0.85rem;
  }

  .tab-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ========================================
   REDUCED MOTION
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  .cert-card {
    animation: none;
    opacity: 1;
    transform: none;
  }
  
  .cert-inner {
    transition: none;
  }

  .cert-card:hover .cert-inner,
  .cert-card.active .cert-inner {
    transform: none;
  }

  .cert-back {
    transform: none;
    display: none;
  }

  .cert-card.active .cert-front {
    display: none;
  }

  .cert-card.active .cert-back {
    display: flex;
    transform: none;
  }

  .tab-panel {
    transition: none;
  }
}
