/* WALSAY 同意管理与 Odoo 线索桥 —— 前台样式
 * v1.0.3：CMP 首层整体缩小约 50%；主色改官网品牌红 #e2001a（深红 #b00014）；
 * 品牌区换成官网真实红色圆形 W logo；注入 Odoo 原生客服并用 body 类让「返回顶部」避让。
 * 合规要点：接受与「仅必要/拒绝」同等显眼；两套同意独立；同意前门控；第三方脚本须命中 SEO 白名单。 */

/* ---------------- 全屏 CMP 首层（apave 形态，默认） ---------------- */
.wcb-cmp {
	position: fixed;
	inset: 0;
	z-index: 100000;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
	color: #1f2733;
}
.wcb-cmp[hidden], .wcb-prefs[hidden], .wcb-sub-panel[hidden],
.wcb-sub[hidden], .wcb-cookie-reopen[hidden], .wcb-msg[hidden],
.wcb-cmp-short[hidden], .wcb-cmp-body[hidden] { display: none !important; }

.wcb-cmp-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, .96);
	/* 纯白磨砂遮罩：既能聚焦首层，又不把品牌页完全涂黑（贴近 Apave 效果图的白底） */
}

/* v1.0.3：卡片宽度 920px → 460px（约缩小 50%），内边距/字号同比收紧 */
.wcb-cmp-card {
	position: relative;
	box-sizing: border-box;
	width: min( 460px, calc( 100vw - 32px ) );
	max-height: calc( 100vh - 40px );
	margin: 20px auto;
	overflow: auto;
	background: #fff;
	padding: 22px 28px 26px;
	box-shadow: 0 14px 46px rgba(15, 32, 64, .12);
	border-radius: 6px;
	border: 1px solid #eef1f5;
	border-top: 3px solid #e2001a; /* 品牌红顶线 */
}

