/**
 * File: assets/css/cwl-style.css
 * Purpose: All front-end styling for the plugin -- liquid glass
 * (glassmorphism) surfaces, floating labels, buttons, tabs, accordion,
 * engagement bar, and the single-prompt template. Dark mode is driven
 * purely by the Kadence theme body class `body.color-switch-dark` --
 * there is no manual toggle in this plugin.
 */

:root {
	--cwl-primary: #6366f1;
	--cwl-accent: #22d3ee;
	--cwl-radius: 16px;

	--cwl-glass-bg: rgba(255, 255, 255, 0.55);
	--cwl-glass-border: rgba(255, 255, 255, 0.35);
	--cwl-glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.12);
	--cwl-text: #1a1a2e;
	--cwl-text-muted: #52526b;
	--cwl-input-bg: rgba(255, 255, 255, 0.5);
	--cwl-input-border: rgba(0, 0, 0, 0.12);
	--cwl-page-bg-tint: transparent;
	--cwl-bg-solid: #ffffff;

	/* Prompt variable highlighting -- a clean "highlighter pen" look (solid
	   warm color behind the text, dark ink) rather than a bordered chip,
	   tuned separately per mode so it always reads clearly. */
	--cwl-highlight-bg: #fde68a;
	--cwl-highlight-bg-hover: #fcd34d;
	--cwl-highlight-text: #1a1a2e;
}

body.color-switch-dark {
	--cwl-glass-bg: rgba(24, 24, 38, 0.55);
	--cwl-glass-border: rgba(255, 255, 255, 0.08);
	--cwl-glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
	--cwl-text: #f4f4fa;
	--cwl-text-muted: #b7b7cf;
	--cwl-input-bg: rgba(255, 255, 255, 0.06);
	--cwl-input-border: rgba(255, 255, 255, 0.14);
	--cwl-bg-solid: #1c1c2e;

	/* Prompt variable highlighting -- a softer, glowing amber marker in
	   dark mode (a flat bright-yellow marker would be too harsh against
	   a dark surface), with pale warm text so it still reads as "ink on
	   a highlighter" rather than a plain badge. */
	--cwl-highlight-bg: rgba(250, 204, 21, 0.32);
	--cwl-highlight-bg-hover: rgba(250, 204, 21, 0.45);
	--cwl-highlight-text: #fef9c3;
}

/* ------------------------------------------------------------------ *
 * Base glass surface
 * ------------------------------------------------------------------ */

.cwl-glass {
	background: var(--cwl-glass-bg);
	border: 1px solid var(--cwl-glass-border);
	border-radius: var(--cwl-radius);
	box-shadow: var(--cwl-glass-shadow);
	-webkit-backdrop-filter: blur(20px) saturate(160%);
	backdrop-filter: blur(20px) saturate(160%);
	color: var(--cwl-text);
}

.cwl-heading {
	color: var(--cwl-text);
	font-weight: 700;
	letter-spacing: -0.01em;
	line-height: 1.2;
	text-shadow: none;
}

.cwl-subtext {
	color: var(--cwl-text-muted);
	margin: 0.25rem 0 1.25rem;
	font-size: 0.95rem;
}

/* ------------------------------------------------------------------ *
 * Auth cards
 * ------------------------------------------------------------------ */

.cwl-auth-card,
.cwl-card {
	max-width: 440px;
	margin: 2rem auto;
	padding: 2rem 1.75rem;
}

.cwl-auth-panel[hidden] {
	display: none;
}

.cwl-notice {
	max-width: 480px;
	margin: 2rem auto;
	padding: 1.5rem;
	text-align: center;
}

.cwl-restricted-notice {
	max-width: 480px;
	margin: 2rem auto 1.25rem;
	padding: 1.25rem 1.5rem;
	text-align: center;
}
.cwl-restricted-notice .cwl-heading {
	margin: 0;
	font-size: 1.1rem;
}

/* Standalone "Submit a Prompt" page ([cwl_submit_prompt]) -- deliberately
   overrides the narrow 440px .cwl-card width (shared with the login/
   register auth cards) so this page matches the Dashboard's container
   width instead of looking like a login form. */
.cwl-submit-card {
	max-width: 1120px;
	margin: 2rem auto;
	padding: 2rem;
}

@media (max-width: 640px) {
	.cwl-submit-card {
		padding: 1.1rem 0.85rem;
		margin: 1rem auto;
		border-radius: calc(var(--cwl-radius) * 0.6);
	}
}

/* ------------------------------------------------------------------ *
 * Forms & floating labels
 * ------------------------------------------------------------------ */

.cwl-form {
	display: flex;
	flex-direction: column;
	gap: 1.1rem;
}

.cwl-field {
	position: relative;
}

.cwl-field-float {
	position: relative;
}

.cwl-field-float input,
.cwl-field-float textarea {
	width: 100%;
	box-sizing: border-box;
	/* Extra top padding (vs. the 1.1rem this used to be) so there is a
	   clear, fixed gap below the floated label instead of the label
	   crowding right up against the typed value -- this is what read as
	   "overlapping" even once the label was technically floating. */
	padding: 1.65rem 0.9rem 0.55rem !important;
	background: var(--cwl-input-bg);
	border: 1px solid var(--cwl-input-border);
	border-radius: calc(var(--cwl-radius) * 0.6);
	color: var(--cwl-text);
	font-size: 0.98rem !important;
	line-height: 1.3 !important;
	outline: none;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cwl-field-float textarea {
	resize: vertical;
	min-height: 5.5rem;
	padding-top: 1.75rem !important;
}

/* Fires a no-op animation on autofill so cwl-scripts.js can detect it via
   the `animationstart` event -- browsers don't emit a normal `input`
   event when a field is filled by a password manager/autofill. */
@keyframes cwlAutofillStart {
	from { opacity: 1; }
	to { opacity: 1; }
}
.cwl-field-float input:-webkit-autofill,
.cwl-field-float textarea:-webkit-autofill {
	animation-name: cwlAutofillStart;
	animation-duration: 0.01s;
}

.cwl-field-float input:focus,
.cwl-field-float textarea:focus {
	border-color: var(--cwl-primary);
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.cwl-field-float label {
	position: absolute !important;
	left: 0.95rem !important;
	top: 1.05rem !important;
	right: auto !important;
	bottom: auto !important;
	margin: 0 !important;
	display: block !important;
	color: var(--cwl-text-muted);
	font-size: 0.95rem !important;
	line-height: 1.2 !important;
	pointer-events: none;
	z-index: 1;
	transition: transform 0.16s ease, font-size 0.16s ease, top 0.16s ease, color 0.16s ease;
	transform-origin: left top;
}

/*
 * :not(:placeholder-shown) is the primary trigger, but it is not reliable
 * on its own -- some themes/browsers don't update it for values set by
 * autofill (password managers, browser-saved addresses), and some hosts'
 * global CSS re-declares `label { position: static }` with higher
 * specificity, which is what caused the label text to sit directly on top
 * of the typed value instead of floating up. cwl-scripts.js mirrors this
 * with a `.cwl-has-value` class toggled on input/change/blur AND right
 * after autofill, so the label reliably floats either way; the !important
 * pins keep the theme's global label styles from overriding these rules.
 */
.cwl-field-float input:focus + label,
.cwl-field-float input:not(:placeholder-shown) + label,
.cwl-field-float.cwl-has-value input + label,
.cwl-field-float textarea:focus + label,
.cwl-field-float textarea:not(:placeholder-shown) + label,
.cwl-field-float.cwl-has-value textarea + label {
	top: 0.4rem !important;
	font-size: 0.72rem !important;
	color: var(--cwl-primary);
	transform: translateY(0);
}

.cwl-field-password {
	display: flex;
	align-items: center;
}

.cwl-field-password input {
	padding-right: 2.6rem;
}

.cwl-toggle-password {
	position: absolute;
	right: 0.6rem;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	cursor: pointer;
	width: 1.8rem;
	height: 1.8rem;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0.65;
}

.cwl-eye-icon {
	width: 18px;
	height: 18px;
	display: block;
	color: var(--cwl-text-muted);
}
/* Password hidden (default): show the open eye. */
.cwl-eye-icon-closed {
	display: none;
}
/* Password visible: swap to the eye-with-slash icon. */
.cwl-toggle-password[data-visible="1"] .cwl-eye-icon-open {
	display: none;
}
.cwl-toggle-password[data-visible="1"] .cwl-eye-icon-closed {
	display: block;
}
.cwl-toggle-password[data-visible="1"] .cwl-eye-icon {
	color: var(--cwl-primary);
}

.cwl-field-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 0.88rem;
}

.cwl-checkbox {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	color: var(--cwl-text-muted);
	cursor: pointer;
}

.cwl-checkbox-pill {
	background: var(--cwl-input-bg);
	border: 1px solid var(--cwl-input-border);
	border-radius: 999px;
	padding: 0.4rem 0.85rem;
}

.cwl-checkbox-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: 0.5rem;
}

