/*
 * AutoForm Builder Storefront — theme-resistant styles.
 *
 * WordPress themes are aggressive about styling .button / button / a tags.
 * To stay visually consistent across themes we:
 *   1. Scope rules under .afb-storefront-* wrappers for high specificity.
 *   2. Use !important on critical visual properties (color, background,
 *      border-radius, text-transform, box-shadow, padding) of buttons.
 *   3. Reset typography on key elements so theme h3 / button rules don't bleed.
 *
 * Override the accent palette by re-declaring the CSS variables on the
 * wrapper class — no need to fork these rules.
 */

.afb-storefront-buy-button,
.afb-storefront-card,
.afb-storefront-grid,
.afb-storefront-pricing,
.afb-storefront-changelog {
  --afb-accent: #d6336c;
  --afb-accent-soft: #fdeaf1;
  --afb-accent-hover: #b02554;
  --afb-accent-strong: #8a1f44;
  --afb-text: #0f172a;
  --afb-text-soft: #475569;
  --afb-muted: #64748b;
  --afb-border: #e6e8ee;
  --afb-border-strong: #cbd2dc;
  --afb-bg: #ffffff;
  --afb-bg-soft: #f8fafc;
  --afb-radius: 18px;
  --afb-radius-sm: 12px;
  --afb-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --afb-shadow-md: 0 6px 16px -6px rgba(15, 23, 42, 0.1);
  --afb-shadow-lg: 0 18px 36px -14px rgba(15, 23, 42, 0.22);
  --afb-shadow-button: 0 6px 18px -4px rgba(214, 51, 108, 0.5);
  --afb-shadow-button-hover: 0 12px 26px -6px rgba(214, 51, 108, 0.6);
  font-family: inherit;
  color: var(--afb-text);
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

.afb-storefront-buy-button *,
.afb-storefront-card *,
.afb-storefront-grid *,
.afb-storefront-pricing *,
.afb-storefront-changelog * {
  box-sizing: border-box;
}

/* ========================================================================
   Buy button — defended against theme overrides via !important on
   appearance-critical properties only.
   ======================================================================== */
.afb-storefront-buy-button.afb-storefront-buy-button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.55em;
  padding: 0.95em 1.7em !important;
  background: linear-gradient(135deg, #e94081 0%, #d6336c 50%, #a82252 100%) !important;
  background-color: #d6336c !important;
  color: #ffffff !important;
  border: 0 !important;
  border-radius: 999px !important;
  font-weight: 700 !important;
  font-size: 0.95rem !important;
  letter-spacing: 0.01em !important;
  text-transform: none !important;
  text-decoration: none !important;
  text-shadow: none !important;
  line-height: 1.2 !important;
  box-shadow: var(--afb-shadow-button), inset 0 1px 0 rgba(255, 255, 255, 0.18) !important;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  position: relative;
  overflow: hidden;
  -webkit-appearance: none !important;
  appearance: none !important;
  font-family: inherit;
  min-height: 0;
  width: auto;
}

.afb-storefront-buy-button.afb-storefront-buy-button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 60%);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.afb-storefront-buy-button.afb-storefront-buy-button:hover,
.afb-storefront-buy-button.afb-storefront-buy-button:focus,
.afb-storefront-buy-button.afb-storefront-buy-button:focus-visible {
  color: #ffffff !important;
  text-decoration: none !important;
  background: linear-gradient(135deg, #ed4d8a 0%, #d6336c 50%, #a82252 100%) !important;
  background-color: #c92a62 !important;
  filter: brightness(1.04);
  box-shadow: var(--afb-shadow-button-hover), inset 0 1px 0 rgba(255, 255, 255, 0.22) !important;
  transform: translateY(-1px);
}

.afb-storefront-buy-button.afb-storefront-buy-button:hover::before,
.afb-storefront-buy-button.afb-storefront-buy-button:focus-visible::before {
  opacity: 1;
}

.afb-storefront-buy-button.afb-storefront-buy-button:focus-visible {
  outline: 3px solid rgba(214, 51, 108, 0.35) !important;
  outline-offset: 2px !important;
}

.afb-storefront-buy-button.afb-storefront-buy-button:active {
  transform: translateY(0);
  box-shadow: 0 3px 10px -3px rgba(214, 51, 108, 0.55) !important;
}

.afb-storefront-buy-button.afb-storefront-buy-button[disabled],
.afb-storefront-buy-button.afb-storefront-buy-button[aria-busy="true"] {
  opacity: 0.7 !important;
  cursor: progress;
  filter: none;
}

.afb-storefront-buy-button__label {
  position: relative;
  z-index: 1;
}

.afb-storefront-buy-button__price {
  position: relative;
  z-index: 1;
  font-size: 0.78em;
  opacity: 0.92;
  font-weight: 500 !important;
  white-space: nowrap;
  letter-spacing: 0;
}

/* Fallback variant (no resolvable plan) — soft outline button */
.afb-storefront-buy-button.afb-storefront-buy-button--fallback {
  background: var(--afb-bg-soft) !important;
  background-image: none !important;
  color: var(--afb-text) !important;
  border: 1px solid var(--afb-border-strong) !important;
  box-shadow: none !important;
}

.afb-storefront-buy-button.afb-storefront-buy-button--fallback:hover,
.afb-storefront-buy-button.afb-storefront-buy-button--fallback:focus-visible {
  background: #ffffff !important;
  background-image: none !important;
  color: var(--afb-text) !important;
  filter: none;
  box-shadow: var(--afb-shadow-md) !important;
}

/* ========================================================================
   Add-on card — premium, theme-resistant
   ======================================================================== */
.afb-storefront-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.75rem 1.5rem 1.5rem;
  background: var(--afb-bg);
  background-image:
    radial-gradient(circle at top right, rgba(214, 51, 108, 0.045), transparent 55%);
  border: 1px solid var(--afb-border);
  border-radius: var(--afb-radius);
  box-shadow: var(--afb-shadow-sm);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.22s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.22s ease;
  overflow: hidden;
  isolation: isolate;
  list-style: none;
}

