/*
 * B2B Portal theme bundle (Stage 3).
 * Source of truth: docs/05-brand-guidelines.md
 */

/* -------------------------------------------------------------------------
   Design tokens
   ------------------------------------------------------------------------- */
:root {
	--color-brand-blue: #1530b8;
	--color-brand-yellow: #ebb000;
	--color-brand-gray: #8f8f8f;
	--color-brand-blue-hover: #0f2390;
	--color-brand-yellow-hover: #c99500;
	--color-bg: #ffffff;
	--color-bg-soft: #f5f5f5;
	--color-text: #2b2b2b;
	--color-text-muted: #8f8f8f;
	--color-text-muted-strong: #6b6b6b;
	--color-border: #e0e0e0;
	--color-success: #22a06b;
	--color-success-badge-bg: #1e8c5c;
	--color-error: #d14343;
	--color-pending-badge-bg: #6b6b6b;
	--focus-ring: 0 0 0 2px var(--color-brand-blue);
	--focus-ring-offset: 2px;
	--space-1: 4px;
	--space-2: 8px;
	--space-3: 12px;
	--space-4: 16px;
	--space-6: 24px;
	--space-8: 32px;
	--space-12: 48px;
	--radius-sm: 2px;
	--radius-md: 4px;
	--radius-lg: 6px;
	--font-sans: "Inter", -apple-system, blinkmacsystemfont, "Segoe UI", roboto, "Helvetica Neue", arial, sans-serif;
	--font-size-h1: 32px;
	--font-size-h2: 24px;
	--font-size-h3: 18px;
	--font-size-body: 16px;
	--font-size-body-dense: 14px;
	--font-size-small: 13px;
	--font-weight-regular: 400;
	--font-weight-semibold: 600;
	--font-weight-bold: 700;
	--line-height-tight: 1.25;
	--line-height-normal: 1.5;
}

/* -------------------------------------------------------------------------
   Self-hosted Inter (@font-face paths relative to this CSS file)
   ------------------------------------------------------------------------- */
@font-face {
	font-family: Inter;
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/Inter-Regular.woff2") format("woff2");
}

@font-face {
	font-family: Inter;
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url("../fonts/Inter-SemiBold.woff2") format("woff2");
}

@font-face {
	font-family: Inter;
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("../fonts/Inter-Bold.woff2") format("woff2");
}

/* -------------------------------------------------------------------------
   Reset / base
   ------------------------------------------------------------------------- */
*,
*::before,
*::after {
	box-sizing: border-box;
}

body {
	margin: 0;
	font-family: var(--font-sans);
	font-size: var(--font-size-body);
	line-height: var(--line-height-normal);
	font-weight: var(--font-weight-regular);
	color: var(--color-text);
	background-color: var(--color-bg);
}

h1 {
	font-size: var(--font-size-h1);
	font-weight: var(--font-weight-bold);
	line-height: var(--line-height-tight);
	margin: 0 0 var(--space-4);
}

h2 {
	font-size: var(--font-size-h2);
	font-weight: var(--font-weight-semibold);
	line-height: var(--line-height-tight);
	margin: 0 0 var(--space-3);
}

h3 {
	font-size: var(--font-size-h3);
	font-weight: var(--font-weight-semibold);
	line-height: var(--line-height-tight);
	margin: 0 0 var(--space-3);
}

a {
	color: var(--color-brand-blue);
	text-decoration: none;
	transition: color 80ms ease, background-color 80ms ease;
}

a:hover {
	color: var(--color-brand-blue-hover);
	text-decoration: underline;
}

p {
	margin: 0 0 var(--space-4);
}

:focus-visible {
	outline: 2px solid var(--color-brand-blue);
	outline-offset: 2px;
}

/* -------------------------------------------------------------------------
   Layout: header
   ------------------------------------------------------------------------- */
.b2b-site-header {
	background: var(--color-bg);
	border-bottom: 1px solid var(--color-border);
}

.b2b-site-header__inner {
	max-width: 1180px;
	margin: 0 auto;
	padding: var(--space-3) var(--space-4);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-4);
}

