/**
 * Biometric Passkey Login — Login & UI Styles
 *
 * Styles for the wp-login.php passkey button, recovery form,
 * profile/My Account passkey management, and recovery codes modal.
 *
 * @package BiometricPasskeyLogin
 */

/* ==========================================================================
   Passkey button
   ========================================================================== */

.bpl-passkey-button {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	height: 48px;
	font-size: 14px;
	font-weight: 600;
	margin-bottom: 0;
	cursor: pointer;
}

.bpl-passkey-button .dashicons {
	font-size: 20px;
	width: 20px;
	height: 20px;
	line-height: 20px;
}

.bpl-passkey-button:disabled {
	opacity: 0.7;
	cursor: not-allowed;
}

.bpl-passkey-button.bpl-loading {
	position: relative;
}

/* ==========================================================================
   Divider
   ========================================================================== */

.bpl-divider {
	display: flex;
	align-items: center;
	margin: 16px 0;
	color: #646970;
	font-size: 13px;
}

.bpl-divider::before,
.bpl-divider::after {
	content: '';
	flex: 1;
	height: 1px;
	background: #c3c4c7;
}

.bpl-divider span {
	padding: 0 12px;
	white-space: nowrap;
}

/* ==========================================================================
   Status messages
   ========================================================================== */

.bpl-status {
	text-align: center;
	margin: 8px 0;
	font-size: 13px;
	min-height: 20px;
}

.bpl-status.bpl-error {
	color: #d63638;
}

.bpl-status.bpl-success {
	color: #00a32a;
}

.bpl-status.bpl-loading-text {
	color: #646970;
}

/* ==========================================================================
   Recovery code link (above panel)
   ========================================================================== */

.bpl-recovery-link {
	display: block;
	text-align: center;
	font-size: 13px;
}

/* ==========================================================================
   Recovery code panel — replaces the login form on wp-login.php and WC login
   ========================================================================== */

.bpl-recovery-panel {
	box-sizing: border-box;
	background: #fff;
	margin: 24px auto 16px;
	padding: 26px 24px;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
	font-size: 14px;
	line-height: 1.5;
	color: #1d2327;
	width: 100%;
	max-width: 320px;
	overflow: hidden;
}

/* WooCommerce: span the column width and breathe like a card. */
.bpl-recovery-panel.bpl-recovery-panel--woocommerce {
	max-width: 480px;
	margin-top: 24px;
}

/* The inner <form> must NOT inherit WP's `.login form` card styles. */
.bpl-recovery-panel .bpl-recovery-panel__form {
	margin: 0;
	padding: 0;
	background: transparent;
	box-shadow: none;
	border: 0;
	overflow: visible;
}

.bpl-recovery-panel .bpl-recovery-panel__title {
	margin: 0 0 6px;
	font-size: 18px;
	font-weight: 600;
	line-height: 1.3;
	color: #1d2327;
	text-shadow: none;
}

.bpl-recovery-panel .bpl-recovery-panel__desc {
	margin: 0 0 18px;
	color: #50575e;
	font-size: 13px;
	line-height: 1.5;
}

.bpl-recovery-panel .bpl-recovery-panel__field {
	margin: 0 0 14px;
}

.bpl-recovery-panel .bpl-recovery-panel__field label {
	display: block;
	margin: 0 0 4px;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.4;
	color: #1d2327;
}

/* High specificity — beats `.login form .input` (24px font) on wp-login. */
.bpl-recovery-panel input.bpl-recovery-panel__input {
	box-sizing: border-box;
	display: block;
	width: 100%;
	height: auto;
	margin: 0;
	padding: 8px 10px;
	font-size: 14px;
	line-height: 1.4;
	background: #fff;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	color: #2c3338;
	box-shadow: none;
}

.bpl-recovery-panel input.bpl-recovery-panel__input:focus {
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
	outline: 2px solid transparent;
}

.bpl-recovery-panel input.bpl-recovery-panel__input--code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 16px;
	letter-spacing: 2px;
	text-align: center;
	text-transform: uppercase;
}

.bpl-recovery-panel .bpl-recovery-panel__message {
	min-height: 0;
	margin: 0 0 12px;
	font-size: 13px;
	color: #b32d2e;
}

.bpl-recovery-panel .bpl-recovery-panel__message:empty {
	display: none;
}

.bpl-recovery-panel .bpl-recovery-panel__submit {
	margin: 6px 0 14px;
}

.bpl-recovery-panel button.bpl-recovery-panel__button {
	display: block;
	width: 100%;
	height: 42px;
	margin: 0;
	font-size: 14px;
	font-weight: 500;
	line-height: 1;
}

.bpl-recovery-panel .bpl-recovery-panel__back {
	margin: 0;
	text-align: center;
	font-size: 13px;
}

