/**
 * Accept Blue TBT — Main Stylesheet
 *
 * Color scheme system: light / dark / auto / custom
 * Uses CSS custom properties for easy theming.
 *
 * @package AcceptBlueTBT
 */

/* ==========================================================================
   1. CSS Custom Properties — Light (default)
   ========================================================================== */

/* :root,
body[data-abtbt-scheme="light"] {
	--abtbt-bg:           #ffffff;
	--abtbt-bg-alt:       #f8f9fa;
	--abtbt-bg-input:     #f7f7f7;
	--abtbt-text:         #1d2327;
	--abtbt-text-muted:   #6b7280;
	--abtbt-border:       #d0d5dd;
	--abtbt-border-input: #d0d5dd;
	--abtbt-accent:       #2271b1;
	--abtbt-btn-bg:       #2271b1;
	--abtbt-btn-hover:    #135e96;
	--abtbt-btn-text:     #ffffff;
	--abtbt-error:        #cc1818;
	--abtbt-success:      #00a32a;
	--abtbt-overlay:      rgba(255, 255, 255, 0.6);
	--abtbt-radius:       6px;
}

/* ==========================================================================
   2. Dark Scheme
   ========================================================================== */

/* body[data-abtbt-scheme="dark"] {
	--abtbt-bg:           #1e1e1e;
	--abtbt-bg-alt:       #2a2a2a;
	--abtbt-bg-input:     #2a2a2a;
	--abtbt-text:         #e8e8e8;
	--abtbt-text-muted:   #9ca3af;
	--abtbt-border:       #3f3f3f;
	--abtbt-border-input: #3f3f3f;
	--abtbt-accent:       #72aee6;
	--abtbt-btn-bg:       #72aee6;
	--abtbt-btn-hover:    #5a9bd5;
	--abtbt-btn-text:     #1e1e1e;
	--abtbt-error:        #f87171;
	--abtbt-success:      #4ade80;
	--abtbt-overlay:      rgba(0, 0, 0, 0.55);
}
 */
/* ==========================================================================
   3. Auto Scheme — respects prefers-color-scheme
   ========================================================================== */

/* @media (prefers-color-scheme: dark) {
	body[data-abtbt-scheme="auto"] {
		--abtbt-bg:           #1e1e1e;
		--abtbt-bg-alt:       #2a2a2a;
		--abtbt-bg-input:     #2a2a2a;
		--abtbt-text:         #e8e8e8;
		--abtbt-text-muted:   #9ca3af;
		--abtbt-border:       #3f3f3f;
		--abtbt-border-input: #3f3f3f;
		--abtbt-accent:       #72aee6;
		--abtbt-btn-bg:       #72aee6;
		--abtbt-btn-hover:    #5a9bd5;
		--abtbt-btn-text:     #1e1e1e;
		--abtbt-error:        #f87171;
		--abtbt-success:      #4ade80;
		--abtbt-overlay:      rgba(0, 0, 0, 0.55);
	}
} */

/* ==========================================================================
   4. Custom Scheme — properties injected by JS
   ========================================================================== */

/* body[data-abtbt-scheme="custom"] {
	--abtbt-bg:           var(--abtbt-custom-bg, #f7f7f7);
	--abtbt-bg-alt:       var(--abtbt-custom-bg, #f7f7f7);
	--abtbt-bg-input:     var(--abtbt-custom-bg, #f7f7f7);
	--abtbt-text:         var(--abtbt-custom-text, #333333);
	--abtbt-text-muted:   var(--abtbt-custom-text, #333333);
	--abtbt-border:       var(--abtbt-custom-border, #cccccc);
	--abtbt-border-input: var(--abtbt-custom-border, #cccccc);
} */

/* ==========================================================================
   5. Hosted Tokenization Form Container
   ========================================================================== */

#abtbt-hosted-tokenization-form {
	position: relative;
	padding: 16px 0 0;
	color: #060607;
}

/* Note / description */
.abtbt-ht-note {
	margin: 0 0 14px;
	font-size: 13px;
	color: #060607;
	line-height: 1.5;
}

/* ==========================================================================
   6. Sandbox / Test Mode Notice
   ========================================================================== */

.abtbt-sandbox-notice {
	background: #fff3cd;
	border: 1px solid #ffc107;
	border-radius: 10px ;
	padding: 10px 14px;
	margin: 0 0 14px;
	font-size: 13px;
	color: #856404;
	line-height: 1.5;
}

body[data-abtbt-scheme="dark"] .abtbt-sandbox-notice {
	background: #3d3100;
	border-color: #806600;
	color: #ffd54f;
}

