/* MAF Commerce: sign-in cards, vendor portal, customer type, product info, order request. */

:root {
	--maf-accent: #1f7a4d;
	--maf-accent-soft: #eef8f2;
	--maf-text: #1f2937;
	--maf-muted: #6b7280;
	--maf-line: #e5e7eb;
	--maf-bg: #ffffff;
	--maf-bg-soft: #f7f7f8;
	--maf-radius: 12px;
}

/* ---- Pages of our own (/partner/, sign-in messages) ---- */
.maf-wrap {
	box-sizing: border-box;
	max-width: 1100px;
	margin: 32px auto 48px;
	padding: 0 16px;
	color: var(--maf-text);
}
.maf-wrap *,
.maf-wrap *::before,
.maf-wrap *::after {
	box-sizing: border-box;
}
.maf-wrap h2 {
	margin: 0 0 8px;
	font-size: 1.5em;
	line-height: 1.3;
}
.maf-th {
	line-height: 1.65;
}

.maf-card {
	background: var(--maf-bg);
	border: 1px solid var(--maf-line);
	border-radius: var(--maf-radius);
	padding: 24px;
	margin: 0 0 16px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.maf-center {
	text-align: center;
	max-width: 480px;
	margin-left: auto;
	margin-right: auto;
}
.maf-login {
	margin-top: 24px;
	margin-bottom: 24px;
}
.maf-muted {
	color: var(--maf-muted);
	font-size: 0.92em;
}
.maf-note {
	background: #fff8e6;
	border-inline-start: 3px solid #f0b429;
	padding: 10px 12px;
	border-radius: 6px;
	margin: 12px 0;
}
.maf-email {
	font-weight: 600;
	font-size: 1.05em;
	word-break: break-all;
}
.maf-list {
	display: inline-block;
	text-align: start;
	margin: 8px auto 0;
	padding-inline-start: 18px;
}
.maf-list li {
	margin: 2px 0;
}

/* ---- Buttons ---- */
.maf-btn,
a.maf-btn,
button.maf-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 10px 18px;
	border: 1px solid var(--maf-accent);
	border-radius: 8px;
	background: var(--maf-accent);
	color: #fff;
	font-weight: 600;
	font-size: 1em;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: filter 0.15s ease;
}
.maf-btn:hover,
.maf-btn:focus {
	filter: brightness(0.93);
	color: #fff;
	text-decoration: none;
}
.maf-btn-light,
a.maf-btn-light {
	background: var(--maf-bg-soft);
	border-color: var(--maf-line);
	color: var(--maf-text);
}
.maf-btn-light:hover,
.maf-btn-light:focus {
	color: var(--maf-text);
}
.maf-btn-small,
a.maf-btn-small {
	padding: 6px 12px;
	font-size: 0.9em;
}

.maf-google-btn,
a.maf-google-btn {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 11px 22px;
	border: 1px solid #dadce0;
	border-radius: 8px;
	background: #fff;
	color: #3c4043;
	font-weight: 600;
	font-size: 1em;
	line-height: 1.2;
	text-decoration: none;
	box-shadow: 0 1px 2px rgba(60, 64, 67, 0.12);
}
.maf-google-btn:hover,
.maf-google-btn:focus {
	background: #f8faff;
	border-color: #c6dafc;
	color: #3c4043;
	text-decoration: none;
}
.maf-google-btn svg {
	flex: none;
}

a.maf-wa-btn,
.button.maf-wa-btn {
	display: inline-block;
	padding: 10px 18px;
	border: 1px solid #25d366;
	border-radius: 8px;
	background: #25d366;
	color: #fff;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
}
a.maf-wa-btn:hover,
.button.maf-wa-btn:hover {
	background: #1ebe5a;
	color: #fff;
}

/* ---- Messages and badges ---- */
.maf-flash {
	padding: 10px 14px;
	border-radius: 8px;
	margin: 12px 0;
}
.maf-flash-ok {
	background: #e7f6ec;
	color: #0a5c2b;
}
.maf-flash-err {
	background: #fdecec;
	color: #8a1f1f;
}

.maf-badge {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 999px;
	font-size: 0.8em;
	font-weight: 600;
	line-height: 1.6;
	background: #eef2ff;
	color: #3730a3;
}
.maf-badge-ok {
	background: #e7f6ec;
	color: #0a5c2b;
}
.maf-badge-warn {
	background: #fff1e0;
	color: #8a4b00;
}
.maf-badge-wait {
	background: #eef2ff;
	color: #3730a3;
}
.maf-badge-muted {
	background: #f3f4f6;
	color: #4b5563;
}
.maf-badge-wholesale {
	background: #e0f2fe;
	color: #075985;
}
.maf-badge-retail {
	background: #fdf2f8;
	color: #9d174d;
}

