/* לשכת סוכני ביטוח – שער סוכנים */

.lag-card,
.lag-library,
.lag-inline-viewer {
	--lag-brand: #0b5fa5;
	--lag-ink: #16212b;
	--lag-muted: #5b6b7a;
	--lag-line: #dfe6ed;
	--lag-bg: #ffffff;
	--lag-radius: 14px;
	direction: rtl;
	font-family: inherit;
	box-sizing: border-box;
}

.lag-card *,
.lag-library *,
.lag-viewer *,
.lag-inline-viewer * {
	box-sizing: border-box;
}

/* ---------- login card ---------- */

.lag-card {
	max-width: 460px;
	margin: 0 auto;
	background: var(--lag-bg);
	border: 1px solid var(--lag-line);
	border-radius: var(--lag-radius);
	padding: 28px;
	box-shadow: 0 10px 30px rgba(16, 33, 48, .07);
}

.lag-title {
	margin: 0 0 8px;
	font-size: 1.35rem;
	color: var(--lag-ink);
}

.lag-intro {
	margin: 0 0 18px;
	color: var(--lag-muted);
	font-size: .95rem;
	line-height: 1.6;
}

.lag-label {
	display: block;
	margin-bottom: 6px;
	font-weight: 600;
	color: var(--lag-ink);
	font-size: .9rem;
}

.lag-input {
	width: 100%;
	padding: 12px 14px;
	border: 1px solid var(--lag-line);
	border-radius: 10px;
	font-size: 1.05rem;
	letter-spacing: .06em;
	direction: ltr;
	text-align: center;
	background: #fbfcfe;
	color: var(--lag-ink);
	transition: border-color .15s, box-shadow .15s;
}

.lag-input:focus {
	outline: none;
	border-color: var(--lag-brand);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--lag-brand) 18%, transparent);
}

.lag-btn {
	display: block;
	width: 100%;
	margin-top: 14px;
	padding: 12px 18px;
	border: 1px solid var(--lag-brand);
	border-radius: 10px;
	background: var(--lag-brand);
	color: #fff;
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
	transition: filter .15s, opacity .15s;
}

.lag-btn:hover:not(:disabled) { filter: brightness(1.08); }
.lag-btn:disabled { opacity: .6; cursor: default; }

.lag-btn-ghost {
	background: transparent;
	color: var(--lag-brand);
}

.lag-link {
	display: block;
	width: 100%;
	margin-top: 10px;
	background: none;
	border: 0;
	color: var(--lag-muted);
	font-size: .85rem;
	text-decoration: underline;
	cursor: pointer;
}

.lag-message {
	margin: 14px 0 0;
	min-height: 1.2em;
	font-size: .9rem;
	line-height: 1.5;
}

