/* File Embed Pro: front-end styles. Kept small and self-contained. */

.fep,
.fep__modal {
	--fep-accent: #2563eb;
	--fep-accent-2: #7c3aed;
	--fep-surface: #ffffff;
	--fep-text: #111827;
	--fep-muted: #6b7280;
	--fep-border: #e5e7eb;
	--fep-radius: 16px;
}

.fep {
	margin: 1.5em 0;
	color: var(--fep-text);
	contain: content; /* Limits layout/paint work to this block. */
}

.fep--empty {
	padding: 1em;
	border: 1px dashed var(--fep-border);
	border-radius: var(--fep-radius);
	color: var(--fep-muted);
	font-size: 0.95em;
}

.fep__custom {
	margin-bottom: 1em;
	line-height: 1.6;
}

.fep__file {
	display: flex;
	align-items: center;
	gap: 0.6em;
	margin-bottom: 0.75em;
	font-weight: 600;
	min-width: 0;
}

.fep__badge {
	flex: 0 0 auto;
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	padding: 0.25em 0.5em;
	border-radius: 6px;
	color: #ffffff;
	background: #64748b;
}

.fep__badge--pdf { background: #dc2626; }
.fep__badge--word { background: #2b579a; }

.fep__name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.fep__preview {
	position: relative;
	width: 100%;
	height: var(--fep-preview-h, 600px);
	border: 1px solid var(--fep-border);
	border-radius: var(--fep-radius);
	overflow: hidden;
	background: #f3f4f6;
}

.fep__preview iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

@media (max-width: 600px) {
	.fep__preview {
		height: min(var(--fep-preview-h, 600px), 420px);
	}
}

/* ---------- Download button ---------- */

.fep__actions {
	display: flex;
	justify-content: center;
	margin-top: 1.1em;
}

.fep__button {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 0.6em;
	padding: 0.85em 1.6em;
	border-radius: 999px;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1;
	color: #ffffff;
	text-decoration: none;
	overflow: hidden;
	isolation: isolate;
	background: linear-gradient(135deg, var(--fep-accent), var(--fep-accent-2));
	box-shadow: 0 8px 20px -6px rgba(37, 99, 235, 0.55);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Light sheen that sweeps across on hover. */
.fep__button::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
	transform: translateX(-120%);
	transition: transform 0.2s ease;
}

.fep__button:hover {
	transform: translateY(-2px);
	box-shadow: 0 14px 26px -8px rgba(37, 99, 235, 0.6);
	color: #ffffff;
}

.fep__button:hover::before {
	transform: translateX(120%);
	transition: transform 0.8s ease;
}

.fep__button:hover .fep__button-icon {
	animation: fep-bob 1s ease-in-out infinite;
}

.fep__button:active {
	transform: translateY(0) scale(0.97);
}

.fep__button:focus-visible {
	outline: 3px solid rgba(124, 58, 237, 0.45);
	outline-offset: 3px;
}

.fep__button.is-downloading {
	animation: fep-pop 0.6s ease;
}

.fep__button.is-downloading .fep__button-icon {
	animation: fep-drop 0.9s ease-in-out 1;
}

.fep__button-icon {
	display: inline-flex;
}

.fep__button-icon .fep-icon {
	width: 20px;
	height: 20px;
}

/* ---------- Welcome pop-up ---------- */

.fep__modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	opacity: 0;
	transition: opacity 0.25s ease;
}

.fep__modal[hidden] {
	display: none;
}

.fep__modal.is-open {
	opacity: 1;
}

.fep__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.55);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
}

.fep__dialog {
	position: relative;
	width: min(420px, 100%);
	padding: 32px 28px 26px;
	border-radius: 20px;
	background: var(--fep-surface);
	color: var(--fep-text);
	text-align: center;
	box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.45);
	overflow: hidden;
	transform: translateY(16px) scale(0.96);
	transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.fep__modal.is-open .fep__dialog {
	transform: none;
}

.fep__dialog-icon {
	display: grid;
	place-items: center;
	width: 64px;
	height: 64px;
	margin: 0 auto 14px;
	border-radius: 50%;
	color: var(--fep-accent);
	background: linear-gradient(135deg, #dbeafe, #ede9fe);
	animation: fep-float 2.4s ease-in-out infinite;
}

.fep__dialog-icon .fep-icon {
	width: 30px;
	height: 30px;
}

.fep__dialog-title {
	margin: 0 0 8px;
	font-size: 1.4rem;
	line-height: 1.2;
	color: var(--fep-text);
}

.fep__dialog-text {
	margin: 0 0 22px;
	color: var(--fep-muted);
	line-height: 1.6;
}

.fep__dialog-ok {
	padding: 0.7em 1.8em;
	border: 0;
	border-radius: 999px;
	font-size: 0.95rem;
	font-weight: 600;
	color: #ffffff;
	background: linear-gradient(135deg, var(--fep-accent), var(--fep-accent-2));
	cursor: pointer;
}

.fep__dialog-ok:focus-visible,
.fep__close:focus-visible {
	outline: 3px solid rgba(124, 58, 237, 0.45);
	outline-offset: 2px;
}

.fep__close {
	position: absolute;
	top: 10px;
	right: 12px;
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--fep-muted);
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
}

.fep__close:hover {
	background: rgba(107, 114, 128, 0.12);
	color: var(--fep-text);
}

/* Progress bar that drains while the pop-up is open (auto-closes at 6s). */
.fep__timer {
	position: absolute;
	left: 0;
	bottom: 0;
	width: 100%;
	height: 4px;
	background: linear-gradient(90deg, var(--fep-accent), var(--fep-accent-2));
	transform-origin: left center;
	animation: fep-timer 6s linear forwards;
}

/* ---------- Keyframes ---------- */

@keyframes fep-bob {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(3px); }
}

@keyframes fep-drop {
	0% { transform: translateY(-6px); opacity: 0; }
	50% { opacity: 1; }
	100% { transform: translateY(6px); opacity: 0; }
}

@keyframes fep-pop {
	0% { transform: scale(1); }
	40% { transform: scale(1.06); }
	100% { transform: scale(1); }
}

@keyframes fep-float {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-4px); }
}

@keyframes fep-timer {
	from { transform: scaleX(1); }
	to { transform: scaleX(0); }
}

/* ---------- Dark mode ---------- */

@media (prefers-color-scheme: dark) {
	.fep,
	.fep__modal {
		--fep-surface: #1f2937;
		--fep-text: #f9fafb;
		--fep-muted: #9ca3af;
		--fep-border: #374151;
	}

	.fep__preview {
		background: #111827;
	}

	.fep__dialog-icon {
		background: linear-gradient(135deg, #1e3a8a, #4c1d95);
		color: #bfdbfe;
	}
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
	.fep__button,
	.fep__button *,
	.fep__modal,
	.fep__dialog,
	.fep__dialog-icon,
	.fep__timer {
		animation: none !important;
		transition: none !important;
	}
}
