/* Cliverse AI Search — full-screen assistant overlay
   Brand: navy #2D365F, orange #E5633C, body #313131 */

/* Suppress the theme's persistent AjaxSearchLite bar (header.php #ajaxsearchlite1):
   the header magnifier icon now opens this AI Search overlay instead. */
#ajaxsearchlite1.wpdreams_asl_container {
	display: none !important;
}

#cas-overlay {
	--cas-navy: #2D365F;
	--cas-orange: #E5633C;
	--cas-text: #313131;
	--cas-lavender: #E9EBF8;
	--cas-border: #e4e6ef;
	display: none;
	position: fixed;
	inset: 0;
	/* Above the AdThrive sticky footer ad (z-index 1000001), which would
	   otherwise cover the chat input at the bottom of the overlay. */
	z-index: 1000100;
	background: transparent;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	color: var(--cas-text);
	font-family: "ProximaNova", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
/* Translucent frosted backdrop on a separate fixed layer. Keeping the blur
   off #cas-overlay itself is intentional: an element with backdrop-filter
   becomes the containing block for its position:fixed descendants, which
   would trap .cas-close in the scrolling area and make it drift on scroll. */
#cas-overlay::before {
	content: "";
	position: fixed;
	inset: 0;
	z-index: -1;
	background: rgba(255, 255, 255, .9);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
}
#cas-overlay.is-open { display: block; }
body.cas-locked { overflow: hidden; }
/* Hide AdThrive sticky/footer ads while the overlay is open so they don't
   show through the backdrop or sit over the chat input. */
body.cas-locked .adthrive-sticky,
body.cas-locked .adthrive-footer,
body.cas-locked .adthrive-sticky-outstream,
body.cas-locked [id^="AdThrive_Footer"] { display: none !important; }

#cas-overlay * { box-sizing: border-box; }

.cas-close {
	position: fixed;
	top: 22px;
	right: 28px;
	z-index: 5;
	width: 40px;
	height: 40px;
	border: 0;
	background: transparent;
	font-size: 34px;
	line-height: 1;
	color: var(--cas-navy);
	cursor: pointer;
	opacity: .7;
	transition: opacity .15s;
}
.cas-close:hover { opacity: 1; }

.cas-view { display: none; }
.cas-view.is-active { display: block; }

/* ---------- Search bars ---------- */
.cas-searchbar {
	position: relative;
	display: flex;
	align-items: center;
	background: #fff;
	border: 1px solid var(--cas-border);
	border-radius: 40px;
	padding: 6px 8px 6px 18px;
	box-shadow: 0 2px 14px rgba(45, 54, 95, .08);
}
.cas-searchbar .cas-input {
	flex: 1;
	border: 0;
	outline: 0;
	background: transparent;
	font-size: 17px;
	color: var(--cas-text);
	padding: 12px 10px;
	min-width: 0;
}
/* Hide the browser's native clear button for type="search" — we use .cas-clear. */
.cas-searchbar .cas-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.cas-searchbar .cas-input::-ms-clear { display: none; }
.cas-searchbar-icon { display: inline-flex; }
.cas-bot-icon { width: 30px; height: 30px; flex: none; }
.cas-bubble-icon { width: 28px; height: 27px; flex: none; }
.cas-searchbar-icon--bubble { margin-right: 4px; }
.cas-mag { flex: none; margin-right: 6px; }