/* 右上角「继续但不同意」：一键拒绝，和同意同等可达 */
.wcb-cmp-skip {
	position: absolute;
	top: 14px; right: 18px;
	background: transparent;
	border: none;
	font: inherit;
	font-size: 12px;
	font-weight: 700;
	color: #1f2733;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
	padding: 4px;
}
.wcb-cmp-skip:hover { color: #e2001a; }

/* 品牌区：官网真实红色圆形 W logo + 字标（替代 Apave 绿圆点） */
.wcb-cmp-brand {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin: 10px 0 18px;
	line-height: 1;
}
.wcb-cmp-logo {
	width: 40px; height: 40px;
	display: block;
	flex: 0 0 auto;
	object-fit: contain;
}
.wcb-cmp-brand-text {
	font-size: 26px;
	font-weight: 800;
	letter-spacing: -0.5px;
	color: #122b3d; /* 主题主文字/页脚深蓝 */
}

.wcb-cmp-title {
	margin: 0 0 14px;
	font-size: 22px;
	font-weight: 800;
	line-height: 1.3;
	color: #1a1a1a;
}

.wcb-cmp-short { display: none; } /* bar 形态才启用，见下方 */
.wcb-cmp-short strong { display: block; font-size: 14px; margin-bottom: 4px; color: #b00014; }
.wcb-cmp-short span { font-size: 13px; line-height: 1.7; }

.wcb-cmp-body { font-size: 13px; line-height: 1.7; color: #2b2b2b; }
.wcb-cmp-body p { margin: 0 0 10px; }
.wcb-cmp-body a { color: #e2001a; text-decoration: underline; }
.wcb-cmp-purposes { font-size: 12px; color: #555; }
.wcb-cmp-purposes strong { font-weight: 700; color: #b00014; }

.wcb-cmp-actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	justify-content: flex-end;
	margin-top: 18px;
}

/* ---------------- 按钮（首层 / 横幅 / 偏好共用） ---------------- */
.wcb-btn {
	font: inherit;
	font-size: 13px;
	font-weight: 700;
	padding: 10px 18px;
	border-radius: 4px;
	border: 1px solid transparent;
	cursor: pointer;
	white-space: nowrap;
	transition: background .15s, border-color .15s, transform .05s;
}
.wcb-btn:active { transform: translateY(1px); }
.wcb-btn-accept { background: #e2001a; color: #fff; }        /* 品牌红 */
.wcb-btn-accept:hover { background: #b00014; }                /* 深红 */
/* 「仅必要/拒绝」与「全部接受」同样大小、实心描边，不弱化、不折叠进二级菜单 */
.wcb-btn-reject { background: #fff; color: #1f2733; border-color: #1f2733; }
.wcb-btn-reject:hover { background: #fdeced; border-color: #b00014; color: #b00014; }
.wcb-btn-ghost { background: #ececec; color: #1f2733; border-color: #d7dce4; }
.wcb-btn-ghost:hover { background: #e2e5ea; }

/* ---------------- 偏好设置面板（「了解更多」展开） ---------------- */
.wcb-prefs {
	margin: 14px 0 4px;
	padding: 12px 14px;
	background: #f7f9fc;
	border: 1px solid #e3e6eb;
	border-radius: 6px;
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	font-size: 12px;
}
.wcb-prefs label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.wcb-prefs small { color: #7a8391; flex-basis: 100%; line-height: 1.6; }
.wcb-prefs .wcb-btn { margin-left: auto; }

/* ---------------- 贴底细横幅（bar 形态，后台可切换回旧版） ---------------- */
.wcb-cmp-bar { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 99999; }
.wcb-cmp-bar .wcb-cmp-backdrop { display: none; }
.wcb-cmp-bar .wcb-cmp-card {
	width: 100%; max-width: none; max-height: none; margin: 0;
	border-radius: 0; border: none; border-top: 2px solid #e2001a;
	box-shadow: 0 -8px 30px rgba(15, 32, 64, .12);
	padding: 14px 24px;
	display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.wcb-cmp-bar .wcb-cmp-skip { display: none; }
.wcb-cmp-bar .wcb-cmp-brand { display: none; }
.wcb-cmp-bar .wcb-cmp-title { display: none; }
.wcb-cmp-bar .wcb-cmp-body { display: none; }
.wcb-cmp-bar .wcb-cmp-short { display: block; flex: 1 1 auto; }
.wcb-cmp-bar .wcb-cmp-actions { margin: 0; flex: 0 0 auto; }
.wcb-cmp-bar .wcb-btn { font-size: 13.5px; padding: 10px 18px; border-radius: 6px; }
.wcb-cmp-bar .wcb-btn-accept { background: #e2001a; }
.wcb-cmp-bar .wcb-btn-accept:hover { background: #b00014; }
.wcb-cmp-bar .wcb-btn-reject { background: #fff; color: #b00014; border-color: #b00014; }
.wcb-cmp-bar .wcb-btn-reject:hover { background: #fdeced; }
.wcb-cmp-bar .wcb-btn-ghost { background: transparent; color: #55606f; border-color: #d7dce4; }
.wcb-cmp-bar .wcb-btn-ghost:hover { background: #f4f6f9; }
.wcb-cmp-bar .wcb-prefs { max-width: 1200px; margin: 0 auto; }

/* ---------------- 常驻「Cookie 设置」入口 ---------------- */
.wcb-cookie-reopen {
	position: fixed;
	left: 16px; bottom: 16px;
	z-index: 99998;
	background: #fff;
	border: 1px solid #d7dce4;
	color: #55606f;
	font: inherit; font-size: 12px;
	padding: 7px 12px;
	border-radius: 20px;
	cursor: pointer;
	box-shadow: 0 2px 10px rgba(0,0,0,.08);
}
.wcb-cookie-reopen:hover { background: #fdeced; color: #b00014; border-color: #e2001a; }

/* ---------------- Odoo 原生客服气泡与主题「返回顶部」避让 ----------------
 * Odoo Live Chat 气泡在 shadow DOM 里固定 right:25px / bottom:10px / 50×50，
 * 外部 CSS 穿不透 shadow root，只能改 WP 主题侧 .walsay-totop（footer.php:110,
 * theme.css:4339 默认 right: clamp(14px,2vw,30px)）。启用客服时给 body 加
 * .wcb-chat-on，把返回顶部右移到 88px，与 50px 气泡并排不重叠。 */
body.wcb-chat-on .walsay-totop { right: 88px !important; }
@media (max-width: 720px) {
	body.wcb-chat-on .walsay-totop { right: 80px !important; }
}

/* ---------------- 邮箱留资：悬浮组件（默认关闭，shortcode 仍可用） ---------------- */
.wcb-sub {
	position: fixed;
	right: 20px; bottom: 20px;
	z-index: 99997;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}
.wcb-sub-toggle {
	background: #e2001a; color: #fff;
	border: none; border-radius: 24px;
	padding: 12px 20px; font: inherit; font-size: 14px;
	cursor: pointer;
	box-shadow: 0 6px 22px rgba(226, 0, 26, .35);
}
.wcb-sub-toggle:hover { background: #b00014; }
.wcb-sub-panel {
	position: absolute; right: 0; bottom: 56px;
	width: 340px; max-width: calc(100vw - 40px);
	max-height: calc(100vh - 90px); overflow: auto;
	background: #fff; border-radius: 12px;
	border: 1px solid #e3e6eb;
	box-shadow: 0 12px 40px rgba(15, 32, 64, .2);
	padding: 22px;
}
.wcb-sub-close {
	position: absolute; right: 12px; top: 10px;
	background: transparent; border: none;
	font-size: 22px; line-height: 1; color: #8a929e; cursor: pointer;
}
.wcb-inline-wrap { max-width: 560px; margin: 24px auto; }
.wcb-inline-wrap .wcb-form {
	background: #fff; border: 1px solid #e3e6eb; border-radius: 12px;
	padding: 26px; box-shadow: 0 6px 24px rgba(15,32,64,.07);
}

/* ---------------- 表单 ---------------- */
.wcb-form { font-size: 14px; color: #1f2733; }
.wcb-form-title { margin: 0 0 6px; font-size: 18px; color: #b00014; }
.wcb-form-desc { margin: 0 0 18px; color: #5c6572; line-height: 1.7; font-size: 13px; }
.wcb-row { margin-bottom: 12px; }
.wcb-row label { display: block; margin-bottom: 5px; font-size: 12.5px; color: #4a5361; }
.wcb-req { color: #b3261e; }
.wcb-row input[type="text"], .wcb-row input[type="email"] {
	width: 100%; box-sizing: border-box;
	padding: 9px 11px; font: inherit; font-size: 14px;
	border: 1px solid #d7dce4; border-radius: 6px; background: #fbfcfe;
}
.wcb-row input:focus { outline: none; border-color: #e2001a; background: #fff; }
.wcb-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.wcb-consent-check {
	display: flex; align-items: flex-start; gap: 8px;
	margin: 16px 0; font-size: 12px; line-height: 1.7; color: #4a5361; cursor: pointer;
}
.wcb-consent-check input { margin-top: 2px; flex: 0 0 auto; }
.wcb-consent-check a { color: #e2001a; }
.wcb-submit {
	width: 100%; background: #e2001a; color: #fff;
	border: none; border-radius: 6px; padding: 11px 16px;
	font: inherit; font-size: 14px; cursor: pointer;
}
.wcb-submit:hover { background: #b00014; }
.wcb-submit:disabled { opacity: .6; cursor: default; }
.wcb-fineprint { margin: 10px 0 0; font-size: 11px; color: #8a929e; line-height: 1.6; }
.wcb-msg { margin-top: 14px; padding: 10px 12px; border-radius: 6px; font-size: 13px; line-height: 1.6; }
.wcb-msg strong { display: block; margin-bottom: 2px; }
.wcb-msg-ok { background: #e9f7ef; color: #0b6b3a; }
.wcb-msg-error { background: #fdecea; color: #b3261e; }

/* ---------------- 移动端适配 ---------------- */
@media (max-width: 720px) {
	.wcb-cmp-card { width: calc( 100vw - 24px ); margin: 12px auto; padding: 18px 18px 20px; }
	.wcb-cmp-brand { margin: 8px 0 14px; }
	.wcb-cmp-logo { width: 34px; height: 34px; }
	.wcb-cmp-brand-text { font-size: 22px; }
	.wcb-cmp-title { font-size: 20px; margin-bottom: 12px; }
	.wcb-cmp-body { font-size: 12.5px; line-height: 1.65; }
	.wcb-cmp-skip { top: 12px; right: 14px; font-size: 11px; }
	.wcb-cmp-actions { flex-direction: column-reverse; }
	.wcb-cmp-actions .wcb-btn { width: 100%; }
	.wcb-cmp-bar .wcb-cmp-card { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px 16px; }
	.wcb-cmp-bar .wcb-cmp-actions { flex-direction: row; flex-wrap: wrap; }
	.wcb-cmp-bar .wcb-cmp-actions .wcb-btn { flex: 1 1 auto; }
	.wcb-prefs { padding: 12px; }
	.wcb-sub { right: 12px; bottom: 12px; }
	.wcb-sub-panel { width: calc(100vw - 24px); }
	.wcb-cookie-reopen { left: 12px; bottom: 12px; }
}
