/*
 * Perfection42 Generation button styles
 * - Class-based selectors to match new markup
 * - Colors sampled from brand (approximate) and exposed as CSS variables for easy tweaks
 */

:root {
	--p42-brand: #e53935; /* brand red (sampled approx) */
	--p42-brand-dark: #c62828; /* darker variant */
	--p42-on-brand: #ffffff; /* text/icon on brand */
	--p42-shadow: rgba(0, 0, 0, 0.15);
	--p42-shadow-strong: rgba(0, 0, 0, 0.25);
}

.p42-gen-button {
	-webkit-appearance: none;
	appearance: none;
	border: 1px solid var(--p42-brand); /* swapped scheme: show border */
	border-radius: 8px; /* slightly larger for presence */
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 10px 16px; /* bigger */
	font: 700 15px/1.3 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif; /* bold */
	cursor: pointer;
	color: var(--p42-brand); /* swapped */
	background: #ffffff; /* swapped */
	min-height: 36px; /* comfortable target */
	box-shadow: 0 1px 1px var(--p42-shadow), 0 2px 6px var(--p42-shadow);
	transition: background .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .02s ease;
}

.p42-gen-button:hover {
	/* invert to filled brand on hover */
	background: linear-gradient(0deg, var(--p42-brand-dark), var(--p42-brand));
	color: var(--p42-on-brand);
	border-color: var(--p42-brand-dark);
	box-shadow: 0 2px 2px var(--p42-shadow), 0 4px 12px var(--p42-shadow-strong);
}

.p42-gen-button:active {
	transform: translateY(1px);
}

.p42-gen-button:focus-visible {
	outline: 2px solid rgba(0,0,0,.35);
	outline-offset: 2px;
}

.p42-gen-button[disabled],
.p42-gen-button:disabled {
	opacity: .6;
	cursor: not-allowed;
}

.p42-gen-button__inner {
	display: inline-flex;
	align-items: center;
	gap: 10px; /* align with larger button */
}

.p42-gen-button .p42-logo {
	width: 18px;
	height: 18px;
	display: inline-block;
}

/* generate icon placed after label */
.p42-gen-button .p42-generate-icon {
	width: 18px;
	height: 18px;
	display: inline-block;
}

.p42-gen-button--toolbar {
	height: 36px; /* match admin toolbar control height */
	padding: 8px 14px;
	vertical-align: middle;
	margin-left: 8px; /* spacing in list toolbar */
}

.p42-gen-button--primary {
	/* same as base for now; reserved for future themes */
}

.p42-gen-button--compact {
	padding: 6px 12px;
	min-height: 32px;
}

/* Add space when placed next to Add Media button */
#wp-content-media-buttons .p42-gen-button,
#wp-excerpt-media-buttons .p42-gen-button {
	margin-left: 8px;
}

/* Metabox placement adjustments: top-left inside boxes */
#postimagediv .inside .p42-gen-button,
#woocommerce-product-images .inside .p42-gen-button,
#product_images_container .inside .p42-gen-button,
#product_images .p42-gen-button {
	margin-bottom: 8px;
}

#edidev-perfection-ai-nextjs-component-root {
	position: fixed;
	top: 0; left: 0;
	width: 100%; height: 100%;
	background: rgba(0,0,0,0.4);
	z-index: 9999;
}

#edidev-perfection-ai-nextjs-component-root .perfection-modal-content {
	background: white;
	width: 99vw;
	height: 100vh;
	margin: auto;
	position: relative;
}

/* Legacy rules removed/replaced by class-based styles */

body.edidev-ai-assistant-for-perfection42-modal-open {
	overflow: hidden !important;
}

#postimagediv .inside img[class*="attachment-"] {
	width: 100% !important;
	height: auto !important;
}

/* Responsive: compact/icon-only below 480px */
@media (max-width: 480px) {
	.p42-gen-button {
		padding: 8px 12px; /* keep larger tap area */
		min-height: 36px;
	}
	.p42-gen-button .p42-label {
		display: none;
	}
	.p42-gen-button .p42-logo {
		width: 20px;
		height: 20px;
	}
	.p42-gen-button .p42-generate-icon {
		width: 20px;
		height: 20px;
	}
}