/**
 * HR-Pay checkout styles — classic + Blocks + order-received widget.
 */

.hrpay-fields,
.hrpay-block-fields {
	--hrpay-accent: #6c2bd9;
	--hrpay-border: rgba(0, 0, 0, .14);
	--hrpay-bg: rgba(0, 0, 0, .015);
	--hrpay-muted: rgba(0, 0, 0, .55);
	margin-top: .5em;
}

.hrpay-desc {
	margin: 0 0 1em;
	color: var(--hrpay-muted);
}

.hrpay-field {
	margin-bottom: 1.1em !important;
}

.hrpay-field > label {
	display: block;
	font-weight: 600;
	margin-bottom: .4em;
	font-size: .92em;
}

.hrpay-country,
.hrpay-fields .hrpay-phone,
.hrpay-block-fields .hrpay-phone {
	width: 100%;
	box-sizing: border-box;
	padding: .7em .85em;
	border: 1px solid var(--hrpay-border);
	border-radius: 10px;
	background: #fff;
	font-size: 1em;
	line-height: 1.3;
}

.hrpay-country:focus,
.hrpay-phone:focus {
	outline: none;
	border-color: var(--hrpay-accent);
	box-shadow: 0 0 0 3px rgba(108, 43, 217, .15);
}

/* Operator chips ------------------------------------------------------- */
.hrpay-op-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
	gap: .55em;
}

.hrpay-op-chip {
	position: relative;
	display: flex !important;
	align-items: center;
	gap: .55em;
	padding: .65em 1.5em .65em .7em;
	border: 1.5px solid var(--hrpay-border);
	border-radius: 12px;
	background: #fff;
	cursor: pointer;
	transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease;
	margin: 0 !important;
	font-weight: 600;
	font-size: .9em;
	user-select: none;
	overflow: hidden;
}

.hrpay-op-chip:hover {
	transform: translateY(-1px);
	border-color: var(--hrpay-op, var(--hrpay-accent));
}

.hrpay-op-chip input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.hrpay-op-chip.is-selected {
	border-color: var(--hrpay-op, var(--hrpay-accent));
	box-shadow: 0 0 0 2px var(--hrpay-op, var(--hrpay-accent)) inset;
}

.hrpay-op-logo {
	width: 22px;
	height: 22px;
	object-fit: contain;
	border-radius: 5px;
	background: #fff;
	flex: 0 0 auto;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, .06);
}

.hrpay-op-dot {
	width: 14px;
	height: 14px;
	border-radius: 50%;
	flex: 0 0 auto;
	box-shadow: 0 0 0 2px rgba(255, 255, 255, .6) inset;
}

.hrpay-op-name {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	flex: 1;
	text-align: left;
}

/* Selected tick badge */
.hrpay-op-tick {
	position: absolute;
	top: 6px;
	right: 6px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--hrpay-op, var(--hrpay-accent));
	color: #fff;
	font-size: 11px;
	line-height: 18px;
	text-align: center;
	transform: scale(0);
	transition: transform .15s ease;
}
.hrpay-op-chip.is-selected .hrpay-op-tick { transform: scale(1); }

/* Phone with dial prefix ---------------------------------------------- */
.hrpay-phone-wrap {
	display: flex;
	align-items: stretch;
	border: 1px solid var(--hrpay-border);
	border-radius: 10px;
	overflow: hidden;
	background: #fff;
}

.hrpay-phone-wrap:focus-within {
	border-color: var(--hrpay-accent);
	box-shadow: 0 0 0 3px rgba(108, 43, 217, .15);
}

.hrpay-dial {
	display: flex;
	align-items: center;
	padding: 0 .8em;
	background: var(--hrpay-bg);
	font-weight: 700;
	color: var(--hrpay-muted);
	border-right: 1px solid var(--hrpay-border);
	white-space: nowrap;
}

.hrpay-phone-wrap .hrpay-phone {
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	flex: 1;
}

.hrpay-hint {
	display: block;
	margin-top: .35em;
	font-size: .82em;
	color: var(--hrpay-muted);
}

.hrpay-convert {
	margin: 0 0 1em;
	padding: .6em .8em;
	background: rgba(108, 43, 217, .07);
	border-left: 3px solid var(--hrpay-accent);
	border-radius: 8px;
	font-size: .88em;
}
.hrpay-convert strong { font-weight: 800; }

.hrpay-test-note {
	margin-top: .8em;
	padding: .55em .7em;
	background: #fff8e1;
	border: 1px solid #ffe08a;
	border-radius: 8px;
	font-size: .82em;
	color: #7a5b00;
}

.hrpay-empty {
	padding: .8em;
	background: #fdecea;
	border-radius: 8px;
	color: #a12622;
}

/* Gateway icon --------------------------------------------------------- */
.hrpay-gateway-icon,
.hrpay-block-icon {
	max-height: 18px;
	width: auto;
	vertical-align: middle;
	border-radius: 3px;
}

.hrpay-block-label {
	display: inline-flex;
	align-items: center;
	gap: .5em;
}

/* ===================================================================== *
 * Order-received / result waiting widget
 * ===================================================================== */
