/* =============================================================================
   ISCAE Chatbot — Styles
   Palette : #0B1F4B navy | #DAB115 gold | #FEF9E7 warm light
   ============================================================================= */

#iscae-chatbot-wrapper {
	--iscae-navy      : #0B1F4B;
	--iscae-navy-mid  : #162d6e;
	--iscae-navy-dark : #071538;
	--iscae-gold      : #DAB115;
	--iscae-gold-dark : #b8940f;
	--iscae-warm      : #FEF9E7;
	--iscae-warm-dark : #f0e8c8;
	--iscae-text      : #1a1a1a;
	--iscae-muted     : #6b6349;

	position: fixed !important;
	bottom: 24px !important;
	right: 24px !important;
	top: auto !important;
	left: auto !important;
	z-index: 2147483647 !important;
	font-family: 'Segoe UI', Arial, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	transform: none !important;
	filter: none !important;
	will-change: unset !important;
}

/* --------------------------------------------------------------------------
   Floating toggle — 150 px, transparent, no background
   -------------------------------------------------------------------------- */

#iscae-chatbot-toggle {
	width: 150px;
	height: 150px;
	border-radius: 50%;
	background: transparent !important;
	border: none !important;
	box-shadow: none !important;
	padding: 0;
	margin: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s ease;
	outline: none;
	-webkit-tap-highlight-color: transparent;
	user-select: none;
}

#iscae-chatbot-toggle:hover {
	transform: scale(1.06);
}

#iscae-chatbot-toggle:focus-visible {
	outline: 3px solid var(--iscae-gold);
	outline-offset: 4px;
	border-radius: 50%;
}

#iscae-chatbot-icon {
	width: 150px;
	height: 150px;
	border-radius: 50%;
	object-fit: contain;
	display: block;
	background: transparent !important;
}

/* --------------------------------------------------------------------------
   Chat window — larger
   -------------------------------------------------------------------------- */

#iscae-chatbot-window {
	display: none;
	flex-direction: column;
	position: absolute;
	bottom: 165px;
	right: 0;
	width: 420px;
	max-width: calc(100vw - 32px);
	max-height: 600px;
	background: #ffffff;
	border-radius: 16px;
	box-shadow: 0 12px 48px rgba(11, 31, 75, 0.28);
	overflow: hidden;
	animation: iscae-slide-up 0.22s ease;
}

#iscae-chatbot-window.iscae-open {
	display: flex;
}

@keyframes iscae-slide-up {
	from { opacity: 0; transform: translateY(14px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   Header — gradient, large avatar left, two-line title
   -------------------------------------------------------------------------- */

#iscae-chatbot-header {
	background: linear-gradient(135deg, var(--iscae-navy) 0%, var(--iscae-navy-mid) 100%);
	padding: 16px 16px 16px 18px;
	display: flex;
	align-items: center;
	gap: 14px;
	flex-shrink: 0;
	border-bottom: 3px solid var(--iscae-gold);
	position: relative;
}

#iscae-header-icon {
	width: 58px;
	height: 58px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
	background: transparent !important;
	border: 2.5px solid var(--iscae-gold);
	box-shadow: 0 2px 10px rgba(218, 177, 21, 0.35);
}

#iscae-header-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 1;
}

#iscae-header-sub {
	font-size: 12px;
	font-weight: 400;
	color: rgba(254, 249, 231, 0.75);
	letter-spacing: 0.3px;
	line-height: 1.3;
}

#iscae-header-name {
	font-size: 20px;
	font-weight: 700;
	color: var(--iscae-warm);
	letter-spacing: 0.2px;
	line-height: 1.2;
}

#iscae-chatbot-close {
	color: var(--iscae-warm);
	font-size: 18px;
	cursor: pointer;
	line-height: 1;
	padding: 4px 8px;
	opacity: 0.7;
	transition: opacity 0.15s, color 0.15s;
	outline: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
	flex-shrink: 0;
}

#iscae-chatbot-close:hover {
	opacity: 1;
	color: var(--iscae-gold);
}

#iscae-chatbot-close:focus-visible {
	outline: 2px solid var(--iscae-gold);
	border-radius: 4px;
}

/* --------------------------------------------------------------------------
   CNDP Consent panel
   -------------------------------------------------------------------------- */

#iscae-chatbot-consent {
	padding: 32px 24px 28px;
	display: flex;
	flex-direction: column;
	gap: 24px;
	background: var(--iscae-warm);
	flex: 1;
}

#iscae-consent-text {
	font-size: 14px;
	color: var(--iscae-navy);
	line-height: 1.7;
	text-align: center;
}

#iscae-consent-buttons {
	display: flex;
	gap: 14px;
	justify-content: center;
}

.iscae-btn {
	padding: 12px 30px;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
	font-family: inherit;
	outline: none;
	text-align: center;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}

.iscae-btn:active {
	transform: scale(0.97);
}

.iscae-btn:focus-visible {
	outline: 3px solid var(--iscae-gold);
	outline-offset: 2px;
}