.cwl-fieldset {
	margin-top: -0.2rem;
}

.cwl-fieldset + .cwl-fieldset {
	margin-top: 1.1rem;
}

.cwl-fieldset-hint {
	text-transform: none;
	font-weight: 500;
	color: var(--cwl-text-muted);
	opacity: 0.75;
}

.cwl-field-hint {
	margin: 0.35rem 0 0;
	font-size: 0.8rem;
	font-weight: 500;
	color: var(--cwl-text-muted);
	opacity: 0.75;
}

.cwl-fieldset-label {
	display: block;
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--cwl-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.03em;
	margin-bottom: 0.35rem;
}

.cwl-hp-field {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Strength meter */
.cwl-strength-meter {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	margin-top: -0.4rem;
}
.cwl-strength-bar {
	flex: 1;
	height: 6px;
	background: var(--cwl-input-border);
	border-radius: 4px;
	overflow: hidden;
}
.cwl-strength-bar span {
	display: block;
	height: 100%;
	width: 0%;
	background: #ef4444;
	transition: width 0.25s ease, background-color 0.25s ease;
}
.cwl-strength-label {
	font-size: 0.78rem;
	color: var(--cwl-text-muted);
	min-width: 4.5rem;
	text-align: right;
}

/* Upload wrapper */
.cwl-upload-wrapper {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 1.6rem 1rem;
	border: 1.5px dashed var(--cwl-input-border);
	border-radius: calc(var(--cwl-radius) * 0.6);
	background: var(--cwl-input-bg);
	cursor: pointer;
	text-align: center;
	transition: border-color 0.2s ease, background 0.2s ease;
	position: relative;
}
.cwl-upload-wrapper input[type="file"] {
	position: absolute;
	inset: 0;
	opacity: 0;
	cursor: pointer;
}
.cwl-upload-icon {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--cwl-primary), var(--cwl-accent));
	display: inline-block;
}
.cwl-upload-text {
	color: var(--cwl-text-muted);
	font-size: 0.85rem;
}
.cwl-upload-preview {
	margin-top: 0.75rem;
	max-width: 100%;
	max-height: 220px;
	border-radius: calc(var(--cwl-radius) * 0.5);
	object-fit: cover;
}

/* ------------------------------------------------------------------ *
 * Buttons
 * ------------------------------------------------------------------ */

.cwl-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	border: none;
	border-radius: calc(var(--cwl-radius) * 0.55);
	padding: 0.75rem 1.3rem;
	font-size: 0.95rem;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
	transition: transform 0.12s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.cwl-btn:active {
	transform: scale(0.98);
}
.cwl-btn-block {
	width: 100%;
}
.cwl-btn-primary {
	background: linear-gradient(135deg, var(--cwl-primary), var(--cwl-accent));
	color: #fff;
	box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}
.cwl-btn-primary:disabled {
	opacity: 0.65;
	cursor: not-allowed;
}
.cwl-btn-ghost {
	background: var(--cwl-input-bg);
	color: var(--cwl-text);
	border: 1px solid var(--cwl-input-border);
}
.cwl-link-btn {
	background: none;
	border: none;
	color: var(--cwl-primary);
	cursor: pointer;
	font-size: 0.88rem;
	padding: 0;
	text-decoration: underline;
}
.cwl-link-btn-danger {
	color: #ef4444;
}
.cwl-switch-text {
	text-align: center;
	color: var(--cwl-text-muted);
	font-size: 0.88rem;
	margin-top: 1.25rem;
}
.cwl-switch-text a {
	color: var(--cwl-primary);
	font-weight: 600;
}

.cwl-spinner {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	border: 2px solid rgba(255, 255, 255, 0.5);
	border-top-color: #fff;
	animation: cwl-spin 0.6s linear infinite;
}
@keyframes cwl-spin {
	to { transform: rotate(360deg); }
}

/* ------------------------------------------------------------------ *
 * Alerts
 * ------------------------------------------------------------------ */

.cwl-alert {
	padding: 0.75rem 1rem;
	border-radius: calc(var(--cwl-radius) * 0.5);
	font-size: 0.88rem;
	margin-bottom: 1rem;
}
.cwl-alert-success {
	background: rgba(34, 197, 94, 0.15);
	color: #16a34a;
	border: 1px solid rgba(34, 197, 94, 0.3);
}
.cwl-alert-error {
	background: rgba(239, 68, 68, 0.14);
	color: #dc2626;
	border: 1px solid rgba(239, 68, 68, 0.3);
}
.cwl-alert-info {
	background: rgba(99, 102, 241, 0.14);
	color: var(--cwl-primary);
	border: 1px solid rgba(99, 102, 241, 0.3);
}
.cwl-resend-block {
	text-align: center;
}
.cwl-resend-block[hidden] {
	display: none;
}

/* ------------------------------------------------------------------ *
 * Dashboard
 * ------------------------------------------------------------------ */

.cwl-dashboard {
	max-width: 1120px;
	margin: 2rem auto;
	padding: 2rem;
}

.cwl-dashboard-header {
	display: flex;
	align-items: center;
	gap: 1.25rem;
	margin-bottom: 1.75rem;
	padding-bottom: 1.5rem;
	border-bottom: 1px solid var(--cwl-glass-border);
}
.cwl-avatar img {
	border-radius: 50%;
	display: block;
}
.cwl-dashboard-greeting {
	font-size: 1.5rem;
	margin: 0 0 0.15rem;
}
.cwl-dashboard-email {
	margin: 0;
	color: var(--cwl-text-muted);
	font-size: 0.9rem;
}
.cwl-dashboard-username {
	margin: 0.15rem 0 0;
	color: var(--cwl-text-muted);
	font-size: 0.85rem;
}
.cwl-dashboard-username-link {
	color: inherit;
	text-decoration: none;
	transition: color 0.15s ease;
}

