/**
 * Attachment Viewer Styles for PNPC Pocket Service Desk
 *
 * @package PNPC_Pocket_Service_Desk
 */

/* ========================================
   Attachment List Styles
   ======================================== */

.pnpc-psd-attachments {
	margin: 20px 0;
}

.pnpc-psd-attachments h3 {
	margin-bottom: 15px;
	font-size: 16px;
	font-weight: 600;
}

.pnpc-psd-attachment {
	display: flex;
	align-items: center;
	gap: 15px;
	padding: 15px;
	border: 1px solid #ddd;
	border-radius: 4px;
	margin-bottom: 10px;
	background: #fff;
	transition: background-color 0.2s ease;
}

.pnpc-psd-attachment:hover {
	background-color: #f9f9f9;
}

.pnpc-psd-attachment-thumbnail {
	width: 80px;
	height: 80px;
	object-fit: cover;
	border-radius: 4px;
	cursor: pointer;
	transition: transform 0.2s ease;
	flex-shrink: 0;
}

.pnpc-psd-attachment-thumbnail:hover {
	transform: scale(1.05);
}

.pnpc-psd-attachment-icon {
	font-size: 48px;
	width: 80px;
	height: 80px;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	flex-shrink: 0;
}

.pnpc-psd-attachment-info {
	flex: 1;
	min-width: 0; /* Allow text truncation */
}

.pnpc-psd-attachment-info strong {
	display: block;
	font-size: 14px;
	font-weight: 600;
	margin-bottom: 5px;
	word-break: break-word;
}

.pnpc-psd-attachment-meta {
	display: block;
	font-size: 13px;
	color: #666;
	margin-top: 5px;
}

.pnpc-psd-attachment-warning {
	display: block;
	font-size: 12px;
	color: #d63638;
	margin-top: 5px;
	font-weight: 500;
}

.pnpc-psd-attachment-actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	flex-shrink: 0;
}

.pnpc-psd-attachment-actions .button {
	white-space: nowrap;
}

/* ========================================
   Lightbox / Modal Styles
   ======================================== */

.pnpc-psd-lightbox {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 9999; /* High z-index for modal overlay */
	display: none;
}

.pnpc-psd-lightbox.pnpc-psd-lightbox-active {
	display: block;
}

.pnpc-psd-lightbox-backdrop {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.9);
	cursor: pointer;
}

.pnpc-psd-lightbox-content {
	position: relative;
	width: 90%;
	max-width: 1200px;
	height: 90%;
	margin: 5% auto;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	pointer-events: none;
}

.pnpc-psd-lightbox-content > * {
	pointer-events: auto;
}

/* Image Container */
.pnpc-psd-lightbox-image-container {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	max-width: 100%;
	max-height: 100%;
}

