/* ===================================================================
   CORPORATE TRAINING PROGRAMS - NO FLIP ON MOBILE
   =================================================================== */

.corporate-programs-section {
  padding: 80px 0;
  background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
  position: relative;
  overflow-x: hidden; /* Prevent horizontal scroll */
}

.corporate-programs-section .container.cp {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%; /* Full width */
  box-sizing: border-box; /* Include padding in width */
}

/* Section Header */
.section-title {
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 700;
  text-align: center;
  color: #2c3e50;
  margin-bottom: 15px;
  letter-spacing: -0.5px;
}

.section-subtitle {
  text-align: center;
  color: #7f8c8d;
  font-size: clamp(0.9rem, 1.5vw, 1.1rem);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 20px;
  font-weight: 500;
}

.title-underline {
  width: 80px;
  height: 4px;
  background: linear-gradient(90deg, #1abc9c, #16a085);
  margin: 0 auto 60px;
  border-radius: 2px;
}

/* Programs Grid - FIXED FOR ZOOM CENTERING */
.programs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); /* Changed to auto-fit */
  gap: 35px;
  margin-top: 40px;
  justify-items: center; /* Center items horizontally */
  margin-left: auto; /* Center grid itself */
  margin-right: auto; /* Center grid itself */
}

/* Flip Card Container */
.program-card {
  perspective: 1000px;
  height: 450px;
  cursor: pointer;
  position: relative;
  width: 100%; /* Ensure full width */
  max-width: 400px; /* Prevent over-stretching */
}

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

.program-card:hover .card-inner {
  transform: rotateY(180deg);
}

/* Card Sides */
.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.3s ease;
}

.program-card:hover .card-front,
.program-card:hover .card-back {
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

/* ===== FRONT SIDE ===== */
.card-front {
  background: #fff;
  display: flex;
  flex-direction: column;
}

.card-image {
  width: 100%;
  height: 200px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.program-card:hover .card-image img {
  transform: scale(1.08);
}

/* WhatsApp Icon */
.card-whatsapp-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 45px;
  height: 45px;
  background: linear-gradient(135deg, #25D366, #128C7E);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
  transition: all 0.3s ease;
  z-index: 10;
  text-decoration: none;
}

.card-whatsapp-btn:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.6);
}

.card-whatsapp-btn i {
  color: #fff;
  font-size: 1.3rem;
}

/* Content Section */
.card-content {
  padding: 25px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 12px;
  line-height: 1.4;
  min-height: 60px;
}

.card-description {
  font-size: 0.93rem;
  color: #5a6c7d;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 20px;
  flex-grow: 1;
}

/* Action Button */
.card-front-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 15px;
  border-top: 1px solid #e9ecef;
}

