/**
 * AI Buttons Styles
 * Styles for AI enhancement buttons in chapter editor
 */

/* Container for AI buttons */
.aibc-ai-buttons-container {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 10px 0;
	padding: 12px;
	background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
	border-radius: 8px;
	border: 1px solid #dee2e6;
}

.aibc-ai-buttons-container.aibc-processing {
	opacity: 0.7;
	pointer-events: none;
}

/* Individual AI button */
.aibc-ai-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.4;
	color: #fff;
	background-color: var(--aibc-btn-color, #0073aa);
	border: none;
	border-radius: 6px;
	cursor: pointer;
	transition: all 0.2s ease;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
	position: relative;
	overflow: hidden;
}

.aibc-ai-btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
	filter: brightness(1.1);
}

.aibc-ai-btn:active {
	transform: translateY(0);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.aibc-ai-btn:focus {
	outline: 2px solid var(--aibc-btn-color, #0073aa);
	outline-offset: 2px;
}

.aibc-ai-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	transform: none;
}

.aibc-ai-btn .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

/* Processing state */
.aibc-ai-btn.aibc-processing {
	pointer-events: none;
}

.aibc-ai-btn.aibc-processing::after {
	content: '';
	position: absolute;
	top: 0;
	left: -100%;
	width: 100%;
	height: 100%;
	background: linear-gradient(
		90deg,
		transparent,
		rgba(255, 255, 255, 0.3),
		transparent
	);
	animation: aibc-shimmer 1.5s infinite;
}

@keyframes aibc-shimmer {
	0% {
		left: -100%;
	}
	100% {
		left: 100%;
	}
}

/* Spinner inside button */
.aibc-ai-btn .aibc-btn-spinner {
	display: none;
	width: 14px;
	height: 14px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: aibc-spin 0.8s linear infinite;
}

.aibc-ai-btn.aibc-processing .aibc-btn-spinner {
	display: inline-block;
}

.aibc-ai-btn.aibc-processing .aibc-btn-icon {
	display: none;
}

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

/* Label styling */
.aibc-ai-buttons-label {
	width: 100%;
	font-size: 12px;
	font-weight: 600;
	color: #495057;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-bottom: 4px;
	display: flex;
	align-items: center;
	gap: 6px;
}

.aibc-ai-buttons-label .dashicons {
	font-size: 14px;
	width: 14px;
	height: 14px;
	color: #6c757d;
}

/* Status message */
.aibc-ai-status {
	width: 100%;
	padding: 8px 12px;
	margin-top: 8px;
	border-radius: 4px;
	font-size: 13px;
	display: none;
}

.aibc-ai-status.aibc-status-visible {
	display: block;
}

.aibc-ai-status.aibc-status-processing {
	background-color: #e3f2fd;
	color: #1565c0;
	border: 1px solid #90caf9;
}

.aibc-ai-status.aibc-status-success {
	background-color: #e8f5e9;
	color: #2e7d32;
	border: 1px solid #a5d6a7;
}

.aibc-ai-status.aibc-status-error {
	background-color: #ffebee;
	color: #c62828;
	border: 1px solid #ef9a9a;
}

/* Undo button */
.aibc-undo-btn {
	display: none;
	align-items: center;
	gap: 4px;
	padding: 6px 12px;
	font-size: 12px;
	color: #6c757d;
	background-color: #fff;
	border: 1px solid #dee2e6;
	border-radius: 4px;
	cursor: pointer;
	transition: all 0.2s ease;
}

.aibc-undo-btn:hover {
	background-color: #f8f9fa;
	border-color: #adb5bd;
}

.aibc-undo-btn.aibc-undo-visible {
	display: inline-flex;
}

/* RTL Support */
[dir="rtl"] .aibc-ai-buttons-container {
	flex-direction: row-reverse;
}

[dir="rtl"] .aibc-ai-btn {
	flex-direction: row-reverse;
}

/* Responsive */
@media (max-width: 768px) {
	.aibc-ai-buttons-container {
		padding: 10px;
	}

	.aibc-ai-btn {
		padding: 6px 10px;
		font-size: 12px;
	}

	.aibc-ai-btn .dashicons {
		font-size: 14px;
		width: 14px;
		height: 14px;
	}
}

/* Admin Styles */
.aibc-admin-buttons-list {
	margin-top: 20px;
}

.aibc-admin-button-card {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	margin-bottom: 12px;
	transition: box-shadow 0.2s;
}

.aibc-admin-button-card:hover {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.aibc-admin-button-card.aibc-button-disabled {
	opacity: 0.6;
	background: #f6f7f7;
}

.aibc-admin-button-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	border-bottom: 1px solid #f0f0f1;
	cursor: pointer;
}

.aibc-admin-button-header:hover {
	background: #f9f9f9;
}

.aibc-admin-button-title {
	display: flex;
	align-items: center;
	gap: 10px;
	font-weight: 500;
}

.aibc-admin-button-title .dashicons {
	color: #fff;
	padding: 4px;
	border-radius: 4px;
}

.aibc-admin-button-actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

.aibc-admin-button-toggle {
	position: relative;
	width: 40px;
	height: 22px;
}

.aibc-admin-button-toggle input {
	opacity: 0;
	width: 0;
	height: 0;
}

.aibc-admin-button-toggle .slider {
	position: absolute;
	cursor: pointer;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: #ccc;
	transition: 0.3s;
	border-radius: 22px;
}

.aibc-admin-button-toggle .slider:before {
	position: absolute;
	content: "";
	height: 16px;
	width: 16px;
	left: 3px;
	bottom: 3px;
	background-color: white;
	transition: 0.3s;
	border-radius: 50%;
}

.aibc-admin-button-toggle input:checked + .slider {
	background-color: #2271b1;
}

.aibc-admin-button-toggle input:checked + .slider:before {
	transform: translateX(18px);
}

.aibc-admin-button-body {
	display: none;
	padding: 16px;
	background: #f9f9f9;
}

.aibc-admin-button-card.aibc-expanded .aibc-admin-button-body {
	display: block;
}

.aibc-admin-button-field {
	margin-bottom: 16px;
}

.aibc-admin-button-field label {
	display: block;
	font-weight: 500;
	margin-bottom: 6px;
}

.aibc-admin-button-field input[type="text"],
.aibc-admin-button-field input[type="number"],
.aibc-admin-button-field select,
.aibc-admin-button-field textarea {
	width: 100%;
	max-width: 400px;
}

.aibc-admin-button-field textarea {
	min-height: 100px;
}

.aibc-admin-button-field .description {
	margin-top: 4px;
	color: #646970;
	font-style: italic;
}

.aibc-admin-button-row {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
}

.aibc-admin-button-row .aibc-admin-button-field {
	flex: 1;
	min-width: 150px;
}

.aibc-admin-button-footer {
	display: flex;
	justify-content: space-between;
	padding-top: 16px;
	border-top: 1px solid #dcdcde;
}

.aibc-add-button-section {
	background: #f0f6fc;
	border: 2px dashed #72aee6;
	border-radius: 8px;
	padding: 24px;
	text-align: center;
	margin-top: 20px;
}

.aibc-add-button-section h3 {
	margin: 0 0 12px 0;
}

.aibc-add-button-section p {
	margin: 0 0 16px 0;
	color: #646970;
}

.aibc-sample-buttons-notice {
	background: #fff3cd;
	border: 1px solid #ffc107;
	padding: 12px 16px;
	border-radius: 4px;
	margin-bottom: 20px;
}

/* Icon picker */
.aibc-icon-picker {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	max-width: 400px;
	padding: 10px;
	background: #fff;
	border: 1px solid #dcdcde;
	border-radius: 4px;
}

.aibc-icon-option {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: 2px solid transparent;
	border-radius: 4px;
	cursor: pointer;
	transition: all 0.2s;
}

.aibc-icon-option:hover {
	background: #f0f0f1;
}

.aibc-icon-option.selected {
	border-color: #2271b1;
	background: #f0f6fc;
}

.aibc-icon-option .dashicons {
	font-size: 20px;
	width: 20px;
	height: 20px;
}

/* Color picker enhancement */
.aibc-color-picker-wrapper {
	display: flex;
	align-items: center;
	gap: 10px;
}

.aibc-color-picker-wrapper input[type="color"] {
	width: 50px;
	height: 36px;
	padding: 2px;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	cursor: pointer;
}

.aibc-color-picker-wrapper input[type="text"] {
	width: 80px !important;
	font-family: monospace;
}

/* Drag handle */
.aibc-drag-handle {
	cursor: move;
	color: #c3c4c7;
	padding: 4px;
}

.aibc-drag-handle:hover {
	color: #2271b1;
}

/* Empty state */
.aibc-no-buttons-message {
	text-align: center;
	padding: 40px 20px;
	background: #f9f9f9;
	border: 1px solid #dcdcde;
	border-radius: 4px;
	color: #646970;
}

.aibc-no-buttons-message .dashicons {
	font-size: 48px;
	width: 48px;
	height: 48px;
	color: #dcdcde;
	margin-bottom: 16px;
}