.afb-storefront-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--afb-accent) 0%, #ff7aab 50%, var(--afb-accent) 100%);
  opacity: 0;
  transition: opacity 0.22s ease;
  z-index: 1;
}

.afb-storefront-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--afb-shadow-lg);
  border-color: var(--afb-border-strong);
}

.afb-storefront-card:hover::before,
.afb-storefront-card.is-featured::before {
  opacity: 1;
}

.afb-storefront-card.is-featured {
  border-color: rgba(214, 51, 108, 0.35);
  box-shadow: 0 10px 28px -12px rgba(214, 51, 108, 0.3);
}

.afb-storefront-card__featured-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--afb-accent);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 5px 11px;
  border-radius: 999px;
  z-index: 2;
  box-shadow: 0 4px 10px -2px rgba(214, 51, 108, 0.4);
}

.afb-storefront-card__icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--afb-border);
  box-shadow: 0 2px 6px -2px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  overflow: hidden;
  flex-shrink: 0;
  padding: 8px;
}

.afb-storefront-card__icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 10px;
}

.afb-storefront-card__icon--fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.85rem;
  line-height: 1;
  border-radius: 10px;
  letter-spacing: -0.02em;
}

.afb-storefront-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
}

.afb-storefront-card__category {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--afb-accent);
  background: var(--afb-accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
  align-self: flex-start;
  line-height: 1.4;
}

.afb-storefront-card__title {
  margin: 0 !important;
  padding: 0 !important;
  font-size: 1.2rem !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
  color: var(--afb-text) !important;
  letter-spacing: -0.005em;
}

.afb-storefront-card__description {
  margin: 0 !important;
  font-size: 0.95rem;
  color: var(--afb-text-soft);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.afb-storefront-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: auto;
  padding-top: 1.25rem;
  border-top: 1px solid var(--afb-border);
}

.afb-storefront-card__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.afb-storefront-card__price-from {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--afb-muted);
  font-weight: 700;
}

.afb-storefront-card__price {
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--afb-text);
  line-height: 1.1;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: baseline;
  gap: 0.3em;
  flex-wrap: wrap;
}

.afb-storefront-card__price-interval {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--afb-muted);
  letter-spacing: 0;
}