/* ---- Vendor dashboard ---- */
.maf-portal-head {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: flex-start;
	gap: 12px 16px;
	margin-bottom: 8px;
}
.maf-portal-head p {
	margin: 0;
}
.maf-portal-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.maf-tiles {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 12px;
	margin: 16px 0 20px;
}
.maf-tile {
	background: var(--maf-bg);
	border: 1px solid var(--maf-line);
	border-radius: var(--maf-radius);
	padding: 14px 16px;
}
.maf-tile b {
	display: block;
	font-size: 1.8em;
	line-height: 1.2;
	color: #3730a3;
}
.maf-tile span {
	color: var(--maf-muted);
	font-size: 0.92em;
}
.maf-tile-warn b {
	color: #b45309;
}
.maf-tile-ok b {
	color: #15803d;
}

.maf-products {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
	gap: 16px;
}
.maf-pcard {
	display: flex;
	flex-direction: column;
	background: var(--maf-bg);
	border: 1px solid var(--maf-line);
	border-radius: var(--maf-radius);
	overflow: hidden;
}
.maf-pimg,
img.maf-pimg {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	background: var(--maf-bg-soft);
	margin: 0;
}
.maf-noimg {
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--maf-muted);
}
.maf-pbody {
	padding: 12px 14px 14px;
}
.maf-pbody h3 {
	font-size: 1em;
	line-height: 1.4;
	margin: 8px 0 4px;
}
.maf-pbody p {
	margin: 6px 0;
}

/* ---- Vendor product form and profile ---- */
.maf-portal-form {
	max-width: 760px;
	margin: 0 auto;
}
.maf-form fieldset {
	background: var(--maf-bg);
	border: 1px solid var(--maf-line);
	border-radius: var(--maf-radius);
	padding: 16px 18px 6px;
	margin: 0 0 16px;
	min-width: 0;
}
.maf-form legend {
	font-weight: 700;
	padding: 0 6px;
}
.maf-form label {
	display: block;
	margin: 0 0 12px;
	font-weight: 600;
	font-size: 0.95em;
}
.maf-form input[type="text"],
.maf-form input[type="number"],
.maf-form select,
.maf-form textarea {
	display: block;
	width: 100%;
	max-width: 100%;
	margin-top: 6px;
	padding: 10px 12px;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	background: #fff;
	color: var(--maf-text);
	font: inherit;
	font-weight: 400;
	font-size: 16px; /* No zoom on phones. */
	line-height: 1.4;
}
.maf-form input[type="file"] {
	display: block;
	max-width: 100%;
	margin-top: 6px;
	font-weight: 400;
}
.maf-form input:focus,
.maf-form select:focus,
.maf-form textarea:focus {
	outline: 2px solid var(--maf-accent);
	outline-offset: 1px;
	border-color: var(--maf-accent);
}
.maf-form .maf-muted {
	margin: -4px 0 12px;
}
.maf-row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
	gap: 0 14px;
}
.maf-thumbs {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0 0 12px;
}
.maf-thumbs figure {
	margin: 0;
	text-align: center;
}
.maf-thumbs img {
	display: block;
	width: 84px;
	height: 84px;
	object-fit: cover;
	border-radius: 8px;
	border: 1px solid var(--maf-line);
}
.maf-thumbs figcaption {
	font-size: 0.8em;
	color: var(--maf-muted);
	margin-top: 4px;
}
.maf-thumbs figcaption label {
	display: inline;
	font-weight: 400;
	margin: 0;
}

/* ---- My account: customer type ---- */
.maf-dash {
	display: grid;
	gap: 14px;
	margin: 0 0 20px;
}
.maf-dash .maf-card {
	margin: 0;
	padding: 18px 20px;
}
.maf-dash .maf-card h3 {
	margin: 0 0 8px;
}
.maf-types {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
	gap: 14px;
	margin: 12px 0;
}
.maf-type-card {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin: 0;
	padding: 18px;
	background: var(--maf-bg);
	border: 2px solid var(--maf-line);
	border-radius: var(--maf-radius);
}
.maf-type-card h3 {
	margin: 0;
	font-size: 1.15em;
}
.maf-type-card p {
	margin: 0;
}
.maf-type-card.is-current {
	border-color: var(--maf-accent);
	background: var(--maf-accent-soft);
}
.maf-type-card .maf-btn,
.maf-type-card .maf-badge {
	align-self: flex-start;
	margin-top: auto;
}
.maf-type-rate {
	font-weight: 600;
}

