/* 1. ROOT & CORE VARIABLES - MATCHING EDUCATION/STATS */
:root {
  --cert-accent: #00ffee;
  --cert-accent-dark: #00ccbb;
  --cert-glass-bg: rgba(255, 255, 255, 0.03); /* Transparent glass */
  --cert-glass-border: rgba(0, 255, 238, 0.15); /* Cyan border for clarity */
  --cert-glass-hover: rgba(255, 255, 255, 0.05);
  --cert-text-primary: #ffffff; /* Full white */
  --cert-text-muted: #b0b0b0;
  --cert-ease-curtain: cubic-bezier(0.33, 1, 0.68, 1);
  --cert-transition-smooth: all 0.3s ease; /* Matching stats timing */
  --cert-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* CERTIFICATIONS SECTION - MATCHING STYLE */
.cert-section {
  position: relative;
  padding: 100px 5%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  background: transparent;
  overflow: hidden;
  isolation: isolate;
}

.cert-container {
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  z-index: 2;
}

/* HEADER WITH GRADIENT TITLE */
.cert-header .cert-section-title {
  text-align: center;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  color: var(--cert-accent); /* Full white */
  position: relative;
  margin-bottom: 25px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

/* Underline effect matching education */
.cert-header .cert-section-title::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: var(--cert-accent);
  border-radius: 2px;
  box-shadow: 0 0 15px var(--cert-accent);
}

.cert-curtain-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  perspective: 2000px;
  position: relative;
  z-index: 2;
}

/* CARD COMPONENT - TRANSPARENT GLASS LIKE EDUCATION */
.cert-card {
  background: transparent;
  border: 1px solid var(--cert-accent); /* Cyan border */
  border-radius: 12px; /* Matching education border radius */
  padding: 25px;
  cursor: default;
  position: relative;
  opacity: 0;
  transform: translateX(-100px) rotateY(30deg) scale(0.95);
  will-change: transform, opacity;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  transition: all 0.3s ease; /* Matching stats timing */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.cert-card.visible {
  opacity: 1;
  transform: translateX(0) rotateY(0deg) scale(1);
  transition:
    opacity 0.8s var(--cert-ease-curtain),
    transform 0.8s var(--cert-ease-curtain);
}

.cert-card:hover {
  border-color: rgba(0, 255, 238, 0.4); /* Stronger cyan on hover */
  background: rgba(255, 255, 255, 0.03); /* Transparent glass */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transform: translateY(-10px) rotateY(0deg) scale(1.02) !important;
  box-shadow: 0 10px 25px rgba(0, 255, 238, 0.15); /* Matching stats shadow */
  z-index: 10;
}

/* THUMBNAIL - GLASS EFFECT */
.cert-thumbnail {
  position: relative;
  width: 100%;
  aspect-ratio: 16/10;
  border-radius: 12px; /* Matching border radius */
  overflow: hidden;
  margin-bottom: 25px;
  border: 1px solid rgba(0, 255, 238, 0.15);
  background: rgba(0, 0, 0, 0.2); /* Dark background for images */
  backdrop-filter: blur(5px);
  transition: all 0.3s ease;
}

.cert-card:hover .cert-thumbnail {
  border-color: rgba(0, 255, 238, 0.4);
}

.cert-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--cert-ease-curtain);
  pointer-events: none;
}

.cert-card:hover .cert-thumbnail img {
  transform: scale(1.08);
}

.cert-badge {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(0, 255, 238, 0.9);
  color: #000;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: 6px;
  text-transform: uppercase;
  z-index: 2;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
}

.cert-card:hover .cert-badge {
  background: rgba(0, 255, 238, 1);
  transform: scale(1.05);
}

/* CONTENT - MATCHING TEXT STYLES */
.cert-content h3 {
  font-size: 1.3rem;
  margin-top: 0;
  margin-bottom: 8px;
  color: var(--cert-text-primary); /* Full white */
  text-align: center;
  width: 100%;
  display: block;
  font-weight: 700;
  line-height: 1.4;
}

