/**
 * WP File Print — Overlay styles.
 *
 * Fullscreen file source selection overlay for product pages.
 * Swatch styling matches Variable Flag accordion family.
 *
 * @package WPFilePrint
 * @since   0.2.0
 */

/* Default state: hidden. Shown via .active class by JS. */
.wppf-overlay-container {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 99999;
	overscroll-behavior: contain;
}

/* Prevent background scroll when overlay is open (set by JS). */
body.wppf-overlay-open {
	overflow: hidden;
	position: fixed;
	width: 100%;
}

.wppf-overlay-container.active {
	display: flex;
	align-items: center;
	justify-content: center;
}

.wppf-overlay-backdrop {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.7);
}

.wppf-overlay-content {
	position: relative;
	background: #fff;
	border-radius: 8px;
	padding: 40px;
	max-width: 900px;
	width: 90%;
	max-height: 90vh;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	-webkit-text-size-adjust: 100%;
	z-index: 1;
}

.wppf-overlay-close {
	position: absolute;
	top: 8px;
	right: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	background: none;
	border: none;
	cursor: pointer;
	color: #666;
	border-radius: 50%;
	transition: background 0.15s ease, color 0.15s ease;
}

.wppf-overlay-close:hover {
	color: #333;
	background: rgba(0, 0, 0, 0.06);
}

.wppf-overlay-close svg {
	width: 24px;
	height: 24px;
}

.wppf-overlay-header {
	text-align: center;
	margin-bottom: 30px;
}

.wppf-overlay-header h2 {
	margin: 0;
	font-size: 24px;
	color: #333;
}

/* --- Cards grid --- */
.wppf-overlay-cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 20px;
}

/* --- Card swatch (Variable Flag accordion family) --- */
.wppf-card {
	border: 1px solid #d1d1d1;
	border-radius: 6px;
	padding: 24px;
	text-align: center;
	cursor: pointer;
	background: #fff;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Ensure clicks always reach the card element */
.wppf-card * {
	pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
	.wppf-card:hover {
		border-color: #333;
		box-shadow: 0 0 0 1px #333;
	}
}

.wppf-card:focus-visible {
	outline: 2px solid #333;
	outline-offset: 2px;
}

.wppf-card.selected {
	border-color: #333;
	box-shadow: 0 0 0 1px #333;
}

.wppf-card-icon svg {
	width: 48px;
	height: 48px;
	color: #333;
}

.wppf-card h3 {
	margin: 12px 0 8px;
	font-size: 16px;
	font-weight: 500;
	color: #333;
}

.wppf-card p {
	color: #666;
	font-size: 0.85em;
	margin: 0;
}

/* --- Sub-form container --- */
.wppf-overlay-form-container {
	margin-top: 30px;
	padding-top: 20px;
	border-top: 1px solid #e0e0e0;
}

/* --- Source form content --- */
.wppf-source-form h3 {
	margin: 0 0 8px;
	font-size: 18px;
	color: #333;
}

.wppf-instructions {
	color: #555;
	font-size: 14px;
	line-height: 1.6;
	margin: 0 0 20px;
}

.wppf-form-field {
	margin-bottom: 16px;
}

.wppf-form-field label {
	display: block;
	font-weight: 600;
	font-size: 14px;
	color: #333;
	margin-bottom: 6px;
}

.wppf-form-field input[type="text"],
.wppf-form-field input[type="file"],
.wppf-form-field textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 16px;
	box-sizing: border-box;
}

.wppf-form-field input[type="text"]:hover,
.wppf-form-field textarea:hover {
	border-color: #999;
}

.wppf-form-field input[type="text"]:focus,
.wppf-form-field textarea:focus {
	border-color: #333;
	box-shadow: 0 0 0 2px rgba(51, 51, 51, 0.15);
	outline: none;
}

.wppf-form-field textarea {
	resize: vertical;
	min-height: 100px;
}

/* --- Check type radio group --- */
.wppf-check-type {
	margin-bottom: 16px;
}

.wppf-check-type label {
	display: block;
	padding: 8px 0;
	cursor: pointer;
	font-size: 16px;
	color: #333;
}

.wppf-check-type .wppf-manual-fee {
	color: #666;
	font-size: 0.9em;
}

/* --- Upload progress --- */
.wppf-upload-progress {
	display: none;
	margin-bottom: 16px;
}

.wppf-upload-progress.active {
	display: block;
}

.wppf-progress-bar {
	width: 100%;
	height: 8px;
	background: #e0e0e0;
	border-radius: 4px;
	overflow: hidden;
	margin-bottom: 6px;
}

.wppf-progress-bar-fill {
	height: 100%;
	background: #333;
	border-radius: 4px;
	width: 0;
	transition: width 0.3s ease;
}

.wppf-upload-status {
	font-size: 13px;
	color: #666;
}

/* --- Confirm button --- */
.wppf-confirm-source {
	display: block;
	width: 100%;
	padding: 12px 24px;
	margin-top: 20px;
	background: #333;
	color: #fff;
	border: none;
	border-radius: 4px;
	font-size: 16px;
	font-weight: 500;
	cursor: pointer;
	transition: background 0.15s ease;
}

.wppf-confirm-source:hover {
	background: #555;
}

.wppf-confirm-source:disabled {
	background: #ccc;
	cursor: not-allowed;
}

.wppf-confirm-source.wppf-btn-uploading {
	background: #999;
	cursor: wait;
	opacity: 0.7;
}

/* --- Validation errors --- */
.wppf-form-field input.wppf-error,
.wppf-form-field textarea.wppf-error {
	border-color: #cc0000;
	box-shadow: 0 0 0 1px #cc0000;
}

.wppf-form-field input.wppf-error:focus,
.wppf-form-field textarea.wppf-error:focus {
	border-color: #cc0000;
	box-shadow: 0 0 0 2px rgba(204, 0, 0, 0.2);
}

.wppf-field-error {
	display: block;
	color: #cc0000;
	font-size: 13px;
	margin-top: 4px;
	line-height: 1.4;
}

.wppf-required-mark {
	color: #cc0000;
	font-weight: 700;
}

.wppf-upload-error {
	color: #cc0000;
}

/* --- Responsive --- */
@media (max-width: 600px) {
	.wppf-overlay-content {
		padding: 20px;
		width: 95%;
	}

	.wppf-overlay-cards {
		grid-template-columns: 1fr 1fr;
		gap: 12px;
	}

	.wppf-card {
		padding: 16px;
	}

	/*
	 * Prevent iOS Safari auto-zoom on input focus (requires >= 16px).
	 * Use !important to override theme / WooCommerce selectors that may
	 * set a smaller font-size with higher specificity.
	 */
	.wppf-overlay-content input[type="text"],
	.wppf-overlay-content input[type="file"],
	.wppf-overlay-content input[type="email"],
	.wppf-overlay-content input[type="tel"],
	.wppf-overlay-content input[type="number"],
	.wppf-overlay-content textarea,
	.wppf-overlay-content select,
	.wppf-overlay-content .wppf-check-type label {
		font-size: 16px !important;
	}
}

/* --- High contrast --- */
@media (forced-colors: active) {
	.wppf-card {
		border-width: 2px;
	}

	.wppf-card:focus-visible {
		outline-width: 4px;
	}
}
