/* Writers Chat – front-end widget */
.wrc-root {
	--wrc-color: #c62828;
	--wrc-offset: 20px;
	--wrc-bg: #f4f5f7;
	--wrc-text: #1d2327;
	--wrc-muted: #6b7280;
	--wrc-border: #e5e7eb;
	--wrc-radius: 16px;
	font-family: inherit;
	font-size: 15px;
	line-height: 1.6;
	color: var(--wrc-text);
	box-sizing: border-box;
}
.wrc-root *, .wrc-root *::before, .wrc-root *::after { box-sizing: border-box; }
.wrc-root button { font-family: inherit; cursor: pointer; margin: 0; text-transform: none; letter-spacing: normal; box-shadow: none; }
.wrc-root [hidden] { display: none !important; }

/* ---------- launcher ---------- */
.wrc-floating .wrc-launcher {
	position: fixed;
	bottom: var(--wrc-offset);
	z-index: 999998;
	width: 60px; height: 60px;
	border-radius: 50%;
	border: 0; padding: 0;
	background: var(--wrc-color);
	color: #fff;
	display: flex; align-items: center; justify-content: center;
	box-shadow: 0 6px 20px rgba(0,0,0,.25);
	transition: transform .2s ease;
}
.wrc-floating .wrc-launcher:hover { transform: scale(1.07); }
.wrc-floating .wrc-launcher:focus-visible { outline: 3px solid rgba(0,0,0,.35); outline-offset: 3px; }
.wrc-pos-right .wrc-launcher, .wrc-pos-right.wrc-floating .wrc-panel { right: var(--wrc-offset); left: auto; }
.wrc-pos-left .wrc-launcher, .wrc-pos-left.wrc-floating .wrc-panel { left: var(--wrc-offset); right: auto; }
.wrc-badge {
	position: absolute; top: -2px; inset-inline-end: -2px;
	min-width: 22px; height: 22px; padding: 0 6px;
	border-radius: 11px; background: #111; color: #fff;
	font-size: 12px; font-weight: 700; line-height: 22px; text-align: center;
	border: 2px solid #fff;
}
.wrc-open .wrc-launcher .wrc-badge { display: none; }

/* ---------- panel ---------- */
.wrc-panel {
	display: flex; flex-direction: column;
	background: #fff;
	overflow: hidden;
	position: relative;
}
.wrc-floating .wrc-panel {
	position: fixed;
	bottom: calc(var(--wrc-offset) + 74px);
	z-index: 999999;
	width: 380px; max-width: calc(100vw - 24px);
	height: 600px; max-height: calc(100vh - var(--wrc-offset) - 100px);
	border-radius: var(--wrc-radius);
	box-shadow: 0 12px 40px rgba(0,0,0,.25);
	opacity: 0; visibility: hidden;
	transform: translateY(16px) scale(.98);
	transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
}
.wrc-floating.wrc-open .wrc-panel {
	opacity: 1; visibility: visible; transform: none;
	transition: opacity .2s ease, transform .2s ease;
}
.wrc-inline-host { max-width: 100%; }
.wrc-inline, .wrc-inline .wrc-panel { height: 100%; }
.wrc-inline .wrc-panel { border: 1px solid var(--wrc-border); border-radius: var(--wrc-radius); }

@media (max-width: 480px) {
	.wrc-floating .wrc-panel {
		left: 0 !important; right: 0 !important; bottom: 0;
		width: 100vw; max-width: 100vw;
		height: 100%; max-height: 100%;
		border-radius: 0;
	}
	.wrc-floating.wrc-open .wrc-launcher { display: none; }
}

.wrc-head {
	display: flex; align-items: center; justify-content: space-between; gap: 8px;
	padding: 14px 16px;
	background: var(--wrc-color); color: #fff;
	flex-shrink: 0;
}
.wrc-head-title { font-weight: 700; font-size: 16px; line-height: 1.3; }
.wrc-head-sub { font-size: 12px; opacity: .85; }
.wrc-head-btns { display: flex; gap: 4px; }
.wrc-icon-btn {
	background: rgba(255,255,255,.15) !important; color: #fff !important;
	border: 0 !important; border-radius: 50% !important;
	width: 36px; height: 36px; padding: 0 !important;
	display: inline-flex; align-items: center; justify-content: center;
}
.wrc-icon-btn:hover { background: rgba(255,255,255,.3) !important; }

