/* NeatIRC Default Theme */

@import url("https://fonts.bunny.net/css?family=lato:400,400i,700,700i,900,900i");

/* Kinda-sorta mitigates text selection on long-presses in mobile */
@media (pointer: coarse) {
	.chat-message,
	.chat-message * {
		-webkit-user-select: none;
		user-select: none;
		-webkit-touch-callout: none;
	}
}

@media (max-width: 500px) {
	.toggle-label {
		display: none;
	}
}

* {
	box-sizing: border-box;
}

button, input {
	font-family: inherit;
	display: flex;
	align-items: center;
	gap: .5em;
}

html, body {
	margin: 0;
	padding: 0;
	height: 100%;
}

body {
	font-family: "Lato", sans-serif;
}

#app {
	height: 100vh;
	max-height: 100vh;
	display: flex;
	flex-direction: column;
}

/* Header bar */

header {
	height: 3em;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 0.5rem;
	border-bottom: 1px solid #ccc;
	background: #f5f5f5;
	gap: 0.5rem;
}

.header-toggle {
	font-size: 0.8rem;
	padding: 0.25rem 0.5rem;
	border: 1px solid #ccc;
	background: #fff;
	border-radius: 3px;
	cursor: pointer;
	white-space: nowrap;
	min-width: 6.2rem;
}

.header-center {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex: 1;
	justify-content: center;
	min-width: 0;
}

.header-title {
	font-size: 0.9rem;
	opacity: 0.8;
}

.header-menu-button {
	padding: 0.25rem 0.5rem;
}

/* Main layout */

main {
	flex: 1;
	height: calc(100vh - 3em);
	display: flex;
	overflow: hidden;
	position: relative;
}

.pane {
	border-right: 1px solid #ddd;
	padding: 0.5rem;
	overflow: auto;
}

#channels-pane {
	background: #fafafa;
	height: calc(100vh - 3em);
	overflow: scroll;
}

#chat-pane {
	flex: 1;
	min-width: 0;
	padding: 0.5rem;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

#chat-view {
	flex: 1 1 auto;
	min-height: 0;
	overflow-x: hidden;
	overflow-y: scroll;
	padding-bottom: 0.5rem;
}

.chat-line {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	padding: 0.2rem 0.75rem;
	margin: 0.05rem 0;
	border-radius: 0.4rem;
}

/* Full-row hover highlight */
.chat-text:hover {
	background: rgba(0, 0, 0, 0.1);
	padding: .2em .3em;
	margin: -.2em -.3em;
	border-radius: .25em;
	cursor: text;
}

.chat-line + .chat-line {
		margin-top: 0.1rem;
}

.chat-line.chat-info {
		display: block;
		padding: 0.25rem 0.75rem;
		font-style: italic;
		color: #666;
}

/* Avatar bubble */
.chat-avatar {
		flex: 0 0 2rem;
		width: 2rem;
		height: 2rem;
		border-radius: 999px;
		background: #ddd;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 0.8rem;
		font-weight: 600;
		color: #555;
		overflow: hidden;
}

.chat-avatar img {
		width: 100%;
		height: 100%;
		display: block;
		object-fit: cover;
}

/* Message content */
.chat-content {
		flex: 1 1 auto;
		min-width: 0;
}

.chat-header {
		display: flex;
		align-items: baseline;
		gap: 0.5rem;
		margin-bottom: 0.1rem;
}

.chat-nick {
		font-weight: bold;
}

.chat-ts {
		font-size: 0.75rem;
		color: #999;
}

.chat-text {
		white-space: pre-wrap;
		word-wrap: break-word;
}

/* Style emote lines */
.chat-line.chat-action .chat-text {
		font-style: italic;
}

/* Additional stacked messages from the same speaker */
.chat-text.chat-text-cont {
	margin-top: 0.15rem;
}

#chat-form {
	flex: 0 0 auto;
	margin-top: 0.5rem;
}

#typing-indicator {
	height: 1.8em;
	font-size: 80%;
}

#chat-input-row {
	display: flex;
	gap: .5em;
}

#chat-input {
	width: 100%;
}

#members-pane {
	background: #fafafa;
	border-right: none;
	border-left: 1px solid #ddd;
	
	height: calc(100vh - 3em);
	overflow: scroll;
	
}

body[data-layout="desktop"] #channels-pane {
	flex: 0 0 220px;
	max-width: 25%;
}

body[data-layout="desktop"] #members-pane {
	flex: 0 0 220px;
	max-width: 25%;
}

body[data-layout="desktop"] #channels-pane.hidden,
body[data-layout="desktop"] #members-pane.hidden {
	display: none;
}

body[data-layout="mobile"] #channels-pane,
body[data-layout="mobile"] #members-pane {
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	bottom: 0;
	z-index: 10;
	display: none;
	border-right: none;
	border-left: none;
	border-top: none;
	border-bottom: none;
	background: #fafafa;
}

