/*!
 * =============================================================================
 * GPS HEADER
 * =============================================================================
 * PURPOSE      : Styling voor het Sportlist AI-chat widget. Mobile-first,
 *                gebruikt tokens.css-variabelen, ondersteunt full markdown,
 *                streaming-dots, en sportschool-card markup.
 *
 * PATH         : wp-content/plugins/sportlist-gemini-proxy/assets/chat.css
 *
 * DEPENDENCIES : tokens.css (theme) voor --primary-*, --neutral-*, --radius-*,
 *                --shadow-*, --space-*, --font-sans. Werkt ook zonder
 *                (graceful fallback op hex / px).
 *
 * =============================================================================
 * SECTIONOVERZICHT
 * =============================================================================
 *   1. LAUNCHER
 *   2. WIDGET FRAME
 *   3. HEADER
 *   4. BODY + BERICHTEN
 *   5. MARKDOWN INHOUD
 *   6. TOOL-STATUS + TYPING DOTS
 *   7. SUGGESTIONS (CHIPS) + FOLLOWUPS
 *   8. SPORTSCHOOL-CARDS
 *   9. LEAD-CAPTURE FORM
 *   10. INPUT
 *   11. RESPONSIVE / FULL-SCREEN MOBIEL
 *   12. REDUCED MOTION + UTILITIES
 *
 * @package Sportlist
 */

/* ============================================================
   1. LAUNCHER
   ============================================================ */
