/**
 * SC-ICG Safety Custom — 前台樣式
 * 所有選擇器限定在 .sc-icg-safety-custom-wrap 內
 */

/* ========== 容器與基本排版 ========== */

.sc-icg-safety-custom-wrap {
	--sp-primary: #4A90D9;
	--sp-secondary: #6BB56B;
	--sp-bg: #F5F7FA;

	max-width: 680px;
	margin: 0 auto;
	padding: 0;
	font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	font-size: 15px;
	line-height: 1.6;
	color: #333;
	-webkit-font-smoothing: antialiased;
}

.sc-icg-safety-custom-wrap *,
.sc-icg-safety-custom-wrap *::before,
.sc-icg-safety-custom-wrap *::after {
	box-sizing: border-box;
}

.sc-icg-safety-custom-wrap h2,
.sc-icg-safety-custom-wrap h3,
.sc-icg-safety-custom-wrap p {
	margin: 0;
	padding: 0;
}

/* ========== 頁面切換 ========== */

.sc-icg-safety-custom-wrap .sp-page {
	display: none;
}

.sc-icg-safety-custom-wrap .sp-page.active {
	display: block;
	animation: spFadeIn 0.35s ease;
}

@keyframes spFadeIn {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ========== 歡迎頁 ========== */

.sc-icg-safety-custom-wrap .sp-welcome {
	text-align: center;
	padding: 48px 24px;
	background: var(--sp-bg);
	border-radius: 16px;
}

.sc-icg-safety-custom-wrap .sp-main-title {
	font-size: 26px;
	font-weight: 700;
	color: #2c3e50;
	margin-bottom: 16px;
	letter-spacing: -0.3px;
}

.sc-icg-safety-custom-wrap .sp-welcome-desc {
	font-size: 15px;
	color: #555;
	line-height: 1.7;
	max-width: 480px;
	margin: 0 auto 28px;
}

/* ========== 按鈕通用 ========== */

.sc-icg-safety-custom-wrap .sp-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 0 24px;
	height: 44px;
	border-radius: 8px;
	font-size: 15px;
	font-weight: 500;
	font-family: inherit;
	cursor: pointer;
	border: none;
	transition: all 0.2s ease;
	text-decoration: none;
	line-height: 1;
}

.sc-icg-safety-custom-wrap .sp-btn svg {
	flex-shrink: 0;
}

.sc-icg-safety-custom-wrap .sp-btn-primary {
	background: var(--sp-primary);
	color: #fff;
}

.sc-icg-safety-custom-wrap .sp-btn-primary:hover {
	filter: brightness(0.9);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sc-icg-safety-custom-wrap .sp-btn-outline {
	background: #fff;
	color: var(--sp-primary);
	border: 1.5px solid var(--sp-primary);
}

.sc-icg-safety-custom-wrap .sp-btn-outline:hover {
	background: var(--sp-primary);
	color: #fff;
}

.sc-icg-safety-custom-wrap .sp-btn-ghost {
	background: transparent;
	color: #666;
	border: 1px solid #ddd;
}

.sc-icg-safety-custom-wrap .sp-btn-ghost:hover {
	background: #f5f5f5;
	color: #333;
	border-color: #ccc;
}

.sc-icg-safety-custom-wrap .sp-btn:active {
	transform: scale(0.97);
}

.sc-icg-safety-custom-wrap .sp-start-btn {
	margin-top: 8px;
	height: 48px;
	font-size: 16px;
	padding: 0 32px;
}

/* ========== 進度指示器 ========== */

.sc-icg-safety-custom-wrap .sp-progress {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px 16px 8px;
}

.sc-icg-safety-custom-wrap .sp-progress-item {
	display: flex;
	align-items: center;
	justify-content: center;
}

.sc-icg-safety-custom-wrap .sp-progress-dot {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	font-weight: 600;
	border: 2px solid #ddd;
	color: #aaa;
	background: #fff;
	transition: all 0.25s ease;
	cursor: pointer;
}

.sc-icg-safety-custom-wrap .sp-progress-item.active .sp-progress-dot {
	border-color: var(--sp-primary);
	background: var(--sp-primary);
	color: #fff;
	box-shadow: 0 2px 8px rgba(74, 144, 217, 0.3);
}

.sc-icg-safety-custom-wrap .sp-progress-item.completed .sp-progress-dot {
	border-color: var(--sp-secondary);
	background: var(--sp-secondary);
	color: #fff;
}

.sc-icg-safety-custom-wrap .sp-progress-line {
	width: 24px;
	height: 2px;
	background: #ddd;
	margin: 0 4px;
	transition: background 0.25s ease;
}

.sc-icg-safety-custom-wrap .sp-progress-line.completed {
	background: var(--sp-secondary);
}

/* ========== 步驟面板 ========== */

.sc-icg-safety-custom-wrap .sp-steps-container {
	padding: 0 8px;
}

.sc-icg-safety-custom-wrap .sp-step {
	display: none;
	animation: spFadeIn 0.3s ease;
}

.sc-icg-safety-custom-wrap .sp-step.active {
	display: block;
}

.sc-icg-safety-custom-wrap .sp-step-title {
	font-size: 20px;
	font-weight: 700;
	color: #2c3e50;
	margin-bottom: 8px;
	padding-top: 20px;
}

.sc-icg-safety-custom-wrap .sp-step-desc {
	font-size: 14px;
	color: #666;
	line-height: 1.7;
	margin-bottom: 20px;
}

/* ========== 建議按鈕 ========== */

.sc-icg-safety-custom-wrap .sp-suggestions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 20px;
	align-items: center;
}