body[data-layout="mobile"] #channels-pane.overlay-open,
body[data-layout="mobile"] #members-pane.overlay-open {
	display: block;
}

body[data-layout="mobile"] #channels-pane.hidden,
body[data-layout="mobile"] #members-pane.hidden {
	/* eh, lol */
}

/* Menu modal */

.menu-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.4);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100;
}

.menu-backdrop.hidden {
	display: none;
}

.menu-modal {
	background: #fff;
	min-width: min(90vw, 420px);
	max-width: 90vw;
	max-height: 80vh;
	border-radius: 6px;
	box-shadow: 0 10px 30px rgba(0,0,0,0.25);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.menu-header {
	padding: 0.75rem 1rem;
	border-bottom: 1px solid #eee;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
}

.menu-title {
	font-size: 0.95rem;
	font-weight: 600;
}

.menu-close-btn {
	border: none;
	background: transparent;
	font-size: 1.1rem;
	cursor: pointer;
	line-height: 1;
}

.menu-body {
	padding: 0.75rem 1rem 1rem;
	overflow: auto;
}

.menu-item {
	display: block;
	width: 100%;
	padding: 0.4rem 0.6rem;
	margin-bottom: 0.3rem;
	border-radius: 4px;
	border: 1px solid #ddd;
	background: #f8f8f8;
	cursor: pointer;
	text-align: left;
	font-size: 0.85rem;
}

.menu-item:last-child {
	margin-bottom: 0;
}

.hidden {
	display: none;
}

.menu-section {
	margin-top: 0.5rem;
	padding-top: 0.25rem;
	border-top: 1px solid #eee;
	font-size: 0.85rem;
}

.menu-section-title {
	font-weight: 600;
	margin-bottom: 0.25rem;
}

.menu-option {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	margin: 0.15rem 0;
}

.menu-option input[type="radio"] {
	margin: 0;
}

.chat-realname {
	color: #777;
	font-weight: normal;
	margin-left: 0.25em;
	font-size: 0.9em;
}

/* Login overlay */

#login-backdrop {
	position: fixed;
	inset: 0;
	background: #f5f5f5;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
}

#login-modal {
	background: #fff;
	width: min(460px, 100vw - 2rem);
	max-height: 100vh;
	border-radius: 8px;
	box-shadow: 0 10px 30px rgba(0,0,0,0.25);
	padding: 1.25rem 1.5rem 1.5rem;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

#login-title {
	font-size: 1.1rem;
	margin: 0;
}

#login-form {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	margin-top: 0.75rem;
}

.login-field {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	font-size: 0.8rem;
}

.login-field span {
	opacity: 0.9;
}

.login-field input {
	font: inherit;
	padding: 0.35rem 0.45rem;
	border-radius: 4px;
	border: 1px solid #ccc;
}

.login-actions {
	display: flex;
	justify-content: flex-end;
	margin-top: 0.5rem;
}

.login-primary {
	font-size: 0.85rem;
	padding: 0.4rem 0.9rem;
	border-radius: 999px;
	border: 1px solid #222;
	background: #222;
	color: #fff;
	cursor: pointer;
}

.login-primary:hover {
	filter: brightness(1.05);
}

.login-footnote {
	margin: 0.4rem 0 0;
	font-size: 0.75rem;
	opacity: 0.7;
}

/* Raw mode overlay */

.raw-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 900;
}

.raw-modal {
	background: #111;
	color: #eee;
	width: min(900px, 100vw - 1.5rem);
	height: min(600px, 100vh - 1.5rem);
	border-radius: 8px;
	box-shadow: 0 10px 30px rgba(0,0,0,0.35);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.raw-header {
	padding: 0.5rem 0.75rem;
	border-bottom: 1px solid #333;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.raw-title {
	font-size: 0.85rem;
	font-weight: 600;
}

.raw-close-btn {
	border: none;
	background: transparent;
	color: inherit;
	font-size: 1.1rem;
	cursor: pointer;
	line-height: 1;
}

.raw-body {
	flex: 1;
	overflow: auto;
	padding: 0.5rem 0.75rem;
}

.raw-log {
	margin: 0;
	font-size: 0.8rem;
	white-space: pre-wrap;
	word-wrap: break-word;
}

.raw-form {
	display: flex;
	border-top: 1px solid #333;
}

.raw-input {
	flex: 1;
	border: none;
	padding: 0.4rem 0.6rem;
	font: inherit;
	background: #222;
	color: #eee;
}

.raw-input:focus {
	outline: 1px solid #555;
}

.raw-send-btn {
	border: none;
	padding: 0.4rem 0.7rem;
	font-size: 0.8rem;
	cursor: pointer;
	background: #444;
	color: #fff;
}

.active {
	font-weight: bold;
}

#upgrade-notice {
	position: absolute;
	top: 1em;
	left: 1em;
	background: rgb(158, 1, 1);
	color: white;
	border-radius: .5em;
	padding: 1em;
	font-size: 1.2em;
}

