/* forcp branch selector — popup + chip styles.
 * The popup itself flips RTL via the [dir="rtl"] attribute on .forcp-modal,
 * so all alignment uses logical properties (inset-inline-*, text-align: start). */

.forcp-modal-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(15, 17, 22, 0.65);
	z-index: 999998;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	animation: forcp-fade-in 200ms ease;
}

@keyframes forcp-fade-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

.forcp-modal {
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
	width: 100%;
	max-width: 640px;
	max-height: calc(100vh - 32px);
	overflow-y: auto;
	font-family: inherit;
	color: #1a1a1a;
	text-align: start;
}

/* ---- Header ---- */

.forcp-modal__header {
	padding: 22px 24px 4px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.forcp-modal__title {
	font-size: 1.35rem;
	font-weight: 600;
	margin: 0;
	line-height: 1.3;
}

.forcp-modal__close {
	background: none;
	border: 0;
	font-size: 1.75rem;
	line-height: 1;
	cursor: pointer;
	color: #888;
	padding: 6px 10px;
	border-radius: 8px;
	min-width: 44px;
	min-height: 44px;
}
.forcp-modal__close:hover { color: #222; background: #f3f3f3; }

/* ---- Language toggle (replaces per-tile EN/AR pills) ---- */

.forcp-langswitch {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 24px 6px;
}

.forcp-langswitch__label {
	font-size: 0.95rem;
	color: #555;
	font-weight: 500;
}

.forcp-langswitch__pills {
	display: inline-flex;
	border: 1px solid #ddd;
	border-radius: 999px;
	overflow: hidden;
	background: #fafafa;
}

.forcp-langswitch__pill {
	background: transparent;
	border: 0;
	padding: 10px 22px;
	font-size: 0.9rem;
	font-weight: 600;
	color: #555;
	cursor: pointer;
	letter-spacing: 0.02em;
	min-height: 44px;
	transition: background 120ms, color 120ms;
}
.forcp-langswitch__pill:hover {
	color: #1a1a1a;
}
.forcp-langswitch__pill.is-active {
	background: #1a1a1a;
	color: #fff;
}

/* ---- Branch tiles ---- */

.forcp-modal__tiles {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
	padding: 14px 24px 8px;
}

.forcp-tile {
	border: 2px solid #e6e6e6;
	border-radius: 12px;
	padding: 16px;
	cursor: pointer;
	transition: border-color 120ms, box-shadow 120ms, transform 80ms;
	display: flex;
	flex-direction: column;
	gap: 6px;
	background: #fff;
	position: relative;
	text-align: start;
	min-height: 88px;
	font-family: inherit;
}
.forcp-tile:hover { border-color: #c9c9c9; }
.forcp-tile.is-selected {
	border-color: #1a1a1a;
	box-shadow: 0 0 0 1px #1a1a1a inset;
}
.forcp-tile.is-suggested .forcp-tile__badge { display: inline-flex; }

.forcp-tile__badge {
	display: none;
	position: absolute;
	top: -10px;
	inset-inline-start: 14px;
	background: #1a1a1a;
	color: #fff;
	border-radius: 999px;
	padding: 3px 10px;
	font-size: 0.72rem;
	letter-spacing: 0.02em;
	align-items: center;
	gap: 4px;
}

.forcp-tile__name {
	font-size: 1.05rem;
	font-weight: 600;
	line-height: 1.25;
}

.forcp-tile__meta {
	font-size: 0.85rem;
	color: #777;
}

/* ---- Footer ---- */

.forcp-modal__footer {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
	padding: 18px 24px 22px;
	border-top: 1px solid #f0f0f0;
	margin-top: 14px;
}

.forcp-btn {
	border: 0;
	border-radius: 10px;
	padding: 12px 26px;
	font-size: 0.95rem;
	font-weight: 600;
	cursor: pointer;
	min-height: 44px;
	transition: background 120ms, color 120ms;
	font-family: inherit;
}
.forcp-btn--primary {
	background: #1a1a1a;
	color: #fff;
}
.forcp-btn--primary:disabled {
	background: #999;
	cursor: not-allowed;
}
.forcp-btn--primary:not(:disabled):hover { background: #000; }
.forcp-btn--ghost {
	background: transparent;
	color: #555;
}
.forcp-btn--ghost:hover { color: #1a1a1a; }

/* ---- Mobile (≤ 640px) — stack tiles, looser touch targets, smaller padding ---- */

@media (max-width: 640px) {
	.forcp-modal-backdrop { padding: 8px; align-items: flex-end; }
	.forcp-modal {
		border-radius: 16px 16px 0 0;
		max-height: 92vh;
	}
	.forcp-modal__header { padding: 18px 18px 0; }
	.forcp-modal__title { font-size: 1.2rem; }
	.forcp-langswitch {
		flex-direction: column;
		align-items: stretch;
		gap: 8px;
		padding: 14px 18px 4px;
	}
	.forcp-langswitch__pills { width: 100%; }
	.forcp-langswitch__pill { flex: 1 1 50%; }
	.forcp-modal__tiles {
		grid-template-columns: 1fr;
		gap: 10px;
		padding: 12px 18px 6px;
	}
	.forcp-tile { padding: 14px 16px; min-height: 72px; }
	.forcp-modal__footer {
		padding: 14px 18px 18px;
		margin-top: 10px;
	}
	.forcp-btn { flex: 1 1 50%; padding: 12px 18px; }
}

/* ---- Chip — floating fallback (used when no header mount point is found) ---- */

.forcp-chip {
	position: fixed;
	bottom: 18px;
	inset-inline-end: 18px;
	background: #1a1a1a;
	color: #fff;
	border: 0;
	border-radius: 999px;
	padding: 9px 16px;
	font-size: 0.85rem;
	font-weight: 500;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
	z-index: 999990;
	display: inline-flex;
	gap: 8px;
	align-items: center;
	font-family: inherit;
}
.forcp-chip:hover { background: #000; }
.forcp-chip__sep { opacity: 0.5; }
.forcp-chip__pin { font-size: 0.95em; line-height: 1; }

@media (max-width: 480px) {
	.forcp-chip {
		bottom: 12px;
		inset-inline-end: 12px;
		font-size: 0.78rem;
		padding: 7px 12px;
	}
}

/* ---- Chip — inline variant, mounted into the Woodmart header next to cart/login. ---- */

.forcp-chip--inline {
	position: static;
	bottom: auto;
	inset-inline-end: auto;
	background: transparent;
	color: inherit;
	box-shadow: none;
	padding: 6px 10px;
	border: 1px solid currentColor;
	border-radius: 999px;
	opacity: 0.85;
	margin: 0 6px;
	font-size: 0.78rem;
	font-weight: 500;
	line-height: 1.2;
	white-space: nowrap;
	vertical-align: middle;
	z-index: auto;
}
.forcp-chip--inline:hover {
	background: rgba(0, 0, 0, 0.06);
	opacity: 1;
}
.forcp-chip--inline .forcp-chip__sep { opacity: 0.4; margin: 0 2px; }
.forcp-chip--inline .forcp-chip__branch { font-weight: 600; }

@media (max-width: 768px) {
	.forcp-chip--inline {
		padding: 4px 8px;
		font-size: 0.72rem;
	}
	.forcp-chip--inline .forcp-chip__branch {
		max-width: 90px;
		overflow: hidden;
		text-overflow: ellipsis;
		display: inline-block;
		vertical-align: bottom;
	}
}

/* ---- RTL — the pin emoji should sit on the leading edge regardless of dir. ---- */
[dir="rtl"] .forcp-chip__pin { transform: scaleX(-1); }

/* Hide WooCommerce Multi-Currency switchers — branch dictates currency. */
.wmc-nav,
.wmc-sidebar-open,
.woocommerce-multi-currency.wmc-sidebar,
.wmc-currency-redirect {
	display: none !important;
}
