/**
 *
 * @package phpBB Extension - mChat
 * @copyright (c) 2016 dmzx - http://www.dmzx-web.net
 * @copyright (c) 2016 kasimi - https://kasimi.net
 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
 *
 */

#mChat {
	position: absolute;
	visibility: hidden;
}

.mchat-nav-link {
	margin-left: 2px;
}

.mchat-nav-caret {
	margin-left: 5px;
}

/* The label and the caret are two separate links: the label navigates to the
   mChat page, the caret opens the dropdown. Keep them visually joined and give
   the caret a usable click target. */
.mchat-nav-link-page,
.mchat-nav-link-title {
	display: inline-block;
	vertical-align: middle;
}

.mchat-nav-link-page {
	padding-right: 0;
}

.mchat-nav-link-title {
	padding-left: 0;
	padding-right: 4px;
}

.mchat-header .list-inner {
	position: relative;
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-align: center;
	   -ms-flex-align: center;
	      align-items: center;
	-webkit-box-pack: start;
	   -ms-flex-pack: start;
	 justify-content: start;
}

.mchat-wrapper li.header dd {
	width: 0;
}

#mchat-body {
	position: relative;
	overflow: hidden;
	width: 100%;
}

#mchat-body * {
	-webkit-box-sizing: border-box;
	        box-sizing: border-box;
}

#mchat-main {
	position: relative;
}

.mchat-ucp fieldset hr:first-child, .mchat-ucp fieldset hr:last-child, .mchat-ucp fieldset hr + hr {
	display: none;
}

#mchat-confirm textarea {
	width: 100%;
	height: 100px;
	background-color: inherit;
}

#mchat-messages {
	overflow: auto;
}

.mchat-message-wrapper {
	overflow: hidden;
}

.mchat-message-header {
	float: left;
}

.mchat-message {
	padding: 5px !important;
}

.mchat-message-flash {
	-webkit-animation-name: flash-message;
	        animation-name: flash-message;
	-webkit-animation-duration: .4s;
	        animation-duration: .4s;
	-webkit-animation-timing-function: ease-out;
	        animation-timing-function: ease-out;
}

.mchat-message-flash:target {
	-webkit-animation-duration: 2s;
	        animation-duration: 2s;
}

@-webkit-keyframes flash-message {

	0% {
		background-color: #FFDC95;
	}

	100% {
		background-color: transparent;
	}

}

@keyframes flash-message {

	0% {
		background-color: #FFDC95;
	}

	100% {
		background-color: transparent;
	}

}

.mchat-avatar {
	float: left;
	width: 36px;
	margin-right: 5px;
}

.mchat-avatar a, .mchat-avatar img {
	display: block;
}

.mchat-wrapper .mchat-buttons li {
	opacity: .3;
}

.mchat-wrapper li:hover .mchat-buttons li {
	opacity: .6;
}

.mchat-wrapper li:hover .mchat-buttons li:hover {
	opacity: 1;
}

.mchat-wrapper .mchat-buttons {
	float: right;
	list-style: none;
	margin-top: 1px;
}

.mchat-wrapper .mchat-buttons > li {
	float: left;
	margin: 0 3px;
}

.mchat-wrapper .mchat-buttons .icon {
	font-size: 12pt;
}

.mchat-wrapper .mchat-buttons span {
	display: block;
	height: 0;
	overflow: hidden;
	position: absolute;
	width: 1px;
}

.mchat-text {
	clear: both;
	overflow: hidden;
	padding: 0 5px 1px;
	font-size: 1.2em;
}

.mchat-text .postlink {
	display: unset;
}

.mchat-text .text-strong {
	color: unset;
}

.mchat-notification-message .mchat-text {
	font-style: italic;
}

.mchat-text strong {
	font-weight: bold !important;
}

.mchat-text img {
	max-width: 100%;
}

.mchat-text li {
	display: list-item !important;
	list-style-type: inherit !important;
	list-style-position: inside;
}

.mchat-text ul, .mchat-text ol {
	list-style-position: inside;
}

