/* Noname chat assistant — inc/chat/, assets/js/chat.js.
   Brand language of the shop (tailwind.css): white surfaces, --primary #3B3B3B
   for text and buttons, --secondary #4ecdc4 as the accent (eyebrows, hover,
   selected state), Teko uppercase with wide tracking for headings and buttons,
   Inter for text, 8px radius on buttons, 1px grey borders on choices. */

.nn-chat {
	--chat-primary: var(--primary, #3b3b3b);
	--chat-accent: var(--secondary, #4ecdc4);
	--chat-accent-soft: var(--secondary-soft, rgba(78, 205, 196, 0.1));
	--chat-accent-glow: var(--secondary-glow, rgba(78, 205, 196, 0.35));
	--chat-accent-ink: #1f8a81; /* the accent, dark enough to read as text */
	--chat-light: var(--light, #f8f8f8);
	--chat-text: var(--text, #3b3b3b);
	--chat-muted: var(--text-light, #6b6b6b);
	--chat-line: rgba(59, 59, 59, 0.16);
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 900; /* closed: under the shop's own layers (filter sheet 1000, cookie banner 1200, drawers) */
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
	color: var(--chat-text);
}

/* The scroll-to-top button moves up out of the launcher's way. */
body.nn-chat-on .scroll-top { bottom: 96px; right: 30px; }

/* Launcher: a round button in the shop's primary colour (like the scroll-to-top
   button) with a small label beside it. The label is plain Inter: Teko sits
   too high in its line box to centre next to an icon. */
.nn-chat-launcher {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	font-family: inherit;
}
.nn-chat-launcher-label {
	padding: 9px 14px;
	border: 1px solid var(--chat-line);
	border-radius: 8px;
	background: #fff;
	color: var(--chat-primary);
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
	transition: border-color 0.2s ease, color 0.2s ease;
}
.nn-chat-launcher-icon {
	display: grid;
	place-items: center;
	flex: none;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: var(--chat-primary);
	color: #fff;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
	transition: background 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
}
.nn-chat-launcher-icon svg { display: block; }
.nn-chat-launcher:hover .nn-chat-launcher-icon { background: var(--chat-accent); transform: translateY(-2px); box-shadow: 0 8px 24px var(--chat-accent-glow); }
.nn-chat-launcher:hover .nn-chat-launcher-label { border-color: var(--chat-accent); }
.nn-chat-launcher:focus-visible { outline: none; }
.nn-chat-launcher:focus-visible .nn-chat-launcher-icon { outline: 2px solid var(--chat-accent); outline-offset: 3px; }
.nn-chat[data-state="open"] { z-index: 10005; } /* open: above the header and drawers, under toasts (10010) */
.nn-chat[data-state="open"] .nn-chat-launcher { display: none; }

.nn-chat-panel {
	position: absolute;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	width: 380px;
	height: min(620px, calc(100vh - 48px));
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
	overflow: hidden;
}
.nn-chat-panel[hidden] { display: none; }

/* Header: like the shop's dialogs — eyebrow in the accent, Teko title. */
.nn-chat-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 16px 14px 20px;
	border-bottom: 1px solid var(--chat-line);
	background: #fff;
}
.nn-chat-eyebrow {
	display: block;
	margin-bottom: 6px;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 3px;
	text-transform: uppercase;
	color: var(--chat-accent);
}
.nn-chat-title {
	margin: 0;
	font-family: 'Teko', 'Inter', sans-serif;
	font-size: 26px;
	font-weight: 600;
	line-height: 1;
	letter-spacing: 1.5px;
	text-transform: uppercase;
	color: var(--chat-primary);
}
.nn-chat-sub { margin: 4px 0 0; font-size: 12px; color: var(--chat-muted); }
.nn-chat-close {
	display: grid;
	place-items: center;
	flex: none;
	width: 34px;
	height: 34px;
	border: 0;
	border-radius: 50%;
	background: var(--chat-light);
	color: var(--chat-primary);
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}
.nn-chat-close:hover { background: var(--chat-primary); color: #fff; }
.nn-chat-close:focus-visible { outline: 2px solid var(--chat-accent); outline-offset: 2px; }

.nn-chat-log {
	position: relative; /* offsetTop of a message is measured from here */
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 18px 16px;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: #fff;
}

.nn-chat-msg {
	max-width: 88%;
	padding: 11px 14px;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.5;
	overflow-wrap: anywhere;
}
.nn-chat-msg p { margin: 0; }
.nn-chat-msg--bot {
	align-self: flex-start;
	background: var(--chat-light);
	border-bottom-left-radius: 4px;
}
.nn-chat-msg--me {
	align-self: flex-end;
	background: var(--chat-primary);
	color: #fff;
	border-bottom-right-radius: 4px;
	white-space: pre-line;
}
.nn-chat-msg-title {
	font-family: 'Teko', 'Inter', sans-serif;
	font-size: 19px;
	font-weight: 600;
	line-height: 1.05;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: var(--chat-primary);
	margin-bottom: 6px !important;
}
.nn-chat-msg-text { white-space: pre-line; }
.nn-chat-link {
	display: inline-block;
	margin-top: 8px;
	color: var(--chat-accent-ink);
	font-weight: 600;
	font-size: 13px;
	text-decoration: underline;
	text-underline-offset: 3px;
}
.nn-chat-link:hover { color: var(--chat-primary); }

/* Choices: the product page's size buttons. */
.nn-chat-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding-top: 2px;
}
.nn-chat-chip {
	padding: 9px 12px;
	border: 1px solid var(--chat-line);
	border-radius: 6px;
	background: #fff;
	color: var(--chat-primary);
	font: 600 12px/1.25 inherit;
	font-family: inherit;
	text-align: left;
	cursor: pointer;
	transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.nn-chat-chip:hover { border-color: var(--chat-accent); background: var(--chat-accent-soft); }
.nn-chat-chip:focus-visible { outline: 2px solid var(--chat-accent); outline-offset: 2px; }

.nn-chat-card {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 14px;
	background: var(--chat-light);
	border-radius: 12px;
}
.nn-chat-label {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: var(--chat-muted);
}
.nn-chat-field {
	width: 100%;
	box-sizing: border-box;
	padding: 10px 12px;
	border: 1px solid var(--chat-line);
	border-radius: 8px;
	font: 14px/1.4 inherit;
	font-family: inherit;
	color: var(--chat-primary);
	background: #fff;
	resize: vertical;
}
.nn-chat-field:focus { outline: none; border-color: var(--chat-accent); box-shadow: 0 0 0 3px var(--chat-accent-soft); }
.nn-chat-note { margin: 2px 0 4px; font-size: 12px; color: var(--chat-muted); }
.nn-chat-submit {
	align-self: flex-start;
	height: 42px;
	padding: 0 22px;
	border: 0;
	border-radius: 8px;
	background: var(--chat-primary);
	color: #fff;
	font-family: 'Teko', 'Inter', sans-serif;
	font-size: 16px;
	font-weight: 600;
	letter-spacing: 1.6px;
	text-transform: uppercase;
	cursor: pointer;
	transition: background 0.2s ease, box-shadow 0.2s ease;
}
.nn-chat-submit:hover { background: var(--chat-accent); box-shadow: 0 6px 20px var(--chat-accent-glow); }
.nn-chat-submit:focus-visible { outline: 2px solid var(--chat-accent); outline-offset: 2px; }
.nn-chat-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }

.nn-chat-typing { align-self: flex-start; display: flex; gap: 4px; padding: 13px 14px; background: var(--chat-light); border-radius: 12px; border-bottom-left-radius: 4px; }
.nn-chat-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--chat-accent); animation: nnChatDot 1s infinite ease-in-out; }
.nn-chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.nn-chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes nnChatDot { 0%, 80%, 100% { opacity: 0.35; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.nn-chat-input {
	display: flex;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid var(--chat-line);
	background: #fff;
}
.nn-chat-input input {
	flex: 1;
	min-width: 0;
	height: 44px;
	padding: 0 14px;
	border: 1px solid var(--chat-line);
	border-radius: 8px;
	font: 14px inherit;
	font-family: inherit;
	color: var(--chat-primary);
	background: #fff;
}
.nn-chat-input input::placeholder { color: var(--chat-muted); }
.nn-chat-input input:focus { outline: none; border-color: var(--chat-accent); box-shadow: 0 0 0 3px var(--chat-accent-soft); }
.nn-chat-input button {
	display: grid;
	place-items: center;
	flex: none;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 8px;
	background: var(--chat-primary);
	color: #fff;
	cursor: pointer;
	transition: background 0.2s ease, box-shadow 0.2s ease;
}
.nn-chat-input button:hover { background: var(--chat-accent); box-shadow: 0 6px 20px var(--chat-accent-glow); }
.nn-chat-input button:focus-visible { outline: 2px solid var(--chat-accent); outline-offset: 2px; }

@media (max-width: 600px) {
	.nn-chat { right: 16px; bottom: 16px; }
	.nn-chat-launcher-label { display: none; }
	.nn-chat[data-state="open"] { inset: 0; right: 0; bottom: 0; }
	.nn-chat-panel { position: fixed; inset: 0; width: auto; height: auto; border-radius: 0; }
	body.nn-chat-on .scroll-top { bottom: 84px; }
	.nn-chat-input input, .nn-chat-field { font-size: 16px; } /* under 16px iOS zooms the page on focus */
}

@media (prefers-reduced-motion: reduce) {
	.nn-chat-launcher-icon, .nn-chat-launcher-label, .nn-chat-chip, .nn-chat-submit, .nn-chat-close, .nn-chat-input button { transition: none; }
	.nn-chat-launcher:hover .nn-chat-launcher-icon { transform: none; }
	.nn-chat-typing span { animation: none; }
}
