/**
 * @file
 * Layout styles for EGR Cards component.
 */

/* Background wrapper - always edge to edge */
.egr-cards-bg-wrapper {
  width: 100%;
  padding: 0;
  margin: 0;
}

/* When background color is applied */
.egr-cards-bg-wrapper[style*="background-color"] {
  padding: 3rem 0;
}

/* Ensure transparent background for component when wrapper has color */
.egr-cards-bg-wrapper[style*="background-color"] .egr-cards {
  background-color: transparent;
}

/* Edge to edge layout */
.egr-cards-edge-to-edge {
  width: 100%;
  max-width: 100%;
  padding: 0 2rem;
  margin: 0;
}

/* Container-based layouts already have Bootstrap styling */
.container .egr-cards,
.container-fluid .egr-cards {
  margin: 2rem 0;
}

/* Column control styles */
.egr-cards {
  display: grid;
  gap: 1.5rem;
  margin: 2rem 0;
}

/* Default auto-fit columns */
.egr-cards:not(.egr-cards--cols-2):not(.egr-cards--cols-3):not(.egr-cards--cols-4) {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* Fixed column layouts */
.egr-cards--cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.egr-cards--cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.egr-cards--cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* Responsive adjustments for fixed columns */
@media (max-width: 1200px) {
  .egr-cards--cols-4 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 992px) {
  .egr-cards--cols-4,
  .egr-cards--cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .egr-cards--cols-4,
  .egr-cards--cols-3,
  .egr-cards--cols-2 {
    grid-template-columns: 1fr;
  }
  
  .egr-cards-edge-to-edge {
    padding: 0 1rem;
  }
}

/* Card styling adjustments when background is present */
.egr-cards-bg-wrapper[style*="background-color"] .egr-card {
  background-color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Ensure consistent card styling */
.egr-card {
  border-radius: 0;
  overflow: hidden;
  transition: all 0.3s ease;
}

.egr-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Adjust padding when no background color */
.egr-cards-bg-wrapper:not([style*="background-color"]) {
  padding: 2rem 0;
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .egr-card {
    transition: none;
  }
  
  .egr-card:hover {
    transform: none;
  }
}