.sc-icg-safety-custom-wrap .sp-suggestions-label {
	font-size: 12px;
	color: #999;
	font-weight: 500;
}

.sc-icg-safety-custom-wrap .sp-suggestion-btn {
	display: inline-flex;
	align-items: center;
	padding: 6px 14px;
	border-radius: 20px;
	font-size: 13px;
	font-family: inherit;
	background: rgba(107, 181, 107, 0.1);
	color: #3d8b3d;
	border: 1px solid rgba(107, 181, 107, 0.25);
	cursor: pointer;
	transition: all 0.2s ease;
	line-height: 1.3;
}

.sc-icg-safety-custom-wrap .sp-suggestion-btn:hover {
	background: rgba(107, 181, 107, 0.2);
	border-color: rgba(107, 181, 107, 0.4);
}

.sc-icg-safety-custom-wrap .sp-suggestion-btn.used {
	opacity: 0.4;
	text-decoration: line-through;
	pointer-events: none;
}

/* ========== 動態清單項目 ========== */

.sc-icg-safety-custom-wrap .sp-items-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-bottom: 12px;
}

.sc-icg-safety-custom-wrap .sp-item {
	display: flex;
	align-items: stretch;
	gap: 8px;
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	padding: 4px;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sc-icg-safety-custom-wrap .sp-item:focus-within {
	border-color: var(--sp-primary);
	box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.1);
}

.sc-icg-safety-custom-wrap .sp-item-text {
	flex: 1;
	min-height: 38px;
	padding: 8px 12px;
	outline: none;
	font-size: 14px;
	font-family: inherit;
	line-height: 1.5;
	color: #333;
	word-break: break-word;
}

.sc-icg-safety-custom-wrap .sp-item-text:empty::before {
	content: attr(data-placeholder);
	color: #bbb;
	pointer-events: none;
}

.sc-icg-safety-custom-wrap .sp-item-contact {
	width: 160px;
	min-width: 120px;
	padding: 8px 12px;
	border: none;
	border-left: 1px solid #e2e8f0;
	font-size: 13px;
	font-family: inherit;
	color: #333;
	outline: none;
	background: transparent;
}

.sc-icg-safety-custom-wrap .sp-item-contact::placeholder {
	color: #bbb;
}

.sc-icg-safety-custom-wrap .sp-item-delete {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	min-width: 34px;
	border: none;
	background: transparent;
	color: #ccc;
	cursor: pointer;
	border-radius: 8px;
	transition: all 0.15s ease;
	font-size: 18px;
	font-family: inherit;
	line-height: 1;
}

.sc-icg-safety-custom-wrap .sp-item-delete:hover {
	background: #fee;
	color: #e53e3e;
}

/* ========== 新增項目按鈕 ========== */

.sc-icg-safety-custom-wrap .sp-add-item-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 16px;
	border: 1.5px dashed #ccc;
	border-radius: 8px;
	background: transparent;
	color: #888;
	font-size: 13px;
	font-family: inherit;
	cursor: pointer;
	transition: all 0.2s ease;
}

.sc-icg-safety-custom-wrap .sp-add-item-btn:hover {
	border-color: var(--sp-primary);
	color: var(--sp-primary);
	background: rgba(74, 144, 217, 0.04);
}

/* ========== 導航按鈕區 ========== */

.sc-icg-safety-custom-wrap .sp-navigation {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 24px 8px 16px;
	gap: 12px;
}

.sc-icg-safety-custom-wrap .sp-navigation .sp-btn {
	min-width: 120px;
}

/* ========== 結果頁 ========== */

.sc-icg-safety-custom-wrap .sp-result-nav {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 16px 0;
	flex-wrap: wrap;
}

.sc-icg-safety-custom-wrap .sp-result-nav-label {
	font-size: 13px;
	color: #888;
}

.sc-icg-safety-custom-wrap .sp-result-nav-btn {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: 1.5px solid var(--sp-primary);
	background: #fff;
	color: var(--sp-primary);
	font-size: 13px;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
}

.sc-icg-safety-custom-wrap .sp-result-nav-btn:hover {
	background: var(--sp-primary);
	color: #fff;
}

/* 可截圖的結果容器 */

.sc-icg-safety-custom-wrap .sp-result-container {
	background: #fff;
	border-radius: 12px;
	padding: 32px 28px;
	border: 1px solid #e2e8f0;
}

