/*
 * Greeting cards: layout only. Components come from pfc-kit.css; this file
 * places them (grid, gaps, spacing) with logical properties, plus the
 * designer's stage and drag handles, which have no PFC equivalent.
 */

/* PFC components name the font "IBMPlexSansArabic"; the theme loads the same
   family as "IBM Plex Sans Arabic". */
@font-face { font-family: "IBMPlexSansArabic"; font-weight: 400; font-display: swap; src: local("IBM Plex Sans Arabic"), url("../fonts/IBMPlexSansArabic-Regular.woff2") format("woff2"); }
@font-face { font-family: "IBMPlexSansArabic"; font-weight: 500; font-display: swap; src: local("IBM Plex Sans Arabic Medium"), url("../fonts/IBMPlexSansArabic-Medium.woff2") format("woff2"); }
@font-face { font-family: "IBMPlexSansArabic"; font-weight: 600; font-display: swap; src: local("IBM Plex Sans Arabic SemiBold"), url("../fonts/IBMPlexSansArabic-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "IBMPlexSansArabic"; font-weight: 700; font-display: swap; src: local("IBM Plex Sans Arabic Bold"), url("../fonts/IBMPlexSansArabic-Bold.woff2") format("woff2"); }

.nugc {
	display: flex;
	flex-direction: column;
	gap: 32px;
	box-sizing: border-box;
	width: 100%;
	padding: 40px 80px;
	font-family: "IBM Plex Sans Arabic", "IBMPlexSansArabic", system-ui, sans-serif;
}

/* The widget page runs full width (theme setting "wrap widget page content"
   off), where the theme's grid row keeps its -15px gutters and pushes the
   page sideways. Only the row holding this widget is straightened. */
.portlet-layout.row:has(.nugc) {
	margin-inline: 0;
}

.portlet-layout.row:has(.nugc) > .portlet-column {
	padding-inline: 0;
}

.nugc [hidden] {
	display: none !important;
}

.nugc-head {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.nugc-head__title,
.nugc-section__title {
	margin: 0;
	color: var(--pfc-text-display, #1f2a37);
	font-weight: 700;
	text-wrap: balance;
}

.nugc-head__title {
	font-size: 28px;
	line-height: 1.4;
}

.nugc-section__title {
	font-size: 20px;
	line-height: 1.5;
}

.nugc-head__lead,
.nugc-section__lead {
	margin: 0;
	max-width: 70ch;
	color: var(--pfc-text-paragraph, #384250);
	line-height: 1.7;
}

.nugc-tabs {
	overflow-x: auto;
	max-width: 100%;
	margin-block-start: -8px;
}

/* Vertical rhythm inside each tab: filters, then content */
.nugc-user,
.nugc-pick {
	display: flex;
	flex-direction: column;
	gap: 28px;
}

.nugc-section {
	display: flex;
	flex-direction: column;
	gap: 28px;
}

.nugc-section__head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
}

/* Guest sign-in card: content on the reading side, like the rest of the page */
.nugc .nugc-empty {
	align-items: flex-start;
	gap: 16px;
	padding: 32px;
	text-align: start;
}

.nugc-empty .pfc-card__content {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.nugc-empty .pfc-card__title,
.nugc-empty .pfc-card__description {
	margin: 0;
}

.nugc-chips,
.nugc-colors {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
}

/* ----- Gallery ----- */

.nugc-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
	gap: 28px 24px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.nugc-grid > li {
	display: flex;
}

.nugc-tile {
	height: 100%;
	padding: 16px;
	gap: 16px;
	text-align: start;
	font: inherit;
}

.nugc-tile .pfc-card__content {
	gap: 4px;
	padding-inline: 4px;
}

.nugc-tile__image {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 8px;
	background: var(--pfc-bg-disabled, #e5e7eb);
}

/* ----- User editor ----- */

.nugc-editor {
	display: flex;
	flex-direction: column;
	gap: 16px;
	scroll-margin-block-start: 96px;
}

.nugc-editor__layout,
.nugc-designer__layout {
	display: grid;
	grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr);
	gap: 32px;
	align-items: start;
}

.nugc-preview__frame {
	position: relative;
}

.nugc-preview__canvas,
.nugc-preview__skeleton {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 12px;
}

.nugc-preview__canvas {
	border: 1px solid var(--pfc-border-neutral, #d2d6db);
}

/* Scoped twice to win over .pfc-scope .pfc-card { position: relative } */
.nugc .nugc-panel {
	position: sticky;
	inset-block-start: 96px;
}

.nugc-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

.nugc-status {
	min-height: 24px;
	margin: 0;
	color: var(--pfc-text-paragraph, #384250);
}

.nugc-status--error {
	color: var(--pfc-text-error, #b42318);
}

.nugc-flip {
	display: inline-flex;
}

[dir="ltr"] .nugc-flip svg {
	transform: scaleX(-1);
}

/* ----- Designer ----- */

.nugc-designer__stage-col {
	display: flex;
	flex-direction: column;
	gap: 12px;
	position: sticky;
	inset-block-start: 96px;
}

.nugc-designer__panel {
	display: flex;
	flex-direction: column;
	gap: 24px;
}

.nugc-fieldset {
	margin: 0;
	min-width: 0;
	gap: 24px;
	padding: 24px;
}

.nugc-fieldset > legend {
	float: inline-start;
	width: 100%;
	margin: 0;
}

.nugc-stage {
	position: relative;
	width: 100%;
	aspect-ratio: 1 / 1;
	border: 1px solid var(--pfc-border-neutral, #d2d6db);
	border-radius: 12px;
	overflow: hidden;
	background: var(--pfc-form-bg-darker, #f3f4f6);
	touch-action: none;
}

.nugc-stage__canvas {
	display: block;
	width: 100%;
	height: 100%;
}

.nugc-stage__empty {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 24px;
	text-align: center;
	color: var(--pfc-text-paragraph, #384250);
}

.nugc-stage__guide {
	position: absolute;
	inset-block: 0;
	left: 50%;
	width: 0;
	border-left: 1px dashed #1b8354;
	pointer-events: none;
}

.nugc-handle {
	position: absolute;
	margin: 0;
	padding: 0;
	border: 1px dashed rgba(255, 255, 255, 0.9);
	outline: 1px dashed rgba(22, 22, 22, 0.55);
	border-radius: 4px;
	background: transparent;
	cursor: move;
	touch-action: none;
}

/* Text handles above the photo area; the selected field above all */
.nugc-handle {
	z-index: 1;
}

.nugc-handle[data-key="photo"] {
	z-index: 0;
}

.nugc-handle.is-selected {
	z-index: 2;
	border-style: solid;
	outline: 2px solid #1b8354;
}

.nugc-handle:focus-visible {
	outline: 3px solid #161616;
}

.nugc-upload .pfc-file-upload__drop-area,
.nugc-upload .pfc-file-upload__content {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
}

.nugc-inline {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 24px;
}

.nugc-input-short {
	max-width: 140px;
}

.nugc-swatch__dot {
	display: inline-block;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	border: 1px solid var(--pfc-border-neutral, #d2d6db);
}

.nugc-colors .nugc-color-input {
	flex: 0 0 56px;
	width: 56px;
	min-width: 0;
	padding: 2px;
}

.nugc-color-input .pfc-input__field {
	width: 100%;
	height: 32px;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
}

/* ----- Tables and statistics ----- */

.nugc-table td,
.nugc-table th {
	vertical-align: middle;
}

.nugc-cell-design {
	display: flex;
	align-items: center;
	gap: 12px;
}

.nugc-cell-design__thumb {
	width: 60px;
	height: 54px;
	object-fit: cover;
	object-position: top;
	border-radius: 6px;
	border: 1px solid var(--pfc-border-neutral, #d2d6db);
}

.nugc-row-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}

.nugc-row-actions form {
	margin: 0;
}

.nugc-muted {
	display: block;
	color: var(--pfc-form-text-helper, #6c727e);
	font-size: 14px;
}

.nugc-occasion-form {
	gap: 24px;
	padding: 24px;
}

.nugc-form-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
	align-items: end;
	gap: 16px;
	width: 100%;
}

.nugc-switch-cell {
	padding-block-end: 10px;
}

.nugc-font-groups {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.nugc-font-group__title {
	margin-block-start: 6px;
}

/* Decorative fonts have tall letters: let the chip grow instead of clipping */
.nugc-font-chip {
	height: auto;
	min-height: 40px;
	padding-block: 6px;
}

.nugc-metrics {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
	gap: 16px;
}

.nugc-metrics .pfc-metric {
	width: auto;
}

.nugc-stat-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
	gap: 20px;
	align-items: start;
}

.nugc-stat-block {
	display: flex;
	flex-direction: column;
	gap: 14px;
	min-width: 0;
}

.nugc-stat-title {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.5;
	color: var(--pfc-text-default, #161616);
}

.nugc-table td:first-child,
.nugc-table th:first-child {
	white-space: nowrap;
}

.nugc-bar-cell {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 160px;
}

.nugc-bar {
	flex: 1;
	height: 8px;
}

/* Statistics: chart cards, daily columns, occasion donut, usage rows and
   the most used designs. Layout only; the parts are PFC components. The PFC
   card aligns its children to the start, which shrinks them to their content,
   so these cards stretch them across (scoped under .nugc to outrank it). */

.nugc .nugc-stat-card {
	align-items: stretch;
	gap: 20px;
	min-width: 0;
	padding: 24px;
}

.nugc .nugc-stat-card .pfc-chart {
	width: 100%;
}

.nugc-stat-card__head {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: flex-start;
	gap: 16px 32px;
}

.nugc-stat-card__head .pfc-card__description {
	margin: 4px 0 0;
}

.nugc-stat-facts {
	display: flex;
	flex-wrap: wrap;
	gap: 12px 32px;
	margin: 0;
}

.nugc-stat-facts dt {
	font-size: 13px;
	font-weight: 400;
	color: var(--pfc-text-paragraph-secondary, #6c727e);
}

.nugc-stat-facts dd {
	margin: 2px 0 0;
	font-size: 16px;
	font-weight: 600;
	color: var(--pfc-text-display, #1f2a37);
}

.nugc-days.pfc-bars {
	gap: 4px;
	height: 220px;
}

.nugc-days .pfc-bars__item {
	min-width: 0;
}

.nugc-donut-layout {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	align-items: center;
	gap: 32px;
}

.nugc-donut {
	position: relative;
	justify-self: center;
}

.nugc-donut__total {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}

.nugc-donut__total strong {
	font-size: 28px;
	line-height: 1.2;
	color: var(--pfc-text-display, #1f2a37);
}

.nugc-donut__total span {
	font-size: 13px;
	color: var(--pfc-text-paragraph-secondary, #6c727e);
}

.nugc-legend.pfc-chart__legend {
	flex-direction: column;
	flex-wrap: nowrap;
	gap: 2px;
}

.nugc-legend .pfc-chart__legend-item {
	width: 100%;
	padding-block: 6px;
}

.nugc-legend__value {
	margin-inline-start: auto;
	font-weight: 600;
	color: var(--pfc-text-display, #1f2a37);
}

.nugc-legend__share {
	font-weight: 400;
	color: var(--pfc-text-paragraph-secondary, #6c727e);
}

.nugc-usage {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.nugc-usage + .nugc-usage {
	padding-block-start: 20px;
	border-block-start: 1px solid var(--pfc-border-neutral, #d2d6db);
}

.nugc-usage__title {
	margin: 0;
	font-size: 14px;
	font-weight: 600;
	color: var(--pfc-text-display, #1f2a37);
}

.nugc-usage__row {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.nugc-usage__label {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	color: var(--pfc-text-paragraph, #384250);
}

.nugc-usage__value {
	margin-inline-start: auto;
	font-weight: 600;
	color: var(--pfc-text-display, #1f2a37);
}

.nugc-top-designs {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
	gap: 16px;
}

.nugc .nugc-top-design {
	align-items: stretch;
	gap: 0;
	overflow: hidden;
	padding: 0;
}

.nugc-top-design__image {
	position: relative;
	height: 200px;
	overflow: hidden;
	background: var(--pfc-bg-body, #f9fafb);
}

.nugc-top-design__image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: top;
}

.nugc-top-design__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

/* A column row: the bar keeps its own height instead of flexing to zero */
.nugc-usage__row .nugc-bar {
	flex: none;
	width: 100%;
}

.nugc-top-design__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 16px;
}

.nugc-top-design__body .pfc-card__title,
.nugc-top-design__body .pfc-card__description {
	margin: 0;
}

.nugc-top-design__body .nugc-usage__row {
	margin-block-start: 8px;
}

@media (max-width: 640px) {
	.nugc-donut-layout {
		grid-template-columns: minmax(0, 1fr);
	}

	.nugc .nugc-stat-card {
		padding: 16px;
	}
}

.nugc-bar-value {
	min-width: 3ch;
	text-align: end;
}

.nugc-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.nugc-alert {
	width: 100%;
}

@media (max-width: 900px) {
	.nugc-editor__layout,
	.nugc-designer__layout {
		grid-template-columns: minmax(0, 1fr);
	}

	.nugc .nugc-panel,
	.nugc-designer__stage-col {
		position: static;
	}
}

@media (prefers-reduced-motion: reduce) {
	.nugc * {
		scroll-behavior: auto !important;
		transition: none !important;
	}
}

/* ===== Shared bits for the wall and the emailed greetings ===== */

.nugc-back {
	align-self: flex-start;
}

.nugc-cell-note {
	display: block;
	font-size: 12px;
	color: var(--pfc-text-paragraph-secondary, #6c727e);
}

.nugc-radio-chip {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
}

/*
 * The radio stays in the form and the keyboard order, out of sight. The
 * theme styles every radio with !important (relative, 24px wide), which
 * would sit inside the label and squeeze its text, hence !important here.
 */
.pfc-scope.nugc .nugc-radio-chip > input[type="radio"],
.pfc-scope.nugc .nugc-design-option > input[type="radio"] {
	position: absolute !important;
	inset: 0;
	width: 100% !important;
	height: 100% !important;
	margin: 0 !important;
	opacity: 0;
	cursor: pointer;
}

.nugc-design-option {
	position: relative;
}

/* Text areas span their field, like the inputs (the kit caps them at 332px) */
.nugc .pfc-textarea,
.nugc .pfc-textarea__field {
	box-sizing: border-box;
	width: 100%;
	max-width: none;
}

/* Icons keep their size inside chips instead of shrinking with the label */
.nugc-radio-chip svg {
	flex: none;
	width: 18px;
	height: 18px;
}

.nugc-react__count {
	margin-inline-start: 6px;
	font-variant-numeric: tabular-nums;
}

.nugc-radio-chip:focus-within,
.nugc-design-option:focus-within {
	outline: 2px solid var(--pfc-text-default, #161616);
	outline-offset: 2px;
}

.nugc-actions--center {
	justify-content: center;
}

/* ===== Congratulations wall ===== */

.nugc .nugc-wall-form {
	align-items: stretch;
	gap: 20px;
	padding: 24px;
}

.nugc-wall-form__head {
	display: flex;
	align-items: center;
	gap: 12px;
}

.nugc-wall-form__head .pfc-card__title,
.nugc-wall-form__head .pfc-card__description {
	margin: 0;
}

.nugc-wall-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
	gap: 20px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.nugc .nugc-wall-post {
	align-items: stretch;
	gap: 14px;
	padding: 20px;
}

.nugc-wall-post--hidden {
	opacity: 0.6;
}

.nugc-wall-post__head {
	display: flex;
	align-items: flex-start;
	gap: 12px;
}

.nugc-wall-post__to {
	display: flex;
	flex: 1;
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
	min-width: 0;
}

.nugc-wall-post__to .pfc-card__title {
	margin: 0;
	overflow-wrap: anywhere;
}

.nugc-wall-post__message {
	flex: 1;
	margin: 0;
	font-size: 16px;
	line-height: 1.9;
	color: var(--pfc-text-paragraph, #384250);
	overflow-wrap: anywhere;
}

.nugc-wall-post__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding-block-start: 12px;
	border-block-start: 1px solid var(--pfc-border-neutral, #d2d6db);
}

.nugc-wall-post__author {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.nugc-wall-post__name {
	font-size: 14px;
	font-weight: 600;
	color: var(--pfc-text-display, #1f2a37);
}

.nugc-wall-post__author time {
	font-size: 12px;
	color: var(--pfc-text-paragraph-secondary, #6c727e);
}

.nugc-wall-post__moderate {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

/* ===== Emailed greetings ===== */

.nugc-campaign-head {
	flex-direction: row;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
}

.nugc-campaign-head > div {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
}

.nugc-campaign-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
	align-items: start;
	gap: 28px;
}

.nugc-campaign-fields {
	display: flex;
	flex-direction: column;
	gap: 24px;
	min-width: 0;
}

.nugc .nugc-campaign-preview {
	align-items: stretch;
	gap: 16px;
}

.nugc-campaign-preview__frame {
	padding: 12px;
	border-radius: 12px;
	background: var(--pfc-bg-body, #f9fafb);
}

.nugc-campaign-preview__frame canvas,
.nugc-campaign-preview__frame img {
	display: block;
	width: 100%;
	height: auto;
	max-height: 70vh;
	object-fit: contain;
}

.nugc-design-picker {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
	gap: 12px;
}

.nugc .nugc-design-option {
	align-items: stretch;
	gap: 6px;
	padding: 8px;
}

.nugc .nugc-design-option.selected {
	border-color: var(--pfc-border-primary, #1b8354);
}

.nugc-design-option img {
	display: block;
	width: 100%;
	aspect-ratio: 1;
	object-fit: cover;
	object-position: top;
	border-radius: 8px;
}

.nugc-design-option__title {
	font-size: 13px;
	line-height: 1.5;
	color: var(--pfc-text-paragraph, #384250);
}

.nugc-people {
	font-family: inherit;
}

.nugc-campaign-summary {
	display: flex;
	flex-direction: column;
	gap: 14px;
	margin: 0;
}

.nugc-campaign-summary dt {
	font-size: 13px;
	font-weight: 400;
	color: var(--pfc-text-paragraph-secondary, #6c727e);
}

.nugc-campaign-summary dd {
	margin: 2px 0 0;
	line-height: 1.8;
	color: var(--pfc-text-display, #1f2a37);
}

.nugc-campaign-actions form {
	display: contents;
}

.nugc .nugc-test-form {
	align-items: stretch;
	padding: 20px 24px;
}

.nugc-test-form__row {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

.nugc-test-form__row .pfc-input {
	flex: 1 1 260px;
	max-width: none;
}

.nugc-audience-picker {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
	gap: 12px;
}

.nugc .nugc-audience-option {
	flex-direction: row;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
}

.nugc-audience-option__text {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.nugc .nugc-audience-option .pfc-featured-icon {
	flex: none;
}

.nugc-audience-option__name {
	font-weight: 600;
	color: var(--pfc-text-display, #1f2a37);
	overflow-wrap: anywhere;
}

@media (max-width: 900px) {
	.nugc-campaign-layout {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (max-width: 640px) {
	.nugc {
		padding: 40px 16px;
	}

	.nugc .nugc-empty {
		padding: 24px;
	}
}