@import url("../shared/variables.css");
@import url("../shared/toasts.css");
@import url("./image-cropper.css");

* {
	box-sizing: border-box;
	-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
	text-underline-offset: 2px;

	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	-webkit-text-size-adjust: 100%;
	-moz-text-size-adjust: 100%;
	-ms-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

html,
body {
	scrollbar-gutter: stable;
}

body {
	font-family:
		"chirp",
		"Noto Color Emoji",
		system-ui,
		-apple-system,
		BlinkMacSystemFont,
		"Segoe UI",
		Roboto,
		Helvetica,
		Arial,
		sans-serif,
		"Apple Color Emoji",
		"Segoe UI Emoji",
		"Segoe UI Symbol";
	font-optical-sizing: auto;
	color: var(--text-primary);
	background-color: var(--bg-primary);
	font-size: 16px;
	font-variation-settings:
		"slnt" 0,
		"wdth" 100;
	line-height: 1.5;
	overflow-x: hidden;
}

button,
img {
	user-select: none;
}

.btn {
	width: 100%;
	padding: 12px 16px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: inherit;
	font-size: 16px;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: background-color 0.12s ease;
	margin-bottom: 12px;

	&:not(:disabled):active {
		opacity: 0.85;
	}

	&.primary {
		background: var(--primary);
		color: var(--primary-fg);

		&:hover:not(:disabled) {
			background: var(--primary-hover);
		}

		&:focus:not(:disabled) {
			background-color: var(--primary-focus);
		}

		&:disabled {
			background: var(--btn-disabled-bg);
			cursor: not-allowed;
		}

		&:focus:not(:disabled) {
			background-color: var(--primary-focus);
		}
	}

	&.secondary {
		background: transparent;
		color: var(--text-primary);
		border: 1px solid var(--btn-secondary-border);

		&:hover:not(:disabled) {
			border-color: var(--border-hover);
		}

		&:focus:not(:disabled) {
			background-color: var(--btn-secondary-hover-bg);
		}

		&:disabled {
			background: var(--bg-secondary);
			color: var(--btn-disabled-color);
			cursor: not-allowed;
		}
	}
}

.loader {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: var(--bg-primary);
	z-index: 1000;
	align-items: center;
	justify-content: center;
	transition: opacity 0.1s;
	display: flex;

	svg {
		width: 28px;
		height: 28px;
	}
}

@keyframes popupEnter {
	from {
		opacity: 0;
		transform: translate(var(--popup-translate-x), var(--popup-translate-y))
			scale(0.95);
		backdrop-filter: blur(0px);
	}

	to {
		opacity: 1;
		transform: translate(var(--popup-translate-x), var(--popup-translate-y))
			scale(1);
		backdrop-filter: blur(1px);
	}
}

@keyframes popupExit {
	from {
		opacity: 1;
		transform: translate(var(--popup-translate-x), var(--popup-translate-y))
			scale(1);
		backdrop-filter: blur(1px);
	}

	to {
		opacity: 0;
		transform: translate(var(--popup-translate-x), var(--popup-translate-y))
			scale(0.95);
		backdrop-filter: blur(0px);
	}
}

.popup-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: transparent;
	z-index: 1000;
	display: flex;
	align-items: flex-start;
	justify-content: flex-start;
	opacity: 0;
	transition: opacity 0.1s ease-out;
}

.popup-overlay.visible {
	opacity: 1;
}

.popup-overlay.closing {
	opacity: 0;
}

