/**
 * Vendyl AI (VAI) frontend styles.
 */

:root {
	--vai-bg: #f5f7fb;
	--vai-panel: #ffffff;
	--vai-text: #101828;
	--vai-muted: #667085;
	--vai-border: rgba(16, 24, 40, 0.10);
	--vai-soft: #f7f8fc;
	--vai-soft-2: #fafbff;
	--vai-dark: #111827;
	--vai-accent: #3867ff;
	--vai-accent-dark: #1f4cff;
	--vai-accent-deep: #13227a;
	--vai-purple: #3867ff;
	--vai-purple-dark: #1f4cff;
	--vai-shadow: 0 24px 60px rgba(16, 24, 40, 0.10);
	--vai-card-shadow: 0 14px 32px rgba(16, 24, 40, 0.06);
	--vai-radius: 22px;
}

.vai-hidden {
	display: none !important;
}

.vai-launcher,
.vai-drawer {
	display: none !important;
}

/* =========================================================
   Base
   ========================================================= */

.vai-page {
	max-width: 1440px;
	margin: 0 auto;
	padding: 22px 18px 28px;
	color: var(--vai-text);
}

.vai-card,
.vai-shell,
.vai-chat-shell {
	border: 1px solid var(--vai-border);
	border-radius: 24px;
	background: var(--vai-panel);
	box-shadow: var(--vai-card-shadow);
}

.vai-card__header,
.vai-shell__header {
	padding: 18px 18px 0;
}

.vai-card__body,
.vai-shell__body {
	padding: 18px;
}

.vai-card__title,
.vai-shell__title {
	margin: 0 0 7px;
	font-size: 18px;
	font-weight: 850;
	color: var(--vai-text);
}

.vai-card__text,
.vai-shell__text {
	margin: 0 0 14px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--vai-muted);
}

.vai-card__text--tight {
	margin-top: 18px;
}

/* =========================================================
   Logged-out
   ========================================================= */

.vai-card--locked {
	max-width: 1120px;
	margin: 28px auto 0;
	box-shadow: 0 14px 32px rgba(16, 24, 40, 0.06);
}

.vai-preview-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 14px;
	margin-top: 14px;
}

.vai-preview-card {
	border: 1px solid rgba(16, 24, 40, 0.08);
	background: var(--vai-soft-2);
	border-radius: 18px;
	padding: 16px;
}

.vai-preview-card h3 {
	margin: 0 0 10px;
	font-size: 15px;
	font-weight: 850;
	color: var(--vai-text);
}

.vai-preview-card ul {
	margin: 0;
	padding-left: 18px;
	color: var(--vai-muted);
	font-size: 14px;
	line-height: 1.55;
}

.vai-locked-page-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.vai-link-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 999px;
	padding: 12px 18px;
	background: var(--vai-purple);
	color: #fff;
	text-decoration: none;
	font-weight: 800;
	font-size: 14px;
	line-height: 1;
}

.vai-link-button:hover,
.vai-link-button:focus {
	background: var(--vai-purple-dark);
	color: #fff;
	text-decoration: none;
	outline: none;
}

.vai-link-button--secondary {
	background: #eef2ff;
	color: #312e81;
}

.vai-link-button--secondary:hover,
.vai-link-button--secondary:focus {
	background: #dfe7ff;
	color: #312e81;
}

/* =========================================================
   Workspace
   ========================================================= */

.vai-workspace {
	display: grid;
	grid-template-columns: 290px minmax(0, 1fr);
	gap: 18px;
	align-items: stretch;
	min-height: calc(100vh - 150px);
}

