/* 
 * Document Pattern Generator Styles
 * Extracted from document_pattern_generator.html
 */
:root {
	--neutral-white: #ffffff;
	--neutral-black: #000000;
	--neutral-light-black: #636262;
	--border-grey: #cccccc;
	--neutral-lighter-grey: #f0f2f5;
	--primary-blue: #1890ff;
	--primary-dark-blue: #0a3d6d;
	--error-red: #ff4d4f;
	--error-dark-red: #741212;
	--secondary-teal: #53eccb;
	--alert-orange: #d48806;
}

/* Apply the color scheme */
body {
	background-color: var(--neutral-lighter-grey);
	color: var(--neutral-black);
}

.text-primary {
	color: var(--primary-blue) !important;
}

.bg-primary {
	background-color: var(--primary-dark-blue) !important;
}

.btn-primary {
	background-color: var(--primary-blue);
	border-color: var(--primary-blue);
}

.btn-primary:hover {
	background-color: var(--primary-dark-blue);
	border-color: var(--primary-dark-blue);
}

.alert-info {
	background-color: var(--neutral-lighter-grey);
	border-color: var(--border-grey);
	color: var(--neutral-light-black);
}

.alert-success {
	background-color: var(--secondary-teal);
	border-color: var(--primary-blue);
	color: var(--primary-dark-blue);
}

.alert-warning {
	background-color: var(--alert-orange);
	border-color: var(--alert-orange);
	color: var(--neutral-white);
}

.alert-danger {
	background-color: var(--error-red);
	border-color: var(--error-dark-red);
	color: var(--neutral-white);
}

.card {
	border-color: var(--border-grey);
}

.logo-container {
	display: flex;
	align-items: center;
	gap: 15px;
}

.logo-img {
	height: 35px;
	width: auto;
}

/* Header text size reduction */
.header-title {
	font-size: 1.5rem;
	font-weight: 500;
	margin-bottom: 0;
}

/* Improved modal and PDF viewer styling */
#key-value-selection-modal .modal-content {
	height: calc(95vh - 20px);
}

/* Table scrolling */
#key-value-selection-modal .table-responsive {
	overflow-y: auto;
	max-height: 100%;
}

/* PDF image container */
#modal-pdf-container {
	min-height: fit-content;
}

/* PDF image */
.pdf-preview-image {
	max-width: 100%;
	height: auto;
}

/* Text preview */
#document-preview-text {
	height: 100%;
}

/* Ensure modal doesn't overflow viewport */
@media (max-height: 600px) {
	#key-value-selection-modal .modal-content {
		height: calc(100vh - 20px);
	}
}

/* Table header always visible */
#key-value-selection-modal .table thead {
	position: sticky;
	top: 0;
	z-index: 1;
	background-color: white;
}

/* PDF preview image */
.pdf-preview-image {
	max-width: 100%;
}

.page-header {
	padding: 12px 0;
	background-color: var(--primary-dark-blue);
	color: var(--neutral-white);
	margin-bottom: 20px;
}