.popup {
	background: var(--bg-primary);
	border: 1px solid var(--border-primary);
	border-radius: 12px;
	padding: 0;
	min-width: 160px;
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
	--popup-translate-x: 0px;
	--popup-translate-y: 0px;
	pointer-events: auto;
	transform-origin: top center;
	opacity: 0;
	transform: translate(var(--popup-translate-x), var(--popup-translate-y))
		scale(0.95);
	animation: popupEnter 0.15s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.popup-overlay.visible .popup {
	animation: popupEnter 0.15s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.popup-overlay.closing .popup {
	animation: popupExit 0.15s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.popup-content {
	padding: 0;
}

.popup-option-has-submenu {
	justify-content: space-between;
}
.popup-option-has-submenu.submenu-open {
	background-color: var(--bg-overlay-light);
}
.popup-option-caret {
	display: inline-flex;
	align-items: center;
	color: var(--text-secondary);
	margin-left: auto;
	opacity: 0.85;
}
.popup-submenu {
	pointer-events: auto;
}

.popup-option {
	width: calc(100% - 8px);
	background: transparent;
	border: none;
	padding: 6.7px 12px;
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	transition:
		background-color 0.1s ease,
		transform 0.15s;
	font-family: inherit;
	text-align: left;
	border-radius: 7px;
	margin: 4px;
	max-width: 300px;
	line-height: 1.5;

	&:hover {
		background-color: var(--bg-overlay-light);
	}

	&:active {
		background-color: var(--bg-overlay-light);
		transform: scale(0.99);
	}

	.popup-option-icon {
		display: flex;
		align-items: center;
		justify-content: center;
		color: var(--text-primary);
		flex-shrink: 0;

		svg {
			width: 16px;
			height: 16px;
		}
	}

	.popup-option-content {
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		text-align: left;

		.popup-option-title {
			font-size: 13px;
			font-weight: 500;
			color: var(--text-primary);
			margin: 0;
		}

		.popup-option-description {
			font-size: 13px;
			color: var(--text-secondary);
			margin: 0;
		}
	}
}

.mention-suggestions {
	background: var(--bg-primary);
	border: 1px solid var(--border-primary);
	border-radius: 12px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	z-index: 1000;
	max-height: 260px;
	overflow-y: auto;
	padding: 6px 6px;
	min-width: 220px;
}

.mention-suggestion {
	width: calc(100% - 8px);
	background: transparent;
	border: none;
	padding: 8px 10px;
	display: flex;
	align-items: center;
	gap: 10px;
	cursor: pointer;
	transition: background-color 0.1s ease;
	font-family: inherit;
	text-align: left;
	border-radius: 8px;
	height: 40px;
	margin: 4px;

	&:hover,
	&.selected {
		background: var(--bg-overlay-light);
	}

	&:first-child {
		margin-top: 2px;
	}

	&:last-child {
		margin-bottom: 2px;
	}
}

.mention-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	flex-shrink: 0;
	object-fit: cover;
}

.mention-info {
	flex: 1;
	min-width: 0;
}

.mention-name {
	font-weight: 600;
	color: var(--text-primary);
	margin-bottom: 0;
	font-size: 13px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.mention-username {
	color: var(--text-secondary);
	font-size: 13px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.mention-suggestions .no-results {
	padding: 12px;
	text-align: center;
	color: var(--text-secondary);
	font-size: 13px;
}

.vibe-selector-btn {
	padding: 6px 12px;
	border-radius: 16px;
	background: var(--bg-secondary);
	border: 1px solid var(--border-primary);
	color: var(--text-primary);
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition:
		background-color 0.15s ease,
		transform 0.15s ease;
	white-space: nowrap;
	font-family: inherit;
}

.vibe-selector-btn:hover {
	background: var(--bg-overlay-light);
}

.vibe-selector-btn:active {
	transform: scale(0.98);
}

.vibe-modal.modal {
	/* DOn't let the cursor be stuck gonna fix xeet 🔔 XRP NOTIFICATIONs rn XRPxʀᴘ ɴᴏᴛɪꜰɪᴄᴀᴛɪᴏɴ*/
	max-width: 400px;
	width: 90%;
	display: block;
}

.vibe-options-list {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	padding: 16px;
}

.vibe-option-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 16px;
	border: 2px solid var(--border-primary);
	border-radius: 12px;
	background: var(--bg-primary);
	cursor: pointer;
	transition: all 0.15s ease;
	font-family: inherit;
}

.vibe-option-item:hover {
	background: var(--bg-secondary);
	border-color: var(--primary);
}

.vibe-option-item.selected {
	background: rgba(var(--primary-rgb), 0.1);
	border-color: var(--primary);
}

.vibe-emoji {
	font-size: 32px;
	line-height: 1;
}

.vibe-label {
	font-size: 14px;
	font-weight: 600;
	color: var(--text-primary);
	text-align: center;
}

.confirm-modal {
	max-width: 400px;
	width: 90%;
}

.confirm-modal-content {
	padding: 24px;
}

.confirm-modal-message {
	margin: 0 0 24px 0;
	font-size: 15px;
	line-height: 1.5;
	color: var(--text-primary);
}

.confirm-modal-actions {
	display: flex;
	gap: 12px;
}

.confirm-modal-cancel,
.confirm-modal-confirm {
	flex: 1;
	padding: 10px 20px;
	border-radius: 9999px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.15s ease;
	border: none;
	font-family: inherit;
}

.confirm-modal-cancel {
	background-color: transparent;
	color: var(--text-primary);
	border: 1px solid var(--border-primary);
}

.confirm-modal-cancel:hover {
	background-color: var(--bg-secondary);
}

.confirm-modal-confirm {
	background-color: var(--primary);
	color: var(--primary-fg);
}

.confirm-modal-confirm:hover {
	background-color: var(--primary-hover);
}

/* Eesti Loafs */
@font-face {
	font-family: "chirp";
	src: url("/public/shared/assets/fonts/chirp.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
}

@font-face {
	font-family: "chirp";
	src: url("/public/shared/assets/fonts/chirpmedium.woff2") format("woff2");
	font-weight: 500;
	font-style: normal;
}

@font-face {
	font-family: "chirp";
	src: url("/public/shared/assets/fonts/chirpbold.woff2") format("woff2");
	font-weight: 700;
	font-style: normal;
}

@font-face {
	font-family: "chirp";
	src: url("/public/shared/assets/fonts/chirpheavy.woff2") format("woff2");
	font-weight: 900;
	font-style: normal;
}

html,
body,
* {
	overscroll-behavior-y: contain;
}

*::placeholder {
	user-select: none;
}
