﻿/* ========== GENERAL ========== */
.prefab-control {
	display: flex;
	flex-direction: row;
	gap: 16px;
	max-width: 420px;
	margin: 15px;
	font-family: sans-serif;
}

	.prefab-control button {
		z-index: 10;
		white-space: nowrap;
		padding: 6px 12px;
		min-width: max-content;
	}

.prefab-search-container span.material-symbols {
	color: black;
}

.prefab-control .dropdown {
	position: relative;
	display: inline-block;
	color: black;
}

.prefab-control .dropdown-toggle,
.prefab-control .site-dropdown-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	color: black;
}

.prefab-control .dropdown-arrow {
	font-size: 24px;
	transition: transform 0.3s ease;
}

.dropdown-toggle.open .dropdown-arrow {
	transform: rotate(180deg);
}

/* ========== MODALS ========== */
.prefab-modal,
.prefab-save-modal {
	display: none;
	position: fixed;
	z-index: 9999;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.5);
}

	.prefab-modal.show,
	.prefab-save-modal.show {
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
		z-index: 99999;
	}

.prefab-modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	background-color: #003E53;
	color: white;
	width: 90%;
	padding: 5px 10px;
	border-radius: 6px 6px 0 0;
}

	.prefab-modal-header h4 {
		margin: 0;
		font-size: 16px;
	}

.close-prefab-modal,
.close-prefab-save-modal {
	font-size: 20px;
	font-weight: bold;
	cursor: pointer;
	background: none;
	border: none;
	line-height: 1;
}

.prefab-modal-content {
	background: white;
	padding: 16px;
	width: 90%;
	max-height: 100vh;
	overflow-y: auto;
	border-radius: 0 0 6px 6px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.prefab-save-modal .prefab-modal-header,
.prefab-save-modal .prefab-modal-content {
	width: 50%;
}

/* ========== DROPDOWN MENU ========== */
.prefab-control .dropdown-menu {
	position: absolute;
	background-color: white;
	border: 1px solid #ccc;
	z-index: 1000;
	max-height: 200px;
	overflow-y: auto;
	width: 220px;
	padding: 10px;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
	border-radius: 4px;
}

.prefab-control .dropdown-item {
	display: block;
	font-size: 14px;
	margin-bottom: 6px;
	cursor: pointer;
	user-select: none;
	color: black;
}

	.prefab-control .dropdown-item input[type="checkbox"] {
		margin-right: 8px;
	}

/* ========== PREFAB LIST ========== */
#prefabList {
	list-style: none;
	padding: 1rem 0;
	margin: 0;
	height: 100%;
	overflow-y: auto;
	border: 1px solid #ddd;
	border-radius: 4px;
	background: rgb(245, 245, 245);
}

	#prefabList li {
		padding: 10px 12px;
		cursor: pointer;
		border-bottom: 1px solid #eee;
		transition: background-color 0.2s ease;
	}

		#prefabList li:hover {
			background-color: #f5f5f5;
		}

		#prefabList li.selected {
			background-color: #d0d0d0;
			font-weight: 600;
		}

/* ========== PREFAB TILES ========== */
.prefab-tiles {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 12px;
	margin-top: 10px;
}

.prefab-tile {
	padding: 6px 16px 0 10px;
	position: relative;
	width: 350px;
	border: 1px solid #ccc;
	cursor: pointer;
	text-align: center;
	background-color: #fff;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
	transition: transform 0.2s ease;
	max-height: 200px;
}

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

	.prefab-tile.selected {
		border: 2px solid #007bff;
		box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
	}

.prefab-tile-img-wrapper {
	position: relative;
	display: inline-block;
	width: 100%;
}

.prefab-tile-img {
	width: 100%;
	height: 150px;
	object-fit: cover;
}

.prefab-tile-name {
	font-size: 14px;
	font-weight: 500;
}

.prefab-tile .prefab-delete-btn {
	position: absolute;
	top: 0;
	right: 2px;
	background: none;
	border: none;
	color: #000;
	font-size: 20px;
	line-height: 1;
	font-weight: 400;
	cursor: pointer;
	z-index: 10;
	padding: 0;
}

.prefab-delete-btn:hover {
	color: #d00;
}

