/* ======================================
   Chat UI Stylesheet
   チャットインターフェースのスタイル定義
   ====================================== */

body {
	margin: 0;
	padding: 0;
	overflow: hidden;
}

* {
	font-family: "Noto Sans JP", sans-serif;
}

#map {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 100%;
}

.layer-create-title {
	font-size: 18px;
	font-weight: 500;
	color: #141415;
}

/* 市区町村名入力フィールド専用のプレースホルダー色 */
#city-box::placeholder {
	color: #ccc;
}

.input-style {
	width: 50px;
	height: 30px;
	border: none;
	border-radius: 4px;
	cursor: pointer;
}

.create-btn {
	padding: 8px 20px;
	background-color: #0969DA;
	color: #fff;
	border: none;
	padding: 8px;
	font-weight: 500;
	border-radius: 4px;
	min-width: 80px;
	font-size: 14px;
	cursor: pointer;
	height: 37px;
}


/* チャットローディングアニメーション */
@keyframes bounce {

	0%,
	80%,
	100% {
		transform: scale(0);
	}

	40% {
		transform: scale(1.0);
	}
}


/* 送信ボタンのスタイル */
#sendButton {
	background: #0D1B36 !important;
	color: #fff !important;
	border-radius: 50% !important;
	transition: background 0.2s !important;
}

#sendButton:hover {
	background: #1a2847 !important;
}

/* チャットメッセージモーダルの改善 */
#chatMessagesModal {
	position: fixed !important;
	top: 72px;
	left: 0;
	width: calc(100% - 320px) !important;
	max-width: 536px !important;
	height: calc(100vh - 88px) !important;
	background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%) !important;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(0, 0, 0, 0.1) !important;
	border: 1px solid rgba(255, 255, 255, 0.2) !important;
	backdrop-filter: blur(20px) !important;
	transition: all 0.3s ease !important;
	transform: translateY(0px);
	opacity: 1;
	padding-left: 16px !important;
	margin-left: 16px;
}

/* drawer-wrapperが表示されている場合 */
.drawer--left.active #chatMessagesModal {
	margin-left: 336px;
}


#chatMessagesModal.show {
	transform: translateY(0);
	opacity: 1;
}

/* ×ボタンの改善 */
#chatCloseBtn {
	background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%) !important;
	color: #444 !important;
	border: 1px solid rgba(0, 0, 0, 0.1) !important;
	font-size: 16px !important;
	font-weight: bold !important;
	width: 32px !important;
	height: 32px !important;
	top: 10px !important;
	right: 10px !important;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.5) !important;
	backdrop-filter: blur(4px) !important;
	transition: all 0.2s ease !important;
}

#chatCloseBtn:hover {
	background: linear-gradient(135deg, #e8e8e8 0%, #d0d0d0 100%) !important;
	color: #222 !important;
	transform: scale(1.05) !important;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.7) !important;
}

#chatCloseBtn:active {
	transform: scale(0.95) !important;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2), inset 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}

/* チャットメッセージエリアの改善 */
#chatMessages {
	padding-top: 55px !important;
	padding-bottom: 120px !important;
	/* レイヤー管理UI用のスペースを拡大 */
	max-height: calc(100vh - 180px) !important;
	/* 最大高さを制限 */
	overflow-y: auto !important;
	overflow-anchor: none !important;
	/* スクロール位置の自動調整を無効化 */
}

/* レイヤー管理UIがチャットメッセージと重ならないよう確実に上に配置 */
.layer-management-ui {
	z-index: 1000 !important;
}

/* チャットメッセージのスクロール動作を上向きに調整 */
#chatMessages::-webkit-scrollbar {
	width: 6px;
}

#chatMessages::-webkit-scrollbar-thumb {
	background-color: rgba(0, 0, 0, 0.2);
	border-radius: 3px;
}