.cas-send {
	flex: none;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	background: var(--cas-navy);
	color: #fff;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background .15s;
}
.cas-send:hover { background: #232a4c; }
.cas-clear {
	flex: none;
	border: 0;
	background: transparent;
	font-size: 26px;
	line-height: 1;
	color: #9aa0b8;
	cursor: pointer;
	padding: 0 10px;
}
/* Clear button temporarily disabled — hidden in every state for now. */
.cas-clear,
.cas-clear.is-visible { display: none; }

/* ---------- VIEW 1: HERO ---------- */
.cas-hero {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 40px 20px;
}
.cas-hero-title {
	font-size: clamp(26px, 4vw, 46px);
	font-weight: 800;
	line-height: 1.15;
	color: var(--cas-navy);
	text-transform: uppercase;
	margin: 0 0 36px;
	letter-spacing: .2px;
}
.cas-accent { color: var(--cas-orange); }
.cas-searchbar--hero {
	width: 100%;
	max-width: 820px;
	/* Figma first screen: soft off-white field with a lavender ring + glow. */
	background: #F7F7FA;
	border-color: #DADCEF;
	border-radius: 48px;
	padding: 10px 12px 10px 22px;
	box-shadow: 0 0 0 4px rgba(45, 54, 95, .05), 0 10px 30px rgba(45, 54, 95, .10);
}
.cas-searchbar--hero .cas-input { font-size: 18px; padding: 14px 12px; }
.cas-searchbar--hero .cas-send { width: 52px; height: 52px; }

/* ---------- Top bar (results + chat) ---------- */
.cas-topbar {
	position: sticky;
	top: 0;
	z-index: 3;
	display: flex;
	align-items: center;
	gap: 16px;
	background: var(--cas-lavender);
	padding: 22px 64px 22px 28px;
}
.cas-searchbar--top { flex: 1; max-width: 1120px; }
.cas-chat-btn {
	flex: none;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	background: var(--cas-navy);
	color: #fff;
	border: 0;
	border-radius: 40px;
	padding: 14px 26px;
	font-size: 16px;
	font-weight: 700;
	cursor: pointer;
	transition: background .15s;
}
.cas-chat-btn:hover { background: #232a4c; }

/* ---------- VIEW 2: RESULTS ---------- */
.cas-results-body {
	display: grid;
	grid-template-columns: 2fr 1fr;
	gap: 48px;
	max-width: 1280px;
	margin: 0 auto;
	padding: 36px 40px 80px;
}
.cas-section-title {
	font-size: 26px;
	font-weight: 800;
	color: #1c1c1c;
	margin: 0 0 14px;
	padding-bottom: 12px;
	border-bottom: 2px solid #1c1c1c;
}
.cas-results-side .cas-section-title { font-size: 22px; }
.cas-side-block { margin-bottom: 38px; }

/* Article cards */
.cas-articles { display: flex; flex-direction: column; gap: 20px; }
.cas-article {
	display: flex;
	gap: 22px;
	align-items: center;
	background: #fff;
	border: 1px solid var(--cas-border);
	border-radius: 10px;
	padding: 18px;
	box-shadow: 0 4px 18px rgba(45, 54, 95, .06);
	text-decoration: none;
	color: inherit;
	transition: box-shadow .15s, transform .15s;
}
.cas-article:hover { box-shadow: 0 8px 26px rgba(45, 54, 95, .12); transform: translateY(-1px); }
.cas-article-thumb {
	flex: none;
	width: 210px;
	height: 150px;
	border-radius: 8px;
	object-fit: cover;
	background: #eef0f6;
}
.cas-article-cat {
	text-transform: uppercase;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .5px;
	color: #6b7194;
	margin: 0 0 8px;
}
.cas-article-title { font-size: 22px; font-weight: 800; color: #1c1c1c; margin: 0 0 14px; line-height: 1.25; }
.cas-article-author { display: flex; align-items: center; gap: 10px; font-size: 15px; color: #555; }
.cas-article-author img { width: 36px; height: 36px; border-radius: 50%; }

/* Tools */
.cas-tools { display: flex; flex-direction: column; gap: 14px; }
.cas-tool {
	display: flex;
	align-items: center;
	gap: 16px;
	background: #fff;
	border: 1px solid var(--cas-border);
	border-radius: 12px;
	padding: 16px 18px;
	text-decoration: none;
	color: #1c1c1c;
	font-weight: 700;
	font-size: 17px;
	box-shadow: 0 4px 16px rgba(45, 54, 95, .05);
	transition: box-shadow .15s;
}
.cas-tool:hover { box-shadow: 0 8px 22px rgba(45, 54, 95, .12); }
.cas-tool-icon {
	flex: none;
	width: 50px;
	height: 50px;
	border-radius: 50%;
	background: #7fa98f;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #fff;
}
/* The page-sourced SVGs already include their own coloured circle. */
.cas-tool-icon--img {
	background: none;
	overflow: hidden;
}
.cas-tool-icon--img img { width: 50px; height: 50px; display: block; }

/* Discussions */
.cas-discussions { display: flex; flex-direction: column; gap: 14px; }
.cas-discussion {
	display: block;
	background: #fff;
	border: 1px solid var(--cas-border);
	border-radius: 12px;
	padding: 18px 20px;
	text-decoration: none;
	color: #1c1c1c;
	box-shadow: 0 4px 16px rgba(45, 54, 95, .05);
}
.cas-discussion:hover { box-shadow: 0 8px 22px rgba(45, 54, 95, .12); }
.cas-discussion-title { font-weight: 800; font-size: 17px; line-height: 1.3; margin: 0 0 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cas-discussion-meta { display: flex; align-items: center; gap: 8px; color: #6b7194; font-weight: 700; }

/* Recent searches */
.cas-recent { list-style: none; margin: 0; padding: 0; }
.cas-recent li { padding: 6px 0; cursor: pointer; font-size: 17px; color: #444; }
.cas-recent li:hover { color: var(--cas-navy); }
.cas-recent li b { font-weight: 800; color: #1c1c1c; }

.cas-empty { color: #8a90a6; font-size: 16px; padding: 8px 0; }

/* ---------- VIEW 3: CHAT ---------- */
.cas-view--chat.is-active { display: flex; flex-direction: column; height: 100vh; }
.cas-topbar--chat { flex: none; }
.cas-chat-scroll {
	flex: 1;
	overflow-y: auto;
	padding: 24px 20px 30px;
}
.cas-chat-context {
	max-width: 820px;
	margin: 0 auto 14px;
	text-align: center;
}
.cas-searched-label { display: block; font-weight: 700; color: var(--cas-navy); margin-bottom: 8px; }
.cas-back-results {
	border: 1px solid var(--cas-border);
	background: #fff;
	border-radius: 30px;
	padding: 8px 18px;
	font-size: 14px;
	cursor: pointer;
	color: #444;
}
.cas-back-results:hover { border-color: var(--cas-navy); color: var(--cas-navy); }

.cas-messages { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.cas-msg { display: flex; gap: 12px; max-width: 88%; }
.cas-msg-avatar { display: none; }
.cas-msg-bubble {
	background: #eef0f4;
	border-radius: 14px;
	padding: 16px 18px;
	font-size: 16px;
	line-height: 1.55;
}
.cas-msg-bubble ul { margin: 6px 0 0; padding-left: 20px; }
.cas-msg-bubble a { color: var(--cas-orange); font-weight: 700; }
.cas-msg--user { align-self: flex-end; flex-direction: row-reverse; }
.cas-msg--user .cas-msg-bubble { background: #e3e6f0; }
.cas-msg--bot .cas-msg-bubble { background: #eef0f4; }
.cas-msg-thinking .cas-msg-bubble { color: #8a90a6; font-style: italic; }

/* Article card inside chat */
.cas-chat-card {
	display: flex;
	gap: 14px;
	align-items: center;
	margin-top: 12px;
	background: #fff;
	border: 1px solid var(--cas-border);
	border-radius: 10px;
	padding: 12px;
	text-decoration: none;
	color: inherit;
}
.cas-chat-card img { width: 96px; height: 72px; border-radius: 6px; object-fit: cover; flex: none; background: #eef0f6; }
.cas-chat-card .cas-article-cat { margin-bottom: 4px; }
.cas-chat-card-title { font-weight: 800; font-size: 15px; line-height: 1.25; }

.cas-chat-form {
	flex: none;
	display: flex;
	align-items: center;
	gap: 8px;
	max-width: 860px;
	width: calc(100% - 40px);
	margin: 0 auto 22px;
	background: #fff;
	border: 1px solid var(--cas-border);
	border-radius: 40px;
	padding: 6px 8px 6px 16px;
	box-shadow: 0 2px 14px rgba(45, 54, 95, .08);
}
.cas-chat-input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 17px; padding: 12px 8px; min-width: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
	.cas-results-body { grid-template-columns: 1fr; gap: 32px; }
}
@media (max-width: 767px) {
	.cas-topbar { flex-wrap: wrap; padding: 16px 56px 16px 16px; gap: 12px; }
	.cas-chat-btn { width: 100%; justify-content: center; }
	.cas-results-body { padding: 24px 16px 64px; }
	.cas-article { flex-direction: column; align-items: flex-start; }
	.cas-article-thumb { width: 100%; height: 190px; }
	.cas-hero-title { margin-bottom: 26px; }
	.cas-close { top: 12px; right: 14px; }
}