/* IRC console overlay */

#raw-mode-overlay {
	position: fixed;
	inset: 0;
	z-index: 900;
	background: #111;
	display: flex;
	align-items: stretch;
	justify-content: stretch;
}

#raw-mode-overlay[hidden] {
	display: none;
}

#raw-mode-inner {
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	color: #eee;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

#raw-mode-header {
	flex: 0 0 auto;
	display: flex;
	justify-content: flex-end;
	align-items: center;
	padding: 0.5rem 0.75rem;
	border-bottom: 1px solid #333;
}

#raw-mode-log {
	flex: 1 1 auto;
	min-height: 0;
	padding: 0.75rem;
	overflow: auto;
}

#raw-mode-log h3 {
	margin: 0 0 0.5rem;
	font-size: 0.9rem;
}

#raw-mode-log pre#log {
	margin: 0;
	white-space: pre;
	display: block;
}

#raw-mode-send {
	flex: 0 0 auto;
	padding: 0.5rem 0.75rem 0.75rem;
	border-top: 1px solid #333;
}

#raw-mode-send form {
	display: flex;
	gap: 0.5rem;
	align-items: center;
}

#raw-mode-send label {
	font-size: 0.8rem;
	white-space: nowrap;
}

#raw-mode-send input[type="text"] {
	flex: 1 1 auto;
	min-width: 0;
}

#raw-mode-send button {
	flex: 0 0 auto;
}

/* Per-message block within a speaker group */
/*
.chat-message {
	margin-top: 0.1rem;
	position: relative;
	padding: 0.15rem 0 0 0;
	border-radius: 0.3rem;
}
*/
.chat-message {
	margin-top: 0.1rem;
	position: relative;
	padding: 0.05rem 0;
}

/* Reaction row */
.chat-reactions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
	margin-top: 0.15rem;
	font-size: 0.75rem;
}

/* Reaction pill (emoji + count) */
.chat-reaction-pill {
	border: 1px solid #ddd;
	border-radius: 999px;
	padding: 0.1rem 0.4rem;
	background: #f5f5f5;
	cursor: pointer;
	line-height: 1.2;
}

.chat-reaction-pill:hover {
	background: #e9e9e9;
}

/* Hmmmm */
.chat-react-button {
	font-weight: 600;
}

/* Emoji picker popup */
.emoji-picker {
	position: fixed;
	z-index: 999;
	background: #eee;
	border-radius: 999px;
	padding: 0.25rem 0.5rem;
	display: flex;
	align-items: center;
	gap: 0.15rem;
	border: 1px solid #ccc;
}

.emoji-picker.hidden {
	display: none;
}

.emoji-option {
	border: none;
	background: transparent;
	font-size: 1.2rem;
	cursor: pointer;
	padding: 0.15rem 0.2rem;
	line-height: 1;
}

.emoji-option:hover {
	transform: translateY(-1px);
}

.chat-text .chat-image {
	display: block;
	margin-top: 0.25rem;
	width: auto;
	height: auto;
	max-height: 320px;
	max-width: 100%;
	border-radius: 4px;
}

.link-preview-card {
	display: block;
	margin-top: 0.35rem;
	border: 1px solid #ddd;
	border-radius: 6px;
	text-decoration: none;
	color: inherit;
	background: #fafafa;
	max-width: 420px;
	font-size: 0.85rem;
	overflow: hidden;
}

.link-preview-card:hover {
	background: #f0f0f0;
	border-color: #ccc;
}

.link-preview-inner {
	display: flex;
	align-items: stretch;
}

.link-preview-image-wrapper {
	flex: 0 0 96px;
	max-width: 96px;
	overflow: hidden;
}

.link-preview-image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.link-preview-content {
	flex: 1;
	padding: 0.45rem 0.6rem;
	min-width: 0;
}

.link-preview-title {
	font-weight: 600;
	margin-bottom: 0.2rem;
	white-space: nowrap;
	text-overflow: ellipsis;
	overflow: hidden;
}

.link-preview-description {
	max-height: 3.2em;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	opacity: 0.9;
}

.link-preview-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin-top: 0.25rem;
	font-size: 0.75rem;
	opacity: 0.8;
}

.link-preview-site {
	white-space: nowrap;
	text-overflow: ellipsis;
	overflow: hidden;
}

.link-preview-fedi {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	white-space: nowrap;
}

.link-preview-fedi-avatar {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	object-fit: cover;
}

.link-preview-fedi-text {
	text-overflow: ellipsis;
	overflow: hidden;
}

label[for="chat-input"] {
	display: none !important;
}
