/**
 * BGE AI Assistant - Template Selector Styles
 *
 * Styles for the prompt templates UI component.
 *
 * @package NELSONS_Membership
 * @subpackage AI_Assistant
 * @since 2.0.0
 */

/* ==========================================================================
   Template Selector Container
   ========================================================================== */

.nd-ai-templates {
	background: var(--nd-ai-bg-secondary, #f8f9fa);
	border-top: 1px solid var(--nd-ai-border-light, #e9ecef);
	padding: 12px 16px;
	flex-shrink: 0;
}

/* ==========================================================================
   Header
   ========================================================================== */

.nd-ai-templates-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 10px;
}

.nd-ai-templates-title {
	font-size: 12px;
	font-weight: 600;
	color: var(--nd-ai-text-light, #6c757d);
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.nd-ai-templates-toggle {
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 4px;
	color: var(--nd-ai-text-light, #6c757d);
	transition: color 0.2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
}

.nd-ai-templates-toggle:hover {
	color: var(--nd-ai-primary, #0073aa);
}

.nd-ai-templates-toggle .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

/* ==========================================================================
   Category Tabs
   ========================================================================== */

.nd-ai-template-tabs {
	display: flex;
	gap: 4px;
	margin-bottom: 12px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	-ms-overflow-style: none;
	padding-bottom: 2px;
}

.nd-ai-template-tabs::-webkit-scrollbar {
	display: none;
}

.nd-ai-template-tab {
	background: var(--nd-ai-bg, #fff);
	border: 1px solid var(--nd-ai-border, #dee2e6);
	border-radius: 16px;
	padding: 6px 14px;
	font-size: 13px;
	font-weight: 500;
	color: var(--nd-ai-text, #495057);
	cursor: pointer;
	transition: all 0.2s ease;
	white-space: nowrap;
	flex-shrink: 0;
}

.nd-ai-template-tab:hover {
	border-color: var(--nd-ai-primary, #0073aa);
	color: var(--nd-ai-primary, #0073aa);
}

.nd-ai-template-tab.active {
	background: var(--nd-ai-primary, #0073aa);
	border-color: var(--nd-ai-primary, #0073aa);
	color: #fff;
}

/* ==========================================================================
   Template Items
   ========================================================================== */

.nd-ai-template-content {
	max-height: 180px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.nd-ai-template-list {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.nd-ai-template-item {
	display: flex;
	align-items: center;
	gap: 10px;
	background: var(--nd-ai-bg, #fff);
	border: 1px solid var(--nd-ai-border, #dee2e6);
	border-radius: 8px;
	padding: 10px 14px;
	font-size: 14px;
	color: var(--nd-ai-text, #495057);
	cursor: pointer;
	transition: all 0.2s ease;
	text-align: left;
	width: 100%;
}

.nd-ai-template-item:hover {
	border-color: var(--nd-ai-primary, #0073aa);
	background: rgba(0, 115, 170, 0.05);
	transform: translateX(4px);
}

.nd-ai-template-item:active {
	transform: translateX(2px);
}

.nd-ai-template-item .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
	color: var(--nd-ai-primary, #0073aa);
	flex-shrink: 0;
}

.nd-ai-template-label {
	flex: 1;
	line-height: 1.4;
}

.nd-ai-no-templates {
	text-align: center;
	color: var(--nd-ai-text-light, #6c757d);
	font-size: 13px;
	padding: 20px 0;
	margin: 0;
}

/* ==========================================================================
   Compact Mode (for smaller widgets)
   ========================================================================== */

.nd-ai-widget--compact .nd-ai-templates {
	padding: 8px 12px;
}

.nd-ai-widget--compact .nd-ai-template-tabs {
	margin-bottom: 8px;
}

.nd-ai-widget--compact .nd-ai-template-tab {
	padding: 4px 10px;
	font-size: 12px;
}

.nd-ai-widget--compact .nd-ai-template-item {
	padding: 8px 10px;
	font-size: 13px;
}

.nd-ai-widget--compact .nd-ai-template-content {
	max-height: 120px;
}

/* ==========================================================================
   Grid Layout (Alternative)
   ========================================================================== */

.nd-ai-templates--grid .nd-ai-template-list {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 8px;
}

.nd-ai-templates--grid .nd-ai-template-item {
	flex-direction: column;
	text-align: center;
	padding: 12px;
}

.nd-ai-templates--grid .nd-ai-template-item .dashicons {
	font-size: 24px;
	width: 24px;
	height: 24px;
	margin-bottom: 6px;
}

/* ==========================================================================
   Dark Theme
   ========================================================================== */

.nd-ai-widget--dark .nd-ai-templates {
	background: var(--nd-ai-dark-bg-secondary, #1e1e1e);
	border-color: var(--nd-ai-dark-border, #333);
}

.nd-ai-widget--dark .nd-ai-templates-title {
	color: var(--nd-ai-dark-text-light, #888);
}

.nd-ai-widget--dark .nd-ai-templates-toggle {
	color: var(--nd-ai-dark-text-light, #888);
}

.nd-ai-widget--dark .nd-ai-template-tab {
	background: var(--nd-ai-dark-bg, #2d2d2d);
	border-color: var(--nd-ai-dark-border, #444);
	color: var(--nd-ai-dark-text, #e0e0e0);
}

.nd-ai-widget--dark .nd-ai-template-tab:hover {
	border-color: var(--nd-ai-primary, #0073aa);
	color: var(--nd-ai-primary, #0073aa);
}

.nd-ai-widget--dark .nd-ai-template-tab.active {
	background: var(--nd-ai-primary, #0073aa);
	border-color: var(--nd-ai-primary, #0073aa);
	color: #fff;
}

.nd-ai-widget--dark .nd-ai-template-item {
	background: var(--nd-ai-dark-bg, #2d2d2d);
	border-color: var(--nd-ai-dark-border, #444);
	color: var(--nd-ai-dark-text, #e0e0e0);
}

.nd-ai-widget--dark .nd-ai-template-item:hover {
	background: rgba(0, 115, 170, 0.15);
	border-color: var(--nd-ai-primary, #0073aa);
}

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

@media (max-width: 768px) {
	.nd-ai-templates {
		padding: 10px 12px;
	}

	.nd-ai-template-tabs {
		margin-bottom: 10px;
		padding-right: 8px; /* Extra space for scrolling */
	}

	.nd-ai-template-tab {
		padding: 8px 12px;
		font-size: 12px;
		min-height: 32px; /* Touch-friendly */
	}

	.nd-ai-template-item {
		padding: 12px;
		min-height: 44px; /* Touch-friendly */
	}

	.nd-ai-template-content {
		max-height: 160px;
	}
}

/* ==========================================================================
   Animation
   ========================================================================== */

.nd-ai-templates {
	animation: nd-ai-templates-fadein 0.3s ease;
}

@keyframes nd-ai-templates-fadein {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.nd-ai-template-item {
	animation: nd-ai-template-item-fadein 0.2s ease;
	animation-fill-mode: both;
}

.nd-ai-template-item:nth-child(1) { animation-delay: 0.05s; }
.nd-ai-template-item:nth-child(2) { animation-delay: 0.1s; }
.nd-ai-template-item:nth-child(3) { animation-delay: 0.15s; }
.nd-ai-template-item:nth-child(4) { animation-delay: 0.2s; }
.nd-ai-template-item:nth-child(5) { animation-delay: 0.25s; }

@keyframes nd-ai-template-item-fadein {
	from {
		opacity: 0;
		transform: translateX(-10px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

/* ==========================================================================
   Scrollbar Styling (for template content)
   ========================================================================== */

.nd-ai-template-content::-webkit-scrollbar {
	width: 6px;
}

.nd-ai-template-content::-webkit-scrollbar-track {
	background: transparent;
}

.nd-ai-template-content::-webkit-scrollbar-thumb {
	background: var(--nd-ai-border, #dee2e6);
	border-radius: 3px;
}

.nd-ai-template-content::-webkit-scrollbar-thumb:hover {
	background: var(--nd-ai-text-light, #6c757d);
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.nd-ai-templates--loading {
	text-align: center;
	padding: 20px;
}

.nd-ai-templates--loading::after {
	content: '';
	display: inline-block;
	width: 20px;
	height: 20px;
	border: 2px solid var(--nd-ai-border, #dee2e6);
	border-top-color: var(--nd-ai-primary, #0073aa);
	border-radius: 50%;
	animation: nd-ai-spin 0.8s linear infinite;
}

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

/* ==========================================================================
   Empty State
   ========================================================================== */

.nd-ai-templates--empty {
	text-align: center;
	padding: 30px 20px;
	color: var(--nd-ai-text-light, #6c757d);
}

.nd-ai-templates--empty .dashicons {
	font-size: 40px;
	width: 40px;
	height: 40px;
	margin-bottom: 10px;
	opacity: 0.5;
}

.nd-ai-templates--empty p {
	margin: 0;
	font-size: 14px;
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.nd-ai-template-tab:focus,
.nd-ai-template-item:focus {
	outline: 2px solid var(--nd-ai-primary, #0073aa);
	outline-offset: 2px;
}

.nd-ai-template-tab:focus:not(:focus-visible),
.nd-ai-template-item:focus:not(:focus-visible) {
	outline: none;
}

/* High contrast mode */
@media (prefers-contrast: high) {
	.nd-ai-template-tab,
	.nd-ai-template-item {
		border-width: 2px;
	}
	
	.nd-ai-template-tab.active {
		background: #000;
		color: #fff;
	}
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.nd-ai-templates,
	.nd-ai-template-item {
		animation: none;
	}
	
	.nd-ai-template-item:hover {
		transform: none;
	}
}