/* AI Coloring Page Generator — Frontend Styles */

.aicpg-app {
	--aicpg-green: #10a37f;
	--aicpg-green-dark: #0d8b6c;
	--aicpg-text: #202123;
	--aicpg-muted: #6e6e80;
	--aicpg-border: #e5e5e5;
	--aicpg-bg: #f7f7f8;
	--aicpg-error: #d93025;

	max-width: 640px;
	margin: 0 auto;
	padding: 24px 16px 48px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--aicpg-text);
	box-sizing: border-box;
}

.aicpg-app *,
.aicpg-app *::before,
.aicpg-app *::after {
	box-sizing: border-box;
}

.aicpg-admin-warning {
	background: #fff8e5;
	border: 1px solid #f0d585;
	color: #7a5b00;
	padding: 12px 16px;
	border-radius: 10px;
	margin-bottom: 20px;
	font-size: 14px;
	text-align: center;
}

.aicpg-card {
	background: #ffffff;
	border: 1px solid var(--aicpg-border);
	border-radius: 20px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
	padding: 40px 32px;
	text-align: center;
	animation: aicpg-fade-in 0.25s ease;
}

@keyframes aicpg-fade-in {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.aicpg-heading {
	font-size: 26px;
	font-weight: 600;
	margin: 0 0 24px;
	color: var(--aicpg-text);
}

.aicpg-input-row {
	margin-bottom: 16px;
}

.aicpg-input {
	width: 100%;
	padding: 16px 18px;
	font-size: 16px;
	border: 1.5px solid var(--aicpg-border);
	border-radius: 14px;
	outline: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	background: var(--aicpg-bg);
}

.aicpg-input:focus {
	border-color: var(--aicpg-green);
	box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.15);
	background: #ffffff;
}

.aicpg-examples {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: center;
	margin-bottom: 24px;
}

.aicpg-example-chip {
	border: 1px solid var(--aicpg-border);
	background: var(--aicpg-bg);
	color: var(--aicpg-text);
	padding: 8px 14px;
	border-radius: 999px;
	font-size: 13px;
	cursor: pointer;
	transition: background 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
}

.aicpg-example-chip:hover {
	background: #eef9f6;
	border-color: var(--aicpg-green);
	transform: translateY(-1px);
}

.aicpg-generate-btn {
	width: 100%;
	background: var(--aicpg-green);
	color: #fff;
	border: none;
	border-radius: 14px;
	padding: 16px;
	font-size: 17px;
	font-weight: 700;
	letter-spacing: 0.5px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	transition: background 0.15s ease, transform 0.1s ease;
}

.aicpg-generate-btn:hover:not(:disabled) {
	background: var(--aicpg-green-dark);
	transform: translateY(-1px);
}