.b2b-site-header__brand {
	flex: 0 0 auto;
}

.b2b-site-logo {
	display: inline-flex;
	align-items: center;
}

.b2b-site-logo__img {
	display: block;
	height: 40px;
	width: auto;
}

.b2b-site-logo__img--mark {
	display: none;
}

.b2b-site-header__nav-desktop {
	flex: 1 1 auto;
	display: none;
}

.b2b-site-header__menu-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-2) var(--space-6);
}

.b2b-site-header__menu-list a {
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	color: var(--color-text);
	font-weight: var(--font-weight-semibold);
}

.b2b-site-header__menu-list a:hover {
	color: var(--color-brand-blue-hover);
}

.b2b-site-header__actions {
	margin-left: auto;
	display: none;
}

.b2b-site-header__account {
	min-height: 44px;
	min-width: 44px;
	padding: 0 var(--space-2);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-weight: var(--font-weight-semibold);
	color: var(--color-brand-blue);
}

.b2b-site-header__account:hover {
	color: var(--color-brand-blue-hover);
}

.b2b-site-header__actions-inner {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	flex-wrap: wrap;
	justify-content: flex-end;
}

/* Cart icon button in header - resets all browser and Storefront button styles */
.b2b-site-header__cart-btn,
.b2b-site-header__cart-btn:hover,
.b2b-site-header__cart-btn:focus,
.b2b-site-header__cart-btn:active {
	background: transparent !important;
	border: none !important;
	border-radius: 0 !important;
	outline: none !important;
	box-shadow: none !important;
	-webkit-appearance: none !important;
	appearance: none !important;
}

.b2b-site-header__cart-btn {
	position: relative;
	min-height: 44px;
	min-width: 44px;
	padding: 0 var(--space-2);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: var(--color-brand-blue);
}

.b2b-site-header__cart-btn:hover {
	color: var(--color-brand-blue-hover);
}

.b2b-site-header__cart-btn:focus-visible {
	outline: 2px solid var(--color-brand-blue) !important;
	outline-offset: 2px !important;
	border-radius: var(--radius-sm) !important;
}

.b2b-site-header__cart-btn .b2b-catalog-cart-btn__count {
	position: absolute;
	top: 6px;
	right: 2px;
	min-width: 16px;
	height: 16px;
	background: var(--color-brand-blue);
	color: #fff;
	border-radius: 8px;
	font-size: 10px;
	font-weight: var(--font-weight-bold);
	padding: 0 3px;
	line-height: 16px;
	text-align: center;
}

.b2b-site-header__logout {
	min-height: 44px;
	min-width: 44px;
	padding: 0 var(--space-2);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-weight: var(--font-weight-semibold);
	color: var(--color-text-muted-strong);
}

.b2b-site-header__logout:hover {
	color: var(--color-text);
}

.b2b-site-header__logout--mobile {
	margin-top: var(--space-2);
	width: 100%;
	justify-content: flex-start;
}

.b2b-site-header__menu {
	margin-left: auto;
	border: 0;
	position: relative;
}

.b2b-site-header__menu-toggle {
	list-style: none;
	cursor: pointer;
	min-height: 44px;
	min-width: 44px;
	padding: 0 var(--space-3);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	background: var(--color-bg);
	color: var(--color-text);
	font-weight: var(--font-weight-semibold);
}

.b2b-site-header__menu-toggle::-webkit-details-marker {
	display: none;
}

.b2b-site-header__menu-panel {
	position: absolute;
	right: 0;
	top: calc(100% + var(--space-2));
	min-width: 220px;
	padding: var(--space-3);
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
}

.b2b-site-header__menu-list--mobile {
	flex-direction: column;
	align-items: flex-start;
	gap: var(--space-2);
}

.b2b-site-header__account--mobile {
	margin-top: var(--space-3);
	width: 100%;
	justify-content: flex-start;
}

@media (min-width: 768px) {
	.b2b-site-logo__img--primary {
		display: block;
	}

	.b2b-site-logo__img--mark {
		display: none;
	}

	.b2b-site-header__nav-desktop {
		display: block;
	}

	.b2b-site-header__actions {
		display: flex;
	}

	.b2b-site-header__menu {
		display: none;
	}
}