.cwl-tab-list {
	display: flex;
	gap: 0.35rem;
	margin-bottom: 1.5rem;
	border-bottom: 1px solid var(--cwl-glass-border);
}
.cwl-tab-btn {
	background: none;
	border: none;
	padding: 0.65rem 1rem;
	font-weight: 600;
	color: var(--cwl-text-muted);
	cursor: pointer;
	border-bottom: 2px solid transparent;
	white-space: nowrap;
	flex-shrink: 0;
	transition: color 0.2s ease, border-color 0.2s ease;
}
.cwl-tab-btn-active {
	border-bottom-color: var(--cwl-primary);
}
.cwl-tab-panel[hidden] {
	display: none;
}

.cwl-subtabs {
	display: flex;
	gap: 1.5rem;
	align-items: flex-start;
}
.cwl-subtab-list {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	flex: 0 0 200px;
	border-right: 1px solid var(--cwl-glass-border);
	padding-right: 1rem;
}
.cwl-subtab-btn {
	background: none;
	border: none;
	border-left: 2px solid transparent;
	text-align: left;
	padding: 0.7rem 1rem;
	font-weight: 600;
	font-size: 0.92rem;
	color: var(--cwl-text-muted);
	cursor: pointer;
	width: 100%;
	border-radius: 0 calc(var(--cwl-radius) * 0.35) calc(var(--cwl-radius) * 0.35) 0;
	transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.cwl-subtab-btn-active {
	border-left-color: var(--cwl-primary);
}
.cwl-subtab-content {
	flex: 1 1 auto;
	min-width: 0;
}

.cwl-profile-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 1.25rem;
}
.cwl-field-label {
	display: block;
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: var(--cwl-text-muted);
	margin-bottom: 0.25rem;
}
.cwl-field-value {
	font-size: 1rem;
	font-weight: 600;
	color: var(--cwl-text);
}

.cwl-profile-password-section {
	margin-top: 2rem;
	padding-top: 1.75rem;
	border-top: 1px solid var(--cwl-input-border);
	display: flex;
	flex-direction: column;
	gap: 1rem;
	max-width: 420px;
}
.cwl-profile-password-heading {
	font-size: 1.1rem;
	margin: 0;
}

.cwl-prompt-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}
.cwl-prompt-row {
	background: var(--cwl-input-bg);
	border: 1px solid var(--cwl-input-border);
	border-radius: calc(var(--cwl-radius) * 0.5);
	padding: 0.9rem 1.1rem;
}
.cwl-prompt-row-main {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
}
.cwl-prompt-row-title {
	color: var(--cwl-text);
	font-weight: 600;
	text-decoration: none;
}
.cwl-prompt-row-meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 0.5rem;
	font-size: 0.82rem;
	color: var(--cwl-text-muted);
}
.cwl-prompt-row-actions {
	display: flex;
	gap: 0.75rem;
}

.cwl-badge {
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	padding: 0.2rem 0.6rem;
	border-radius: 999px;
}
.cwl-badge-publish {
	background: rgba(34, 197, 94, 0.18);
	color: #16a34a;
}
.cwl-badge-draft {
	background: rgba(148, 163, 184, 0.25);
	color: #64748b;
}
.cwl-badge-pending {
	background: rgba(234, 179, 8, 0.2);
	color: #ca8a04;
}

.cwl-empty-state {
	text-align: center;
	padding: 2.5rem 1rem;
	color: var(--cwl-text-muted);
}

.cwl-pagination {
	display: flex;
	justify-content: center;
	gap: 0.4rem;
	margin-top: 1.25rem;
}
.cwl-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2rem;
	height: 2rem;
	padding: 0 0.5rem;
	border-radius: calc(var(--cwl-radius) * 0.4);
	background: var(--cwl-input-bg);
	color: var(--cwl-text);
	text-decoration: none;
	font-size: 0.85rem;
}
.cwl-pagination .page-numbers.current {
	background: var(--cwl-primary);
	color: #fff;
}

/* ------------------------------------------------------------------ *
 * Single prompt template
 * ------------------------------------------------------------------ */

.cwl-single-prompt-wrap {
	max-width: 1120px;
	margin: 3rem auto;
	padding: 0 1.25rem;
}

/* Flex-based (not viewport-media-based) so the two-column layout responds
   to the ACTUAL rendered width of this wrapper -- some themes box the
   content column in narrower than the viewport, which made a viewport
   media query collapse to one column even on wide desktop screens. Flex
   wrapping reacts to the element's own available space instead. */
.cwl-prompt-layout {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 2rem;
}

.cwl-prompt-media {
	flex: 1 1 320px;
	max-width: 360px;
	position: sticky;
	top: 1.5rem;
}

/* Fixed 3:4 frame -- always keeps this ratio no matter the source image's
   natural dimensions; the image is cropped to fill via object-fit. */
.cwl-prompt-media-frame {
	position: relative;
	width: 100%;
	aspect-ratio: 3 / 4;
	border-radius: calc(var(--cwl-radius) * 1.1);
	overflow: hidden;
	background: var(--cwl-input-bg);
	border: 1px solid var(--cwl-glass-border);
	box-shadow: 0 20px 48px rgba(0, 0, 0, 0.28);
}
.cwl-prompt-media-frame img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease;
}
.cwl-prompt-media-placeholder {
	position: absolute;
	inset: 0;
	background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(34, 211, 238, 0.14));
}

.cwl-prompt-info {
	flex: 3 1 420px;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 1.1rem;
}

.cwl-prompt-card {
	margin-bottom: 0;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.cwl-prompt-header {
	padding: 1.5rem 1.75rem;
}
.cwl-prompt-title {
	font-size: 1.85rem;
	margin: 0 0 0.4rem;
}
.cwl-prompt-byline {
	color: var(--cwl-text-muted);
	font-size: 0.92rem;
}
.cwl-prompt-author {
	color: var(--cwl-text);
	font-weight: 600;
	text-decoration: none;
}
.cwl-prompt-dot {
	margin: 0 0.4rem;
}

.cwl-engagement-bar {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.85rem 1.1rem;
	margin-bottom: 0;
	flex-wrap: wrap;
}

.cwl-faq-section {
	flex: 1 1 100%;
	margin-top: 0.75rem;
}

@media (max-width: 640px) {
	.cwl-prompt-media {
		position: static;
		max-width: 100%;
		flex-basis: 100%;
	}
	.cwl-prompt-info {
		flex-basis: 100%;
	}
	.cwl-prompt-title {
		font-size: 1.5rem;
	}
}

/* ------------------------------------------------------------------ *
 * Related Prompts -- sits just above the footer on the single prompt
 * page. Minimal glass cards: image, a soft bottom-gradient title, and
 * an optional "Tested On" chip. Grid auto-fills so it adapts smoothly
 * from desktop down to a single narrow column on phones.
 * ------------------------------------------------------------------ */

.cwl-related-section {
	margin-top: 3rem;
	padding-top: 0.5rem;
}

.cwl-related-inner {
	margin-top: 0;
	margin-bottom: 0;
}

.cwl-related-heading {
	font-size: 1.3rem;
	margin: 0 0 1rem;
}

.cwl-related-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
	gap: 1rem;
}

.cwl-related-card {
	display: block;
	text-decoration: none;
	border-radius: calc(var(--cwl-radius) * 0.85);
	overflow: hidden;
	background: var(--cwl-input-bg);
	border: 1px solid var(--cwl-glass-border);
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.cwl-related-card:hover,
.cwl-related-card:focus-visible {
	transform: translateY(-4px);
	border-color: var(--cwl-primary);
	box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
}

.cwl-related-thumb {
	position: relative;
	width: 100%;
	aspect-ratio: 3 / 4;
	background: var(--cwl-input-bg);
	overflow: hidden;
}
.cwl-related-img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.35s ease;
}
.cwl-related-card:hover .cwl-related-img {
	transform: scale(1.06);
}
.cwl-related-thumb-placeholder {
	position: absolute;
	inset: 0;
	background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(34, 211, 238, 0.14));
}

