/* General resets for Features Grid to avoid theme overrides */
.megaplast-features-grid,
.megaplast-features-grid * {
  box-sizing: border-box;
}

.megaplast-features-grid p {
  padding: 0 !important;
  margin: 0 !important;
}

/* Grid Layout definitions */
.megaplast-features-grid {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(var(--megaplast-grid-cols, var(--megaplast-default-cols, 4)), minmax(0, 1fr)) !important;
}

.megaplast-features-grid--cols-4 {
  --megaplast-default-cols: 4;
}

.megaplast-features-grid--cols-3 {
  --megaplast-default-cols: 3;
}

.megaplast-features-grid--cols-2 {
  --megaplast-default-cols: 2;
}

.megaplast-features-grid--cols-1 {
  --megaplast-default-cols: 1;
}

/* ==========================================
   LAYOUT 1: Proof Grid
   ========================================== */
.megaplast-features-grid--proof_grid {
  --megaplast-default-cols: 4;
  align-items: center;
  min-height: 165px;
}

.megaplast-features-grid--proof_grid .megaplast-features-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 19px;
  align-items: center;
  min-height: 82px;
  padding: 0 36px;
  border-left: 1px solid var(--megaplast-border, #dce4f2);
  transition: transform 180ms ease, color 180ms ease;
}

.megaplast-features-grid--proof_grid .megaplast-features-item:first-child {
  border-left: 0;
  padding-left: 0;
}

