/**
 * ============================================================================
 * B-Book - Mon Premier Livre Numérique
 * Feuilles de styles principales pour enfants et école primaire
 * ============================================================================
 */

:root {
	--primary-teal: #0d9488;
	--primary-teal-dark: #0f766e;
	--primary-teal-light: #ccfbf1;
	--accent-amber: #f59e0b;
	--accent-amber-hover: #d97706;
	--accent-coral: #f43f5e;
	--accent-coral-hover: #e11d48;
	--accent-blue: #0284c7;
	--bg-slate: #f1f5f9;
	--card-border: #cbd5e1;
	--text-dark: #1e293b;
	--text-muted: #64748b;
	--font-title: 'Fredoka', 'Nunito', sans-serif;
	--font-body: 'Nunito', sans-serif;
	--font-dys: 'OpenDyslexic', 'Nunito', sans-serif;
	--shadow-page: 0 14px 40px rgba(0, 0, 0, 0.16), 0 2px 10px rgba(0, 0, 0, 0.08);
}

*, *::before, *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html, body {
	height: 100%;
	width: 100%;
	overflow: hidden;
	font-family: var(--font-body);
	background: var(--bg-slate);
	color: var(--text-dark);
	user-select: none;
	-webkit-user-select: none;
}

/* ==========================================================================
   1. Structure Principale
   ========================================================================== */
.bbook-wrapper {
	display: flex;
	flex-direction: column;
	height: 100vh;
	width: 100vw;
	overflow: hidden;
}

