/**
 * TMD Support Chat AI — front-end chat widget styles (floating + inline
 * shortcode variants). Self-contained, no theme dependency.
 *
 * Source of truth for markup: public/class-tmd-wp-ai-public-frontend.php,
 * render_widget_markup() (Stage 6/7 contract — every class/attribute below
 * is copied from that method, nothing invented here).
 * Visual reference: Idee Plan pentru WP/mockups/mockup-widget-A.html
 * (GATE 1B approved, Varianta A "Clarity") — palette reused, markup adapted
 * to the real render_widget_markup() output (mockup classes are NOT 1:1).
 *
 * BEM, all selectors scoped under .tmd-wp-ai-widget — zero bare global
 * class names, zero !important except the single documented
 * prefers-reduced-motion override below.
 *
 * Known gaps (documented, not silently patched — see dispatch report):
 * - .tmd-wp-ai-send (composer send button) has no icon markup server-side;
 *   a CSS-only ::before triangle substitutes for it below (decorative,
 *   aria-label already provides the accessible name).
 * - widget_theme (--theme-*) is wired for the full contract but only ever
 *   applied via an explicit shortcode `theme` attribute
 *   (render_widget_markup()'s $atts['theme']) — enqueue_floating() always
 *   passes '' for it, so the site-wide floating widget never carries a
 *   --theme-* class; only a manual [tmd_wp_ai_chat theme="..."] shortcode
 *   reaches it.
 * - widget_position (--position-*) IS live: render_widget_markup() falls
 *   back to the widget_position Settings_Store value whenever no shortcode
 *   `position` attribute is set, so the floating widget already picks up
 *   these classes site-wide.
 * - branding() (widget_color/shape/size/icon) is applied server-side, not
 *   read by assets/js/frontend.js: widget_color becomes an inline
 *   --tmd-wp-ai-accent override on the root element, widget_shape/
 *   widget_size become the --shape-* and --size-* classes below, and
 *   widget_icon/logo selection happens entirely in PHP (launcher_visual())
 *   — no JS involvement needed for any of the four.
 */

/* ==========================================================================
   Design tokens (scoped — not on :root, so nothing leaks page-wide)
   ========================================================================== */

