/**
 * SC-ICG HJ Exchange — 前台切換器樣式
 */

/* ============================================================
 * 共用
 * ============================================================ */
.sc-hj-exchange-switcher {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans TC', sans-serif;
	font-size: 14px;
	line-height: 1.4;
	z-index: 99999;
	box-sizing: border-box;
}

.sc-hj-exchange-switcher *,
.sc-hj-exchange-switcher *::before,
.sc-hj-exchange-switcher *::after {
	box-sizing: border-box;
}

/* ============================================================
 * 浮動工具列（幣別切換 + 換算器合併容器）
 * ============================================================ */
.sc-hj-toolbar {
	position: fixed;
	z-index: 99999;
	display: flex;
	align-items: flex-end;
	gap: 8px;
}

.sc-hj-toolbar-bottom-right { bottom: 24px; right: 24px; }
.sc-hj-toolbar-bottom-left  { bottom: 24px; left: 24px; }
.sc-hj-toolbar-top-right    { top: 80px; right: 24px; }
.sc-hj-toolbar-top-left     { top: 80px; left: 24px; }

/* 工具列內的子元素不要自帶 fixed */
.sc-hj-toolbar .sc-hj-exchange-switcher,
.sc-hj-toolbar .sc-hj-calc-wrap {
	position: relative !important;
	bottom: auto !important;
	right: auto !important;
	left: auto !important;
	top: auto !important;
}

/* Inline 模式用（Shortcode） */
.sc-hj-exchange-inline {
	position: relative;
	display: inline-block;
}

/* ============================================================
 * Trigger Button
 * ============================================================ */
.sc-hj-exchange-trigger {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 16px;
	background: #ffffff;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 50px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	color: #333;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
	transition: all 0.2s ease;
	line-height: 1;
}

.sc-hj-exchange-trigger:hover {
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
	transform: translateY(-1px);
}

.sc-hj-exchange-trigger:focus {
	outline: none;
	box-shadow: 0 0 0 3px rgba(10, 110, 177, 0.2), 0 2px 12px rgba(0, 0, 0, 0.08);
}

.sc-hj-flag {
	font-size: 18px;
	line-height: 1;
}

.sc-hj-code {
	font-weight: 600;
	letter-spacing: 0.3px;
}

.sc-hj-chevron {
	transition: transform 0.2s ease;
	opacity: 0.5;
}

.sc-hj-exchange-switcher.open .sc-hj-chevron {
	transform: rotate(180deg);
}

/* ============================================================
 * Dropdown
 * ============================================================ */
.sc-hj-exchange-dropdown {
	display: none;
	position: absolute;
	width: 260px;
	max-height: 420px;
	overflow-y: auto;
	background: #ffffff;
	border: 1px solid rgba(0, 0, 0, 0.10);
	border-radius: 12px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
	padding: 8px 0;
	margin-top: 8px;
	z-index: 100000;
}

/* 工具列內的 dropdown 向上展開 */
.sc-hj-toolbar .sc-hj-exchange-dropdown {
	bottom: 100%;
	right: 0;
	margin-top: 0;
	margin-bottom: 8px;
}

/* Inline 模式向下展開 */
.sc-hj-exchange-inline .sc-hj-exchange-dropdown {
	top: 100%;
	left: 0;
}

.sc-hj-exchange-switcher.open .sc-hj-exchange-dropdown {
	display: block;
	animation: scHjDropIn 0.2s ease-out;
}

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

/* 工具列向上展開動畫 */
.sc-hj-toolbar .sc-hj-exchange-dropdown {
	animation-name: scHjDropUp;
}

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

/* ============================================================
 * Dropdown Scrollbar
 * ============================================================ */
.sc-hj-exchange-dropdown::-webkit-scrollbar {
	width: 6px;
}

.sc-hj-exchange-dropdown::-webkit-scrollbar-track {
	background: transparent;
}