.megaplast-features-grid--proof_grid .megaplast-features-icon {
  display: grid;
  place-items: center;
  color: var(--megaplast-blue, #0e48b8);
  transition: transform 180ms ease;
}

.megaplast-features-grid--proof_grid .megaplast-features-icon svg {
  width: 47px;
  height: 47px;
  stroke-width: 1.9;
  fill: none;
  stroke: currentColor;
}

.megaplast-features-grid--proof_grid h2 {
  margin: 0 0 8px !important;
  color: var(--megaplast-blue, #0e48b8);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
}

.megaplast-features-grid--proof_grid p {
  max-width: 245px;
  margin: 0 !important;
  color: var(--megaplast-muted-dark, #44506c);
  font-size: 13px;
  line-height: 1.45;
}

.megaplast-features-grid--proof_grid .megaplast-features-item:hover {
  transform: translateY(-2px);
}

.megaplast-features-grid--proof_grid .megaplast-features-item:hover .megaplast-features-icon {
  transform: translateY(-2px);
}

/* ==========================================
   LAYOUT 2: Feature Row
   ========================================== */
.megaplast-features-grid--feature_row {
  --megaplast-default-cols: 3;
  gap: 42px;
  margin-top: 58px;
}

.megaplast-features-grid--feature_row .megaplast-features-item {
  min-width: 0;
  transition: transform 180ms ease;
}

.megaplast-features-grid--feature_row .megaplast-features-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 24px;
  color: var(--megaplast-blue, #0e48b8);
  background: #eef4ff;
  border-radius: 999px;
  transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.megaplast-features-grid--feature_row .megaplast-features-icon svg {
  width: 30px;
  height: 30px;
  stroke-width: 1.9;
  fill: none;
  stroke: currentColor;
}

.megaplast-features-grid--feature_row h3 {
  margin: 0 0 11px !important;
  color: var(--megaplast-text, #101a3d);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
}

.megaplast-features-grid--feature_row p {
  margin: 0 !important;
  color: var(--megaplast-muted, #7a89a8);
  font-size: 13px;
  line-height: 1.62;
}

.megaplast-features-grid--feature_row .megaplast-features-item:hover {
  transform: translateY(-3px);
}

.megaplast-features-grid--feature_row .megaplast-features-item:hover .megaplast-features-icon {
  color: #ffffff !important;
  background-color: var(--megaplast-blue, #0e48b8) !important;
  transform: translateY(-2px);
}

/* ==========================================
   LAYOUT 3: Commitment Items
   ========================================== */
.megaplast-features-grid--commitments {
  --megaplast-default-cols: 4;
  gap: 28px;
}

.megaplast-features-grid--commitments .megaplast-features-item {
  display: grid;
  justify-items: center;
  text-align: center;
  padding: 10px 8px;
  border-radius: 8px;
  transition: background-color 180ms ease, transform 180ms ease;
}

.megaplast-features-grid--commitments .megaplast-features-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 22px;
  color: var(--megaplast-blue, #0e48b8);
  transition: transform 180ms ease;
}

.megaplast-features-grid--commitments .megaplast-features-icon svg {
  width: 47px;
  height: 47px;
  stroke-width: 1.8;
  fill: none;
  stroke: currentColor;
}

.megaplast-features-grid--commitments h3 {
  margin: 0 0 10px !important;
  color: var(--megaplast-text, #101a3d);
  font-size: 18px;
  font-weight: 820;
  line-height: 1.2;
}

.megaplast-features-grid--commitments p {
  margin: 0 !important;
  color: var(--megaplast-muted, #7a89a8);
  font-size: 14px;
  line-height: 1.5;
}

.megaplast-features-grid--commitments .megaplast-features-item:hover {
  background: rgba(14, 72, 184, 0.05);
  transform: translateY(-3px);
}

.megaplast-features-grid--commitments .megaplast-features-item:hover .megaplast-features-icon {
  transform: translateY(-2px);
}


/* ==========================================
   LAYOUT 4: Quote Flow
   ========================================== */
.megaplast-features-grid--quote_flow {
  --megaplast-default-cols: 3;
  max-width: 1060px;
  margin: 61px auto 0;
}

.megaplast-features-grid--quote_flow .megaplast-features-item {
  position: relative;
  display: grid;
  justify-items: center;
  text-align: center;
  transition: transform 180ms ease;
}

.megaplast-features-grid--quote_flow .step-number {
  position: absolute;
  top: 0;
  left: calc(50% - 82px);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #ffffff;
  background: var(--megaplast-blue, #0e48b8);
  border-radius: 999px;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
}

.megaplast-features-grid--quote_flow .megaplast-features-icon {
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  color: var(--megaplast-text, #101a3d);
  background: #ffffff;
  border-radius: 999px;
  box-shadow: 0 12px 34px rgba(16, 38, 83, 0.06);
  transition: color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.megaplast-features-grid--quote_flow .megaplast-features-icon svg {
  width: 45px;
  height: 45px;
  stroke-width: 2.1;
  fill: none;
  stroke: currentColor;
}

.megaplast-features-grid--quote_flow h3 {
  margin: 26px 0 10px !important;
  color: var(--megaplast-text, #101a3d);
  font-size: 19px;
  font-weight: 790;
  line-height: 1.2;
}

.megaplast-features-grid--quote_flow p {
  max-width: 290px;
  margin: 0 !important;
  color: var(--megaplast-muted-dark, #44506c);
  font-size: 13px;
  line-height: 1.55;
}

.megaplast-features-grid--quote_flow .megaplast-features-item:hover {
  transform: translateY(-4px);
}

.megaplast-features-grid--quote_flow .megaplast-features-item:hover .megaplast-features-icon {
  color: var(--megaplast-blue, #0e48b8);
  box-shadow: 0 18px 42px rgba(14, 72, 184, 0.12);
  transform: scale(1.03);
}

/* Pseudo-element flow-line connecting the step circle icons */
.megaplast-features-grid--quote_flow .megaplast-features-item::after {
  content: "";
  position: absolute;
  top: 56px;
  left: calc(50% + 76px);
  width: calc(100% - 152px);
  height: 0;
  border-top: 2px dashed rgba(14, 72, 184, 0.22);
  z-index: 1;
}

/* Hide flow line for the last item of each row based on column count */
.megaplast-features-grid--cols-4 .megaplast-features-item:nth-child(4n)::after {
  display: none !important;
}
.megaplast-features-grid--cols-3 .megaplast-features-item:nth-child(3n)::after {
  display: none !important;
}
.megaplast-features-grid--cols-2 .megaplast-features-item:nth-child(2n)::after {
  display: none !important;
}
.megaplast-features-grid--cols-1 .megaplast-features-item::after {
  display: none !important;
}
.megaplast-features-grid--quote_flow .megaplast-features-item:last-child::after {
  display: none !important;
}


/* ==========================================
   RESPONSIVE LAYOUTS
   ========================================== */

/* Breakpoint: max-width 1180px */
@media (max-width: 1180px) {
  .megaplast-features-grid--proof_grid .megaplast-features-item {
    padding: 0 18px;
  }
}

/* Breakpoint: tablet max-width 991px */
@media (max-width: 991px) {
  .megaplast-features-grid {
    grid-template-columns: repeat(var(--megaplast-grid-cols, 2), minmax(0, 1fr)) !important;
  }

  .megaplast-features-grid--feature_row {
    gap: 32px 28px !important;
    margin-top: 36px !important;
  }
  
  .megaplast-features-grid--commitments {
    gap: 36px 20px !important;
  }

  .megaplast-features-grid--quote_flow .megaplast-features-item::after {
    top: 28px !important;
    left: calc(50% + 38px) !important;
    width: calc(100% - 76px) !important;
    display: block !important;
  }

  /* Default flow-line hiding on tablet (assuming 2 columns default) */
  .megaplast-features-grid--quote_flow .megaplast-features-item:nth-child(2n)::after {
    display: none !important;
  }
  
  .megaplast-features-grid--quote_flow .step-number {
    left: calc(50% - 56px);
    width: 21px;
    height: 21px;
    font-size: 9px;
  }

  .megaplast-features-grid--quote_flow .megaplast-features-icon {
    width: 56px;
    height: 56px;
  }

  .megaplast-features-grid--quote_flow .megaplast-features-icon svg {
    width: 25px;
    height: 25px;
  }

  .megaplast-features-grid--quote_flow h3 {
    margin: 11px 0 4px !important;
    font-size: 10px;
  }

  .megaplast-features-grid--quote_flow p {
    max-width: 150px;
    font-size: 6.5px;
    line-height: 1.45;
  }
  
  .megaplast-features-grid--feature_row h3 {
    margin-bottom: 7px !important;
    font-size: 13px;
  }

  .megaplast-features-grid--feature_row p {
    font-size: 11px;
    line-height: 1.45;
  }

  .megaplast-features-grid--commitments h3 {
    margin-bottom: 7px !important;
    font-size: 14px;
  }

  .megaplast-features-grid--commitments p {
    font-size: 12px;
    line-height: 1.45;
  }
}

/* Breakpoint: mobile max-width 768px */
@media (max-width: 768px) {
  .megaplast-features-grid {
    grid-template-columns: repeat(var(--megaplast-grid-cols, 1), minmax(0, 1fr)) !important;
    gap: 32px 0 !important;
  }

  .megaplast-features-grid--quote_flow .megaplast-features-item::after {
    display: none !important;
  }

  .megaplast-features-grid--quote_flow .step-number {
    left: calc(50% - 78px);
  }
  
  .megaplast-features-grid--proof_grid .megaplast-features-item {
    border-left: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    gap: 26px 0 !important;
  }
  
  .megaplast-features-grid--proof_grid,
  .megaplast-features-grid--feature_row,
  .megaplast-features-grid--commitments,
  .megaplast-features-grid--quote_flow {
    margin-top: 36px !important;
  }
}