/* ==========================================================================
   7. Saved Tokens List
   ========================================================================== */

.abtbt-ht-saved-tokens {
	margin: 0 0 16px;
}

.abtbt-ht-saved-tokens__label {
	display: block;
	margin: 0 0 8px;
	font-size: 14px;
	font-weight: 600;
	color: var(--abtbt-text);
}

.abtbt-ht-token-list {
	list-style: none;
	margin: 0;
	padding: 0;
	border: 1px solid var(--abtbt-border);
	border-radius: var(--abtbt-radius);
	overflow: hidden;
}

.abtbt-ht-token-item {
	display: flex;
	align-items: center;
	padding: 10px 14px;
	border-bottom: 1px solid var(--abtbt-border);
	background: var(--abtbt-bg);
	cursor: pointer;
	transition: background 0.15s ease;
}

.abtbt-ht-token-item:last-child {
	border-bottom: none;
}

.abtbt-ht-token-item:hover {
	background: var(--abtbt-bg-alt);
}

.abtbt-ht-token-item--default {
	/* subtle highlight for default card */
}

.abtbt-ht-token-label {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	cursor: pointer;
	font-size: 14px;
	color: var(--abtbt-text);
	line-height: 1.4;
}

.abtbt-ht-token-radio {
	flex-shrink: 0;
	margin: 0;
	accent-color: var(--abtbt-accent);
}

/* Card brand icons */
.abtbt-ht-token-card-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 24px;
	border-radius: 3px;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	color: #ffffff;
	background: #6b7280;
	flex-shrink: 0;
	letter-spacing: 0.02em;
}

.abtbt-ht-token-card-icon--visa        { background: #1a1f71; }
.abtbt-ht-token-card-icon--mastercard   { background: #252525; }
.abtbt-ht-token-card-icon--amex         { background: #007bc1; }
.abtbt-ht-token-card-icon--discover     { background: #f76f20; }
.abtbt-ht-token-card-icon--jcb          { background: #003087; }
.abtbt-ht-token-card-icon--diners       { background: #004b87; }
.abtbt-ht-token-card-icon--unionpay     { background: #c0392b; }
.abtbt-ht-token-card-icon--card         { background: #6b7280; }
.abtbt-ht-token-card-icon--new          { background: var(--abtbt-accent); }

.abtbt-ht-token-card-info {
	flex: 1;
	font-size: 14px;
}

.abtbt-ht-token-exp {
	font-size: 12px;
	color: var(--abtbt-text-muted);
	margin-left: 4px;
}

/* ==========================================================================
   8. New Card Section
   ========================================================================== */

.abtbt-ht-new-card-section {
	margin: 0 0 14px;
}

.abtbt-ht-new-card-label {
	display: block;
	margin: 0 0 10px;
	font-size: 14px;
	font-weight: 600;
	color: #060607;
}

/* Field wrapper */
.abtbt-ht-field {
	margin: 0 0 12px;
}

.abtbt-ht-field__label {
	display: block;
	margin: 0 0 4px;
	font-size: 13px;
	font-weight: 500;
	color: var(--abtbt-text);
}

/* Text inputs (name on card) */
.abtbt-ht-input {
	display: block;
	width: 100%;
	padding: 10px 12px;
	font-size: 14px;
	line-height: 1.4;
	color: var(--abtbt-text);
	background: var(--abtbt-bg-input);
	border: 2px solid var(--abtbt-border-input);
	border-radius: var(--abtbt-radius);
	box-sizing: border-box;
	transition: border-color 0.15s ease;
	outline: none;
}

.abtbt-ht-input:focus {
	border-color: var(--abtbt-accent);
}

/* ==========================================================================
   9. Hosted Tokenization Iframe Container
   ========================================================================== */

#abtbt-ht-iframe-container {
	width: 100%;
	min-height: 70px;
	margin: 0 0 14px;
	border-radius: var(--abtbt-radius);
	overflow: hidden;
}

/* Override WC's default 10% height on iframes */
#abtbt-ht-iframe-container iframe {
	display: block;
	width: 100% !important;
	height: 70px !important;
	min-height: 70px;
}

/* ==========================================================================
   10. Save Card Checkbox
   ========================================================================== */

.abtbt-save-card-row,
.abtbt-ht-save-card-row {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 14px;
	padding: 10px 14px;
	background: var(--abtbt-bg-alt);
	border: 1px solid var(--abtbt-border);
	border-radius: var(--abtbt-radius);
}

#abtbt-ht-save-card {
	margin: 0;
	accent-color: var(--abtbt-accent);
}

.abtbt-save-card-label {
	font-size: 13px;
	color: var(--abtbt-text);
	cursor: pointer;
}

/* ==========================================================================
   11. Error Message
   ========================================================================== */

#abtbt-ht-error-message {
	display: none;
	margin: 0 0 12px;
	padding: 10px 14px;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.5;
	color: var(--abtbt-error);
	background: rgba(204, 24, 24, 0.06);
	border: 1px solid rgba(204, 24, 24, 0.15);
	border-radius: var(--abtbt-radius);
}

body[data-abtbt-scheme="dark"] #abtbt-ht-error-message {
	background: rgba(248, 113, 113, 0.08);
	border-color: rgba(248, 113, 113, 0.2);
}

/* ==========================================================================
   12. Place Order / Charge Button (order-pay page)
   ========================================================================== */

#abtbt-ht-charge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 13px 24px;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.4;
	color:    #e8e8e8;
	background: #72aee6;
	border: none;
	border-radius: 10px;
	cursor: pointer;
	transition: background 0.15s ease, box-shadow 0.15s ease;
	box-sizing: border-box;
}

#abtbt-ht-charge:hover {
	background: #72aee6;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

#abtbt-ht-charge:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* ==========================================================================
   13. AJAX Loading Overlay
   ========================================================================== */

#abtbt-hosted-token-ajax-loader {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 10000;
	background: var(--abtbt-overlay);
	align-items: center;
	justify-content: center;
}

#abtbt-hosted-token-ajax-loader::after {
	content: "";
	display: block;
	width: 40px;
	height: 40px;
	border: 4px solid var(--abtbt-border);
	border-top-color: var(--abtbt-accent);
	border-radius: 50%;
	animation: abtbt-spin 0.8s linear infinite;
}

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