.tmd-wp-ai-widget {
	--tmd-wp-ai-surface: #ffffff;
	--tmd-wp-ai-surface-2: #fbfcfd;
	--tmd-wp-ai-border: #e2e6ea;
	--tmd-wp-ai-border-strong: #c7ccd3;
	--tmd-wp-ai-text: #1a1f27;
	/* Single secondary-text tier (WCAG AA verified ~5.98:1 on white),
	   deliberately not using the mockup's lighter --text-3 (~2.6:1, fails
	   AA) for any real text use. */
	--tmd-wp-ai-text-muted: #5b6472;
	--tmd-wp-ai-accent: #2563eb;
	--tmd-wp-ai-accent-600: #1d4ed8;
	--tmd-wp-ai-accent-50: #eff4ff;
	--tmd-wp-ai-accent-100: #dbe6fe;
	--tmd-wp-ai-red: #dc2626;
	--tmd-wp-ai-red-50: #fef2f2;
	--tmd-wp-ai-radius: 10px;
	--tmd-wp-ai-radius-lg: 18px;
	--tmd-wp-ai-shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
	--tmd-wp-ai-shadow-lg: 0 20px 48px rgba(15, 23, 42, .16), 0 8px 16px rgba(15, 23, 42, .08);
	--tmd-wp-ai-font: system-ui, -apple-system, "Segoe UI", Roboto, Oxygen, sans-serif;
	--tmd-wp-ai-z: 999990;

	font-family: var(--tmd-wp-ai-font);
	color: var(--tmd-wp-ai-text);
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

.tmd-wp-ai-widget,
.tmd-wp-ai-widget *,
.tmd-wp-ai-widget *::before,
.tmd-wp-ai-widget *::after {
	box-sizing: border-box;
}

.tmd-wp-ai-widget button,
.tmd-wp-ai-widget input,
.tmd-wp-ai-widget textarea {
	font-family: inherit;
	font-size: inherit;
	color: inherit;
}

.tmd-wp-ai-widget a {
	color: inherit;
}

/* Server-rendered skeleton, hidden by default (ARCHITECTURE.md §7.5 [L7.2]).
   Compound selectors (class + [hidden]) beat any plain class rule below on
   specificity alone, so no !important is needed here. */
.tmd-wp-ai-widget[hidden],
.tmd-wp-ai-window[hidden],
.tmd-wp-ai-gate__error[hidden] {
	display: none;
}

/* ==========================================================================
   Root + launcher (floating variant)
   ========================================================================== */

.tmd-wp-ai-widget--inline {
	display: block;
	width: 100%;
}

.tmd-wp-ai-launcher {
	position: fixed;
	right: 16px;
	bottom: 16px;
	z-index: var(--tmd-wp-ai-z);
	width: 56px;
	height: 56px;
	border: none;
	border-radius: 50%;
	background: var(--tmd-wp-ai-accent);
	color: #fff;
	display: grid;
	place-items: center;
	box-shadow: var(--tmd-wp-ai-shadow-lg);
	cursor: pointer;
	transition: background-color .15s ease;
}

.tmd-wp-ai-launcher:hover {
	background: var(--tmd-wp-ai-accent-600);
}

.tmd-wp-ai-launcher svg {
	width: 24px;
	height: 24px;
}

/* ==========================================================================
   Shape modifier (GATE 1B customization — launcher only; see VALIDATION.md
   Stage 11 C1. Chat window keeps its own fixed radius regardless of shape —
   window roundedness is a readability decision, not part of the branding
   "shape" toggle, so no window-side rule is added here (would have no
   visual rationale tied to the setting).
   ========================================================================== */

.tmd-wp-ai-widget--shape-square .tmd-wp-ai-launcher {
	border-radius: 12px;
}

/* --shape-pill: the launcher is a fixed square button (width === height at
   every breakpoint, see .tmd-wp-ai-launcher / @media rules below) — on a
   square box, border-radius: 999px clamps to the same half-side-length
   circle as the default 50%, so pill renders identical to circle here. Not
   an oversight: this only diverges once/if the launcher becomes non-square.
   Rule kept for contract completeness (class is real, applied by PHP). */
.tmd-wp-ai-widget--shape-pill .tmd-wp-ai-launcher {
	border-radius: 999px;
}

/* ==========================================================================
   Size modifier (GATE 6 fix — widget_size setting had no CSS effect; see
   DECISION_LOG_v1.md Entry 045. "medium" is the unmodified default above,
   no class/rule needed for it.
   Specificity note: this compound selector is (0,2,0), higher than the
   plain .tmd-wp-ai-launcher width/height rules inside the @media breakpoints
   below (0,1,0) — so a single declaration here wins at every breakpoint
   without needing duplicate rules inside those media queries.
   ========================================================================== */

.tmd-wp-ai-widget--size-small .tmd-wp-ai-launcher {
	width: 44px;
	height: 44px;
}

.tmd-wp-ai-widget--size-small .tmd-wp-ai-launcher svg {
	width: 20px;
	height: 20px;
}

.tmd-wp-ai-widget--size-large .tmd-wp-ai-launcher {
	width: 68px;
	height: 68px;
}

.tmd-wp-ai-widget--size-large .tmd-wp-ai-launcher svg {
	width: 28px;
	height: 28px;
}

/* Best-effort cosmetic fix for a gap: frontend.js never hides the launcher
   while the window is open (mockup does, via a body class this widget has
   no equivalent of). Progressive enhancement only — degrades harmlessly
   where :has() is unsupported, the window's higher z-index still visually
   covers the launcher at that corner. */
.tmd-wp-ai-widget--floating:has(.tmd-wp-ai-window:not([hidden])) .tmd-wp-ai-launcher {
	display: none;
}

/* ==========================================================================
   Window (shared shell — floating + inline)
   ========================================================================== */

.tmd-wp-ai-window {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--tmd-wp-ai-surface);
	border: 1px solid var(--tmd-wp-ai-border);
}

