/* ZeroPulp Employee Portal redesign - Catalog follow-ups (see zpPortal.css for the shared tokens)

   Home's Forms Catalog tab: start forms as a grid of cards - title, description and the card's
   actions (Start, or Open in Designer / Test Process in a sandbox). */

/* the catalog area scrolls natively (formsCatalog.js#showInline) - no jScrollPane, no white sheet */
.zp-portal-theme main .right-content-area-scroll.zp-catalog-scroll
{
	overflow-y: auto !important;
	overflow-x: hidden !important;
	background: transparent !important;
	box-sizing: border-box;
}

/* a window too short for the card (home.js setHeight adds .zp-home-short below 220px - browser zoom, or
   the sandbox notice above the tabs): while the catalog is on show the Home column scrolls as one, and the
   catalog drops its fixed px height so it is never a second, nested scroller. The task tabs keep their own
   jScrollPane list and the column stays fixed, so they keep one scrollbar too */
.zp-portal-theme main #recordListContainer.zp-home-short > #all:has(.zp-catalog-scroll)
{
	overflow-y: auto !important;
	overflow-x: hidden !important;
}

.zp-portal-theme main #recordListContainer.zp-home-short .tab-content-outer:has(> .zp-catalog-scroll),
.zp-portal-theme main #recordListContainer.zp-home-short .right-content-area-scroll.zp-catalog-scroll
{
	height: auto !important;
	overflow-y: visible !important;
}

.zp-portal-theme main ul#published-form-list.zp-catalog-grid
{
	display: grid !important;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 20px;
	margin: 0 0 24px;
	/* the catalog sits in one white card, matching the Tasks list (zpPortal.css section 7) */
	padding: 20px 24px 24px !important;
	list-style: none;
	background: var(--zp-surface);
	border: 1px solid var(--zp-line);
	border-radius: var(--zp-radius-card);
	box-shadow: var(--zp-shadow-card);
	box-sizing: border-box;
	/* one scrollbar only: the area above (.zp-catalog-scroll) scrolls. pulpstream2.css still gives the
	   list its own max-height: calc(100vh - 210px) + overflow-y: auto from the old inline catalog, which
	   put a second scrollbar beside the area's whenever the cards were taller than both (zoomed-in or
	   short windows, or simply many cards) */
	max-height: none !important;
	overflow: visible !important;
}

/* #published-form-list out-ranks pulpstream2.css's id rule (white strip, 8px 15px padding) */
.zp-portal-theme main ul#published-form-list.zp-catalog-grid > li.publish-templates
{
	padding: 0 !important;
	grid-column: 1 / -1;
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 10px;
	margin: 8px 0 -4px;
	background: transparent;
	border: 0;
}

.zp-portal-theme main .zp-catalog-grid > li.publish-templates h5
{
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	color: var(--zp-ink);
}

.zp-portal-theme main .zp-catalog-grid .zp-section-count
{
	font-size: 13px;
	color: var(--zp-ink-4);
}

.zp-portal-theme main .zp-catalog-grid .catalog-section-desc
{
	flex-basis: 100%;
	margin: 0;
	font-size: 14px;
	color: var(--zp-ink-3);
}