.afb-storefront-card__docs-link {
  font-size: 0.82rem;
  color: var(--afb-muted);
  text-decoration: none;
  border-bottom: 1px dashed var(--afb-border-strong);
  align-self: flex-start;
  margin-top: 4px;
  padding-bottom: 1px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.afb-storefront-card__docs-link:hover {
  color: var(--afb-accent);
  border-bottom-color: var(--afb-accent);
}

.afb-storefront-card__buy.afb-storefront-card__buy {
  padding: 0.7em 1.4em !important;
  font-size: 0.9rem !important;
  flex-shrink: 0;
}

/* ========================================================================
   Grid layout
   ======================================================================== */
.afb-storefront-grid {
  display: grid;
  gap: 1.5rem;
}

.afb-storefront-grid--cols-1 { grid-template-columns: 1fr; }
.afb-storefront-grid--cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.afb-storefront-grid--cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.afb-storefront-grid--cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 960px) {
  .afb-storefront-grid--cols-3,
  .afb-storefront-grid--cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .afb-storefront-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
  .afb-storefront-card {
    padding: 1.5rem 1.25rem 1.25rem;
  }
  .afb-storefront-card__footer {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  .afb-storefront-card__meta {
    flex-direction: row;
    align-items: baseline;
    gap: 0.5rem;
  }
  .afb-storefront-card__buy.afb-storefront-card__buy {
    width: 100%;
    text-align: center;
  }
}

/* ========================================================================
   Pricing table
   ======================================================================== */
.afb-storefront-pricing {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
}

.afb-storefront-pricing__card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  padding: 2rem 1.6rem 1.6rem;
  background: var(--afb-bg);
  border: 1px solid var(--afb-border);
  border-radius: var(--afb-radius);
  box-shadow: var(--afb-shadow-sm);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.afb-storefront-pricing__card:hover {
  transform: translateY(-3px);
  box-shadow: var(--afb-shadow-md);
}

.afb-storefront-pricing__card.is-highlighted {
  border-color: var(--afb-accent);
  box-shadow: 0 14px 32px -14px rgba(214, 51, 108, 0.35);
}

.afb-storefront-pricing__badge {
  position: absolute;
  top: -12px;
  right: 20px;
  background: var(--afb-accent);
  color: #fff;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  box-shadow: 0 4px 12px -3px rgba(214, 51, 108, 0.5);
}

.afb-storefront-pricing__name {
  margin: 0 !important;
  font-size: 1.15rem !important;
  font-weight: 700 !important;
  color: var(--afb-text) !important;
}

.afb-storefront-pricing__price {
  margin: 0 !important;
  display: flex;
  align-items: baseline;
  gap: 0.4em;
}

.afb-storefront-pricing__amount {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1;
}

.afb-storefront-pricing__interval {
  color: var(--afb-muted);
  font-size: 0.95rem;
}

.afb-storefront-pricing__description,
.afb-storefront-pricing__site-limit {
  margin: 0 !important;
  color: var(--afb-text-soft);
  font-size: 0.92rem;
  line-height: 1.55;
}

.afb-storefront-pricing__features {
  margin: 0.25rem 0 0 !important;
  padding: 0 !important;
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--afb-text-soft);
  list-style: none !important;
}

.afb-storefront-pricing__features li {
  position: relative;
  padding-left: 1.55em;
  list-style: none !important;
}

.afb-storefront-pricing__features li::before {
  content: "";
  position: absolute;
  left: 0.1em;
  top: 0.55em;
  width: 14px;
  height: 8px;
  border-left: 2px solid var(--afb-accent);
  border-bottom: 2px solid var(--afb-accent);
  transform: rotate(-45deg);
}

.afb-storefront-pricing__card .afb-storefront-buy-button {
  margin-top: auto;
  width: 100% !important;
}

/* ========================================================================
   Changelog
   ======================================================================== */
.afb-storefront-changelog {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.afb-storefront-changelog__item {
  padding: 1.1rem 1.3rem;
  background: var(--afb-bg-soft);
  border-left: 3px solid var(--afb-accent);
  border-radius: var(--afb-radius-sm);
  list-style: none !important;
}

.afb-storefront-changelog__header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.afb-storefront-changelog__version {
  font-weight: 700;
}

.afb-storefront-changelog__date {
  font-size: 0.85rem;
  color: var(--afb-muted);
}

.afb-storefront-changelog__body p {
  margin: 0 0 0.5rem;
}

.afb-storefront-changelog__body p:last-child {
  margin-bottom: 0;
}

/* ========================================================================
   Misc
   ======================================================================== */
.afb-storefront-fallback {
  text-align: center;
  padding: 1.5rem;
  background: var(--afb-bg-soft);
  border-radius: var(--afb-radius);
}

.afb-storefront-admin-notice {
  padding: 0.75rem 1rem;
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  border-radius: 6px;
  margin: 0.5rem 0;
}