/* レイヤー管理UI */
.layer-management-ui {
	position: absolute;
	bottom: 16px;
	left: 16px;
	right: 16px;
	background: rgba(255, 255, 255, 0.95);
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 12px;
	padding: 12px;
	backdrop-filter: blur(10px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.layer-add-button {
	background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
	color: white;
	border: none;
	border-radius: 8px;
	padding: 8px 12px;
	font-size: 12px;
	display: flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	transition: all 0.2s ease;
	margin-bottom: 8px;
}

.layer-add-button:hover {
	background: linear-gradient(135deg, #4338ca 0%, #2563eb 100%);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.active-layers-list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.layer-tag {
	background: rgba(79, 70, 229, 0.1);
	color: #4f46e5;
	border: 1px solid rgba(79, 70, 229, 0.2);
	border-radius: 16px;
	padding: 4px 8px;
	font-size: 11px;
	display: flex;
	align-items: center;
	gap: 4px;
}

.layer-tag .remove-btn {
	background: none;
	border: none;
	color: #6b7280;
	cursor: pointer;
	font-size: 14px;
	line-height: 1;
	padding: 0;
	margin: 0;
}

.layer-tag .remove-btn:hover {
	color: #ef4444;
}

/* レイヤー警告メッセージ */
.layer-warning-message {
	background: rgba(251, 146, 60, 0.1);
	border: 1px solid rgba(251, 146, 60, 0.3);
	border-radius: 8px;
	padding: 12px;
	margin: 8px 0;
}

.layer-warning-message p {
	margin: 0 0 8px 0;
	color: #ea580c;
}

/* モーダル */
.layer-selection-modal {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 2000;
	display: none;
}

.layer-selection-content {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: #ffffff;
	border-radius: 12px;
	padding: 24px;
	max-width: 500px;
	width: 90%;
	max-height: 70vh;
	overflow-y: auto;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.layer-option {
	padding: 12px 16px;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	margin: 8px 0;
	cursor: pointer;
	transition: all 0.2s ease;
	background: #f9fafb;
	word-wrap: break-word;
	word-break: break-word;
	white-space: normal;
	overflow-wrap: break-word;
}

.layer-option:hover {
	background: #eff6ff;
	border-color: #3b82f6;
	box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

/* レイヤーパネルの＋/－ボタン */
.zoning_addToChatIcon {
	opacity: 1;
	/* 常時表示 */
	transition: all 0.2s ease;
}

.show-zoning_deleteIcon.zoning_addToChatIcon,
.show-zoning_deleteIcon {
	opacity: 1;
}

.zoning_addToChatIcon:hover {
	transform: scale(1.1);
	opacity: 0.8;
}

/* アクティブレイヤーの場合のスタイル */
.zoning_addToChatIcon.active-layer {
	background: rgba(239, 68, 68, 0.1);
	border-radius: 3px;
}

/* チャットメッセージのスタイル */
.chat-message {
	display: flex;
	margin-bottom: 10px;
	opacity: 0;
	animation: fadeInUp 0.3s ease forwards;
}

@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translateY(10px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.chat-message.user {
	justify-content: flex-end;
}

.chat-message.ai {
	justify-content: flex-start;
}

.chat-message-content {
	max-width: 80%;
	padding: 10px 14px;
	border-radius: 16px;
	font-size: 14px;
	line-height: 1.5;
	word-wrap: break-word;
	white-space: pre-line;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
	font-family: "Noto Sans JP", sans-serif;
}

.chat-message.user .chat-message-content {
	background: #e6eeff;
	color: #0D1B36;
	border: 1px solid #b8ccff;
	border-bottom-right-radius: 4px;
}

.chat-message.ai .chat-message-content {
	background: #f0f1f3;
	color: #0D1B36;
	border: 1px solid #d6d8db;
	border-bottom-left-radius: 4px;
}

/* Thinking dotsアニメーション */
.thinking-dots {
	display: flex;
	align-items: center;
}

.thinking-dots .thinking-text {
	margin-right: 8px;
}

.thinking-dots .dots-container {
	display: flex;
	gap: 2px;
}

.thinking-dots .dot {
	width: 4px;
	height: 4px;
	background-color: #666;
	border-radius: 50%;
	animation: bounce 1.4s infinite ease-in-out both;
}

.thinking-dots .dot:nth-child(1) {
	animation-delay: -0.32s;
}

.thinking-dots .dot:nth-child(2) {
	animation-delay: -0.16s;
}

.thinking-dots .dot:nth-child(3) {
	animation-delay: 0s;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
	#chatInputContainer {
		width: calc(100% - 40px) !important;
		max-width: 350px;
		left: 20px !important;
		transform: none !important;
	}

	#chatMessagesModal {
		width: calc(100% - 40px) !important;
		max-width: 350px !important;
		left: 20px !important;
		max-height: calc(100vh - 100px) !important;
	}

	#chatMessages {
		padding-top: 60px !important;
		padding-bottom: 20px !important;
		max-height: calc(100vh - 120px) !important;
	}

	#chatCloseBtn {
		top: 8px !important;
		right: 8px !important;
		width: 36px !important;
		height: 36px !important;
		font-size: 18px !important;
	}


	/* 統合フォームのモバイル対応 */
	.unified-chat-form {
		border-radius: 16px !important;
	}

	.form-layers-section {
		padding: 8px 12px 6px 12px !important;
	}

	.layer-tag {
		padding: 3px 8px !important;
		font-size: 11px !important;
		border-radius: 12px !important;
	}

	.layer-tag-name {
		max-width: 60px !important;
	}

	.layer-remove-btn {
		width: 14px !important;
		height: 14px !important;
		font-size: 8px !important;
	}

	.unified-input {
		padding: 12px 16px !important;
	}

	.layer-add-btn {
		width: 28px !important;
		height: 28px !important;
	}

	.send-btn {
		width: 28px !important;
		height: 28px !important;
	}

	.input-actions {
		padding-right: 8px !important;
		gap: 6px !important;
	}

	.chat-layer-modal-content {
		width: 95% !important;
		margin: 20px !important;
		padding: 16px !important;
	}
}

/* プレースホルダーのスタイル */
#polygon-box::placeholder,
#CityPolygon-Layer-Box::placeholder {
	color: #ccc;
}

/* 統合フォームデザイン */
.unified-chat-form {
	background: #fff;
	border-radius: 24px;
	border: 2px solid #e0e0e0;
	transition: border-color 0.2s, box-shadow 0.2s;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
	overflow: hidden;
	position: relative;
}

.unified-chat-form:focus-within {
	border-color: #4A90E2;
	box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2), 0 4px 20px rgba(0, 0, 0, 0.1);
}

