/**
 * AI Book Creator - Book Types & Story Elements Styles
 * Clean, minimal design matching the existing wizard UI
 */

/* ========================================
	Book Type Dropdown (like language/chapters)
	======================================== */
.aibc-book-type-group {
	margin-bottom: 1rem;
}

.aibc-book-type-group label {
	display: block;
	margin-bottom: 0.5rem;
	font-weight: 500;
	color: #374151;
}

.aibc-book-type-select {
	width: 100%;
	padding: 0.75rem 1rem;
	font-size: 1rem;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	background-color: #fff;
	color: #374151;
	cursor: pointer;
	transition: border-color 0.2s, box-shadow 0.2s;
	appearance: none;
	background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
	background-position: right 0.75rem center;
	background-repeat: no-repeat;
	background-size: 1.5em 1.5em;
	padding-right: 2.5rem;
}

.aibc-book-type-select:hover {
	border-color: #9ca3af;
}

.aibc-book-type-select:focus {
	outline: none;
	border-color: #6366f1;
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ========================================
	Story Elements Step (Step 1.5)
	======================================== */
.aibc-story-elements-step {
	max-width: 800px;
	margin: 0 auto;
	padding: 2rem;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Step Header */
.aibc-story-elements-step .aibc-step-header {
	text-align: center;
	margin-bottom: 2rem;
	padding-bottom: 1.5rem;
	border-bottom: 1px solid #e5e7eb;
}

.aibc-story-elements-step .aibc-step-title {
	font-size: 1.75rem;
	font-weight: 700;
	color: #1f2937;
	margin: 0 0 0.5rem 0;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
}

.aibc-story-elements-step .aibc-step-icon {
	font-size: 1.5rem;
}

.aibc-story-elements-step .aibc-step-subtitle {
	font-size: 1rem;
	color: #6b7280;
	margin: 0;
}

/* Summary Section */
.aibc-elements-summary {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 1rem;
	padding: 1rem;
	background: #f9fafb;
	border-radius: 12px;
	margin-bottom: 1.5rem;
}

.aibc-summary-item {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.aibc-summary-label {
	font-size: 0.75rem;
	color: #6b7280;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.aibc-summary-value {
	font-size: 0.95rem;
	font-weight: 600;
	color: #1f2937;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Generate Button Wrapper */
.aibc-generate-elements-wrapper {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75rem;
	margin-bottom: 2rem;
	padding: 1.5rem;
	background: linear-gradient(135deg, #f0f5ff 0%, #e0e7ff 100%);
	border-radius: 12px;
	border: 1px dashed #6366f1;
}

.aibc-btn-generate-elements {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.875rem 2rem;
	font-size: 1rem;
	font-weight: 600;
	color: #fff;
	background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
	border: none;
	border-radius: 10px;
	cursor: pointer;
	transition: all 0.2s;
	box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.35);
}

.aibc-btn-generate-elements:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 20px 0 rgba(99, 102, 241, 0.45);
}

.aibc-btn-generate-elements:active {
	transform: translateY(0);
}

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

.aibc-btn-generate-elements .aibc-btn-icon {
	font-size: 1.1rem;
}

.aibc-generate-hint {
	font-size: 0.85rem;
	color: #6b7280;
	text-align: center;
}

/* Story Elements Form */
.aibc-story-elements-form {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 1.25rem;
	margin-bottom: 2rem;
}

/* Element Field */
.aibc-element-field {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	padding: 1rem;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.aibc-element-field:hover {
	border-color: #d1d5db;
}

.aibc-element-field:focus-within {
	border-color: #6366f1;
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.aibc-element-field label {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.9rem;
	font-weight: 600;
	color: #374151;
	margin-bottom: 0.5rem;
}

.aibc-element-icon {
	font-size: 1rem;
}

.aibc-element-field input,
.aibc-element-field textarea,
.aibc-element-field select {
	width: 100%;
	padding: 0.625rem 0.75rem;
	font-size: 0.9rem;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	background: #f9fafb;
	color: #374151;
	transition: border-color 0.2s, background-color 0.2s;
	box-sizing: border-box;
}

.aibc-element-field input:focus,
.aibc-element-field textarea:focus,
.aibc-element-field select:focus {
	outline: none;
	border-color: #6366f1;
	background: #fff;
}

.aibc-element-field textarea {
	min-height: 80px;
	resize: vertical;
}

.aibc-element-description {
	font-size: 0.75rem;
	color: #9ca3af;
	margin-top: 0.5rem;
	line-height: 1.4;
}

/* Step Navigation */
.aibc-step-navigation {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	padding-top: 1.5rem;
	border-top: 1px solid #e5e7eb;
}

.aibc-step-navigation .aibc-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.75rem 1.5rem;
	font-size: 0.95rem;
	font-weight: 500;
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.2s;
	border: none;
}

.aibc-step-navigation .aibc-btn-secondary {
	background: #f3f4f6;
	color: #374151;
}

.aibc-step-navigation .aibc-btn-secondary:hover {
	background: #e5e7eb;
}

.aibc-step-navigation .aibc-btn-primary {
	background: #fff;
	color: #6366f1;
	border: 1px solid #6366f1;
}

.aibc-step-navigation .aibc-btn-primary:hover {
	background: #f0f5ff;
}

.aibc-step-navigation .aibc-btn-success {
	background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
	color: #fff;
}

.aibc-step-navigation .aibc-btn-success:hover {
	box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

/* Loading State */
.aibc-story-elements-step.is-loading .aibc-btn-generate-elements {
	pointer-events: none;
}

.aibc-story-elements-step.is-loading .aibc-btn-generate-elements::after {
	content: '';
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: aibc-spin 0.8s linear infinite;
	margin-left: 0.5rem;
}

/* Field Loading State */
.aibc-element-field.is-loading input,
.aibc-element-field.is-loading textarea,
.aibc-element-field.is-loading select,
.aibc-element-field input.is-loading,
.aibc-element-field textarea.is-loading,
.aibc-element-field select.is-loading {
	opacity: 0.6;
	background: #f3f4f6;
}

.aibc-field-loading {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-top: 0.5rem;
	font-size: 0.8rem;
	color: #6366f1;
}

.aibc-loading-spinner {
	width: 14px;
	height: 14px;
	border: 2px solid #e0e7ff;
	border-top-color: #6366f1;
	border-radius: 50%;
	animation: aibc-spin 0.8s linear infinite;
}

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

/* Notification */
.aibc-elements-notification {
	padding: 0.875rem 1rem;
	border-radius: 8px;
	font-size: 0.9rem;
	margin-bottom: 1rem;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.aibc-elements-notification.success {
	background: #d1fae5;
	color: #065f46;
	border: 1px solid #a7f3d0;
}

.aibc-elements-notification.error {
	background: #fee2e2;
	color: #991b1b;
	border: 1px solid #fecaca;
}

.aibc-elements-notification.info {
	background: #dbeafe;
	color: #1e40af;
	border: 1px solid #bfdbfe;
}

/* ========================================
	Responsive Design
	======================================== */
@media (max-width: 768px) {
	.aibc-story-elements-step {
		padding: 1.25rem;
		margin: 0 1rem;
	}

	.aibc-story-elements-step .aibc-step-title {
		font-size: 1.35rem;
	}

	.aibc-elements-summary {
		grid-template-columns: repeat(2, 1fr);
	}

	.aibc-story-elements-form {
		grid-template-columns: 1fr;
	}

	.aibc-step-navigation {
		flex-wrap: wrap;
	}

	.aibc-step-navigation .aibc-btn {
		flex: 1;
		justify-content: center;
		min-width: calc(50% - 0.5rem);
	}

	.aibc-step-navigation .aibc-btn-success {
		order: -1;
		min-width: 100%;
		margin-bottom: 0.5rem;
	}
}

@media (max-width: 480px) {
	.aibc-elements-summary {
		grid-template-columns: 1fr;
	}

	.aibc-generate-elements-wrapper {
		padding: 1rem;
	}

	.aibc-btn-generate-elements {
		width: 100%;
		justify-content: center;
	}
}

/* ========================================
	RTL Support
	======================================== */
[dir="rtl"] .aibc-book-type-select {
	background-position: left 0.75rem center;
	padding-left: 2.5rem;
	padding-right: 1rem;
}

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

[dir="rtl"] .aibc-btn-icon {
	transform: scaleX(-1);
}

/* ========================================
	Dark Mode Support (if enabled)
	======================================== */
@media (prefers-color-scheme: dark) {
	.aibc-design-clarity.dark-mode .aibc-story-elements-step {
		background: #1f2937;
		box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
	}

	.aibc-design-clarity.dark-mode .aibc-story-elements-step .aibc-step-title {
		color: #f9fafb;
	}

	.aibc-design-clarity.dark-mode .aibc-elements-summary {
		background: #374151;
	}

	.aibc-design-clarity.dark-mode .aibc-summary-label {
		color: #9ca3af;
	}

	.aibc-design-clarity.dark-mode .aibc-summary-value {
		color: #f9fafb;
	}

	.aibc-design-clarity.dark-mode .aibc-element-field {
		background: #374151;
		border-color: #4b5563;
	}

	.aibc-design-clarity.dark-mode .aibc-element-field label {
		color: #f9fafb;
	}

	.aibc-design-clarity.dark-mode .aibc-element-field input,
	.aibc-design-clarity.dark-mode .aibc-element-field textarea,
	.aibc-design-clarity.dark-mode .aibc-element-field select {
		background: #1f2937;
		border-color: #4b5563;
		color: #f9fafb;
	}
}
