/**
 * Admin grid view for the Model Textures CPT.
 *
 * Applied only on the edit.php?post_type=model_texture screen.
 * Overrides the default WP list-table display so each texture
 * renders as a card in a responsive grid.
 *
 * @package ProductCustomizer
 */

/* Hide table furniture that makes no sense in a grid */
.wp-list-table.posts thead,
.wp-list-table.posts tfoot,
.wp-list-table.posts .column-cb,
.wp-list-table.posts .column-date,
.wp-list-table.posts colgroup {
	display: none !important;
}

/* Turn the tbody into the grid container */
.wp-list-table.posts tbody {
	display: grid !important;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 16px;
	padding: 16px 0;
}

/* Each row becomes a card */
.wp-list-table.posts tbody tr {
	display: flex !important;
	flex-direction: column;
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	overflow: hidden;
	transition: box-shadow 0.15s ease;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.wp-list-table.posts tbody tr.hidden {
	display: none !important;
}

.wp-list-table.posts tbody tr.inline-edit-row {
	grid-column: 1 / -1;
}

.wp-list-table.posts tbody tr:hover {
	box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

/* Alternate row background that WP adds — remove it */
.wp-list-table.posts tbody tr.alternate {
	background: #fff;
}

/* Image cell — fills the top of the card */
.wp-list-table.posts .column-base_color {
	padding: 10px;
	padding-bottom: 0px;
	display: block;
	line-height: 0;
}

.wp-list-table.posts .column-base_color img {
	display: block;
	width: 100%;
	height: 130px;
	object-fit: cover;
	border-radius: 0;
}

/* Placeholder when no image */
.wp-list-table.posts .column-base_color:not(:has(img)) {
	height: 130px;
	background: #f0f0f1;
	display: flex !important;
	align-items: center;
	justify-content: center;
	color: #aaa;
	font-size: 28px;
}

/* Title cell — sits below the image */
.wp-list-table.posts .column-title {
	display: block !important;
	padding: 8px 10px 10px !important;
	flex: 1;
}

.wp-list-table.posts .column-title strong a {
	font-size: 12px;
	line-height: 1.3;
	word-break: break-word;
}

/* Row actions — always visible (no hover needed on small cards) */
.wp-list-table.posts .column-title .row-actions {
	position: static;
	visibility: visible;
	opacity: 1;
	font-size: 11px;
	padding-top: 4px;
}

/* Make the overall table element not interfere */
.wp-list-table.posts {
	display: block !important;
	border: none !important;
	background: transparent !important;
	box-shadow: none !important;
}


.grid-color-swatch {
	width: 100%;
	height: 100%;

	span {
		background: rgba(44, 44, 44, 0.8);
		color: #fff;
		padding: 2px 4px;
		font-size: 10px;
	}
}

.texture-field-wrapper {
	display: inline-block;
}

.texture-preview {
	width: 150px;
	height: 150px;
	background-color: #aaa;
}

.texture-field-container {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	align-items: center;
	gap: 10px;
}

.advanced-texture-field-wrapper {
	grid-column: 1 / -1;
}

.texture-preview{
	margin-bottom: 1em;
}

.button.remove-image-button{
	color: red;
	font-size: 12px;
	cursor: pointer;
	border-color: red;
}