.form-layers-section {
	padding: 12px 20px 4px 20px;
	background: transparent;
}

.form-input-section {
	display: flex;
	align-items: center;
	position: relative;
	padding: 8px 4px 4px 0;
}

.unified-input {
	flex: 1;
	border: none;
	outline: none;
	font-size: 1em;
	padding: 16px 20px;
	background: transparent;
	color: #333;
	resize: none;
	min-height: 24px;
	align-self: center;
}

.unified-input::placeholder {
	color: #9ca3af;
}

.input-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	padding-right: 12px;
}

.layer-add-btn {
	background: #f3f4f6;
	color: #6b7280;
	border: none;
	border-radius: 12px;
	width: 32px;
	height: 32px;
	cursor: pointer;
	transition: all 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
}

.layer-add-btn:hover {
	background: #e5e7eb;
	color: #374151;
	transform: scale(1.05);
}

.send-btn {
	background: #0D1B36;
	color: #fff;
	border-radius: 50%;
	width: 32px;
	height: 32px;
	cursor: pointer;
	transition: all 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
}

.send-btn:hover {
	background: #1a2332;
	transform: scale(1.05);
}

.active-layers-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.layer-tag {
	background: #f8f9fa;
	border: 1px solid #e9ecef;
	border-radius: 14px;
	padding: 4px 10px;
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: #495057;
	transition: all 0.2s;
	font-weight: 500;
}

.layer-tag:hover {
	background: #e9ecef;
	transform: translateY(-1px);
	border-color: #dee2e6;
}

.layer-tag-name {
	max-width: 100px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.layer-remove-btn {
	background: #64748b;
	color: white;
	border: none;
	border-radius: 50%;
	width: 16px;
	height: 16px;
	cursor: pointer;
	font-size: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
	padding: 0;
	line-height: 1;
}

.layer-remove-btn:hover {
	background: #ef4444;
	transform: scale(1.1);
}

/* チャットレイヤーモーダル */
.chat-layer-modal {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	z-index: 3000;
	justify-content: center;
	align-items: center;
	visibility: hidden;
	opacity: 0;
	transition: opacity 0.3s ease, visibility 0.3s ease;
	padding: 0;
	margin: 0;
}

.chat-layer-modal.show {
	visibility: visible;
	opacity: 1;
}

.chat-layer-modal-content {
	background: #ffffff;
	border-radius: 16px;
	padding: 0;
	width: 80%;
	max-width: 600px;
	height: auto;
	max-height: 80vh;
	min-height: 400px;
	overflow-y: auto;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
	border: 1px solid rgba(255, 255, 255, 0.2);
	margin: auto;
	transform: scale(0.9);
	transition: transform 0.3s ease;
}

.chat-layer-modal.show .chat-layer-modal-content {
	transform: scale(1);
}
.modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 24px 24px 0 24px;
	margin-bottom: 16px;
	border-bottom: 1px solid #f1f5f9;
	padding-bottom: 16px;
}

.modal-title {
	font-size: 20px;
	font-weight: 700;
	color: #1f2937;
	margin: 0;
}

.modal-close {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	color: #64748b;
	cursor: pointer;
	transition: all 0.2s ease;
}

.modal-close:hover {
	background: #f1f5f9;
	color: #475569;
	border-color: #cbd5e1;
}

.available-layers {
	padding: 0 24px 24px 24px;
	max-height: calc(75vh - 120px);
	overflow-y: auto;
}

.available-layers::-webkit-scrollbar {
	width: 6px;
}

.available-layers::-webkit-scrollbar-track {
	background: #f8fafc;
	border-radius: 3px;
}

.available-layers::-webkit-scrollbar-thumb {
	background: #cbd5e1;
	border-radius: 3px;
}

.available-layers::-webkit-scrollbar-thumb:hover {
	background: #94a3b8;
}

.modal-close:hover {
	color: #374151;
}

.available-layers {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.layer-option {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	cursor: pointer;
	transition: all 0.2s;
	gap: 12px;
	min-height: 48px;
}

.layer-option:hover {
	border-color: #4A90E2;
	background: rgba(74, 144, 226, 0.05);
}

.layer-option-info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 1;
	min-width: 0;
}

.layer-option-name {
	font-weight: 500;
	color: #111827;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	line-height: 1.4;
	max-height: 2.8em;
}

.layer-option-type {
	font-size: 12px;
	color: #6b7280;
}

.layer-add-button {
	background: #10b981;
	color: white;
	border: none;
	border-radius: 6px;
	padding: 8px 16px;
	font-size: 13px;
	cursor: pointer;
	white-space: nowrap;
	flex-shrink: 0;
	min-width: 60px;
	transition: all 0.2s;
}

.layer-add-button:hover {
	background: #059669;
}