.cwl-related-badge {
	position: absolute;
	top: 0.6rem;
	left: 0.6rem;
	z-index: 1;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.01em;
	padding: 0.25rem 0.6rem;
	border-radius: 999px;
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}

.cwl-related-overlay {
	position: absolute;
	inset: auto 0 0 0;
	padding: 1.75rem 0.75rem 0.65rem;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0));
}
.cwl-related-title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	color: #fff;
	font-size: 0.88rem;
	font-weight: 600;
	line-height: 1.35;
}

@media (max-width: 640px) {
	.cwl-related-section {
		margin-top: 2.25rem;
	}
	.cwl-related-heading {
		font-size: 1.15rem;
		padding: 0 0.1rem;
	}
	.cwl-related-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 0.75rem;
	}
	.cwl-related-title {
		font-size: 0.8rem;
	}
	.cwl-related-badge {
		font-size: 0.62rem;
		padding: 0.2rem 0.5rem;
	}
}

@media (max-width: 380px) {
	.cwl-related-grid {
		grid-template-columns: 1fr 1fr;
		gap: 0.6rem;
	}
}

.cwl-engage-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	background: var(--cwl-input-bg);
	border: 1px solid var(--cwl-input-border);
	border-radius: 999px;
	padding: 0.5rem 1rem;
	cursor: pointer;
	color: var(--cwl-text);
	font-weight: 600;
	font-size: 0.88rem;
	transition: transform 0.12s ease, background 0.2s ease, color 0.2s ease;
}
.cwl-engage-btn.cwl-engage-active {
	background: linear-gradient(135deg, var(--cwl-primary), var(--cwl-accent));
	color: #fff;
	border-color: transparent;
}

.cwl-icon {
	width: 18px;
	height: 18px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	position: relative;
}
.cwl-icon svg {
	display: block;
}
.cwl-icon-heart svg {
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
	transition: fill 0.15s ease, stroke 0.15s ease, transform 0.15s ease;
}
.cwl-engage-btn.cwl-like-btn.cwl-engage-active .cwl-icon-heart svg {
	fill: #ff4d6d;
	stroke: #ff4d6d;
	transform: scale(1.08);
}
.cwl-icon-star::before {
	content: "\2605";
	font-size: 16px;
	line-height: 1;
}
.cwl-icon-share svg {
	color: currentColor;
}

.cwl-share-wrapper {
	position: relative;
	margin-left: auto;
}
/* Each .cwl-glass card creates its own stacking context (backdrop-filter),
   so a z-index set only on the menu can't out-rank the NEXT card's
   context, which paints later in DOM order regardless of the menu's own
   z-index -- that's what made the menu appear "under" the prompt card.
   Bumping the whole engagement card's stacking context above its
   siblings (via .cwl-share-open on the card) fixes it at the source. */
.cwl-prompt-card.cwl-share-open {
	position: relative;
	z-index: 30;
}
.cwl-share-menu {
	/* Deliberately NOT translucent like the surrounding .cwl-glass cards --
	   a floating popup needs to stay legible over any photo/background
	   behind it, so it gets its own solid, high-contrast surface instead
	   of inheriting the 55%-opacity glass background. */
	position: absolute;
	right: 0;
	top: calc(100% + 8px);
	min-width: 220px;
	padding: 0.5rem;
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	z-index: 30;
	background: var(--cwl-bg-solid);
	border: 1px solid var(--cwl-input-border);
	border-radius: var(--cwl-radius);
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
}
.cwl-share-menu[hidden] {
	display: none;
}
.cwl-share-item {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.6rem 0.75rem;
	border-radius: calc(var(--cwl-radius) * 0.4);
	color: var(--cwl-text);
	text-decoration: none;
	font-size: 0.92rem;
	font-weight: 600;
}
.cwl-share-item-icon {
	flex: none;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #fff;
}
.cwl-share-item-icon svg {
	width: 16px;
	height: 16px;
}
/* Official per-app brand colors so each row reads as that app's real
   share button rather than a generic monochrome line icon. */
