/**
 * Design 5: CLARITY
 *
 * Philosophy: Clean, professional, efficient - business-ready simplicity
 *
 * Key principles applied:
 * - Task-Oriented Design (Maximum efficiency)
 * - Intentional Minimalism (Nothing wasted)
 * - Strong Call to Action (Clear next step)
 * - Respects user time (Fast completion)
 * - Professional trust signals
 */

/* ========================================
	CLARITY DESIGN - CSS
	======================================== */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&display=swap');

:root {
	--clarity-bg: #FAFBFC;
	--clarity-card: #FFFFFF;
	--clarity-text: #111827;
	--clarity-text-secondary: #6B7280;
	--clarity-text-tertiary: #9CA3AF;
	--clarity-primary: #2563EB;
	--clarity-primary-hover: #1D4ED8;
	--clarity-success: #059669;
	--clarity-border: #E5E7EB;
	--clarity-border-focus: #93C5FD;
	--clarity-input-bg: #F9FAFB;
	--clarity-font: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.aibc-design-clarity {
	font-family: var(--clarity-font);
	background: var(--clarity-bg);
	min-height: 100vh;
	padding: 48px 20px;
}

/* Clarity Form Group - Simple Field Style */
.clarity-form-group {
	margin-bottom: 16px;
}

.clarity-form-group > label {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: var(--clarity-text, #111827);
	margin-bottom: 8px;
}

.clarity-form-group select,
.clarity-form-group input[type="text"] {
	width: 100%;
	padding: 14px 16px;
	font-size: 14px;
	font-family: inherit;
	color: var(--clarity-text, #374151);
	background-color: var(--clarity-input-bg, #f3f4f6);
	border: 1px solid var(--clarity-border, #e5e7eb);
	border-radius: 12px;
	appearance: none;
	cursor: pointer;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.clarity-form-group select {
	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: left 14px center;
	background-repeat: no-repeat;
	background-size: 18px;
	padding-left: 40px;
}

[dir="ltr"] .clarity-form-group select {
	background-position: right 14px center;
	padding-left: 16px;
	padding-right: 40px;
}

.clarity-form-group select:focus,
.clarity-form-group input[type="text"]:focus {
	outline: none;
	border-color: var(--clarity-primary, #2563eb);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.clarity-form-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	margin-bottom: 16px;
}

.clarity-hint {
	display: block;
	margin-top: 6px;
	font-size: 12px;
	color: var(--clarity-text-tertiary, #9ca3af);
}

.clarity-required {
	color: #ef4444;
}

@media (max-width: 500px) {
	.clarity-form-row {
		grid-template-columns: 1fr;
	}
}

.aibc-design-clarity .aibc-wizard-shell {
	max-width: 560px;
	margin: 0 auto;
	background: var(--clarity-card);
	border: 1px solid var(--clarity-border);
	border-radius: 12px;
	box-shadow:
		0 1px 2px rgba(0, 0, 0, 0.04),
		0 4px 12px rgba(0, 0, 0, 0.03);
	overflow: hidden;
}

/* Header - Clean and direct */
.aibc-design-clarity .aibc-wizard-header {
	padding: 32px 32px 24px;
	border-bottom: 1px solid var(--clarity-border);
}

.aibc-design-clarity .aibc-header-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 8px;
}

.aibc-design-clarity .aibc-wizard-header h1 {
	font-size: 20px;
	font-weight: 600;
	color: var(--clarity-text);
	margin: 0;
}

.aibc-design-clarity .aibc-header-badge {
	font-size: 12px;
	font-weight: 500;
	color: var(--clarity-success);
	background: rgba(5, 150, 105, 0.1);
	padding: 4px 10px;
	border-radius: 4px;
}

.aibc-design-clarity .aibc-wizard-header p {
	font-size: 14px;
	color: var(--clarity-text-secondary);
	margin: 0;
	line-height: 1.5;
}

/* Form Body */
.aibc-design-clarity .aibc-wizard-body {
	padding: 24px 32px 32px;
}

/* Form Groups - Structured and clear */
.aibc-design-clarity .aibc-form-group {
	margin-bottom: 20px;
}

.aibc-design-clarity .aibc-form-group:last-child {
	margin-bottom: 0;
}

.aibc-design-clarity .aibc-form-label {
	display: block;
	font-size: 13px;
	font-weight: 500;
	color: var(--clarity-text);
	margin-bottom: 6px;
}

.aibc-design-clarity .aibc-form-label .aibc-required {
	color: #EF4444;
	margin-left: 2px;
}

.aibc-design-clarity .aibc-form-hint {
	font-size: 12px;
	color: var(--clarity-text-tertiary);
	margin-top: 4px;
}

/* Input Styles */
.aibc-design-clarity .aibc-input,
.aibc-design-clarity .aibc-select {
	width: 100%;
	padding: 10px 14px;
	font-family: var(--clarity-font);
	font-size: 14px;
	color: var(--clarity-text);
	background: var(--clarity-input-bg);
	border: 1px solid var(--clarity-border);
	border-radius: 8px;
	transition: all 0.15s ease;
	box-sizing: border-box;
}

.aibc-design-clarity .aibc-input:hover,
.aibc-design-clarity .aibc-select:hover {
	border-color: #D1D5DB;
}

.aibc-design-clarity .aibc-input:focus,
.aibc-design-clarity .aibc-select:focus {
	outline: none;
	border-color: var(--clarity-primary);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
	background: white;
}

.aibc-design-clarity .aibc-input::placeholder {
	color: var(--clarity-text-tertiary);
}

.aibc-design-clarity .aibc-select {
	appearance: none;
	cursor: pointer;
	background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	padding-right: 40px;
}

/* Inline Row */
.aibc-design-clarity .aibc-form-row {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 16px;
}

/* Tone - Clean segmented control */
.aibc-design-clarity .aibc-segment-control {
	display: flex;
	background: var(--clarity-input-bg);
	border: 1px solid var(--clarity-border);
	border-radius: 8px;
	padding: 4px;
}

.aibc-design-clarity .aibc-segment-btn {
	flex: 1;
	padding: 10px 16px;
	font-family: var(--clarity-font);
	font-size: 13px;
	font-weight: 500;
	color: var(--clarity-text-secondary);
	background: transparent;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	transition: all 0.15s ease;
}

.aibc-design-clarity .aibc-segment-btn:hover {
	color: var(--clarity-text);
}

.aibc-design-clarity .aibc-segment-btn.is-active {
	background: white;
	color: var(--clarity-text);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Divider */
.aibc-design-clarity .aibc-form-divider {
	height: 1px;
	background: var(--clarity-border);
	margin: 24px 0;
}

/* Advanced Toggle */
.aibc-design-clarity .aibc-advanced-toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	color: var(--clarity-text-secondary);
	cursor: pointer;
	user-select: none;
	margin-top: 20px;
}

.aibc-design-clarity .aibc-toggle-icon {
	transition: transform 0.2s ease;
}

.aibc-design-clarity .aibc-advanced-toggle.is-open .aibc-toggle-icon {
	transform: rotate(90deg);
}

/* Footer / CTA */
.aibc-design-clarity .aibc-wizard-footer {
	padding: 24px 32px;
	background: var(--clarity-input-bg);
	border-top: 1px solid var(--clarity-border);
}

.aibc-design-clarity .aibc-cta-button {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 12px 24px;
	font-family: var(--clarity-font);
	font-size: 14px;
	font-weight: 600;
	color: white;
	background: var(--clarity-primary);
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.15s ease;
}

.aibc-design-clarity .aibc-cta-button:hover {
	background: var(--clarity-primary-hover);
}

.aibc-design-clarity .aibc-cta-button:active {
	transform: scale(0.99);
}

.aibc-design-clarity .aibc-cta-icon {
	font-size: 16px;
}

/* Footer info */
.aibc-design-clarity .aibc-footer-info {
	display: flex;
	justify-content: center;
	gap: 24px;
	margin-top: 16px;
}

.aibc-design-clarity .aibc-footer-stat {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: var(--clarity-text-secondary);
}

.aibc-design-clarity .aibc-footer-stat-icon {
	font-size: 14px;
	opacity: 0.6;
}

/* Loading State */
.aibc-design-clarity .aibc-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 64px 32px;
}

.aibc-design-clarity .aibc-loading-spinner {
	width: 32px;
	height: 32px;
	border: 3px solid var(--clarity-border);
	border-top-color: var(--clarity-primary);
	border-radius: 50%;
	animation: clarity-spin 0.8s linear infinite;
	margin-bottom: 16px;
}

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

.aibc-design-clarity .aibc-loading-text {
	font-size: 14px;
	color: var(--clarity-text-secondary);
}

.aibc-design-clarity .aibc-loading-progress {
	width: 200px;
	height: 4px;
	background: var(--clarity-border);
	border-radius: 2px;
	margin-top: 16px;
	overflow: hidden;
}

.aibc-design-clarity .aibc-loading-progress-bar {
	height: 100%;
	background: var(--clarity-primary);
	border-radius: 2px;
	width: 0%;
	animation: clarity-progress 3s ease-in-out infinite;
}

@keyframes clarity-progress {
	0% { width: 0%; }
	50% { width: 70%; }
	100% { width: 100%; }
}

/* Success State */
.aibc-design-clarity .aibc-success {
	text-align: center;
	padding: 48px 32px;
}

.aibc-design-clarity .aibc-success-icon {
	width: 48px;
	height: 48px;
	background: rgba(5, 150, 105, 0.1);
	border-radius: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 auto 16px;
	font-size: 24px;
	color: var(--clarity-success);
}

.aibc-design-clarity .aibc-success-title {
	font-size: 18px;
	font-weight: 600;
	color: var(--clarity-text);
	margin: 0 0 8px;
}

.aibc-design-clarity .aibc-success-text {
	font-size: 14px;
	color: var(--clarity-text-secondary);
	margin: 0;
}

/* Mobile Responsive */
@media (max-width: 560px) {
	.aibc-design-clarity {
		padding: 24px 16px;
	}

	.aibc-design-clarity .aibc-wizard-header {
		padding: 24px 20px 20px;
	}

	.aibc-design-clarity .aibc-wizard-body {
		padding: 20px;
	}

	.aibc-design-clarity .aibc-form-row {
		grid-template-columns: 1fr;
	}

	.aibc-design-clarity .aibc-segment-control {
		flex-wrap: wrap;
	}

	.aibc-design-clarity .aibc-segment-btn {
		flex: 1 1 calc(50% - 4px);
	}

	.aibc-design-clarity .aibc-wizard-footer {
		padding: 20px;
	}

	.aibc-design-clarity .aibc-footer-info {
		flex-direction: column;
		gap: 8px;
		align-items: center;
	}
}

/* RTL Support */
[dir="rtl"] .aibc-design-clarity .aibc-select {
	background-position: left 14px center;
	padding-right: 14px;
	padding-left: 40px;
}

[dir="rtl"] .aibc-design-clarity .aibc-form-label .aibc-required {
	margin-left: 0;
	margin-right: 2px;
}

/* ========================================
	CHAPTER METHOD SELECTOR STYLES
	======================================== */

/* Base Chapter Method Selector */
.aibc-chapter-method-selector {
	margin-top: 16px;
	margin-bottom: 16px;
}

/* Simple Field Style - Same as PDF Format */
.aibc-simple-field {
	margin-bottom: 16px;
}

.aibc-simple-field > label {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: #111827;
	margin-bottom: 8px;
}

.aibc-simple-field select {
	width: 100%;
	padding: 14px 16px;
	font-size: 14px;
	font-family: inherit;
	color: #374151;
	background-color: #f3f4f6;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	appearance: none;
	cursor: pointer;
	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: left 14px center;
	background-repeat: no-repeat;
	background-size: 18px;
	padding-left: 40px;
}

[dir="ltr"] .aibc-simple-field select {
	background-position: right 14px center;
	padding-left: 16px;
	padding-right: 40px;
}

.aibc-simple-field select:focus {
	outline: none;
	border-color: #3b82f6;
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.aibc-field-hint {
	margin-top: 8px;
	padding: 10px 12px;
	font-size: 13px;
	color: #6b7280;
	background: #f0f9ff;
	border-radius: 8px;
	border-right: 3px solid #0ea5e9;
}

[dir="ltr"] .aibc-field-hint {
	border-right: none;
	border-left: 3px solid #0ea5e9;
}

.aibc-chapter-method-selector:hover {
	/* No hover effect needed */
}

.aibc-chapter-method-selector > label {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: var(--clarity-text, #111827);
	margin-bottom: 8px;
	text-align: right;
}

.aibc-chapter-method-icon {
	font-size: 16px;
	margin-left: 6px;
}

.aibc-chapter-method-selector select {
	width: 100%;
	padding: 14px 40px 14px 16px;
	font-size: 14px;
	font-family: inherit;
	color: var(--clarity-text, #111827);
	background-color: #f8fafc;
	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: left 12px center;
	background-repeat: no-repeat;
	background-size: 20px;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	appearance: none;
	cursor: pointer;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

[dir="ltr"] .aibc-chapter-method-selector select {
	background-position: right 12px center;
	padding: 14px 40px 14px 16px;
}

.aibc-chapter-method-selector select:focus {
	outline: none;
	border-color: var(--clarity-primary, #2563eb);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.aibc-chapter-method-desc {
	margin-top: 10px;
	padding: 12px;
	font-size: 13px;
	line-height: 1.5;
	color: var(--clarity-text-secondary, #6b7280);
	background: #f0f9ff;
	border-radius: 8px;
	border-right: 3px solid #0ea5e9;
}

[dir="ltr"] .aibc-chapter-method-desc {
	border-right: none;
	border-left: 3px solid #0ea5e9;
}

.aibc-chapter-method-hint {
	margin-top: 8px;
	font-size: 12px;
	color: var(--clarity-text-tertiary, #9ca3af);
	text-align: right;
}

/* Design-specific variants - Simplified */

/* Whisper Design */
.whisper-chapter-method {
	/* Simple - no background box */
}

.whisper-chapter-method:hover {
	/* No hover */
}

.whisper-chapter-method .aibc-chapter-method-desc {
	border-right-color: #8b5cf6;
	background: #faf5ff;
}

/* Focus Design */
.focus-chapter-method {
	/* Simple - no background box */
}

.focus-chapter-method > label {
	color: #f1f5f9;
}

.focus-chapter-method select {
	background-color: #1e293b;
	color: #f1f5f9;
	border-color: #475569;
}

.focus-chapter-method select:focus {
	border-color: #3b82f6;
	box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.focus-chapter-method .aibc-chapter-method-desc {
	background: #1e293b;
	color: #94a3b8;
	border-right-color: #3b82f6;
}

.focus-chapter-method .aibc-chapter-method-hint {
	color: #64748b;
}

/* Flow Design */
.flow-chapter-method {
	/* Simple - no background box */
}

.flow-chapter-method > label {
	color: #78350f;
}

.flow-chapter-method .aibc-chapter-method-desc {
	border-right-color: #f59e0b;
	background: #fffbeb;
}

/* Canvas Design */
.canvas-chapter-method {
	/* Simple - no background box */
	text-align: center;
}

.canvas-chapter-method > label {
	justify-content: center;
	color: #065f46;
	text-align: center;
}

.canvas-chapter-method .aibc-chapter-method-desc {
	border-right: none;
	border-top: 2px solid #10b981;
	text-align: right;
}

/* RTL Support */
[dir="rtl"] .aibc-chapter-method-selector select {
	background-position: left 12px center;
	padding-left: 40px;
	padding-right: 14px;
}

[dir="rtl"] .aibc-chapter-method-desc {
	border-left: none;
	border-right: 3px solid #0ea5e9;
}

[dir="rtl"] .whisper-chapter-method .aibc-chapter-method-desc {
	border-right-color: #8b5cf6;
}

[dir="rtl"] .focus-chapter-method .aibc-chapter-method-desc {
	border-right-color: #3b82f6;
}

[dir="rtl"] .flow-chapter-method .aibc-chapter-method-desc {
	border-right-color: #f59e0b;
}

/* Responsive */
@media (max-width: 640px) {
	.aibc-chapter-method-selector > label {
		font-size: 13px;
	}

	.aibc-chapter-method-selector select {
		font-size: 13px;
		padding: 12px 36px 12px 12px;
	}
}

/* ========================================
	BOOK TYPE & STORY ELEMENTS - BULK/SCHEDULER
	======================================== */

/* Book Type Section in Bulk Generator */
.aibc-bulk-story-elements-section {
	margin-top: 20px;
	padding: 20px;
	background: #f8fafc;
	border-radius: 12px;
	border: 1px solid var(--clarity-border);
}

.aibc-bulk-default-toggle {
	padding: 16px;
	background: #fff;
	border-radius: 8px;
	border: 1px solid var(--clarity-border);
}

.aibc-bulk-default-toggle .aibc-checkbox-label {
	display: flex;
	align-items: center;
	gap: 10px;
	cursor: pointer;
	font-weight: 500;
	color: var(--clarity-text);
}

.aibc-bulk-default-toggle .aibc-checkbox-label input[type="checkbox"] {
	width: 18px;
	height: 18px;
	cursor: pointer;
	accent-color: var(--clarity-primary);
}

.aibc-bulk-toggle-hint {
	margin: 8px 0 0 28px;
	font-size: 13px;
	color: var(--clarity-text-secondary);
}

.aibc-bulk-story-elements {
	margin-top: 16px;
	padding: 20px;
	background: #fff;
	border-radius: 8px;
	border: 1px solid var(--clarity-border);
}

.aibc-bulk-story-elements h4 {
	margin: 0 0 8px 0;
	font-size: 16px;
	font-weight: 600;
	color: var(--clarity-text);
}

.aibc-bulk-story-elements .description {
	margin: 0 0 16px 0;
	font-size: 13px;
	color: var(--clarity-text-secondary);
}

/* Story Element Fields */
.aibc-story-element-field {
	margin-bottom: 16px;
	padding-bottom: 16px;
	border-bottom: 1px solid #f0f0f0;
}

.aibc-story-element-field:last-child {
	margin-bottom: 0;
	padding-bottom: 0;
	border-bottom: none;
}

.aibc-story-element-field label {
	display: block;
	font-weight: 600;
	font-size: 14px;
	margin-bottom: 6px;
	color: var(--clarity-text);
}

.aibc-story-element-field input[type="text"],
.aibc-story-element-field textarea,
.aibc-story-element-field select {
	width: 100%;
	padding: 10px 14px;
	font-size: 14px;
	font-family: var(--clarity-font);
	border: 1px solid var(--clarity-border);
	border-radius: 8px;
	background: var(--clarity-input-bg);
	color: var(--clarity-text);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.aibc-story-element-field input[type="text"]:focus,
.aibc-story-element-field textarea:focus,
.aibc-story-element-field select:focus {
	border-color: var(--clarity-primary);
	outline: none;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

.aibc-story-element-field .description {
	margin-top: 6px;
	font-size: 12px;
	color: var(--clarity-text-tertiary);
}

.aibc-no-elements {
	padding: 20px;
	text-align: center;
	color: var(--clarity-text-secondary);
	font-style: italic;
}

/* Scheduler Book Type Section */
.aibc-scheduler-book-type-section {
	margin-top: 20px;
	padding-top: 20px;
	border-top: 1px solid var(--clarity-border);
}

.aibc-scheduler-default-toggle {
	margin-top: 16px;
	padding: 14px;
	background: #f8fafc;
	border-radius: 8px;
}

.aibc-scheduler-toggle-hint {
	margin: 6px 0 0 28px;
	font-size: 12px;
	color: var(--clarity-text-secondary);
}

.aibc-scheduler-story-elements {
	margin-top: 16px;
	padding: 16px;
	background: #fff;
	border-radius: 8px;
	border: 1px solid var(--clarity-border);
}

.aibc-scheduler-story-elements h5 {
	margin: 0 0 16px 0;
	font-size: 15px;
	font-weight: 600;
	color: var(--clarity-text);
}

/* Checkbox Label Style */
.aibc-checkbox-label {
	display: flex;
	align-items: center;
	gap: 10px;
	cursor: pointer;
	font-weight: 500;
}

.aibc-checkbox-label input[type="checkbox"] {
	margin: 0;
	width: 18px;
	height: 18px;
	cursor: pointer;
	accent-color: var(--clarity-primary);
}

/* RTL Support for Story Elements */
[dir="rtl"] .aibc-bulk-toggle-hint,
[dir="rtl"] .aibc-scheduler-toggle-hint {
	margin: 8px 28px 0 0;
}

[dir="rtl"] .aibc-story-element-field label {
	text-align: right;
}

/* Responsive adjustments */
@media (max-width: 768px) {
	.aibc-bulk-story-elements-section {
		padding: 15px;
	}

	.aibc-bulk-story-elements,
	.aibc-scheduler-story-elements {
		padding: 15px;
	}
}
