:root {
	/* Cores Principais */
	--color-white: #ffffff;

	/* Cores de Acento */
	--color-accent-600: #4863f7;
	--color-accent-500: #7878d7;

	/* Cor de Alerta */
	--color-alert-600: #ff5c5c;

	/* Tons de Cinza */
	--color-gray-900: #0d0d0d;
	--color-gray-800: #111111;
	--color-gray-700: #1a1a1a;
	--color-gray-200: #424242;
	--color-gray-100: #737373;
}

/*
	NLW - Prompt Manager (style.css)
	- Contém as variáveis de cor, estilos globais e regras para a sidebar/lista de prompts.
	- Nota: a visibilidade do botão `.open-toggle` é controlada por posicionamento e z-index;
		evitar manipular display via JS para manter consistência entre viewports.
*/

body,
input,
button {
	font-family: "Inter", sans-serif;
}

body {
	background-color: var(--color-gray-900);
	color: var(--color-white);
}

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

::-webkit-scrollbar {
	width: 8px;
}

::-webkit-scrollbar-track {
	background-color: transparent;
}

::-webkit-scrollbar-thumb {
	background-color: var(--color-gray-100);
	border-radius: 4px;
}

.app {
	display: flex;
	height: 100vh;
	width: 100vw;
}

.main {
	display: flex;
	flex-direction: column;
	flex: 1;
	padding: 62px 124px;
	gap: 32px;

	overflow-y: scroll;
}

.main-header {
	display: flex;
	justify-content: flex-end;
	align-items: center;
	gap: 16px;
	width: 100%;
	margin-bottom: 24px;
}

.btn {
	display: flex;
	height: 44px;
	justify-content: center;
	align-items: center;
	font-weight: 500;
	font-size: 14px;
	border-radius: 6px;
	cursor: pointer;
	transition: filter 0.2s;
}

.btn-outline {
	background: transparent;
	border: 0.5px solid var(--color-gray-200);
	color: var(--color-white);
	padding: 0 20px;
	height: 44px;
	gap: 10px;
	transition: background-color 0.3s;
}

.btn-outline:hover {
	background-color: var(--color-gray-200);
}

.btn-primary {
	background: var(--color-accent-600);
	color: var(--color-white);
	padding: 0 24px;
}

.btn-primary.btn:hover {
	background: var(--color-accent-500);
}

.w-150 {
	width: 150px;
}

.icon {
	width: 20px;
	height: 20px;
}

.prompt-title {
	font-size: 32px;
	font-weight: 600;
	outline: none;
}

.prompt-content {
	font-size: 16px;
	border-radius: 16px;
	min-height: 180px;
	outline: none;
	border: none;
	line-height: 32px;
	margin-bottom: 0;
}

.editable-wrapper {
	position: relative;
}

.editable-wrapper::before {
	content: attr(data-placeholder);
	position: absolute;

	color: var(--color-gray-200);
	pointer-events: none;
	opacity: 0;
}

.editable-wrapper.is-empty::before {
	opacity: 1;
}

#title-wrapper.is-empty {
	font-size: 32px;
	font-weight: 600;
}

#content-wrapper.is-empty {
	font-size: 16px;
	line-height: 32px;
}

.icon-button {
	padding: 0;
	border: none;
	background: transparent;
	cursor: pointer;
	/* tamanho padrão para botões de ícone (alinha open/close) */
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 8px;
}

.open-toggle {
	/* Tornar o toggle sempre visível; posicionamento fixo para ficar na viewport */
	position: fixed;
	top: 32px;
	left: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	background: transparent;
	border: none;
	border-radius: 8px;
	z-index: 1000; /* botão fica abaixo da sidebar (sidebar usará z-index maior) */
}

.sidebar {
	width: 400px;
	height: 100vh;
	flex-direction: column;
	padding: 32px;
	background-color: var(--color-gray-800);
	border-right: 0.5px solid var(--color-gray-700);
	position: relative; /* permite z-index funcionar */
	z-index: 1100; /* sidebar deve ficar acima do botão quando houver sobreposição */
}

.sidebar.collapsed {
	width: 0;
	padding: 0;
	opacity: 0;
	transform: translateX(0);
}

.sidebar-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 32px;
}

.logo {
	height: 24px;
}

/* Sidebar Content (Figma Style) */
.sidebar-content {
	display: flex;
	flex-direction: column;
	gap: 20px;
	padding: 24px 20px 0 20px;
}
/* Prompt Item (Sidebar List) */
.prompt-list {
	list-style: none;
	padding: 0;
	margin: 0;
}

.prompt-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: var(--color-gray-700);
	border-radius: 12px;
	padding: 16px 20px;
	margin-bottom: 12px;
	transition: background 0.2s;
}
.prompt-item:hover {
	background: var(--color-gray-800);
}

.prompt-item-info {
	display: flex;
	flex-direction: column;
	gap: 4px;
	flex: 1;
	min-width: 0;
}

.prompt-item-title {
	font-size: 16px;
	font-weight: 400;
	color: var(--color-white);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.prompt-item-description {
	font-size: 13px;
	color: var(--color-gray-100);
	/* Usar line-clamp para suportar truncamento mesmo com quebras (<br>)
	   -webkit-line-clamp limita o número de linhas visíveis
	   Ajuste o valor para 1, 2, 3 conforme desejar */
	display: -webkit-box;
	-webkit-line-clamp: 2; /* troque para 2 ou 3 para múltiplas linhas */
	line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: normal; /* permitir quebras no conteúdo, line-clamp controla o corte */
}

.btn-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 0;
	margin-left: 16px;
	border-radius: 6px;
	transition: background 0.2s;
	height: 32px;
	width: 32px;
}
.btn-icon:hover {
	background: rgba(255, 92, 92, 0.08);
}

.icon-trash {
	width: 20px;
	height: 20px;
	stroke: var(--color-alert-600);
}

.search-container {
	display: flex;
	align-items: center;
	width: 100%;
	border: 1px solid var(--color-gray-200);
	border-radius: 8px;
	padding: 0 12px;
	height: 44px;
	position: relative;
}

.search-container:focus-within {
	border-color: var(--color-accent-600);
	.search-icon img {
		filter: invert(48%) sepia(88%) saturate(4031%) hue-rotate(216deg)
			brightness(95%) contrast(101%);
	}
}

.search-icon {
	display: flex;
	align-items: center;
	margin-right: 8px;
}

.search-icon img {
	width: 20px;
	height: 20px;
}

.search-input {
	width: 100%;
	height: 44px;
	border: none;
	background: transparent;
	padding-left: 4px;
	outline: none;
	color: var(--color-white);
}

.new-prompt-btn {
	width: 100%;
	height: 44px;
	font-size: 16px;
	font-weight: 500;
	border-radius: 8px;
	margin-top: 4px;
}

.search-divider {
	width: 100%;
	border-bottom: 3px solid var(--color-gray-700);
	margin-top: 8px;
	margin-bottom: 25px;
}

@media (max-width: 950px) {
	.open-toggle {
		/* adapta um pouco o posicionamento em telas pequenas */
		left: 20px;
		z-index: 1000; /* manter abaixo da sidebar (sidebar usa 1100)
						o sidebar terá posição fixed e idêntico z-index em mobile */
	}

	.sidebar {
		position: fixed;
		top: 0;
		left: 0;
		height: 100vh;
		width: 80%;
		max-width: 300px;
		transform: translateX(-100%);
		z-index: 1100;
	}

	.sidebar.open {
		transform: translateX(0);
		transition: transform 0.3s ease-in-out;
	}

	.main {
		padding: 24px 32px;
	}
}
