/* IDA PDF Block Pro — styles frontend v1.0.0 */

/* ================================================================== */
/* 1. MODE PRÉSENTATION — bouton Play/Pause + anneau de progression     */
/* ================================================================== */

.wp-block-ida-pdf-block .ida-pro-pres-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-left: 8px;
	border-left: 1px solid rgba( 0, 0, 0, 0.12 );
	padding-left: 8px;
	min-width: 36px;
}

.ida-pro-pres-ring {
	position: absolute;
	top:    -4px;
	right:  -4px;
	width:  18px;
	height: 18px;
	pointer-events: none;
}

.ida-pro-pres-ring svg {
	width:  100%;
	height: 100%;
	transform: rotate( -90deg );
}

.ida-pro-pres-ring-bg {
	fill:   none;
	stroke: rgba( 0, 0, 0, 0.12 );
	stroke-width: 4;
}

.ida-pro-pres-ring-fill {
	fill:             none;
	stroke:           #ae510c;
	stroke-width:     4;
	stroke-dasharray: 81.68; /* 2π × 13 */
	stroke-dashoffset: 81.68;
	stroke-linecap:   round;
	transition: stroke-dashoffset 0.1s linear;
}

/* ================================================================== */
/* 2. MÉMOIRE DE LECTURE — toast non-bloquant                           */
/* ================================================================== */

.ida-pro-resume-toast {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	padding: 8px 12px;
	background: #291433;
	color: #fff;
	border-radius: 4px;
	font-size: 0.88em;
	line-height: 1.4;
	margin-bottom: 4px;
	transition: opacity 0.5s ease, transform 0.5s ease;
	opacity: 1;
	transform: translateY( 0 );
}

.ida-pro-resume-toast--fade {
	opacity: 0;
	transform: translateY( -6px );
}

.ida-pro-resume-msg {
	flex: 1;
	min-width: 0;
}

.ida-pro-resume-yes {
	background: #ae510c;
	font-size: 0.85em;
	padding: 3px 10px;
}

.ida-pro-resume-no {
	background: transparent;
	border: 1px solid rgba( 255, 255, 255, 0.4 );
	color: #fff;
	font-size: 0.85em;
	padding: 3px 10px;
}