.sc-icg-safety-custom-wrap .sp-result-title {
	font-size: 22px;
	font-weight: 700;
	color: #2c3e50;
	text-align: center;
	margin-bottom: 28px;
	padding-bottom: 16px;
	border-bottom: 2px solid var(--sp-primary);
}

.sc-icg-safety-custom-wrap .sp-result-step {
	margin-bottom: 20px;
	padding-bottom: 16px;
	border-bottom: 1px solid #f0f0f0;
}

.sc-icg-safety-custom-wrap .sp-result-step:last-child {
	margin-bottom: 0;
	padding-bottom: 0;
	border-bottom: none;
}

.sc-icg-safety-custom-wrap .sp-result-step-title {
	font-size: 15px;
	font-weight: 600;
	color: var(--sp-primary);
	margin-bottom: 8px;
}

.sc-icg-safety-custom-wrap .sp-result-items {
	list-style: none;
	padding: 0;
	margin: 0;
}

.sc-icg-safety-custom-wrap .sp-result-items li {
	padding: 5px 0 5px 20px;
	position: relative;
	font-size: 14px;
	color: #444;
	line-height: 1.6;
}

.sc-icg-safety-custom-wrap .sp-result-items li::before {
	content: '';
	position: absolute;
	left: 4px;
	top: 13px;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--sp-primary);
	opacity: 0.5;
}

.sc-icg-safety-custom-wrap .sp-result-items .sp-result-contact {
	color: #888;
	font-size: 13px;
	margin-left: 8px;
}

.sc-icg-safety-custom-wrap .sp-result-footer {
	text-align: center;
	font-size: 12px;
	color: #aaa;
	margin-top: 24px;
	padding-top: 16px;
	border-top: 1px solid #f0f0f0;
}

/* ========== 匯出按鈕區 ========== */

.sc-icg-safety-custom-wrap .sp-export-actions {
	display: flex;
	justify-content: center;
	gap: 12px;
	padding: 24px 0 16px;
	flex-wrap: wrap;
}

/* ========== Loading 狀態 ========== */

.sc-icg-safety-custom-wrap .sp-btn.loading {
	opacity: 0.7;
	pointer-events: none;
}

.sc-icg-safety-custom-wrap .sp-btn.loading::after {
	content: '';
	width: 16px;
	height: 16px;
	border: 2px solid transparent;
	border-top-color: currentColor;
	border-radius: 50%;
	animation: spSpin 0.6s linear infinite;
	margin-left: 4px;
}

@keyframes spSpin {
	to {
		transform: rotate(360deg);
	}
}

/* ========== 響應式 ========== */

@media (max-width: 768px) {
	.sc-icg-safety-custom-wrap .sp-welcome {
		padding: 32px 16px;
	}

	.sc-icg-safety-custom-wrap .sp-main-title {
		font-size: 22px;
	}

	.sc-icg-safety-custom-wrap .sp-progress-dot {
		width: 30px;
		height: 30px;
		font-size: 12px;
	}

	.sc-icg-safety-custom-wrap .sp-progress-line {
		width: 16px;
	}

	.sc-icg-safety-custom-wrap .sp-step-title {
		font-size: 18px;
	}

	.sc-icg-safety-custom-wrap .sp-item-contact {
		width: 100%;
		min-width: unset;
		border-left: none;
		border-top: 1px solid #e2e8f0;
	}

	.sc-icg-safety-custom-wrap .sp-item {
		flex-wrap: wrap;
	}

	.sc-icg-safety-custom-wrap .sp-item-text {
		min-width: calc(100% - 42px);
	}

	.sc-icg-safety-custom-wrap .sp-navigation {
		padding: 20px 4px 16px;
	}

	.sc-icg-safety-custom-wrap .sp-navigation .sp-btn {
		min-width: 100px;
		padding: 0 16px;
		font-size: 14px;
	}

	.sc-icg-safety-custom-wrap .sp-result-container {
		padding: 24px 18px;
	}

	.sc-icg-safety-custom-wrap .sp-result-title {
		font-size: 19px;
	}

	.sc-icg-safety-custom-wrap .sp-export-actions {
		flex-direction: column;
		align-items: stretch;
	}

	.sc-icg-safety-custom-wrap .sp-export-actions .sp-btn {
		width: 100%;
	}
}

@media (max-width: 480px) {
	.sc-icg-safety-custom-wrap .sp-progress-dot {
		width: 26px;
		height: 26px;
		font-size: 11px;
	}

	.sc-icg-safety-custom-wrap .sp-progress-line {
		width: 10px;
		margin: 0 2px;
	}

	.sc-icg-safety-custom-wrap .sp-welcome {
		padding: 24px 12px;
	}

	.sc-icg-safety-custom-wrap .sp-btn {
		height: 42px;
		font-size: 14px;
	}

	.sc-icg-safety-custom-wrap .sp-start-btn {
		height: 44px;
		width: 100%;
	}

	.sc-icg-safety-custom-wrap .sp-result-nav-btn {
		width: 30px;
		height: 30px;
		font-size: 12px;
	}
}