.cwl-share-item-twitter .cwl-share-item-icon { background: #000000; }
.cwl-share-item-reddit .cwl-share-item-icon { background: #FF4500; }
.cwl-share-item-facebook .cwl-share-item-icon { background: #1877F2; }
.cwl-share-item-whatsapp .cwl-share-item-icon { background: #25D366; }

.cwl-generate-with-bar {
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
	padding: 1rem 1.1rem;
	margin-bottom: 0;
}
.cwl-generate-with-label {
	font-size: 0.78rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--cwl-text-muted);
}
.cwl-generate-with-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
}
.cwl-generate-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	gap: 0;
	background: var(--cwl-generate-btn-bg, #f4f5f8);
	border: 1.5px solid var(--cwl-generate-btn-border, rgba(15, 23, 42, 0.16));
	border-radius: 999px;
	padding: 0.6rem 1.3rem;
	cursor: pointer;
	color: var(--cwl-generate-btn-color, var(--cwl-text));
	font-weight: 700;
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	text-shadow: none;
	box-shadow: var(--cwl-generate-btn-shadow, 0 1px 3px rgba(15, 23, 42, 0.06));
	transition: transform 0.12s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
/* Star badge -- shown on whichever Generate-With button matches this
   prompt's "Tested On" taxonomy terms (see $cwl_starred_targets in
   templates/single-prompts.php). A small gold badge floating at the
   button's top-right corner, consistent in both light and dark mode. */
.cwl-generate-btn-tested {
	border-color: #f59e0b;
	box-shadow: 0 0 14px rgba(245, 158, 11, 0.35), inset 0 0 10px rgba(245, 158, 11, 0.18);
}
.cwl-generate-star {
	position: absolute;
	top: -9px;
	left: -9px;
	width: 20px;
	height: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	line-height: 1;
	color: #7c4a03;
	background: linear-gradient(135deg, #fef08a, #f59e0b);
	border-radius: 50%;
	box-shadow: 0 2px 8px rgba(245, 158, 11, 0.55), 0 0 0 2px var(--cwl-bg-solid);
	animation: cwlStarPulse 2.4s ease-in-out infinite;
}
@keyframes cwlStarPulse {
	0%, 100% { box-shadow: 0 2px 8px rgba(245, 158, 11, 0.55), 0 0 0 2px var(--cwl-bg-solid); }
	50% { box-shadow: 0 2px 14px rgba(245, 158, 11, 0.85), 0 0 0 2px var(--cwl-bg-solid); }
}
/* Light mode (default): solid tinted background per platform (generic
   accent colors, not brand logos) with a darker, higher-contrast label
   so each pill stays clearly legible on a white/light card -- rather
   than the washed-out look of a dark translucent pill on a light page. */
.cwl-generate-btn-chatgpt {
	--cwl-generate-btn-bg: #e2faf1;
	--cwl-generate-btn-border: #3ddcac;
	--cwl-generate-btn-color: #0d8f6f;
}
.cwl-generate-btn-gemini {
	--cwl-generate-btn-bg: #f1edff;
	--cwl-generate-btn-border: #b3a0ff;
	--cwl-generate-btn-color: #6c47e0;
}
.cwl-generate-btn-meta {
	--cwl-generate-btn-bg: #e9f2ff;
	--cwl-generate-btn-border: #6ea1ff;
	--cwl-generate-btn-color: #2f6fe0;
}
.cwl-generate-btn-ideogram {
	--cwl-generate-btn-bg: #fff1e1;
	--cwl-generate-btn-border: #ffa85c;
	--cwl-generate-btn-color: #c2650f;
}

/* Dark mode: restore the original glowing pill style -- dark translucent
   background with a soft colored border + text glow per platform. */
body.color-switch-dark .cwl-generate-btn {
	--cwl-generate-btn-bg: rgba(15, 23, 42, 0.55);
	--cwl-generate-btn-border: rgba(255, 255, 255, 0.18);
	--cwl-generate-btn-shadow: 0 0 14px var(--cwl-generate-btn-glow, transparent), inset 0 0 10px var(--cwl-generate-btn-glow, transparent);
	text-shadow: 0 0 10px var(--cwl-generate-btn-glow, transparent);
}
body.color-switch-dark .cwl-generate-btn-chatgpt {
	--cwl-generate-btn-border: rgba(61, 220, 172, 0.55);
	--cwl-generate-btn-color: #3ddcac;
	--cwl-generate-btn-glow: rgba(61, 220, 172, 0.45);
}
body.color-switch-dark .cwl-generate-btn-gemini {
	--cwl-generate-btn-border: rgba(179, 160, 255, 0.55);
	--cwl-generate-btn-color: #b3a0ff;
	--cwl-generate-btn-glow: rgba(179, 160, 255, 0.45);
}
body.color-switch-dark .cwl-generate-btn-meta {
	--cwl-generate-btn-border: rgba(110, 161, 255, 0.55);
	--cwl-generate-btn-color: #6ea1ff;
	--cwl-generate-btn-glow: rgba(110, 161, 255, 0.45);
}
body.color-switch-dark .cwl-generate-btn-ideogram {
	--cwl-generate-btn-border: rgba(255, 168, 92, 0.55);
	--cwl-generate-btn-color: #ffa85c;
	--cwl-generate-btn-glow: rgba(255, 168, 92, 0.45);
}
.cwl-generate-btn[data-copied="1"] {
	background: rgba(22, 163, 74, 0.85);
	color: #fff;
	border-color: transparent;
	text-shadow: none;
	box-shadow: 0 0 14px rgba(22, 163, 74, 0.5);
}
.cwl-generate-with-note {
	font-size: 0.78rem;
	color: var(--cwl-text-muted);
	margin: 0;
	line-height: 1.5;
}

.cwl-prompt-thumb {
	margin-bottom: 1.5rem;
	text-align: center;
}
.cwl-prompt-thumb img {
	width: 100%;
	max-width: 100%;
	border-radius: var(--cwl-radius);
	display: inline-block;
}
@media (min-width: 641px) {
	.cwl-prompt-thumb img {
		max-width: 420px;
	}
}

.cwl-prompt-container {
	padding: 1.5rem;
	margin-bottom: 1.5rem;
}
.cwl-prompt-container-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 0.75rem;
}
.cwl-prompt-container-label {
	font-size: 0.78rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--cwl-text-muted);
}
.cwl-copy-btn {
	background: linear-gradient(135deg, var(--cwl-primary), var(--cwl-accent));
	color: #fff;
	border: none;
	border-radius: 999px;
	padding: 0.45rem 1rem;
	font-size: 0.82rem;
	font-weight: 600;
	cursor: pointer;
}
.cwl-copy-btn[data-copied="1"] {
	background: #16a34a;
}
.cwl-prompt-text {
	color: var(--cwl-text);
	line-height: 1.7;
	font-size: 1.02rem;
	white-space: pre-wrap;
}

/* Highlighted "variables" inside the prompt text -- the swappable details
   (subject, age, colors, style, etc.) identified by CWL_AI. A clean
   highlighter-marker look -- solid color behind the text, no border/chip
   elevation -- so it reads as "here's what you can change" at a glance,
   and stays clearly legible on both the light and dark glass surfaces
   via the --cwl-highlight-* tokens. */
.cwl-var-highlight {
	background: var(--cwl-highlight-bg);
	color: var(--cwl-highlight-text);
	border-radius: 3px;
	padding: 0.03em 0.32em;
	margin: 0 0.02em;
	font-weight: 600;
	-webkit-box-decoration-break: clone;
	box-decoration-break: clone;
	cursor: default;
	transition: background 0.15s ease;
}
.cwl-var-highlight:hover {
	background: var(--cwl-highlight-bg-hover);
}

/* "Pro tip" note under the prompt text, shown only when at least one
   variable was highlighted -- explains what the highlight means, with a
   tiny swatch of the highlight style itself inline so it's immediately
   self-evident rather than needing to be taken on faith. */
.cwl-prompt-variable-note {
	margin: 1rem 0 0;
	padding-top: 0.9rem;
	border-top: 1px dashed var(--cwl-input-border);
	font-size: 0.82rem;
	color: var(--cwl-text-muted);
	line-height: 1.5;
}

.cwl-tested-on {
	padding: 1.5rem 1.75rem;
	margin-bottom: 0;
}
.cwl-tested-on .cwl-fieldset-label {
	margin-bottom: 0.75rem;
}

/* Combined "Tested On" + "Style" card -- two columns in one box,
   separated by a thick divider, per updated design reference. */
.cwl-tested-on-style {
	display: flex;
	align-items: stretch;
	padding: 0;
	margin-bottom: 0;
	overflow: hidden;
}
.cwl-tested-on-style-col {
	flex: 1 1 50%;
	min-width: 0;
	padding: 1.5rem 1.75rem;
}
.cwl-tested-on-style-col + .cwl-tested-on-style-col {
	border-left: 2px solid var(--cwl-glass-border);
}
.cwl-tested-on-style-col .cwl-fieldset-label {
	margin-bottom: 0.75rem;
}
.cwl-badge-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}
.cwl-model-badge {
	background: var(--cwl-input-bg);
	border: 1px solid var(--cwl-input-border);
	border-radius: 999px;
	padding: 0.35rem 0.9rem;
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--cwl-text);
	text-decoration: none;
	display: inline-block;
	transition: border-color 0.15s ease, color 0.15s ease;
}

.cwl-faq-heading {
	font-size: 1.3rem;
	margin-bottom: 0.75rem;
}
.cwl-accordion-item {
	border-bottom: 1px solid var(--cwl-glass-border);
}
.cwl-accordion-trigger {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: none;
	border: none;
	padding: 1rem 0;
	color: var(--cwl-text);
	font-weight: 600;
	font-size: 0.98rem;
	cursor: pointer;
	text-align: left;
}
.cwl-accordion-icon {
	width: 10px;
	height: 10px;
	border-right: 2px solid var(--cwl-text-muted);
	border-bottom: 2px solid var(--cwl-text-muted);
	transform: rotate(45deg);
	transition: transform 0.2s ease;
	flex-shrink: 0;
	margin-left: 1rem;
}
.cwl-accordion-item.cwl-accordion-open .cwl-accordion-icon {
	transform: rotate(-135deg);
}
.cwl-accordion-panel {
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.25s ease;
}
.cwl-accordion-panel p {
	color: var(--cwl-text-muted);
	line-height: 1.6;
	padding-bottom: 1rem;
	margin: 0;
}