.header-content {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.pdf-thumbnail {
	max-width: 100%;
	height: auto;
	border: 1px solid #dee2e6;
	border-radius: 5px;
}
.pdf-canvas {
	border: 1px solid #ddd;
	margin-bottom: 15px;
	max-width: 100%; /* Ensure canvas doesn't overflow container */
	height: auto !important; /* Override any inline height to maintain aspect ratio */
}
.page-navigation {
	margin-bottom: 15px;
}
#document-text {
	max-height: 400px;
	overflow-y: auto;
	font-family: monospace;
	white-space: pre-wrap;
	font-size: 0.85rem;
}
.pattern-item {
	transition: transform 0.2s;
}
.pattern-item:hover {
	transform: translateY(-2px);
}
.loading-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: rgba(0, 0, 0, 0.8); /* Darker background for better visibility */
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	z-index: 9999;
}
.loading-spinner {
	width: 3rem;
	height: 3rem;
	border-width: 0.25rem !important; /* Thicker spinner */
	filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.7)); /* Add glow effect */
}
.loading-text {
	color: white;
	margin-top: 10px;
	font-weight: bold;
	text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
	font-size: 1.1rem; /* Slightly larger text */
}
.pdf-container {
	width: 100%;
	overflow-x: auto; /* Allow horizontal scrolling for very wide landscape PDFs */
	position: relative;
	max-height: 80vh; /* Limit maximum height to 80% of viewport height */
	display: flex;
	justify-content: center; /* Center the PDF canvas */
}
.pdf-status {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background-color: rgba(0, 0, 0, 0.85);
	color: white;
	padding: 12px 18px;
	border-radius: 5px;
	z-index: 10;
	font-weight: bold;
	box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
	border: 1px solid rgba(255, 255, 255, 0.2);
	display: block !important; /* Ensure it's visible */
	opacity: 1 !important; /* Ensure it's fully opaque */
	visibility: visible !important; /* Ensure it's visible */
}
.test-match {
	background-color: #d4edda;
	border-radius: 3px;
	padding: 2px 5px;
}
#sticky-controls {
	position: sticky;
	top: 0;
	z-index: 100;
	background-color: white;
	padding: 15px 0;
	border-bottom: 1px solid #dee2e6;
	margin-bottom: 15px;
}
.pattern-card {
	transition: all 0.2s;
}
.pattern-card:hover {
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.delete-pattern {
	opacity: 0.7;
	transition: opacity 0.2s;
}
.pattern-card:hover .delete-pattern {
	opacity: 1;
}
.delete-pattern:hover {
	background-color: #dc3545;
	color: white;
}
#global-loading {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.8); /* Darker for better visibility */
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	z-index: 9999;
	color: white;
}
#global-loading-spinner {
	width: 4rem;
	height: 4rem;
	border-width: 0.35rem !important; /* Thicker spinner border */
	filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.7)); /* Add glow effect */
}
#global-loading-text {
	margin-top: 1rem;
	font-size: 1.2rem;
	font-weight: bold; /* Make text bolder for better visibility */
	text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.9); /* Add stronger text shadow */
}

/* Additional styles for PDF viewing in landscape mode */
@media (orientation: landscape) {
	.pdf-container {
		max-height: 75vh; /* Slightly smaller in landscape mode */
	}
}

/* Improve visibility of all spinners */
.spinner-border {
	border-width: 0.25rem; /* Thicker spinner border */
	filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.5)); /* Light glow effect */
}

/* Fix for invisible loading indicators */
.d-none {
	display: none !important;
}
.d-flex {
	display: flex !important;
}
.loading-overlay:not(.d-none) {
	display: flex !important;
}
#global-loading:not(.d-none) {
	display: flex !important;
}
.pdf-status:not(.d-none) {
	display: block !important;
}

/* Status indicator - only visible when needed */
#status-indicator {
	display: none; /* Hidden by default */
	position: fixed; /* Fixed position in the viewport */
	top: 10px; /* Positioned at the top with some margin */
	left: 50%;
	transform: translateX(-50%); /* Center horizontally */
	z-index: 1070; /* Higher than modal (1055) to ensure visibility above modals */
	background-color: rgba(0, 0, 0, 0.9);
	color: white;
	padding: 8px 15px;
	border-radius: 4px;
	text-align: center;
	font-weight: bold;
	min-width: 200px;
	box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

/* Only display when specific classes are added */
#status-indicator.processing,
#status-indicator.loading {
	display: block !important; /* Show only when processing or loading */
	background-color: rgba(0, 123, 255, 0.9);
}

#status-indicator.success {
	display: block !important;
	background-color: rgba(40, 167, 69, 0.9);
}

#status-indicator.success .spinner-border {
	display: none !important; /* Hide spinner for success state */
}

#status-indicator.error {
	display: block !important;
	background-color: rgba(220, 53, 69, 0.9);
}

#test-pattern {
	font-family: monospace;
	font-size: 0.9rem;
	line-height: 1.4;
	tab-size: 4;
	white-space: pre-wrap;
	word-break: break-all;
}

/* Responsive adjustments for pattern tester */
@media (max-width: 768px) {
	#test-pattern {
		font-size: 0.8rem;
		min-height: 120px; /* Ensure enough space on mobile */
	}

	/* Stack buttons on smaller screens */
	#pattern-tester-section .d-flex.justify-content-end {
		flex-direction: column;
	}

	#pattern-tester-section .btn {
		margin-right: 0 !important;
		margin-bottom: 0.5rem;
		width: 100%;
	}
}
