/* GarantiBBVA Payment Gateway - storefront styles
 *
 * Themes can restyle the card element through these custom properties, e.g.
 * .gpgw-card { --gpgw-accent: #1a7f37; }
 */

.gpgw-card {
	--gpgw-accent: #0570de;
	--gpgw-accent-ring: rgba(5, 112, 222, .25);
	--gpgw-text: #30313d;
	--gpgw-muted: #6d6e78;
	--gpgw-placeholder: #a3a4ab;
	--gpgw-border: #e0e0e6;
	--gpgw-bg: #ffffff;
	--gpgw-danger: #df1b41;
	--gpgw-danger-ring: rgba(223, 27, 65, .2);
	--gpgw-radius: 6px;
	--gpgw-shadow: 0 1px 1px rgba(0, 0, 0, .03), 0 3px 6px rgba(18, 42, 66, .02);

	border: 0;
	margin: 0;
	padding: 0;
	color: var(--gpgw-text);
	font-size: 15px;
	line-height: 1.4;
}
.gpgw-card *,
.gpgw-card *::before,
.gpgw-card *::after { box-sizing: border-box; }

.gpgw-description { margin: 0 0 14px; color: var(--gpgw-muted); font-size: 14px; }
.gpgw-description p { margin: 0; }

.gpgw-sr {
	position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Card element --------------------------------------------------------- */

.gpgw-label {
	display: block; margin: 0 0 6px; font-size: 14px; font-weight: 500; color: var(--gpgw-text);
}

.gpgw-group {
	position: relative;
	background: var(--gpgw-bg);
	border: 1px solid var(--gpgw-border);
	border-radius: var(--gpgw-radius);
	box-shadow: var(--gpgw-shadow);
	transition: border-color .15s ease, box-shadow .15s ease;
}
.gpgw-group-row { display: flex; border-top: 1px solid var(--gpgw-border); }

.gpgw-cell { position: relative; flex: 1 1 0; display: flex; align-items: center; min-width: 0; }
.gpgw-cell + .gpgw-cell { border-left: 1px solid var(--gpgw-border); }

/* Focus / error ring drawn per cell so the group keeps its single outline. */
.gpgw-cell::after {
	content: ""; position: absolute; inset: -1px; pointer-events: none; border-radius: inherit;
	border: 1px solid transparent; transition: border-color .15s ease, box-shadow .15s ease;
}
.gpgw-cell--number { border-radius: var(--gpgw-radius) var(--gpgw-radius) 0 0; }
.gpgw-cell--expiry { border-radius: 0 0 0 var(--gpgw-radius); }
.gpgw-cell--cvc { border-radius: 0 0 var(--gpgw-radius) 0; }
.gpgw-cell:focus-within { z-index: 1; }
.gpgw-cell:focus-within::after { border-color: var(--gpgw-accent); box-shadow: 0 0 0 3px var(--gpgw-accent-ring); }
.gpgw-cell.is-invalid::after { border-color: var(--gpgw-danger); }
.gpgw-cell.is-invalid:focus-within::after { box-shadow: 0 0 0 3px var(--gpgw-danger-ring); }

/* Reset theme input styling inside the element. */
.gpgw-card .gpgw-input,
.gpgw-card input.gpgw-input[type="text"],
.gpgw-card input.gpgw-input[type="password"],
.gpgw-card input.gpgw-input[type="tel"] {
	-webkit-appearance: none; appearance: none;
	display: block; width: 100%; min-width: 0; height: auto; margin: 0;
	padding: 12px 14px; border: 0 !important; border-radius: 0; outline: 0 !important;
	background: transparent !important; box-shadow: none !important;
	color: var(--gpgw-text); font: inherit; font-size: 16px; line-height: 1.35;
	letter-spacing: .01em; font-variant-numeric: tabular-nums;
}
.gpgw-card .gpgw-input::placeholder { color: var(--gpgw-placeholder); opacity: 1; }
.gpgw-cell.is-invalid .gpgw-input { color: var(--gpgw-danger); }
.gpgw-cell--number .gpgw-input { padding-right: 150px; }
.gpgw-cell--cvc .gpgw-input { padding-right: 44px; }

/* Brand badges (text marks, no logos) */
.gpgw-brands {
	position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
	display: flex; gap: 4px; pointer-events: none;
}
.gpgw-badge {
	display: inline-flex; align-items: center; justify-content: center;
	height: 20px; min-width: 30px; padding: 0 5px; border-radius: 3px;
	border: 1px solid var(--gpgw-border); background: #fff;
	font: 800 9px/1 system-ui, -apple-system, "Segoe UI", sans-serif; letter-spacing: .02em;
	text-transform: uppercase; transition: opacity .15s ease, transform .15s ease;
}
.gpgw-badge--visa { color: #1a1f71; font-style: italic; }
.gpgw-badge--mastercard { color: #eb001b; }
.gpgw-badge--amex { color: #fff; background: #1f72cd; border-color: #1f72cd; }
.gpgw-badge--troy { color: #00a2a6; height: 22px; min-width: 34px; border-radius: 3px; font-size: 9.5px; text-transform: lowercase; letter-spacing: 0; }
/* Official logos (from WooCommerce) carry their own frame. */
.gpgw-badge--logo { padding: 0; border: 0; background: none; min-width: 0; height: auto; }
.gpgw-card .gpgw-badge--logo img { display: block; width: 34px; height: 22px; max-width: none; margin: 0; border: 0; box-shadow: none; border-radius: 3px; }
/* Once a brand is detected only its badge stays visible. */
.gpgw-brands[data-brand="visa"] .gpgw-badge:not(.gpgw-badge--visa),
.gpgw-brands[data-brand="mastercard"] .gpgw-badge:not(.gpgw-badge--mastercard),
.gpgw-brands[data-brand="amex"] .gpgw-badge:not(.gpgw-badge--amex),
.gpgw-brands[data-brand="troy"] .gpgw-badge:not(.gpgw-badge--troy) { display: none; }

.gpgw-cvc-icon {
	position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
	width: 24px; height: 16px; color: var(--gpgw-muted); pointer-events: none;
}

.gpgw-field-error {
	display: flex; align-items: flex-start; gap: 6px; min-height: 0; margin: 6px 0 0;
	color: var(--gpgw-danger); font-size: 13px;
}
.gpgw-field-error:empty { display: none; }
.gpgw-field-error::before {
	content: "!"; flex: none; width: 15px; height: 15px; margin-top: 1px; border-radius: 50%;
	background: var(--gpgw-danger); color: #fff; font: 700 10px/15px system-ui, sans-serif; text-align: center;
}

.gpgw-secure-note {
	display: flex; align-items: center; gap: 6px; margin: 10px 0 0; color: var(--gpgw-muted); font-size: 12px;
}
.gpgw-secure-note svg { width: 12px; height: 12px; flex: none; }

/* Installment plans ------------------------------------------------------ */

.gpgw-plans { margin-top: 14px; clear: both; }
.gpgw-plans:empty { display: none; }
.gpgw-plan-heading { margin: 0 0 6px; font-size: 14px; font-weight: 500; color: var(--gpgw-text); }
.gpgw-hint { margin: 10px 0 0; font-size: 13px; color: var(--gpgw-muted); }
.gpgw-plan-list { display: flex; flex-direction: column; gap: 4px; }

.gpgw-plan {
	position: relative; display: grid; grid-template-columns: 16px 1fr auto; align-items: center; gap: 10px;
	margin: 0; padding: 8px 12px; cursor: pointer; line-height: 1.3;
	background: var(--gpgw-bg); border: 1px solid var(--gpgw-border); border-radius: var(--gpgw-radius);
	box-shadow: var(--gpgw-shadow); transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
/* Themes often add margins to <label> and <p>; keep the list tight regardless. */
.gpgw-card .gpgw-plan-list > .gpgw-plan { margin: 0 !important; }
.gpgw-card .gpgw-plan-list > .gpgw-plan-heading { margin: 0 0 4px !important; }
.gpgw-card .gpgw-hint { margin-bottom: 0 !important; }
.gpgw-plan:hover { border-color: #c9cad3; }
.gpgw-plan.is-selected { border-color: var(--gpgw-accent); box-shadow: 0 0 0 1px var(--gpgw-accent); }
.gpgw-plan:focus-within { box-shadow: 0 0 0 3px var(--gpgw-accent-ring); }

.gpgw-card .gpgw-plan input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.gpgw-plan-dot {
	width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid #c9cad3; background: #fff;
	transition: border-color .15s ease, border-width .15s ease;
}
.gpgw-plan.is-selected .gpgw-plan-dot { border: 4.5px solid var(--gpgw-accent); }

.gpgw-plan-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; min-width: 0; }
.gpgw-plan-title { font-size: 14px; font-weight: 500; color: var(--gpgw-text); }
.gpgw-plan-monthly { font-size: 12.5px; color: var(--gpgw-muted); }
.gpgw-plan-monthly:empty { display: none; }
.gpgw-plan-total { font-size: 14px; font-weight: 600; color: var(--gpgw-text); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Block checkout spacing */
.gpgw-card--block { margin-top: 4px; }

@media (max-width: 480px) {
	.gpgw-cell--number .gpgw-input { padding-right: 56px; }
	.gpgw-brands[data-brand=""] .gpgw-badge:not(:first-child) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.gpgw-card * { transition: none !important; animation: none !important; }
}