@media (max-width: 640px) {
	.cwl-dashboard {
		padding: 1.1rem 0.85rem;
		margin: 1rem auto;
		border-radius: calc(var(--cwl-radius) * 0.6);
	}
	.cwl-dashboard-header {
		flex-direction: column;
		text-align: center;
		gap: 0.6rem;
		margin-bottom: 1.25rem;
		padding-bottom: 1.1rem;
	}
	.cwl-avatar img {
		width: 56px;
		height: 56px;
	}
	.cwl-dashboard-greeting {
		font-size: 1.15rem;
	}
	.cwl-dashboard-email,
	.cwl-dashboard-username {
		font-size: 0.78rem;
	}
	.cwl-tab-list {
		overflow-x: auto;
		flex-wrap: nowrap;
		gap: 0.15rem;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
	}
	.cwl-tab-list::-webkit-scrollbar {
		display: none;
	}
	.cwl-tab-btn {
		padding: 0.55rem 0.65rem;
		font-size: 0.8rem;
	}
	.cwl-profile-grid {
		grid-template-columns: 1fr;
		gap: 0.9rem;
	}
	.cwl-field-label {
		font-size: 0.68rem;
	}
	.cwl-field-value {
		font-size: 0.92rem;
	}
	.cwl-engagement-bar {
		justify-content: space-between;
		gap: 0.5rem;
		padding: 0.65rem;
	}
	.cwl-engage-btn {
		flex: 1 1 0;
		justify-content: center;
		padding: 0.55rem 0.4rem;
		gap: 0.35rem;
		font-size: 0.82rem;
	}
	.cwl-share-wrapper {
		margin-left: 0;
		flex: 1 1 0;
		display: flex;
	}
	.cwl-share-wrapper .cwl-engage-btn {
		width: 100%;
	}
	.cwl-share-menu {
		left: 50%;
		right: auto;
		transform: translateX(-50%);
		min-width: 180px;
		max-width: calc(100vw - 2rem);
	}
	.cwl-generate-with-bar {
		padding: 0.85rem;
	}
	.cwl-generate-btn {
		flex: 1 1 calc(50% - 0.3rem);
		justify-content: center;
		font-size: 0.8rem;
		padding: 0.55rem 0.75rem;
	}
	.cwl-subtab-list {
		flex-direction: row;
		flex-wrap: nowrap;
		width: 100%;
		flex-basis: auto;
		overflow-x: visible;
		border-right: none;
		border-bottom: 1px solid var(--cwl-glass-border);
		padding-right: 0;
		padding-bottom: 0.5rem;
		gap: 0.25rem;
	}
	.cwl-subtabs {
		flex-direction: column;
	}
	.cwl-subtab-btn {
		flex: 1 1 0;
		border-left: none;
		border-bottom: 2px solid transparent;
		text-align: center;
		white-space: nowrap;
		padding: 0.65rem 0.4rem;
		font-size: 0.85rem;
	}
	.cwl-subtab-btn-active {
		border-left-color: transparent;
		border-bottom-color: var(--cwl-primary);
	}

	/* Combined tested-on/style card stacks with a horizontal divider
	   instead of a vertical one on narrow screens. */
	.cwl-tested-on-style {
		flex-direction: column;
	}
	.cwl-tested-on-style-col {
		padding: 1.1rem 1.1rem;
	}
	.cwl-tested-on-style-col + .cwl-tested-on-style-col {
		border-left: none;
		border-top: 2px solid var(--cwl-glass-border);
	}
}


/* ================================================================== *
 * iPrompts AI Tab — styles
 * ================================================================== */

/* AI tab button highlight */
.cwl-tab-btn-ai {
	background: linear-gradient(135deg, rgba(99,102,241,0.18), rgba(34,211,238,0.12));
	border: 1px solid rgba(99,102,241,0.3);
}

/* Main AI layout: sidebar + panel */
.cwl-ai-layout {
	display: flex;
	gap: 0;
	min-height: 480px;
	border-radius: calc(var(--cwl-radius) * 0.75);
	overflow: hidden;
	border: 1px solid var(--cwl-glass-border);
}

/* Sidebar */
.cwl-ai-sidebar {
	width: 176px;
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	background: rgba(99,102,241,0.06);
	border-right: 1px solid var(--cwl-glass-border);
	padding: 1.2rem 0 1rem;
}
body.color-switch-dark .cwl-ai-sidebar {
	background: rgba(99,102,241,0.1);
}
.cwl-ai-sidebar-header {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0 1rem 1rem;
	border-bottom: 1px solid var(--cwl-glass-border);
	margin-bottom: 0.65rem;
	color: var(--cwl-primary);
	font-weight: 700;
	font-size: 0.88rem;
	letter-spacing: 0.01em;
}
.cwl-ai-nav {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	padding: 0 0.65rem;
	flex: 1;
}
.cwl-ai-nav-btn {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	padding: 0.65rem 0.85rem;
	border: none;
	background: transparent;
	color: var(--cwl-text-muted);
	font-size: 0.875rem;
	font-weight: 500;
	cursor: pointer;
	border-radius: calc(var(--cwl-radius) * 0.5);
	text-align: left;
	transition: background 0.18s ease, color 0.18s ease;
	width: 100%;
}
.cwl-ai-nav-btn-active {
	background: rgba(99,102,241,0.18);
	color: var(--cwl-primary);
	font-weight: 600;
}
body.color-switch-dark .cwl-ai-nav-btn-active {
	background: rgba(99,102,241,0.22);
}
.cwl-ai-sidebar-badge {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.75rem 1rem 0;
	font-size: 0.72rem;
	color: var(--cwl-text-muted);
	border-top: 1px solid var(--cwl-glass-border);
	margin-top: 0.65rem;
}
.cwl-ai-badge-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #22c55e;
	flex-shrink: 0;
	animation: cwlAiBadgePulse 2.5s infinite;
}
@keyframes cwlAiBadgePulse {
	0%, 100% { opacity: 1; }
	50%       { opacity: 0.4; }
}

/* Panel area */
.cwl-ai-panel {
	flex: 1;
	min-width: 0;
	padding: 1.6rem 1.75rem;
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
	overflow-y: auto;
}
.cwl-ai-panel[hidden] {
	display: none;
}
.cwl-ai-panel-header {
	border-bottom: 1px solid var(--cwl-glass-border);
	padding-bottom: 1rem;
}
.cwl-ai-panel-title {
	font-size: 1.15rem;
	font-weight: 700;
	color: var(--cwl-text);
	margin: 0 0 0.3rem;
}
.cwl-ai-panel-desc {
	font-size: 0.86rem;
	color: var(--cwl-text-muted);
	margin: 0;
	line-height: 1.5;
}

/* ---- Standalone AI pages ([cwl_ai_image_to_prompt] / [cwl_ai_chat]) ---- */
.cwl-ai-page-back {
	margin-bottom: 1.5rem;
	padding: 0.55rem 1.1rem;
	font-size: 0.85rem;
}
.cwl-ai-layout-chat .cwl-ai-chat-messages {
	max-height: 520px;
}

