/* Document Page Manager - Frontend Styles */

/* ---------------------------------------------------------------------------
 * Full-bleed layout (breaks out of the theme content container to full width)
 * Scoped to the plugin only so the theme header/nav is never affected.
 * ------------------------------------------------------------------------- */
.dpm-document-page {
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	padding: 0;
	box-sizing: border-box;
}

.dpm-document-page * {
	box-sizing: border-box;
}

/* Hide the theme page-title / breadcrumb hero on document pages only.
 * (These selectors target page-title areas, never the site header/nav.) */
body.dpm-document-active .entry-header,
body.dpm-document-active .page-title,
body.dpm-document-active .page-header-title,
body.dpm-document-active .page-title-bar,
body.dpm-document-active .breadcrumb,
body.dpm-document-active .breadcrumbs,
body.dpm-document-active .elementor-page-title,
body.dpm-document-active .wp-block-post-title {
	display: none !important;
}

body.dpm-modal-open {
	overflow: hidden !important;
	position: fixed !important;
	width: 100% !important;
	height: 100% !important;
	left: 0;
	right: 0;
	overscroll-behavior: none;
}

/* ---------------------------------------------------------------------------
 * Hero Slider
 * ------------------------------------------------------------------------- */
.dpm-hero-slider {
	position: relative;
	width: 100%;
	overflow: hidden;
	background: #fff;
	height: 180px;
	margin-bottom: 0;
}

.dpm-hero-slide {
	display: none;
	width: 100%;
	height: 100%;
}

.dpm-hero-slide.is-active {
	display: block;
}

.dpm-hero-slide-inner {
	display: grid;
	grid-template-columns: minmax(300px, 40%) 1fr;
	gap: 0;
	align-items: stretch;
	height: 100%;
}

.dpm-hero-text {
	padding: 20px 40px;
	background: #f5f5f5;
	display: flex;
	align-items: center;
	font-size: 14px;
	line-height: 1.6;
}

.dpm-hero-image {
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
}

.dpm-hero-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.dpm-hero-prev,
.dpm-hero-next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(0, 0, 0, 0.45);
	color: #fff;
	border: none;
	width: 40px;
	height: 40px;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.3s;
	z-index: 10;
}

.dpm-hero-prev:hover,
.dpm-hero-next:hover {
	background: rgba(0, 0, 0, 0.7);
}

.dpm-hero-prev { left: 10px; }
.dpm-hero-next { right: 10px; }

/* ---------------------------------------------------------------------------
 * Menu Navigation (full width)
 * ------------------------------------------------------------------------- */
.dpm-menu-nav-wrap {
	background: #fff;
	border-bottom: 2px solid #e5e5e5;
	display: flex;
	align-items: center;
	width: 100%;
	padding: 0 4%;
}

.dpm-menu-nav {
	flex: 1;
	display: flex;
	gap: 0;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.dpm-menu-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 16px 20px;
	background: none;
	border: none;
	border-bottom: 3px solid transparent;
	cursor: pointer;
	transition: all 0.3s;
	white-space: nowrap;
	color: #555;
	font-size: 13px;
	font-weight: 500;
	min-width: 100px;
}

.dpm-menu-item i {
	font-size: 24px;
	margin-bottom: 6px;
	display: block;
}

.dpm-menu-item-logo {
	width: 32px;
	height: 32px;
	object-fit: contain;
	margin-bottom: 6px;
	display: block;
}

.dpm-menu-item:hover {
	color: #000;
	background: #f9f9f9;
}

.dpm-menu-item.is-active {
	color: #2271b1;
	border-bottom-color: #2271b1;
	background: #f0f6fc;
}

/* Search Box in Menu */
.dpm-search-tools {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-left: 20px;
	padding: 10px 0 10px 20px;
	border-left: 1px solid #e5e5e5;
	flex-shrink: 0;
}

.dpm-sort-box {
	display: flex;
	align-items: center;
}