@media (max-width: 767px) {
	.b2b-site-logo__img--primary {
		display: none;
	}

	.b2b-site-logo__img--mark {
		display: block;
		height: 36px;
	}
}

/* -------------------------------------------------------------------------
   Layout: footer
   ------------------------------------------------------------------------- */
.b2b-site-footer {
	background: var(--color-text);
	color: var(--color-bg);
	padding: var(--space-8) var(--space-4) var(--space-4);
}

/* Three items: [logo] [contact col] [legal col].
   Logo and contact col sit together on the left; the legal col is
   pushed to the right edge with margin-left: auto. */
.b2b-site-footer__inner {
	max-width: 1180px;
	margin: 0 auto;
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: var(--space-6);
}

.b2b-site-footer__brand {
	flex: 0 0 auto;
}

.b2b-site-footer__col {
	flex: 0 1 auto;
	font-size: var(--font-size-small);
	line-height: 1.8;
	color: rgba(255, 255, 255, 0.9);
}

/* Push legal/banking column to the right edge. */
.b2b-site-footer__col:last-child {
	margin-left: auto;
}

.b2b-site-footer__logo {
	height: 64px;
	width: auto;
	display: block;
}

.b2b-site-footer__logo-link {
	display: inline-flex;
	border-radius: var(--radius-md);
}

.b2b-site-footer__company-name {
	margin: 0 0 var(--space-2);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-size: var(--font-size-base);
	color: #ffffff;
}

.b2b-site-footer__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.b2b-site-footer__row {
	display: block;
	margin: 0;
	padding: 0;
}

.b2b-site-footer__row-label {
	opacity: 0.7;
}

.b2b-site-footer__row-sep {
	opacity: 0.5;
}

.b2b-site-footer__row-value {
	color: #ffffff;
}

.b2b-site-footer__bottom {
	max-width: 1180px;
	margin: var(--space-6) auto 0;
	padding-top: var(--space-4);
	border-top: 1px solid rgba(255, 255, 255, 0.15);
	text-align: center;
}

.b2b-site-footer__copyright {
	margin: 0;
	font-size: var(--font-size-small);
	color: var(--color-bg);
	opacity: 0.75;
}

/*
 * Footer link colour: Storefront defines `.site-footer a { color: #2c2d33 }`
 * with the same selector specificity as ours, and storefront's stylesheet
 * is enqueued by WordPress in a different order across requests (parent
 * style.css can land after our theme.css in some flows). We override with
 * a higher-specificity selector AND `!important`, scoped only to anchors
 * inside our footer, to keep the rule deterministic.
 */
.site-footer.b2b-site-footer a,
.site-footer.b2b-site-footer a:visited {
	color: #ffffff !important;
	text-decoration: underline;
}

.site-footer.b2b-site-footer a:hover,
.site-footer.b2b-site-footer a:focus {
	color: #ffffff !important;
	opacity: 1;
	text-decoration: none;
}

@media (max-width: 720px) {
	.b2b-site-footer__inner {
		flex-direction: column;
		align-items: flex-start;
		gap: var(--space-6);
	}
}

/* -------------------------------------------------------------------------
   Auth shell + plugin BEM (.b2b-auth, .b2b-form)
   ------------------------------------------------------------------------- */
body.b2b-is-auth-page #content > .col-full {
	max-width: none;
	padding-left: 0;
	padding-right: 0;
}

body.b2b-is-auth-page .site-content {
	padding-top: 0;
	padding-bottom: 0;
}

/* Auth screens are first-class entry points: keep only the logo in the
   header. Hide primary navigation, account link and mobile menu - they
   add noise and the only available action ("Sign in") would link back
   to the page the user is already on. */
body.b2b-is-auth-page .b2b-site-header__nav-desktop,
body.b2b-is-auth-page .b2b-site-header__actions,
body.b2b-is-auth-page .b2b-site-header__menu {
	display: none;
}

/* Storefront sets padding-top: 2.617924em and the header becomes quite
   tall when it contains only the logo. Compress it on auth pages. */