/* ---- Image-to-Prompt Upload Area ---- */
.cwl-ai-upload-area {
	position: relative;
	border: 2px dashed var(--cwl-glass-border);
	border-radius: calc(var(--cwl-radius) * 0.65);
	background: rgba(99,102,241,0.04);
	min-height: 180px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: border-color 0.2s ease, background 0.2s ease;
	overflow: hidden;
}
.cwl-ai-file-input {
	position: absolute;
	inset: 0;
	opacity: 0;
	cursor: pointer;
	width: 100%;
	height: 100%;
	z-index: 2;
}
.cwl-ai-upload-placeholder {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
	pointer-events: none;
	padding: 1.5rem;
	text-align: center;
}
.cwl-ai-upload-icon {
	color: var(--cwl-primary);
	opacity: 0.7;
}
.cwl-ai-upload-text {
	font-size: 0.92rem;
	color: var(--cwl-text);
	font-weight: 500;
	margin: 0;
}
.cwl-ai-upload-hint {
	font-size: 0.78rem;
	color: var(--cwl-text-muted);
	margin: 0;
}
.cwl-ai-upload-preview-wrap {
	position: relative;
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0.75rem;
}
.cwl-ai-upload-preview-img {
	max-height: 240px;
	max-width: 100%;
	border-radius: calc(var(--cwl-radius) * 0.5);
	object-fit: contain;
	display: block;
	box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.cwl-ai-upload-remove {
	position: absolute;
	top: 0.5rem;
	right: 0.5rem;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	border: none;
	background: rgba(239,68,68,0.85);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 3;
	transition: background 0.15s;
}

/* Generate button row */
.cwl-ai-i2p-actions {
	display: flex;
	align-items: center;
	gap: 1rem;
}
.cwl-ai-generate-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.65rem 1.4rem;
}
.cwl-ai-generate-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

/* Result box */
.cwl-ai-result-wrap {
	border: 1px solid var(--cwl-glass-border);
	border-radius: calc(var(--cwl-radius) * 0.6);
	background: rgba(99,102,241,0.04);
	overflow: hidden;
}
.cwl-ai-result-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.75rem 1rem;
	background: rgba(99,102,241,0.08);
	border-bottom: 1px solid var(--cwl-glass-border);
}
.cwl-ai-result-title {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.88rem;
	font-weight: 600;
	color: var(--cwl-text);
	margin: 0;
}
.cwl-ai-copy-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.35rem 0.8rem;
	border: 1px solid var(--cwl-primary);
	border-radius: 999px;
	background: transparent;
	color: var(--cwl-primary);
	font-size: 0.78rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}
.cwl-ai-result-body {
	padding: 1rem;
}
.cwl-ai-result-text {
	font-size: 0.9rem;
	color: var(--cwl-text);
	line-height: 1.7;
	margin: 0;
	white-space: pre-wrap;
	word-break: break-word;
}

/* Alert in AI panels */
.cwl-ai-alert {
	padding: 0.75rem 1rem;
	border-radius: calc(var(--cwl-radius) * 0.5);
	font-size: 0.875rem;
	line-height: 1.5;
	border: 1px solid transparent;
}
.cwl-ai-alert-error {
	background: rgba(239,68,68,0.1);
	border-color: rgba(239,68,68,0.3);
	color: #ef4444;
}
.cwl-ai-alert-success {
	background: rgba(34,197,94,0.1);
	border-color: rgba(34,197,94,0.3);
	color: #16a34a;
}
.cwl-ai-alert-info {
	background: rgba(99,102,241,0.1);
	border-color: rgba(99,102,241,0.25);
	color: var(--cwl-primary);
}
body.color-switch-dark .cwl-ai-alert-error { color: #fca5a5; }
body.color-switch-dark .cwl-ai-alert-success { color: #86efac; }

/* ---- AI Chat ---- */
.cwl-ai-chat-messages {
	flex: 1;
	min-height: 260px;
	max-height: 400px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 1rem;
	padding: 0.25rem 0.1rem 0.5rem;
	scroll-behavior: smooth;
}
.cwl-ai-chat-messages::-webkit-scrollbar {
	width: 4px;
}
.cwl-ai-chat-messages::-webkit-scrollbar-track {
	background: transparent;
}
.cwl-ai-chat-messages::-webkit-scrollbar-thumb {
	background: var(--cwl-glass-border);
	border-radius: 4px;
}
.cwl-chat-msg {
	display: flex;
	gap: 0.6rem;
	align-items: flex-start;
	animation: cwlChatFadeIn 0.22s ease forwards;
}
@keyframes cwlChatFadeIn {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: translateY(0); }
}
.cwl-chat-msg-user {
	flex-direction: row-reverse;
}
.cwl-chat-avatar {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: rgba(99,102,241,0.18);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	color: var(--cwl-primary);
}
.cwl-chat-msg-user .cwl-chat-avatar {
	background: rgba(34,211,238,0.18);
	color: var(--cwl-accent);
}
.cwl-chat-bubble {
	max-width: 78%;
	padding: 0.65rem 0.9rem;
	border-radius: var(--cwl-radius);
	background: rgba(99,102,241,0.1);
	border: 1px solid rgba(99,102,241,0.15);
	font-size: 0.88rem;
	line-height: 1.65;
	color: var(--cwl-text);
	word-break: break-word;
}
.cwl-chat-bubble p,
.cwl-chat-bubble ul,
.cwl-chat-bubble ol {
	margin: 0 0 0.5rem;
}
.cwl-chat-bubble p:last-child,
.cwl-chat-bubble ul:last-child,
.cwl-chat-bubble ol:last-child {
	margin-bottom: 0;
}
.cwl-chat-bubble ul,
.cwl-chat-bubble ol {
	padding-left: 1.25rem;
}
.cwl-chat-msg-user .cwl-chat-bubble {
	background: var(--cwl-primary);
	border-color: var(--cwl-primary);
	color: #fff;
}
.cwl-chat-bubble-thinking {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 0.7rem 1rem;
}
.cwl-chat-bubble-thinking span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--cwl-primary);
	opacity: 0.5;
	animation: cwlThinkDot 1.2s infinite ease-in-out;
}
.cwl-chat-bubble-thinking span:nth-child(1) { animation-delay: 0s; }
.cwl-chat-bubble-thinking span:nth-child(2) { animation-delay: 0.18s; }
.cwl-chat-bubble-thinking span:nth-child(3) { animation-delay: 0.36s; }
@keyframes cwlThinkDot {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
	30%            { transform: translateY(-6px); opacity: 1; }
}
.cwl-ai-chat-input-wrap {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	border-top: 1px solid var(--cwl-glass-border);
	padding-top: 1rem;
}
.cwl-ai-chat-input-row {
	display: flex;
	gap: 0.6rem;
	align-items: flex-end;
}
.cwl-ai-chat-textarea {
	flex: 1;
	resize: none;
	padding: 0.7rem 0.9rem;
	background: var(--cwl-input-bg);
	border: 1px solid var(--cwl-input-border);
	border-radius: calc(var(--cwl-radius) * 0.65);
	color: var(--cwl-text);
	font-size: 0.9rem;
	line-height: 1.55;
	font-family: inherit;
	min-height: 44px;
	max-height: 150px;
	overflow-y: auto;
	transition: border-color 0.15s ease;
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
}
.cwl-ai-chat-textarea::placeholder {
	color: var(--cwl-text-muted);
}
.cwl-ai-chat-textarea:focus {
	outline: none;
	border-color: var(--cwl-primary);
	box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.cwl-ai-chat-send-btn {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	border: none;
	background: var(--cwl-primary);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	flex-shrink: 0;
	transition: background 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}
.cwl-ai-chat-send-btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
	transform: none;
}
.cwl-ai-chat-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
}
.cwl-ai-chat-hint {
	font-size: 0.72rem;
	color: var(--cwl-text-muted);
}
.cwl-ai-chat-clear {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	border: none;
	background: transparent;
	color: var(--cwl-text-muted);
	font-size: 0.75rem;
	cursor: pointer;
	padding: 0.2rem 0.4rem;
	border-radius: 4px;
	transition: color 0.15s, background 0.15s;
}
.cwl-ai-chat-clear-label {
	white-space: nowrap;
}