.pnpc-psd-lightbox-image {
	max-width: 100%;
	max-height: 80vh;
	object-fit: contain;
	border-radius: 4px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* PDF Container */
.pnpc-psd-lightbox-pdf-container {
	width: 100%;
	height: 85vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.pnpc-psd-lightbox-pdf {
	width: 100%;
	height: 100%;
	border: none;
	border-radius: 4px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
	background: #fff;
}

.pnpc-psd-pdf-fallback {
	text-align: center;
	background: #fff;
	padding: 40px;
	border-radius: 4px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.pnpc-psd-pdf-fallback p {
	font-size: 16px;
	margin-bottom: 20px;
	color: #333;
}

/* Close Button */
.pnpc-psd-lightbox-close {
	position: absolute;
	top: 20px;
	right: 20px;
	background: rgba(255, 255, 255, 0.9);
	border: none;
	font-size: 36px;
	line-height: 1;
	width: 50px;
	height: 50px;
	border-radius: 50%;
	cursor: pointer;
	z-index: 10;
	transition: background-color 0.2s ease, transform 0.2s ease;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #333;
}

.pnpc-psd-lightbox-close:hover {
	background: #fff;
	transform: rotate(90deg);
}

.pnpc-psd-lightbox-close:focus {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

/* Navigation Arrows */
.pnpc-psd-lightbox-prev,
.pnpc-psd-lightbox-next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(255, 255, 255, 0.9);
	border: none;
	font-size: 48px;
	line-height: 1;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	cursor: pointer;
	z-index: 10;
	transition: background-color 0.2s ease, transform 0.2s ease;
	padding: 0;
	display: none; /* Hidden by default, shown via JS when needed */
	align-items: center;
	justify-content: center;
	color: #333;
}

.pnpc-psd-lightbox-prev.pnpc-psd-show,
.pnpc-psd-lightbox-next.pnpc-psd-show {
	display: flex;
}

.pnpc-psd-lightbox-prev:hover,
.pnpc-psd-lightbox-next:hover {
	background: #fff;
	transform: translateY(-50%) scale(1.1);
}

.pnpc-psd-lightbox-prev:focus,
.pnpc-psd-lightbox-next:focus {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

.pnpc-psd-lightbox-prev {
	left: 20px;
}

.pnpc-psd-lightbox-next {
	right: 20px;
}

.pnpc-psd-lightbox-prev:disabled,
.pnpc-psd-lightbox-next:disabled {
	opacity: 0.3;
	cursor: not-allowed;
}

/* Caption and Counter */
.pnpc-psd-lightbox-caption {
	position: absolute;
	bottom: 20px;
	left: 50%;
	transform: translateX(-50%);
	background: rgba(0, 0, 0, 0.8);
	color: #fff;
	padding: 10px 20px;
	border-radius: 4px;
	display: flex;
	gap: 20px;
	align-items: center;
	max-width: 80%;
	flex-wrap: wrap;
	justify-content: center;
}

.pnpc-psd-lightbox-filename {
	font-size: 14px;
	word-break: break-word;
}

.pnpc-psd-lightbox-counter {
	font-size: 13px;
	color: #ccc;
	white-space: nowrap;
}

/* Download Button in Lightbox */
.pnpc-psd-lightbox-download {
	position: absolute;
	top: 20px;
	left: 20px;
	background: rgba(255, 255, 255, 0.9);
	color: #333;
	border: none;
	padding: 10px 20px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	transition: background-color 0.2s ease;
	z-index: 10;
	display: inline-flex;
	align-items: center;
	gap: 5px;
}

.pnpc-psd-lightbox-download:hover {
	background: #fff;
	color: #333;
	text-decoration: none;
}

.pnpc-psd-lightbox-download:focus {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

/* Prevent body scroll when lightbox open */
body.pnpc-psd-lightbox-open {
	overflow: hidden;
}

/* ========================================
   Response Attachments
   ======================================== */

.pnpc-psd-response-attachments {
	margin-top: 10px;
	padding-top: 10px;
	border-top: 1px solid #e0e0e0;
}

.pnpc-psd-response-attachments strong {
	display: block;
	margin-bottom: 10px;
	font-size: 13px;
}

/* Compact attachment view for responses */
.pnpc-psd-response-attachments .pnpc-psd-attachment {
	padding: 10px;
	margin-bottom: 8px;
}

.pnpc-psd-response-attachments .pnpc-psd-attachment-thumbnail {
	width: 60px;
	height: 60px;
}

.pnpc-psd-response-attachments .pnpc-psd-attachment-icon {
	font-size: 36px;
	width: 60px;
	height: 60px;
}

/* ========================================
   Responsive Styles
   ======================================== */

@media (max-width: 768px) {
	.pnpc-psd-attachment {
		flex-direction: column;
		text-align: center;
		padding: 12px;
	}

	.pnpc-psd-attachment-actions {
		width: 100%;
		justify-content: center;
	}

	.pnpc-psd-lightbox-content {
		width: 95%;
		height: 95%;
		margin: 2.5% auto;
	}

	.pnpc-psd-lightbox-image {
		max-height: 70vh;
	}

	.pnpc-psd-lightbox-pdf-container {
		height: 75vh;
	}

	.pnpc-psd-lightbox-prev,
	.pnpc-psd-lightbox-next {
		width: 40px;
		height: 40px;
		font-size: 32px;
	}

	.pnpc-psd-lightbox-prev {
		left: 10px;
	}

	.pnpc-psd-lightbox-next {
		right: 10px;
	}

	.pnpc-psd-lightbox-close {
		width: 40px;
		height: 40px;
		font-size: 28px;
		top: 10px;
		right: 10px;
	}

	.pnpc-psd-lightbox-download {
		top: 10px;
		left: 10px;
		padding: 8px 15px;
		font-size: 13px;
	}

	.pnpc-psd-lightbox-caption {
		bottom: 10px;
		padding: 8px 15px;
		font-size: 12px;
		max-width: 90%;
	}
}

@media (max-width: 480px) {
	.pnpc-psd-attachment-thumbnail {
		width: 60px;
		height: 60px;
	}

	.pnpc-psd-attachment-icon {
		font-size: 36px;
		width: 60px;
		height: 60px;
	}

	.pnpc-psd-lightbox-download {
		position: relative;
		top: auto;
		left: auto;
		margin-bottom: 10px;
	}

	.pnpc-psd-lightbox-caption {
		position: relative;
		bottom: auto;
		left: auto;
		transform: none;
		margin-top: 10px;
	}
}

/* ========================================
   Loading State
   ======================================== */

.pnpc-psd-lightbox-loading {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	color: #fff;
	font-size: 18px;
}

/* ========================================
   Accessibility
   ======================================== */

.pnpc-psd-lightbox button:focus,
.pnpc-psd-lightbox a:focus {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

/* Screen reader only text */
.pnpc-psd-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border-width: 0;
}