.mchat-text ul {
	list-style-type: disc;
}

.mchat-text ol {
	list-style-type: decimal;
}

.mchat-text ul ul {
	list-style-type: circle;
}

.mchat-text blockquote, .mchat-text .codebox, .mchat-text ul, .mchat-text ol {
	margin-bottom: 5px;
	margin-left: 1em;
}

.mchat-mention strong {
	color: inherit !important;
}

.mchat-mention {
	cursor: pointer;
	width: 16px;
	height: 16px;
}

#mchat-no-message {
	font-size: 1.2em;
}

#mchat-character-count {
	float: right;
}

#mchat-character-count.invisible {
	visibility: hidden;
}

#mchat-panel {
	text-align: center;
	max-height: none;
	overflow: hidden;
	padding: 5px;
	margin: 0;
	border-radius: 0;
}

#mchat-panel:not(.mchat-panel-content) {
	display: none;
}

#mchat-form {
	clear: both;
}

.mchat-controls {
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	margin: 5px 0;
}

.mchat-avatars .mchat-controls {
	margin: 10px 43px;
}

.mchat-input-container {
	-webkit-box-flex: 1;
	    -ms-flex: 1;
	        flex: 1;
	position: relative;
	max-width: 100%;
	border-radius: 4px;
	padding: 0;
}

#mchat-input {
	font-size: 1.2em;
	padding: 6px 6px 5px;
	min-width: 100%;
	border-radius: 4px;
	overflow: hidden;
	resize: none;
	border: none;
	border-right: 35px solid transparent;
	background-color: inherit;
}

#mchat-input:focus, .mchat-input-control > *:focus {
	outline: none;
}

.mchat-single-line {
	white-space: nowrap;
}

.mchat-input-error {
	border-color: #F00 !important;
}

.mchat-input-control {
	position: absolute;
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-pack: center;
	    -ms-flex-pack: center;
	        justify-content: center;
	-webkit-box-align: center;
	    -ms-flex-align: center;
	        align-items: center;
	width: 30px;
	height: 100%;
	top: 0;
	right: 0;
}

.mchat-input-control button {
 	background: transparent;
	border: 0;
}

.mchat-input-control button:hover .icon {
	color: #1198D9;
}

#mchat-status {
	display: inline;
	margin-left: 6px;
	text-indent: 0;
}

.mchat-status {
	position: absolute;
	top: calc(50% - 1px);
	-webkit-transform: translateY(-50%);
	    -ms-transform: translateY(-50%);
	        transform: translateY(-50%);
	text-indent: 0;
}

.fa-spin::before {
	padding-left: 2px;
}

.mchat-button-add {
	margin: 3px 0 0 3px;
	padding: 5px;
}

.mchat-input-control button .icon {
	font-size: 15px;
}

#mchat-exceed-character-count {
	color: #F00;
	font-weight: bold;
}

.mchat-panel-buttons {
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	margin-left: 5px;
}

.mchat-panel-buttons .button:not(:last-child) {
	margin-right: 5px;
}

.mchat-panel-buttons .icon {
	font-size: 16px;
}

.mchat-button-is-down {
	border-style: inset;
}

.mchat-nav-item-enabled .mchat-nav-item-disabled,
.mchat-nav-item-disabled .mchat-nav-item-enabled {
	display: none;
}

#mchat-bbcodes {
	display: none;
}

#mchat-bbcodes #format-buttons,
#mchat-bbcodes #format-postingbuttons {
	margin: 0 0 5px;
}

#mchat-colour {
	display: none;
}

#mchat-bbcodes #colour_palette {
	-webkit-user-select: none;
	   -moz-user-select: none;
	    -ms-user-select: none;
	        user-select: none;
}

#mchat-bbcodes #colour_palette label {
	display: none;
}

#mchat-bbcodes #colour_palette table {
	margin: 0 auto 5px;
}

#mchat-bbcodes #colour_palette a {
	cursor: pointer;
}

