/* ple-cre Chat Lead - frontend styles */

:root {
	--pclead-accent: #1f6f54;
	--pclead-accent-2: #1f6f54;
	--pclead-accent-bg: #1f6f54;
	--pclead-ink: #22252a;
	--pclead-bg: #ffffff;
	--pclead-surface: #f3f4f2;
	--pclead-radius: 16px;
	--pclead-shadow: 0 12px 40px rgba(20, 24, 28, 0.18);
	--pclead-font: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
}

#pclead-root {
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 99990;
	font-family: var(--pclead-font);
	font-size: 14px;
	line-height: 1.7;
	color: var(--pclead-ink);
}

/* PC限定設定時のみ、960px未満で非表示 */
@media (max-width: 959px) {
	#pclead-root.pclead-pc-only { display: none !important; }
}


#pclead-root *,
#pclead-root *::before,
#pclead-root *::after { box-sizing: border-box; }

/* ---------------- 起動ボタン ---------------- */
.pclead-launcher {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 0.7em;
	margin: 0;
	padding: 1em 1.55em 1em 1.25em;
	border: none;
	border-radius: 999px;
	background: var(--pclead-accent-bg);
	color: #fff;
	font-family: inherit;
	font-size: var(--pclead-launcher-fs, 14px);
	font-weight: 700;
	line-height: 1; /* テーマのline-height干渉によるアイコン位置ずれ防止 */
	letter-spacing: 0.04em;
	cursor: pointer;
	touch-action: manipulation; /* ダブルタップズームによるタップ遅延・無反応の防止 */
	-webkit-tap-highlight-color: transparent;
	box-shadow: var(--pclead-shadow);
	transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.25s ease;
}
.pclead-launcher-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 1.5em; /* ラベルと同一高さに揃える */
	flex-shrink: 0;
}
.pclead-launcher-icon svg {
	display: block; /* ベースライン揃えによるずれを防止 */
	width: 1.5em;
	height: 1.5em;
}
.pclead-launcher-label {
	display: inline-flex;
	align-items: center;
	height: 1.5em; /* アイコンと同一高さのボックス内で中央揃え */
	line-height: 1;
}

/* 丸型(アイコンのみ) */
.pclead-launcher.is-circle {
	width: 3.6em;
	height: 3.6em;
	padding: 0;
	justify-content: center;
	border-radius: 50%;
}
.pclead-launcher.is-circle .pclead-launcher-label {
	display: none;
}
.pclead-launcher.is-circle .pclead-launcher-icon svg {
	width: 1.7em;
	height: 1.7em;
}
.pclead-launcher.is-circle .pclead-launcher-dot {
	top: 0.1em;
	right: 0.1em;
}

/* サークル(回転テキスト)GYM76風 */
.pclead-launcher.is-badge {
	width: 10.5em;
	height: 10.5em;
	padding: 0;
	flex-direction: column;
	justify-content: center;
	border-radius: 50%;
	text-align: center;
}
.pclead-launcher.is-badge:hover {
	transform: scale(1.04);
}
.pclead-launcher.is-badge .pclead-launcher-label {
	display: block;
	height: auto;
	max-width: 60%;
	line-height: 1.7;
	white-space: normal;
	font-size: 1em;
}
.pclead-launcher.is-badge .pclead-launcher-label::after {
	content: '▶';
	display: block;
	margin-top: 0.55em;
	font-size: 0.65em;
	opacity: 0.9;
}
.pclead-badge-ring {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	animation: pclead-spin 26s linear infinite;
	pointer-events: none;
}
.pclead-badge-ring text {
	fill: rgba(255, 255, 255, 0.92);
	font-size: 7px;
	font-weight: 600;
	letter-spacing: 1.6px;
}
@keyframes pclead-spin {
	to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
	.pclead-badge-ring { animation: none; }
}
.pclead-launcher:hover {
	transform: translateY(-2px);
	box-shadow: 0 16px 44px rgba(20, 24, 28, 0.24);
}
.pclead-launcher.is-hidden {
	opacity: 0;
	pointer-events: none;
	transform: translateY(8px);
}
.pclead-launcher-dot {
	position: absolute;
	top: -0.15em;
	right: 0.7em; /* ピルの角丸の内側に配置(角の外に浮かないように) */
	width: 0.85em;
	height: 0.85em;
	border-radius: 50%;
	background: #e5484d;
	border: 2px solid #fff;
	animation: pclead-pulse 2.4s ease-in-out infinite;
}
@keyframes pclead-pulse {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.25); }
}

/* ---------------- パネル ---------------- */
.pclead-panel {
	position: absolute;
	right: 0;
	bottom: 0;
	width: 360px;
	max-height: min(640px, calc(100vh - 64px));
	display: flex;
	flex-direction: column;
	background: var(--pclead-bg);
	border-radius: var(--pclead-radius);
	box-shadow: var(--pclead-shadow);
	overflow: hidden;
	opacity: 0;
	visibility: hidden;
	transform: translateY(12px) scale(0.98);
	pointer-events: none;
	transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
}
.pclead-panel.is-open {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

.pclead-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 16px;
	background: var(--pclead-accent-bg);
	color: #fff;
}
.pclead-header-status {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: #7ef0b2;
	box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18);
}
.pclead-header-title {
	flex: 1;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.05em;
}
.pclead-close {
	display: inline-flex;
	padding: 6px;
	border: none;
	border-radius: 8px;
	background: transparent;
	color: #fff;
	cursor: pointer;
	transition: background 0.15s ease;
}
.pclead-close:hover { background: rgba(255, 255, 255, 0.16); }