.cert-content p {
  color: var(--cert-text-primary); /* Full white instead of muted */
  margin-bottom: 20px;
  font-size: 0.95rem;
  text-align: center;
  opacity: 0.9;
}

/* BUTTONS - GLASS EFFECT */
.cert-actions {
  display: flex;
  gap: 12px;
}

.cert-download-btn,
.cert-view-btn {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
  border: none;
  position: relative;
  overflow: hidden;
}

.cert-download-btn {
  background: rgba(0, 255, 238, 0.9);
  color: #000;
  border: 1px solid rgba(0, 255, 238, 0.9);
}

.cert-download-btn:hover {
  background: rgba(0, 255, 238, 1);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 255, 238, 0.4);
}

.cert-view-btn {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border: 1px solid rgba(0, 255, 238, 0.15);
}

.cert-view-btn:hover {
  border-color: rgba(0, 255, 238, 0.4);
  background: rgba(0, 255, 238, 0.1);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 255, 238, 0.2);
}

/* MODAL - GLASS EFFECT - IMPROVED FOR MOBILE */
.cert-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(15px);
  z-index: 99999;
  opacity: 0;
  transition: opacity 0.4s ease;
  align-items: center;
  justify-content: center;
}

.cert-modal.active {
  display: flex;
  opacity: 1;
}

.cert-modal-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.cert-modal-image-container {
  width: 90%;
  max-width: 1200px;
  height: 90%;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 255, 238, 0.15);
  border-radius: 12px;
  padding: 20px;
  position: relative;
}

.cert-modal-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 0 50px rgba(0, 255, 238, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transform: scale(0.9);
  transition: transform 0.5s var(--cert-ease-curtain);
}

.cert-modal.active .cert-modal-image {
  transform: scale(1);
}

/* FIXED CLOSE BUTTON - SINGLE X CENTERED PROPERLY */
/* FIXED CLOSE BUTTON - SINGLE X CENTERED PROPERLY */
.cert-modal-close {
  position: fixed; /* Changed from absolute to fixed */
  top: 80px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid rgba(0, 255, 238, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 1000001; /* Increased from 1000000 */
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.3),
    0 0 20px rgba(0, 255, 238, 0.2);
}

.cert-modal-close:hover {
  background: rgba(0, 255, 238, 0.9);
  color: #000;
  border-color: rgba(0, 255, 238, 0.9);
  transform: rotate(90deg) scale(1.1);
  box-shadow: 
    0 6px 25px rgba(0, 0, 0, 0.4),
    0 0 30px rgba(0, 255, 238, 0.4);
}
/* REMOVED THE DUPLICATE INSIDE CLOSE BUTTON */
.cert-modal-close-inside {
  display: none; /* Completely hide the duplicate */
}

/* TOUCH-AREA EXTENSION FOR BETTER MOBILE UX */
.cert-modal-close-touch-area {
  position: fixed;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  z-index: 999999;
  display: none;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
  .cert-curtain-row {
    grid-template-columns: 1fr 1fr;
  }

  .cert-section {
    padding: 80px 5%;
    min-height: auto;
  }
  
  .cert-modal-image-container {
    width: 95%;
    height: 85%;
    padding: 15px;
  }
}