.prefab-tile-name {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.2;
	overflow-wrap: anywhere;
	hyphens: auto;
	color: black;
}
/* ========== PREVIEW HOVER ========== */
.preview-hover {
	display: none;
	position: absolute;
	top: 0;
	left: 105%;
	z-index: 1000;
	border: 1px solid #ccc;
	background: white;
	padding: 5px;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

	.preview-hover img {
		max-width: 300px;
		max-height: 300px;
	}

.prefab-tile-img-wrapper:hover .preview-hover {
	display: block;
}

#hover-preview-popup img {
	max-width: 600px;
	max-height: 600px;
	border-radius: 6px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ========== CATEGORY & TAGS ========== */
.prefab-control .category-filter-container {
	position: relative;
}

.prefab-control .selected-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 8px;
}

.prefab-control .selected-tag {
	background-color: #e1f0ff;
	padding: 4px 8px;
	border-radius: 4px;
	font-size: 13px;
	cursor: pointer;
	user-select: none;
	display: flex;
	align-items: center;
	gap: 6px;
	color: black;
}

	.prefab-control .selected-tag:hover {
		background-color: #cfe4fa;
	}

	.prefab-control .selected-tag .remove-tag {
		font-weight: bold;
		color: #777;
		cursor: pointer;
		font-size: 14px;
		margin-left: 4px;
	}

	.prefab-control .selected-tag:hover .remove-tag {
		color: #333;
	}

/* ========== INPUTS & BUTTONS ========== */
.prefabNameInput {
	padding: 8px 10px;
	font-size: 14px;
	border: 1px solid #ccc;
	border-radius: 4px;
	color: black;
}

.populate-prefab,
.save-prefab {
	color: #fff;
	background-color: #283f8a;
	border-radius: 16px;
	padding: 6px 16px;
	width: fit-content;
	border: none;
	cursor: pointer;
}

/* ========== MESSAGES & STATES ========== */
.prefab-loader,
.prefab-error,
.prefab-empty {
	padding: 20px;
	text-align: center;
	font-size: 15px;
	color: #555;
}

	.prefab-loader::after {
		content: "";
		display: inline-block;
		margin-left: 10px;
		width: 16px;
		height: 16px;
		border: 2px solid #ccc;
		border-top-color: #007bff;
		border-radius: 50%;
		animation: spin 0.8s linear infinite;
	}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

/* ========== PAGINATION ========== */
.pagination-container {
	display: flex;
	gap: 6px;
	margin-top: 12px;
	justify-content: center;
}

.pagination-btn {
	padding: 5px 10px;
	border: 1px solid #ccc;
	background: #f5f5f5;
	cursor: pointer;
	border-radius: 4px;
}

	.pagination-btn.active {
		background: #e1f0ff;
		color: rgb(44, 41, 39);
		font-weight: bold;
	}

	.pagination-btn:disabled {
		background: #e0e0e0;
		cursor: not-allowed;
	}

/* ========== FORM ERROR ========== */
.prefab-control .input-error {
	border: 1px solid red;
}

.prefab-control .error-message {
	color: red;
	font-size: 12px;
	margin-top: 4px;
	display: block;
}

/* ========== FILTERS ========== */

.prefab-filters-container {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 0 16px;
	margin-bottom: 10px;
}

.filter-tags-row {
	width: 100%;
}

.filter-main-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 16px;
}

.filter-left {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

.filter-right {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 40%;
}

/* ========== SEARCH INPUT ========== */

.prefab-search-container {
	display: flex;
	align-items: center;
	gap: 4px;
	position: relative;
	width: 100%;
}

#prefabSearchInput {
	padding: 8px 12px;
	border: 1px solid black;
	border-radius: 25px;
	outline: none;
	font-size: 14px;
	width: 100%;
	background: white;
	color: black;
}

.search-btn {
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 4px;
	font-size: 18px;
	position: absolute;
	right: 0;
	display: flex;
}

.search-icon {
	color: black;
}

.prefab-footer-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 12px;
}


.prefab-modal-warning {
	margin: 8px 16px 0;
	padding: 8px 12px;
	border: 1px solid #ffd8a8;
	background: #fff4e5;
	color: #7a3e00;
	border-radius: 6px;
	font-size: 13px;
}
