/**
 * FLW Document Reader Pro - Frontend Styles
 */

.flw-drp-pro-wrapper {
	position: relative;
	z-index: 9000; /* Sit above normal page content and SecurePDF overlays */
}

.flw-drp-content-wrapper {
	position: relative;
	z-index: 1; /* Base layer for the viewer and its own overlays */
}

.flw-drp-overlay-root {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	pointer-events: none;
	z-index: 2; /* Above content wrapper, contains mask and modal */
}

.flw-drp-mask {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	/* Stronger darkening + blur so the document is not readable */
	background: rgba(15, 23, 42, 0.75);
	backdrop-filter: blur(6px);
	pointer-events: auto; /* this blocks interaction with the viewer */
	z-index: 1; /* Relative to overlay-root, above content but below modal */
}

.flw-drp-panel {
	position: absolute;
	top: 50%;
	left: 50%;
	/* Center the modal in the viewer */
	transform: translate(-50%, -50%);
	/* Auto width, but never larger than 600px and leave some margin on small screens */
	width: auto;
	max-width: min(600px, 100% - 40px);
	max-height: 80vh;
	background: rgba(17, 24, 39, 0.97);
	color: #f9fafb;
	font-size: 12px;
	border-radius: 8px;
	box-shadow: 0 18px 45px rgba(0, 0, 0, 0.55);
	overflow: hidden;
	pointer-events: auto; /* this is clickable */
	z-index: 2; /* Relative to overlay-root, above mask */
	display: flex;
	flex-direction: column;
}

.flw-drp-panel-header {
	padding: 8px 10px;
	background: rgba(31, 41, 55, 1);
	border-bottom: 1px solid rgba(55, 65, 81, 1);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 6px;
}

.flw-drp-panel-title {
	font-weight: 600;
	font-size: 12px;
}

.flw-drp-panel-tag {
	padding: 2px 6px;
	border-radius: 999px;
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	background: rgba(59, 130, 246, 0.18);
	border: 1px solid rgba(59, 130, 246, 0.6);
}

.flw-drp-panel-body {
	padding: 10px 12px 12px;
	flex: 1 1 auto;
	min-height: 0; /* Important: allows inner scroll area to shrink in flex */
	overflow: hidden; /* Internal scroll happens inside content region */
	display: flex;
	flex-direction: column;
}

.flw-drp-panel-meta {
	font-size: 11px;
	opacity: 0.85;
	margin-bottom: 4px;
	word-break: break-all;
}

.flw-drp-panel-state {
	font-size: 11px;
	margin-top: 4px;
}

.flw-drp-tabs {
	display: flex;
	gap: 4px;
	margin-bottom: 6px;
	border-bottom: 1px solid rgba(55, 65, 81, 1);
}

.flw-drp-tab {
	flex: 1;
	padding: 4px 6px;
	text-align: center;
	font-size: 11px;
	cursor: pointer;
	border-radius: 4px 4px 0 0;
	background: transparent;
	color: #e5e7eb;
	border: 1px solid transparent;
}

.flw-drp-tab-active {
	background: rgba(31, 41, 55, 1);
	border-color: rgba(55, 65, 81, 1);
	border-bottom-color: transparent;
	font-weight: 600;
}

.flw-drp-auth-body {
	margin-top: 6px;
}

.flw-drp-field {
	display: flex;
	flex-direction: column;
	margin-bottom: 8px;
}

.flw-drp-field label {
	font-size: 11px;
	margin-bottom: 2px;
}

.flw-drp-field input {
	font-size: 11px;
	padding: 4px 6px;
	border-radius: 4px;
	border: 1px solid rgba(55, 65, 81, 1);
	background: rgba(17, 24, 39, 1);
	color: #f9fafb;
}

.flw-drp-submit-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-top: 6px;
	padding: 6px 12px;
	font-size: 11px;
	border-radius: 4px;
	border: none;
	cursor: pointer;
	background: rgba(59, 130, 246, 1);
	color: #f9fafb;
}

.flw-drp-submit-btn:disabled {
	opacity: 0.6;
	cursor: default;
}

