/**
 * Leadsie Links — tool styles
 *
 * Cards, buttons, badges, inputs, alerts and empty states are frikwork's;
 * nothing here restyles one. What is left is the card grid, the icon picker and
 * the access-level section headings.
 *
 * Every colour is a --fw-* token or a color-mix over one, so both themes work.
 * v1 hardcoded #dc3545 for the delete hover and three rgba(148, 200, 62, …)
 * stops for the icon halo, which only ever looked right on the dark theme.
 */

/* ---------------------------------------------------------------------------
 * Panel head controls
 * ------------------------------------------------------------------------ */

.leadsie-count { align-self: center; }

.leadsie-search { width: min(18rem, 60vw); }
.leadsie-search .fw-input { min-width: 0; }

.leadsie-sort { width: auto; }

.leadsie-loading {
  display: flex;
  flex-direction: column;
  gap: var(--fw-space-sm);
  padding: var(--fw-space-md) 0;
}

/* ---------------------------------------------------------------------------
 * Access-level sections
 * ------------------------------------------------------------------------ */

.leadsie-section + .leadsie-section { margin-top: var(--fw-space-xl); }

.leadsie-section__title {
  display: flex;
  align-items: center;
  gap: var(--fw-space-sm);
  margin: 0;
  padding-bottom: var(--fw-space-sm);
  border-bottom: 1px solid var(--fw-border);
  font-size: 0.95rem;
}
.leadsie-section__title i { color: var(--fw-brand-text); }

.leadsie-section__count { font-weight: 500; }

.leadsie-section__desc {
  margin: var(--fw-space-xs) 0 var(--fw-space-md);
  color: var(--fw-text-muted);
  font-size: 0.85rem;
}

.leadsie-section__empty { margin: 0; color: var(--fw-text-muted); }

/* ---------------------------------------------------------------------------
 * Link cards
 * ------------------------------------------------------------------------ */

.leadsie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: var(--fw-space-md);
}

.leadsie-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--fw-space-sm);
  padding: var(--fw-space-lg) var(--fw-space-md) var(--fw-space-md);
  text-align: center;
}

/* --- the hover-revealed edit/delete pair --------------------------------- */

.leadsie-card__actions {
  position: absolute;
  top: var(--fw-space-xs);
  right: var(--fw-space-xs);
  display: flex;
  gap: 0.15rem;
  opacity: 0;
  transition: opacity var(--fw-dur-fast, 0.15s) ease;
  z-index: 1;
}
.leadsie-card:hover .leadsie-card__actions,
.leadsie-card:focus-within .leadsie-card__actions { opacity: 1; }

.leadsie-card__action { font-size: 0.8rem; }
.leadsie-card__action--danger:hover { color: var(--fw-danger); }

/* --- the icon halo -------------------------------------------------------- */

.leadsie-card__icon {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--fw-brand) 14%, transparent);
  color: var(--fw-brand-text);
  font-size: 1.35rem;
  transition: transform var(--fw-dur, 0.25s) ease, background var(--fw-dur, 0.25s) ease;
}
.leadsie-card:hover .leadsie-card__icon {
  transform: scale(1.08);
  background: color-mix(in srgb, var(--fw-brand) 24%, transparent);
}

.leadsie-card__title {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.leadsie-card__buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--fw-space-xs);
  margin-top: auto;
  padding-top: var(--fw-space-xs);
}

/* Hold the width while the label flips to "Copied" so the row does not jump. */
.leadsie-copy__text { display: inline-block; min-width: 3.4em; }
.leadsie-copy.is-copied {
  border-color: var(--fw-success);
  color: var(--fw-success);
}

/* ---------------------------------------------------------------------------
 * Icon picker
 * ------------------------------------------------------------------------ */

.leadsie-icon-preview {
  display: flex;
  align-items: center;
  gap: var(--fw-space-sm);
  margin-bottom: var(--fw-space-sm);
  padding: var(--fw-space-sm);
  border: 1px solid var(--fw-border);
  border-radius: var(--fw-radius-md);
  background: var(--fw-bg-2);
}

.leadsie-icon-preview__mark {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--fw-radius-sm);
  background: color-mix(in srgb, var(--fw-brand) 16%, transparent);
  color: var(--fw-brand-text);
  font-size: 1.05rem;
}

.leadsie-icon-preview__label {
  color: var(--fw-text-muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.leadsie-icon-search { margin-bottom: var(--fw-space-sm); }

.leadsie-icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(2.75rem, 1fr));
  gap: 0.35rem;
  max-height: 11rem;
  overflow-y: auto;
  padding: var(--fw-space-sm);
  border: 1px solid var(--fw-border);
  border-radius: var(--fw-radius-md);
  background: var(--fw-bg-2);
}

.leadsie-icon-btn {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid transparent;
  border-radius: var(--fw-radius-sm);
  background: transparent;
  color: var(--fw-text-2);
  font: inherit;
  font-size: 1.05rem;
  cursor: pointer;
  transition: background var(--fw-dur-fast, 0.15s) ease,
              border-color var(--fw-dur-fast, 0.15s) ease,
              color var(--fw-dur-fast, 0.15s) ease;
}
.leadsie-icon-btn:hover {
  background: var(--fw-bg-hover);
  border-color: var(--fw-border);
  color: var(--fw-text);
}
.leadsie-icon-btn.is-selected {
  background: color-mix(in srgb, var(--fw-brand) 18%, transparent);
  border-color: var(--fw-brand);
  color: var(--fw-brand-text);
}

.leadsie-icon-none {
  margin: var(--fw-space-sm) 0 0;
  color: var(--fw-text-muted);
}

.leadsie-icon-custom__label { margin-top: var(--fw-space-md); }

/* ---------------------------------------------------------------------------
 * Delete dialog
 * ------------------------------------------------------------------------ */

.leadsie-delete-target {
  padding: var(--fw-space-sm) var(--fw-space-md);
  border-left: 3px solid var(--fw-danger);
  border-radius: var(--fw-radius-sm);
  background: var(--fw-bg-2);
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------------------
 * Utilities
 * ------------------------------------------------------------------------ */

.leadsie-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------------------
 * Responsive
 * ------------------------------------------------------------------------ */

@media (max-width: 760px) {
  /* Touch devices never fire hover, so the edit/delete pair would be
     unreachable if it stayed hidden. */
  .leadsie-card__actions { opacity: 1; }

  .leadsie-search { width: 100%; }
  .leadsie-sort { width: 100%; }
  .leadsie-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