.iscae-btn-accept {
	background: var(--iscae-gold);
	color: var(--iscae-navy);
	box-shadow: 0 2px 8px rgba(218, 177, 21, 0.38);
}

.iscae-btn-accept:hover {
	background: var(--iscae-gold-dark);
	box-shadow: 0 4px 12px rgba(218, 177, 21, 0.48);
}

.iscae-btn-refuse {
	background: var(--iscae-warm-dark);
	color: var(--iscae-muted);
}

.iscae-btn-refuse:hover {
	background: #e0d4a8;
	color: var(--iscae-navy);
}

/* --------------------------------------------------------------------------
   Chat body
   -------------------------------------------------------------------------- */

#iscae-chatbot-body {
	display: none;
	flex-direction: column;
	flex: 1;
	overflow: hidden;
}

/* Messages scroll area */
#iscae-chatbot-messages {
	flex: 1;
	overflow-y: auto;
	padding: 18px 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	background: var(--iscae-warm);
	min-height: 220px;
	max-height: 400px;
	scroll-behavior: smooth;
}

#iscae-chatbot-messages::-webkit-scrollbar {
	width: 5px;
}
#iscae-chatbot-messages::-webkit-scrollbar-thumb {
	background: var(--iscae-gold-dark);
	border-radius: 4px;
	opacity: 0.5;
}

/* Message bubbles */
.iscae-msg {
	max-width: 82%;
	padding: 11px 15px;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.6;
	word-break: break-word;
}

.iscae-msg-bot {
	background: #ffffff;
	color: var(--iscae-navy);
	border: 1px solid var(--iscae-warm-dark);
	align-self: flex-start;
	border-bottom-left-radius: 3px;
	box-shadow: 0 1px 4px rgba(11, 31, 75, 0.07);
}

.iscae-msg-user {
	background: var(--iscae-navy);
	color: var(--iscae-warm);
	align-self: flex-end;
	border-bottom-right-radius: 3px;
	box-shadow: 0 1px 5px rgba(11, 31, 75, 0.2);
}

.iscae-msg-typing {
	background: var(--iscae-warm-dark);
	color: var(--iscae-muted);
	align-self: flex-start;
	border-bottom-left-radius: 3px;
	font-style: italic;
	letter-spacing: 3px;
}

/* --------------------------------------------------------------------------
   Input area
   -------------------------------------------------------------------------- */

#iscae-chatbot-input-area {
	display: flex;
	align-items: flex-end;
	padding: 12px 14px;
	background: #ffffff;
	border-top: 2px solid var(--iscae-warm-dark);
	gap: 10px;
	flex-shrink: 0;
}

#iscae-chatbot-input {
	flex: 1;
	border: 1.5px solid var(--iscae-warm-dark);
	border-radius: 10px;
	padding: 10px 14px;
	font-size: 14px;
	font-family: inherit;
	resize: none;
	outline: none;
	max-height: 100px;
	overflow-y: auto;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
	line-height: 1.45;
	color: var(--iscae-navy);
	background: var(--iscae-warm);
}

#iscae-chatbot-input:focus {
	border-color: var(--iscae-gold);
	box-shadow: 0 0 0 3px rgba(218, 177, 21, 0.18);
}

#iscae-chatbot-input:disabled {
	background: var(--iscae-warm-dark);
	color: var(--iscae-muted);
	cursor: not-allowed;
}

/* Send — gold circle with navy arrow */
#iscae-chatbot-send {
	width: 42px;
	height: 42px;
	background: var(--iscae-gold);
	color: var(--iscae-navy);
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease, transform 0.1s ease;
	flex-shrink: 0;
	outline: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
	box-shadow: 0 3px 8px rgba(218, 177, 21, 0.4);
}

#iscae-chatbot-send:hover {
	background: var(--iscae-gold-dark);
}

#iscae-chatbot-send:active {
	transform: scale(0.93);
}

#iscae-chatbot-send.iscae-disabled {
	background: var(--iscae-warm-dark);
	color: var(--iscae-muted);
	cursor: not-allowed;
	pointer-events: none;
	box-shadow: none;
}

#iscae-chatbot-send:focus-visible {
	outline: 3px solid var(--iscae-navy);
	outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Refused panel
   -------------------------------------------------------------------------- */

#iscae-chatbot-refused-msg {
	padding: 32px 24px;
	font-size: 14px;
	color: var(--iscae-muted);
	text-align: center;
	line-height: 1.7;
	background: var(--iscae-warm);
	flex: 1;
}

/* --------------------------------------------------------------------------
   Responsive — mobile
   -------------------------------------------------------------------------- */

@media (max-width: 480px) {
	#iscae-chatbot-wrapper {
		bottom: 12px !important;
		right: 12px !important;
	}

	#iscae-chatbot-toggle {
		width: 100px;
		height: 100px;
	}

	#iscae-chatbot-icon {
		width: 100px;
		height: 100px;
	}

	#iscae-chatbot-window {
		width: calc(100vw - 24px);
		right: 0;
		bottom: 118px;
		max-height: 75vh;
	}

	#iscae-chatbot-messages {
		max-height: calc(75vh - 200px);
	}
}