.flw-drp-auth-note {
	font-size: 10px;
	margin-top: 4px;
	opacity: 0.8;
}

.flw-drp-forgot-link {
	display: inline-block;
	margin-top: 4px;
	font-size: 10px;
	color: #93c5fd;
	text-decoration: underline;
	cursor: pointer;
}

/* ARC Shell - Full Screen Layout */
.flw-drp-arc-shell {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	pointer-events: auto;
	z-index: 2; /* Above mask */
	background: rgba(17, 24, 39, 1);
}

.flw-drp-arc-main {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	overflow: hidden;
	transition: filter 0.3s ease;
	/* Ensure main area can shrink to accommodate footer */
	flex-shrink: 1;
}

.flw-drp-arc-main-blurred {
	filter: blur(4px) brightness(0.5);
}

.flw-drp-arc-main iframe {
	width: 100%;
	height: 100%;
	border: none;
}

.flw-drp-arc-overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	display: none; /* Hidden by default, shown in application mode */
	align-items: center; /* Center vertically when card is short */
	justify-content: center;
	padding: 20px;
	padding-bottom: 80px; /* Extra space to keep card above footer */
	pointer-events: none; /* Allow clicks through to footer */
	z-index: 1; /* Below footer, above blurred main */
	overflow-y: auto; /* Allow overlay to scroll if needed */
	box-sizing: border-box; /* Include padding in height calculation */
	/* Ensure overlay only covers main area, not footer - bottom constraint handled by padding */
}

.flw-drp-arc-overlay-card {
	background: rgba(17, 24, 39, 0.98);
	border-radius: 8px;
	box-shadow: 0 18px 45px rgba(0, 0, 0, 0.55);
	max-width: 600px;
	width: 100%;
	max-height: calc(100% - 40px); /* Use overlay height minus padding, ensuring card stays above footer */
	display: flex;
	flex-direction: column;
	pointer-events: auto; /* Card is clickable */
	border: 1px solid rgba(55, 65, 81, 1);
	overflow: hidden; /* Ensure card content scrolls internally */
}

.flw-drp-arc-overlay-card-content {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 20px;
}

/* ARC Mode Styles (Legacy - for panel-based states) */
.flw-drp-arc-content {
	flex: 1 1 auto;
	min-height: 0; /* Important: allows scrolling in flex container */
	overflow-y: auto;
	margin-bottom: 16px;
	display: flex;
	flex-direction: column;
}

.flw-drp-arc-viewer {
	width: 100%;
	flex: 1 1 auto;
	min-height: 400px; /* Ensure minimum visible height for reader */
	border-radius: 4px;
	overflow: hidden;
	background: rgba(17, 24, 39, 1);
	border: 1px solid rgba(55, 65, 81, 1);
}

.flw-drp-arc-sample-iframe {
	width: 100%;
	height: 100%;
	border: none;
}

.flw-drp-arc-no-sample {
	padding: 20px;
	text-align: center;
	color: #9ca3af;
	font-size: 11px;
}

.flw-drp-arc-load-error {
	padding: 20px;
	text-align: center;
	color: #9ca3af;
	font-size: 11px;
}

/* ARC Footer - Full Screen Layout */
.flw-drp-arc-shell .flw-drp-arc-footer {
	position: relative; /* Enable z-index stacking */
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 20px;
	background: rgba(31, 41, 55, 1); /* Fully opaque dark navy background */
	border-top: 1px solid rgba(55, 65, 81, 1);
	flex: 0 0 auto; /* Stay pinned to bottom of shell */
	z-index: 20; /* Above overlay (z-index: 1) and blurred main, ensuring footer is visually on top */
	box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.3); /* Slight shadow to emphasize it's a solid front layer */
}

.flw-drp-arc-footer-left {
	font-size: 12px;
	color: #e5e7eb;
	flex: 0 0 auto;
}

.flw-drp-arc-footer-center {
	flex: 1 1 auto;
	display: flex;
	justify-content: center;
}

.flw-drp-arc-shell .flw-drp-arc-footer-btn {
	padding: 10px 24px;
	border-radius: 4px;
	border: none;
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
	text-align: center;
	transition: background 0.2s;
	background: rgba(59, 130, 246, 1);
	color: #f9fafb;
}

