/* =========================================================================
   Libafang online chat widget (2026-09-22) — self-contained stylesheet.
   Reuses the theme custom properties from main.css; loaded site-wide only
   while the chat widget is enabled. FAB sits in footer.php's .float-tools
   column, the panel anchors above it (JS sets the exact bottom offset).
   ========================================================================= */

/* ---------- floating action button ---------- */
.lbf-chat-fab {
	position: relative; width: 46px; height: 46px; border-radius: 50%; border: 0;
	display: flex; align-items: center; justify-content: center; cursor: pointer;
	background: linear-gradient(135deg, var(--c-gold), var(--c-gold-deep));
	color: #241a08; box-shadow: var(--shadow-hover); transition: transform .2s; padding: 0;
}
.lbf-chat-fab:hover { transform: scale(1.08); }
.lbf-chat-badge {
	position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px;
	border-radius: 9px; background: #c0392b; color: #fff; font: 700 11px/18px var(--font-body);
	text-align: center; padding: 0 4px; box-shadow: 0 2px 6px rgba(0,0,0,.3);
}

/* ---------- panel ---------- */
.lbf-chat { position: fixed; right: 18px; bottom: 212px; z-index: 240; pointer-events: none; }
.lbf-chat-panel {
	pointer-events: auto; width: min(380px, calc(100vw - 32px));
	height: min(560px, calc(100vh - 250px)); min-height: 320px;
	display: flex; flex-direction: column; background: #fff; border-radius: 14px;
	border: 1px solid var(--c-line); overflow: hidden;
	box-shadow: 0 24px 64px rgba(26, 20, 16, .32);
	animation: lbf-chat-in .22s ease;
}
/* display:flex above beats the UA [hidden] rule (author > UA stylesheet). */
.lbf-chat-panel[hidden] { display: none; }
.lbf-chat-id[hidden] { display: none; }
.lbf-chat-idrow[hidden] { display: none; }
@keyframes lbf-chat-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.lbf-chat-head {
	background: linear-gradient(135deg, #1a1410, #3a2a15); color: #fff;
	padding: 14px 16px; display: flex; align-items: center; gap: 12px;
	border-bottom: 2px solid var(--c-gold);
}
.lbf-chat-head-txt { flex: 1; min-width: 0; }
.lbf-chat-head-txt strong { display: block; font: 700 16px/1.2 var(--font-head); letter-spacing: .3px; }
.lbf-chat-head-txt span { display: block; font-size: 12px; color: #d8cdb4; margin-top: 3px; }
.lbf-chat-x {
	border: 0; background: rgba(255,255,255,.12); color: #fff; width: 28px; height: 28px;
	border-radius: 50%; font-size: 18px; line-height: 1; cursor: pointer; flex: 0 0 28px;
}
.lbf-chat-x:hover { background: rgba(255,255,255,.26); }

/* ---------- messages ---------- */
.lbf-chat-log {
	flex: 1; overflow-y: auto; overscroll-behavior: contain;
	background: var(--c-bg-soft); padding: 14px 14px 8px;
	display: flex; flex-direction: column; gap: 10px;
}
.lbf-m { display: flex; }
.lbf-m-visitor { justify-content: flex-end; }
.lbf-m-b {
	position: relative; max-width: 82%; padding: 9px 12px 16px; border-radius: 12px;
	font-size: 13.5px; line-height: 1.55; word-break: break-word; white-space: pre-wrap;
}
.lbf-m-visitor .lbf-m-b {
	background: linear-gradient(135deg, var(--c-gold), var(--c-gold-deep));
	color: #241a08; border-bottom-right-radius: 4px;
}
.lbf-m-admin .lbf-m-b {
	background: #fff; border: 1px solid var(--c-line); color: var(--c-text);
	border-bottom-left-radius: 4px;
}
.lbf-m-t { position: absolute; right: 10px; bottom: 3px; font-size: 10px; opacity: .55; }
.lbf-m-sys { margin: 0; text-align: center; font-size: 12px; color: #a0803a; }

/* ---------- form ---------- */
.lbf-chat-form { border-top: 1px solid var(--c-line); background: #fff; padding: 10px 12px 8px; }
.lbf-chat-id { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.lbf-chat-id input {
	width: 100%; border: 1px solid var(--c-line); border-radius: 8px; padding: 8px 10px;
	font-size: 13px; background: var(--c-bg-soft); color: var(--c-text);
}
.lbf-chat-id input:focus { outline: none; border-color: var(--c-primary); background: #fff; }
.lbf-chat-idrow { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 12px; color: var(--c-muted); }
.lbf-chat-idrow span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbf-chat-edit {
	border: 0; background: none; color: var(--c-primary); font-size: 12px; cursor: pointer;
	text-decoration: underline; padding: 0; flex: 0 0 auto;
}
.lbf-chat-row { display: flex; gap: 8px; align-items: flex-end; }
.lbf-chat-row textarea {
	flex: 1; resize: none; border: 1px solid var(--c-line); border-radius: 10px;
	padding: 9px 11px; font-size: 13.5px; font-family: var(--font-body); line-height: 1.5;
	max-height: 96px; background: var(--c-bg-soft); color: var(--c-text);
}
.lbf-chat-row textarea:focus { outline: none; border-color: var(--c-primary); background: #fff; }
.lbf-chat-send {
	width: 40px; height: 40px; flex: 0 0 40px; border: 0; border-radius: 50%; cursor: pointer;
	background: linear-gradient(135deg, var(--c-gold), var(--c-gold-deep)); color: #241a08;
	display: flex; align-items: center; justify-content: center; transition: transform .15s; padding: 0;
}
.lbf-chat-send:hover { transform: scale(1.06); }
.lbf-chat-send:disabled { opacity: .55; cursor: default; transform: none; }
.lbf-chat-note { margin: 6px 2px 0; font-size: 11px; color: var(--c-faint); }
.lbf-chat-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---------- mobile: sheet above the floating tools ---------- */
@media (max-width: 640px) {
	.lbf-chat { left: 10px; right: 10px; bottom: 188px; }
	.lbf-chat-panel { width: auto; height: min(68vh, 540px); }
}

@media (prefers-reduced-motion: reduce) {
	.lbf-chat-panel { animation: none; }
	.lbf-chat-fab, .lbf-chat-send { transition: none; }
}
