/*
 * MyReactions 0.1.0
 * No hard-coded colours: everything inherits from the theme's own classes
 * (.postbit_buttons, .tborder, .thead, .tcat, .trow1, .smalltext, .modal),
 * so light/dark modes and any installed theme keep working.
 * Neutral grey with alpha is used for hover/borders so it looks right on light and dark backgrounds.
 */

/* ---------- Row above .post_controls ---------- */
.myr-container {
	clear: both;
	padding: 4px 5px 2px;
	overflow: hidden;
}
.myr-container:empty {
	display: none;
	padding: 0;
}
.myr-container.myr-profile {
	padding: 0;
}

.myr-chips,
.myr-linear {
	float: left;
}

/* Chips use the theme's postbit button look (.postbit_buttons > a) - we only fix layout */
.myr-container .postbit_buttons > a.myr-reaction {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	vertical-align: middle;
	line-height: 1;
	text-decoration: none;
	cursor: default;
}
.myr-container .postbit_buttons > a.myr-reaction.myr-can,
.myr-container .postbit_buttons > a.myr-reaction.myr-mine {
	cursor: pointer;
}

/* Fallback for themes without .postbit_buttons styles (zero specificity, the theme always wins) */
:where(.myr-container) :where(a.myr-reaction) {
	padding: 2px 6px;
	margin: 2px;
	border: 1px solid rgba(128, 128, 128, .35);
	border-radius: 4px;
}

/* The count must not get the theme's sprite icon meant for postbit button <span>s */
.myr-container .postbit_buttons a.myr-reaction span.myr-count,
.postbit_buttons a.myr-reaction span.myr-count {
	padding: 0;
	margin: 0;
	height: auto;
	background: none;
	font-weight: bold;
	display: inline;
}

/* Your own reaction */
.myr-container .postbit_buttons > a.myr-reaction.myr-mine {
	box-shadow: inset 0 0 0 1px currentColor;
}
.myr-container .postbit_buttons > a.myr-reaction.myr-can:hover img,
.myr-container .postbit_buttons > a.myr-reaction.myr-mine:hover img {
	transform: scale(1.2);
}
.myr-container img.myr-img,
.myr-pick img {
	transition: transform .12s ease;
}

.myr-linear img.myr-img {
	margin: 2px;
	vertical-align: middle;
}

/* "Reaccionaste con: ... (Eliminar)" */
.myr-reacted {
	clear: both;
	padding: 3px 2px 0;
	opacity: .85;
}
.myr-reacted img.myr-img {
	vertical-align: middle;
}
.myr-reacted .myr-mine-item {
	white-space: nowrap;
	margin-left: 4px;
}
.myr-reacted a.myr-remove {
	cursor: pointer;
}

/* ---------- Button inside .post_controls ---------- */
.postbit_buttons a.postbit_myreactions span {
	padding-left: 20px;
	display: inline-block;
	min-height: 16px;
	background-image: url(../images/reactions/react_add.png);
	background-repeat: no-repeat;
	background-position: 0 50%;
	background-size: 16px 16px;
}
.myr-fallback {
	margin-right: 5px;
}

/* ---------- Emoji sizes (ACP setting) ---------- */
.reactions-16 img.myr-img { width: 16px; height: 16px; }
.reactions-20 img.myr-img { width: 20px; height: 20px; }
.reactions-24 img.myr-img { width: 24px; height: 24px; }
.reactions-28 img.myr-img { width: 28px; height: 28px; }
.reactions-32 img.myr-img { width: 32px; height: 32px; }
.myr-reacted img.myr-img  { width: 16px; height: 16px; }

.reactions-16 .myr-count, .reactions-16 .myr-reacted { font-size: 11px; }
.reactions-20 .myr-count { font-size: 12px; }
.reactions-24 .myr-count { font-size: 13px; }
.reactions-28 .myr-count { font-size: 14px; }
.reactions-32 .myr-count { font-size: 15px; }

/* ---------- Picker popup ---------- */
/* The table (.tborder/.thead/.tcat/.trow1) gives the look, so the popup follows the active theme / dark mode */
.modal.myr-modal {
	width: 460px;
	max-width: calc(100% - 4px); /* % of the .blocker content box, so it never wraps below on phones */
	padding: 0;
	background: transparent;
}
.myr-modal table.myr-react {
	width: 100%;
	margin: 0;
}
.myr-modal .myr-preview {
	font-style: italic;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}
.myr-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 2px;
}
.myr-grid.myr-grid-all {
	max-height: min(300px, 45vh);
	overflow-y: auto;
}
a.myr-pick {
	display: inline-flex;
	padding: 5px;
	border-radius: 6px;
	line-height: 0;
	cursor: pointer;
}
a.myr-pick img {
	width: 26px;
	height: 26px;
}
a.myr-pick:hover,
a.myr-pick:focus {
	background: rgba(128, 128, 128, .22);
	outline: none;
}
a.myr-pick:hover img {
	transform: scale(1.2);
}
a.myr-pick.disabled {
	cursor: not-allowed;
	opacity: .25;
	filter: grayscale(100%);
}
a.myr-pick.disabled:hover {
	background: none;
}
a.myr-pick.disabled:hover img {
	transform: none;
}

@media (max-width: 480px) {
	a.myr-pick img {
		width: 30px;
		height: 30px;
	}
}