.dpm-sort-select {
	min-width: 130px;
	padding: 8px 10px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 14px;
	background: #fff;
	color: #333;
	cursor: pointer;
}

.dpm-sort-select:focus {
	outline: none;
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
}

.dpm-search-box {
	display: flex;
	align-items: center;
	gap: 5px;
	padding: 0;
	margin-left: 0;
	border-left: none;
}

.dpm-search-input {
	width: 280px;
	padding: 8px 12px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 14px;
	transition: border-color 0.3s, box-shadow 0.3s;
}

.dpm-search-input:focus {
	outline: none;
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
}

.dpm-search-btn {
	background: #2271b1;
	color: #fff;
	border: none;
	width: 40px;
	height: 40px;
	border-radius: 4px;
	cursor: pointer;
	transition: background 0.3s;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
}

.dpm-search-btn:hover { background: #135e96; }
.dpm-search-btn i { font-size: 18px; }

/* ---------------------------------------------------------------------------
 * Content area (full width)
 * ------------------------------------------------------------------------- */
.dpm-content-panels {
	width: 100%;
	padding: 40px 4% 60px;
}

.dpm-content-panel { display: none; }
.dpm-content-panel.is-active { display: block; }

.dpm-empty {
	text-align: center;
	color: #999;
	padding: 40px 20px;
	font-style: italic;
}

/* ---------------------------------------------------------------------------
 * Cards grid (collection covers)
 * ------------------------------------------------------------------------- */
.dpm-cards-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 28px;
}

.dpm-collection-card {
	background: #fff;
	border-radius: 4px;
	transition: transform 0.25s ease;
}

.dpm-collection-card:hover {
	transform: translateY(-4px);
}

.dpm-collection-open,
.dpm-video-open,
.dpm-pdf-open {
	display: block;
	width: 100%;
	border: none;
	background: none;
	padding: 0;
	margin: 0;
	cursor: pointer;
	text-align: center;
}

.dpm-collection-cover {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	aspect-ratio: 4 / 3;
	background: #fff;
	overflow: hidden;
	position: relative;
}

.dpm-collection-cover img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
}

.dpm-collection-info {
	display: block;
	padding: 14px 8px 4px;
}

.dpm-collection-name {
	display: block;
	font-size: 15px;
	font-weight: 600;
	color: #222;
	line-height: 1.3;
}

.dpm-collection-count {
	display: block;
	font-size: 12px;
	color: #888;
	margin-top: 4px;
}

/* PDF card - A4 first-page preview */
.dpm-pdf-card .dpm-pdf-cover {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1.414;
	background: #fff;
	border: 1px solid #e5e5e5;
	overflow: hidden;
	position: relative;
}

.dpm-pdf-card .dpm-pdf-cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: top center;
	display: block;
}

.dpm-pdf-firstpage {
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
	pointer-events: none;
}

/* Transparent layer so a click opens the popup instead of the embedded viewer */
.dpm-pdf-clickguard {
	position: absolute;
	inset: 0;
	z-index: 2;
	cursor: pointer;
}

/* Video play icon */
.dpm-video-play-icon {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 60px;
	height: 60px;
	background: rgba(255, 0, 0, 0.9);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 32px;
	pointer-events: none;
	transition: background 0.3s;
}

.dpm-video-open:hover .dpm-video-play-icon {
	background: rgba(255, 0, 0, 1);
}

/* File-type icon badge (top-left of the cover) */
.dpm-type-icon {
	position: absolute;
	top: 8px;
	left: 8px;
	z-index: 3;
	width: 28px;
	height: 28px;
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.92);
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
	display: flex;
	align-items: center;
	justify-content: center;
	color: #444;
}

.dpm-type-icon .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
	line-height: 18px;
}