.vai-shell--threads {
	position: sticky;
	top: 24px;
	height: calc(100vh - 120px);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.vai-shell__header {
	flex: 0 0 auto;
}

.vai-shell__body {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.vai-new-chat {
	width: 100%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	border: 0;
	border-radius: 16px;
	padding: 13px 14px;
	background: linear-gradient(135deg, #13227a, #07145f);
	color: #fff;
	font-size: 14px;
	font-weight: 850;
	cursor: pointer;
	transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
	box-shadow: 0 10px 24px rgba(7, 20, 95, 0.16);
}

.vai-new-chat:hover,
.vai-new-chat:focus {
	transform: translateY(-1px);
	outline: none;
}

.vai-new-chat:disabled {
	opacity: 0.7;
	cursor: wait;
	transform: none;
}

.vai-new-chat__plus {
	font-size: 18px;
	line-height: 1;
	font-weight: 700;
}

.vai-folder-section {
	margin-top: 16px;
}

.vai-section-label-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 10px;
}

.vai-folder-create {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid rgba(56, 103, 255, 0.16);
	border-radius: 999px;
	padding: 7px 12px;
	background: #f8faff;
	color: var(--vai-accent);
	font-size: 12px;
	font-weight: 800;
	line-height: 1;
	cursor: pointer;
}

.vai-folder-create:hover,
.vai-folder-create:focus {
	background: #eef3ff;
	outline: none;
}

.vai-folder-create:disabled {
	opacity: 0.6;
	cursor: wait;
}

.vai-folder-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-height: 190px;
	overflow-y: auto;
	padding-right: 2px;
}

.vai-folder {
	width: 100%;
	display: block;
	text-align: left;
	border: 1px solid rgba(16, 24, 40, 0.08);
	border-radius: 14px;
	padding: 10px 12px;
	background: #fff;
	color: var(--vai-text);
	font-size: 13px;
	font-weight: 700;
	line-height: 1.35;
	cursor: pointer;
	transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.vai-folder:hover,
.vai-folder:focus {
	border-color: rgba(56, 103, 255, 0.22);
	background: #f8faff;
	transform: translateY(-1px);
	outline: none;
}

.vai-folder.is-active {
	border-color: rgba(56, 103, 255, 0.24);
	background: linear-gradient(180deg, #f8faff, #f2f6ff);
	box-shadow: inset 0 0 0 1px rgba(56, 103, 255, 0.05);
}

.vai-thread-list-wrap {
	margin-top: 16px;
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
}

.vai-thread-list__label {
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--vai-muted);
}

.vai-thread-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
	overflow-y: auto;
	padding-right: 2px;
}

.vai-thread-list__empty {
	border: 1px dashed rgba(16, 24, 40, 0.12);
	border-radius: 16px;
	padding: 14px 12px;
	background: var(--vai-soft-2);
	font-size: 13px;
	line-height: 1.5;
	color: var(--vai-muted);
}

.vai-thread {
	width: 100%;
	display: block;
	text-align: left;
	border: 1px solid rgba(16, 24, 40, 0.08);
	border-radius: 16px;
	padding: 12px 12px;
	background: #fff;
	cursor: pointer;
	transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.vai-thread:hover,
.vai-thread:focus {
	border-color: rgba(56, 103, 255, 0.22);
	background: #f8faff;
	transform: translateY(-1px);
	outline: none;
}

.vai-thread.is-active {
	border-color: rgba(56, 103, 255, 0.24);
	background: linear-gradient(180deg, #f8faff, #f2f6ff);
	box-shadow: inset 0 0 0 1px rgba(56, 103, 255, 0.05);
}

.vai-thread__title {
	margin: 0 0 4px;
	font-size: 13px;
	font-weight: 800;
	line-height: 1.35;
	color: var(--vai-text);
	word-break: break-word;
}

.vai-thread__preview {
	font-size: 12px;
	line-height: 1.45;
	color: var(--vai-muted);
	word-break: break-word;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* =========================================================
   Main chat shell
   ========================================================= */


.vai-attachment-toolbar {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	margin: 0 0 10px;
}

.vai-attach-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid rgba(56, 103, 255, 0.16);
	border-radius: 999px;
	padding: 10px 14px;
	background: #f8faff;
	color: var(--vai-accent);
	font-size: 13px;
	font-weight: 800;
	line-height: 1;
	cursor: pointer;
	transition: background 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;
}

.vai-attach-button:hover,
.vai-attach-button:focus {
	background: #eef3ff;
	border-color: rgba(56, 103, 255, 0.24);
	outline: none;
}

.vai-attach-button:disabled {
	opacity: 0.65;
	cursor: wait;
}

.vai-attachment-toolbar__hint {
	font-size: 12px;
	line-height: 1.45;
	color: var(--vai-muted);
}

.vai-file-input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

.vai-attachment-list {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0 0 12px;
}

.vai-attachment-list.is-empty {
	display: none;
}

.vai-attachment-chip {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	max-width: 100%;
	padding: 9px 12px;
	border-radius: 999px;
	background: #f8faff;
	border: 1px solid rgba(56, 103, 255, 0.12);
	box-shadow: 0 6px 14px rgba(16, 24, 40, 0.04);
}

.vai-attachment-chip__name {
	font-size: 12px;
	font-weight: 800;
	color: var(--vai-text);
	max-width: 240px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.vai-attachment-chip__meta {
	font-size: 11px;
	color: var(--vai-muted);
	white-space: nowrap;
}

.vai-attachment-chip__remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border: 0;
	border-radius: 999px;
	background: rgba(16, 24, 40, 0.08);
	color: var(--vai-text);
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
}

.vai-attachment-chip__remove:hover,
.vai-attachment-chip__remove:focus {
	background: rgba(16, 24, 40, 0.12);
	outline: none;
}


.vai-chat-shell {
	display: flex;
	flex-direction: column;
	min-height: calc(100vh - 120px);
	overflow: hidden;
}

.vai-chat-shell__topbar {
	flex: 0 0 auto;
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding: 18px 20px 14px;
	border-bottom: 1px solid rgba(16, 24, 40, 0.08);
	background: linear-gradient(180deg, #ffffff, #fbfcff);
}

.vai-chat-shell__topbar-left {
	display: flex;
	flex-direction: column;
	gap: 10px;
	min-width: 240px;
}

.vai-mode-pill-label {
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--vai-muted);
}

.vai-mode-select,
.vai-folder-move {
	width: 100%;
	max-width: 320px;
	min-height: 46px;
	border-radius: 14px;
	border: 1px solid var(--vai-border);
	background: #fff;
	padding: 0 14px;
	font-size: 14px;
	font-weight: 700;
	color: var(--vai-text);
	outline: none;
	box-shadow: none;
}

.vai-mode-select:focus,
.vai-folder-move:focus {
	border-color: rgba(56, 103, 255, 0.34);
	box-shadow: 0 0 0 3px rgba(56, 103, 255, 0.08);
}

.vai-folder-move:disabled {
	opacity: 0.7;
	cursor: not-allowed;
	background: #f8fafc;
}

.vai-chat-shell__topbar-right {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	justify-content: flex-end;
}

.vai-mode-summary-inline {
	max-width: 620px;
	text-align: right;
}

.vai-mode-summary-inline__title {
	margin: 0 0 4px;
	font-size: 15px;
	font-weight: 850;
	color: var(--vai-text);
	line-height: 1.25;
}

.vai-mode-summary-inline__text {
	font-size: 13px;
	line-height: 1.5;
	color: var(--vai-muted);
}

.vai-chat-shell__body {
	flex: 1 1 auto;
	min-height: 0;
	padding: 18px 20px 0;
	display: flex;
	flex-direction: column;
}

.vai-messages {
	flex: 1 1 auto;
	min-height: 420px;
	max-height: none;
	padding: 8px 2px 8px 0;
	background: transparent;
	display: flex;
	flex-direction: column;
	gap: 14px;
	overflow-y: auto;
	scroll-behavior: smooth;
}

.vai-chat-shell__composer {
	flex: 0 0 auto;
	padding: 12px 20px 20px;
	background: linear-gradient(180deg, rgba(255,255,255,0), #fff 24%);
}

.vai-chat-shell__composer-note {
	margin: 0 0 10px;
	font-size: 12px;
	line-height: 1.5;
	color: var(--vai-muted);
}

.vai-input-row {
	display: flex;
	gap: 12px;
	align-items: flex-end;
	background: #fff;
	border: 1px solid var(--vai-border);
	border-radius: 22px;
	padding: 10px;
	box-shadow: 0 10px 24px rgba(16, 24, 40, 0.04);
}

.vai-input {
	flex: 1 1 auto;
	width: 100%;
	min-height: 56px;
	max-height: 220px;
	resize: none;
	border-radius: 16px;
	border: 0;
	padding: 12px 14px;
	font-size: 15px;
	line-height: 1.5;
	color: var(--vai-text);
	background: transparent;
}

.vai-input:focus {
	outline: none;
	box-shadow: none;
}

.vai-input:disabled {
	opacity: 0.72;
	cursor: wait;
}

.vai-send {
	flex: 0 0 120px;
	width: 120px;
	min-width: 120px;
	min-height: 52px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	border: 0;
	border-radius: 16px;
	padding: 13px 15px;
	background: linear-gradient(135deg, #3867ff, #1f4cff);
	color: #fff;
	font-weight: 850;
	font-size: 15px;
	line-height: 1;
	white-space: nowrap;
	cursor: pointer;
	transition: transform 0.16s ease, opacity 0.16s ease, box-shadow 0.16s ease;
	box-shadow: 0 10px 24px rgba(56, 103, 255, 0.18);
}

.vai-send:hover,
.vai-send:focus {
	transform: translateY(-1px);
	outline: none;
}

.vai-send:disabled {
	opacity: 0.72;
	cursor: wait;
	transform: none;
}

/* =========================================================
   Messages
   ========================================================= */

.vai-message {
	max-width: min(860px, 100%);
	border-radius: 18px;
	padding: 14px 15px;
	font-size: 14px;
	line-height: 1.65;
	white-space: pre-wrap;
	word-break: break-word;
}

.vai-message--assistant {
	align-self: flex-start;
	background: #fff;
	color: var(--vai-text);
	border: 1px solid rgba(16, 24, 40, 0.08);
	box-shadow: 0 8px 18px rgba(16, 24, 40, 0.03);
}

.vai-message--user {
	align-self: flex-end;
	background: var(--vai-dark);
	color: #fff;
	margin-left: 48px;
}

.vai-message--meta {
	align-self: flex-start;
	background: transparent;
	border: 0;
	padding: 2px 2px 0;
	font-size: 12px;
	color: var(--vai-muted);
	box-shadow: none;
}

.vai-message--error {
	background: #fff4f4;
	color: #991b1b;
	border: 1px solid rgba(220, 38, 38, 0.14);
}

.vai-message--loading {
	position: relative;
}

.vai-message--loading::after {
	content: '';
	display: inline-block;
	width: 14px;
	height: 14px;
	margin-left: 8px;
	border: 2px solid rgba(56, 103, 255, 0.2);
	border-top-color: var(--vai-accent);
	border-radius: 999px;
	vertical-align: -2px;
	animation: vai-spin 0.8s linear infinite;
}

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

/* =========================================================
   Rich assistant rendering
   ========================================================= */

.vai-rich-text {
	display: block;
	color: var(--vai-text);
}

.vai-rich-text > *:first-child {
	margin-top: 0;
}

.vai-rich-text > *:last-child {
	margin-bottom: 0;
}

.vai-rich-text h1,
.vai-rich-text h2,
.vai-rich-text h3 {
	margin: 0 0 10px;
	line-height: 1.2;
	letter-spacing: -0.02em;
	color: var(--vai-text);
}

.vai-rich-text h1 {
	font-size: 20px;
	font-weight: 900;
}

.vai-rich-text h2 {
	font-size: 17px;
	font-weight: 850;
}

.vai-rich-text h3 {
	font-size: 15px;
	font-weight: 800;
}

.vai-rich-text p {
	margin: 0 0 12px;
	font-size: 14px;
	line-height: 1.68;
	color: var(--vai-text);
}

.vai-rich-text ul,
.vai-rich-text ol {
	margin: 0 0 14px 0;
	padding-left: 20px;
}

.vai-rich-text li {
	margin: 0 0 8px;
	line-height: 1.6;
	color: var(--vai-text);
}

.vai-rich-text strong {
	font-weight: 800;
	color: #0f172a;
}

.vai-rich-text em {
	font-style: italic;
}

.vai-rich-text code {
	display: inline-block;
	padding: 1px 7px;
	border-radius: 8px;
	background: #eef2ff;
	border: 1px solid rgba(56, 103, 255, 0.12);
	font-size: 12px;
	color: #1e3a8a;
	vertical-align: baseline;
}

.vai-rich-text a {
	color: var(--vai-accent);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.vai-rich-table-wrap {
	margin: 0 0 14px;
	overflow-x: auto;
	border: 1px solid rgba(16, 24, 40, 0.08);
	border-radius: 14px;
	background: #fff;
}

.vai-rich-table {
	width: 100%;
	border-collapse: collapse;
	min-width: 420px;
}

.vai-rich-table th,
.vai-rich-table td {
	padding: 11px 12px;
	text-align: left;
	vertical-align: top;
	border-bottom: 1px solid rgba(16, 24, 40, 0.08);
	font-size: 13px;
	line-height: 1.5;
}

.vai-rich-table th {
	background: #f8faff;
	font-weight: 800;
	color: #0f172a;
}

.vai-rich-table tr:last-child td {
	border-bottom: 0;
}

/* =========================================================
   Legacy hidden / neutralized old blocks
   ========================================================= */

.vai-page__hero,
.vai-card--sidebar,
.vai-quick-prompts,
.vai-chat-footer-note,
.vai-mode-grid,
.vai-mode-summary,
.vai-helper-pills,
.vai-caveat,
.vai-drawer,
.vai-launcher {
	display: none !important;
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 1100px) {
	.vai-workspace {
		grid-template-columns: 1fr;
		min-height: auto;
	}

	.vai-shell--threads {
		position: static;
		top: auto;
		height: auto;
	}

	.vai-chat-shell {
		min-height: 70vh;
	}
}

@media (max-width: 860px) {
	.vai-page {
		padding: 14px 12px 22px;
	}

	.vai-chat-shell__topbar {
		flex-direction: column;
		align-items: stretch;
	}

	.vai-chat-shell__topbar-right {
		justify-content: flex-start;
	}

	.vai-mode-summary-inline {
		text-align: left;
		max-width: none;
	}

	.vai-messages {
		min-height: 320px;
	}

	.vai-preview-grid {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 620px) {
	.vai-shell__header,
	.vai-shell__body,
	.vai-chat-shell__topbar,
	.vai-chat-shell__body,
	.vai-chat-shell__composer {
		padding-left: 14px;
		padding-right: 14px;
	}

	.vai-input-row {
		flex-direction: column;
		align-items: stretch;
		border-radius: 18px;
	}

	.vai-send {
		width: 100%;
		min-width: 0;
		flex-basis: auto;
	}

	.vai-message--user {
		margin-left: 0;
	}
}

@media (max-width: 520px) {
	.vai-thread__title {
		font-size: 12.5px;
	}

	.vai-thread__preview,
	.vai-chat-shell__composer-note {
		font-size: 11.5px;
	}

	.vai-mode-select,
	.vai-folder-move {
		max-width: none;
	}
}