.tmd-wp-ai-widget--floating .tmd-wp-ai-window {
	position: fixed;
	z-index: calc(var(--tmd-wp-ai-z) + 1);
	inset: 0;
	width: 100vw;
	height: 100vh;
	height: 100dvh;
	border-radius: 0;
	border: none;
	box-shadow: var(--tmd-wp-ai-shadow-lg);
}

.tmd-wp-ai-widget--inline .tmd-wp-ai-window {
	position: static;
	width: 100%;
	max-width: 640px;
	height: 480px;
	max-height: 70vh;
	border-radius: var(--tmd-wp-ai-radius-lg);
	box-shadow: var(--tmd-wp-ai-shadow-sm);
}

/* ==========================================================================
   Head
   ========================================================================== */

.tmd-wp-ai-head {
	flex: none;
	background: var(--tmd-wp-ai-accent);
	color: #fff;
	padding: 16px 18px;
	display: flex;
	align-items: center;
	gap: 12px;
}

.tmd-wp-ai-head__avatar {
	flex: none;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .18);
	border: 2px solid rgba(255, 255, 255, .35);
	display: grid;
	place-items: center;
}

.tmd-wp-ai-head__avatar svg {
	width: 20px;
	height: 20px;
}

/* Logo (GATE 1B customization — replaces the default SVG icon with an
   uploaded <img> in the launcher and head avatar; sized 1:1 with the SVG
   it replaces in each of those two locations). */
.tmd-wp-ai-logo {
	display: block;
	object-fit: contain;
	border-radius: 50%;
}

.tmd-wp-ai-launcher .tmd-wp-ai-logo {
	width: 24px;
	height: 24px;
}

.tmd-wp-ai-head__avatar .tmd-wp-ai-logo {
	width: 20px;
	height: 20px;
}

.tmd-wp-ai-head__who {
	flex: 1;
	min-width: 0;
}