@media (max-width: 768px) {
  .cert-curtain-row {
    grid-template-columns: 1fr;
  }

  .cert-modal-image-container {
    width: 95%;
    height: 75%;
    padding: 10px;
    margin-top: 50px;
  }
  
  .cert-modal-close {
    top: 95px;
    right: 15px;
    width: 45px;
    height: 45px;
    font-size: 24px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid rgba(0, 255, 238, 0.6);
    box-shadow: 
      0 4px 15px rgba(0, 0, 0, 0.5),
      0 0 15px rgba(0, 255, 238, 0.3);
  }
  
  /* Hide the touch area extension */
  .cert-modal-close-touch-area {
    display: block;
  }
  
  .cert-modal-content {
    padding: 20px 15px;
  }
  
  .cert-actions {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .cert-section {
    padding: 60px 5%;
  }

  .cert-card {
    padding: 20px;
  }

  .cert-modal-image-container {
    width: 98%;
    height: 65%;
    padding: 8px;
    margin-top: 60px;
  }
  
  .cert-modal-close {
    position: absolute; /* Changed from absolute to fixed */
    margin-top: 35px; /* Increased from 10px */
    right: 15px; /* Increased from 10px */
    width: 45px; /* Increased from 40px */
    height: 45px; /* Increased from 40px */
    font-size: 24px; /* Increased from 20px */
    background: rgba(0, 0, 0, 0.95); /* Increased opacity */
    border: 3px solid rgba(0, 255, 238, 0.9); /* Thicker, brighter border */
    box-shadow: 
      0 4px 15px rgba(0, 0, 0, 0.8),
      0 0 25px rgba(0, 255, 238, 0.5); /* Stronger glow */
    z-index: 1000001; /* Higher z-index */
  }
  
  .cert-modal-close-touch-area {
    position: fixed;
    top: 0;
    right: 0;
    width: 80px; /* Increased from 70px */
    height: 80px; /* Increased from 70px */
    z-index: 1000000;
    background: transparent;
  }
  
  /* Add this to ensure modal content doesn't overlap close button */
  .cert-modal-content {
    padding-top: 70px; /* Add padding at top for close button */
  }
}

/* VERY SMALL SCREENS (iPhone SE, Galaxy Fold, etc.) */
@media (max-width: 375px) {
  .cert-modal-image-container {
    height: 60%;
    margin-top: 70px;
  }
  
  .cert-modal-close {
    position: absolute;
    margin-top: 170px;
    width: 40px;
    height: 40px;
    font-size: 22px;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.95);
    border: 3px solid rgba(0, 255, 238, 0.9);
    box-shadow: 
      0 4px 15px rgba(0, 0, 0, 0.8),
      0 0 25px rgba(0, 255, 238, 0.6);
    z-index: 1000001;
  }
  
  .cert-modal-content {
    padding: 15px 10px;
    padding-top: 65px;
  }
  
  .cert-modal-close-touch-area {
    width: 75px;
    height: 75px;
  }
}

/* LANDSCAPE MODE FOR MOBILE */
@media (max-height: 600px) and (orientation: landscape) {
  .cert-modal-image-container {
    height: 85%;
    width: 90%;
    margin-top: 15px;
  }
  
  .cert-modal-close {
    position: fixed;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.95);
    border: 3px solid rgba(0, 255, 238, 0.9);
    z-index: 1000001;
  }
  
  .cert-modal-content {
    padding-top: 60px;
  }
}

/* EXTRA SMALL HEIGHT SCREENS */
@media (max-height: 500px) {
  .cert-modal-close {
    top: 8px;
    right: 8px;
    width: 35px;
    height: 35px;
    font-size: 20px;
  }
  
  .cert-modal-content {
    padding-top: 50px;
  }
}

/* DARK MODE ENHANCEMENTS */
@media (prefers-color-scheme: dark) {
  .cert-modal-close {
    background: rgba(0, 0, 0, 0.95); /* Increased opacity */
    border-color: rgba(0, 255, 238, 0.8); /* Brighter border for dark mode */
  }
}

/* HIGH CONTRAST MODE SUPPORT */
@media (prefers-contrast: high) {
  .cert-modal-close {
    background: #000;
    border: 3px solid #00ffee;
    color: #fff;
    box-shadow: 
      0 0 0 3px #000, /* Outer black border for extra contrast */
      0 4px 20px rgba(0, 0, 0, 0.9),
      0 0 30px rgba(0, 255, 238, 0.8);
  }
}