/* =========================================================
   AGO Formidable Icon Select — FULL REPLACEMENT CSS (v2.2)
   - No layout shift on select (constant border width)
   - Desktop: icon centered, half out of the card
   - Mobile: icon top-left overlap
   - Extra breathing room under heading + between mobile cards
   ========================================================= */

:root {
  --ago-accent: #007bff;
  --ago-border: #d9d9d9;
  --ago-card-bg: #fff;
  --ago-hover-bg: #f0f8ff;
  --ago-selected-bg: #e6f2ff;
}

/* Container */
.custom-icon-select,
.ff-icon-select-wrapper {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 1.75rem;   /* breathing room under intro text */
  margin-bottom: 2rem;
}

/* Card */
.icon-option,
.ff-icon-option {
  position: relative;
  overflow: visible;
  cursor: pointer;
  background: var(--ago-card-bg);
  border: 1px solid var(--ago-border);   /* constant width to prevent reflow */
  border-radius: 12px;
  padding: 1.25rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1 1 32%;
  max-width: 42%;
  min-width: 280px;
  transition: background-color .2s, box-shadow .2s, border-color .2s, transform .1s;
}

/* Desktop icon: centered and half outside the top */
.icon-option img,
.ff-icon-option img {
  position: absolute;
  z-index: 2; /* ensure it visually overlaps the card edge */
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 68px;
  height: auto;
  pointer-events: none;
}

/* Space under the floating icon so the title doesn’t collide */
.icon-option,
.ff-icon-option {
  padding-top: 2.75rem;
}

/* Title + description */
.icon-option > strong,
.ff-icon-option > strong {
  display: block;
  font-weight: 700;
  font-size: 1.05rem;
  margin-top: .35rem;
  margin-bottom: .6rem;
}

.icon-option > p,
.ff-icon-option > p {
  margin: 0;
  font-size: .95rem;
  line-height: 1.45;
  max-width: 90%;
}

/* Hover + Selected (no border width change) */
.icon-option:hover,
.ff-icon-option:hover {
  border-color: var(--ago-accent);
  background-color: var(--ago-hover-bg);
  box-shadow: 0 0 6px rgba(0,123,255,.25);
}

.icon-option.selected,
.ff-icon-option.selected {
  border-color: var(--ago-accent);
  background-color: var(--ago-selected-bg);
  box-shadow:
    0 0 12px rgba(0,123,255,.35),
    0 0 0 2px var(--ago-accent); /* selection ring without layout shift */
}

/* ===========================================
   MOBILE (≤ 768px)
   - Icon overlaps top-left
   - Larger vertical spacing between cards
   - Slightly bigger left padding to clear icon
   =========================================== */
@media (max-width: 768px) {
  .custom-icon-select,
  .ff-icon-select-wrapper {
    flex-direction: column;
    align-items: stretch;
    gap: 2.75rem;          /* ★ increased vertical space between cards */
    margin-top: 2.25rem;   /* extra breathing room below intro */
  }

  .icon-option,
  .ff-icon-option {
    text-align: left;
    align-items: flex-start;
    max-width: 100%;
    padding: 1.25rem 1rem 1.25rem;
    padding-left: calc(1rem + 64px + 1rem);
    margin-bottom: 0.5rem; /* ★ safety margin so spacing is consistent in all browsers */
  }

  .icon-option img,
  .ff-icon-option img {
    left: 1rem;
    top: 0;
    transform: translateY(-50%);
    width: 64px;
  }

  .icon-option > strong,
  .ff-icon-option > strong {
    margin-top: 0;
    margin-bottom: .45rem;
    font-size: 1rem;
  }

  .icon-option > p,
  .ff-icon-option > p {
    max-width: 100%;
    font-size: .96rem;
  }
}

/* Optional: visually hide the real FF radios if you keep them on the page */
input[name^="item_meta["][type="radio"].ago-hidden {
  position: absolute;
  left: -9999px;
}