/* Tab panel for AI needs no extra padding */
.cwl-tab-panel-ai {
	padding: 0;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
	.cwl-ai-layout {
		flex-direction: column;
		min-height: auto;
	}
	.cwl-ai-sidebar {
		width: 100%;
		border-right: none;
		border-bottom: 1px solid var(--cwl-glass-border);
		padding: 0.75rem 0 0;
		flex-direction: column;
	}
	.cwl-ai-sidebar-header {
		padding: 0 1rem 0.65rem;
	}
	.cwl-ai-nav {
		flex-direction: row;
		flex-wrap: nowrap;
		overflow-x: visible;
		padding: 0 0.65rem 0.65rem;
		gap: 0.4rem;
	}
	.cwl-ai-nav-btn {
		white-space: nowrap;
		flex: 1 1 0;
		flex-shrink: 1;
		justify-content: center;
		padding: 0.6rem 0.5rem;
		font-size: 0.82rem;
	}
	.cwl-ai-sidebar-badge {
		display: none;
	}
	.cwl-ai-panel {
		padding: 1.1rem;
	}
	.cwl-chat-bubble {
		max-width: 88%;
	}
	.cwl-ai-chat-messages {
		max-height: 300px;
	}

	/* Chat input row: bigger, non-clipping textarea + evenly aligned
	   round send button, so nothing overflows on small screens. */
	.cwl-ai-chat-input-row {
		gap: 0.5rem;
		align-items: flex-end;
	}
	.cwl-ai-chat-textarea {
		min-height: 48px;
		max-height: 40vh;
		padding: 0.65rem 0.8rem;
		font-size: 0.85rem;
		line-height: 1.5;
	}
	.cwl-ai-chat-textarea::placeholder {
		font-size: 0.8rem;
	}
	.cwl-ai-chat-send-btn {
		width: 44px;
		height: 44px;
	}

	/* "Clear" button collapses to an icon-only tap target on mobile so its
	   label never wraps awkwardly under the dustbin icon. */
	.cwl-ai-chat-clear {
		width: 32px;
		height: 32px;
		justify-content: center;
		padding: 0;
		border-radius: 50%;
		background: rgba(239,68,68,0.08);
		flex-shrink: 0;
	}
	.cwl-ai-chat-clear svg {
		width: 15px;
		height: 15px;
	}
	.cwl-ai-chat-clear-label {
		display: none;
	}
	.cwl-ai-chat-footer {
		align-items: center;
	}
}


/* ------------------------------------------------------------------ *
 * Persistent state rules
 * ------------------------------------------------------------------ *
 * These selectors were previously grouped together with a :hover
 * selector in the same rule. They represent a state that must stay
 * applied regardless of pointer type (active tab, drag-over, copied
 * confirmation, keyboard focus) so they are NOT gated behind the
 * hover-only media query below -- only the ":hover" part of each
 * original rule moved there.
 * ------------------------------------------------------------------ */

.cwl-dashboard-username-link:focus-visible {
	color: var(--cwl-primary);
	text-decoration: underline;
}
.cwl-tab-btn-active {
	color: var(--cwl-primary);
}
.cwl-subtab-btn-active {
	color: var(--cwl-primary);
	background: var(--cwl-input-bg);
}
.cwl-tab-btn-ai.cwl-tab-btn-active {
	background: linear-gradient(135deg, rgba(99,102,241,0.35), rgba(34,211,238,0.2));
}
.cwl-ai-upload-area.cwl-drag-over {
	border-color: var(--cwl-primary);
	background: rgba(99,102,241,0.09);
}
.cwl-ai-copy-btn[data-copied="1"] {
	background: var(--cwl-primary);
	color: #fff;
}

/* ------------------------------------------------------------------ *
 * Tap/press feedback (all pointer types, including touch)
 * ------------------------------------------------------------------ *
 * :active only applies while the pointer/finger is actually down and
 * clears the instant it is released, so it gives immediate feedback on
 * tap without ever getting "stuck" the way a simulated :hover does.
 * ------------------------------------------------------------------ */

.cwl-tab-btn:active,
.cwl-subtab-btn:active,
.cwl-tab-btn-ai:active,
.cwl-ai-nav-btn:active,
.cwl-engage-btn:active,
.cwl-share-item:active,
.cwl-model-badge:active,
.cwl-generate-btn:active,
.cwl-ai-copy-btn:active,
.cwl-ai-upload-remove:active,
.cwl-ai-chat-send-btn:active,
.cwl-ai-chat-clear:active {
	opacity: 0.75;
}
.cwl-prompt-card:active {
	box-shadow: 0 12px 36px rgba(31, 38, 135, 0.16);
}

/* ------------------------------------------------------------------ *
 * Hover-only interactions
 * ------------------------------------------------------------------ *
 * Gated behind (hover: hover) and (pointer: fine) so touch devices
 * (which fake a :hover state on tap and only clear it on the NEXT tap
 * elsewhere) never get stuck showing a hover color after a real click.
 * Touch/tap feedback is handled separately by the :active rules
 * further up in this file (e.g. .cwl-btn:active), which respond to
 * the actual press-and-release and release cleanly.
 * ------------------------------------------------------------------ */

@media (hover: hover) and (pointer: fine) {
	.cwl-upload-wrapper:hover {
		border-color: var(--cwl-primary);
	}
	.cwl-btn-primary:hover {
		box-shadow: 0 8px 26px rgba(99, 102, 241, 0.45);
	}
	.cwl-dashboard-username-link:hover {
		color: var(--cwl-primary);
		text-decoration: underline;
	}
	.cwl-tab-btn:hover {
		color: var(--cwl-primary);
	}
	.cwl-subtab-btn:hover {
		color: var(--cwl-primary);
		background: var(--cwl-input-bg);
	}
	.cwl-prompt-row-title:hover {
		color: var(--cwl-primary);
	}
	.cwl-prompt-media-frame:hover img {
		transform: scale(1.03);
	}
	.cwl-prompt-card:hover {
		box-shadow: 0 12px 36px rgba(31, 38, 135, 0.16);
	}
	.cwl-prompt-author:hover {
		color: var(--cwl-primary);
		text-decoration: underline;
	}
	.cwl-engage-btn:hover {
		transform: translateY(-1px);
	}
	.cwl-generate-btn:hover {
		transform: translateY(-1px);
		box-shadow: 0 0 20px var(--cwl-generate-btn-glow, rgba(15, 23, 42, 0.1)), inset 0 0 14px var(--cwl-generate-btn-glow, transparent);
		filter: brightness(1.08);
	}
	.cwl-generate-btn[data-copied="1"]:hover {
		filter: none;
	}
	.cwl-share-item:hover {
		background: var(--cwl-input-bg);
	}
	.cwl-model-badge:hover {
		border-color: var(--cwl-primary);
		color: var(--cwl-primary);
	}
	.cwl-tab-btn-ai:hover {
		background: linear-gradient(135deg, rgba(99,102,241,0.35), rgba(34,211,238,0.2));
	}
	.cwl-ai-nav-btn:hover {
		background: rgba(99,102,241,0.12);
		color: var(--cwl-text);
	}
	.cwl-ai-upload-area:hover {
		border-color: var(--cwl-primary);
		background: rgba(99,102,241,0.09);
	}
	.cwl-ai-upload-remove:hover {
		background: #ef4444;
	}
	.cwl-ai-copy-btn:hover {
		background: var(--cwl-primary);
		color: #fff;
	}
	.cwl-ai-chat-send-btn:hover {
		background: var(--cwl-accent);
		transform: scale(1.06);
	}
	.cwl-ai-chat-clear:hover {
		color: #ef4444;
		background: rgba(239,68,68,0.08);
	}
}
