/*
 * Uniform Card Styles - Standardized Card Component
 * Ensures all cards have identical dimensions and layout
 * Based on the 3rd blog card design pattern
 */

/* Grid Container - Forces Equal Heights */
.uniform-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 30px;
  padding: 40px 0;
  align-items: start; /* Changed from stretch to start to prevent overflow */
}

/* Card Container - Fixed Dimensions */
.uniform-card-item {
  display: flex;
  width: 100%;
  height: 100%;
}

.uniform-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 630px; /* INCREASED HEIGHT to accommodate button overflow */
  background: #050f2c;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
}

.uniform-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

/* Image Section - Fixed Dimensions */
.uniform-card-image-link {
  display: block;
  width: 100%;
  height: 260px; /* FIXED IMAGE HEIGHT */
  overflow: hidden;
  position: relative;
  flex-shrink: 0; /* Prevent shrinking */
}

.uniform-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.3s ease;
}

.uniform-card:hover .uniform-card-image {
  transform: scale(1.05);
}

/* Content Section - Flex Layout with Fixed Areas */
.uniform-card-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 30px;
  height: 280px; /* AGGRESSIVELY REDUCED CONTENT HEIGHT to fix button overflow */
  min-height: 280px;
  max-height: 280px;
  overflow: hidden;
  box-sizing: border-box; /* Ensure padding is included in height calculation */
}

/* Header Section - Category + Author */
.uniform-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  height: 30px; /* FIXED HEADER HEIGHT */
  flex-shrink: 0;
}

.uniform-card-category {
  display: flex;
  align-items: center;
}

.uniform-card-category-flex {
  display: flex;
  align-items: center;
}

.uniform-card-category-dot {
  width: 8px;
  height: 8px;
  background: #667eea;
  border-radius: 50%;
  margin-right: 10px;
  flex-shrink: 0;
}

.uniform-card-category-text {
  color: #667eea;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.uniform-card-author {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.uniform-card-author-icon {
  width: 20px;
  height: 20px;
  margin-right: 8px;
  flex-shrink: 0;
}

.uniform-card-author-name {
  color: #a0aec0;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Title Section - Fixed Height */
.uniform-card-title {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  text-decoration: none;
  margin-bottom: 12px;
  height: 66px; /* FIXED TITLE HEIGHT (3 lines max) */
  line-height: 1.3;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.uniform-card-title:hover {
  color: #667eea;
  text-decoration: none;
}

/* Divider */
.uniform-card-divider {
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #667eea, transparent);
  margin-bottom: 20px;
  flex-shrink: 0;
}

/* Description Section - Fixed Height with Overflow */
.uniform-card-description {
  font-size: 15px;
  line-height: 1.6;
  color: #a0aec0;
  margin: 0 0 10px 0;
  height: 90px; /* FURTHER REDUCED DESCRIPTION HEIGHT to ensure button fits */
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

/* Action Button - Always at Bottom */
.uniform-card-action {
  margin-top: auto; /* Push to bottom */
  padding-top: 8px;
  padding-bottom: 0;
  flex-shrink: 0;
  min-height: 0; /* Allow shrinking if needed */
}

.uniform-card-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: #667eea;
  font-weight: 600;
  font-size: 16px;
  transition: all 0.3s ease;
  padding: 8px 0;
}

.uniform-card-button:hover {
  color: #ffffff;
  text-decoration: none;
  transform: translateX(5px);
}

.uniform-card-button-text {
  margin-right: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px; /* Prevent extremely long button text */
  flex-shrink: 1;
}

.uniform-card-button-arrow {
  width: 16px;
  height: 16px;
  background: url('../../images/Blog-Card-Link-Arrow.svg') no-repeat center;
  background-size: contain;
  transition: transform 0.3s ease;
}

.uniform-card-button:hover .uniform-card-button-arrow {
  transform: translateX(5px);
}

/* Responsive Design - Maintains Proportions */
@media screen and (max-width: 991px) {
  .uniform-card-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
  }

  .uniform-card {
    height: 580px; /* Slightly smaller on tablets */
  }

  .uniform-card-content {
    height: 320px;
    padding: 25px;
  }
}

@media screen and (max-width: 767px) {
  .uniform-card-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .uniform-card {
    height: 560px; /* Optimized for mobile */
  }

  .uniform-card-content {
    height: 300px;
    padding: 20px;
  }

  .uniform-card-title {
    font-size: 20px;
    height: 60px;
  }

  .uniform-card-description {
    font-size: 14px;
    height: 105px;
    -webkit-line-clamp: 4;
  }
}

/* Grid Layout Override for Existing Classes */
.main-blog-collection-list.use-uniform-cards {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)) !important;
  gap: 30px !important;
  padding: 40px 0 !important;
  align-items: stretch !important;
}

.main-blog-collection-list.use-uniform-cards .main-blog-collection-list-item {
  display: flex !important;
  width: 100% !important;
  height: 100% !important;
}

.main-blog-collection-list.use-uniform-cards .main-blog-single {
  height: 600px !important;
  display: flex !important;
  flex-direction: column !important;
}