.bpl-recovery-panel .bpl-recovery-panel__back a {
	color: #50575e;
	text-decoration: none;
}

.bpl-recovery-panel .bpl-recovery-panel__back a:hover,
.bpl-recovery-panel .bpl-recovery-panel__back a:focus {
	color: #135e96;
	text-decoration: underline;
}

@media (max-width: 480px) {
	.bpl-recovery-panel--woocommerce {
		max-width: 100%;
	}
}

/* ==========================================================================
   Passkey section on profile / My Account
   ========================================================================== */

.bpl-profile-section {
	max-width: 100%;
}

/* Table inherits WooCommerce shop_table styles; only add passkey-specific overrides. */

.bpl-passkeys-table thead th {
	padding: 10px;
}

.bpl-passkey-badge {
	display: inline-block;
	font-size: 11px;
	font-weight: 500;
	padding: 1px 8px;
	border-radius: 10px;
	vertical-align: middle;
}

.bpl-passkey-badge--disabled {
	background: #f0c33c;
	color: #614a00;
}

.bpl-status {
	font-weight: 500;
}

.bpl-status--active {
	color: #008a20;
}

.bpl-status--disabled {
	color: #996800;
}

.bpl-passkeys-table__cell-actions {
	display: flex;
	gap: 6px;
}

.bpl-passkeys-table__cell-actions .woocommerce-button {
	font-size: 13px;
	padding: 4px 12px;
	white-space: nowrap;
}

.bpl-btn-delete {
	color: #b32d2e !important;
	border-color: #b32d2e !important;
}

.bpl-btn-delete:hover {
	background: #b32d2e !important;
	color: #fff !important;
}

.bpl-recovery-info {
	margin-top: 16px;
	padding: 12px 16px;
	background: #f0f0f1;
	border-radius: 4px;
}

/* Responsive: use data-title attributes like WooCommerce orders table */
@media (max-width: 768px) {
	.bpl-passkeys-table thead {
		display: none;
	}

	.bpl-passkeys-table tbody tr {
		display: block;
		margin-bottom: 16px;
	}

	.bpl-passkeys-table tbody td {
		display: block;
		text-align: right;
	}

	.bpl-passkeys-table tbody td::before {
		content: attr(data-title) ": ";
		float: left;
		font-weight: 600;
	}

	.bpl-passkeys-table__cell-actions {
		justify-content: flex-end;
	}

	.bpl-passkeys-table__cell-actions::before {
		display: none;
	}
}

/* ==========================================================================
   Recovery codes modal (created by JS)
   ========================================================================== */

.bpl-recovery-modal {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.7);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100000;
}

.bpl-recovery-modal__dialog {
	background: #fff;
	border-radius: 8px;
	padding: 32px;
	max-width: 600px;
	width: 90%;
	max-height: 90vh;
	overflow-y: auto;
}

.bpl-recovery-modal__title {
	margin-top: 0;
	font-size: 20px;
	text-align: center;
}

.bpl-recovery-modal__text {
	color: #646970;
	text-align: center;
	font-size: 13px;
}

.bpl-recovery-modal__grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	margin: 24px 0;
}

.bpl-recovery-modal__code {
	font-family: monospace;
	font-size: 16px;
	text-align: center;
	padding: 8px;
	background: #f0f0f1;
	border-radius: 4px;
	letter-spacing: 1px;
	display: block;
}

.bpl-recovery-modal__warning {
	color: #996800;
	background: #fcf9e8;
	padding: 8px 12px;
	border-radius: 4px;
	font-size: 13px;
	margin: 16px 0;
	text-align: center;
}

.bpl-recovery-modal__actions {
	display: flex;
	gap: 8px;
	margin-bottom: 16px;
}

.bpl-recovery-modal__actions .button {
	flex: 1;
	text-align: center;
}

.bpl-recovery-modal__btn--dismiss {
	display: block;
	width: 100%;
	min-width: 200px;
}

/* ==========================================================================
   Mobile responsive
   ========================================================================== */

@media (max-width: 600px) {
	.bpl-recovery-modal__grid {
		grid-template-columns: 1fr;
	}

	.bpl-recovery-modal__dialog {
		width: 100%;
		height: 100%;
		max-height: 100vh;
		border-radius: 0;
	}

	.bpl-passkey-card {
		flex-direction: column;
		align-items: flex-start;
		gap: 10px;
	}

	.bpl-passkey-card__actions {
		margin-left: 0;
		width: 100%;
	}

	.bpl-passkey-card__actions .button {
		flex: 1;
	}
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	.bpl-passkey-button,
	.bpl-progress-bar-fill {
		transition: none;
	}
}
