/* Resizable iframe module with custom drag handle
 *
 * CUSTOMIZE: Edit CSS variables below to change handle appearance
 */

.resizable {
	/* Styling variables - change these to customize */
	--handle-width: 16px;
	--handle-color: rgba(0, 0, 0, 0.15);
	--handle-hover-color: rgba(0, 120, 215, 0.4);
	--iframe-min-width: 320px;
	--iframe-height: 600px;

	position: relative;
	overflow: auto;

	/* Size constraints */
	width: 100%;
	min-width: var(--iframe-min-width);
	max-width: 100%;
	height: var(--iframe-height);

	/* Visual styling */
	border: 1px solid rgba(0, 0, 0, 0.55);
	margin-top: var(--spacing-2, 1rem);
	margin-bottom: var(--spacing-2, 1rem);
}

.resizable iframe {
	width: 100%;
	height: 100%;
	display: block;
	border: none;
}

/* Drag handle - visible bar on right edge */
.resize-handle {
	position: absolute;
	top: 0;
	right: 0;
	width: var(--handle-width);
	height: 100%;
	background: var(--handle-color);
	cursor: ew-resize;
	z-index: 10;
	transition: background 0.2s;
}

.resize-handle:hover {
	background: var(--handle-hover-color);
}

/* Optional: Grip dots for visual affordance */
.resize-handle::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 3px;
	height: 40px;
	background: repeating-linear-gradient(
		to bottom,
		transparent,
		transparent 2px,
		rgba(255, 255, 255, 0.6) 2px,
		rgba(255, 255, 255, 0.6) 4px
	);
}

/* Width indicator - shows pixel width while dragging */
.resize-width-indicator {
	position: absolute;
	top: 10px;
	left: 10px;
	background: rgba(0, 0, 0, 0.8);
	color: white;
	padding: 4px 8px;
	border-radius: 3px;
	font-family: monospace;
	font-size: 14px;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.2s;
	z-index: 11;
}

.resizable.is-resizing .resize-width-indicator {
	opacity: 1;
}

/* Admin codepen link */
.admin-codepen-link {
	font-size: 0.73rem;
	font-family: monospace;
	text-transform: uppercase;
	position: absolute;
	top: 70px;
	left: -120px;
	text-decoration: underline;
	color: rgba(0, 0, 0, 0.15);
	transition: color 0.3s;
}

.admin-codepen-link:hover {
	color: rgba(0, 0, 0, 0.5);
}
