/**
 * PersonaFlow Frontend Styles
 *
 * Recommendation cards, feedback buttons, and display layouts.
 * Uses CSS custom properties for easy theme customization.
 *
 * @package Smart_Local_AI
 * @subpackage PersonaFlow
 */

/* ── Container ── */
.atlas-ai-pf-container {
	margin: 2em 0;
	background: var(--atlas-ai-pf-bg, transparent);
	color: var(--atlas-ai-pf-text, inherit);
}

.atlas-ai-pf-container h3 {
	font-size: 1.25em;
	font-weight: 600;
	margin: 0 0 1em;
	color: var(--atlas-ai-pf-heading, #1a1a1a);
}

/* ── Cards Layout (Default) ── */
.atlas-ai-pf-cards {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 280px, 1fr ) );
	gap: 1.25em;
}

.atlas-ai-pf-card {
	background: var(--atlas-ai-pf-card-bg, #fff);
	border: 1px solid var(--atlas-ai-pf-border, #e5e7eb);
	border-radius: var(--atlas-ai-pf-border-radius, 8px);
	overflow: hidden;
	transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.atlas-ai-pf-card:hover {
	box-shadow: 0 4px 12px rgba( 0, 0, 0, 0.08 );
	transform: translateY( -2px );
}

.atlas-ai-pf-card a {
	text-decoration: none;
	color: var(--atlas-ai-pf-text, inherit);
	display: block;
}

/* ── Card Thumbnail ── */
.atlas-ai-pf-card-thumb {
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	display: block;
}

.atlas-ai-pf-card-thumb-placeholder {
	width: 100%;
	aspect-ratio: 16 / 9;
	background: linear-gradient( 135deg, #667eea 0%, #764ba2 100% );
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 2em;
	color: #fff;
}

/* ── Card Body ── */
.atlas-ai-pf-card-body {
	padding: 1em;
}

.atlas-ai-pf-card-title {
	font-size: 1em;
	font-weight: 600;
	line-height: 1.4;
	margin: 0 0 0.5em;
	color: var(--atlas-ai-pf-heading, #111827);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.atlas-ai-pf-card a:hover .atlas-ai-pf-card-title {
	color: var(--atlas-ai-pf-accent, #4f46e5);
}

.atlas-ai-pf-card-excerpt {
	font-size: 0.875em;
	line-height: 1.5;
	color: var(--atlas-ai-pf-excerpt-color, #6b7280);
	margin: 0;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* ── Feedback Buttons ── */
.atlas-ai-pf-card-feedback {
	display: flex;
	gap: 0.25em;
	padding: 0.5em 1em 1em;
	border-top: 1px solid var(--atlas-ai-pf-border, #f3f4f6);
}

.atlas-ai-pf-feedback-btn {
	background: none;
	border: 1px solid var(--atlas-ai-pf-border, #e5e7eb);
	border-radius: 6px;
	padding: 0.35em 0.6em;
	cursor: pointer;
	font-size: 0.875em;
	line-height: 1;
	transition: all 0.15s ease;
	color: #9ca3af;
}

.atlas-ai-pf-feedback-btn:hover {
	background: #f3f4f6;
	border-color: #d1d5db;
	color: #374151;
}

.atlas-ai-pf-feedback-btn.active {
	background: #eef2ff;
	border-color: #818cf8;
	color: #4f46e5;
}

.atlas-ai-pf-feedback-btn[data-action="dislike"]:hover {
	background: #fef2f2;
	border-color: #fca5a5;
	color: #dc2626;
}

.atlas-ai-pf-feedback-btn[data-action="dislike"].active {
	background: #fef2f2;
	border-color: #f87171;
	color: #dc2626;
}

.atlas-ai-pf-feedback-btn[data-action="bookmark"]:hover {
	background: #fffbeb;
	border-color: #fcd34d;
	color: #d97706;
}

.atlas-ai-pf-feedback-btn[data-action="bookmark"].active {
	background: #fffbeb;
	border-color: #fbbf24;
	color: #d97706;
}

/* ── List Layout ── */
.atlas-ai-pf-list {
	display: flex;
	flex-direction: column;
	gap: 0.75em;
}

.atlas-ai-pf-list .atlas-ai-pf-card {
	display: flex;
	flex-direction: row;
	align-items: stretch;
}

.atlas-ai-pf-list .atlas-ai-pf-card a {
	display: flex;
	flex-direction: row;
	flex: 1;
}

.atlas-ai-pf-list .atlas-ai-pf-card-thumb,
.atlas-ai-pf-list .atlas-ai-pf-card-thumb-placeholder {
	width: 120px;
	min-width: 120px;
	aspect-ratio: auto;
	height: auto;
}

.atlas-ai-pf-list .atlas-ai-pf-card-body {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 0.75em 1em;
}

.atlas-ai-pf-list .atlas-ai-pf-card-feedback {
	flex-direction: column;
	border-top: none;
	border-left: 1px solid var(--atlas-ai-pf-border, #f3f4f6);
	padding: 0.5em;
	justify-content: center;
}

/* ── Grid Layout ── */
.atlas-ai-pf-grid {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 200px, 1fr ) );
	gap: 1em;
}

.atlas-ai-pf-grid .atlas-ai-pf-card-thumb {
	aspect-ratio: 1;
}

.atlas-ai-pf-grid .atlas-ai-pf-card-thumb-placeholder {
	aspect-ratio: 1;
}

.atlas-ai-pf-grid .atlas-ai-pf-card-body {
	padding: 0.75em;
}

.atlas-ai-pf-grid .atlas-ai-pf-card-title {
	font-size: 0.875em;
	-webkit-line-clamp: 2;
}

.atlas-ai-pf-grid .atlas-ai-pf-card-excerpt {
	display: none;
}

.atlas-ai-pf-grid .atlas-ai-pf-card-feedback {
	padding: 0.35em 0.75em 0.75em;
}

/* ── Loading State ── */
.atlas-ai-pf-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 200px;
	color: #9ca3af;
	font-size: 0.875em;
}

.atlas-ai-pf-loading::before {
	content: '';
	width: 1.25em;
	height: 1.25em;
	border: 2px solid var(--atlas-ai-pf-border, #e5e7eb);
	border-top-color: var(--atlas-ai-pf-accent, #6366f1);
	border-radius: 50%;
	animation: atlas-ai-pf-spin 0.6s linear infinite;
	margin-right: 0.5em;
}

@keyframes atlas-ai-pf-spin {
	to {
		transform: rotate( 360deg );
	}
}

/* ── Empty State ── */
.atlas-ai-pf-empty {
	text-align: center;
	padding: 2em;
	color: #9ca3af;
	font-size: 0.875em;
}

/* ── Responsive ── */
@media ( max-width: 640px ) {
	.atlas-ai-pf-cards {
		grid-template-columns: 1fr;
	}

	.atlas-ai-pf-grid {
		grid-template-columns: repeat( 2, 1fr );
	}

	.atlas-ai-pf-list .atlas-ai-pf-card-thumb,
	.atlas-ai-pf-list .atlas-ai-pf-card-thumb-placeholder {
		width: 80px;
		min-width: 80px;
	}
}

@media ( max-width: 400px ) {
	.atlas-ai-pf-grid {
		grid-template-columns: 1fr;
	}
}