#mchat-bbcodes #colour_palette td a.remember-color {
	position: relative;
	-webkit-box-shadow: 0 0 2px 2px #F00;
	        box-shadow: 0 0 2px 2px #F00;
}

#mchat-smilies {
	padding: 0;
}

#mchat-legend {
	clear: both;
	margin: 10px 0;
}

.mchat-static, #mchat-stats, #mchat-whois, #mchat-refresh, #mchat-legend {
	text-align: left;
	font-size: 1.1em;
}

#mchat-panel > #mchat-whois {
	float: left;
}

.mchat-copyright.footer-row {
	font-size: 10px;
	line-height: 1.8;
	margin: 0;
}

.footer-row + br {
	display: none;
}

.mchat-static {
	padding: 5px 5px 7px !important;
}

@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) {

	#mchat-body {
		overflow: visible;
	}

	.mchat-wrapper .list-inner {
		display: inherit !important;
	}

	.mchat-wrapper .mchat-buttons > li {
		padding: 0 5px;
	}

	.mchat-controls {
		-webkit-box-orient: vertical;
		-webkit-box-direction: normal;
		    -ms-flex-direction: column;
		        flex-direction: column;
	}

	.mchat-panel-buttons {
		min-height: 32px;
		margin: 3px auto !important;
	}

}

/* Compatibility with Advanced BBCode Box extension */

#mchat-panel #abbc3_buttons {
	margin: 0 !important;
	padding-bottom: 5px;
}

#mchat-panel #abbc3_buttons .abbc3_buttons_row {
	margin: 0 auto !important;
}

/* Compatibility with Collapsible Categories extension */

.mchat-category {
	display: none;
	height: 0;
}

.mchat-collapse {
	display: none;
	line-height: 0;
}

.hidden-category + .forabg #mchat-body .topiclist.forums {
	display: block;
}

/* ---------------------------------------------------------------------------
   JustRP overrides

   mChat wraps its chat block in .forabg and relies on the style to supply the
   panel background. JustRP is a compiled Tailwind build and never defines
   .forabg or .forumbg, so the chat renders with no chrome at all. Everything
   below rebuilds that chrome using JustRP's own tokens (--panel-bg, the .panel
   colours) so the chat matches the rest of the board.
   --------------------------------------------------------------------------- */

.mchat-wrapper {
	background-color: #1e1e1e;
	border: 1px solid #333;
	border-radius: 4px;
	overflow: hidden;
	margin-bottom: 1em;
}

.mchat-wrapper .inner {
	padding: 0;
}

/* Title bar: reuse the gradient JustRP declares on :root as --panel-bg. */
.mchat-wrapper .mchat-header li.header,
.mchat-wrapper .mchat-header .row-item {
	background: var(--panel-bg, linear-gradient(to bottom, #484848 0%, #2d2d2d 100%));
	border-bottom: 1px solid #333;
	color: rgb(var(--color-primary, 232, 150, 46));
	padding: 8px 12px;
	font-weight: 600;
}

.mchat-wrapper .mchat-header .list-inner {
	padding: 0;
}

/* Scrollable message area. Height itself is set inline by mChat from the ACP
   "custom page height" setting, so only the skin is defined here. */
#mchat-messages {
	background-color: #191919;
	overflow-y: auto;
}

/* Base mchat.css sets "padding: 5px !important" on .mchat-message, so this has
   to be !important too in order to win. */
.mchat-message {
	background-color: transparent;
	border-bottom: 1px solid #262626;
	padding: 7px 12px !important;
}

.mchat-message:last-child {
	border-bottom: 0;
}

.mchat-message:hover {
	background-color: #202020;
}

.mchat-notification-message {
	background-color: #1c1c1c;
}

.mchat-message-header .mchat-time {
	color: #8d8d8d;
}

/* Composer sits in #mchat-panel, which already carries JustRP's .panel class;
   it only needs separating from the message list. */
#mchat-panel.mchat-panel-content {
	margin-top: 8px;
	border: 1px solid #333;
}