.hrpay-receipt {
	--hrpay-accent: #6c2bd9;
	max-width: 460px;
	margin: 1.5em auto;
	padding: 1.8em 1.6em;
	border: 1px solid rgba(0, 0, 0, .1);
	border-radius: 18px;
	text-align: center;
	background: #fff;
	box-shadow: 0 14px 40px rgba(0, 0, 0, .08);
}

.hrpay-receipt-logo {
	max-height: 16px;
	width: auto;
	margin: 0 auto .2em;
	display: block;
	opacity: .75;
	border-radius: 3px;
}

/* Animation container -------------------------------------------------- */
.hrpay-anim-wrap {
	position: relative;
	width: 72px;
	height: 72px;
	margin: .5em auto .9em;
}
.hrpay-anim {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: none;
}
.hrpay-state-pending .hrpay-anim-pending,
.hrpay-state-idle .hrpay-anim-pending { display: block; }
.hrpay-state-success .hrpay-anim-success { display: block; }
.hrpay-state-failed .hrpay-anim-failed { display: block; }

/* Pending ring */
.hrpay-ring-track {
	fill: none;
	stroke: rgba(108, 43, 217, .15);
	stroke-width: 5;
}
.hrpay-ring-spin {
	fill: none;
	stroke: var(--hrpay-accent);
	stroke-width: 5;
	stroke-linecap: round;
	stroke-dasharray: 60 116;
	transform-origin: 50% 50%;
	animation: hrpay-spin 1.05s linear infinite;
}
.hrpay-state-idle .hrpay-ring-spin { animation-play-state: paused; opacity: .5; }

/* Success check draw */
.hrpay-anim-circle {
	fill: none;
	stroke-width: 4;
	stroke-linecap: round;
	stroke-dasharray: 189;
	stroke-dashoffset: 189;
}
.hrpay-anim-circle-ok { stroke: #1a9c53; }
.hrpay-anim-circle-ko { stroke: #d5342c; }
.hrpay-state-success .hrpay-anim-circle-ok { animation: hrpay-draw .5s ease forwards; }
.hrpay-state-failed .hrpay-anim-circle-ko { animation: hrpay-draw .5s ease forwards; }

.hrpay-anim-check {
	fill: none;
	stroke: #1a9c53;
	stroke-width: 5;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-dasharray: 42;
	stroke-dashoffset: 42;
}
.hrpay-state-success .hrpay-anim-check { animation: hrpay-draw .35s .45s ease forwards; }

.hrpay-anim-cross {
	fill: none;
	stroke: #d5342c;
	stroke-width: 5;
	stroke-linecap: round;
	stroke-dasharray: 29;
	stroke-dashoffset: 29;
}
.hrpay-state-failed .hrpay-anim-cross { animation: hrpay-draw .3s .45s ease forwards; }
.hrpay-state-failed .hrpay-anim-cross-2 { animation-delay: .6s; }

.hrpay-state-success .hrpay-anim-success { animation: hrpay-pop .35s ease; }
.hrpay-state-failed .hrpay-anim-failed { animation: hrpay-shake .5s ease; }

.hrpay-receipt-title {
	margin: .2em 0 .3em;
	font-size: 1.25em;
	font-weight: 700;
}

.hrpay-receipt-msg {
	margin: 0 0 1em;
	color: rgba(0, 0, 0, .6);
}
.hrpay-state-pending .hrpay-receipt-msg::after {
	content: '';
	animation: hrpay-dots 1.4s steps(4, end) infinite;
}

.hrpay-receipt-meta {
	list-style: none;
	margin: 1.2em 0 0;
	padding: 1em 0 0;
	border-top: 1px dashed rgba(0, 0, 0, .12);
	text-align: left;
}
.hrpay-receipt-meta li {
	display: flex;
	justify-content: space-between;
	gap: 1em;
	padding: .3em 0;
	font-size: .9em;
}
.hrpay-receipt-meta li span { color: rgba(0, 0, 0, .55); }
.hrpay-receipt-meta li strong { word-break: break-all; text-align: right; }

.hrpay-retry-btn { margin-top: 1.2em; }

@keyframes hrpay-spin { to { transform: rotate(360deg); } }
@keyframes hrpay-draw { to { stroke-dashoffset: 0; } }
@keyframes hrpay-pop { 0% { transform: scale(.7); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes hrpay-shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
@keyframes hrpay-dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }

/* Dark scheme ---------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
	.hrpay-fields,
	.hrpay-block-fields {
		--hrpay-border: rgba(255, 255, 255, .18);
		--hrpay-bg: rgba(255, 255, 255, .04);
		--hrpay-muted: rgba(255, 255, 255, .6);
	}
	.hrpay-country,
	.hrpay-phone-wrap,
	.hrpay-op-chip {
		background: rgba(255, 255, 255, .04);
		color: inherit;
	}
	.hrpay-receipt {
		background: #1c1c22;
		border-color: rgba(255, 255, 255, .12);
		box-shadow: none;
	}
	.hrpay-receipt-meta li span,
	.hrpay-receipt-msg { color: rgba(255, 255, 255, .6); }
}

@media (max-width: 480px) {
	.hrpay-op-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
	.hrpay-ring-spin, .hrpay-anim-circle, .hrpay-anim-check, .hrpay-anim-cross,
	.hrpay-anim-success, .hrpay-anim-failed { animation: none !important; stroke-dashoffset: 0 !important; }
}