.pclead-body {
	flex: 1;
	min-height: 220px;
	padding: 18px 16px 10px;
	overflow-y: auto;
	background: var(--pclead-surface);
	scrollbar-width: thin;
}

/* ---------------- メッセージ ---------------- */
.pclead-msg {
	max-width: 84%;
	margin-bottom: 10px;
	padding: 10px 14px;
	border-radius: 14px;
	font-size: 13.5px;
	word-break: break-word;
	animation: pclead-in 0.25s ease both;
}
@keyframes pclead-in {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: translateY(0); }
}
.pclead-msg.is-bot {
	background: #fff;
	border: 1px solid #e4e6e2;
	border-bottom-left-radius: 4px;
}
.pclead-msg.is-user {
	margin-left: auto;
	background: var(--pclead-accent-bg);
	color: #fff;
	border-bottom-right-radius: 4px;
}

/* 入力中(タイピング)表示 */
.pclead-msg.is-typing {
	display: inline-flex;
	gap: 5px;
	padding: 13px 16px;
}
.pclead-msg.is-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #b8bcb5;
	animation: pclead-typing 1.1s ease-in-out infinite;
}
.pclead-msg.is-typing span:nth-child(2) { animation-delay: 0.15s; }
.pclead-msg.is-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes pclead-typing {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
	30% { transform: translateY(-4px); opacity: 1; }
}

/* 確認サマリー */
.pclead-summary { max-width: 100%; }
.pclead-summary dl { margin: 0; }
.pclead-summary dt {
	margin-top: 8px;
	font-size: 11px;
	font-weight: 700;
	color: var(--pclead-accent);
	letter-spacing: 0.06em;
}
.pclead-summary dt:first-child { margin-top: 0; }
.pclead-summary dd { margin: 1px 0 0; }

/* ---------------- 入力エリア ---------------- */
.pclead-input-area {
	padding: 12px 14px 14px;
	background: #fff;
	border-top: 1px solid #ececea;
}
.pclead-input-area:empty { display: none; }

.pclead-choices {
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.pclead-choice {
	padding: 11px 14px;
	border: 1.5px solid var(--pclead-accent);
	border-radius: 10px;
	background: #fff;
	color: var(--pclead-accent);
	font-family: inherit;
	font-size: 13.5px;
	font-weight: 600;
	text-align: left;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.pclead-choice:hover {
	background: var(--pclead-accent-bg);
	color: #fff;
	transform: translateX(2px);
}

.pclead-form {
	display: flex;
	gap: 8px;
	align-items: flex-end;
}
.pclead-field {
	flex: 1;
	padding: 10px 12px;
	border: 1.5px solid #d8dad4;
	border-radius: 10px;
	font-family: inherit;
	font-size: 14px;
	line-height: 1.6;
	resize: none;
	background: #fff;
	color: var(--pclead-ink);
}
.pclead-field:focus {
	outline: none;
	border-color: var(--pclead-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--pclead-accent) 18%, transparent);
}

.pclead-send {
	flex-shrink: 0;
	padding: 10px 16px;
	border: none;
	border-radius: 10px;
	background: var(--pclead-accent-bg);
	color: #fff;
	font-family: inherit;
	font-size: 13.5px;
	font-weight: 700;
	cursor: pointer;
	transition: opacity 0.15s ease;
}
.pclead-send:hover { opacity: 0.88; }
.pclead-send:disabled { opacity: 0.5; cursor: default; }
.pclead-send.is-primary {
	width: 100%;
	padding: 13px;
	font-size: 14px;
	letter-spacing: 0.05em;
}

.pclead-skip {
	display: block;
	width: 100%;
	margin-top: 8px;
	padding: 8px 12px;
	border: 1px dashed #c5c8c0;
	border-radius: 10px;
	background: transparent;
	color: #6c7066;
	font-family: inherit;
	font-size: 12px;
	cursor: pointer;
	transition: border-color 0.15s ease, color 0.15s ease;
}
.pclead-skip:hover {
	border-color: var(--pclead-accent);
	color: var(--pclead-accent);
}

.pclead-error {
	margin: 6px 2px 0;
	font-size: 12px;
	color: #d13438;
}
.pclead-error:empty { display: none; }

.pclead-confirm { display: flex; flex-direction: column; gap: 10px; }
.pclead-privacy {
	margin: 0;
	font-size: 11.5px;
	color: #6c7066;
}
.pclead-privacy a { color: var(--pclead-accent); }

/* スマートフォン用レイアウト
   ベースの .pclead-panel(absolute / width:360px)より後に記述し、
   カスケード順で確実に上書きする。 */
@media (max-width: 600px) {
	#pclead-root {
		right: 16px;
		bottom: 16px;
	}
	.pclead-panel {
		position: fixed;
		left: 12px;
		right: 12px;
		bottom: 12px;
		width: auto;
		max-width: none;
		max-height: min(78vh, calc(100vh - 24px));
	}
	.pclead-launcher.is-badge {
		width: 8.5em;
		height: 8.5em;
	}
}

/* モーション軽減 */
@media (prefers-reduced-motion: reduce) {
	#pclead-root *,
	#pclead-root *::before,
	#pclead-root *::after {
		animation: none !important;
		transition: none !important;
	}
}