.know-more-front-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #1abc9c, #16a085);
  color: #fff;
  text-decoration: none;
  border-radius: 25px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.know-more-front-btn:hover {
  background: linear-gradient(135deg, #16a085, #1abc9c);
  transform: translateX(5px);
  box-shadow: 0 4px 15px rgba(26, 188, 156, 0.3);
}

.know-more-front-btn i {
  transition: transform 0.3s ease;
}

.know-more-front-btn:hover i {
  transform: translateX(3px);
}

/* ===== BACK SIDE ===== */
.card-back {
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 30px;
  text-align: center;
  color: #fff;
}

.card-back h3 {
  font-size: 1.9rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.card-back p {
  font-size: 1.05rem;
  line-height: 1.7;
  margin-bottom: 30px;
  opacity: 0.95;
}

.know-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid #fff;
  color: #fff;
  text-decoration: none;
  border-radius: 30px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.know-more-btn:hover {
  background: #fff;
  color: #1abc9c;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.know-more-btn i {
  transition: transform 0.3s ease;
}

.know-more-btn:hover i {
  transform: translateX(5px);
}

/* Card Back Color Themes */
.program-card:nth-child(1) .card-back { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.program-card:nth-child(2) .card-back { background: linear-gradient(135deg, #1abc9c 0%, #16a085 100%); }
.program-card:nth-child(3) .card-back { background: linear-gradient(135deg, #3498db 0%, #2980b9 100%); }
.program-card:nth-child(4) .card-back { background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%); }
.program-card:nth-child(5) .card-back { background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%); }
.program-card:nth-child(6) .card-back { background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%); }
.program-card:nth-child(7) .card-back { background: linear-gradient(135deg, #1abc9c 0%, #16a085 100%); }
.program-card:nth-child(8) .card-back { background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%); }

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

/* Desktop Large (4 columns) */
@media (min-width: 1200px) {
  .programs-grid {
    grid-template-columns: repeat(4, 1fr);
    justify-content: center; /* Center the entire grid */
  }
}

/* Desktop (3 columns) */
@media (max-width: 1199px) and (min-width: 992px) {
  .programs-grid {
    grid-template-columns: repeat(3, 1fr);
    justify-content: center; /* Center the entire grid */
  }
}

/* Tablet (2 columns) */
@media (max-width: 991px) and (min-width: 768px) {
  .programs-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    justify-content: center; /* Center the entire grid */
  }

  .program-card {
    height: 420px;
  }
}

/* ===== MOBILE - NO FLIP EFFECT ===== */
@media (max-width: 767px) {
  .corporate-programs-section {
    padding: 60px 0;
  }

  .programs-grid {
    grid-template-columns: 1fr;
    gap: 25px;
    justify-items: center; /* Center items */
  }

  .program-card {
    height: auto;
    min-height: 400px;
    max-width: 500px;
    margin: 0 auto;
    perspective: none; /* Disable 3D */
    cursor: default;
  }

  .card-inner {
    transform: none !important; /* No flip */
    transform-style: flat !important;
  }

  .program-card:hover .card-inner {
    transform: none !important; /* Disable hover flip */
  }

  .card-front {
    position: relative !important; /* Not absolute */
    backface-visibility: visible !important;
  }

  .card-back {
    display: none !important; /* Hide back side completely */
  }

  .card-title {
    font-size: 1.25rem;
    min-height: auto;
  }

  .card-description {
    font-size: 0.9rem;
  }

  .card-whatsapp-btn {
    width: 40px;
    height: 40px;
  }

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

  .title-underline {
    margin-bottom: 40px;
  }
}

/* Extra Small Mobile */
@media (max-width: 480px) {
  .corporate-programs-section .container.cp {
    padding: 0 15px;
  }

  .card-content {
    padding: 20px 15px;
  }

  .know-more-front-btn {
    padding: 9px 18px;
    font-size: 0.85rem;
  }

  .card-title {
    font-size: 1.2rem;
  }

  .card-description {
    font-size: 0.88rem;
  }
}

/* Performance Optimizations */
@media (prefers-reduced-motion: reduce) {
  .card-inner,
  .card-image img,
  .know-more-btn,
  .know-more-front-btn,
  .card-whatsapp-btn {
    transition-duration: 0.01ms !important;
  }

  .program-card:hover .card-inner {
    transform: none !important;
  }
}

/* Prevent layout shift */
.card-image img {
  will-change: transform;
}

.card-inner {
  will-change: transform;
}

/* spinner */
/* Loading Spinner */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  min-height: 400px;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #1abc9c;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-spinner p {
  margin-top: 20px;
  color: #7f8c8d;
  font-size: 1rem;
  font-weight: 500;
}

/* Error Message */
.error-message {
  text-align: center;
  padding: 60px 20px;
  color: #e74c3c;
}

.error-message p {
  margin-bottom: 20px;
  font-size: 1.1rem;
}

.error-message button {
  padding: 12px 30px;
  background: #1abc9c;
  color: #fff;
  border: none;
  border-radius: 25px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.error-message button:hover {
  background: #16a085;
  transform: translateY(-2px);
}