.aicpg-generate-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.aicpg-spinner {
	display: none;
	width: 18px;
	height: 18px;
	border: 2.5px solid rgba(255, 255, 255, 0.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: aicpg-spin 0.7s linear infinite;
}

.aicpg-generate-btn.is-loading .aicpg-spinner {
	display: inline-block;
}

.aicpg-generate-btn.is-loading .aicpg-btn-text {
	opacity: 0.85;
}

@keyframes aicpg-spin {
	to {
		transform: rotate(360deg);
	}
}

.aicpg-progress {
	margin-top: 20px;
}

.aicpg-progress-bar {
	width: 100%;
	height: 6px;
	background: var(--aicpg-bg);
	border-radius: 999px;
	overflow: hidden;
}

.aicpg-progress-bar span {
	display: block;
	height: 100%;
	width: 30%;
	background: var(--aicpg-green);
	border-radius: 999px;
	animation: aicpg-progress-slide 1.4s ease-in-out infinite;
}

@keyframes aicpg-progress-slide {
	0% {
		margin-left: -30%;
	}
	50% {
		margin-left: 60%;
	}
	100% {
		margin-left: 110%;
	}
}

.aicpg-progress-label {
	font-size: 13px;
	color: var(--aicpg-muted);
	margin: 10px 0 0;
}

.aicpg-error {
	background: #fdecea;
	color: var(--aicpg-error);
	border: 1px solid #f6c6c2;
	padding: 12px 14px;
	border-radius: 10px;
	font-size: 14px;
	margin-top: 16px;
	text-align: left;
}

.aicpg-credits-row {
	margin-top: 24px;
	font-size: 14px;
	color: var(--aicpg-muted);
	display: flex;
	gap: 6px;
	justify-content: center;
}

.aicpg-credits-row strong {
	color: var(--aicpg-text);
}

.aicpg-nav-links {
	margin-top: 12px;
}

.aicpg-link-btn {
	background: none;
	border: none;
	color: var(--aicpg-green);
	font-size: 14px;
	cursor: pointer;
	text-decoration: underline;
	padding: 4px;
}

.aicpg-link-btn:hover {
	color: var(--aicpg-green-dark);
}

/* Result view */

.aicpg-result-image-wrap {
	background: var(--aicpg-bg);
	border-radius: 14px;
	padding: 16px;
	margin-bottom: 20px;
}

.aicpg-result-image-wrap img {
	width: 100%;
	height: auto;
	border-radius: 8px;
	display: block;
}

.aicpg-result-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	justify-content: center;
}

.aicpg-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 20px;
	border-radius: 12px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
	border: none;
	transition: transform 0.1s ease, background 0.15s ease;
}

.aicpg-btn:hover {
	transform: translateY(-1px);
}

.aicpg-btn-primary {
	background: var(--aicpg-green);
	color: #fff;
}

.aicpg-btn-primary:hover {
	background: var(--aicpg-green-dark);
}

.aicpg-btn-secondary {
	background: var(--aicpg-bg);
	color: var(--aicpg-text);
	border: 1px solid var(--aicpg-border);
}

.aicpg-btn-secondary:hover {
	background: #eee;
}

/* Paywall */

.aicpg-paywall-copy {
	font-size: 18px;
	font-weight: 600;
	margin-bottom: 24px;
}

#aicpg-paypal-button-container {
	margin-bottom: 16px;
}

/* History */

.aicpg-history-card {
	text-align: left;
	max-width: 100%;
}

.aicpg-history-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 20px;
}

.aicpg-history-header h2 {
	font-size: 20px;
	margin: 0;
}

.aicpg-history-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 16px;
}

.aicpg-history-empty {
	grid-column: 1 / -1;
	text-align: center;
	color: var(--aicpg-muted);
	font-size: 14px;
	padding: 30px 0;
}

.aicpg-history-item {
	border: 1px solid var(--aicpg-border);
	border-radius: 12px;
	overflow: hidden;
	background: var(--aicpg-bg);
	display: flex;
	flex-direction: column;
	transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.aicpg-history-item:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.aicpg-history-thumb img {
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	display: block;
	background: #fff;
}

.aicpg-history-meta {
	padding: 10px 10px 4px;
}

.aicpg-history-prompt {
	font-size: 13px;
	font-weight: 600;
	margin: 0 0 2px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.aicpg-history-date {
	font-size: 11px;
	color: var(--aicpg-muted);
	margin: 0;
}

.aicpg-history-actions {
	display: flex;
	justify-content: space-around;
	padding: 8px 6px 10px;
}

.aicpg-icon-btn {
	background: #fff;
	border: 1px solid var(--aicpg-border);
	border-radius: 8px;
	width: 32px;
	height: 32px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	text-decoration: none;
	font-size: 14px;
	color: var(--aicpg-text);
	transition: background 0.15s ease;
}

.aicpg-icon-btn:hover {
	background: var(--aicpg-bg);
}

@media (max-width: 480px) {
	.aicpg-card {
		padding: 28px 20px;
	}

	.aicpg-heading {
		font-size: 21px;
	}
}