.flw-drp-arc-shell .flw-drp-arc-footer-btn:hover {
	background: rgba(37, 99, 235, 1);
}

/* Legacy Footer Styles (for panel-based states) */
.flw-drp-arc-footer {
	display: flex;
	justify-content: space-between;
	gap: 8px;
	margin-top: 8px;
	flex: 0 0 auto; /* Prevent footer from growing or shrinking */
}

.flw-drp-arc-footer-btn-sample {
	background: rgba(55, 65, 81, 1);
	color: #f9fafb;
	border: 1px solid rgba(75, 85, 99, 1);
}

.flw-drp-arc-footer-btn-sample:hover {
	background: rgba(75, 85, 99, 1);
}

.flw-drp-arc-footer-btn-apply {
	background: rgba(59, 130, 246, 1);
	color: #f9fafb;
}

.flw-drp-arc-footer-btn-apply:hover {
	background: rgba(37, 99, 235, 1);
}

.flw-drp-arc-footer-btn.is-active {
	opacity: 1;
}

.flw-drp-arc-footer-btn:not(.is-active) {
	opacity: 0.7;
}

.flw-drp-arc-cta {
	margin-top: 12px;
}

.flw-drp-arc-cta-title {
	font-size: 14px;
	font-weight: 600;
	margin: 0 0 6px 0;
	color: #f9fafb;
}

.flw-drp-arc-cta-description {
	font-size: 11px;
	margin: 0 0 12px 0;
	opacity: 0.85;
	color: #e5e7eb;
}

.flw-drp-arc-btn-primary {
	display: block;
	width: 100%;
	padding: 8px 12px;
	font-size: 12px;
	font-weight: 600;
	border-radius: 4px;
	border: none;
	cursor: pointer;
	background: rgba(59, 130, 246, 1);
	color: #f9fafb;
	margin-bottom: 8px;
	transition: background 0.2s;
}

.flw-drp-arc-btn-primary:hover {
	background: rgba(37, 99, 235, 1);
}

.flw-drp-arc-link-secondary {
	display: block;
	text-align: center;
	font-size: 11px;
	color: #93c5fd;
	text-decoration: underline;
	cursor: pointer;
}

.flw-drp-arc-link-secondary:hover {
	color: #60a5fa;
}

.flw-drp-arc-app-heading {
	font-size: 14px;
	font-weight: 600;
	margin: 0 0 8px 0;
	color: #f9fafb;
}

.flw-drp-arc-app-intro {
	font-size: 11px;
	opacity: 0.85;
	color: #e5e7eb;
	margin: 0 0 12px 0;
	line-height: 1.5;
}

.flw-drp-arc-app-intro p {
	margin: 0 0 8px 0;
}

.flw-drp-arc-app-intro p:last-child {
	margin-bottom: 0;
}

.flw-drp-arc-app-intro a {
	color: #93c5fd;
	text-decoration: underline;
}

.flw-drp-arc-app-intro a:hover {
	color: #60a5fa;
}

.flw-drp-arc-app-intro ul,
.flw-drp-arc-app-intro ol {
	margin: 8px 0;
	padding-left: 20px;
}

.flw-drp-arc-app-intro li {
	margin-bottom: 4px;
}

.flw-drp-arc-app-intro strong,
.flw-drp-arc-app-intro b {
	font-weight: 600;
}

.flw-drp-arc-app-intro em,
.flw-drp-arc-app-intro i {
	font-style: italic;
}

.flw-drp-arc-app-placeholder {
	font-size: 11px;
	opacity: 0.85;
	color: #e5e7eb;
	margin: 0;
}

/* ARC Application Form Styles */
.flw-drp-arc-application-form {
	margin: 0;
}

.flw-drp-form-errors {
	background: rgba(239, 68, 68, 0.1);
	border: 1px solid rgba(239, 68, 68, 0.3);
	border-radius: 4px;
	padding: 8px;
	margin-bottom: 12px;
}

.flw-drp-form-errors ul {
	margin: 0;
	padding-left: 16px;
}