/* ==========================================================================
   14. 3D Secure Overlay — ensure challenge iframe is on top
   ========================================================================== */

body > div[id*="acceptblue"],
body > div[class*="acceptblue"],
body > div[class*="ab-3ds"],
body > div[class*="challenge"],
body > div[class*="paay"],
body > iframe[id*="Cardinal"] {
	z-index: 999999 !important;
}

/* ==========================================================================
   15. Test Cards Notice (Block Checkout)
   ========================================================================== */

.abtbt-test-cards-notice {
	background: #fff8e1;
	border: 1px solid #ffe082;
	border-left: 3px solid #ffb300;
	border-radius: 4px;
	padding: 10px 14px;
	margin: 0 0 12px;
	font-size: 12px;
	color: #5d4200;
	line-height: 1.6;
}

.abtbt-test-cards-notice strong {
	display: block;
	margin-bottom: 4px;
	font-size: 11px;
	letter-spacing: 0.03em;
	color: #e65100;
}

body[data-abtbt-scheme="dark"] .abtbt-test-cards-notice {
	background: #3d2e00;
	border-color: #806600;
	border-left-color: #ffb300;
	color: #ffe082;
}

body[data-abtbt-scheme="dark"] .abtbt-test-cards-notice strong {
	color: #ffb74d;
}

.abtbt-test-cards-notice code {
	background: rgba(0, 0, 0, 0.07);
	padding: 2px 6px;
	border-radius: 3px;
	font-size: 12px;
	font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
}

body[data-abtbt-scheme="dark"] .abtbt-test-cards-notice code {
	background: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   16. Block Checkout — Payment Method Components
   ========================================================================== */

#abtbt-block-payment-form {
	padding: 0;
}