/* card */
.zp-portal-theme main .zp-catalog-grid > li.zp-form-card
{
	display: flex !important;
	flex-direction: column;
	align-items: stretch !important;
	gap: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	background: var(--zp-surface);
	border: 1px solid var(--zp-line);
	border-radius: var(--zp-radius-card);
	box-shadow: var(--zp-shadow-card);
	overflow: hidden;
	cursor: pointer;
	transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.zp-portal-theme main .zp-catalog-grid > li.zp-form-card:hover
{
	border-color: var(--zp-accent-border);
	box-shadow: 0 6px 18px rgba(28,27,34,0.08);
	background: var(--zp-surface);
}

.zp-portal-theme .zp-form-card-body
{
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 18px;
}

.zp-portal-theme .zp-form-card-body h3.form-title
{
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: var(--zp-ink);
}

.zp-portal-theme .zp-form-card-body p.form-description
{
	margin: 0;
	font-size: 14px;
	line-height: 1.5;
	color: var(--zp-ink-3);
}

.zp-portal-theme .zp-form-card-body p.form-description:empty
{
	display: none;
}

.zp-portal-theme .zp-form-card-foot
{
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 10px;
	margin-top: auto;
	padding-top: 10px;
}

/* Open in Designer, the guest share link and Start/Test process stay on ONE line (no wrap); the buttons
   keep their labels on one line and the row may shrink the Start button's padding before anything moves */
.zp-portal-theme .zp-form-card-actions
{
	display: flex;
	flex-wrap: nowrap;
	justify-content: flex-end;
	align-items: center;
	gap: 6px;
	min-width: 0;
	max-width: 100%;
}

.zp-portal-theme .zp-form-card .zp-form-card-start
{
	min-height: 40px;
	padding: 0 12px !important;
	white-space: nowrap;
	flex-shrink: 0;
}

.zp-portal-theme .zp-form-card .guest-share-link,
.zp-portal-theme .zp-form-card .zp-form-card-designer
{
	min-height: 40px;
	padding: 0 12px;
	border: 1px solid var(--zp-line);
	border-radius: var(--zp-radius-control);
	background: var(--zp-surface);
	color: var(--zp-ink-2);
	font-size: 13px;
	font-weight: 600;
}

/* Open in Designer (sandbox only) - an <a>, so centre its label like the Start button's */
.zp-portal-theme .zp-form-card .zp-form-card-designer
{
	display: inline-block;
	line-height: 38px;
	padding: 0 10px;
	text-decoration: none;
	white-space: nowrap;
	/* the one control that gives way on a narrow card: its label ellipsises rather than the row overflowing */
	min-width: 0;
	flex-shrink: 1;
	overflow: hidden;
	text-overflow: ellipsis;
}

.zp-portal-theme .zp-form-card .zp-form-card-designer:hover
{
	border-color: var(--zp-accent-border);
	color: var(--zp-ink);
}

/* Records / Analytics (production only, formsCatalog.js#zpRefreshCatalogCardLinks) keep their full labels */
.zp-portal-theme .zp-form-card .zp-form-card-link
{
	flex-shrink: 0;
}

/* the "No forms yet" empty state (formsCatalog.js#printFolders) spans the whole grid */
.zp-portal-theme main .zp-catalog-grid > li.zp-catalog-empty
{
	grid-column: 1 / -1;
	list-style: none;
}

/* "Getting started in sandbox" note above Home's tabs (home.js#showSandboxIntro) */
.zp-portal-theme main .zp-sandbox-intro
{
	margin: 0 24px 16px;
	padding: 14px 18px;
	background: var(--zp-accent-tint);
	border: 1px solid var(--zp-accent-border);
	border-radius: var(--zp-radius-card);
	position: relative;
}

.zp-portal-theme main .zp-sandbox-intro-close
{
	position: absolute;
	top: 10px;
	right: 10px;
	width: 28px;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 0;
	border-radius: 7px;
	background: transparent;
	color: var(--zp-accent-ink);
	font-size: 13px;
	line-height: 1;
	cursor: pointer;
	opacity: 0.7;
}

.zp-portal-theme main .zp-sandbox-intro-close:hover
{
	background: rgba(124,58,237,0.1);
	opacity: 1;
}

.zp-portal-theme main .zp-sandbox-intro-title
{
	margin: 0 0 4px;
	padding-right: 32px;
	font-size: 14px;
	font-weight: 700;
	color: var(--zp-accent-ink);
}

.zp-portal-theme main .zp-sandbox-intro-body
{
	margin: 0;
	font-size: 13.5px;
	line-height: 1.5;
	color: var(--zp-ink-2);
}

/* a card's share link is just the chain icon beside Open - the label stays for the copied
   feedback's sake but is hidden; the title attribute says what it does */
.zp-portal-theme .zp-form-card .guest-share-link
{
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	margin: 0;
	padding: 0;
	flex-shrink: 0;
}

.zp-portal-theme .zp-form-card .guest-share-link .guest-share-label
{
	display: none;
}

.zp-portal-theme .zp-form-card .guest-share-link:hover
{
	border-color: var(--zp-accent-border);
	color: var(--zp-accent);
}

.zp-portal-theme .zp-form-card .guest-share-link.copied
{
	border-color: #86EFAC;
	background: #F0FDF4;
	color: #15803D;
}