.wrc-body { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--wrc-bg); position: relative; }

/* ---------- auth ---------- */
.wrc-auth { padding: 18px; overflow-y: auto; }
.wrc-tabs { display: flex; background: #e9eaee; border-radius: 10px; padding: 4px; margin-bottom: 14px; }
.wrc-tab {
	flex: 1; border: 0 !important; background: transparent !important; color: var(--wrc-muted) !important;
	padding: 8px !important; border-radius: 8px !important; font-weight: 600; font-size: 14px;
}
.wrc-tab.is-active { background: #fff !important; color: var(--wrc-text) !important; box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.wrc-form { display: flex; flex-direction: column; gap: 12px; }
.wrc-hint { margin: 0; color: var(--wrc-muted); font-size: 14px; }
.wrc-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; margin: 0; }
.wrc-input {
	width: 100%; padding: 10px 12px !important; margin: 0 !important;
	border: 1px solid #d1d5db !important; border-radius: 10px !important;
	font: inherit; font-size: 15px !important; background: #fff !important; color: var(--wrc-text) !important;
	height: auto !important; box-shadow: none !important;
}
.wrc-input:focus { outline: none; border-color: var(--wrc-color) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--wrc-color) 20%, transparent) !important; }
.wrc-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.wrc-btn {
	background: var(--wrc-color) !important; color: #fff !important; border: 0 !important;
	border-radius: 10px !important; padding: 11px 16px !important; font-weight: 700; font-size: 15px; width: 100%;
}
.wrc-btn:disabled { opacity: .6; cursor: wait; }
.wrc-btn-light { background: #fff !important; color: var(--wrc-color) !important; border: 1px solid var(--wrc-color) !important; width: auto; }
.wrc-error { background: #fdecec; color: #b42318; border-radius: 10px; padding: 9px 12px; font-size: 14px; margin-bottom: 10px; }
.wrc-error-float { margin: 0 0 8px; }
.wrc-notice { padding: 30px 22px; text-align: center; color: var(--wrc-muted); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.wrc-notice p { margin: 0; }

/* ---------- messages ---------- */
.wrc-list { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.wrc-welcome {
	background: #fff8e1; color: #6d4c00; border-radius: 12px; padding: 10px 12px;
	font-size: 13.5px; text-align: center; margin-bottom: 6px; white-space: pre-line;
}
.wrc-empty { text-align: center; color: var(--wrc-muted); font-size: 14px; margin: auto 0; }
.wrc-older {
	align-self: center; background: #fff !important; color: var(--wrc-text) !important; border: 1px solid var(--wrc-border) !important;
	border-radius: 20px !important; padding: 5px 14px !important; font-size: 13px;
}
.wrc-msg { display: flex; }
.wrc-mine { justify-content: flex-end; }
.wrc-theirs { justify-content: flex-start; }
.wrc-bubble {
	max-width: 82%; padding: 8px 11px 5px; border-radius: 14px;
	background: #fff; box-shadow: 0 1px 1px rgba(0,0,0,.06); word-wrap: break-word; overflow-wrap: anywhere;
}
.wrc-mine .wrc-bubble { background: color-mix(in srgb, var(--wrc-color) 12%, #fff); border-end-end-radius: 4px; }
.wrc-theirs .wrc-bubble { border-end-start-radius: 4px; }
.wrc-author { font-size: 12px; font-weight: 700; color: var(--wrc-color); margin-bottom: 2px; }
.wrc-text { white-space: pre-wrap; font-size: 14.5px; }
.wrc-text a { color: var(--wrc-color); text-decoration: underline; }
.wrc-meta { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; margin-top: 3px; font-size: 11px; color: var(--wrc-muted); }
.wrc-status { display: inline-block; padding: 0 7px; border-radius: 9px; font-size: 11px; font-weight: 600; background: #eef0f3; color: #4b5563; }
.wrc-st-review { background: #fff4d6; color: #8a5a00; }
.wrc-st-published { background: #dcfce7; color: #166534; }
.wrc-st-rejected { background: #fde2e1; color: #991b1b; }
.wrc-status-link { text-decoration: none; color: #166534; font-weight: 600; }

.wrc-gallery { display: grid; gap: 3px; margin: 2px 0 5px; border-radius: 10px; overflow: hidden; }
.wrc-g1 { grid-template-columns: 1fr; }
.wrc-g2, .wrc-g4 { grid-template-columns: 1fr 1fr; }
.wrc-g3 { grid-template-columns: 1fr 1fr 1fr; }
.wrc-img { display: block; background: #e5e7eb; aspect-ratio: 1 / 1; }
.wrc-g1 .wrc-img { aspect-ratio: auto; max-height: 280px; }
.wrc-img img { display: block; width: 100%; height: 100%; object-fit: cover; margin: 0; max-width: none; border-radius: 0; }
.wrc-g1 .wrc-img img { max-height: 280px; height: auto; }

/* ---------- composer ---------- */
.wrc-composer { background: #fff; border-top: 1px solid var(--wrc-border); padding: 8px 10px 6px; flex-shrink: 0; }
.wrc-compose-row { display: flex; align-items: flex-end; gap: 6px; }
.wrc-textarea {
	flex: 1; resize: none; min-height: 42px; max-height: 160px;
	padding: 10px 12px !important; margin: 0 !important; border: 1px solid #d1d5db !important; border-radius: 20px !important;
	font: inherit; font-size: 15px !important; line-height: 1.45 !important; background: #f9fafb !important; color: var(--wrc-text) !important;
	box-shadow: none !important; width: auto !important;
}
.wrc-textarea:focus { outline: none; border-color: var(--wrc-color) !important; background: #fff !important; }
.wrc-attach, .wrc-send {
	flex-shrink: 0; width: 42px; height: 42px; border-radius: 50% !important; padding: 0 !important;
	display: inline-flex; align-items: center; justify-content: center; border: 0 !important;
}
.wrc-attach { background: #f1f2f4 !important; color: #4b5563 !important; }
.wrc-attach:hover { background: #e5e7eb !important; }
.wrc-send { background: var(--wrc-color) !important; color: #fff !important; }
[dir="rtl"] .wrc-send svg { transform: scaleX(-1); }
.wrc-send:disabled { opacity: .55; cursor: wait; }
.wrc-limits { font-size: 11px; color: var(--wrc-muted); text-align: center; margin-top: 4px; }
.wrc-previews { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.wrc-prev { position: relative; width: 62px; height: 62px; border-radius: 8px; overflow: hidden; background: #eee; }
.wrc-prev img { width: 100%; height: 100%; object-fit: cover; display: block; margin: 0; }
.wrc-prev-x {
	position: absolute; top: 2px; inset-inline-end: 2px; width: 22px; height: 22px; padding: 0 !important;
	border-radius: 50% !important; border: 0 !important; background: rgba(0,0,0,.65) !important; color: #fff !important;
	font-size: 16px; line-height: 22px; text-align: center;
}
.wrc-progress { height: 4px; background: #eee; border-radius: 2px; overflow: hidden; margin-bottom: 8px; }
.wrc-progress span { display: block; height: 100%; width: 0; background: var(--wrc-color); transition: width .15s; }

.wrc-drop {
	position: absolute; inset: 8px; border: 3px dashed var(--wrc-color); border-radius: 14px;
	background: rgba(255,255,255,.92); display: none; align-items: center; justify-content: center;
	font-weight: 700; color: var(--wrc-color); z-index: 5; pointer-events: none;
}
.wrc-drop.is-on { display: flex; }

/* ---------- misc ---------- */
.wrc-loading { display: flex; justify-content: center; padding: 30px; }
.wrc-spinner {
	width: 28px; height: 28px; border-radius: 50%;
	border: 3px solid #ddd; border-top-color: var(--wrc-color);
	animation: wrc-spin .8s linear infinite;
}
@keyframes wrc-spin { to { transform: rotate(360deg); } }

.wrc-lightbox {
	position: fixed; inset: 0; z-index: 1000000; background: rgba(0,0,0,.88);
	display: flex; align-items: center; justify-content: center; padding: 20px; cursor: zoom-out;
}
.wrc-lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.wrc-lb-open {
	position: absolute; top: 14px; right: 14px; width: 40px; height: 40px; border-radius: 50%;
	background: rgba(255,255,255,.18); color: #fff; font-size: 20px; text-decoration: none;
	display: flex; align-items: center; justify-content: center;
}

@media (prefers-reduced-motion: reduce) {
	.wrc-floating .wrc-panel, .wrc-launcher { transition: none !important; }
}