.ida-pro-resume-yes:hover { background: #c76012; }
.ida-pro-resume-no:hover  { background: rgba( 255, 255, 255, 0.1 ); }

/* ================================================================== */
/* 3. GRILLE DE PAGES                                                   */
/* ================================================================== */

.wp-block-ida-pdf-block .ida-pro-page-grid {
	display:               grid;
	grid-template-columns: repeat( auto-fill, minmax( 140px, 1fr ) );
	gap:                   12px;
	padding:               12px;
	background:            #f5f4f2;
	border-radius:         4px;
	max-height:            60vh;
	overflow-y:            auto;
	width:                 100%;
	scrollbar-width:       thin;
}

.wp-block-ida-pdf-block .ida-pro-grid-cell {
	position:       relative;
	display:        flex;
	flex-direction: column;
	align-items:    center;
	gap:            4px;
	background:     #fff;
	border:         2px solid #e0e0e0;
	border-radius:  4px;
	padding:        4px;
	cursor:         pointer;
	transition:     border-color 0.15s, box-shadow 0.15s;
}

.wp-block-ida-pdf-block .ida-pro-grid-cell:hover {
	border-color: #291433;
	box-shadow:   0 2px 8px rgba( 0, 0, 0, 0.12 );
}

.wp-block-ida-pdf-block .ida-pro-grid-canvas {
	display:   block;
	max-width: 100%;
	height:    auto;
	min-height: 80px; /* placeholder avant rendu */
	background: #f0eee8;
}

.wp-block-ida-pdf-block .ida-pro-grid-num {
	font-size:   0.72em;
	color:       #888;
	line-height: 1.2;
	user-select: none;
}

/* ================================================================== */
/* Mode sombre — styles Pro                                             */
/* ================================================================== */

@media ( prefers-color-scheme: dark ) {
	.ida-pro-resume-toast  { background: #3e1f52; }
	.ida-pro-resume-yes    { background: #ae510c; }

	.wp-block-ida-pdf-block .ida-pro-page-grid { background: #1e1e1e; }
	.wp-block-ida-pdf-block .ida-pro-grid-cell {
		background:   #2e2e2e;
		border-color: #444;
	}
	.wp-block-ida-pdf-block .ida-pro-grid-cell:hover {
		border-color: #7e6e86;
	}
	.wp-block-ida-pdf-block .ida-pro-grid-canvas { background: #252525; }
	.wp-block-ida-pdf-block .ida-pro-grid-num    { color: #888; }
}

/* ================================================================== */
/* RGAA — A8 : Reflow de la grille de pages à 320 px (WCAG 1.4.10)    */
/* ================================================================== */

@media ( max-width: 320px ) {
	.wp-block-ida-pdf-block .ida-pro-page-grid {
		grid-template-columns: repeat( auto-fill, minmax( 90px, 1fr ) );
		gap:    8px;
		padding: 8px;
	}

	.wp-block-ida-pdf-block .ida-pro-grid-num {
		font-size: 0.65em;
	}
}

/* ── Annotations / surlignages (Pro) ────────────────────────────────── */
.ida-anno-bar {
	display: inline-flex;
	gap: 4px;
	align-items: center;
	margin-left: 8px;
}
.ida-anno-tool.is-active {
	outline: 2px solid #ffd54a;
	outline-offset: 1px;
}
.ida-anno-color {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	border: 2px solid rgba(255,255,255,.7);
	cursor: pointer;
	padding: 0;
}
.ida-anno-layer {
	position: absolute;
	z-index: 5;
	pointer-events: none;
}
.ida-anno-layer.ida-anno-drawing {
	cursor: crosshair;
	background: rgba(0,0,0,0.01); /* capte les événements pointeur */
}
.ida-anno {
	position: absolute;
	box-sizing: border-box;
}
.ida-anno--highlight {
	opacity: 0.38;
	mix-blend-mode: multiply;
	border-radius: 2px;
	cursor: pointer;
}
.ida-anno--ghost {
	opacity: 0.3;
	pointer-events: none;
}
.ida-anno--note {
	width: 26px;
	height: 26px;
	transform: translate(-50%, -50%);
	border: none;
	border-radius: 50% 50% 50% 0;
	font-size: 13px;
	line-height: 26px;
	text-align: center;
	cursor: pointer;
	box-shadow: 0 1px 4px rgba(0,0,0,.4);
}

/* ── RGAA / WCAG 2.3.3 — respect de prefers-reduced-motion ──────────── */
@media (prefers-reduced-motion: reduce) {
	.ida-pdf-presentation-ring *,
	.ida-pdf-resume-toast,
	.ida-anno,
	.ida-anno-layer * {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
	}
}

/* Les annotations sont des <button> (accessibilité clavier) — reset des
 * styles natifs pour préserver le rendu visuel des surlignages. */
.ida-anno--highlight {
	border: none;
	padding: 0;
	font: inherit;
	appearance: none;
	-webkit-appearance: none;
}
.ida-anno:focus-visible {
	outline: 2px solid #1e6ee8;
	outline-offset: 1px;
	opacity: 0.6;
}

/* Fix : les annotations doivent recevoir les clics même quand la couche
 * est en pointer-events:none (hors mode dessin). */
.ida-anno {
	pointer-events: auto;
}

/* Popover inline (saisie de note / confirmation de suppression) */
.ida-anno-popover {
	position: absolute;
	z-index: 10;
	min-width: 200px;
	max-width: 280px;
	padding: 10px;
	background: #fff;
	color: #1e1e1e;
	border: 1px solid #ccc;
	border-radius: 6px;
	box-shadow: 0 4px 16px rgba(0,0,0,.25);
	pointer-events: auto;
	font-size: 13px;
}
.ida-anno-popover-input {
	width: 100%;
	box-sizing: border-box;
	margin-bottom: 8px;
	font: inherit;
}
.ida-anno-popover-text {
	margin: 0 0 8px;
	white-space: pre-wrap;
	word-break: break-word;
}
.ida-anno-popover-actions {
	display: flex;
	gap: 6px;
	justify-content: flex-end;
}
.ida-anno-popover-btn {
	padding: 4px 10px;
	border: 1px solid #ccc;
	border-radius: 4px;
	background: #f6f7f7;
	cursor: pointer;
	font: inherit;
}
.ida-anno-popover-btn--primary {
	background: #1e6ee8;
	border-color: #1e6ee8;
	color: #fff;
}
.ida-anno-popover-btn:focus-visible {
	outline: 2px solid #1e6ee8;
	outline-offset: 1px;
}
@media (prefers-color-scheme: dark) {
	.ida-anno-popover { background: #2a2a2a; color: #eee; border-color: #555; }
	.ida-anno-popover-btn { background: #3a3a3a; border-color: #555; color: #eee; }
	.ida-anno-popover-btn--primary { background: #1e6ee8; color: #fff; }
}

/* #5 — Filigrane dynamique par visiteur (Pro) : dissuasion contre les captures. */
.ida-pdf-wrapper{position:relative}
.ida-pdf-wm-overlay{position:absolute;inset:0;pointer-events:none;overflow:hidden;z-index:6}
.ida-pdf-wm-overlay span{position:absolute;inset:-45%;transform:rotate(-28deg);display:block;font-size:13px;font-weight:700;line-height:3.4;letter-spacing:.05em;word-spacing:1.4em;color:rgba(30,20,40,.11);text-align:center;overflow:hidden;-webkit-user-select:none;user-select:none}
.ida-pdf-wm-lightbox{z-index:100000}
.ida-pdf-wm-lightbox span{color:rgba(255,255,255,.16)}
@media (prefers-color-scheme:dark){.ida-pdf-wm-overlay span{color:rgba(255,255,255,.12)}}

/* #6 — Soft-DRM (protection douce du contenu). */
.ida-pdf-protected,.ida-pdf-protected *{-webkit-user-select:none;user-select:none}
.ida-pdf-protected .ida-pdf-download-wrap{display:none!important}
.ida-lb-protected #ida-lb-download,.ida-lb-protected #ida-lb-print{display:none!important}
@media print{
	.ida-pdf-protected>*{visibility:hidden!important}
	.ida-pdf-protected{position:relative}
	.ida-pdf-protected::after{content:"Protected document — printing is disabled.";visibility:visible;display:block;padding:24px;font-weight:700;color:#000}
}

/* #11 — CTA de fin de document (Pro). */
.ida-pdf-cta{position:absolute;left:0;right:0;bottom:14px;display:flex;justify-content:center;z-index:7;pointer-events:none}
.ida-pdf-cta[hidden]{display:none}
.ida-pdf-cta-btn{pointer-events:auto;background:var(--ida-accent,#da740f);color:#fff;font-weight:700;padding:.7em 1.5em;border-radius:10px;text-decoration:none;box-shadow:0 8px 22px rgba(0,0,0,.28);transition:transform .12s ease}
.ida-pdf-cta-btn:hover{transform:translateY(-2px)}
@media (prefers-reduced-motion:reduce){.ida-pdf-cta-btn{transition:none}}

/* #7 — Gating progressif : mur de fin d'aperçu. */
.ida-pdf-gate{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;background:rgba(251,250,247,.94);z-index:8;text-align:center;padding:24px;border-radius:8px}
.ida-pdf-gate[hidden]{display:none}
.ida-pdf-gate-msg{font-weight:600;max-width:30em;margin:0;line-height:1.5}
@media (prefers-color-scheme:dark){.ida-pdf-gate{background:rgba(20,18,24,.94);color:#eee}}

/* #4 — Accès par achat / adhésion. */
.ida-pdf-purchase-gate{display:flex;flex-direction:column;align-items:center;gap:14px;padding:32px 22px;border:1px dashed var(--ida-border,#ae510c);border-radius:10px;background:var(--ida-card,#fbfaf7);text-align:center}
.ida-pdf-purchase-gate p{margin:0;font-weight:600}
@media (prefers-color-scheme:dark){.ida-pdf-purchase-gate{background:#26242a;color:#eee}}