.dpm-type-icon--document { color: #c0392b; }
.dpm-type-icon--video { color: #e74c3c; }
.dpm-type-icon--photo { color: #2271b1; }

/* Slide with a filled background (color or photo) */
.dpm-hero-slide.dpm-has-bg .dpm-hero-slide-inner {
	grid-template-columns: 1fr;
}

.dpm-hero-slide.dpm-has-bg .dpm-hero-text {
	background: transparent;
}

.dpm-hero-slide.dpm-has-bg .dpm-hero-image {
	display: none;
}

/* ---------------------------------------------------------------------------
 * Photo collection popup (light background, image left / info right)
 * ------------------------------------------------------------------------- */
.dpm-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.dpm-lightbox[hidden] { display: none; }

.dpm-lightbox-overlay {
	position: absolute;
	inset: 0;
	background: rgba(20, 20, 20, 0.2);
	z-index: 1;
}

.dpm-lightbox-dialog {
	position: relative;
	z-index: 2;
	background: #fff;
	border-radius: 6px;
	width: min(1120px, 96vw);
	max-height: 92vh;
	display: flex;
	overflow: hidden;
	box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.dpm-lightbox-close {
	position: absolute;
	top: 12px;
	right: 14px;
	background: transparent;
	color: #333;
	border: none;
	width: 36px;
	height: 36px;
	font-size: 30px;
	line-height: 1;
	cursor: pointer;
	z-index: 10;
}

.dpm-lightbox-close:hover { color: #000; }

.dpm-lightbox-left {
	flex: 1 1 auto;
	min-width: 0;
	padding: 28px;
	display: flex;
	flex-direction: column;
}

.dpm-lightbox-stage {
	position: relative;
	flex: 0 0 auto;
	height: 58vh;
	max-height: 520px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #fff;
}

.dpm-lightbox-image {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
}

.dpm-lightbox-prev,
.dpm-lightbox-next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(0, 0, 0, 0.06);
	color: #333;
	border: none;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s;
	z-index: 3;
}

.dpm-lightbox-prev { left: 0; }
.dpm-lightbox-next { right: 0; }

.dpm-lightbox-prev:hover,
.dpm-lightbox-next:hover {
	background: rgba(0, 0, 0, 0.14);
}

.dpm-lightbox-counter {
	text-align: center;
	font-size: 12px;
	color: #888;
	padding: 12px 0 8px;
}

.dpm-lightbox-thumbnails {
	display: flex;
	gap: 10px;
	overflow-x: auto;
	padding-bottom: 6px;
}

.dpm-lightbox-thumb {
	flex-shrink: 0;
	width: 72px;
	height: 72px;
	border-radius: 4px;
	overflow: hidden;
	cursor: pointer;
	border: 2px solid transparent;
	background: #f5f5f5;
	padding: 0;
}

.dpm-lightbox-thumb:hover { border-color: #bbb; }
.dpm-lightbox-thumb.is-active { border-color: #2271b1; }

.dpm-lightbox-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.dpm-lightbox-right {
	flex: 0 0 330px;
	max-width: 330px;
	border-left: 1px solid #eee;
	padding: 34px 26px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.dpm-lightbox-card-name {
	font-size: 22px;
	font-weight: 700;
	color: #1a1a1a;
	margin: 0 0 6px;
}

.dpm-lightbox-photo-name {
	font-size: 13px;
	color: #777;
	margin-bottom: 18px;
}

.dpm-lightbox-desc {
	flex: 1 1 auto;
	overflow-y: auto;
	font-size: 14px;
	line-height: 1.7;
	color: #444;
	margin-bottom: 16px;
}

.dpm-lightbox-desc p { margin: 0 0 12px; }

/* Download actions pinned to the bottom of the info panel */
.dpm-lightbox-actions {
	margin-top: auto;
	flex-shrink: 0;
	padding-top: 16px;
	border-top: 1px solid #e5e5e5;
}

.dpm-lightbox-action-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 8px 0;
}

.dpm-lightbox-action-label {
	font-size: 14px;
	font-weight: 600;
	color: #222;
}

.dpm-btn-filled,
.dpm-btn-outline {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
	padding: 9px 24px;
	border-radius: 22px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s, color 0.2s;
	white-space: nowrap;
}

.dpm-btn-filled {
	background: #111;
	color: #fff;
	border: 1px solid #111;
}

.dpm-btn-filled:hover { background: #333; border-color: #333; color: #fff; }

.dpm-btn-outline {
	background: transparent;
	color: #111;
	border: 1px solid #111;
}

.dpm-btn-outline:hover { background: #111; color: #fff; }

/* ---------------------------------------------------------------------------
 * PDF popup (same page)
 * ------------------------------------------------------------------------- */
.dpm-pdf-popup {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	/* Keep touch gestures inside the popup on iOS */
	touch-action: none;
	overscroll-behavior: none;
}

.dpm-pdf-popup[hidden] { display: none; }

.dpm-pdf-overlay {
	position: absolute;
	inset: 0;
	background: rgba(20, 20, 20, 0.35);
	z-index: 1;
}

.dpm-pdf-dialog {
	position: relative;
	z-index: 2;
	background: #fff;
	border-radius: 6px;
	width: min(900px, 96vw);
	height: 92vh;
	height: 92dvh;
	max-height: 92vh;
	max-height: 92dvh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
	/* Critical for iOS flex + iframe height calculation */
	min-height: 0;
	touch-action: auto;
}

.dpm-pdf-bar {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 18px;
	border-bottom: 1px solid #eee;
	background: #fafafa;
	gap: 10px;
}

.dpm-pdf-title {
	font-size: 15px;
	font-weight: 600;
	color: #222;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	min-width: 0;
	flex: 1 1 auto;
}

.dpm-pdf-actions {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-shrink: 0;
}

.dpm-pdf-download {
	background: #111;
	color: #fff;
	text-decoration: none;
	padding: 7px 16px;
	border-radius: 20px;
	font-size: 13px;
	font-weight: 600;
}

.dpm-pdf-download:hover { background: #333; color: #fff; }

.dpm-pdf-close {
	background: transparent;
	border: none;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: #555;
}

.dpm-pdf-close:hover { color: #000; }

/* Wrapper gives the iframe a real bounded box on iOS Safari */
.dpm-pdf-frame-wrap {
	flex: 1 1 auto;
	min-height: 0;
	position: relative;
	width: 100%;
	overflow: hidden;
	-webkit-overflow-scrolling: touch;
	touch-action: pan-x pan-y;
	overscroll-behavior: contain;
	background: #525659;
}

.dpm-pdf-frame {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
	background: #525659;
}

.dpm-pdf-frame[hidden] { display: none; }

/* Canvas-based renderer (used on iOS/iPadOS where iframe PDFs don't scroll) */
.dpm-pdf-canvas {
	position: absolute;
	inset: 0;
	overflow-y: auto;
	overflow-x: hidden;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	background: #525659;
	text-align: center;
	padding: 12px 0 24px;
}

.dpm-pdf-canvas[hidden] { display: none; }

.dpm-pdf-canvas-status {
	color: #e8e8e8;
	font-size: 13px;
	padding: 18px 12px;
}

.dpm-pdf-canvas-status[hidden] { display: none; }

.dpm-pdf-canvas-pages {
	display: block;
}

.dpm-pdf-page-canvas {
	display: block;
	margin: 0 auto 12px;
	max-width: 100%;
	height: auto;
	background: #fff;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

@media (max-width: 767px) {
	.dpm-pdf-popup {
		padding: 10px;
		/* Use safe areas on notched iPhones */
		padding-top: max(10px, env(safe-area-inset-top));
		padding-bottom: max(10px, env(safe-area-inset-bottom));
	}

	.dpm-pdf-dialog {
		width: 100%;
		height: calc(100vh - 20px);
		height: calc(100dvh - 20px);
		max-height: calc(100vh - 20px);
		max-height: calc(100dvh - 20px);
		border-radius: 4px;
	}

	.dpm-pdf-bar {
		padding: 10px 12px;
	}

	.dpm-pdf-title {
		font-size: 13px;
	}

	.dpm-pdf-download {
		padding: 6px 12px;
		font-size: 12px;
	}
}

/* ---------------------------------------------------------------------------
 * Video popup
 * ------------------------------------------------------------------------- */
.dpm-video-popup {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.dpm-video-popup[hidden] { display: none; }

.dpm-video-overlay {
	position: absolute;
	inset: 0;
	background: rgba(10, 10, 10, 0.6);
	z-index: 1;
}

.dpm-video-dialog {
	position: relative;
	z-index: 2;
	width: 90vw;
	max-width: 1100px;
	aspect-ratio: 16 / 9;
}

.dpm-video-close {
	position: absolute;
	top: -44px;
	right: 0;
	background: rgba(255, 255, 255, 0.2);
	color: #fff;
	border: none;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
}

.dpm-video-close:hover { background: rgba(255, 255, 255, 0.35); }

.dpm-video-container {
	width: 100%;
	height: 100%;
}

.dpm-video-container iframe {
	width: 100%;
	height: 100%;
	border: 0;
}

/* ---------------------------------------------------------------------------
 * Search results (grouped by category)
 * ------------------------------------------------------------------------- */
.dpm-search-results {
	width: 100%;
	padding: 30px 4% 60px;
}

.dpm-search-results[hidden] { display: none; }

.dpm-search-results-head {
	margin-bottom: 24px;
	padding-bottom: 14px;
	border-bottom: 1px solid #e5e5e5;
}

.dpm-search-results-stats {
	font-size: 15px;
	color: #666;
}

.dpm-search-results-stats strong { color: #2271b1; }

.dpm-search-group {
	margin-bottom: 44px;
}

.dpm-search-group-label {
	display: inline-block;
	border: 1px solid #2271b1;
	color: #2271b1;
	padding: 4px 14px;
	border-radius: 4px;
	font-size: 14px;
	font-weight: 600;
	margin-bottom: 20px;
}

/* ---------------------------------------------------------------------------
 * Responsive
 * ------------------------------------------------------------------------- */
@media (max-width: 900px) {
	.dpm-lightbox-dialog {
		flex-direction: column;
		overflow-y: auto;
	}

	.dpm-lightbox-right {
		flex: 1 1 auto;
		max-width: none;
		border-left: none;
		border-top: 1px solid #eee;
		overflow: visible;
	}

	.dpm-lightbox-desc {
		flex: 0 0 auto;
		overflow-y: visible;
	}

	.dpm-lightbox-stage {
		height: 44vh;
	}
}

@media (max-width: 768px) {
	.dpm-hero-slide-inner {
		grid-template-columns: 1fr;
		height: auto;
	}

	.dpm-hero-text { padding: 15px 20px; }
	.dpm-hero-image { height: 160px; }

	.dpm-menu-nav-wrap {
		flex-direction: column;
		align-items: stretch;
		padding: 0;
	}

	.dpm-menu-nav { padding: 0 10px; }

	.dpm-menu-item {
		min-width: 80px;
		padding: 12px 15px;
		font-size: 12px;
	}

	.dpm-menu-item i { font-size: 20px; }

	.dpm-search-tools {
		border-left: none;
		border-top: 1px solid #e5e5e5;
		margin-left: 0;
		padding: 10px 15px;
		width: 100%;
		flex-wrap: wrap;
	}

	.dpm-search-box {
		border-left: none;
		border-top: none;
		margin-left: 0;
		padding: 0;
		width: auto;
		flex: 1;
		min-width: 180px;
	}

	.dpm-search-input { flex: 1; width: auto; }

	.dpm-cards-grid {
		grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
		gap: 18px;
	}
}