.sgp-launcher {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 9998;
	width: 60px;
	height: 60px;
	border: none;
	border-radius: var(--radius-circle, 50%);
	background: var(--primary-500, #004AAD);
	color: #fff;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--shadow-raised, 0 8px 24px rgba(16, 18, 24, 0.20));
	transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.sgp-launcher:hover {
	background: var(--primary-600, #003F93);
	transform: translateY(-2px);
	box-shadow: var(--shadow-hero, 0 16px 48px rgba(16, 18, 24, 0.20));
}
.sgp-launcher:focus-visible {
	outline: none;
	box-shadow: 0 0 0 4px rgba(0, 74, 173, 0.35), var(--shadow-raised, 0 8px 24px rgba(16, 18, 24, 0.20));
}
.sgp-launcher[aria-expanded="true"] {
	transform: scale(0.92);
	opacity: 0.7;
}
.sgp-launcher-icon {
	display: block;
}
.sgp-launcher-pulse {
	position: absolute;
	inset: 0;
	border-radius: inherit;
	pointer-events: none;
	box-shadow: 0 0 0 0 rgba(0, 74, 173, 0.5);
	animation: sgp-pulse 2.4s ease-out infinite;
}
@keyframes sgp-pulse {
	0%   { box-shadow: 0 0 0 0 rgba(0, 74, 173, 0.45); }
	70%  { box-shadow: 0 0 0 18px rgba(0, 74, 173, 0); }
	100% { box-shadow: 0 0 0 0 rgba(0, 74, 173, 0); }
}

/* ============================================================
   2. WIDGET FRAME
   ============================================================ */
.sgp-widget {
	position: fixed;
	right: 20px;
	bottom: 90px;
	z-index: 9999;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 600px;
	max-height: calc(100vh - 110px);
	background: #fff;
	border-radius: var(--radius-xl, 20px);
	box-shadow: var(--shadow-hero, 0 16px 48px rgba(16, 18, 24, 0.20));
	display: flex;
	flex-direction: column;
	overflow: hidden;
	font-family: var(--font-sans, 'Montserrat', 'Helvetica Neue', Arial, sans-serif);
	color: var(--color-text, #1a1d29);
	transform-origin: bottom right;
	opacity: 0;
	transform: scale(0.96) translateY(10px);
	pointer-events: none;
	transition: opacity .18s ease, transform .18s ease;
}
.sgp-widget[hidden] {
	display: none;
}
.sgp-widget.is-open {
	opacity: 1;
	transform: scale(1) translateY(0);
	pointer-events: auto;
}

/* ============================================================
   3. HEADER
   ============================================================ */
.sgp-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 18px;
	background: linear-gradient(135deg, var(--primary-500, #004AAD) 0%, var(--primary-700, #003381) 100%);
	color: #fff;
}
.sgp-header-text {
	flex: 1;
	min-width: 0;
}
.sgp-title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.2;
	color: #fff;
}
.sgp-status {
	display: block;
	font-size: 12px;
	opacity: 0.85;
	margin-top: 2px;
	min-height: 14px;
}
.sgp-icon-btn {
	width: 32px;
	height: 32px;
	border: none;
	border-radius: var(--radius-circle, 50%);
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background-color .15s ease;
}
.sgp-icon-btn:hover {
	background: rgba(255, 255, 255, 0.22);
}
.sgp-icon-btn:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.55);
}

/* ============================================================
   4. BODY + BERICHTEN
   ============================================================ */
.sgp-body {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #fafbfd;
	scroll-behavior: smooth;
}
.sgp-body::-webkit-scrollbar {
	width: 8px;
}
.sgp-body::-webkit-scrollbar-thumb {
	background: rgba(0, 0, 0, 0.12);
	border-radius: 999px;
}
.sgp-msg {
	max-width: 86%;
	padding: 10px 14px;
	border-radius: 16px;
	font-size: 14px;
	line-height: 1.5;
	word-wrap: break-word;
	overflow-wrap: anywhere;
	animation: sgp-fade-in .18s ease-out both;
}
.sgp-msg-user {
	align-self: flex-end;
	background: var(--primary-500, #004AAD);
	color: #fff;
	border-bottom-right-radius: 4px;
}
.sgp-msg-ai {
	align-self: flex-start;
	background: #fff;
	color: var(--color-text, #1a1d29);
	border: 1px solid var(--color-border-subtle, #eef1f6);
	border-bottom-left-radius: 4px;
	box-shadow: var(--shadow-xs, 0 1px 2px rgba(16, 18, 24, 0.05));
}
.sgp-msg-error {
	background: #fff5f5;
	color: #c0392b;
	border: 1px solid #ffd9d6;
}
@keyframes sgp-fade-in {
	from { opacity: 0; transform: translateY(4px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   5. MARKDOWN INHOUD (binnen .sgp-msg-ai)
   ============================================================ */
.sgp-msg-ai > *:first-child { margin-top: 0; }
.sgp-msg-ai > *:last-child  { margin-bottom: 0; }
.sgp-msg-ai p {
	margin: 0 0 8px;
}
.sgp-msg-ai h1,
.sgp-msg-ai h2,
.sgp-msg-ai h3 {
	margin: 12px 0 6px;
	font-weight: 700;
	line-height: 1.2;
	color: var(--primary-700, #003381);
}
.sgp-msg-ai h1 { font-size: 18px; }
.sgp-msg-ai h2 { font-size: 16px; }
.sgp-msg-ai h3 { font-size: 14px; }
.sgp-msg-ai ul,
.sgp-msg-ai ol {
	margin: 6px 0 8px;
	padding-left: 22px;
}
.sgp-msg-ai li {
	margin: 2px 0;
}
.sgp-msg-ai li::marker {
	color: var(--primary-500, #004AAD);
}
.sgp-msg-ai a {
	color: var(--primary-600, #003F93);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
}
.sgp-msg-ai a:hover {
	text-decoration-thickness: 2px;
}
.sgp-msg-ai code {
	font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
	font-size: 12.5px;
	background: #f1f3f7;
	padding: 1px 5px;
	border-radius: 4px;
}
.sgp-msg-ai pre {
	margin: 8px 0;
	padding: 10px 12px;
	background: #f1f3f7;
	border-radius: var(--radius-md, 10px);
	overflow-x: auto;
	font-size: 12.5px;
}
.sgp-msg-ai pre code {
	background: transparent;
	padding: 0;
}
.sgp-msg-ai blockquote {
	margin: 8px 0;
	padding: 4px 10px;
	border-left: 3px solid var(--primary-300, #6c92e8);
	color: var(--color-text-muted, #5b6577);
	background: #f7f9fd;
	border-radius: 0 6px 6px 0;
}
.sgp-msg-ai strong {
	font-weight: 700;
	color: var(--primary-700, #003381);
}

/* ============================================================
   6. TOOL-STATUS + TYPING DOTS
   ============================================================ */
.sgp-tool-pill {
	align-self: flex-start;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 12px;
	font-size: 12px;
	color: var(--color-text-muted, #5b6577);
	background: rgba(0, 74, 173, 0.06);
	border-radius: var(--radius-pill, 999px);
	animation: sgp-fade-in .15s ease-out both;
}
.sgp-tool-pill .sgp-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--primary-500, #004AAD);
	animation: sgp-dot-bounce 1.2s infinite ease-in-out;
}
.sgp-tool-pill .sgp-dot:nth-child(2) { animation-delay: .15s; }
.sgp-tool-pill .sgp-dot:nth-child(3) { animation-delay: .30s; }
@keyframes sgp-dot-bounce {
	0%, 80%, 100% { transform: translateY(0);   opacity: .4; }
	40%           { transform: translateY(-4px); opacity: 1; }
}

.sgp-typing {
	align-self: flex-start;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 12px 16px;
	background: #fff;
	border: 1px solid var(--color-border-subtle, #eef1f6);
	border-radius: 16px;
	border-bottom-left-radius: 4px;
	box-shadow: var(--shadow-xs, 0 1px 2px rgba(16, 18, 24, 0.05));
}
.sgp-typing .sgp-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--primary-300, #6c92e8);
	animation: sgp-dot-bounce 1.2s infinite ease-in-out;
}
.sgp-typing .sgp-dot:nth-child(2) { animation-delay: .15s; }
.sgp-typing .sgp-dot:nth-child(3) { animation-delay: .30s; }

/* ============================================================
   7. SUGGESTIONS (CHIPS) + FOLLOWUPS
   ============================================================ */
.sgp-suggestions {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 0 16px 8px;
	background: #fafbfd;
}
.sgp-suggestions:empty {
	display: none;
}
.sgp-chip {
	border: 1px solid var(--color-border-default, #d6dbe5);
	background: #fff;
	color: var(--color-text, #1a1d29);
	border-radius: var(--radius-pill, 999px);
	padding: 6px 12px;
	font-size: 12.5px;
	cursor: pointer;
	line-height: 1.3;
	transition: background-color .15s ease, border-color .15s ease, color .15s ease;
	white-space: nowrap;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
}
.sgp-chip:hover {
	background: var(--primary-50, #e8efff);
	border-color: var(--primary-300, #6c92e8);
	color: var(--primary-700, #003381);
}
.sgp-chip:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(0, 74, 173, 0.25);
}
.sgp-followups {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	align-self: flex-start;
	max-width: 100%;
	animation: sgp-fade-in .18s ease-out both;
}
.sgp-chip-followup {
	background: var(--primary-50, #e8efff);
	border-color: var(--primary-200, #9cb5f3);
	color: var(--primary-700, #003381);
	font-weight: 500;
	white-space: normal;
	text-align: left;
}
.sgp-chip-followup:hover {
	background: var(--primary-100, #c7d7ff);
	border-color: var(--primary-400, #3e73d8);
}

/* ============================================================
   8. SPORTSCHOOL-CARDS
   ============================================================ */
.sgp-card {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	margin: 6px 0;
	background: #fff;
	border: 1px solid var(--color-border-default, #d6dbe5);
	border-radius: var(--radius-md, 10px);
	text-decoration: none;
	color: var(--color-text, #1a1d29);
	transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.sgp-card:hover {
	border-color: var(--primary-500, #004AAD);
	box-shadow: var(--shadow-sm, 0 2px 8px rgba(16, 18, 24, 0.06));
	text-decoration: none;
}
.sgp-card:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(0, 74, 173, 0.25);
}
.sgp-card-main {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.sgp-card-name {
	font-weight: 600;
	font-size: 14px;
	color: var(--primary-700, #003381);
	display: flex;
	align-items: center;
	gap: 6px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.sgp-card-badge {
	display: inline-block;
	font-size: 10px;
	font-weight: 700;
	padding: 1px 6px;
	border-radius: var(--radius-pill, 999px);
	background: linear-gradient(135deg, #f39c12, #e67e22);
	color: #fff;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}
.sgp-card-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	font-size: 12px;
	color: var(--color-text-muted, #5b6577);
}
.sgp-card-loc::before {
	content: '📍';
	margin-right: 3px;
}
.sgp-card-price {
	color: var(--primary-600, #003F93);
	font-weight: 600;
}
.sgp-card-cta {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	flex-shrink: 0;
	color: var(--primary-500, #004AAD);
	font-size: 12.5px;
	font-weight: 600;
}

/* ============================================================
   9. LEAD-CAPTURE FORM
   ============================================================ */
.sgp-leadform {
	align-self: flex-start;
	max-width: 100%;
	width: 100%;
	background: #fff;
	border: 1px solid var(--primary-200, #9cb5f3);
	border-radius: var(--radius-lg, 16px);
	padding: 14px;
	box-shadow: var(--shadow-sm, 0 2px 8px rgba(16, 18, 24, 0.06));
	animation: sgp-fade-in .2s ease-out both;
}
.sgp-leadform-head {
	margin-bottom: 10px;
	font-size: 13px;
	color: var(--color-text, #1a1d29);
}
.sgp-leadform-head strong {
	display: block;
	margin-bottom: 4px;
	color: var(--primary-700, #003381);
}
.sgp-leadform-target {
	font-size: 12px;
	color: var(--color-text-muted, #5b6577);
}
.sgp-leadform-row {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin-bottom: 8px;
}
.sgp-leadform-label {
	font-size: 12px;
	font-weight: 600;
	color: var(--color-text, #1a1d29);
}
.sgp-leadform-input {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid var(--color-border-default, #d6dbe5);
	border-radius: var(--radius-md, 10px);
	font-family: inherit;
	font-size: 13px;
	color: var(--color-text, #1a1d29);
	background: #fafbfd;
	box-sizing: border-box;
	transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.sgp-leadform-input:focus {
	outline: none;
	border-color: var(--primary-500, #004AAD);
	background: #fff;
	box-shadow: 0 0 0 3px rgba(0, 74, 173, 0.15);
}
textarea.sgp-leadform-input {
	resize: vertical;
	min-height: 60px;
}
.sgp-leadform-consent {
	margin: 8px 0 12px;
	font-size: 11px;
	color: var(--color-text-muted, #5b6577);
	line-height: 1.4;
}
.sgp-leadform-actions {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
}
.sgp-leadform-submit,
.sgp-leadform-cancel {
	padding: 8px 14px;
	border-radius: var(--radius-md, 10px);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease, border-color .15s ease;
	font-family: inherit;
}
.sgp-leadform-submit {
	background: var(--primary-500, #004AAD);
	color: #fff;
	border: 1px solid var(--primary-500, #004AAD);
}
.sgp-leadform-submit:hover {
	background: var(--primary-600, #003F93);
}
.sgp-leadform-submit:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}
.sgp-leadform-cancel {
	background: transparent;
	color: var(--color-text-muted, #5b6577);
	border: 1px solid var(--color-border-default, #d6dbe5);
}
.sgp-leadform-cancel:hover {
	background: #f1f3f7;
}
.sgp-leadform-status {
	margin-top: 8px;
	font-size: 12px;
	color: #c0392b;
	min-height: 16px;
}
.sgp-leadform.is-success {
	border-color: #b6e3c1;
	background: #f0faf3;
}
.sgp-leadform-done {
	font-size: 13px;
	color: #1a7c2a;
	font-weight: 600;
	text-align: center;
	padding: 8px;
}

/* ============================================================
   10. INPUT
   ============================================================ */
.sgp-input {
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 12px 14px;
	background: #fff;
	border-top: 1px solid var(--color-border-subtle, #eef1f6);
}
.sgp-input-field {
	flex: 1;
	min-height: 40px;
	max-height: 140px;
	resize: none;
	padding: 10px 14px;
	border: 1px solid var(--color-border-default, #d6dbe5);
	border-radius: var(--radius-lg, 16px);
	font-family: inherit;
	font-size: 14px;
	line-height: 1.4;
	color: var(--color-text, #1a1d29);
	background: #fafbfd;
	transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.sgp-input-field:focus {
	outline: none;
	border-color: var(--primary-500, #004AAD);
	background: #fff;
	box-shadow: 0 0 0 3px rgba(0, 74, 173, 0.15);
}
.sgp-send {
	width: 40px;
	height: 40px;
	border: none;
	border-radius: var(--radius-circle, 50%);
	background: var(--primary-500, #004AAD);
	color: #fff;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background-color .15s ease, transform .1s ease;
}
.sgp-send:hover {
	background: var(--primary-600, #003F93);
}
.sgp-send:active {
	transform: scale(0.94);
}
.sgp-send:disabled {
	background: var(--color-border-default, #d6dbe5);
	cursor: not-allowed;
}
.sgp-send:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(0, 74, 173, 0.35);
}

/* ============================================================
   11. RESPONSIVE / FULL-SCREEN MOBIEL
   ============================================================ */
@media (max-width: 640px) {
	.sgp-widget {
		right: 0;
		bottom: 0;
		left: 0;
		top: auto;
		width: 100%;
		max-width: 100%;
		height: 90vh;
		max-height: 90vh;
		border-radius: var(--radius-xl, 20px) var(--radius-xl, 20px) 0 0;
		transform-origin: bottom center;
	}
	.sgp-widget.is-open {
		transform: translateY(0);
	}
	.sgp-widget:not(.is-open) {
		transform: translateY(100%);
	}
	.sgp-launcher {
		right: 16px;
		bottom: 16px;
	}
}

/* ============================================================
   12. REDUCED MOTION + UTILITIES
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
	.sgp-launcher-pulse,
	.sgp-tool-pill .sgp-dot,
	.sgp-typing .sgp-dot {
		animation: none;
	}
	.sgp-widget,
	.sgp-msg,
	.sgp-tool-pill,
	.sgp-launcher {
		transition: none;
	}
}

.sgp-visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