.flw-drp-form-errors li {
	color: #ef4444;
	font-size: 11px;
	margin-bottom: 4px;
}

.flw-drp-field textarea {
	font-size: 11px;
	padding: 4px 6px;
	border-radius: 4px;
	border: 1px solid rgba(55, 65, 81, 1);
	background: rgba(17, 24, 39, 1);
	color: #f9fafb;
	font-family: inherit;
	resize: vertical;
	width: 100%;
	box-sizing: border-box;
}

.flw-drp-field-error {
	display: block;
	color: #ef4444;
	font-size: 10px;
	margin-top: 2px;
}

.flw-drp-radio-group {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-top: 4px;
}

.flw-drp-radio-option {
	display: flex;
	align-items: center;
	gap: 6px;
}

.flw-drp-radio-option input[type="radio"] {
	margin: 0;
	cursor: pointer;
}

.flw-drp-radio-option label {
	font-size: 11px;
	cursor: pointer;
	margin: 0;
}

.flw-drp-field input[type="checkbox"] {
	margin-right: 6px;
	cursor: pointer;
}

.flw-drp-field label[for] {
	cursor: pointer;
}

.flw-drp-agreement-section {
	margin-bottom: 12px;
}

.flw-drp-agreement-text {
	font-size: 10px;
	opacity: 0.9;
	margin-bottom: 8px;
	padding: 8px;
	background: rgba(31, 41, 55, 0.5);
	border-radius: 4px;
}

.flw-drp-account-choice-section {
	margin-top: 12px;
	margin-bottom: 12px;
}

.flw-drp-login-fields {
	margin-top: 8px;
	margin-bottom: 8px;
	padding-top: 8px;
	border-top: 1px solid rgba(55, 65, 81, 0.5);
}

.flw-drp-arc-pending-message {
	font-size: 11px;
	opacity: 0.85;
	color: #e5e7eb;
	margin: 0;
	line-height: 1.5;
}

/* Unlock behavior - when approved */
.flw-drp-unlocked .flw-drp-mask {
	display: none !important;
}

.flw-drp-unlocked .flw-drp-panel {
	display: none !important;
}

.flw-drp-unlocked .flw-drp-content-wrapper {
	pointer-events: auto;
}

/* ARC unlocked - ensure viewer is fully clear */
.flw-drp-unlocked .flw-drp-arc-main {
	filter: none !important;
	opacity: 1 !important;
}

/* ARC unlocked - do not apply any dimming from shell/overlay */
.flw-drp-unlocked .flw-drp-arc-shell,
.flw-drp-unlocked .flw-drp-arc-overlay {
	filter: none !important;
	opacity: 1 !important;
}

/* ARC unlocked - allow interaction */
.flw-drp-unlocked .flw-drp-arc-main,
.flw-drp-unlocked .flw-drp-arc-shell {
	pointer-events: auto !important;
}

/* ARC unlocked - generic blur reset inside wrapper */
.flw-drp-unlocked * {
	filter: none !important;
}

/* Status badges for admin */
.flw-drp-status-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 3px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
}

.flw-drp-status-pending {
	background: rgba(251, 191, 36, 0.2);
	color: #fbbf24;
	border: 1px solid rgba(251, 191, 36, 0.4);
}

.flw-drp-status-approved {
	background: rgba(34, 197, 94, 0.2);
	color: #22c55e;
	border: 1px solid rgba(34, 197, 94, 0.4);
}

.flw-drp-status-rejected {
	background: rgba(239, 68, 68, 0.2);
	color: #ef4444;
	border: 1px solid rgba(239, 68, 68, 0.4);
}