body.b2b-is-auth-page .site-header {
	padding-top: 12px !important;
	padding-bottom: 12px !important;
}

/* Hide vertical scrollbar on auth pages - the form fits in one screen
   on most devices, and when it doesn't (register form) the extra scroll
   is implicit. Avoids the ugly "empty half-screen + scrollbar" look. */
body.b2b-is-auth-page {
	overflow-y: auto;
	scrollbar-width: none;
}

body.b2b-is-auth-page::-webkit-scrollbar {
	display: none;
}

.b2b-auth-page {
	padding: 0;
	background: transparent;
}

.b2b-auth {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 0;
	padding: var(--space-8) var(--space-4);
	background: var(--color-bg-soft);
}

.b2b-auth__card {
	width: 100%;
	max-width: 420px;
	padding: var(--space-8) var(--space-6);
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
}

.b2b-auth__brand {
	display: flex;
	justify-content: center;
	margin-bottom: var(--space-6);
}

.b2b-auth__brand img {
	height: 48px;
	width: auto;
}

.b2b-auth__title {
	font-size: 28px;
	font-weight: var(--font-weight-bold);
	text-align: center;
	margin: 0 0 var(--space-6);
}

.b2b-form {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
}

.b2b-form__field {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}

.b2b-form__label {
	font-size: var(--font-size-small);
	font-weight: var(--font-weight-semibold);
	color: var(--color-text-muted-strong);
}

.b2b-form__input {
	width: 100%;
	min-height: 44px;
	padding: var(--space-2) var(--space-3);
	font: inherit;
	color: var(--color-text);
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
}

.b2b-form__input::placeholder {
	color: var(--color-text-muted);
}

.b2b-form__input:disabled {
	background: var(--color-bg-soft);
	color: var(--color-text-muted);
	cursor: not-allowed;
}

.b2b-form__input:focus {
	border-color: var(--color-brand-blue);
	outline: none;
}

.b2b-form__input:focus-visible {
	outline: 2px solid var(--color-brand-blue);
	outline-offset: 2px;
}

.b2b-form__input.b2b-is-error,
.b2b-form__input[aria-invalid="true"] {
	border-color: var(--color-error);
}

.b2b-form__error {
	font-size: var(--font-size-small);
	color: var(--color-error);
	min-height: 1.25em;
}

.b2b-form__error[hidden] {
	display: none;
}

.b2b-form__submit {
	margin-top: var(--space-2);
	width: 100%;
}

.b2b-auth__links {
	text-align: center;
	font-size: var(--font-size-small);
	margin: var(--space-6) 0 0;
	color: var(--color-text-muted-strong);
}

.b2b-auth__links a {
	font-weight: var(--font-weight-semibold);
}

.b2b-auth__sep {
	margin: 0 var(--space-2);
	color: var(--color-text-muted);
}

.b2b-auth__policy {
	text-align: center;
	font-size: 12px;
	margin: var(--space-3) 0 0;
	color: var(--color-text-muted);
}

.b2b-auth__policy a {
	color: var(--color-text-muted);
	text-decoration: underline;
}

/* Policy + portal placeholders (catalog / manager / account): breadcrumbs
   removed, so the entry-header sits flush under the masthead. Match policy
   spacing so the H1 clears the header bar. */
body.b2b-is-policy-page .hentry,
body.b2b-is-portal-shell .hentry {
	padding-top: var(--space-8);
}

/* Catalog page: the WP page title is the slug "Catalog". The shortcode
 * prints its own h1 "Product catalog" - hide the duplicate theme title. */
body.b2b-is-catalog-page .hentry .entry-header .entry-title,
body.b2b-is-catalog-page .entry-header .entry-title {
	display: none;
}

.b2b-back-link {
	display: inline-flex;
	align-items: center;
	gap: var(--space-1);
	font-size: var(--font-size-small);
	font-weight: var(--font-weight-semibold);
	color: var(--color-primary);
	text-decoration: none;
	margin-bottom: var(--space-4);
}

.b2b-back-link:hover {
	text-decoration: underline;
}

