/**
 * Address book styling.
 *
 * Borrows the theme's design tokens so the screens match the rest of the shop, with
 * fallbacks in case the plugin is ever used under a different theme.
 */

.blva {
	--blva-line: var(--line, #e3ddd4);
	--blva-ink: var(--ink, #1c1917);
	--blva-ink-2: var(--ink-2, #6b6259);
	--blva-paper: var(--paper, #fdfbf8);
	--blva-radius: var(--radius-sm, 10px);
	--blva-danger: #b32d2e;
}

.blva-intro { color: var(--blva-ink-2); margin: 0 0 20px; }
.blva-muted { color: var(--blva-ink-2); }

/* ---------- Cards ---------- */

.blva-cards {
	list-style: none;
	margin: 0 0 24px;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 14px;
}

.blva-card {
	position: relative;
	border: 1px solid var(--blva-line);
	border-radius: var(--blva-radius);
	background: var(--blva-paper);
	padding: 16px 18px;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.blva-card.is-default { border-color: var(--blva-ink); }

.blva-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.blva-card-head h3 { margin: 0; font-size: 15px; line-height: 1.3; }

.blva-tag {
	flex: none;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	padding: 3px 8px;
	border-radius: 99px;
	background: var(--blva-ink);
	color: #fff;
}

.blva-card-name { margin: 0; font-weight: 600; font-size: 14px; }
.blva-card-lines,
.blva-card-phone { margin: 0; font-size: 13px; color: var(--blva-ink-2); line-height: 1.5; }
.blva-card-phone { margin-top: 4px; }

.blva-card-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 14px;
	margin-top: 14px;
	padding-top: 12px;
	border-top: 1px solid var(--blva-line);
}

/* Each action is its own form, so they must sit inline like plain links. */
.blva-mini { display: inline; margin: 0; }

.blva-link {
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
	font-size: 13px;
	color: var(--blva-ink);
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}
.blva-link:hover { opacity: .7; }
.blva-link--danger { color: var(--blva-danger); }

.blva-empty {
	border: 1px dashed var(--blva-line);
	border-radius: var(--blva-radius);
	padding: 28px 20px;
	text-align: center;
	margin-bottom: 20px;
}
.blva-empty p { margin: 0 0 6px; }

.blva-add { margin: 0; }

/* The account pages sit inside WooCommerce templates whose button styling varies, so
   the address book brings its own rather than inheriting something unpredictable. */
.blva-btn {
	display: inline-block;
	font: inherit;
	font-size: 14px;
	line-height: 1;
	padding: 12px 22px;
	border: 1px solid var(--blva-ink);
	border-radius: 99px;
	background: var(--blva-ink);
	color: #fff;
	text-decoration: none;
	cursor: pointer;
}
.blva-btn:hover { opacity: .88; color: #fff; }

/* ---------- Form ---------- */

.blva-form-title { margin: 0 0 18px; }

.blva-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 14px 16px;
}
.blva-field--wide { grid-column: 1 / -1; }

.blva-field { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.blva-field label { font-size: 13px; font-weight: 600; }
.blva-req { color: var(--blva-danger); }
.blva-opt { font-weight: 400; color: var(--blva-ink-2); }

.blva-field input,
.blva-field select {
	width: 100%;
	padding: 11px 12px;
	border: 1px solid var(--blva-line);
	border-radius: var(--blva-radius);
	background: #fff;
	font: inherit;
	font-size: 15px;
}
.blva-field input:focus,
.blva-field select:focus { outline: 2px solid var(--blva-ink); outline-offset: -2px; }

.blva-field.has-error input,
.blva-field.has-error select { border-color: var(--blva-danger); }

.blva-hint { font-size: 12px; color: var(--blva-ink-2); }
.blva-error { font-size: 12px; color: var(--blva-danger); }

.blva-form-actions { display: flex; align-items: center; gap: 16px; margin: 22px 0 0; }

/* ---------- Checkout picker ---------- */

.blva-picker {
	--blva-line: var(--line, #e3ddd4);
	--blva-ink: var(--ink, #1c1917);
	--blva-ink-2: var(--ink-2, #6b6259);
	--blva-radius: var(--radius-sm, 10px);
	border: 1px solid var(--blva-line);
	border-radius: var(--blva-radius);
	padding: 16px 18px;
	margin: 0 0 26px;
}

.blva-picker-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.blva-picker-head h2 { margin: 0; font-size: 16px; }

.blva-picker-single { margin: 0; font-size: 14px; color: var(--blva-ink-2); }

.blva-picker-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 10px;
}

.blva-picker-item label {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 12px 14px;
	border: 1px solid var(--blva-line);
	border-radius: var(--blva-radius);
	cursor: pointer;
	height: 100%;
}
.blva-picker-item label:hover { border-color: var(--blva-ink-2); }
.blva-picker-item input { margin-top: 3px; flex: none; }
.blva-picker-item:has(input:checked) label { border-color: var(--blva-ink); box-shadow: inset 0 0 0 1px var(--blva-ink); }

.blva-picker-body { display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 1.45; }
.blva-picker-body strong { font-size: 14px; }

.blva-picker-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 14px 0 0; font-size: 13px; }

.blva-picker-btn {
	font: inherit;
	font-size: 14px;
	padding: 9px 18px;
	border: 1px solid var(--blva-ink);
	border-radius: 99px;
	background: var(--blva-ink);
	color: #fff;
	cursor: pointer;
}
.blva-picker-btn:hover { opacity: .88; }

@media (max-width: 600px) {
	.blva-grid { grid-template-columns: 1fr; }
	.blva-cards,
	.blva-picker-list { grid-template-columns: 1fr; }
	.blva-picker-head { flex-direction: column; align-items: flex-start; gap: 4px; }
	.blva-form-actions { flex-wrap: wrap; }
}

/* ---------- Checkout: contact section ---------- */

/*
 * A signed-in shopper has already told us their email, so the field is hidden rather
 * than asked for again. It stays in the form — WooCommerce still submits it, and the
 * order still carries it — it is simply not theirs to retype at checkout.
 *
 * The :valid guard is the safety net: an empty or malformed email makes the field
 * invalid, the section reappears, and the customer can fix what would otherwise be a
 * blocking error on a control they cannot see.
 */
body.logged-in .wp-block-woocommerce-checkout-contact-information-block:has(#email:valid) {
	display: none;
}

.blva-account-bar {
	margin: 0 0 18px;
	font-size: 13px;
	color: var(--ink-2, #6b6259);
}
.blva-account-bar strong { color: var(--ink, #1c1917); font-weight: 600; }
.blva-account-bar a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.blva-account-bar a:hover { color: var(--ink, #1c1917); }

/* ---------- Show / hide password ---------- */

.blva-pw { position: relative; display: block; }

/* Room for the button, so revealed text never runs underneath it. */
.blva-pw input[type="password"],
.blva-pw input[type="text"],
.blva-pw-host input[type="password"],
.blva-pw-host input[type="text"] { padding-right: 46px; }

.blva-pw-toggle {
	position: absolute;
	top: 0;
	bottom: 0;
	right: 4px;
	margin: auto 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: none;
	color: var(--ink-2, #6b6259);
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}
.blva-pw-toggle:hover { color: var(--ink, #1c1917); }
.blva-pw-toggle:focus-visible { outline: 2px solid var(--ink, #1c1917); outline-offset: -2px; }
.blva-pw-toggle svg { display: block; pointer-events: none; }

/* The block checkout floats its label over the field, so the button sits above it. */
.blva-pw-host .blva-pw-toggle { z-index: 2; }

/* WooCommerce's own strength line is absolutely placed in these forms; the button
   must not be mistaken for part of it. */
.acct-form .blva-pw + .woocommerce-password-strength { margin-top: 5px; }