/* Mobile responsiveness for ARC shell */
@media (max-width: 768px) {
	.flw-drp-arc-overlay {
		padding: 10px;
		padding-bottom: 100px; /* Extra space for footer on mobile (footer may be taller due to column layout) */
	}

	.flw-drp-arc-overlay-card {
		max-width: 100%;
		max-height: calc(100% - 40px); /* Use overlay height minus padding, ensuring card stays above footer on mobile */
	}

	.flw-drp-arc-overlay-card-content {
		padding: 16px;
	}

	.flw-drp-arc-shell .flw-drp-arc-footer {
		padding: 10px 16px;
		flex-direction: column;
		gap: 8px;
	}

	.flw-drp-arc-footer-left {
		font-size: 11px;
		text-align: center;
	}

	.flw-drp-arc-footer-center {
		width: 100%;
	}

	.flw-drp-arc-shell .flw-drp-arc-footer-btn {
		width: 100%;
	}
}

/* ARC Application Card - Light Theme for Better Readability */
.flw-drp-arc-overlay-card {
	background: #ffffff;
	color: #000000;
}

/* Force all text elements inside the card to be black */
.flw-drp-arc-overlay-card h1,
.flw-drp-arc-overlay-card h2,
.flw-drp-arc-overlay-card h3,
.flw-drp-arc-overlay-card h4,
.flw-drp-arc-overlay-card h5,
.flw-drp-arc-overlay-card h6,
.flw-drp-arc-overlay-card label,
.flw-drp-arc-overlay-card p,
.flw-drp-arc-overlay-card span {
	color: #000000 !important;
}

/* Style form inputs, textareas, and selects with light theme */
.flw-drp-arc-overlay-card input[type="text"],
.flw-drp-arc-overlay-card input[type="email"],
.flw-drp-arc-overlay-card input[type="password"],
.flw-drp-arc-overlay-card textarea,
.flw-drp-arc-overlay-card select {
	background: #ffffff;
	color: #000000;
	border: 1px solid #cccccc;
}

/* Placeholder text in medium gray */
.flw-drp-arc-overlay-card input::placeholder,
.flw-drp-arc-overlay-card textarea::placeholder {
	color: #777777;
}

/* Radio and checkbox labels should be black */
.flw-drp-arc-overlay-card input[type="radio"] + label,
.flw-drp-arc-overlay-card input[type="checkbox"] + label,
.flw-drp-arc-overlay-card .flw-drp-radio-option label {
	color: #000000 !important;
}

/* ARC Application intro text - match header styling at smaller size */
.flw-drp-arc-overlay-card .flw-drp-arc-app-intro {
	color: #000000 !important;
	font-weight: 600 !important; /* Same as header */
	font-size: 12px !important; /* Slightly smaller than header's 14px */
	opacity: 1 !important; /* Override any semi-transparent styles from theme */
	font-family: inherit; /* Inherit same font family as header */
}

/* Pro action bar that sits inside the reader overlay */
.flw-drp-pro-action-bar {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 16px;
	background: rgba(17, 24, 39, 0.9);
	border-top: 1px solid rgba(59, 130, 246, 0.4);
	box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.35);
	gap: 12px;
	pointer-events: auto;
	z-index: 25;
}

.flw-drp-pro-action-bar-left {
	font-size: 13px;
	font-weight: 600;
	color: #f9fafb;
	flex: 1 1 auto;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.flw-drp-pro-action-bar-right {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 0 0 auto;
}

.flw-drp-pro-action-btn {
	padding: 6px 14px;
	font-size: 12px;
	font-weight: 600;
	border-radius: 4px;
	border: 1px solid rgba(255, 255, 255, 0.3);
	background: rgba(59, 130, 246, 1);
	color: #f9fafb;
	cursor: pointer;
	transition: background 0.2s ease, opacity 0.2s ease;
}

.flw-drp-pro-action-btn:disabled {
	opacity: 0.5;
	cursor: default;
}

.flw-drp-feedback-drawer {
	position: absolute;
	left: 10px;
	right: 10px;
	bottom: 60px;
	background: rgba(17, 24, 39, 0.95);
	border-radius: 8px;
	box-shadow: 0 -12px 35px rgba(0, 0, 0, 0.45);
	overflow: hidden;
	max-height: 45%;
	z-index: 30;
	pointer-events: auto;
	display: none;
}

.flw-drp-feedback-drawer[data-open="true"] {
	display: block;
}

.flw-drp-feedback-drawer-content {
	padding: 12px;
	max-height: 100%;
	overflow-y: auto;
}