/* -------------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------------- */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 0 var(--space-4);
	font: inherit;
	font-weight: var(--font-weight-semibold);
	border-radius: var(--radius-md);
	border: 1px solid transparent;
	cursor: pointer;
	text-decoration: none !important;
	transition: color 80ms ease, background-color 80ms ease, border-color 80ms ease;
}

.btn:hover,
.btn:focus,
.btn:active,
.btn:visited {
	text-decoration: none !important;
}

.btn:focus {
	outline: none;
}

.btn:focus-visible {
	outline: 2px solid var(--color-brand-blue);
	outline-offset: 2px;
}

.btn--primary {
	background: var(--color-brand-blue);
	color: var(--color-bg);
}

.btn--primary:hover {
	background: var(--color-brand-blue-hover);
	color: var(--color-bg);
	text-decoration: none;
}

.btn--secondary {
	background: var(--color-brand-yellow);
	color: var(--color-text);
}

.btn--secondary:hover {
	background: var(--color-brand-yellow-hover);
	color: var(--color-text);
	text-decoration: none;
}

.btn--disabled,
.btn:disabled {
	background: var(--color-border);
	color: var(--color-text-muted);
	cursor: not-allowed;
}

/* -------------------------------------------------------------------------
   Badges (order statuses, future use)
   ------------------------------------------------------------------------- */
.badge {
	display: inline-flex;
	align-items: center;
	min-height: 28px;
	padding: 0 var(--space-3);
	font-size: var(--font-size-small);
	font-weight: var(--font-weight-semibold);
	border-radius: var(--radius-sm);
}

.badge--new {
	background: var(--color-brand-yellow);
	color: var(--color-text);
}

.badge--pending {
	background: var(--color-pending-badge-bg);
	color: var(--color-bg);
}

.badge--confirmed {
	background: var(--color-success-badge-bg);
	color: var(--color-bg);
}

.badge--rejected {
	background: var(--color-error);
	color: var(--color-bg);
}

/* -------------------------------------------------------------------------
   Alerts
   ------------------------------------------------------------------------- */
.alert {
	padding: var(--space-3) var(--space-4);
	border-radius: var(--radius-md);
	font-size: var(--font-size-small);
	border: 1px solid var(--color-border);
}

.alert--info {
	border-color: var(--color-brand-blue);
	color: var(--color-text);
	background: var(--color-bg-soft);
}

.alert--success {
	border-color: var(--color-success-badge-bg);
	color: var(--color-text);
	background: var(--color-bg-soft);
}

.alert--warning {
	border-color: var(--color-brand-yellow);
	color: var(--color-text);
	background: #fff9e6;
}

.alert--error {
	border-color: var(--color-error);
	color: var(--color-error);
	background: #fdf3f3;
}

/* -------------------------------------------------------------------------
   Tables (catalog stub)
   ------------------------------------------------------------------------- */
.b2b-table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--font-size-body-dense);
}

.b2b-table thead th {
	text-align: left;
	padding: var(--space-3) var(--space-4);
	background: var(--color-bg-soft);
	color: var(--color-text);
	font-weight: var(--font-weight-semibold);
	border-bottom: 1px solid var(--color-border);
}

.b2b-table tbody td {
	padding: var(--space-3) var(--space-4);
	border-bottom: 1px solid var(--color-border);
}

.b2b-table tbody tr:nth-child(even) td {
	background: var(--color-bg-soft);
}

.b2b-table tbody tr:hover td {
	background: var(--color-bg-soft);
}

.b2b-catalog__sidebar {
	/* Placeholder for Stage 7 */
}

/* -------------------------------------------------------------------------
   404
   ------------------------------------------------------------------------- */
.b2b-error-404 {
	max-width: 560px;
	padding: var(--space-12) var(--space-4);
}

.b2b-error-404__title {
	margin-bottom: var(--space-4);
}

.b2b-error-404__text {
	color: var(--color-text-muted-strong);
}

.b2b-error-404__actions {
	margin-top: var(--space-6);
}

.b2b-error-404__secondary {
	margin-top: var(--space-4);
}
