/**
 * NVIDIA Article Chatbot - front-end styles.
 *
 * The default skin ("minimal") deliberately sets no colours, fonts or
 * backgrounds of its own: it inherits everything from the theme and only adds
 * spacing and layout. The "card" skin adds a frame for themes where the widget
 * needs to stand apart. An accent colour is applied only when the site owner
 * picks one, otherwise the current text colour is used.
 */

.nac-widget {
	--nac-accent: currentColor;
	--nac-gap: 1rem;
	--nac-radius: 6px;
	--nac-line: color-mix(in srgb, currentColor 18%, transparent);
	--nac-soft: color-mix(in srgb, currentColor 5%, transparent);
	--nac-muted-opacity: 0.72;

	box-sizing: border-box;
	margin: 2.5rem 0;
	font: inherit;
	color: inherit;
}

/* Fallback for browsers without color-mix(). */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
	.nac-widget {
		--nac-line: rgba(128, 128, 128, 0.35);
		--nac-soft: rgba(128, 128, 128, 0.09);
	}
}

.nac-widget *,
.nac-widget *::before,
.nac-widget *::after {
	box-sizing: inherit;
}

.nac-header {
	margin-bottom: var(--nac-gap);
}

.nac-title {
	margin: 0 0 0.35em;
	font-family: inherit;
	line-height: 1.3;
}

.nac-intro {
	margin: 0;
	opacity: var(--nac-muted-opacity);
}

.nac-intro p {
	margin: 0 0 0.5em;
}

.nac-intro p:last-child {
	margin-bottom: 0;
}

/* Conversation ---------------------------------------------------------- */

.nac-chat:empty {
	display: none;
}

.nac-chat {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	margin-bottom: var(--nac-gap);
	max-height: 70vh;
	overflow-y: auto;
}

.nac-bubble {
	padding: 0.85em 1em;
	border: 1px solid var(--nac-line);
	border-radius: var(--nac-radius);
}

.nac-bubble-user {
	background: var(--nac-soft);
	border-style: dashed;
}

.nac-bubble-author {
	display: block;
	margin-bottom: 0.35em;
	font-size: 0.75em;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	opacity: var(--nac-muted-opacity);
}

.nac-bubble-body > *:first-child {
	margin-top: 0;
}

.nac-bubble-body > *:last-child {
	margin-bottom: 0;
}

.nac-bubble-body p {
	margin: 0 0 0.7em;
}

.nac-bubble-body ul,
.nac-bubble-body ol {
	margin: 0 0 0.7em;
	padding-left: 1.4em;
}

.nac-bubble-body li {
	margin-bottom: 0.25em;
}

.nac-bubble-body code {
	padding: 0.1em 0.35em;
	border-radius: 4px;
	background: var(--nac-soft);
	font-size: 0.92em;
}

.nac-bubble-body .nac-code {
	overflow-x: auto;
	margin: 0 0 0.7em;
	padding: 0.8em 1em;
	border-radius: var(--nac-radius);
	background: var(--nac-soft);
}

.nac-bubble-notice {
	margin: 0.85em 0 0;
	padding-top: 0.65em;
	border-top: 1px solid var(--nac-line);
	font-size: 0.9em;
	opacity: var(--nac-muted-opacity);
}

.nac-thinking {
	opacity: var(--nac-muted-opacity);
}

.nac-dots {
	display: inline-block;
	width: 1.6em;
	font-weight: 700;
	letter-spacing: 0.15em;
	color: var(--nac-accent);
}

.nac-dots::after {
	content: "•••";
	animation: nac-pulse 1.2s ease-in-out infinite;
}

@keyframes nac-pulse {
	0%, 100% { opacity: 0.3; }
	50% { opacity: 1; }
}

/* Form ------------------------------------------------------------------ */

.nac-field {
	margin-bottom: 0.75rem;
}

.nac-label {
	display: block;
	margin-bottom: 0.35em;
	font-size: 0.9em;
	font-weight: 600;
}

.nac-optional {
	font-weight: 400;
	opacity: var(--nac-muted-opacity);
}

/* Inputs stay close to the theme: only the box model is set here. */
.nac-input,
.nac-textarea {
	display: block;
	width: 100%;
	max-width: 100%;
	padding: 0.65em 0.8em;
	border: 1px solid var(--nac-line);
	border-radius: var(--nac-radius);
	background: transparent;
	color: inherit;
	font: inherit;
	line-height: 1.5;
}

