/**
 * PeachPay Field Editor - Custom Field Types Styles
 * Styles for scrollable text box and signature fields
 */

/* ===== Scrollable Text Field ===== */
.pp-scrollable-text-wrapper {
	margin-bottom: 20px;
}

.pp-scrollable-text-wrapper > label {
	display: block;
	margin-bottom: 8px;
}

/* Dropdown Container - Hidden (always visible mode) */
.pp-scrollable-dropdown {
	display: none !important;
}

/* Dropdown Toggle Button - Hidden (always visible mode) */
.pp-scrollable-toggle {
	display: none !important;
}

/* Scrollable Content - Always visible */
.pp-scrollable-content {
	max-height: 200px;
	overflow-y: auto;
	overflow-x: hidden;
	border: 1px solid #d1d9e0;
	border-radius: 6px;
	padding: 15px;
	background-color: #fff;
	font-size: 14px;
	line-height: 1.6;
	color: #444;
	position: relative;
}

.pp-scrollable-content p {
	margin: 0 0 10px 0;
}

.pp-scrollable-content p:last-child {
	margin-bottom: 0;
}

.pp-scrollable-content b {
	color: #222;
}

.pp-scrollable-content::-webkit-scrollbar {
	width: 8px;
}

.pp-scrollable-content::-webkit-scrollbar-track {
	background: #f1f1f1;
	border-radius: 4px;
}

.pp-scrollable-content::-webkit-scrollbar-thumb {
	background: #888;
	border-radius: 4px;
}

.pp-scrollable-content::-webkit-scrollbar-thumb:hover {
	background: #555;
}

/* Content Wrapper - Always visible */
.pp-scrollable-content-wrapper {
	display: block;
	width: 100%;
	margin-top: 8px;
}

/* Scroll Indicator */
.pp-scroll-indicator {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 8px 12px;
	background-color: #f0f4f8;
	border-top: 1px solid #e1e4e8;
	font-size: 12px;
	color: #666;
	transition: all 0.3s ease;
}

.pp-scroll-arrow {
	font-size: 14px;
	animation: bounce 1.5s infinite;
}

@keyframes bounce {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(3px); }
}

.pp-scroll-check {
	font-size: 14px;
	color: #28a745;
	font-weight: bold;
	margin-right: 4px;
}

.pp-scroll-indicator.pp-scroll-complete {
	background-color: #d4edda;
	border-color: #c3e6cb;
	color: #155724;
}

.pp-scroll-indicator.pp-scroll-complete .pp-scroll-text {
	color: #155724;
	font-weight: 500;
}

.pp-scroll-indicator.pp-scroll-complete .pp-scroll-arrow {
	display: none;
}

/* ===== Signature Field ===== */
.pp-signature-wrapper {
	margin-bottom: 20px;
	/* Ensure it appears on a new line below other fields */
	clear: both;
	display: block;
}

/* Express Checkout specific: ensure proper stacking in flex container */
.pp-form .pp-scrollable-text-wrapper,
.pp-form .pp-signature-wrapper,
#pp-additional-form .pp-scrollable-text-wrapper,
#pp-additional-form .pp-signature-wrapper {
	min-width: 100%;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

/* Override flex.col to ensure items stack properly (Express Checkout only) */
#pp-additional-form.flex.col {
	flex-direction: column;
	flex-wrap: nowrap;
	align-items: stretch;
}

#pp-additional-form.flex.col > .pp-scrollable-text-wrapper {
	min-width: 100%;
	width: 100%;
	display: block;
}

/* Signature wrapper - always visible */
#pp-additional-form.flex.col > .pp-signature-wrapper {
	min-width: 100%;
	width: 100%;
	display: block;
}

/* Signature label styling */
.pp-signature-wrapper > .pp-signature-label,
.pp-signature-wrapper > label.pp-signature-label {
	display: block;
	position: static;
	top: auto;
	left: auto;
	transform: none;
	margin-bottom: 8px;
	padding: 0;
	background: transparent;
	font-weight: 600;
	color: #333;
	font-size: 14px;
	width: auto;
}


/* Signature Tabs - Hidden (draw-only mode) */
.pp-signature-tabs {
	display: none !important;
}

.pp-signature-tab {
	display: none !important;
}

/* Signature Draw - Always visible (draw-only mode) */
.pp-signature-draw {
	border: 1px solid #ddd;
	padding: 5px;
	background-color: #fff;
	border-radius: 4px;
	margin-top: 8px;
}

/* Signature Type - Hidden (draw-only mode) */
.pp-signature-type {
	display: none !important;
}

.pp-signature-canvas {
	width: 100%;
	height: 150px;
	border: 1px dashed #ccc;
	border-radius: 4px;
	background-color: #fefefe;
	cursor: crosshair;
	touch-action: none;
}

.pp-signature-clear {
	padding: 8px 16px;
	border: 1px solid #ddd;
	border-radius: 4px;
	background-color: #f5f5f5;
	color: #666;
	cursor: pointer;
	font-size: 13px;
	transition: all 0.2s ease;
	width: 100%;
	margin-top: 8px;
}

.pp-signature-clear:hover {
	background-color: #e9e9e9;
	border-color: #ccc;
}

.pp-signature-typed {
	margin-bottom: 10px;
}

/* Signature typed input wrapper - for floating label effect */
.pp-signature-type .flex.col.relative {
	position: relative;
}

/* Classic checkout: position label above input using flexbox order */
.woocommerce-checkout .pp-signature-type .flex.col.relative {
	display: flex;
	flex-direction: column;
}

.woocommerce-checkout .pp-signature-type .flex.col.relative > label {
	order: -1;
	position: static;
	margin-bottom: 5px;
}

.woocommerce-checkout .pp-signature-type .flex.col.relative > input {
	order: 0;
}

.pp-signature-preview {
	min-height: 80px;
	padding: 15px;
	border: 1px dashed #ccc;
	border-radius: 4px;
	background-color: #fefefe;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: 'Brush Script MT', 'Segoe Script', 'Bradley Hand', cursive;
	font-size: 32px;
	color: #333;
}

.pp-signature-preview.pp-has-signature {
	border-style: solid;
	border-color: #28a745;
}

.required {
    border-bottom: 0 !important;
    color: #e2401c;
}

/* Responsive adjustments */
@media (max-width: 768px) {
	.pp-scrollable-content {
		height: 150px;
	}

	.pp-signature-canvas {
		height: 120px;
	}

	.pp-signature-tab {
		padding: 8px 15px;
		font-size: 13px;
	}

	.pp-signature-preview {
		font-size: 24px;
		min-height: 60px;
	}
}