/* The chrome goes on the container, NOT on #mchat-input itself: the textarea's
   "border-right: 35px solid transparent" is what reserves space for the send
   button in .mchat-input-control, so overriding its border breaks that. */
.mchat-input-container {
	background-color: #191919;
	border: 1px solid #333;
	border-radius: 4px;
	transition: border-color .12s ease, box-shadow .12s ease;
	/* This div carries the .inputbox class, so JustRP's Tailwind ring utility
	   applies to it and paints a stray ring underneath the border. Zero out the
	   ring variables as well as the shadow itself — clearing only box-shadow
	   isn't enough, because the variables get re-composed on other states. */
	--tw-ring-shadow: 0 0 #0000;
	--tw-ring-offset-shadow: 0 0 #0000;
	--tw-shadow: 0 0 #0000;
	--tw-ring-offset-width: 0px;
	--tw-ring-color: transparent;
	box-shadow: none;
	background-image: none;
}

.mchat-input-container:focus-within {
	border-color: rgb(var(--color-primary, 232, 150, 46));
	box-shadow: 0 0 0 2px rgba(var(--color-primary, 232, 150, 46), .18);
}

/* The textarea reserves the send-button slot with a 35px transparent right
   border; keep it transparent and ringless so nothing paints in that gap. */
#mchat-input,
#mchat-input:focus {
	border-right-color: transparent;
	box-shadow: none;
	outline: none;
}

.mchat-input-control button:focus {
	outline: none;
	box-shadow: none;
}

/* Base mchat.css turns the send chevron #1198D9 on hover — the other stray
   blue in this area. Use the JustRP accent instead. */
.mchat-input-control button:hover .icon {
	color: rgb(var(--color-primary, 232, 150, 46));
}

#mchat-input {
	color: inherit;
}

#mchat-input::placeholder {
	color: #6b6b6b;
}

/* --- Message list polish --- */

/* NOTE: the base layout here is float-based (.mchat-avatar and
   .mchat-message-header float left, .mchat-text clears them, .mchat-buttons
   floats right). Introducing flex on .mchat-message would neutralise those
   floats and collapse the layout, so these rules only restyle — they do not
   change the box model. */

.mchat-message {
	transition: background-color .1s ease;
}

.mchat-message .mchat-avatar img {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	object-fit: cover;
}

.mchat-message-header {
	line-height: 1.35;
}

.mchat-message-header a.username,
.mchat-message-header a.username-coloured {
	font-weight: 600;
}

.mchat-text {
	line-height: 1.45;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

/* Base already fades the action icons (.3 idle, .6 row hover, 1 icon hover).
   Hide them fully until hover instead, then bring them to full strength. */
.mchat-wrapper .mchat-message .mchat-buttons li {
	opacity: 0;
	transition: opacity .12s ease;
}

.mchat-wrapper .mchat-message:hover .mchat-buttons li {
	opacity: .65;
}

.mchat-wrapper .mchat-message:hover .mchat-buttons li:hover {
	opacity: 1;
}

/* Empty state */
.mchat-no-messages {
	color: #6b6b6b;
	font-style: italic;
	text-align: center;
	padding: 24px 12px;
	border-bottom: 0;
}

.mchat-no-messages:hover {
	background-color: transparent;
}

/* Dark scrollbar for the message pane. */
#mchat-messages {
	scrollbar-width: thin;
	scrollbar-color: #3a3a3a #191919;
}

#mchat-messages::-webkit-scrollbar {
	width: 9px;
}

#mchat-messages::-webkit-scrollbar-track {
	background: #191919;
}

#mchat-messages::-webkit-scrollbar-thumb {
	background-color: #3a3a3a;
	border-radius: 5px;
	border: 2px solid #191919;
}

#mchat-messages::-webkit-scrollbar-thumb:hover {
	background-color: #4a4a4a;
}

/* The rooms sidebar sits inside .mchat-wrapper as a flex sibling of the chat,
   so the wrapper must not impose its own padding. */
.mchat-wrapper .mchat-wrapper-rooms {
	display: flex;
	align-items: stretch;
}
