/**
 * FIMS Core public styles — download waiting page and sidebar blocks.
 * Neutral, theme-agnostic design; themes may override.
 */

.fims-download-wait__inner {
	max-width: 640px;
	margin: 2.5rem auto;
	padding: 2rem 1.75rem;
	text-align: center;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
}

.fims-breadcrumb {
	font-size: 0.82rem;
	margin-bottom: 1.25rem;
	text-align: left;
	color: #6b7280;
}

.fims-breadcrumb a {
	color: #2563eb;
	text-decoration: none;
}

.fims-breadcrumb a:hover {
	text-decoration: underline;
}

.fims-download-wait__title {
	font-size: 1.5rem;
	line-height: 1.3;
	margin: 0 0 1.25rem;
	color: #111827;
}

.fims-download-wait__cover img {
	max-width: 200px;
	height: auto;
	margin: 0 auto 1.25rem;
	display: block;
	border-radius: 8px;
	box-shadow: 0 2px 12px rgba(15, 23, 42, 0.1);
}

.fims-download-wait__file {
	display: inline-flex;
	flex-direction: column;
	gap: 0.2rem;
	margin: 0 auto 1.5rem;
	padding: 0.7rem 1.25rem;
	background: #f8fafc;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	max-width: 100%;
}

.fims-download-wait__file-name {
	font-weight: 600;
	font-size: 0.95rem;
	color: #1f2937;
	word-break: break-all;
}

.fims-download-wait__file-meta {
	font-size: 0.8rem;
	color: #6b7280;
}

.fims-download-wait__ad {
	margin: 1.5rem auto;
	min-height: 90px;
}

.fims-download-wait__status {
	margin-top: 0.5rem;
}

.fims-download-wait__countdown {
	font-size: 1.05rem;
	color: #374151;
	margin: 0 0 1rem;
}

.fims-download-wait__button {
	display: inline-block;
	margin-top: 0.5rem;
	padding: 0.85rem 2.5rem;
	font-size: 1.05rem;
	font-weight: 600;
	color: #fff !important;
	background: #2563eb;
	border-radius: 8px;
	text-decoration: none;
	transition: background 0.15s ease;
}

.fims-download-wait__button:hover {
	background: #1d4ed8;
	color: #fff !important;
}

.fims-download-wait__error {
	color: #b00020;
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 8px;
	padding: 0.75rem 1rem;
	font-size: 0.95rem;
}

.fims-download-wait__note {
	font-size: 0.82rem;
	color: #6b7280;
	margin-top: 1.5rem;
}

@media (max-width: 480px) {
	.fims-download-wait__inner {
		margin: 1rem auto;
		padding: 1.5rem 1rem;
		border-radius: 0;
		border-left: none;
		border-right: none;
	}

	.fims-download-wait__title {
		font-size: 1.25rem;
	}
}

.fims-sidebar-links ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.fims-sidebar-links li {
	margin-bottom: 0.5rem;
}

.fims-sidebar-banner {
	margin: 1rem 0;
}

.fims-sidebar-banner__img {
	max-width: 100%;
	height: auto;
}

/* FIMS books grid shortcode [fims_books] */
.fims-books-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 1.5rem;
	margin: 1.5rem 0;
}

.fims-book-card {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: box-shadow 0.15s ease;
}

.fims-book-card:hover {
	box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

.fims-book-card__cover-link {
	display: block;
	aspect-ratio: 3 / 4;
	background: #f8fafc;
	overflow: hidden;
}

.fims-book-card__cover {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.fims-book-card__body {
	padding: 0.9rem 1rem 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	flex: 1;
}

.fims-book-card__title {
	font-size: 0.95rem;
	line-height: 1.35;
	margin: 0;
	font-weight: 600;
}

.fims-book-card__title a {
	color: #111827;
	text-decoration: none;
}

.fims-book-card__title a:hover {
	color: #2563eb;
}

.fims-book-card__author {
	font-size: 0.82rem;
	color: #6b7280;
	margin: 0;
}

.fims-book-card__download {
	margin-top: auto;
	display: inline-block;
	text-align: center;
	padding: 0.55rem 1rem;
	font-size: 0.88rem;
	font-weight: 600;
	color: #fff !important;
	background: #2563eb;
	border-radius: 7px;
	text-decoration: none;
}

.fims-book-card__download:hover {
	background: #1d4ed8;
	color: #fff !important;
}

.fims-books-grid__empty {
	color: #6b7280;
	font-style: italic;
}

/* [fims_download_button] */
.fims-download-button {
	display: inline-block;
	padding: 0.85rem 2.5rem;
	font-size: 1.05rem;
	font-weight: 600;
	color: #fff !important;
	background: #2563eb;
	border-radius: 8px;
	text-decoration: none;
	transition: background 0.15s ease;
}

.fims-download-button:hover {
	background: #1d4ed8;
	color: #fff !important;
}

/* [fims_book_meta] */
.fims-book-meta {
	display: grid;
	gap: 0.4rem;
	margin: 1rem 0;
}

.fims-book-meta__row {
	display: flex;
	gap: 0.5rem;
	font-size: 0.95rem;
}

.fims-book-meta__row dt {
	font-weight: 600;
	color: #374151;
	margin: 0;
}

.fims-book-meta__row dd {
	margin: 0;
	color: #111827;
}

/* Single Book template: responsive + accessibility fixes (0.1.9) */

/* Stack Elementor flex containers vertically on tablet/mobile for book pages.
   The Theme Builder template's container direction controls are not reliably
   settable via automation; this guarantees a readable single-column layout. */
@media (max-width: 1024px) {
	.single-fims_book .e-con.e-flexbox-base {
		flex-direction: column !important;
	}
	.single-fims_book .e-con.e-flexbox-base > .e-con-inner {
		flex-direction: column !important;
	}
}

/* H1 contrast: override the low-contrast light-blue title on book pages. */
.single-fims_book h1.elementor-heading-title,
.single-fims_book .elementor-widget-theme-post-title h1 {
	color: #1e293b !important;
}

/* Ensure download button has comfortable tap target on mobile. */
@media (max-width: 767px) {
	.single-fims_book .fims-download-button {
		display: block;
		text-align: center;
		padding: 1rem 1.5rem;
	}
}

/* Fix broken Single Book template structure (0.1.10).
   The Theme Builder template's inner content container (ed1985c) was set to
   --flex-direction:row with 7 children (title, meta, content, button, tags,
   related books) causing overlap. Force it to column at all widths.
   Elementor uses CSS custom properties, so we override the property itself. */
.single-fims_book .elementor-element-ed1985c {
	--flex-direction: column !important;
}

/* FIMS-branded cover fallback (0.1.12) — for books without a featured image.
   Navy background with book title; clearly a placeholder, not publisher art. */
.fims-book-card__cover--fallback {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	aspect-ratio: 2 / 3;
	background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
	color: #ffffff;
	text-decoration: none;
	padding: 1.5rem 1rem;
	text-align: center;
}

.fims-book-card__fallback-title {
	font-size: 0.95rem;
	font-weight: 600;
	line-height: 1.4;
	margin-bottom: 0.75rem;
	display: -webkit-box;
	-webkit-line-clamp: 4;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.fims-book-card__fallback-brand {
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	opacity: 0.7;
	border-top: 1px solid rgba(255, 255, 255, 0.3);
	padding-top: 0.5rem;
}

/* Consistent cover aspect ratio for all card images */
.fims-book-card__cover-link img,
.fims-book-card__cover--fallback {
	aspect-ratio: 2 / 3;
	object-fit: cover;
	width: 100%;
}
