/**
 * Image Generator History Styles
 *
 * Recent generations grid and thumbnail styling.
 *
 * @package AgenticWP
 */

/* ==========================================================================
   History Section
   ========================================================================== */

.agenticwp-history-section {
	background: var(--agenticwp-bg-white);
	border-radius: var(--agenticwp-radius-lg);
	padding: var(--agenticwp-space-xl);
	border: 1px solid var(--agenticwp-border-light);
	box-shadow: var(--agenticwp-shadow-xs);
}

/* ==========================================================================
   History Grid
   ========================================================================== */

.agenticwp-history-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: var(--agenticwp-space-lg);
}

.agenticwp-history-loading {
	grid-column: 1 / -1;
	text-align: center;
	padding: var(--agenticwp-space-2xl);
	color: var(--agenticwp-text-muted);
	font-size: var(--agenticwp-text-sm);
}

.agenticwp-history-empty {
	grid-column: 1 / -1;
	text-align: center;
	padding: var(--agenticwp-space-2xl);
	color: var(--agenticwp-text-secondary);
	font-size: var(--agenticwp-text-sm);
}

.agenticwp-history-empty .dashicons {
	display: block;
	font-size: 48px;
	width: 48px;
	height: 48px;
	margin: 0 auto var(--agenticwp-space-md);
	color: var(--agenticwp-text-muted);
}

/* ==========================================================================
   History Item
   ========================================================================== */

.agenticwp-history-item {
	position: relative;
	aspect-ratio: 1;
	border-radius: var(--agenticwp-radius);
	overflow: hidden;
	background: var(--agenticwp-bg-light);
	cursor: pointer;
	transition: var(--agenticwp-transition-fast);
	animation: fadeIn 0.3s ease-out both;
}

.agenticwp-history-item:nth-child(2) { animation-delay: 0.05s; }
.agenticwp-history-item:nth-child(3) { animation-delay: 0.1s; }
.agenticwp-history-item:nth-child(4) { animation-delay: 0.15s; }
.agenticwp-history-item:nth-child(5) { animation-delay: 0.2s; }
.agenticwp-history-item:nth-child(6) { animation-delay: 0.25s; }
.agenticwp-history-item:nth-child(7) { animation-delay: 0.3s; }
.agenticwp-history-item:nth-child(8) { animation-delay: 0.35s; }
.agenticwp-history-item:nth-child(9) { animation-delay: 0.4s; }
.agenticwp-history-item:nth-child(10) { animation-delay: 0.45s; }

.agenticwp-history-item:hover {
	transform: translateY(-4px);
	box-shadow: var(--agenticwp-shadow-lg);
}

.agenticwp-history-item:focus {
	outline: 2px solid var(--agenticwp-primary);
	outline-offset: 2px;
}

/* Checkerboard background for transparent images */
.agenticwp-history-item::before {
	content: '';
	position: absolute;
	inset: 0;
	background-image:
		linear-gradient(45deg, #e8e8ed 25%, transparent 25%),
		linear-gradient(-45deg, #e8e8ed 25%, transparent 25%),
		linear-gradient(45deg, transparent 75%, #e8e8ed 75%),
		linear-gradient(-45deg, transparent 75%, #e8e8ed 75%);
	background-size: 12px 12px;
	background-position: 0 0, 0 6px, 6px -6px, -6px 0;
	opacity: 0.4;
	z-index: 0;
}

.agenticwp-history-item img {
	position: relative;
	width: 100%;
	height: 100%;
	object-fit: cover;
	z-index: 1;
}

/* Hover overlay */
.agenticwp-history-overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, transparent 50%);
	opacity: 0;
	transition: var(--agenticwp-transition-fast);
	z-index: 2;
	display: flex;
	align-items: flex-end;
	padding: var(--agenticwp-space-sm);
}

.agenticwp-history-item:hover .agenticwp-history-overlay {
	opacity: 1;
}

.agenticwp-history-overlay .dashicons {
	color: white;
	font-size: 16px;
	width: 16px;
	height: 16px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media screen and (max-width: 782px) {
	.agenticwp-history-grid {
		grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
		gap: var(--agenticwp-space-md);
	}
}

@media screen and (max-width: 480px) {
	.agenticwp-history-grid {
		grid-template-columns: repeat(3, 1fr);
		gap: var(--agenticwp-space-sm);
	}
}
