/**
 * Opayo Pi Checkout Styles
 *
 * @package WC_Opayo_Pi
 * @version 1.0.0
 */

/* Express Checkout Section */
.opayo-express-checkout-section {
	margin: 0 0 15px 0;
	padding: 0;
}

/* Custom Checkout Integration (PS WC Checkout) */
.pswc-payment-methods .opayo-express-checkout-section {
	margin: 0 0 20px 0;
}

.pswc-payment-methods #opayo-pi-form {
	margin: 15px 0;
}

.opayo-express-checkout-container {
	display: flex;
	flex-direction: column;
	gap: 10px;
	align-items: center;
}

.opayo-express-checkout-container .opayo-express-button {
	width: 100%;
	max-width: 400px;
}

/* Payment Form Container */
#opayo-pi-form {
	margin: 20px 0;
	padding: 0;
	border: none;
}

/* Test Mode Notice */
.opayo-pi-test-mode-notice {
	background: #fff3cd;
	border: 1px solid #ffc107;
	color: #856404;
	padding: 12px 15px;
	border-radius: 4px;
	margin-bottom: 20px;
	font-size: 14px;
}

/* Error Messages */
.opayo-pi-errors {
	margin-bottom: 20px;
}

.opayo-pi-errors .woocommerce-error {
	background: #f8d7da;
	border: 1px solid #f5c6cb;
	color: #721c24;
	padding: 15px;
	border-radius: 4px;
	list-style: none;
	margin: 0;
}

.opayo-pi-errors .woocommerce-error li {
	margin: 5px 0;
}

/* Form Rows */
#opayo-pi-form .form-row {
	margin-bottom: 15px;
}

#opayo-pi-form .form-row label {
	display: block;
	margin-bottom: 5px;
	font-weight: 600;
	font-size: 14px;
}

#opayo-pi-form .form-row label .required {
	color: #e53935;
	font-weight: bold;
}

/* Input Fields */
#opayo-pi-form input.input-text,
#opayo-pi-form .opayo-pi-card-field input {
	width: 100%;
	padding: 12px 15px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 16px;
	line-height: 1.5;
	transition: border-color 0.3s ease;
	box-sizing: border-box;
}

#opayo-pi-form input.input-text:focus,
#opayo-pi-form .opayo-pi-card-field:focus,
#opayo-pi-form .opayo-pi-card-field input:focus {
	outline: none;
	border-color: #007bff;
	box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

#opayo-pi-form input.input-text::placeholder,
#opayo-pi-form .opayo-pi-card-field input::placeholder {
	color: #999;
}

/* Card Field Specific Styles */
.opayo-pi-card-field {
	background: #fff;
	min-height: 46px;
	display: flex;
	align-items: center;
}

/* Two Column Layout for Expiry and CVC */
#opayo-pi-form .form-row-first {
	width: 48%;
	float: left;margin-right: 0;
}

#opayo-pi-form .form-row-last {
	width: 48%;
	float: right;
}

#opayo-pi-form .clear {
	clear: both;
}

/* Digital Wallets Section */
.opayo-pi-digital-wallets {
	margin-top: 25px;
	padding-top: 20px;
	border-top: 1px solid #e0e0e0;
	text-align: center;
}

.opayo-pi-digital-wallets > div {
	margin-bottom: 15px;
}

/* Apple Pay Button */
.apple-pay-button {
	display: inline-block;
	-webkit-appearance: -apple-pay-button;
	-apple-pay-button-type: plain;
	width: 100%;
	max-width: 400px;
	height: 48px;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	background-size: 100% 60%;
	background-repeat: no-repeat;
	background-position: 50% 50%;
	background-color: #000;
}

.apple-pay-button-black {
	-apple-pay-button-style: black;
}

.apple-pay-button:hover {
	opacity: 0.9;
}

/* Google Pay Button */
.google-pay-button {
	display: inline-block;
	width: 100%;
	max-width: 400px;
	height: 48px;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	background-color: #000;
	background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="41" height="17" viewBox="0 0 41 17"><g fill="none" fill-rule="evenodd"><path fill="%23FFF" d="M19.526 2.635v4.083h2.518c.6 0 1.096-.202 1.488-.605.403-.402.605-.882.605-1.437 0-.544-.202-1.018-.605-1.422-.392-.413-.888-.62-1.488-.62h-2.518zm0 5.52v4.736h-1.504V1.198h4.022c1.058 0 1.956.379 2.694 1.137.738.748 1.107 1.67 1.107 2.763 0 1.093-.369 2.01-1.107 2.757-.738.759-1.636 1.138-2.694 1.138h-2.518v.162zm7.707 4.736h-1.504V1.198h1.504v11.693zm2.757 0h-1.504V1.198h1.504v11.693z"/></g></svg>');
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
	color: #fff;
	font-size: 0;
}

.google-pay-button:hover {
	opacity: 0.9;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
	#opayo-pi-form .form-row-first,
	#opayo-pi-form .form-row-last {
		width: 100%;
		float: none;
	}

	#opayo-pi-form .form-row {
		margin-bottom: 12px;
	}

	.apple-pay-button,
	.google-pay-button {
		max-width: 100%;
	}

	.opayo-express-checkout-container .opayo-express-button {
		max-width: 100%;
	}

	.opayo-express-separator span {
		font-size: 12px;
		padding: 0 10px;
	}
}

/* Loading State */
.processing #opayo-pi-form {
	opacity: 0.6;
	pointer-events: none;
}

.processing #opayo-pi-form::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 40px;
	height: 40px;
	margin: -20px 0 0 -20px;
	border: 4px solid #f3f3f3;
	border-top: 4px solid #007bff;
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

@keyframes spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

/* Card Type Icons (Optional Enhancement) */
.opayo-pi-card-icons {
	margin-top: 10px;
	text-align: right;
}

.opayo-pi-card-icons img {
	height: 24px;
	margin-left: 5px;
	opacity: 0.5;
}

.opayo-pi-card-icons img.active {
	opacity: 1;
}

/* Accessibility */
#opayo-pi-form input:focus,
#opayo-pi-form button:focus {
	outline: 2px solid #007bff;
	outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
	#opayo-pi-form input.input-text,
	#opayo-pi-form .opayo-pi-card-field {
		border-width: 2px;
	}
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
	#opayo-pi-form input.input-text,
	#opayo-pi-form .opayo-pi-card-field input {
		padding: .6180469716em;
		background-color: #f2f2f2;
		color: #43454b;
		border: 0;
		-webkit-appearance: none;
		box-sizing: border-box;
		font-weight: 400;box-shadow: none;
	}

	.opayo-pi-test-mode-notice {
		background: #3e2723;
		border-color: #795548;
		color: #ffb74d;
	}
}