.sc-hj-exchange-dropdown::-webkit-scrollbar-thumb {
	background: rgba(0, 0, 0, 0.15);
	border-radius: 3px;
}

/* ============================================================
 * Group & Options
 * ============================================================ */
.sc-hj-exchange-group {
	padding: 4px 0;
}

.sc-hj-exchange-group + .sc-hj-exchange-group {
	border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.sc-hj-group-label {
	padding: 8px 16px 4px;
	font-size: 11px;
	font-weight: 600;
	color: rgba(0, 0, 0, 0.4);
	text-transform: uppercase;
	letter-spacing: 0.8px;
}

.sc-hj-currency-option {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px;
	text-decoration: none;
	color: #333;
	transition: background 0.15s ease;
	font-size: 13.5px;
}

.sc-hj-currency-option:hover {
	background: rgba(0, 0, 0, 0.04);
	color: #333;
	text-decoration: none;
}

.sc-hj-currency-option.active {
	background: rgba(10, 110, 177, 0.08);
	color: #0A6EB1;
	font-weight: 500;
}

.sc-hj-currency-option .sc-hj-flag {
	font-size: 16px;
}

.sc-hj-currency-option .sc-hj-code {
	font-weight: 600;
	font-size: 13px;
	min-width: 36px;
}

.sc-hj-name {
	color: rgba(0, 0, 0, 0.5);
	font-size: 12px;
}

/* ============================================================
 * Footer
 * ============================================================ */
.sc-hj-exchange-footer {
	padding: 8px 16px;
	font-size: 11px;
	color: rgba(0, 0, 0, 0.35);
	text-align: center;
	border-top: 1px solid rgba(0, 0, 0, 0.06);
	margin-top: 4px;
}

/* ============================================================
 * Inline Style (Shortcode)
 * ============================================================ */
.sc-hj-exchange-inline {
	position: relative;
	display: inline-block;
}

.sc-hj-exchange-inline .sc-hj-exchange-dropdown {
	position: absolute;
	top: 100%;
	left: 0;
}

/* ============================================================
 * Calculator — Wrapper & Floating
 * ============================================================ */
.sc-hj-calc-wrap {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans TC', sans-serif;
	font-size: 14px;
	z-index: 99998;
	box-sizing: border-box;
}

.sc-hj-calc-wrap *,
.sc-hj-calc-wrap *::before,
.sc-hj-calc-wrap *::after {
	box-sizing: border-box;
}

.sc-hj-calc-floating {
	position: relative;
}

/* --- Trigger Button --- */
.sc-hj-calc-trigger {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 16px;
	background: #ffffff;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 50px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	color: #555;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
	transition: all 0.2s ease;
	line-height: 1;
	font-family: inherit;
}

.sc-hj-calc-trigger:hover {
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
	transform: translateY(-1px);
	color: #0A6EB1;
}

.sc-hj-calc-trigger.active {
	background: #0A6EB1;
	color: #ffffff;
	border-color: #0A6EB1;
}

.sc-hj-calc-trigger-text {
	font-weight: 600;
	letter-spacing: 0.3px;
}

/* --- Panel (collapsible) --- */
.sc-hj-calc-panel {
	display: none;
	width: 380px;
	max-height: 520px;
	overflow-y: auto;
	background: #ffffff;
	border: 1px solid rgba(0, 0, 0, 0.10);
	border-radius: 16px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
}

.sc-hj-calc-floating .sc-hj-calc-panel {
	position: absolute;
	bottom: 100%;
	right: 0;
	margin-bottom: 8px;
}

.sc-hj-calc-panel-open {
	display: block;
	animation: scHjCalcIn 0.25s ease-out;
}

@keyframes scHjCalcIn {
	from { opacity: 0; transform: translateY(10px) scale(0.97); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Inline mode (shortcode) */
.sc-hj-calc-wrap:not(.sc-hj-calc-floating) .sc-hj-calc-panel {
	position: relative;
	width: 100%;
	max-width: 480px;
	box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
}

/* --- Header --- */
.sc-hj-calc-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 18px 22px 0;
}

.sc-hj-calc-title {
	font-size: 16px;
	font-weight: 700;
	color: #1a1a1a;
	margin: 0;
}

.sc-hj-calc-close {
	width: 32px;
	height: 32px;
	border: none;
	background: transparent;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: rgba(0, 0, 0, 0.3);
	border-radius: 8px;
	transition: all 0.15s;
}

.sc-hj-calc-close:hover {
	background: rgba(0, 0, 0, 0.05);
	color: rgba(0, 0, 0, 0.6);
}

/* --- Body --- */
.sc-hj-calc-body {
	padding: 14px 22px 22px;
}

/* --- Currency Rows --- */
.sc-hj-calc-from,
.sc-hj-calc-to {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 12px 14px;
	background: #f8f9fa;
	border: 1px solid rgba(0, 0, 0, 0.06);
	border-radius: 10px;
}

.sc-hj-calc-currency-badge {
	display: flex;
	align-items: center;
	gap: 7px;
	flex-shrink: 0;
}

.sc-hj-calc-flag { font-size: 20px; line-height: 1; }
.sc-hj-calc-code { font-size: 14px; font-weight: 700; color: #1a1a1a; }
.sc-hj-calc-name-text { font-size: 11.5px; color: rgba(0,0,0,0.35); }

.sc-hj-calc-input {
	width: 140px;
	height: 42px;
	padding: 0 12px;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 8px;
	font-size: 17px;
	font-weight: 600;
	color: #1a1a1a;
	text-align: right;
	background: #ffffff;
	transition: border-color 0.2s, box-shadow 0.2s;
	font-family: inherit;
	-moz-appearance: textfield;
}

.sc-hj-calc-input::-webkit-outer-spin-button,
.sc-hj-calc-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.sc-hj-calc-input:focus {
	outline: none;
	border-color: #0A6EB1;
	box-shadow: 0 0 0 3px rgba(10, 110, 177, 0.12);
}

/* --- Swap --- */
.sc-hj-calc-swap-wrap {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 6px 0;
}

.sc-hj-calc-swap {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: 1px solid rgba(0, 0, 0, 0.1);
	background: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: rgba(0, 0, 0, 0.35);
	transition: all 0.2s ease;
	flex-shrink: 0;
}

.sc-hj-calc-swap:hover {
	background: #f0f2f4;
	color: #0A6EB1;
	border-color: rgba(10, 110, 177, 0.3);
}

.sc-hj-calc-swap.sc-hj-calc-swap-active {
	background: rgba(10, 110, 177, 0.08);
	color: #0A6EB1;
	border-color: rgba(10, 110, 177, 0.3);
	transform: rotate(180deg);
}

.sc-hj-calc-divider {
	flex: 1;
	height: 1px;
	background: rgba(0, 0, 0, 0.06);
}

/* --- To Row --- */
.sc-hj-calc-to {
	padding: 12px 14px;
	background: #f8f9fa;
	border: 1px solid rgba(0, 0, 0, 0.06);
	border-radius: 10px;
}

.sc-hj-calc-select {
	width: 100%;
	height: 38px;
	padding: 0 30px 0 10px;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	color: #1a1a1a;
	background: #fff url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center;
	appearance: none;
	-webkit-appearance: none;
	cursor: pointer;
	font-family: inherit;
	transition: border-color 0.2s;
	max-width: 100%;
}

.sc-hj-calc-select:focus {
	outline: none;
	border-color: #0A6EB1;
	box-shadow: 0 0 0 3px rgba(10, 110, 177, 0.12);
}

/* --- Result Row (獨立一行) --- */
.sc-hj-calc-result-row {
	text-align: center;
	padding: 16px 14px;
	margin-top: 6px;
	background: rgba(10, 110, 177, 0.04);
	border: 1px solid rgba(10, 110, 177, 0.1);
	border-radius: 10px;
}

.sc-hj-calc-result-value {
	font-size: 22px;
	font-weight: 700;
	color: #0A6EB1;
	letter-spacing: -0.3px;
	word-break: break-all;
	line-height: 1.3;
}

/* ============================================================
 * Calculator — Rate Mode Tabs
 * ============================================================ */
.sc-hj-calc-rate-section {
	margin-top: 14px;
	padding-top: 14px;
	border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.sc-hj-calc-mode-tabs {
	display: flex;
	gap: 0;
	background: #f2f3f5;
	border-radius: 8px;
	padding: 3px;
	margin-bottom: 12px;
}

.sc-hj-calc-mode-tab {
	flex: 1;
	padding: 7px 0;
	border: none;
	background: transparent;
	border-radius: 6px;
	font-size: 12.5px;
	font-weight: 500;
	color: rgba(0, 0, 0, 0.45);
	cursor: pointer;
	transition: all 0.2s;
	font-family: inherit;
	text-align: center;
}

.sc-hj-calc-mode-tab:hover {
	color: rgba(0, 0, 0, 0.7);
}

.sc-hj-calc-mode-tab.active {
	background: #ffffff;
	color: #0A6EB1;
	font-weight: 600;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* --- Mode Panels --- */
.sc-hj-calc-mode-panel {
	display: none;
}

.sc-hj-calc-mode-panel.active {
	display: block;
}

/* Auto mode */
.sc-hj-calc-rate-display-wrap {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.sc-hj-calc-rate-label {
	font-size: 11px;
	font-weight: 600;
	color: rgba(0, 0, 0, 0.3);
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.sc-hj-calc-rate-display {
	font-size: 13px;
	color: rgba(0, 0, 0, 0.55);
	font-variant-numeric: tabular-nums;
}

/* Manual mode */
.sc-hj-calc-manual-wrap {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.sc-hj-calc-manual-input-row {
	display: flex;
	align-items: center;
	gap: 8px;
}

.sc-hj-calc-manual-prefix {
	font-size: 13px;
	font-weight: 500;
	color: rgba(0, 0, 0, 0.5);
	white-space: nowrap;
}

.sc-hj-calc-manual-suffix {
	font-size: 13px;
	font-weight: 600;
	color: rgba(0, 0, 0, 0.5);
	white-space: nowrap;
}

.sc-hj-calc-rate-input {
	flex: 1;
	height: 36px;
	padding: 0 10px;
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
	color: #1a1a1a;
	text-align: center;
	background: #fff;
	transition: border-color 0.2s, box-shadow 0.2s;
	font-family: inherit;
	-moz-appearance: textfield;
	min-width: 80px;
}

.sc-hj-calc-rate-input::-webkit-outer-spin-button,
.sc-hj-calc-rate-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.sc-hj-calc-rate-input:focus {
	outline: none;
	border-color: #0A6EB1;
	box-shadow: 0 0 0 3px rgba(10, 110, 177, 0.12);
}

.sc-hj-calc-rate-input::placeholder {
	color: rgba(0, 0, 0, 0.2);
	font-weight: 400;
}

/* ============================================================
 * Responsive
 * ============================================================ */
@media (max-width: 480px) {
	.sc-hj-toolbar {
		bottom: 16px !important;
		right: 16px !important;
		left: auto !important;
		top: auto !important;
	}

	.sc-hj-calc-panel {
		width: calc(100vw - 32px);
		max-width: 380px;
	}

	.sc-hj-calc-from {
		flex-wrap: wrap;
	}

	.sc-hj-calc-input {
		width: 100%;
		font-size: 16px;
	}

	.sc-hj-exchange-dropdown {
		width: calc(100vw - 32px);
		max-width: 300px;
	}

	.sc-hj-exchange-trigger {
		padding: 8px 12px;
		font-size: 13px;
	}
}
