/**
 * AI Assistant Styles
 *
 * Floating button, dropdown menu, and UI components for AI Assistant.
 *
 * @package Starter_Flavor
 * @since 1.0.0
 */

/* Floating Button */
#sf-ai-assistant-button {
	position: fixed;
	bottom: 30px;
	right: 30px;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
	color: white;
	border: none;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 28px;
	transition: all 0.3s ease;
	z-index: 9999;
	font-family: inherit;
	padding: 0;
}

#sf-ai-assistant-button:hover {
	transform: scale(1.1);
	box-shadow: 0 8px 20px rgba(124, 58, 237, 0.6);
}

#sf-ai-assistant-button:active {
	transform: scale(0.95);
}

/* Dropdown Menu */
#sf-ai-assistant-menu {
	position: fixed;
	bottom: 100px;
	right: 30px;
	width: 400px;
	max-height: 600px;
	background: white;
	border-radius: 12px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
	z-index: 9998;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	animation: slideUp 0.3s ease;
	border: 1px solid #e5e7eb;
}

#sf-ai-assistant-menu.hidden {
	display: none !important;
}

@keyframes slideUp {
	from {
		opacity: 0;
		transform: translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Menu Header */
.ai-menu-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 16px;
	border-bottom: 1px solid #e5e7eb;
	background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.ai-menu-header h3 {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: #1e293b;
}

.ai-close-btn {
	background: none;
	border: none;
	font-size: 24px;
	cursor: pointer;
	color: #64748b;
	padding: 0;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 6px;
	transition: all 0.2s ease;
}

.ai-close-btn:hover {
	background: #e2e8f0;
	color: #1e293b;
}

/* Menu Content */
.ai-menu-content {
	flex: 1;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
}

/* Tabs */
.ai-tabs {
	display: flex;
	gap: 0;
	padding: 0;
	border-bottom: 1px solid #e5e7eb;
	background: #f8fafc;
	flex-wrap: wrap;
}

.ai-tab-btn {
	flex: 1;
	min-width: 70px;
	padding: 12px;
	background: none;
	border: none;
	color: #64748b;
	font-size: 12px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s ease;
	border-bottom: 3px solid transparent;
	white-space: nowrap;
}

.ai-tab-btn:hover {
	background: white;
	color: #7c3aed;
}

.ai-tab-btn.active {
	color: #7c3aed;
	background: white;
	border-bottom-color: #7c3aed;
}

/* Tab Content */
.ai-tab-content {
	display: none;
	padding: 16px;
	gap: 12px;
	flex-direction: column;
}

.ai-tab-content.active {
	display: flex;
}

.ai-tab-content.hidden {
	display: none !important;
}

/* Inputs */
.ai-input {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	font-family: inherit;
	font-size: 14px;
	resize: vertical;
	transition: all 0.2s ease;
	box-sizing: border-box;
}

.ai-input:focus {
	outline: none;
	border-color: #7c3aed;
	box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.ai-select {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	font-family: inherit;
	font-size: 14px;
	background: white;
	cursor: pointer;
	transition: all 0.2s ease;
}

.ai-select:focus {
	outline: none;
	border-color: #7c3aed;
	box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

/* Options */
.ai-options {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

.ai-option {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.ai-option label {
	font-size: 12px;
	font-weight: 500;
	color: #475569;
}

/* Action Buttons */
.ai-action-btn {
	padding: 10px 16px;
	background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
	color: white;
	border: none;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
	width: 100%;
	font-family: inherit;
}

.ai-action-btn:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.ai-action-btn:active {
	transform: translateY(0);
}

/* Result Container */
.ai-result-container {
	padding: 16px;
	border-top: 1px solid #e5e7eb;
	background: #f8fafc;
	display: flex;
	flex-direction: column;
	gap: 12px;
	max-height: 300px;
	overflow-y: auto;
}

.ai-result-container.hidden {
	display: none !important;
}

.ai-result-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.ai-result-header h4 {
	margin: 0;
	font-size: 14px;
	font-weight: 600;
	color: #1e293b;
}

.ai-result-close {
	background: none;
	border: none;
	font-size: 20px;
	cursor: pointer;
	color: #64748b;
	padding: 0;
	width: 28px;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 4px;
	transition: all 0.2s ease;
}

.ai-result-close:hover {
	background: #e2e8f0;
	color: #1e293b;
}

.ai-result-content {
	padding: 12px;
	background: white;
	border-radius: 8px;
	border: 1px solid #e5e7eb;
	font-size: 14px;
	line-height: 1.6;
	color: #334155;
	max-height: 200px;
	overflow-y: auto;
	white-space: pre-wrap;
	word-break: break-word;
}

/* Result Actions */
.ai-result-actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}

.ai-copy-btn,
.ai-insert-btn {
	padding: 8px 12px;
	background: white;
	color: #7c3aed;
	border: 1px solid #7c3aed;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s ease;
	font-family: inherit;
}

.ai-copy-btn:hover,
.ai-insert-btn:hover {
	background: #7c3aed;
	color: white;
}

.ai-insert-btn {
	background: #7c3aed;
	color: white;
	border-color: #7c3aed;
}

.ai-insert-btn:hover {
	background: white;
	color: #7c3aed;
}

/* Loading State */
.ai-loading {
	padding: 16px;
	text-align: center;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	justify-content: center;
	min-height: 120px;
}

.ai-loading.hidden {
	display: none !important;
}

.ai-shimmer {
	width: 100%;
	height: 20px;
	background: linear-gradient(
		90deg,
		#e5e7eb 0%,
		#f3f4f6 50%,
		#e5e7eb 100%
	);
	background-size: 200% 100%;
	border-radius: 4px;
	animation: shimmer 2s infinite;
}

@keyframes shimmer {
	0% {
		background-position: 200% 0;
	}
	100% {
		background-position: -200% 0;
	}
}

.ai-loading p {
	margin: 0;
	font-size: 14px;
	color: #64748b;
	font-weight: 500;
}

/* History */
.ai-history {
	padding: 12px 16px;
	border-top: 1px solid #e5e7eb;
	background: #f8fafc;
}

.ai-history-toggle {
	width: 100%;
	padding: 10px;
	background: white;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 500;
	color: #1e293b;
	cursor: pointer;
	transition: all 0.2s ease;
	font-family: inherit;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.ai-history-toggle:hover {
	border-color: #7c3aed;
	color: #7c3aed;
}

.ai-history-count {
	font-size: 12px;
	color: #94a3b8;
}

.ai-history-list {
	margin: 12px 0 0 0;
	padding: 0;
	list-style: none;
	max-height: 200px;
	overflow-y: auto;
}

.ai-history-list.hidden {
	display: none !important;
}

.ai-history-item {
	padding: 10px;
	background: white;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	margin-bottom: 8px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
	font-size: 12px;
}

.ai-history-type {
	background: #f0f4ff;
	color: #7c3aed;
	padding: 2px 8px;
	border-radius: 4px;
	font-weight: 600;
	white-space: nowrap;
	font-size: 11px;
}

.ai-history-input {
	flex: 1;
	color: #64748b;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	min-width: 0;
}

.ai-history-restore {
	padding: 4px 8px;
	background: #e0f2fe;
	color: #0369a1;
	border: none;
	border-radius: 4px;
	font-size: 11px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s ease;
	white-space: nowrap;
}

.ai-history-restore:hover {
	background: #0369a1;
	color: white;
}

/* Responsive */
@media (max-width: 768px) {
	#sf-ai-assistant-button {
		bottom: 20px;
		right: 20px;
		width: 50px;
		height: 50px;
		font-size: 24px;
	}

	#sf-ai-assistant-menu {
		width: calc(100% - 40px);
		max-width: 100%;
		right: 20px;
		left: auto;
		bottom: 80px;
		max-height: 70vh;
	}

	.ai-tabs {
		flex-wrap: wrap;
	}

	.ai-tab-btn {
		flex: 0 1 auto;
		min-width: 60px;
		padding: 10px 8px;
		font-size: 11px;
	}

	.ai-options {
		grid-template-columns: 1fr;
	}

	.ai-result-actions {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 480px) {
	#sf-ai-assistant-menu {
		width: calc(100% - 20px);
		right: 10px;
		left: 10px;
		bottom: 70px;
	}

	.ai-tab-btn {
		min-width: 50px;
		padding: 8px 6px;
		font-size: 10px;
	}

	.ai-menu-header {
		padding: 12px;
	}

	.ai-menu-header h3 {
		font-size: 14px;
	}

	.ai-tab-content {
		padding: 12px;
	}
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
	#sf-ai-assistant-menu {
		background: #1e293b;
		border-color: #475569;
	}

	.ai-menu-header {
		background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
		border-bottom-color: #475569;
	}

	.ai-menu-header h3 {
		color: #f1f5f9;
	}

	.ai-tabs {
		background: #0f172a;
		border-bottom-color: #475569;
	}

	.ai-tab-btn {
		color: #94a3b8;
	}

	.ai-tab-btn:hover {
		background: #1e293b;
	}

	.ai-tab-btn.active {
		background: #1e293b;
	}

	.ai-input,
	.ai-select {
		background: #0f172a;
		border-color: #475569;
		color: #f1f5f9;
	}

	.ai-input:focus,
	.ai-select:focus {
		border-color: #a855f7;
	}

	.ai-option label {
		color: #cbd5e1;
	}

	.ai-result-container {
		background: #0f172a;
		border-top-color: #475569;
	}

	.ai-result-header h4 {
		color: #f1f5f9;
	}

	.ai-result-content {
		background: #1e293b;
		border-color: #475569;
		color: #cbd5e1;
	}

	.ai-history {
		background: #0f172a;
		border-top-color: #475569;
	}

	.ai-history-toggle {
		background: #1e293b;
		border-color: #475569;
		color: #f1f5f9;
	}

	.ai-history-item {
		background: #1e293b;
		border-color: #475569;
		color: #cbd5e1;
	}

	.ai-history-type {
		background: rgba(168, 85, 247, 0.1);
		color: #d8b4fe;
	}

	.ai-history-input {
		color: #94a3b8;
	}

	.ai-copy-btn,
	.ai-insert-btn {
		background: #1e293b;
		color: #a855f7;
		border-color: #a855f7;
	}

	.ai-copy-btn:hover,
	.ai-insert-btn:hover {
		background: #a855f7;
		color: #1e293b;
	}

	.ai-insert-btn:hover {
		background: #1e293b;
		color: #a855f7;
	}

	.ai-close-btn {
		color: #94a3b8;
	}

	.ai-close-btn:hover {
		background: #334155;
		color: #f1f5f9;
	}

	.ai-loading p {
		color: #94a3b8;
	}
}

/* Scrollbar Styling */
#sf-ai-assistant-menu::-webkit-scrollbar,
.ai-menu-content::-webkit-scrollbar,
.ai-result-content::-webkit-scrollbar,
.ai-history-list::-webkit-scrollbar {
	width: 6px;
}

#sf-ai-assistant-menu::-webkit-scrollbar-track,
.ai-menu-content::-webkit-scrollbar-track,
.ai-result-content::-webkit-scrollbar-track,
.ai-history-list::-webkit-scrollbar-track {
	background: transparent;
}

#sf-ai-assistant-menu::-webkit-scrollbar-thumb,
.ai-menu-content::-webkit-scrollbar-thumb,
.ai-result-content::-webkit-scrollbar-thumb,
.ai-history-list::-webkit-scrollbar-thumb {
	background: #cbd5e1;
	border-radius: 3px;
}

#sf-ai-assistant-menu::-webkit-scrollbar-thumb:hover,
.ai-menu-content::-webkit-scrollbar-thumb:hover,
.ai-result-content::-webkit-scrollbar-thumb:hover,
.ai-history-list::-webkit-scrollbar-thumb:hover {
	background: #94a3b8;
}

@media (prefers-color-scheme: dark) {
	#sf-ai-assistant-menu::-webkit-scrollbar-thumb,
	.ai-menu-content::-webkit-scrollbar-thumb,
	.ai-result-content::-webkit-scrollbar-thumb,
	.ai-history-list::-webkit-scrollbar-thumb {
		background: #475569;
	}

	#sf-ai-assistant-menu::-webkit-scrollbar-thumb:hover,
	.ai-menu-content::-webkit-scrollbar-thumb:hover,
	.ai-result-content::-webkit-scrollbar-thumb:hover,
	.ai-history-list::-webkit-scrollbar-thumb:hover {
		background: #64748b;
	}
}

/* Print Styles */
@media print {
	#sf-ai-assistant-button,
	#sf-ai-assistant-menu {
		display: none !important;
	}
}