/* 1.1 Barre supérieure */
.bbook-top-bar {
	height: 64px;
	background: #ffffff;
	border-bottom: 2px solid #e2e8f0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 16px;
	gap: 12px;
	flex-shrink: 0;
	z-index: 100;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Gauche */
.bbook-top-left {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 0;
}

.btn-top-back {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	background: #f8fafc;
	color: #334155;
	border: 1px solid #cbd5e1;
	border-radius: 12px;
	text-decoration: none;
	font-weight: 700;
	font-size: 13px;
	transition: all 0.15s ease;
	white-space: nowrap;
}

.btn-top-back:hover {
	background: #e2e8f0;
	color: #0f172a;
}

.bbook-logo-badge {
	display: flex;
	align-items: center;
	gap: 8px;
	background: linear-gradient(135deg, #0d9488, #0f766e);
	color: #ffffff;
	padding: 6px 14px;
	border-radius: 14px;
	box-shadow: 0 2px 6px rgba(13, 148, 136, 0.25);
}

.bbook-logo-icon {
	font-size: 20px;
}

.bbook-logo-text h1 {
	font-family: var(--font-title);
	font-size: 18px;
	font-weight: 900;
	letter-spacing: 0.5px;
	line-height: 1;
}

.bbook-title-container {
	max-width: 260px;
	min-width: 140px;
}

.bbook-title-field {
	width: 100%;
	padding: 6px 12px;
	border: 1.5px dashed #cbd5e1;
	background: #f8fafc;
	border-radius: 10px;
	font-family: var(--font-title);
	font-size: 15px;
	font-weight: 700;
	color: #0f172a;
	outline: none;
	transition: all 0.2s ease;
	text-overflow: ellipsis;
}

.bbook-title-field:hover {
	border-color: #0d9488;
	background: #ffffff;
}

.bbook-title-field:focus {
	border-style: solid;
	border-color: #0d9488;
	background: #ffffff;
	box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

/* Centre (Pagination) */
.bbook-top-center {
	display: flex;
	align-items: center;
	gap: 10px;
}

.page-nav-pill {
	display: inline-flex;
	align-items: center;
	background: #f1f5f9;
	border: 1.5px solid #cbd5e1;
	border-radius: 30px;
	padding: 3px;
	gap: 4px;
}

.btn-page-nav {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: none;
	background: #ffffff;
	color: #334155;
	font-size: 13px;
	font-weight: 900;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 1px 3px rgba(0,0,0,0.08);
	transition: all 0.15s ease;
}

.btn-page-nav:hover:not(:disabled) {
	background: #0d9488;
	color: #ffffff;
	transform: scale(1.08);
}

.btn-page-nav:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.page-counter-btn {
	border: none;
	background: transparent;
	padding: 4px 12px;
	font-family: var(--font-title);
	font-size: 14px;
	font-weight: 800;
	color: #0f172a;
	cursor: pointer;
	border-radius: 20px;
	transition: background 0.15s ease;
}

.page-counter-btn:hover {
	background: #e2e8f0;
}

.btn-tool-header {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	background: #ffffff;
	border: 1.5px solid #cbd5e1;
	border-radius: 12px;
	font-family: var(--font-title);
	font-size: 13px;
	font-weight: 700;
	color: #334155;
	cursor: pointer;
	transition: all 0.15s ease;
}

.btn-tool-header:hover {
	background: #f8fafc;
	border-color: #94a3b8;
}

/* Droite : Boutons clés */
.bbook-top-right {
	display: flex;
	align-items: center;
	gap: 10px;
}

/* Bouton "+" Magique (Inspiré de Book Creator) */
.btn-action-add {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 18px;
	background: linear-gradient(135deg, #f59e0b, #d97706);
	color: #ffffff;
	border: none;
	border-radius: 30px;
	font-family: var(--font-title);
	font-size: 15px;
	font-weight: 800;
	cursor: pointer;
	box-shadow: 0 3px 10px rgba(245, 158, 11, 0.35);
	transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-action-add:hover {
	transform: translateY(-2px) scale(1.04);
	box-shadow: 0 6px 14px rgba(245, 158, 11, 0.45);
	background: linear-gradient(135deg, #fbbf24, #d97706);
}

/* Bouton Inspecteur (i) */
.btn-action-inspect {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	background: #e0f2fe;
	color: #0369a1;
	border: 1.5px solid #bae6fd;
	border-radius: 30px;
	font-family: var(--font-title);
	font-size: 14px;
	font-weight: 800;
	cursor: pointer;
	transition: all 0.15s ease;
}

.btn-action-inspect:hover,
.btn-action-inspect.active {
	background: #0284c7;
	color: #ffffff;
	border-color: #0284c7;
}

/* Bouton Lire le livre (Mode Liseuse) */
.btn-action-read {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 16px;
	background: linear-gradient(135deg, #10b981, #059669);
	color: #ffffff;
	border: none;
	border-radius: 30px;
	font-family: var(--font-title);
	font-size: 14px;
	font-weight: 800;
	cursor: pointer;
	box-shadow: 0 3px 8px rgba(16, 185, 129, 0.3);
	transition: all 0.2s ease;
}

.btn-action-read:hover {
	transform: translateY(-1px);
	box-shadow: 0 5px 12px rgba(16, 185, 129, 0.4);
}

/* Menu déroulant Projet */
.project-menu-dropdown-wrapper {
	position: relative;
}

.project-dropdown-menu {
	display: none;
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	background: #ffffff;
	border: 1px solid #cbd5e1;
	border-radius: 14px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
	min-width: 260px;
	padding: 8px;
	z-index: 200;
}

.project-dropdown-menu.active {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.dropdown-item {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 10px 14px;
	border: none;
	background: transparent;
	border-radius: 8px;
	font-family: var(--font-body);
	font-size: 14px;
	font-weight: 700;
	color: #334155;
	text-align: left;
	cursor: pointer;
	transition: background 0.15s ease;
}

.dropdown-item:hover {
	background: #f1f5f9;
	color: #0f172a;
}

.dropdown-item.text-danger:hover {
	background: #fee2e2;
	color: #b91c1c;
}

.file-label-item {
	cursor: pointer;
}

.dropdown-divider {
	border: none;
	border-top: 1px solid #e2e8f0;
	margin: 4px 0;
}

/* ==========================================================================
   2. Espace de travail et page du livre
   ========================================================================== */
.bbook-workspace {
	flex: 1;
	overflow: auto;
	position: relative;
	background: #e2e8f0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 30px;
}

.bbook-stage-scaler {
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.15s ease;
	transform-origin: center center;
}

/* La page du livre */
.bbook-page-canvas {
	position: relative;
	background: #ffffff;
	border-radius: 8px;
	box-shadow: var(--shadow-page);
	overflow: hidden;
	user-select: none;
	transition: width 0.25s ease, height 0.25s ease;
}

/* Formats de pages */
.bbook-page-canvas.format-landscape {
	width: 960px;
	height: 640px; /* Ratio 3:2 ou proche 4:3 */
}

.bbook-page-canvas.format-portrait {
	width: 640px;
	height: 900px; /* Ratio A4 / livre vertical */
}

.bbook-page-canvas.format-square {
	width: 740px;
	height: 740px; /* Ratio 1:1 */
}

/* Couche de fond (couleurs et motifs) */
.page-background-layer {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 1;
}

/* Motifs de papiers scolaires */
.bg-pattern-seyes {
	background-color: #ffffff;
	background-image: 
		linear-gradient(#e0e7ff 1px, transparent 1px),
		linear-gradient(90deg, transparent 80px, #fca5a5 80px, #fca5a5 82px, transparent 82px),
		linear-gradient(#c7d2fe 2px, transparent 2px);
	background-size: 100% 8px, 100% 100%, 100% 32px;
}

.bg-pattern-grid {
	background-color: #ffffff;
	background-image: 
		linear-gradient(#e2e8f0 1.5px, transparent 1.5px),
		linear-gradient(90deg, #e2e8f0 1.5px, transparent 1.5px);
	background-size: 24px 24px;
}

.bg-pattern-lines {
	background-color: #ffffff;
	background-image: linear-gradient(#cbd5e1 1.5px, transparent 1.5px);
	background-size: 100% 32px;
}

.bg-pattern-dots {
	background-color: #ffffff;
	background-image: radial-gradient(#94a3b8 1.5px, transparent 1.5px);
	background-size: 20px 20px;
}

.bg-pattern-parchment {
	background: #fef3c7;
	background-image: radial-gradient(#fde68a 1px, transparent 1px);
	background-size: 16px 16px;
}

/* Couche des éléments */
.page-elements-layer {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 5;
}

/* Numérotation de page */
.page-number-display {
	position: absolute;
	bottom: 12px;
	right: 18px;
	font-family: var(--font-title);
	font-size: 13px;
	font-weight: 700;
	color: #94a3b8;
	pointer-events: none;
	z-index: 4;
}

/* ==========================================================================
   3. Éléments Intérieurs (Texte, Dessin, Image, Audio, Formes, Stickers)
   ========================================================================== */
.bbook-element {
	position: absolute;
	cursor: move;
	touch-action: none;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: box-shadow 0.15s ease;
}

.bbook-element.selected {
	outline: 2.5px solid #0284c7;
	outline-offset: 2px;
}

/* Poignées de redimensionnement */
.element-resize-handle {
	position: absolute;
	width: 12px;
	height: 12px;
	background: #0284c7;
	border: 2px solid #ffffff;
	border-radius: 50%;
	box-shadow: 0 1px 4px rgba(0,0,0,0.3);
	display: none;
	z-index: 40;
}

.bbook-element.selected .element-resize-handle {
	display: block;
}

.element-resize-handle.handle-nw { top: -6px; left: -6px; cursor: nwse-resize; }
.element-resize-handle.handle-ne { top: -6px; right: -6px; cursor: nesw-resize; }
.element-resize-handle.handle-sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.element-resize-handle.handle-se { bottom: -6px; right: -6px; cursor: nwse-resize; }

/* Barre d'action rapide sur l'élément sélectionné */
.element-quick-actions {
	position: absolute;
	top: -42px;
	left: 50%;
	transform: translateX(-50%);
	display: none;
	align-items: center;
	gap: 4px;
	background: #1e293b;
	padding: 4px 8px;
	border-radius: 20px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
	z-index: 50;
	white-space: nowrap;
}

.bbook-element.selected .element-quick-actions {
	display: flex;
}

.quick-btn {
	border: none;
	background: transparent;
	color: #ffffff;
	padding: 4px 8px;
	border-radius: 6px;
	font-size: 13px;
	cursor: pointer;
	transition: background 0.15s ease;
}

.quick-btn:hover {
	background: rgba(255, 255, 255, 0.2);
}

.quick-btn.btn-quick-del:hover {
	background: #ef4444;
}

/* --- Élément TEXTE --- */
.el-text-content {
	width: 100%;
	height: 100%;
	outline: none;
	word-break: break-word;
	line-height: 1.35;
	padding: 8px 12px;
	user-select: text;
	-webkit-user-select: text;
}

.el-text-content[contenteditable="true"] {
	cursor: text;
	background: rgba(255, 255, 255, 0.9) !important;
	outline: 2px dashed #0284c7;
}

/* --- Élément IMAGE --- */
.el-image-wrapper {
	width: 100%;
	height: 100%;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
}

.el-image-img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	pointer-events: none;
}

/* --- Élément AUDIO / MA VOIX (Le badge haut-parleur interactif) --- */
.el-audio-badge {
	width: 68px;
	height: 68px;
	border-radius: 50%;
	background: linear-gradient(135deg, #f43f5e, #e11d48);
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 32px;
	box-shadow: 0 6px 16px rgba(244, 63, 94, 0.4);
	cursor: pointer;
	transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
	position: relative;
}

.el-audio-badge:hover {
	transform: scale(1.1);
}

.el-audio-badge.is-playing {
	animation: audioWavePulse 1.2s infinite alternate;
	background: linear-gradient(135deg, #10b981, #059669);
	box-shadow: 0 8px 24px rgba(16, 185, 129, 0.5);
}

@keyframes audioWavePulse {
	0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
	100% { transform: scale(1.15); box-shadow: 0 0 0 16px rgba(16, 185, 129, 0); }
}

/* --- Élément STICKER --- */
.el-sticker-emoji {
	font-size: 64px;
	line-height: 1;
	filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
}

/* --- Élément BULLE / FORME --- */
.el-shape-svg {
	width: 100%;
	height: 100%;
	overflow: visible;
}

/* ==========================================================================
   4. Mode Dessin Libre au Stylo (Drawing Canvas)
   ========================================================================== */
.drawing-mode-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(15, 23, 42, 0.4);
	backdrop-filter: blur(4px);
	z-index: 150;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.drawing-toolbar {
	background: #ffffff;
	padding: 10px 18px;
	border-radius: 40px;
	box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
	display: flex;
	align-items: center;
	gap: 16px;
	margin-bottom: 15px;
	z-index: 160;
}

.drawing-tools-group,
.drawing-sizes-group,
.drawing-actions-group {
	display: flex;
	align-items: center;
	gap: 6px;
}

.draw-tool-btn {
	padding: 6px 12px;
	border: 1.5px solid #cbd5e1;
	background: #f8fafc;
	border-radius: 20px;
	font-family: var(--font-title);
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
	transition: all 0.15s ease;
}

.draw-tool-btn.active,
.draw-tool-btn:hover {
	background: #0d9488;
	color: #ffffff;
	border-color: #0d9488;
}

.draw-size-btn {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: 1.5px solid #cbd5e1;
	background: #f8fafc;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.draw-size-btn.active {
	border-color: #0d9488;
	background: #ccfbf1;
}

.size-dot {
	background: #334155;
	border-radius: 50%;
}

.drawing-colors-palette {
	display: flex;
	align-items: center;
	gap: 5px;
}

.draw-color-swatch {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	border: 2px solid #ffffff;
	box-shadow: 0 1px 3px rgba(0,0,0,0.2);
	cursor: pointer;
	transition: transform 0.15s ease;
}

.draw-color-swatch.active {
	transform: scale(1.3);
	box-shadow: 0 0 0 2px #0d9488;
}

.btn-draw-action {
	padding: 8px 14px;
	border: none;
	border-radius: 20px;
	font-family: var(--font-title);
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
	background: #f1f5f9;
	color: #334155;
}

.btn-draw-validate {
	background: #10b981;
	color: #ffffff;
}

.btn-draw-danger {
	background: #fee2e2;
	color: #dc2626;
}

.drawing-canvas-surface {
	background: #ffffff;
	box-shadow: var(--shadow-page);
	border-radius: 8px;
	touch-action: none;
	cursor: crosshair;
}

/* ==========================================================================
   5. Inspecteur Latéral (i)
   ========================================================================== */
.bbook-inspector-drawer {
	position: fixed;
	top: 64px;
	right: 0;
	width: 320px;
	height: calc(100vh - 64px - 44px);
	background: #ffffff;
	border-left: 2px solid #e2e8f0;
	box-shadow: -4px 0 20px rgba(0, 0, 0, 0.08);
	display: flex;
	flex-direction: column;
	z-index: 90;
	overflow-y: auto;
	padding: 18px;
	gap: 20px;
}

.inspector-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding-bottom: 12px;
	border-bottom: 1.5px solid #e2e8f0;
}

.inspector-header h3 {
	font-family: var(--font-title);
	font-size: 16px;
	font-weight: 800;
	color: #0f172a;
}

.btn-close-inspector {
	border: none;
	background: #f1f5f9;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	font-weight: 900;
	cursor: pointer;
}

.inspector-section {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.inspector-section h4 {
	font-family: var(--font-title);
	font-size: 14px;
	font-weight: 800;
	color: #475569;
}

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

.pattern-btn-card {
	padding: 10px 8px;
	border: 1.5px solid #cbd5e1;
	border-radius: 10px;
	background: #ffffff;
	text-align: center;
	font-size: 12px;
	font-weight: 700;
	cursor: pointer;
	transition: all 0.15s ease;
}

.pattern-btn-card.active,
.pattern-btn-card:hover {
	border-color: #0d9488;
	background: #ccfbf1;
	color: #0f766e;
}

.colors-palette-flex {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.color-circle-btn {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	border: 2px solid #ffffff;
	box-shadow: 0 1px 3px rgba(0,0,0,0.2);
	cursor: pointer;
}

.color-circle-btn.active {
	box-shadow: 0 0 0 3px #0d9488;
}

.btn-step-size {
	width: 34px;
	height: 34px;
	border-radius: 8px;
	border: 1.5px solid #cbd5e1;
	background: #f8fafc;
	color: #0f172a;
	font-family: var(--font-title);
	font-weight: 800;
	font-size: 13px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.15s ease;
	flex-shrink: 0;
}

.btn-step-size:hover {
	background: #ccfbf1;
	border-color: #0d9488;
	color: #0f766e;
}

/* ==========================================================================
   6. Modales (Ajouter, Pages, Nouveau livre)
   ========================================================================== */
.bbook-modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background: rgba(15, 23, 42, 0.55);
	backdrop-filter: blur(4px);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 250;
	padding: 20px;
}

.bbook-modal-overlay.active {
	display: flex;
}

.bbook-modal-card {
	background: #ffffff;
	border-radius: 20px;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
	width: 100%;
	max-width: 600px;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: modalPop 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.bbook-modal-card.modal-lg { max-width: 780px; }
.bbook-modal-card.modal-xl { max-width: 960px; }

@keyframes modalPop {
	0% { transform: scale(0.94); opacity: 0; }
	100% { transform: scale(1); opacity: 1; }
}

.modal-header {
	padding: 16px 22px;
	background: #f8fafc;
	border-bottom: 1.5px solid #e2e8f0;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.modal-header h2 {
	font-family: var(--font-title);
	font-size: 20px;
	font-weight: 800;
	color: #0f172a;
}

.btn-close-modal {
	background: transparent;
	border: none;
	font-size: 20px;
	font-weight: 800;
	color: #64748b;
	cursor: pointer;
}

.modal-body {
	padding: 20px;
	overflow-y: auto;
}

.modal-footer {
	padding: 14px 22px;
	background: #f8fafc;
	border-top: 1.5px solid #e2e8f0;
	display: flex;
	justify-content: flex-end;
	gap: 10px;
}

/* Onglets d'ajout (+) */
.add-media-tabs-nav {
	display: flex;
	gap: 6px;
	padding: 8px 16px;
	background: #f1f5f9;
	border-bottom: 1px solid #e2e8f0;
	overflow-x: auto;
}

.tab-media-btn {
	padding: 8px 16px;
	border: none;
	background: transparent;
	border-radius: 12px;
	font-family: var(--font-title);
	font-size: 14px;
	font-weight: 800;
	color: #475569;
	cursor: pointer;
	white-space: nowrap;
	transition: all 0.15s ease;
}

.tab-media-btn.active {
	background: #ffffff;
	color: #0d9488;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.tab-media-btn.tab-highlight-audio {
	color: #e11d48;
}

.tab-media-btn.tab-highlight-audio.active {
	background: #ffe4e6;
}

.add-tab-panel {
	display: none;
}

.add-tab-panel.active {
	display: block;
}

/* Formulaires et boutons */
.text-editor-container textarea {
	width: 100%;
	padding: 14px;
	border: 2px solid #cbd5e1;
	border-radius: 12px;
	font-size: 18px;
	font-family: var(--font-body);
	outline: none;
	resize: vertical;
}

.text-editor-container textarea:focus {
	border-color: #0d9488;
}

.text-presets-row,
.text-style-colors-row {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 14px;
	flex-wrap: wrap;
}

.input-select-scolaire {
	padding: 8px 12px;
	border: 1.5px solid #cbd5e1;
	border-radius: 10px;
	font-size: 14px;
	font-weight: 700;
}

.btn-modal-primary {
	padding: 10px 20px;
	border: none;
	background: linear-gradient(135deg, #0d9488, #0f766e);
	color: #ffffff;
	border-radius: 12px;
	font-family: var(--font-title);
	font-size: 15px;
	font-weight: 800;
	cursor: pointer;
	box-shadow: 0 3px 10px rgba(13, 148, 136, 0.3);
}

.btn-modal-secondary {
	padding: 10px 18px;
	border: 1.5px solid #cbd5e1;
	background: #ffffff;
	color: #334155;
	border-radius: 12px;
	font-family: var(--font-title);
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
}

/* Enregistreur vocal */
.voice-recorder-module {
	text-align: center;
	padding: 20px 10px;
}

.mic-circle-pulse {
	width: 90px;
	height: 90px;
	border-radius: 50%;
	background: #ffe4e6;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 40px;
	margin-bottom: 14px;
	transition: all 0.2s ease;
}

.mic-circle-pulse.recording {
	background: #f43f5e;
	animation: pulseRing 1.4s infinite;
}

@keyframes pulseRing {
	0% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7); }
	70% { box-shadow: 0 0 0 25px rgba(244, 63, 94, 0); }
	100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

.record-timer-badge {
	font-family: var(--font-title);
	font-size: 28px;
	font-weight: 800;
	color: #f43f5e;
	margin: 10px 0;
}

.record-waveform-canvas {
	width: 100%;
	height: 60px;
	background: #f1f5f9;
	border-radius: 10px;
	margin-bottom: 14px;
}

.mic-buttons-row {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 14px;
}

.btn-mic-action {
	padding: 12px 24px;
	border: none;
	border-radius: 30px;
	font-family: var(--font-title);
	font-size: 16px;
	font-weight: 800;
	cursor: pointer;
	transition: all 0.2s ease;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.btn-mic-action:hover {
	transform: translateY(-2px);
	filter: brightness(1.08);
}

.btn-record-start {
	background: #f43f5e;
	color: #ffffff;
	box-shadow: 0 4px 14px rgba(244, 63, 94, 0.35);
}

.btn-record-stop {
	background: #334155;
	color: #ffffff;
}

.btn-audio-import {
	background: #3b82f6;
	color: #ffffff;
	box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

.btn-record-insert {
	background: #10b981;
	color: #ffffff;
	box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.audio-file-info-badge {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: #ecfeff;
	border: 1.5px solid #a5f3fc;
	color: #0e7490;
	font-family: var(--font-title);
	font-weight: 700;
	font-size: 14px;
	padding: 6px 16px;
	border-radius: 20px;
	margin-bottom: 12px;
	max-width: 90%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Grille de formes et stickers */
.shapes-selection-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 12px;
}

.shape-card {
	padding: 14px 10px;
	border: 1.5px solid #e2e8f0;
	border-radius: 14px;
	text-align: center;
	cursor: pointer;
	background: #ffffff;
	transition: all 0.15s ease;
}

.shape-card:hover {
	border-color: #0d9488;
	transform: translateY(-2px);
	box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
}

.shape-preview-icon {
	font-size: 32px;
	display: block;
	margin-bottom: 6px;
}

.stickers-display-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
	gap: 12px;
	padding: 10px 0;
}

.sticker-item-btn {
	border: none;
	background: #f8fafc;
	font-size: 36px;
	padding: 8px;
	border-radius: 12px;
	cursor: pointer;
	transition: transform 0.15s ease;
}

.sticker-item-btn:hover {
	transform: scale(1.25);
	background: #e2e8f0;
}

.stickers-categories-nav {
	display: flex;
	gap: 6px;
	margin-bottom: 12px;
	flex-wrap: wrap;
}

.cat-pill {
	padding: 6px 12px;
	border: 1px solid #cbd5e1;
	background: #ffffff;
	border-radius: 20px;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
}

.cat-pill.active {
	background: #0d9488;
	color: #ffffff;
	border-color: #0d9488;
}

/* Grille de miniatures de pages */
.pages-grid-container {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 20px;
	padding: 10px;
}

.page-thumb-card {
	border: 2px solid #e2e8f0;
	border-radius: 12px;
	padding: 10px;
	background: #ffffff;
	text-align: center;
	cursor: pointer;
	transition: all 0.2s ease;
}

.page-thumb-card.active {
	border-color: #0d9488;
	box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2);
}

.page-thumb-preview {
	height: 120px;
	background: #f1f5f9;
	border-radius: 6px;
	margin-bottom: 8px;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	color: #64748b;
}

/* ==========================================================================
   7. Liseuse de Livre Plein Écran (Mode Lecteur ▶️)
   ========================================================================== */
.bbook-reader-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	background: #0f172a;
	z-index: 300;
	display: flex;
	flex-direction: column;
}

.reader-header-bar {
	height: 60px;
	padding: 0 24px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	color: #ffffff;
	background: rgba(15, 23, 42, 0.8);
	backdrop-filter: blur(8px);
}

.reader-title-display {
	font-family: var(--font-title);
	font-size: 20px;
	font-weight: 800;
}

.reader-controls-cluster {
	display: flex;
	align-items: center;
	gap: 12px;
}

.btn-reader-action {
	padding: 8px 16px;
	border-radius: 20px;
	border: 1px solid rgba(255, 255, 255, 0.2);
	background: rgba(255, 255, 255, 0.1);
	color: #ffffff;
	font-family: var(--font-title);
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
}

.btn-reader-close {
	padding: 8px 18px;
	border-radius: 20px;
	border: none;
	background: #ef4444;
	color: #ffffff;
	font-family: var(--font-title);
	font-size: 14px;
	font-weight: 800;
	cursor: pointer;
}

.reader-stage-center {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	padding: 20px;
}

.btn-reader-nav-arrow {
	position: absolute;
	width: 54px;
	height: 54px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.15);
	border: 2px solid rgba(255, 255, 255, 0.3);
	color: #ffffff;
	font-size: 20px;
	font-weight: 900;
	cursor: pointer;
	z-index: 310;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
}

.btn-reader-nav-arrow:hover {
	background: rgba(255, 255, 255, 0.35);
	transform: scale(1.1);
}

.btn-reader-nav-arrow.arrow-left { left: 30px; }
.btn-reader-nav-arrow.arrow-right { right: 30px; }

.reader-page-viewport {
	position: relative;
	box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.1);
	border-radius: 12px;
	perspective: 2400px;
	perspective-origin: center center;
	transition: width 0.25s ease, height 0.25s ease;
}

/* Tranche et reliure de livre sur la gauche */
.reader-page-viewport::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	width: 28px;
	height: 100%;
	background: linear-gradient(to right, rgba(0, 0, 0, 0.22) 0%, rgba(0, 0, 0, 0.08) 35%, transparent 100%);
	pointer-events: none;
	z-index: 60;
	border-top-left-radius: 12px;
	border-bottom-left-radius: 12px;
}

.reader-page-surface {
	position: relative;
	width: 100%;
	height: 100%;
	border-radius: 12px;
	overflow: hidden;
	backface-visibility: hidden;
	transform-style: preserve-3d;
}

/* Animation 3D de page tournée vers l'AVANT (Page suivante) */
.reader-turning-page-next {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	transform-origin: left center;
	backface-visibility: hidden;
	pointer-events: none;
	z-index: 50;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: -10px 0 30px rgba(0, 0, 0, 0.35);
	animation: bbookPageTurnNext 0.95s cubic-bezier(0.25, 0.9, 0.35, 1) forwards;
}

@keyframes bbookPageTurnNext {
	0% {
		transform: rotateY(0deg);
		filter: brightness(1);
		box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
	}
	30% {
		box-shadow: -15px 0 35px rgba(0, 0, 0, 0.4);
	}
	55% {
		filter: brightness(0.88);
		box-shadow: -28px 0 55px rgba(0, 0, 0, 0.58);
	}
	85% {
		opacity: 1;
	}
	100% {
		transform: rotateY(-105deg);
		filter: brightness(0.62);
		opacity: 0;
		box-shadow: -45px 0 75px rgba(0, 0, 0, 0.7);
	}
}

/* Animation 3D de page tournée vers l'ARRIÈRE (Page précédente) */
.reader-turning-page-prev {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	transform-origin: left center;
	backface-visibility: hidden;
	pointer-events: none;
	z-index: 50;
	border-radius: 12px;
	overflow: hidden;
	box-shadow: -25px 0 50px rgba(0, 0, 0, 0.5);
	animation: bbookPageTurnPrev 0.95s cubic-bezier(0.25, 0.9, 0.35, 1) forwards;
}

@keyframes bbookPageTurnPrev {
	0% {
		transform: rotateY(-105deg);
		filter: brightness(0.62);
		opacity: 0;
		box-shadow: -45px 0 75px rgba(0, 0, 0, 0.7);
	}
	25% {
		opacity: 1;
		filter: brightness(0.86);
		box-shadow: -28px 0 55px rgba(0, 0, 0, 0.58);
	}
	65% {
		filter: brightness(0.95);
		box-shadow: -15px 0 35px rgba(0, 0, 0, 0.4);
	}
	100% {
		transform: rotateY(0deg);
		filter: brightness(1);
		opacity: 1;
		box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
	}
}

.reader-page-surface.page-turn-incoming {
	animation: bbookPageUnderlay 0.95s ease forwards;
}

@keyframes bbookPageUnderlay {
	0% {
		filter: brightness(0.82);
	}
	60% {
		filter: brightness(0.94);
	}
	100% {
		filter: brightness(1);
	}
}

.reader-footer-bar {
	height: 50px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #94a3b8;
}

.reader-pagination-pill {
	background: rgba(255, 255, 255, 0.1);
	padding: 6px 16px;
	border-radius: 20px;
	font-family: var(--font-title);
	font-size: 14px;
	font-weight: 700;
	color: #ffffff;
}

/* ==========================================================================
   8. Barre d'état inférieure
   ========================================================================== */
.bbook-status-bar {
	height: 44px;
	background: #ffffff;
	border-top: 1.5px solid #e2e8f0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 16px;
	font-size: 13px;
	flex-shrink: 0;
	z-index: 80;
}

.status-left {
	display: flex;
	align-items: center;
	gap: 16px;
}

.status-school-brand {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.status-school-logo {
	width: 22px;
	height: 22px;
	border-radius: 50%;
}

.status-school-copy {
	font-weight: 800;
	color: #0f172a;
}

.status-tip-text {
	color: #64748b;
}

.zoom-controls-group {
	display: flex;
	align-items: center;
	gap: 6px;
}

.btn-zoom-action {
	border: 1px solid #cbd5e1;
	background: #f8fafc;
	padding: 4px 8px;
	border-radius: 6px;
	font-weight: 700;
	font-size: 12px;
	cursor: pointer;
}

.zoom-level-badge {
	font-family: var(--font-title);
	font-size: 12px;
	font-weight: 800;
	color: #0f172a;
	min-width: 42px;
	text-align: center;
}

/* Conteneur d'impression multi-pages */
.bbook-print-all-container {
	display: none;
}

/* ==========================================================================
   9. Styles d'impression (@media print)
   ========================================================================== */
@media print {
	.bbook-top-bar,
	.bbook-status-bar,
	.bbook-inspector-drawer,
	.bbook-modal-overlay,
	.drawing-mode-overlay,
	.element-resize-handle,
	.element-quick-actions,
	.bbook-reader-overlay {
		display: none !important;
	}

	body.bbook-printing-all .bbook-workspace {
		display: none !important;
	}

	body.bbook-printing-all .bbook-print-all-container {
		display: block !important;
	}

	body, .bbook-wrapper, .bbook-workspace {
		background: #ffffff !important;
		padding: 0 !important;
		overflow: visible !important;
		height: auto !important;
	}

	.bbook-page-canvas {
		box-shadow: none !important;
		border: 1px solid #cbd5e1 !important;
		page-break-after: always;
		break-after: page;
		margin: 0 auto 20px auto !important;
	}
}

