/* ADNOK Chat — floating chat window and client account page.
 * Colours and fonts come from the active theme (theme.json presets), with fallbacks. */

.adnok-chat,
.adnok-chat-account {
	--ac-navy: var(--wp--preset--color--navy, #0C1A2E);
	--ac-deep: var(--wp--preset--color--deep, #13294A);
	--ac-brand: var(--wp--preset--color--brand, #2A58A3);
	--ac-amber: var(--wp--preset--color--amber, #E39A2D);
	--ac-amber-light: var(--wp--preset--color--amber-light, #E8B66A);
	--ac-muted: var(--wp--preset--color--muted, #46546A);
	--ac-mist: var(--wp--preset--color--mist, #B9C6D6);
	--ac-line: var(--wp--preset--color--line, #D5DCE6);
	--ac-light: var(--wp--preset--color--light, #F4F6F9);
	--ac-field: #C9D2DE;
	--ac-font: var(--wp--preset--font-family--body, "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif);
	--ac-font-display: var(--wp--preset--font-family--display, Alexandria, "Segoe UI", Tahoma, sans-serif);
	--ac-radius: 4px;
	font-family: var(--ac-font);
	color: var(--ac-navy);
	-webkit-font-smoothing: antialiased;
}

.adnok-chat *,
.adnok-chat *::before,
.adnok-chat *::after,
.adnok-chat-account *,
.adnok-chat-account *::before,
.adnok-chat-account *::after { box-sizing: border-box; }

.adnok-chat [hidden],
.adnok-chat-account [hidden] { display: none !important; }

:where(.adnok-chat, .adnok-chat-account) button {
	margin: 0; padding: 0; border: 0; background: none;
	font: inherit; color: inherit; letter-spacing: normal; text-transform: none;
	cursor: pointer; -webkit-tap-highlight-color: transparent;
}
:where(.adnok-chat, .adnok-chat-account) :where(input, textarea) { margin: 0; font: inherit; color: inherit; }
:where(.adnok-chat) :where(h2, h3, p) { margin: 0; }
:where(.adnok-chat) img { max-width: none; }
.adnok-chat :focus-visible,
.adnok-chat-account :focus-visible { outline: 2px solid var(--ac-amber); outline-offset: 2px; }

.ac-ico { display: block; flex-shrink: 0; }
.ac-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

html.ac-locked, html.ac-locked body { overflow: hidden !important; }

/* ---------- Floating button ---------- */

.adnok-chat { position: relative; z-index: 99990; font-size: 15px; line-height: 1.55; }

.ac-launcher {
	position: fixed; z-index: 99990;
	inset-block-end: max(22px, env(safe-area-inset-bottom));
	inset-inline-end: 22px;
	width: 60px; height: 60px; border-radius: 50%;
	display: grid; place-items: center;
	background: var(--ac-amber); color: var(--ac-navy);
	box-shadow: 0 16px 32px -14px rgba(12, 26, 46, .7), 0 2px 6px rgba(12, 26, 46, .2);
	transition: transform .2s ease, background-color .2s ease;
}
.ac-launcher:hover { background: var(--ac-amber-light); transform: translateY(-2px); }
.ac-launcher .ac-ico { grid-area: 1 / 1; transition: transform .22s ease, opacity .22s ease; }
.ac-launcher .ac-ico--down { opacity: 0; transform: rotate(-90deg) scale(.6); }
.adnok-chat.is-open .ac-launcher .ac-ico--chat { opacity: 0; transform: rotate(90deg) scale(.6); }
.adnok-chat.is-open .ac-launcher .ac-ico--down { opacity: 1; transform: none; }
.ac-launcher.is-nudge { animation: ac-nudge .9s ease 2; }
@keyframes ac-nudge { 0%, 100% { transform: none; } 30% { transform: translateY(-5px) rotate(-6deg); } 60% { transform: translateY(0) rotate(5deg); } }

.ac-badge {
	position: absolute; inset-block-start: -3px; inset-inline-end: -3px;
	min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
	background: var(--ac-navy); color: #fff;
	font-family: var(--ac-font-display); font-size: 12px; font-weight: 600; line-height: 22px; text-align: center;
	box-shadow: 0 0 0 2px #fff;
}

/* ---------- Window ---------- */

.ac-panel {
	position: fixed; z-index: 99991;
	inset-block-end: calc(max(22px, env(safe-area-inset-bottom)) + 74px);
	inset-inline-end: 22px;
	width: 390px; max-width: calc(100vw - 32px);
	height: min(660px, calc(100vh - 124px));
	height: min(660px, calc(100dvh - 124px));
	display: flex; flex-direction: column; overflow: hidden;
	background: #fff; border-radius: 10px;
	box-shadow: 0 34px 70px -28px rgba(12, 26, 46, .55), 0 0 0 1px rgba(12, 26, 46, .07);
	opacity: 0; transform: translateY(14px) scale(.98); transform-origin: bottom right;
	transition: opacity .2s ease, transform .2s ease;
}
[dir="rtl"] .ac-panel { transform-origin: bottom left; }
.adnok-chat.is-visible .ac-panel { opacity: 1; transform: none; }

@media (max-width: 640px) {
	.ac-panel {
		inset: 0; width: 100%; max-width: none; height: 100%; height: 100dvh;
		border-radius: 0; transform: translateY(24px);
	}
	.adnok-chat.is-open .ac-launcher { display: none; }
}
@media (prefers-reduced-motion: reduce) {
	.ac-panel, .ac-launcher, .ac-launcher .ac-ico { transition: none; }
	.ac-launcher.is-nudge { animation: none; }
}

/* Header */
.ac-head {
	display: flex; align-items: center; gap: 12px; flex-shrink: 0;
	padding-block: 14px; padding-inline: 16px 8px;
	background: var(--ac-navy); color: #fff;
	border-bottom: 3px solid var(--ac-amber);
}
@media (max-width: 640px) { .ac-head { padding-top: max(14px, env(safe-area-inset-top)); } }
.ac-head__text { flex: 1; min-width: 0; }
.ac-head__title {
	font-family: var(--ac-font-display); font-size: 16px; font-weight: 600; line-height: 1.3;
	color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ac-head__note { display: flex; align-items: center; gap: 7px; margin-top: 2px; font-size: 12.5px; line-height: 1.4; color: var(--ac-mist); }
.ac-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ac-amber); flex-shrink: 0; }
.ac-head__actions { display: flex; align-items: center; gap: 2px; }

.ac-icon-btn {
	width: 40px; height: 40px; border-radius: 8px;
	display: grid; place-items: center; color: #fff; opacity: .85;
	transition: background-color .15s, opacity .15s;
}
.ac-icon-btn:hover { background: rgba(255, 255, 255, .1); opacity: 1; }

.ac-avatar {
	display: inline-grid; place-items: center; flex-shrink: 0; border-radius: 50%;
	font-family: var(--ac-font-display); font-weight: 600; line-height: 1; overflow: hidden;
}
.ac-avatar--lg { width: 42px; height: 42px; font-size: 15px; }
.ac-avatar--sm { width: 28px; height: 28px; font-size: 11px; }
.ac-avatar--team { background: var(--ac-deep); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.ac-avatar--team img { display: block; width: 64%; height: auto; }
.ac-avatar--user { background: var(--ac-amber); color: var(--ac-navy); }

/* Menu */
.ac-menu { position: relative; }
.ac-menu__list {
	position: absolute; z-index: 5; inset-inline-end: 0; top: calc(100% + 6px);
	min-width: 230px; padding: 6px; border-radius: 8px;
	background: #fff; color: var(--ac-navy);
	box-shadow: 0 18px 40px -14px rgba(12, 26, 46, .4), 0 0 0 1px rgba(12, 26, 46, .08);
}
.ac-menu__who { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--ac-light); font-size: 12.5px; color: var(--ac-muted); }
.ac-menu__who strong { font-size: 14px; font-weight: 600; color: var(--ac-navy); overflow-wrap: anywhere; }
.ac-menu__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border-radius: 6px; font-size: 14px; text-align: start; }
.ac-menu__item:hover { background: var(--ac-light); }

/* Views */
.ac-body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--ac-light); }
.ac-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ac-view--loading { align-items: center; justify-content: center; }
.ac-spinner {
	width: 28px; height: 28px; border-radius: 50%;
	border: 3px solid var(--ac-line); border-top-color: var(--ac-brand);
	animation: ac-spin .8s linear infinite;
}
@keyframes ac-spin { to { transform: rotate(360deg); } }

.ac-scroll { flex: 1; overflow-y: auto; padding: 22px 20px 24px; background: #fff; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.ac-intro { margin-bottom: 18px; }
.ac-intro__title { font-family: var(--ac-font-display); font-size: 20px; font-weight: 700; line-height: 1.35; color: var(--ac-navy); }
.ac-intro__text { margin-top: 6px; font-size: 14.5px; line-height: 1.65; color: var(--ac-muted); }

.ac-notice {
	margin: 0 0 14px; padding: 10px 14px; border-radius: 6px;
	background: #EEF3FB; color: var(--ac-deep); font-size: 14px; line-height: 1.5;
	border-inline-start: 3px solid var(--ac-brand);
}
.ac-notice--warn { background: #FFF6E8; color: #6B4206; border-color: var(--ac-amber); }

/* ---------- Forms (window and account page) ---------- */

.ac-tabs {
	display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
	margin-bottom: 18px; padding: 4px; border-radius: 8px; background: var(--ac-light);
}
.ac-tab {
	padding: 9px 10px; border-radius: 6px;
	font-family: var(--ac-font-display); font-size: 14px; font-weight: 600; color: var(--ac-muted);
	transition: background-color .15s, color .15s;
}
.ac-tab:hover { color: var(--ac-navy); }
.ac-tab[aria-selected="true"] { background: #fff; color: var(--ac-navy); box-shadow: 0 1px 3px rgba(12, 26, 46, .14); }

.ac-form { display: flex; flex-direction: column; gap: 14px; }
.ac-form__title { margin: 0; font-family: var(--ac-font-display); font-size: 18px; font-weight: 700; line-height: 1.35; }
.ac-form__text { margin: -6px 0 0; font-size: 14px; line-height: 1.6; color: var(--ac-muted); }

.ac-field { display: flex; flex-direction: column; gap: 6px; }
.ac-field label { font-size: 14px; font-weight: 600; line-height: 1.4; color: var(--ac-navy); }
.ac-field input {
	width: 100%; height: 48px; padding: 0 14px;
	border: 1px solid var(--ac-field); border-radius: var(--ac-radius);
	background: #fff; color: var(--ac-navy); font-size: 16px; line-height: 1.4;
	transition: border-color .15s, box-shadow .15s;
}
.ac-field input:focus { outline: none; border-color: var(--ac-brand); box-shadow: 0 0 0 3px rgba(42, 88, 163, .18); }
.ac-field input[aria-invalid="true"] { border-color: #C0392B; }
[dir="rtl"] .ac-field input[dir="ltr"] { text-align: right; }

.ac-pass { position: relative; }
.ac-pass input { padding-inline-end: 48px; }
.ac-pass__toggle {
	position: absolute; inset-block: 0; inset-inline-end: 0; width: 46px;
	display: grid; place-items: center; color: var(--ac-muted);
}
.ac-pass__toggle:hover { color: var(--ac-navy); }
.ac-pass__toggle .ac-ico--eye-off,
.ac-pass__toggle[aria-pressed="true"] .ac-ico--eye { display: none; }
.ac-pass__toggle[aria-pressed="true"] .ac-ico--eye-off { display: block; }
.ac-hint { margin: 0; font-size: 12.5px; color: var(--ac-muted); }

.ac-row { display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap; }
.ac-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.ac-check input { width: 18px; height: 18px; accent-color: var(--ac-navy); }
.ac-link { color: var(--ac-brand); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.ac-link:hover { color: var(--ac-deep); }
.ac-link--back { align-self: center; }

.ac-error, .ac-success { margin: 0; padding: 10px 14px; border-radius: 6px; font-size: 14px; line-height: 1.5; }
.ac-error { background: #FBEAEA; color: #8A1F1F; }
.ac-success { background: #E7F3EC; color: #1E5B3A; }

.ac-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 50px; padding: 0 24px; border-radius: var(--ac-radius);
	font-family: var(--ac-font-display); font-size: 16px; font-weight: 600; line-height: 1.2;
	text-decoration: none; transition: background-color .15s, color .15s, box-shadow .15s, opacity .15s;
}
.ac-btn--primary, .ac-btn--primary:visited { background: var(--ac-navy); color: #fff; }
.ac-btn--primary:hover { background: var(--ac-deep); color: #fff; }
.ac-btn--ghost { background: transparent; color: var(--ac-navy); box-shadow: inset 0 0 0 1.5px var(--ac-line); }
.ac-btn--ghost:hover { box-shadow: inset 0 0 0 1.5px var(--ac-navy); }
.ac-btn--block { width: 100%; }
.ac-btn[disabled], .ac-btn.is-busy { opacity: .65; cursor: progress; }
.ac-fine { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--ac-muted); text-align: center; }
.ac-hp { position: absolute !important; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }

.ac-whatsapp {
	display: flex; align-items: center; justify-content: center; gap: 8px;
	margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--ac-light);
	color: var(--ac-muted); font-size: 14px; text-decoration: none;
}
.ac-whatsapp:hover { color: var(--ac-navy); }

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

.ac-offline { margin: 0; padding: 8px 14px; background: #FFF6E8; color: #6B4206; font-size: 13px; text-align: center; }

.ac-log {
	flex: 1; min-height: 0; overflow-y: auto;
	display: flex; flex-direction: column;
	padding: 14px 14px 10px;
	overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
.ac-log:focus { outline: none; }
.ac-log > .ac-spinner { margin: auto; }
.ac-older { align-self: center; min-height: 24px; margin: 0 0 6px; font-size: 12px; color: var(--ac-muted); }

.ac-day {
	align-self: center; margin: 14px 0 6px; padding: 3px 12px; border-radius: 999px;
	background: rgba(12, 26, 46, .06); color: var(--ac-muted); font-size: 12px; font-weight: 500;
}

.ac-msg { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; margin-top: 3px; }
.ac-msg.is-first { margin-top: 12px; }
.ac-msg--team { align-self: flex-start; padding-inline-end: 36px; }
.ac-msg--mine { align-self: flex-end; justify-content: flex-end; padding-inline-start: 48px; }
.ac-msg__avatar { width: 28px; flex-shrink: 0; }
.ac-msg__wrap { display: flex; flex-direction: column; min-width: 0; max-width: 100%; }
.ac-msg--mine .ac-msg__wrap { align-items: flex-end; }

.ac-bubble {
	max-width: 100%; padding: 9px 13px 6px; border-radius: 14px;
	font-size: 15px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere;
}
.ac-msg--team .ac-bubble { background: #fff; color: var(--ac-navy); border: 1px solid #E3E8EF; box-shadow: 0 1px 2px rgba(12, 26, 46, .05); }
.ac-msg--mine .ac-bubble { background: var(--ac-deep); color: #fff; }
.ac-msg--team.is-last .ac-bubble { border-end-start-radius: 4px; }
.ac-msg--mine.is-last .ac-bubble { border-end-end-radius: 4px; }
.ac-bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.ac-time { display: block; margin-top: 2px; font-size: 11px; line-height: 1.3; opacity: .62; text-align: end; }
.ac-msg.is-pending .ac-bubble { opacity: .72; }
.ac-msg.is-failed .ac-bubble { background: #8A2A2A; cursor: pointer; }

.ac-status { display: inline-flex; align-items: center; gap: 4px; margin: 4px 4px 0; font-size: 11.5px; color: var(--ac-muted); }
.ac-status .ac-ico { width: 15px; height: 15px; color: var(--ac-brand); }
.ac-status.is-failed { color: #B42318; font-weight: 600; cursor: pointer; }

/* Composer */
.ac-composer {
	position: relative; flex-shrink: 0;
	display: flex; align-items: flex-end; gap: 8px;
	padding-block: 10px; padding-inline: 14px 10px;
	background: #fff; border-top: 1px solid var(--ac-line);
}
@media (max-width: 640px) { .ac-composer { padding-bottom: max(10px, env(safe-area-inset-bottom)); } }
.ac-composer__input {
	flex: 1; min-height: 44px; max-height: 132px; padding: 11px 2px;
	border: 0; outline: none; resize: none; background: transparent;
	font-size: 16px; line-height: 1.4; color: var(--ac-navy);
}
.ac-composer__input::placeholder { color: #8391A5; opacity: 1; }
.ac-composer__input:focus, .ac-composer__input:focus-visible { outline: none; }
.ac-composer:focus-within { border-top-color: var(--ac-brand); box-shadow: inset 0 1px 0 var(--ac-brand); }
.ac-send {
	width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
	display: grid; place-items: center;
	background: var(--ac-navy); color: #fff;
	transition: background-color .15s;
}
.ac-send:hover:not([disabled]) { background: var(--ac-brand); }
.ac-send[disabled] { background: var(--ac-line); cursor: default; }
[dir="rtl"] .ac-send .ac-ico { transform: scaleX(-1); }
.ac-counter {
	position: absolute; inset-block-start: -24px; inset-inline-end: 12px;
	padding: 1px 7px; border-radius: 4px; background: #fff;
	font-size: 11.5px; color: var(--ac-muted); box-shadow: 0 0 0 1px var(--ac-line);
}

/* Team member view */
.ac-staff { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: auto; padding: 28px 24px; text-align: center; }
.ac-staff__icon {
	width: 58px; height: 58px; margin-bottom: 4px; border-radius: 50%;
	display: grid; place-items: center; background: #fff; color: var(--ac-brand);
	box-shadow: 0 1px 3px rgba(12, 26, 46, .12);
}
.ac-staff .ac-btn { margin-top: 10px; }
.ac-pill {
	display: inline-block; min-width: 22px; padding: 0 8px; border-radius: 11px;
	background: var(--ac-amber); color: var(--ac-navy); font-size: 12px; line-height: 22px;
}

/* ---------- Client account page ---------- */

.adnok-chat-account { font-size: 16px; line-height: 1.7; margin-block: 0 !important; }
:where(.adnok-chat-account) :where(h1, h2, h3, p) { margin: 0; }
.aca-wrap { box-sizing: content-box !important; max-width: 1280px; margin-inline: auto; padding-inline: clamp(20px, 4vw, 48px); }

.aca-hero {
	position: relative; overflow: hidden;
	background: var(--ac-navy); color: #fff;
	padding-block: clamp(64px, 8vw, 112px) clamp(132px, 13vw, 176px);
}
.aca-eyebrow { margin-bottom: 14px; font-size: 15px; font-weight: 500; color: var(--ac-amber-light); }
.aca-title {
	max-width: 20ch; color: #fff;
	font-family: var(--ac-font-display); font-size: clamp(34px, 4.2vw, 56px); font-weight: 700; line-height: 1.22;
	text-wrap: balance;
}
.aca-lead { max-width: 56ch; margin-top: 18px; color: var(--ac-mist); font-size: clamp(16px, 1.4vw, 19px); line-height: 1.75; }

.aca-main { background: var(--ac-light); padding-bottom: clamp(64px, 8vw, 112px); }
.aca-grid {
	position: relative; z-index: 1;
	display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); gap: 24px; align-items: start;
	margin-top: calc(-1 * clamp(88px, 9vw, 120px));
}
.aca-card {
	width: 100%; max-width: 640px;
	padding: clamp(24px, 4vw, 44px); border-radius: 6px;
	background: #fff; box-shadow: 0 24px 48px -28px rgba(12, 26, 46, .4);
}
.aca-side { padding: clamp(24px, 3vw, 34px); border-radius: 6px; background: var(--ac-deep); color: #fff; }
.aca-side__title { margin-bottom: 18px; color: #fff; font-family: var(--ac-font-display); font-size: 20px; font-weight: 600; line-height: 1.35; }
.aca-points { display: flex; flex-direction: column; gap: 14px; margin: 0; padding: 0; list-style: none; }
.aca-points li { display: flex; align-items: flex-start; gap: 12px; margin: 0; color: #DCE4EE; font-size: 15.5px; line-height: 1.6; }
.aca-points .ac-ico { margin-top: 3px; color: var(--ac-amber); }
.aca-side__link { display: inline-flex; align-items: center; gap: 8px; margin-top: 22px; color: var(--ac-amber-light); font-weight: 600; text-decoration: none; }
.aca-side__link:hover { color: #fff; }

.aca-me { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; padding-bottom: 22px; border-bottom: 1px solid var(--ac-light); }
.aca-me .ac-avatar--lg { width: 58px; height: 58px; font-size: 20px; }
.aca-me__text { display: flex; flex-direction: column; min-width: 0; }
.aca-me__label { font-size: 13px; color: var(--ac-muted); }
.aca-me__name { font-family: var(--ac-font-display); font-size: 20px; font-weight: 600; line-height: 1.35; }
.aca-me__email { font-size: 14.5px; color: var(--ac-muted); overflow-wrap: anywhere; }
[dir="rtl"] .aca-me__email { text-align: right; }
.aca-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.adnok-chat-account .ac-fine { text-align: start; }

@media (max-width: 900px) {
	.aca-grid { grid-template-columns: 1fr; }
	.aca-card { max-width: none; }
}
@media (max-width: 480px) {
	.aca-actions .ac-btn { width: 100%; }
}
