/* ── GifPicker ─────────────────────────────────────────────────
   Klipy-backed GIF browser embedded in the EmojiPicker's GIFs tab.
   Search bar at the top, optional featured tile row + grid below. */

.root {
	display: flex;
	flex-direction: column;
	height: 100%;
	min-height: 0;
	box-sizing: border-box;
}

/* Matches the emoji picker's search row — full-width slot with a
   bottom hairline, holding a rounded `.searchBar` pill inside. */
.searchRow {
	padding: 10px 12px;
	border-bottom: 1px solid var(--background-modifier-hover);
	flex-shrink: 0;
}

/* Body wrapper — everything below the search row. Uses
   `--background-primary` so the categories / featured / grid
   content reads against a lighter surface instead of the picker's
   tertiary base. */
.body {
	flex: 1;
	min-width: 0;
	min-height: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 10px 12px;
	background-color: var(--background-primary);
	overflow: hidden;
	box-sizing: border-box;
}

.searchBar {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	background: var(--background-tertiary);
	border: 1px solid var(--background-modifier-accent);
	border-radius: 8px;
	flex-shrink: 0;
}

/* Kill any :focus-within highlight that global styles might paint
   on the search bar wrapper when the input gains focus. */
.searchBar:focus-within {
	outline: none;
	box-shadow: none;
	border-color: var(--background-modifier-accent);
}

.searchIcon {
	color: var(--text-tertiary);
	flex-shrink: 0;
}

.searchInput {
	flex: 1;
	background: transparent;
	border: none;
	outline: none;
	color: var(--text-primary);
	font: inherit;
	font-size: 14px;
	min-width: 0;
}

/* Some UA stylesheets still paint a focus ring via `:focus-visible`
   even with `outline: none` on the base rule. Nuke both explicitly. */
.searchInput:focus,
.searchInput:focus-visible {
	outline: none;
	box-shadow: none;
	border: none;
}

.featuredRow {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	flex-shrink: 0;
}

.featuredTile {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	align-items: flex-start;
	padding: 14px;
	height: 96px;
	border-radius: 8px;
	border: none;
	cursor: pointer;
	color: #ffffff;
	overflow: hidden;
	transition: transform 0.12s ease;
}

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

.featuredFavorites {
	background: linear-gradient(135deg, #4641d9 0%, #7b5ce7 100%);
}

.featuredTrending {
	background: linear-gradient(135deg, #f04f88 0%, #ff7c5c 100%);
}

.featuredIcon {
	position: absolute;
	top: 12px;
	right: 12px;
	opacity: 0.85;
}

.featuredLabel {
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 0.01em;
}

/* ── Category grid (home view) ─────────────────────────────────
   Discord-style 2-column tiles, each backed by a still frame of
   a real GIF from that category. A dark gradient overlay keeps
   the label readable against anything — bright cartoons, night
   scenes, black-and-white clips. */
.categoriesGrid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	grid-auto-rows: max-content;
	gap: 8px;
	overflow-y: auto;
	min-height: 0;
	flex: 1;
	padding-bottom: 4px;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.categoriesGrid::-webkit-scrollbar {
	display: none;
}

.categoryTile {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 10px 12px;
	aspect-ratio: 16 / 9;
	width: 100%;
	min-width: 0;
	min-height: 0;
	border-radius: 8px;
	border: none;
	background-color: var(--background-tertiary);
	color: #ffffff;
	cursor: pointer;
	overflow: hidden;
	transition: transform 0.12s ease;
}

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

.categoryTileImage {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	pointer-events: none;
}

.categoryTile::after {
	/* Uniformly dark scrim so the centred label reads cleanly
	   against any preview — bright cartoons, night scenes,
	   black-and-white clips. */
	content: '';
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	pointer-events: none;
}

.categoryTileLabel {
	position: relative;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.01em;
	text-transform: capitalize;
	text-align: center;
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
	z-index: 1;
}

.subHeaderRow {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 0 4px;
	flex-shrink: 0;
}

.backLink {
	background: none;
	border: none;
	color: var(--brand-primary, #5865f2);
	font: inherit;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	padding: 0;
}

.subHeaderTitle {
	font-size: 13px;
	font-weight: 700;
	color: var(--text-primary);
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	grid-auto-rows: max-content;
	gap: 8px;
	overflow-y: auto;
	min-height: 0;
	flex: 1;
	padding-bottom: 4px;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.grid::-webkit-scrollbar {
	display: none;
}

.tile {
	position: relative;
	border: none;
	padding: 0;
	margin: 0;
	cursor: pointer;
	border-radius: 8px;
	overflow: hidden;
	background: var(--background-tertiary);
	aspect-ratio: 16 / 9;
	width: 100%;
	min-width: 0;
	min-height: 0;
	transition: transform 0.12s ease;
}

.tile:hover {
	transform: scale(1.02);
}

.tileImage {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.favoriteButton {
	position: absolute;
	top: 6px;
	right: 6px;
	width: 26px;
	height: 26px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	border: none;
	background: rgba(0, 0, 0, 0.55);
	color: #ffffff;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.12s ease, background-color 0.12s ease;
}

.tile:hover .favoriteButton {
	opacity: 1;
}

.favoriteButton:hover {
	background: rgba(0, 0, 0, 0.75);
}

.favoriteButtonActive {
	opacity: 1;
	color: var(--brand-primary, #5865f2);
}

.statusMessage,
.statusMessageError {
	padding: 24px 12px;
	text-align: center;
	color: var(--text-tertiary);
	font-size: 13px;
}

.statusMessageError {
	color: var(--status-danger, #ed4245);
}