.lag-message.is-error { color: #b3261e; }
.lag-message.is-ok { color: #1a7f37; }

.lag-otp-sent {
	margin: 0 0 4px;
	color: var(--lag-ink);
	font-size: .95rem;
}

.lag-otp-sent strong { direction: ltr; unicode-bidi: embed; letter-spacing: .08em; }

.lag-otp-hint {
	margin: 0 0 14px;
	color: var(--lag-muted);
	font-size: .82rem;
	line-height: 1.5;
}

.lag-captcha {
	display: flex;
	justify-content: center;
	margin-top: 14px;
	min-height: 78px;
}

.lag-notice {
	text-align: center;
	color: var(--lag-muted);
}

/* ---------- library grid ---------- */

.lag-library {
	display: grid;
	grid-template-columns: repeat(var(--lag-cols, 3), minmax(0, 1fr));
	gap: 26px;
	margin: 0 0 24px;
}

@media (max-width: 900px) { .lag-library { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .lag-library { grid-template-columns: 1fr; } }

.lag-book { margin: 0; }

.lag-book-cover {
	position: relative;
	display: block;
	width: 100%;
	padding: 0;
	border: 1px solid var(--lag-line);
	border-radius: 10px;
	overflow: hidden;
	background: #eef2f6;
	cursor: pointer;
	aspect-ratio: 3 / 4;
	transition: transform .18s, box-shadow .18s;
}

.lag-book-cover:hover:not(:disabled) {
	transform: translateY(-3px);
	box-shadow: 0 14px 30px rgba(16, 33, 48, .16);
}

.lag-book-cover:disabled { cursor: default; opacity: .55; }

.lag-book-cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.lag-book-fallback {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	font-size: 2rem;
	font-weight: 700;
	color: #9fb0c0;
	letter-spacing: .1em;
}

.lag-book-open {
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	padding: 10px;
	background: linear-gradient(to top, rgba(11, 24, 38, .88), rgba(11, 24, 38, 0));
	color: #fff;
	font-size: .85rem;
	font-weight: 600;
	opacity: 0;
	transition: opacity .18s;
}

.lag-book-cover:hover:not(:disabled) .lag-book-open,
.lag-book-cover:focus-visible .lag-book-open { opacity: 1; }

.lag-book-title { margin: 12px 0 4px; font-size: 1.02rem; color: var(--lag-ink); }
.lag-book-desc { margin: 0 0 6px; font-size: .88rem; color: var(--lag-muted); line-height: 1.55; }
.lag-book-meta { margin: 0; font-size: .8rem; color: var(--lag-muted); }
.lag-book-meta .lag-warn { color: #b3261e; }

/* ---------- modal ---------- */

.lag-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
}

.lag-modal[hidden] { display: none; }

.lag-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(8, 16, 24, .82);
	backdrop-filter: blur(2px);
}

.lag-modal-body {
	position: relative;
	width: min(1400px, 96vw);
	height: min(94vh, 100%);
	display: flex;
	flex-direction: column;
}

.lag-modal-close {
	position: absolute;
	top: -2px;
	inset-inline-end: 0;
	z-index: 3;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .16);
	color: #fff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
}

.lag-modal-close:hover { background: rgba(255, 255, 255, .3); }

/* ---------- viewer ---------- */

.lag-viewer,
.lag-inline-viewer {
	position: relative;
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	min-height: 0;
	background: #101820;
	border-radius: 12px;
	overflow: hidden;
	color: #e7edf3;
}

.lag-inline-viewer { height: 78vh; border: 1px solid var(--lag-line); }

.lag-vw-stage {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	perspective: 2600px;
	padding: 18px;
	background: radial-gradient(ellipse at center, #1c2732 0%, #0d141b 100%);
}

.lag-vw-scroller {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.lag-vw-scroller.is-zoomed {
	display: block;
	overflow: auto;
	text-align: center;
}

.lag-vw-scroller.is-zoomed .lag-vw-book { margin: 0 auto; }

.lag-vw-book {
	position: relative;
	flex: 0 0 auto;
	direction: ltr; /* StPageFlip עובד משמאל לימין בכל מקרה */
	transition: transform .5s ease;
}

.lag-vw-book .stf__block { filter: drop-shadow(0 22px 40px rgba(0, 0, 0, .5)); }

.lag-vw-leaf {
	position: relative;
	background: #fff;
	overflow: hidden;
	user-select: none;
	-webkit-user-select: none;
}

.lag-vw-leaf canvas {
	display: block;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

.lag-vw-leaf.is-blank { background: #f4f5f7; }

.lag-vw-leaf[data-density="hard"] { background: #fdfdfd; }

/* צל עדין ליד השדרה – נותן עומק לספר פתוח */
.lag-vw-gutter {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

.lag-vw-leaf.--left .lag-vw-gutter {
	background: linear-gradient(to left, rgba(0, 0, 0, .18) 0, rgba(0, 0, 0, .06) 3%, rgba(0, 0, 0, 0) 9%);
}

.lag-vw-leaf.--right .lag-vw-gutter {
	background: linear-gradient(to right, rgba(0, 0, 0, .18) 0, rgba(0, 0, 0, .06) 3%, rgba(0, 0, 0, 0) 9%);
}

.lag-vw-loading {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 30px;
	height: 30px;
	margin: -15px 0 0 -15px;
	border: 3px solid #d9dee5;
	border-top-color: var(--lag-brand, #0b5fa5);
	border-radius: 50%;
	animation: lag-spin .8s linear infinite;
}

.lag-vw-bar {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	background: #16202a;
	border-top: 1px solid rgba(255, 255, 255, .08);
	flex-wrap: wrap;
}

.lag-vw-bar .lag-vw-title {
	font-weight: 600;
	margin-inline-end: auto;
	font-size: .95rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 40%;
}

.lag-vw-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	height: 38px;
	padding: 0 12px;
	border: 1px solid rgba(255, 255, 255, .14);
	border-radius: 9px;
	background: rgba(255, 255, 255, .06);
	color: #e7edf3;
	font-size: .9rem;
	cursor: pointer;
	transition: background .15s;
}

.lag-vw-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .16); }
.lag-vw-btn:disabled { opacity: .35; cursor: default; }
.lag-vw-btn.is-active { background: var(--lag-brand, #0b5fa5); border-color: transparent; }

.lag-vw-pageno {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: .88rem;
	color: #b9c6d2;
	white-space: nowrap;
}

.lag-vw-pageno input {
	width: 58px;
	padding: 7px;
	border: 1px solid rgba(255, 255, 255, .14);
	border-radius: 8px;
	background: rgba(255, 255, 255, .06);
	color: #fff;
	text-align: center;
	direction: ltr;
}

.lag-vw-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 46px;
	height: 76px;
	border: 0;
	border-radius: 10px;
	background: rgba(255, 255, 255, .1);
	color: #fff;
	font-size: 24px;
	cursor: pointer;
	z-index: 40;
	transition: background .15s, opacity .15s;
}

.lag-vw-nav:hover:not(:disabled) { background: rgba(255, 255, 255, .24); }
.lag-vw-nav:disabled { opacity: .2; cursor: default; }
.lag-vw-prev { inset-inline-start: 10px; }
.lag-vw-next { inset-inline-end: 10px; }

.lag-vw-thumbs {
	flex: 0 0 auto;
	display: none;
	gap: 8px;
	padding: 10px;
	overflow-x: auto;
	background: #0c141b;
	border-top: 1px solid rgba(255, 255, 255, .08);
}

.lag-vw-thumbs.is-open { display: flex; }

.lag-vw-thumb {
	flex: 0 0 auto;
	width: 72px;
	border: 2px solid transparent;
	border-radius: 6px;
	background: #fff;
	padding: 0;
	cursor: pointer;
	overflow: hidden;
}

.lag-vw-thumb.is-current { border-color: var(--lag-brand, #0b5fa5); }
.lag-vw-thumb canvas { display: block; width: 100%; }

.lag-vw-status {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	gap: 12px;
	background: rgba(13, 20, 27, .92);
	color: #dbe4ec;
	font-size: .95rem;
	z-index: 8;
}

.lag-vw-status[hidden] { display: none; }

.lag-vw-spinner {
	width: 34px;
	height: 34px;
	border: 3px solid rgba(255, 255, 255, .2);
	border-top-color: #fff;
	border-radius: 50%;
	animation: lag-spin .9s linear infinite;
}

@keyframes lag-spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
	.lag-vw-bar .lag-vw-title { display: none; }
	.lag-vw-nav { width: 38px; height: 60px; font-size: 20px; }
	.lag-card { padding: 22px 18px; }
}

@media print {
	.lag-modal, .lag-viewer, .lag-inline-viewer { display: none !important; }
}