.tmd-wp-ai-head__name {
	font-weight: 700;
	font-size: 15px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tmd-wp-ai-head__close {
	flex: none;
	background: rgba(255, 255, 255, .15);
	border: none;
	color: #fff;
	width: 32px;
	height: 32px;
	border-radius: 9px;
	display: grid;
	place-items: center;
	cursor: pointer;
	font-size: 20px;
	line-height: 1;
	transition: background-color .15s ease;
}

.tmd-wp-ai-head__close:hover {
	background: rgba(255, 255, 255, .28);
}

/* ==========================================================================
   Pre-chat gate — visible only while data-tmd-wp-ai-state="gate"
   ========================================================================== */

.tmd-wp-ai-gate {
	display: none;
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	padding: 24px 20px;
	flex-direction: column;
	gap: 14px;
}

.tmd-wp-ai-window[data-tmd-wp-ai-state="gate"] .tmd-wp-ai-gate {
	display: flex;
}

.tmd-wp-ai-gate__intro {
	text-align: center;
	font-size: 13px;
	color: var(--tmd-wp-ai-text-muted);
}

.tmd-wp-ai-gate__error {
	display: block;
	font-size: 12px;
	font-weight: 600;
	color: var(--tmd-wp-ai-red);
	background: var(--tmd-wp-ai-red-50);
	border: 1px solid var(--tmd-wp-ai-red);
	border-radius: var(--tmd-wp-ai-radius);
	padding: 8px 10px;
}

.tmd-wp-ai-field {
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.tmd-wp-ai-field label {
	font-size: 12px;
	font-weight: 600;
	color: var(--tmd-wp-ai-text-muted);
}

.tmd-wp-ai-field__req {
	color: var(--tmd-wp-ai-red);
	font-weight: 700;
}

.tmd-wp-ai-field input {
	width: 100%;
	border: 1px solid var(--tmd-wp-ai-border-strong);
	border-radius: 9px;
	padding: 10px 12px;
	font-size: 14px;
	outline: none;
}

.tmd-wp-ai-field input:focus {
	border-color: var(--tmd-wp-ai-accent);
	box-shadow: 0 0 0 3px var(--tmd-wp-ai-accent-50);
}

.tmd-wp-ai-consent {
	display: flex;
	gap: 9px;
	align-items: flex-start;
	font-size: 12px;
	color: var(--tmd-wp-ai-text-muted);
	line-height: 1.4;
	cursor: pointer;
}

.tmd-wp-ai-consent input {
	margin-top: 2px;
	accent-color: var(--tmd-wp-ai-accent);
	width: 16px;
	height: 16px;
	flex: none;
}

.tmd-wp-ai-consent a {
	color: var(--tmd-wp-ai-accent-600);
	font-weight: 600;
	text-decoration: underline;
}

/* Turnstile mount point (D-M10): hidden while empty (feature disabled, or
   Cloudflare script not yet mounted a widget into it), revealed the moment
   it actually contains rendered content — no JS/PHP change needed for this
   toggle, :empty tracks it automatically. */
.tmd-wp-ai-gate__turnstile {
	display: none;
}

.tmd-wp-ai-gate__turnstile:not(:empty) {
	display: block;
	margin: 2px 0;
}

.tmd-wp-ai-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 700;
	padding: 11px;
	border-radius: var(--tmd-wp-ai-radius);
	border: 1px solid transparent;
	cursor: pointer;
	transition: background-color .15s ease;
	width: 100%;
}

.tmd-wp-ai-widget .tmd-wp-ai-btn--primary {
	background: var(--tmd-wp-ai-accent);
	color: #fff;
}

.tmd-wp-ai-btn--primary:hover {
	background: var(--tmd-wp-ai-accent-600);
}

/* ==========================================================================
   Conversation body — visible only while data-tmd-wp-ai-state="chat"
   ========================================================================== */

.tmd-wp-ai-body {
	display: none;
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	padding: 18px;
	flex-direction: column;
	gap: 12px;
	background: var(--tmd-wp-ai-surface-2);
}

.tmd-wp-ai-window[data-tmd-wp-ai-state="chat"] .tmd-wp-ai-body {
	display: flex;
}

.tmd-wp-ai-msg {
	max-width: 82%;
}

.tmd-wp-ai-msg--bot {
	align-self: flex-start;
}

.tmd-wp-ai-msg--user {
	align-self: flex-end;
}

.tmd-wp-ai-msg__bubble {
	padding: 10px 13px;
	border-radius: 14px;
	font-size: 14px;
	line-height: 1.45;
	word-break: break-word;
}

.tmd-wp-ai-msg--bot .tmd-wp-ai-msg__bubble {
	background: var(--tmd-wp-ai-surface);
	border: 1px solid var(--tmd-wp-ai-border);
	border-bottom-left-radius: 5px;
	color: var(--tmd-wp-ai-text);
}

.tmd-wp-ai-msg--user .tmd-wp-ai-msg__bubble {
	background: var(--tmd-wp-ai-accent);
	color: #fff;
	border-bottom-right-radius: 5px;
}

.tmd-wp-ai-msg[data-tmd-wp-ai-error="true"] .tmd-wp-ai-msg__bubble {
	background: var(--tmd-wp-ai-red-50);
	border-color: var(--tmd-wp-ai-red);
	color: var(--tmd-wp-ai-text);
}

.tmd-wp-ai-msg[data-tmd-wp-ai-pending="true"] .tmd-wp-ai-msg__bubble {
	color: var(--tmd-wp-ai-text-muted);
	letter-spacing: 2px;
	animation: tmd-wp-ai-pulse 1.2s ease-in-out infinite;
}

@keyframes tmd-wp-ai-pulse {
	0%, 100% { opacity: .45; }
	50% { opacity: 1; }
}

.tmd-wp-ai-msg__sources {
	list-style: none;
	margin: 8px 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.tmd-wp-ai-msg__sources a {
	font-size: 12px;
	color: var(--tmd-wp-ai-accent-600);
	text-decoration: underline;
	word-break: break-all;
}

/* Per-message feedback (thumbs up/down) — appended by frontend.js only to
   bot messages, sibling of .tmd-wp-ai-msg__bubble (and .tmd-wp-ai-msg__sources
   when present) inside .tmd-wp-ai-msg--bot. Icon color follows the button's
   `color` via the SVG's own stroke="currentColor" (set in JS) — no svg
   selector needed here. */
.tmd-wp-ai-msg__feedback {
	display: flex;
	gap: 4px;
	margin-top: 4px;
}

.tmd-wp-ai-msg__feedback-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 1px solid transparent;
	border-radius: 8px;
	background: transparent;
	color: var(--tmd-wp-ai-text-muted);
	cursor: pointer;
	transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.tmd-wp-ai-msg__feedback-btn--up:hover,
.tmd-wp-ai-msg__feedback-btn--up[data-tmd-wp-ai-selected="true"] {
	background: var(--tmd-wp-ai-accent-50);
	border-color: var(--tmd-wp-ai-accent-100);
	color: var(--tmd-wp-ai-accent-600);
}

.tmd-wp-ai-msg__feedback-btn--up[data-tmd-wp-ai-selected="true"] {
	border-color: var(--tmd-wp-ai-accent);
}

.tmd-wp-ai-msg__feedback-btn--down:hover,
.tmd-wp-ai-msg__feedback-btn--down[data-tmd-wp-ai-selected="true"] {
	background: var(--tmd-wp-ai-red-50);
	border-color: var(--tmd-wp-ai-red);
	color: var(--tmd-wp-ai-red);
}

/* ==========================================================================
   Foot — composer, quick replies, handoff (visible only in "chat" state)
   ========================================================================== */

.tmd-wp-ai-foot {
	display: none;
	flex: none;
	border-top: 1px solid var(--tmd-wp-ai-border);
	padding: 10px 12px;
	background: var(--tmd-wp-ai-surface);
}

.tmd-wp-ai-window[data-tmd-wp-ai-state="chat"] .tmd-wp-ai-foot {
	display: block;
}

.tmd-wp-ai-human-row {
	display: flex;
	justify-content: center;
	margin-bottom: 8px;
}

.tmd-wp-ai-human-btn {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-size: 12px;
	font-weight: 600;
	color: var(--tmd-wp-ai-accent-600);
	background: var(--tmd-wp-ai-accent-50);
	border: 1px solid var(--tmd-wp-ai-accent-100);
	padding: 6px 13px;
	border-radius: 999px;
	cursor: pointer;
	transition: background-color .15s ease;
}

.tmd-wp-ai-human-btn:hover {
	background: var(--tmd-wp-ai-accent-100);
}

.tmd-wp-ai-composer {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	background: var(--tmd-wp-ai-surface-2);
	border: 1px solid var(--tmd-wp-ai-border-strong);
	border-radius: 12px;
	padding: 6px 6px 6px 14px;
}

.tmd-wp-ai-composer:focus-within {
	border-color: var(--tmd-wp-ai-accent);
	box-shadow: 0 0 0 3px var(--tmd-wp-ai-accent-50);
}

.tmd-wp-ai-composer [data-tmd-wp-ai-input] {
	flex: 1;
	border: none;
	background: transparent;
	resize: none;
	font-size: 14px;
	outline: none;
	max-height: 80px;
	padding: 6px 0;
}

.tmd-wp-ai-send {
	flex: none;
	width: 36px;
	height: 36px;
	border-radius: 9px;
	border: none;
	background: var(--tmd-wp-ai-accent);
	color: #fff;
	display: grid;
	place-items: center;
	cursor: pointer;
	transition: background-color .15s ease;
}

.tmd-wp-ai-send:hover {
	background: var(--tmd-wp-ai-accent-600);
}

/* No icon markup ships server-side for this button (see file header gap
   note) — CSS-only right-pointing triangle stand-in. Decorative: the
   button's aria-label already supplies its accessible name. */
.tmd-wp-ai-send::before {
	content: "";
	display: block;
	width: 0;
	height: 0;
	margin-left: 2px;
	border-style: solid;
	border-width: 6px 0 6px 9px;
	border-color: transparent transparent transparent #fff;
}

/* Composer character counter (Audit 4 M-07) — built by frontend.js only
   (initCharCount()), inserted as the composer's next sibling; no
   server-rendered skeleton (see that function's comment). */
.tmd-wp-ai-char-count {
	font-size: 11px;
	color: var(--tmd-wp-ai-text-muted);
	text-align: right;
	margin-top: 4px;
}

.tmd-wp-ai-char-count[data-tmd-wp-ai-char-count-warn="true"] {
	color: var(--tmd-wp-ai-red);
	font-weight: 600;
}

.tmd-wp-ai-quick-replies {
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
	margin-top: 9px;
}

.tmd-wp-ai-qr-chip {
	font-size: 12px;
	font-weight: 600;
	color: var(--tmd-wp-ai-accent-600);
	background: var(--tmd-wp-ai-accent-50);
	border: 1px solid var(--tmd-wp-ai-accent-100);
	padding: 6px 12px;
	border-radius: 999px;
	cursor: pointer;
	transition: background-color .15s ease, border-color .15s ease;
}

.tmd-wp-ai-qr-chip:hover {
	background: var(--tmd-wp-ai-accent-100);
	border-color: var(--tmd-wp-ai-accent);
}

/* Whole-conversation rating (thumbs up/down) — built once by frontend.js
   into .tmd-wp-ai-foot (inserted as its first child, ahead of
   .tmd-wp-ai-human-row), disabled via the native `disabled` attribute until
   state.sessionId is known. Layout mirrors .tmd-wp-ai-human-row (centered,
   margin-bottom: 8px) so it reads as part of the same foot row group rather
   than a bolted-on element. Disabled visuals reuse the existing global
   `button:disabled` rule below (opacity + not-allowed cursor) — no extra
   rule needed here. Selected state uses a solid fill (vs. the lighter tint
   used for per-message feedback) since this is a single persistent choice
   per conversation, not a repeatable per-message action. */
.tmd-wp-ai-conversation-rating {
	display: flex;
	justify-content: center;
	gap: 6px;
	margin-bottom: 8px;
}

.tmd-wp-ai-conversation-rating__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 1px solid var(--tmd-wp-ai-border-strong);
	border-radius: 9px;
	background: var(--tmd-wp-ai-surface-2);
	color: var(--tmd-wp-ai-text-muted);
	cursor: pointer;
	transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.tmd-wp-ai-conversation-rating__btn--up:hover {
	background: var(--tmd-wp-ai-accent-50);
	border-color: var(--tmd-wp-ai-accent);
	color: var(--tmd-wp-ai-accent-600);
}

.tmd-wp-ai-conversation-rating__btn--up[data-tmd-wp-ai-selected="true"] {
	background: var(--tmd-wp-ai-accent);
	border-color: var(--tmd-wp-ai-accent);
	color: #fff;
}

.tmd-wp-ai-conversation-rating__btn--down:hover {
	background: var(--tmd-wp-ai-red-50);
	border-color: var(--tmd-wp-ai-red);
	color: var(--tmd-wp-ai-red);
}

.tmd-wp-ai-conversation-rating__btn--down[data-tmd-wp-ai-selected="true"] {
	background: var(--tmd-wp-ai-red);
	border-color: var(--tmd-wp-ai-red);
	color: #fff;
}

/* Defensive fallback for the WP core ".screen-reader-text" convention class
   already present in render_widget_markup()'s composer label — this file
   is self-contained/no theme dependency, so it cannot assume a theme
   stylesheet defines it. Matches WordPress core's own definition. */
.tmd-wp-ai-widget .screen-reader-text {
	position: absolute !important; /* justified: matches WP core's own !important on this exact utility class, relied upon site-wide to defeat arbitrary theme specificity */
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
	border: 0;
	margin: -1px;
	padding: 0;
}

/* ==========================================================================
   Disabled states (D-M6)
   ========================================================================== */

.tmd-wp-ai-widget button:disabled,
.tmd-wp-ai-widget [data-tmd-wp-ai-input]:disabled {
	opacity: .55;
	cursor: not-allowed;
}

/* ==========================================================================
   Focus visibility (frontend-accessibility skill — keyboard operability)
   ========================================================================== */

.tmd-wp-ai-widget :focus-visible {
	outline: 2px solid var(--tmd-wp-ai-accent);
	outline-offset: 2px;
}

/* ==========================================================================
   Position modifiers (floating variant) — driven by the widget_position
   Settings_Store value (render_widget_markup() fallback, see file header
   note); an explicit shortcode `position` attribute overrides it.
   ========================================================================== */

.tmd-wp-ai-widget--position-bottom-left .tmd-wp-ai-launcher,
.tmd-wp-ai-widget--position-top-left .tmd-wp-ai-launcher {
	right: auto;
	left: 16px;
}

.tmd-wp-ai-widget--position-top-right .tmd-wp-ai-launcher,
.tmd-wp-ai-widget--position-top-left .tmd-wp-ai-launcher {
	bottom: auto;
	top: 16px;
}

@media (min-width: 768px) {
	.tmd-wp-ai-widget--position-bottom-left .tmd-wp-ai-window,
	.tmd-wp-ai-widget--position-top-left .tmd-wp-ai-window {
		right: auto;
		left: 16px;
	}

	.tmd-wp-ai-widget--position-top-right .tmd-wp-ai-window,
	.tmd-wp-ai-widget--position-top-left .tmd-wp-ai-window {
		bottom: auto;
		top: 16px;
	}
}

/* ==========================================================================
   Responsive breakpoints — mobile-first (375 / 768 / 1024)
   ========================================================================== */

/* Base rules above already target the smallest supported viewport (375px
   phones): floating window is a full-screen takeover, inline widget is a
   compact card. */

@media (min-width: 768px) {
	.tmd-wp-ai-launcher {
		right: 24px;
		bottom: 24px;
		width: 58px;
		height: 58px;
	}

	.tmd-wp-ai-widget--floating .tmd-wp-ai-window {
		inset: auto;
		right: 16px;
		bottom: 16px;
		width: 380px;
		max-width: calc(100vw - 32px);
		height: 600px;
		max-height: calc(100vh - 32px);
		border-radius: var(--tmd-wp-ai-radius-lg);
		border: 1px solid var(--tmd-wp-ai-border);
	}

	.tmd-wp-ai-widget--inline .tmd-wp-ai-window {
		height: 560px;
		max-height: 80vh;
	}
}

@media (min-width: 1024px) {
	.tmd-wp-ai-widget--floating .tmd-wp-ai-window {
		right: 24px;
		bottom: 24px;
		width: 400px;
		height: 640px;
		max-height: calc(100vh - 48px);
	}

	.tmd-wp-ai-widget--inline .tmd-wp-ai-window {
		max-width: 680px;
		height: 600px;
	}
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	/* justified: standard a11y override, must beat any transition/animation
	   duration declared above regardless of selector specificity */
	.tmd-wp-ai-widget * {
		animation-duration: .001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .001ms !important;
	}
}