/* ---- Product page and cart ---- */
.maf-buy-info {
	margin: 12px 0 16px;
	padding: 10px 14px;
	border: 1px solid var(--maf-line);
	border-radius: 10px;
	background: var(--maf-bg-soft);
	font-size: 0.95em;
}
.maf-buy-info p {
	margin: 4px 0;
}
.maf-buy-qty {
	font-weight: 600;
}
.maf-buy-hint {
	color: var(--maf-muted);
	font-size: 0.92em;
}
.maf-ship-note {
	color: var(--maf-muted);
	font-size: 0.85em;
	margin-top: 2px;
}

/* ---- Order request ---- */
.maf-request-box {
	margin: 0 0 20px;
	padding: 16px 18px;
	border: 2px solid #25d366;
	border-radius: var(--maf-radius);
	background: #f3fdf6;
}
.maf-request-box p {
	margin: 6px 0;
}
.maf-request-title {
	font-weight: 700;
	font-size: 1.1em;
}
.maf-request-desc {
	margin: 0;
}

/* ---- Footer link for the team and vendors ---- */
.maf-team-bar {
	padding: 10px 16px;
	text-align: center;
	font-size: 13px;
	background: var(--maf-bg-soft);
	color: var(--maf-muted);
}
.maf-team-link {
	color: inherit;
	text-decoration: underline;
	font-size: 0.9em;
}
/* The team and vendor entrance as a button: in the footer menu, or in the bar when there is no footer menu. */
.maf-team-bar a,
.maf-menu-item.maf-menu-team > a {
	display: inline-block;
	padding: 8px 18px;
	border-radius: 999px;
	background: var(--maf-accent);
	color: #ffffff !important;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	text-decoration: none !important;
}
.maf-team-bar a:hover,
.maf-team-bar a:focus,
.maf-menu-item.maf-menu-team > a:hover,
.maf-menu-item.maf-menu-team > a:focus {
	background: #17603c;
	color: #ffffff !important;
}

/* ---- Language ---- */
.maf-lang[lang="ar"] {
	font-family: "Noto Kufi Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
}
.maf-ar-text {
	direction: rtl;
	text-align: right;
	font-family: "Noto Naskh Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
	line-height: 1.9;
}
.maf-en-text {
	direction: ltr;
	text-align: left;
	margin-top: 16px;
	padding-top: 12px;
	border-top: 1px dashed var(--maf-line);
	color: #4b5563;
}

/* Arabic pages: product names stay English. Keep their punctuation in order without moving the text. */
html[dir="rtl"] .product_title,
html[dir="rtl"] .woocommerce-loop-product__title,
html[dir="rtl"] .wc-block-components-product-name,
html[dir="rtl"] .wc-block-grid__product-title,
html[dir="rtl"] .wc-block-components-product-title,
html[dir="rtl"] .woocommerce-mini-cart-item > a,
html[dir="rtl"] td.product-name,
html[dir="rtl"] .maf-pbody h3 {
	unicode-bidi: plaintext;
}
:where(html[dir="rtl"]) :where(.product_title, .woocommerce-loop-product__title, .wc-block-components-product-name, .wc-block-grid__product-title, .wc-block-components-product-title, td.product-name) {
	text-align: match-parent;
}

/* ---- Phones ---- */
@media (max-width: 600px) {
	.maf-wrap {
		margin-top: 20px;
	}
	.maf-card {
		padding: 18px 16px;
	}
	.maf-tiles {
		gap: 8px;
	}
	.maf-tile {
		padding: 10px 12px;
	}
	.maf-tile b {
		font-size: 1.4em;
	}
	.maf-portal-actions {
		width: 100%;
	}
	.maf-portal-actions .maf-btn {
		flex: 1 1 auto;
	}
	/* Product cards: small picture beside the text, so a list of products stays short. */
	.maf-products {
		gap: 10px;
	}
	.maf-pcard {
		flex-direction: row;
		align-items: flex-start;
	}
	.maf-pcard .maf-pimg,
	.maf-pcard img.maf-pimg {
		flex: none;
		width: 96px;
		height: 96px;
		font-size: 0.8em;
	}
	.maf-pbody {
		flex: 1 1 auto;
		min-width: 0;
		padding: 10px 12px;
	}
	.maf-pbody h3 {
		margin-top: 6px;
	}
}

/* Google-only accounts: no "Password change" box on My Account → Account details. */
.maf-google-only .woocommerce-EditAccountForm fieldset { display: none; }