.abtbt-block-payment-label {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.abtbt-block-payment-label img {
	height: 24px;
	width: auto;
}

/* Saved tokens list — WC block style */
.abtbt-block-saved-tokens {
	margin: 0 0 12px;
	border: 1px solid hsla(0, 0%, 7%, 0.8);
	border-radius: 4px;
	overflow: hidden;
	background: #fff;
}

.has-dark-controls .abtbt-block-saved-tokens {
	background-color: rgba(0, 0, 0, 0.1);
	border-color: hsla(0, 0%, 100%, 0.4);
}

.abtbt-block-token-option {
	display: flex;
	align-items: center;
	padding: 0;
	border-bottom: 1px solid hsla(0, 0%, 7%, 0.15);
	transition: background 0.12s ease;
}

.has-dark-controls .abtbt-block-token-option {
	border-bottom-color: hsla(0, 0%, 100%, 0.15);
}

.abtbt-block-token-option:last-child {
	border-bottom: none;
}

.abtbt-block-token-option:hover {
	background: hsla(0, 0%, 7%, 0.03);
}

.has-dark-controls .abtbt-block-token-option:hover {
	background: hsla(0, 0%, 100%, 0.05);
}

.abtbt-block-token-option label {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 12px 14px;
	cursor: pointer;
	font-size: inherit;
	font-family: inherit;
	font-weight: inherit;
	color: inherit;
	line-height: 1.4;
	margin: 0;
}

.abtbt-block-token-option input[type="radio"] {
	flex-shrink: 0;
	margin: 0;
	width: 16px;
	height: 16px;
	accent-color: currentColor;
}

/* Save card checkbox — matches WC block checkbox pattern */
.abtbt-block-save-card {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 12px 0 0;
	font-size: inherit;
	font-family: inherit;
	color: inherit;
	line-height: 1.4;
}

.abtbt-block-save-card label {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	font-size: inherit;
	font-weight: inherit;
	color: inherit;
	margin: 0;
}

.abtbt-block-save-card input[type="checkbox"] {
	appearance: none;
	-webkit-appearance: none;
	background-color: #fff;
	border: 1px solid rgba(25, 23, 17, 0.48);
	border-radius: 4px;
	box-sizing: border-box;
	height: 20px;
	width: 20px;
	min-width: 20px;
	margin: 0;
	cursor: pointer;
	position: relative;
	flex-shrink: 0;
}

.abtbt-block-save-card input[type="checkbox"]:checked {
	background-color: currentColor;
	border-color: currentColor;
}

.abtbt-block-save-card input[type="checkbox"]:checked::after {
	content: "";
	display: block;
	position: absolute;
	left: 6px;
	top: 2px;
	width: 5px;
	height: 10px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

.abtbt-block-save-card input[type="checkbox"]:focus {
	outline: 1.5px solid hsla(0, 0%, 7%, 0.8);
	outline-offset: 1.5px;
}

.has-dark-controls .abtbt-block-save-card input[type="checkbox"] {
	background-color: rgba(0, 0, 0, 0.1);
	border-color: hsla(0, 0%, 100%, 0.4);
}

/* Card wrapper — label + bordered iframe container */
.abtbt-block-card-wrapper {
	margin: 0;
	border: 1px solid hsla(0, 0%, 7%, 0.8);
	border-radius: 4px;
	background: #fff;
	padding: 14px 14px 10px;
	box-sizing: border-box;
}

.has-dark-controls .abtbt-block-card-wrapper {
	background-color: rgba(0, 0, 0, 0.1);
	border-color: hsla(0, 0%, 100%, 0.4);
}

.abtbt-block-card-label {
	display: block;
	margin: 0 0 10px;
	font-size: 16px;
	font-family: inherit;
	font-weight: inherit;
	color: inherit;
	line-height: 1.4;
}

.has-dark-controls .abtbt-block-card-label {
	color: hsla(0, 0%, 100%, 0.6);
}

.abtbt-block-card-hint {
	display: block;
	margin: 0 0 10px;
	font-size: 13px;
	color: hsla(0, 0%, 7%, 0.75);
	line-height: 1.4;
}

.has-dark-controls .abtbt-block-card-hint {
	color: hsla(0, 0%, 100%, 0.45);
}

/* Iframe container in blocks */
.abtbt-block-iframe-container {
	width: 100%;
	min-height: 0;
}

.abtbt-block-iframe-container iframe {
	display: block;
	height: 50px !important;
	min-height: 0;
	max-height: 60px;
}


/* ==========================================================================
   17. Admin — Color Picker Fields
   ========================================================================== */

.abtbt-color-picker {
	/* wp-color-picker handles styling */
}

/* Admin tab UI */
.abtbt-nav-tab-wrapper {
	margin: 0 0 20px;
	border-bottom: 1px solid #c3c4c7;
}

.abtbt-tab-panel {
	display: none;
}

.abtbt-tab-panel.abtbt-tab-active {
	display: block;
}

/* ==========================================================================
   18. WooCommerce Overrides & Responsive
   ========================================================================== */

/* Ensure payment form doesn't get squeezed */
.woocommerce-checkout #abtbt-hosted-tokenization-form,
.woocommerce-order-pay #abtbt-hosted-tokenization-form {
	max-width: 100%;
}

/* Mobile adjustments */
@media (max-width: 480px) {
	.abtbt-ht-token-label {
		font-size: 13px;
		gap: 8px;
	}

	.abtbt-ht-token-card-icon {
		width: 30px;
		height: 20px;
		font-size: 8px;
	}

	.abtbt-ht-token-exp {
		display: block;
		margin-left: 0;
		margin-top: 2px;
	}

	#abtbt-ht-charge {
		padding: 12px 16px;
		font-size: 14px;
	}
}
