/* Madar member chat. Colours come from the active theme's variables (with fallbacks). */
.mc-chat-page {
	--mc-bg: var(--bg-2, #0d0f22);
	--mc-surface: var(--surface, #14162e);
	--mc-surface-2: var(--surface-2, #1b1e3a);
	--mc-surface-3: var(--surface-3, #252946);
	--mc-line: var(--line, rgb(255 255 255 / .07));
	--mc-line-2: var(--line-2, rgb(255 255 255 / .12));
	--mc-text: var(--text, #f2f3f7);
	--mc-text-2: var(--text-2, #b7bbc8);
	--mc-muted: var(--muted, #7e8396);
	--mc-accent: var(--accent, #7c5cff);
	--mc-accent-rgb: var(--accent-rgb, 124 92 255);
	--mc-danger: var(--danger, #ff4d5e);
	--mc-gold: var(--gold, #ffc24a);
	--mc-r: var(--r, 14px);
	--mc-r-sm: var(--r-sm, 10px);
	padding: 12px clamp(0px, 2vw, 24px) 24px;
	color: var(--mc-text);
}
.mc-chat {
	position: relative;
	display: grid;
	grid-template-columns: 260px minmax(0, 1fr) 240px;
	height: calc(100vh - var(--header-h, 64px) - 48px);
	height: calc(100dvh - var(--header-h, 64px) - 48px);
	min-height: 480px;
	max-width: var(--wrap, 1440px);
	margin: 0 auto;
	background: var(--mc-surface);
	border: 1px solid var(--mc-line);
	border-radius: var(--mc-r);
	overflow: hidden;
	font-size: 15px;
}
.mc-chat.is-members-hidden { grid-template-columns: 260px minmax(0, 1fr); }
.mc-chat.is-members-hidden .mc-members { display: none; }
.mc-chat button { font: inherit; color: inherit; cursor: pointer; }
.mc-chat__loading { display: flex; gap: 6px; justify-content: center; padding: 40px; grid-column: 1 / -1; }
.mc-chat__loading span { width: 8px; height: 8px; border-radius: 50%; background: var(--mc-accent); animation: mc-dot 1s infinite ease-in-out; }
.mc-chat__loading span:nth-child(2) { animation-delay: .15s; }
.mc-chat__loading span:nth-child(3) { animation-delay: .3s; }
@keyframes mc-dot { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }

/* The chat fills the screen: the site footer is not needed under it. */
.mc-chat-body .site-footer { display: none; }

/* Sidebars */
.mc-side, .mc-members { display: flex; flex-direction: column; min-height: 0; background: var(--mc-bg); }
.mc-side { border-inline-end: 1px solid var(--mc-line); }
.mc-members { border-inline-start: 1px solid var(--mc-line); }
.mc-side__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--mc-line); font-size: 14px; }
.mc-rooms { flex: 1; overflow-y: auto; padding: 8px; }
.mc-rooms__cat { padding: 14px 8px 6px; font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--mc-muted); text-transform: uppercase; }
.mc-room { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--mc-r-sm); background: none; text-align: start; color: var(--mc-text-2); }
.mc-room:hover { background: var(--mc-surface-2); color: var(--mc-text); }
.mc-room.is-active { background: rgb(var(--mc-accent-rgb) / .16); color: var(--mc-text); }
.mc-room.is-unread { color: var(--mc-text); font-weight: 700; }
.mc-room.is-out { opacity: .7; }
.mc-room__icon { width: 22px; text-align: center; flex: none; }
.mc-room__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-room__flag { font-size: 12px; opacity: .8; }
.mc-room__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mc-accent); flex: none; }
.mc-me { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--mc-line); background: var(--mc-surface); }
.mc-me__who { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mc-me__who strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-av { border-radius: 50%; object-fit: cover; background: var(--mc-surface-3); flex: none; }
.mc-av--letter { display: inline-grid; place-items: center; color: #fff; font-weight: 700; background: var(--c, var(--mc-accent)); }

/* Main column */
.mc-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.mc-top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--mc-line); min-height: 56px; }
.mc-top__info { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 12px; }
.mc-top__name { font-size: 16px; white-space: nowrap; }
.mc-top__desc { color: var(--mc-muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-top__tools { display: flex; gap: 4px; }
.mc-icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: var(--mc-r-sm); background: none; font-size: 16px; }
.mc-icon-btn:hover, .mc-icon-btn.is-on { background: var(--mc-surface-2); }
.mc-icon-btn.is-on { box-shadow: inset 0 0 0 1px rgb(var(--mc-accent-rgb) / .5); }
.mc-banner { padding: 8px 16px; background: rgb(255 77 94 / .12); color: var(--mc-danger); font-size: 13px; }
.mc-msgs { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 8px 0 12px; }
.mc-older { display: block; margin: 8px auto 4px; padding: 6px 14px; border: 1px solid var(--mc-line-2); border-radius: 999px; background: var(--mc-surface-2); font-size: 13px !important; }
.mc-empty { margin: 40px 16px; text-align: center; color: var(--mc-muted); }
.mc-day { display: flex; align-items: center; gap: 12px; margin: 14px 16px 6px; color: var(--mc-muted); font-size: 12px; font-weight: 600; }
.mc-day::before, .mc-day::after { content: ""; flex: 1; height: 1px; background: var(--mc-line); }

.mc-msg { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 6px 16px; margin-top: 8px; }
.mc-msg:hover { background: rgb(255 255 255 / .025); }
.mc-msg.is-grouped { margin-top: 0; padding-top: 1px; padding-bottom: 1px; }
.mc-msg.is-grouped .mc-msg__av, .mc-msg.is-grouped .mc-msg__head { display: none; }
.mc-msg.is-grouped .mc-msg__body { grid-column: 2; }
.mc-msg { border-inline-start: 3px solid transparent; }
.mc-msg.is-mention { background: rgb(255 194 74 / .07); border-inline-start-color: var(--mc-gold); }
.mc-msg.is-pinned { border-inline-start-color: var(--mc-accent); }
.mc-msg.is-flash { animation: mc-flash 1.5s ease; }
@keyframes mc-flash { 0%, 40% { background: rgb(var(--mc-accent-rgb) / .2); } 100% { background: transparent; } }
.mc-msg__av { padding: 0; border: 0; background: none; align-self: start; }
.mc-msg__body { min-width: 0; }
.mc-msg__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 2px; }
.mc-msg__name { padding: 0; border: 0; background: none; font-weight: 700; color: var(--c, var(--mc-text)) !important; }
.mc-msg__name:hover { text-decoration: underline; }
.mc-msg__time { color: var(--mc-muted); font-size: 11px; }
.mc-msg__pin { font-size: 11px; }
.mc-msg__text { line-height: 1.75; overflow-wrap: anywhere; white-space: normal; color: var(--mc-text); }
.mc-msg__text a { color: var(--mc-accent); text-decoration: underline; }
.mc-msg__text.is-deleted { color: var(--mc-muted); font-style: italic; font-size: 13px; }
.mc-msg__edited { color: var(--mc-muted); font-size: 11px; }
.mc-mention { background: rgb(255 194 74 / .2); color: inherit; border-radius: 4px; padding: 0 2px; }
.mc-msg__reply { display: flex; gap: 6px; align-items: center; max-width: 100%; margin-bottom: 2px; padding: 0; border: 0; background: none; color: var(--mc-muted) !important; font-size: 12px !important; text-align: start; }
.mc-msg__reply span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-msg__acts { position: absolute; inset-inline-end: 12px; top: -12px; display: none; gap: 2px; padding: 2px; border: 1px solid var(--mc-line-2); border-radius: 8px; background: var(--mc-surface-2); box-shadow: 0 6px 18px -8px rgb(0 0 0 / .6); }
.mc-msg:hover .mc-msg__acts, .mc-msg:focus-within .mc-msg__acts { display: flex; }
.mc-msg__acts button { width: 30px; height: 28px; border: 0; border-radius: 6px; background: none; font-size: 14px; }
.mc-msg__acts button:hover { background: var(--mc-surface-3); }
@media (hover: none) { .mc-msg__acts { display: flex; position: static; margin-top: 4px; grid-column: 2; width: max-content; box-shadow: none; } .mc-msg.is-grouped .mc-msg__acts { display: none; } }

.mc-lvl { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px 1px 2px; border-radius: 999px; background: color-mix(in srgb, var(--c, #94a3b8) 16%, transparent); color: var(--c, #94a3b8); font-size: 11px; font-weight: 600; line-height: 18px; white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.mc-lvl b { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--c, #94a3b8); color: #0b0c18; font-size: 10px; }
.mc-rank { display: inline-flex; align-items: center; gap: 3px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 18px; white-space: nowrap; }
.mc-rank--admin { background: rgb(255 77 94 / .16); color: #ff7a87; }
.mc-rank--moderator { background: rgb(43 211 139 / .15); color: #46e0a0; }
.mc-rank--premium { background: rgb(255 194 74 / .16); color: var(--mc-gold); }
.mc-fb { font-size: 14px; line-height: 1; }

.mc-newpill { position: absolute; bottom: 92px; left: 50%; transform: translateX(-50%); padding: 6px 14px; border: 0; border-radius: 999px; background: var(--mc-accent); color: #fff !important; font-size: 13px !important; box-shadow: 0 8px 20px -8px rgb(0 0 0 / .7); z-index: 2; }

/* Compose */
.mc-compose { padding: 0 16px 14px; }
.mc-compose[hidden] { display: none; }
.mc-replybar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 12px; border-radius: var(--mc-r-sm) var(--mc-r-sm) 0 0; background: var(--mc-surface-2); color: var(--mc-text-2); font-size: 13px; }
.mc-replybar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-compose__row { display: flex; align-items: flex-end; gap: 8px; padding: 8px; border: 1px solid var(--mc-line-2); border-radius: var(--mc-r); background: var(--mc-surface-2); }
.mc-compose__row[hidden] { display: none; }
.mc-input { flex: 1; min-height: 38px; max-height: 160px; padding: 8px 10px; border: 0; border-radius: var(--mc-r-sm); background: transparent; color: var(--mc-text); font: inherit; line-height: 1.6; resize: none; outline: none; }
.mc-input::placeholder { color: var(--mc-muted); }
.mc-send { padding: 0 18px; height: 38px; border: 0; border-radius: var(--mc-r-sm); background: var(--grad, var(--mc-accent)); color: #fff !important; font-weight: 700; }
.mc-send:disabled { opacity: .5; cursor: not-allowed; }
.mc-status { min-height: 18px; padding: 4px 4px 0; font-size: 12px; color: var(--mc-muted); }
.mc-status.is-error { color: var(--mc-danger); }
.mc-status.is-blocked { padding: 12px; border: 1px dashed var(--mc-line-2); border-radius: var(--mc-r); text-align: center; font-size: 13px; }
.mc-join { display: block; margin: 0 auto 4px; }
.mc-join[hidden] { display: none; }
.mc-edit { display: flex; flex-wrap: wrap; gap: 6px; }
.mc-edit .mc-input { flex-basis: 100%; border: 1px solid var(--mc-line-2); background: var(--mc-surface-2); }

/* Buttons */
.mc-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--mc-line-2); border-radius: var(--mc-r-sm); background: var(--mc-surface-2); color: var(--mc-text) !important; font-size: 13px; font-weight: 600; text-decoration: none; }
.mc-btn:hover { background: var(--mc-surface-3); }
.mc-btn--primary { border-color: transparent; background: var(--grad, var(--mc-accent)); color: #fff !important; }
.mc-btn--danger { border-color: rgb(255 77 94 / .4); color: var(--mc-danger) !important; }

/* Online list */
.mc-online { list-style: none; margin: 0; padding: 8px; overflow-y: auto; flex: 1; }
.mc-online__u { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 0; border-radius: var(--mc-r-sm); background: none; text-align: start; }
.mc-online__u:hover { background: var(--mc-surface-2); }
.mc-online__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c, var(--mc-text)); font-size: 14px; }

/* Pop-ups */
.mc-pop { position: fixed; z-index: 10000; width: min(320px, calc(100vw - 16px)); max-height: 70vh; overflow: auto; padding: 14px; border: 1px solid var(--line-2, rgb(255 255 255 / .12)); border-radius: var(--r, 14px); background: var(--surface-2, #1b1e3a); color: var(--text, #f2f3f7); box-shadow: 0 24px 60px -20px rgb(0 0 0 / .85); font-size: 14px; }
.mc-pop__title { display: block; margin-bottom: 10px; }
.mc-card-user__head { display: flex; gap: 12px; align-items: center; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line, rgb(255 255 255 / .07)); }
.mc-card-user__head strong { display: block; font-size: 16px; color: var(--c, inherit); }
.mc-card-user__chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.mc-card-user__mod { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line, rgb(255 255 255 / .07)); }
.mc-pop .mc-btn { font-size: 12px; padding: 6px 10px; }
.mc-pins__item { padding: 10px 0; border-bottom: 1px solid var(--line, rgb(255 255 255 / .07)); line-height: 1.7; overflow-wrap: anywhere; }
.mc-pins__head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 2px; font-size: 12px; color: var(--muted, #7e8396); }
.mc-pins__head b { color: var(--text, #fff); }
.mc-ask__f { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 13px; }
.mc-ask__f input { padding: 8px 10px; border: 1px solid var(--line-2, rgb(255 255 255 / .12)); border-radius: 8px; background: var(--bg-2, #0d0f22); color: inherit; font: inherit; }
.mc-ask__bar { display: flex; gap: 8px; }
.mc-toast--chat { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 10001; padding: 10px 18px; border-radius: 999px; background: var(--surface-3, #252946); color: var(--text, #fff); box-shadow: 0 12px 30px -10px rgb(0 0 0 / .8); font-size: 14px; }

/* Guests */
.mc-guest { max-width: 520px; margin: 60px auto; padding: 32px; text-align: center; background: var(--surface, #14162e); border: 1px solid var(--line, rgb(255 255 255 / .07)); border-radius: var(--r-lg, 22px); color: var(--text, #f2f3f7); }
.mc-guest__icon { font-size: 44px; }
.mc-guest h1 { margin: 10px 0; font-size: 24px; }
.mc-guest p { color: var(--text-2, #b7bbc8); line-height: 1.8; }
.mc-guest__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }

.mc-scrim { display: none; }
.mc-only-mobile { display: none; }

@media (max-width: 1100px) {
	.mc-chat, .mc-chat.is-members-hidden { grid-template-columns: 240px minmax(0, 1fr); }
	.mc-members { position: absolute; inset-block: 0; inset-inline-end: 0; width: min(280px, 85%); z-index: 5; transform: translateX(-110%); transition: transform .2s ease; box-shadow: 0 0 40px rgb(0 0 0 / .6); }
	[dir="rtl"] .mc-members, .mc-chat[dir="rtl"] .mc-members { transform: translateX(-110%); }
	.mc-chat.is-members-open .mc-members { display: flex; transform: none; }
	.mc-chat.is-members-hidden .mc-members { display: flex; }
}
@media (max-width: 760px) {
	.mc-chat-page { padding: 0; }
	.mc-chat, .mc-chat.is-members-hidden { grid-template-columns: minmax(0, 1fr); border-radius: 0; border-inline: 0; height: calc(100dvh - var(--header-h, 64px)); }
	.mc-only-mobile { display: inline-grid; }
	.mc-side { position: absolute; inset-block: 0; inset-inline-start: 0; width: min(290px, 86%); z-index: 6; transform: translateX(110%); transition: transform .2s ease; box-shadow: 0 0 40px rgb(0 0 0 / .6); }
	.mc-chat.is-side-open .mc-side { transform: none; }
	.mc-chat.is-side-open .mc-scrim, .mc-chat.is-members-open .mc-scrim { display: block; position: absolute; inset: 0; z-index: 4; background: rgb(0 0 0 / .5); }
	.mc-top__desc { display: none; }
	.mc-msg { padding-inline: 12px; gap: 10px; grid-template-columns: 34px minmax(0, 1fr); }
	.mc-msg .mc-av { width: 34px; height: 34px; }
	.mc-compose { padding: 0 10px 10px; }
	.mc-newpill { bottom: 84px; }
}
