/**
 * Simple Redsys Payments - Bizum RTP Styles
 *
 * Styles for the Bizum Request To Pay payment method on checkout.
 * Uses CSS custom properties to inherit from WooCommerce/theme styles.
 */

/* Container */
.srp-bizum-rtp-blocks-content {
	padding: 0;
}

.srp-bizum-rtp-blocks-content > p {
	margin: 0 0 16px 0;
	color: var(--wp--preset--color--contrast-2, var(--wc-block-components-checkout-step-description-color, inherit));
	font-size: var(--wp--preset--font-size--small, 14px);
	line-height: 1.5;
	opacity: 0.8;
}

/* Phone field container */
.srp-bizum-rtp-phone-field {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

/* Label */
.srp-bizum-rtp-phone-field > label {
	display: block;
	font-weight: 600;
	font-size: var(--wp--preset--font-size--small, 14px);
	color: var(--wp--preset--color--contrast, var(--wc-block-components-text-input-label-color, inherit));
	margin-bottom: 4px;
}

.srp-bizum-rtp-phone-field > label .required {
	color: var(--wc-block-components-required-indicator-color, var(--wp--preset--color--vivid-red, #cc0000));
}

/* Input wrapper */
.srp-bizum-rtp-input-wrapper {
	position: relative;
	display: flex;
	align-items: center;
}

/* Phone input - inherit from WooCommerce blocks or theme */
.srp-bizum-rtp-phone-field input[type="tel"],
.srp-bizum-rtp-phone-input {
	width: 100%;
	padding: var(--wc-block-components-text-input-padding, 12px 16px);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--medium, 16px);
	line-height: var(--wc-block-components-text-input-line-height, 1.5);
	border: 1px solid var(--wp--preset--color--contrast-3, var(--wc-block-components-text-input-border-color, currentColor));
	border-radius: var(--wc-block-components-text-input-border-radius, var(--wp--custom--border-radius, 4px));
	background-color: var(--wp--preset--color--base, var(--wc-block-components-text-input-background-color, #fff));
	color: var(--wp--preset--color--contrast, var(--wc-block-components-text-input-color, inherit));
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	box-sizing: border-box;
}

.srp-bizum-rtp-phone-field input[type="tel"]:focus,
.srp-bizum-rtp-phone-input:focus {
	outline: none;
	border-color: var(--wp--preset--color--primary, var(--wc-block-components-text-input-border-focus-color, currentColor));
	box-shadow: 0 0 0 1px var(--wp--preset--color--primary, var(--wc-block-components-text-input-border-focus-color, currentColor));
}

.srp-bizum-rtp-phone-field input[type="tel"]::placeholder,
.srp-bizum-rtp-phone-input::placeholder {
	color: var(--wp--preset--color--contrast-3, var(--wc-block-components-text-input-placeholder-color, currentColor));
	opacity: 0.6;
}

/* Hint text */
.srp-bizum-rtp-phone-hint {
	display: block;
	font-size: var(--wp--preset--font-size--small, 13px);
	color: var(--wp--preset--color--contrast-2, inherit);
	line-height: 1.4;
	margin-top: 4px;
	opacity: 0.7;
}

/* Error message */
.srp-bizum-rtp-error {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	padding: 12px;
	background-color: var(--wc-block-components-notice-error-background-color, rgba(204, 0, 0, 0.05));
	border: 1px solid var(--wc-block-components-notice-error-border-color, rgba(204, 0, 0, 0.2));
	border-radius: var(--wc-block-components-text-input-border-radius, var(--wp--custom--border-radius, 4px));
	color: var(--wc-block-components-notice-error-color, var(--wp--preset--color--vivid-red, #cc0000));
	font-size: var(--wp--preset--font-size--small, 13px);
	line-height: 1.4;
	margin-top: 8px;
}

.srp-bizum-rtp-error::before {
	content: "\26A0";
	flex-shrink: 0;
	font-size: 16px;
}

/* Success state */
.srp-bizum-rtp-success {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	padding: 12px;
	background-color: var(--wc-block-components-notice-success-background-color, rgba(0, 128, 0, 0.05));
	border: 1px solid var(--wc-block-components-notice-success-border-color, rgba(0, 128, 0, 0.2));
	border-radius: var(--wc-block-components-text-input-border-radius, var(--wp--custom--border-radius, 4px));
	color: var(--wc-block-components-notice-success-color, var(--wp--preset--color--vivid-green-cyan, #008000));
	font-size: var(--wp--preset--font-size--small, 13px);
	line-height: 1.4;
	margin-top: 8px;
}

.srp-bizum-rtp-success::before {
	content: "\2713";
	flex-shrink: 0;
	font-size: 16px;
}

/* Loading state */
.srp-bizum-rtp-loading {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--wp--preset--color--primary, var(--wc-block-components-text-input-border-focus-color, inherit));
}

.srp-bizum-rtp-loading::before {
	content: "";
	display: inline-block;
	width: 14px;
	height: 14px;
	border: 2px solid currentColor;
	border-top-color: transparent;
	border-radius: 50%;
	animation: srp-bizum-spin 0.8s linear infinite;
}

@keyframes srp-bizum-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Classic checkout styles (non-blocks) - inherit from theme */
.payment_method_redsys_bizum_rtp .srp-bizum-rtp-phone-wrapper {
	margin-top: 15px;
}

.payment_method_redsys_bizum_rtp .srp-bizum-rtp-phone-wrapper label {
	display: block;
	font-weight: 600;
	margin-bottom: 8px;
}

.payment_method_redsys_bizum_rtp .srp-bizum-rtp-phone-wrapper input {
	width: 100%;
	max-width: 300px;
}

/* Status container for classic checkout */
.bizum-rtp-status {
	margin-top: 10px;
	padding: 10px 15px;
	border-radius: var(--wp--custom--border-radius, 4px);
	display: none;
}

.bizum-rtp-status.loading {
	background-color: var(--wc-block-components-notice-info-background-color, rgba(0, 128, 255, 0.05));
	border: 1px solid var(--wc-block-components-notice-info-border-color, rgba(0, 128, 255, 0.2));
	color: var(--wc-block-components-notice-info-color, inherit);
}

.bizum-rtp-status.success {
	background-color: var(--wc-block-components-notice-success-background-color, rgba(0, 128, 0, 0.05));
	border: 1px solid var(--wc-block-components-notice-success-border-color, rgba(0, 128, 0, 0.2));
	color: var(--wc-block-components-notice-success-color, var(--wp--preset--color--vivid-green-cyan, #008000));
}

.bizum-rtp-status.error {
	background-color: var(--wc-block-components-notice-error-background-color, rgba(204, 0, 0, 0.05));
	border: 1px solid var(--wc-block-components-notice-error-border-color, rgba(204, 0, 0, 0.2));
	color: var(--wc-block-components-notice-error-color, var(--wp--preset--color--vivid-red, #cc0000));
}

.bizum-rtp-status.warning {
	background-color: var(--wc-block-components-notice-warning-background-color, rgba(255, 165, 0, 0.05));
	border: 1px solid var(--wc-block-components-notice-warning-border-color, rgba(255, 165, 0, 0.2));
	color: var(--wc-block-components-notice-warning-color, var(--wp--preset--color--luminous-vivid-orange, #d97706));
}

.bizum-rtp-status-icon {
	display: inline-block;
	margin-right: 8px;
}

.bizum-rtp-status .spinner {
	display: inline-block;
	width: 14px;
	height: 14px;
	border: 2px solid currentColor;
	border-top-color: transparent;
	border-radius: 50%;
	animation: srp-bizum-spin 0.8s linear infinite;
	vertical-align: middle;
}

/* Responsive */
@media (max-width: 480px) {
	.srp-bizum-rtp-phone-field input[type="tel"],
	.srp-bizum-rtp-phone-input {
		font-size: 16px; /* Prevent zoom on iOS */
		padding: 14px 16px;
	}
}
