/*
 * FormVault Blocks / Widget / Shortcode styles.
 * Used on both the frontend and in the block editor (via formvault-blocks handle).
 * Depends on tokens.css for CSS custom properties.
 * ────────────────────────────────────────────────────────────────────────────
 */

/* ── Widget title ────────────────────────────────────────────────────────── */
.fv-widget-title {
  font-size: var(--fv-text-sm, 13px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 var(--fv-sp-3, 12px);
}

/* ── Form card (block / shortcode [formvault_form]) ─────────────────────── */
.fv-form-card {
  display: flex;
  align-items: center;
  gap: var(--fv-sp-3, 12px);
  padding: var(--fv-sp-3, 12px);
  background: #ffffff !important;
  color-scheme: light;
  border: 1px solid #f1f5f9 !important;
  border-radius: var(--fv-radius-lg, 16px);
  box-shadow: var(--fv-shadow-xs, 0 1px 2px rgba(15,23,42,0.04));
  transition: box-shadow 0.15s;
}

.fv-form-card:hover {
  box-shadow: var(--fv-shadow-sm, 0 2px 6px rgba(15,23,42,0.06));
}

.fv-form-card__thumb {
  width: 60px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--fv-radius-md, 10px);
  border: 1px solid var(--fv-ink-100, #f1f5f9);
  flex-shrink: 0;
}

.fv-form-card__body {
  flex: 1;
  min-width: 0;
}

.fv-form-card__title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}

.fv-form-card__title a {
  color: var(--fv-ink-900, #0f172a);
  text-decoration: none;
}

.fv-form-card__title a:hover {
  color: var(--fv-primary, #2563eb);
  text-decoration: underline;
}

.fv-form-card__desc {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--fv-ink-500, #64748b);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fv-form-card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.fv-form-card__action {
  flex-shrink: 0;
}

/* ── Category list ───────────────────────────────────────────────────────── */
.fv-cat-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.fv-cat-list__item {
  padding: 5px 0;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fv-cat-list__item a {
  text-decoration: none;
  transition: color 0.12s;
}

.fv-cat-list__item a:hover {
  color: var(--fv-primary, #2563eb);
  text-decoration: underline;
}

.fv-cat-list__count {
  font-size: 12px;
  opacity: 0.55;
}

/* ── Recent forms list ───────────────────────────────────────────────────── */
.fv-recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.fv-recent-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 0;
  border-bottom: 1px solid var(--fv-ink-100, #f1f5f9);
}

.fv-recent-list__item:last-child {
  border-bottom: none;
}

.fv-recent-list__title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fv-recent-list__title a {
  color: var(--fv-ink-800, #1e293b);
  text-decoration: none;
  transition: color 0.12s;
}

.fv-recent-list__title a:hover {
  color: var(--fv-primary, #2563eb);
  text-decoration: underline;
}

.fv-recent-list__meta {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* ── Lock indicator (premium badge) ─────────────────────────────────────── */
.fv-card-lock {
  font-size: 11px;
  color: var(--fv-ink-500, #64748b);
}

/* ── Block editor placeholder ────────────────────────────────────────────── */
.fv-block-placeholder {
  font-size: 13px;
  color: var(--fv-ink-400, #94a3b8);
  font-style: italic;
  margin: 0;
  padding: var(--fv-sp-3, 12px);
  border: 1px dashed var(--fv-ink-200, #e2e8f0);
  border-radius: var(--fv-radius-md, 10px);
}

/* ── Chips (format badges) — self-contained copy used on non-form pages ── */
/* Primary chip styles live in frontend.css; these are the minimal fallback
   so blocks/widgets render correctly even if frontend.css is not loaded. */
.fv-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: var(--fv-radius-full, 9999px);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.6;
  background: var(--fv-ink-100, #f1f5f9);
  color: var(--fv-ink-600, #475569);
}

.fv-chip--pdf  { background: #fef2f2; color: #b91c1c; }
.fv-chip--docx { background: #eff6ff; color: #1d4ed8; }
.fv-chip--doc  { background: #eff6ff; color: #1d4ed8; }
.fv-chip--xlsx { background: #f0fdf4; color: #15803d; }
.fv-chip--xls  { background: #f0fdf4; color: #15803d; }
.fv-chip--pptx { background: #fff7ed; color: #c2410c; }
.fv-chip--ppt  { background: #fff7ed; color: #c2410c; }
.fv-chip--odt  { background: #f5f3ff; color: #6d28d9; }
.fv-chip--ods  { background: #f5f3ff; color: #6d28d9; }
.fv-chip--odp  { background: #f5f3ff; color: #6d28d9; }
.fv-chip--rtf  { background: #fdf4ff; color: #86198f; }
.fv-chip--txt  { background: #f8fafc; color: #475569; }
.fv-chip--csv  { background: #f0fdf4; color: #166534; }
.fv-chip--zip  { background: #fafaf9; color: #78716c; }

/* ── Button — sm / xs sizes (supplement frontend.css) ───────────────────── */
.fv-btn--sm {
  padding: 5px 12px;
  font-size: 12px;
}

.fv-btn--xs {
  padding: 2px 8px;
  font-size: 11px;
  min-height: 24px;
}

/* ── Forms grid (recent-forms block / shortcode) ─────────────────────────── */
.fv-forms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--fv-sp-4, 16px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.fv-grid-card {
  display: flex;
  flex-direction: column;
  background: #ffffff !important;
  color-scheme: light;
  border: 1px solid #f1f5f9 !important;
  border-radius: var(--fv-radius-lg, 16px);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
  transition: box-shadow 0.15s, transform 0.15s;
}

.fv-grid-card:hover {
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.12);
  transform: translateY(-2px);
}

/* Thumbnail link wrapper — portrait A4 ratio */
.fv-grid-card__thumb-wrap {
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--fv-ink-050, #f8fafc);
}

.fv-grid-card__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
}

.fv-grid-card:hover .fv-grid-card__thumb {
  transform: scale(1.03);
}

/* Placeholder shown when no image is available */
.fv-grid-card__thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--fv-ink-300, #cbd5e1);
}

.fv-grid-card__thumb-placeholder svg {
  width: 40px;
  height: 40px;
}

/* Card body */
.fv-grid-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--fv-sp-2, 8px);
  padding: var(--fv-sp-3, 12px);
  flex: 1;
}

.fv-grid-card__title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fv-grid-card__title a {
  color: var(--fv-ink-800, #1e293b);
  text-decoration: none;
  transition: color 0.12s;
}

.fv-grid-card__title a:hover {
  color: var(--fv-primary, #2563eb);
}

.fv-grid-card__meta {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: auto;
}