.nac-textarea {
	min-height: 3.4em;
	resize: vertical;
}

.nac-input:focus,
.nac-textarea:focus {
	outline: 2px solid var(--nac-accent);
	outline-offset: 1px;
}

.nac-field-name {
	max-width: 22em;
}

.nac-counter {
	margin-top: 0.3em;
	font-size: 0.8em;
	text-align: right;
	opacity: var(--nac-muted-opacity);
}

.nac-counter-low {
	opacity: 1;
	font-weight: 600;
}

.nac-hp {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.nac-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem 1rem;
}

/* Ghost button by default; solid once an accent colour is chosen. */
.nac-submit {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	padding: 0.6em 1.5em;
	border: 1px solid var(--nac-accent);
	border-radius: 999px;
	background: transparent;
	color: inherit;
	font: inherit;
	font-weight: 600;
	line-height: 1.4;
	cursor: pointer;
	transition: background-color 0.15s ease, opacity 0.15s ease;
}

.nac-submit:hover:not(:disabled) {
	background: var(--nac-soft);
}

.nac-has-accent .nac-submit {
	background: var(--nac-accent);
	color: var(--nac-accent-text, #fff);
}

.nac-has-accent .nac-submit:hover:not(:disabled) {
	opacity: 0.88;
	background: var(--nac-accent);
}

.nac-submit:disabled {
	opacity: 0.55;
	cursor: progress;
}

.nac-spinner {
	display: none;
	width: 1em;
	height: 1em;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: nac-spin 0.7s linear infinite;
}

.nac-busy .nac-spinner {
	display: inline-block;
}

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

.nac-disclaimer {
	margin: 0;
	font-size: 0.82em;
	opacity: var(--nac-muted-opacity);
}

.nac-message {
	margin-top: 0.75rem;
	font-size: 0.9em;
}

.nac-message:empty {
	display: none;
}

.nac-message-error {
	padding: 0.6em 0.8em;
	border-left: 3px solid #d63638;
	border-radius: 4px;
	background: rgba(214, 54, 56, 0.08);
}

.nac-login-required {
	margin: 0;
}

/* Published questions --------------------------------------------------- */

.nac-published {
	margin-top: 1.75rem;
	padding-top: 1.25rem;
	border-top: 1px solid var(--nac-line);
}

.nac-published-title {
	margin: 0 0 1rem;
	font-family: inherit;
}

.nac-count {
	font-weight: 400;
	opacity: var(--nac-muted-opacity);
}

.nac-qa-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.nac-qa-item + .nac-qa-item {
	margin-top: 1.25rem;
	padding-top: 1.25rem;
	border-top: 1px solid var(--nac-line);
}

.nac-qa-question {
	margin: 0 0 0.3em;
	font-family: inherit;
	line-height: 1.4;
}

.nac-qa-meta {
	margin: 0 0 0.65em;
	font-size: 0.82em;
	opacity: var(--nac-muted-opacity);
}

.nac-qa-date::before {
	content: " · ";
}

.nac-qa-answer > *:last-child {
	margin-bottom: 0;
}

.nac-qa-answer p {
	margin: 0 0 0.7em;
}

.nac-qa-badge {
	margin: 0.6em 0 0;
	font-size: 0.78em;
	opacity: var(--nac-muted-opacity);
}

.nac-qa-badge::before {
	content: "✓ ";
	color: var(--nac-accent);
	font-weight: 700;
}

/* Card skin ------------------------------------------------------------- */

.nac-skin-card {
	padding: 1.5rem;
	border: 1px solid var(--nac-line);
	border-radius: 10px;
	background: var(--nac-soft);
}

.nac-skin-card .nac-bubble {
	background: rgba(255, 255, 255, 0.5);
}

@media (prefers-color-scheme: dark) {
	.nac-skin-card .nac-bubble {
		background: rgba(0, 0, 0, 0.18);
	}
}

.nac-skin-card .nac-bubble-user {
	background: transparent;
}

/* Minimal skin ---------------------------------------------------------- */

.nac-skin-minimal {
	padding-top: 1.5rem;
	border-top: 1px solid var(--nac-line);
}

@media (max-width: 600px) {
	.nac-skin-card {
		padding: 1.15rem;
	}

	.nac-actions {
		gap: 0.6rem;
	}

	.nac-submit {
		width: 100%;
		justify-content: center;
	}
}
