/* Shop storefront, scoped and aligned with the Mangarama dark UI. */
.mgshop-storefront,
.mgshop-modal {
	--mgshop-border: rgba(255, 255, 255, 0.09);
	--mgshop-muted: #96a1b3;
	--mgshop-fg: #f5f7fb;
	--mgshop-panel: rgba(16, 17, 20, 0.92);
	--mgshop-field: #17191d;
	--mgshop-card: rgba(255, 255, 255, 0.035);
	--mgshop-accent: #4267ff;
	--mgshop-accent-hover: #5275ff;
	--mgshop-danger: #ff8794;
	--mgshop-success: #65d9a2;
	--mgshop-shadow: rgba(0, 0, 0, 0.3);
	color: var(--mgshop-fg);
	font-family: Poppins, sans-serif;
}

.mgshop-storefront,
.mgshop-storefront *,
.mgshop-modal,
.mgshop-modal * { box-sizing: border-box; }

.mgshop-storefront {
	margin: 16px 0;
	padding: 16px;
	border: 1px solid var(--mgshop-border);
	border-radius: 18px;
	background: rgba(13, 17, 24, 0.66);
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
}

.mgshop-storefront[data-mgshop-inventory-only="1"] {
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
}

.mgshop-storefront[data-mgshop-inventory-only="1"].is-empty { display: none; }

/* Center the title already output by Madara; the shortcode has no duplicate. */
body.page .c-page > .entry-header,
body.page .c-page > .entry-header .entry-header_wrap,
body.page .entry-header .entry-title,
body.page .entry-header .entry-title .item-title,
body.page .c-page .entry-header .entry-title {
	float: none;
	width: 100%;
	margin-right: auto;
	margin-left: auto;
	text-align: center !important;
}

.mgshop-status {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.mgshop-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin-bottom: 16px;
	padding: 12px;
	border: 1px solid var(--mgshop-border);
	border-radius: 14px;
	background: var(--mgshop-panel);
}

.mgshop-toolbar .mgshop-input {
	flex: 1 1 160px;
	width: auto !important;
	min-width: 140px;
	min-height: 42px;
	margin: 0 !important;
	padding: 8px 12px !important;
	border: 1px solid #2b2e34 !important;
	border-radius: 10px !important;
	background-color: var(--mgshop-field) !important;
	box-shadow: none !important;
	color: var(--mgshop-fg) !important;
	font: 400 13px/1.3 Poppins, sans-serif !important;
	transition: border-color .18s ease, box-shadow .18s ease;
}

.mgshop-toolbar .mgshop-search { flex: 2 1 240px; }
.mgshop-toolbar .mgshop-input::placeholder { color: #777f8d; }

.mgshop-toolbar .mgshop-input:focus {
	border-color: var(--mgshop-accent) !important;
	box-shadow: 0 0 0 3px rgba(66, 103, 255, 0.18) !important;
	outline: none;
}

.mgshop-toggle {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin: 0;
	color: var(--mgshop-muted);
	font-size: 12px;
	cursor: pointer;
	white-space: nowrap;
}

.mgshop-toggle input {
	width: 16px;
	height: 16px;
	margin: 0;
	accent-color: var(--mgshop-accent);
}

.mgshop-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
	gap: 14px;
	min-height: 60px;
	transition: opacity .15s ease;
}

.mgshop-grid[aria-busy="true"] { opacity: .5; }

.mgshop-inventory-group-title {
	grid-column: 1 / -1;
	margin: 12px 0 0;
	color: var(--mgshop-fg);
	font-size: 18px;
	font-weight: 750;
}

.mgshop-empty,
.mgshop-error {
	grid-column: 1 / -1;
	padding: 32px 12px;
	border: 1px dashed var(--mgshop-border);
	border-radius: 14px;
	color: var(--mgshop-muted);
	text-align: center;
}

.mgshop-error { color: var(--mgshop-danger); }

.mgshop-card {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 9px;
	min-width: 0;
	padding: 12px;
	border: 1px solid var(--mgshop-border);
	border-radius: 16px;
	background: radial-gradient(circle at 50% 0, rgba(66, 103, 255, .1), transparent 48%), var(--mgshop-card);
	box-shadow: 0 12px 32px rgba(0, 0, 0, .2);
	color: var(--mgshop-fg);
	text-align: center;
	cursor: pointer;
	transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.mgshop-card:hover,
.mgshop-card:focus-visible {
	transform: translateY(-2px);
	border-color: rgba(110, 138, 255, .55);
	box-shadow: 0 16px 36px var(--mgshop-shadow);
	outline: none;
}

.mgshop-card.is-locked { opacity: .7; }

.mgshop-card__image {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border: 1px solid rgba(255, 255, 255, .05);
	border-radius: 12px;
	background: rgba(255, 255, 255, .035);
	color: var(--mgshop-muted);
	font-size: 28px;
	font-weight: 700;
}

.mgshop-card__image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.mgshop-card__featured {
	position: absolute;
	top: 20px;
	left: 20px;
	padding: 4px 8px;
	border: 1px solid rgba(255, 204, 92, .35);
	border-radius: 999px;
	background: rgba(113, 73, 0, .9);
	color: #ffd879;
	font-size: 9px;
	font-weight: 700;
	letter-spacing: .04em;
	text-transform: uppercase;
}

.mgshop-card__title {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	gap: 6px;
	min-height: 61px;
	color: var(--mgshop-fg);
	font-size: 14px;
	font-weight: 600;
	text-align: center;
}

.mgshop-card__name {
	display: -webkit-box;
	min-height: 38px;
	overflow: hidden;
	word-break: break-word;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.mgshop-badge {
	display: inline-block;
	padding: 4px 7px;
	border: 1px solid var(--mgshop-border);
	border-radius: 999px;
	background: rgba(255, 255, 255, .055);
	color: var(--mgshop-muted);
	font-size: 9px;
	line-height: 1;
	letter-spacing: .03em;
	text-transform: uppercase;
	white-space: nowrap;
}

.mgshop-badge--rarity-uncommon { color: var(--mgshop-success); }
.mgshop-badge--rarity-rare { color: #80a2ff; }
.mgshop-badge--rarity-epic { color: #c28cff; }
.mgshop-badge--rarity-legendary { color: #ffb85c; }
.mgshop-badge--rarity-mythic { color: #ff77ae; }

.mgshop-card__price {
	display:flex;
	align-items:center;
	justify-content:center;
	min-height:20px;
	color: var(--mgshop-fg);
	font-size: 13px;
	font-weight: 600;
}

.mgshop-card__availability {
	display: block;
	min-height: 30px;
	color: var(--mgshop-muted);
	font-size: 10px;
	font-weight: 450;
	line-height: 1.4;
}

.mgshop-card__availability.is-empty { visibility: hidden; }

.mgshop-card__price--free { color: var(--mgshop-success); }

.mgshop-card__lock {
	display: flex;
	align-items: center;
	gap: 4px;
	color: var(--mgshop-muted);
	font-size: 11px;
}

.mgshop-card__action,
.mgshop-modal__action {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	text-align: center;
	min-height: 38px;
	padding: 8px 12px;
	border: 2px solid var(--mgshop-accent) !important;
	border-radius: 18px !important;
	background: radial-gradient(circle at 50% 0, var(--mgshop-accent-hover) 0, #364ce5 34%, #152877 78%, #10173a 100%) !important;
	box-shadow: 0 6px 18px rgba(49, 79, 211, .28);
	color: #fff !important;
	font: 600 13px/1.2 Poppins, sans-serif !important;
	cursor: pointer;
	transition: transform .18s ease, border-color .18s ease, filter .18s ease;
}

.mgshop-card__action { margin-top: auto; }

.mgshop-card__action:hover:not(:disabled),
.mgshop-modal__action:hover:not(:disabled) {
	transform: translateY(-1px);
	border-color: #7190ff !important;
	filter: brightness(1.08);
}

.mgshop-card__action.is-secondary {
	background: rgba(66, 103, 255, .1) !important;
	box-shadow: none;
	color: #91a8ff !important;
}

.mgshop-card__action.is-equipped,
.mgshop-modal__action.is-equipped {
	border-color: #2c9a68 !important;
	background: linear-gradient(180deg, #27865b, #175139) !important;
}

.mgshop-card__action:disabled,
.mgshop-modal__action:disabled { opacity: .55; cursor: default; }

.mgshop-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	margin-top: 18px;
	color: var(--mgshop-muted);
	font-size: 13px;
}

.mgshop-pagination button {
	min-height: 36px;
	padding: 7px 14px;
	border: 1px solid rgba(110, 138, 255, .45) !important;
	border-radius: 18px !important;
	background: rgba(66, 103, 255, .1) !important;
	color: #a8b8ff !important;
	font: 500 12px/1.2 Poppins, sans-serif !important;
	cursor: pointer;
}

.mgshop-pagination button:disabled { opacity: .38; cursor: default; }

.mgshop-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.mgshop-modal[hidden] { display: none; }

.mgshop-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .76);
	backdrop-filter: blur(5px);
}

.mgshop-modal__dialog {
	position: relative;
	width: 100%;
	max-width: 520px;
	max-height: 88vh;
	padding: 24px;
	overflow: auto;
	border: 1px solid var(--mgshop-border);
	border-radius: 20px;
	background: #10141c;
	box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
	color: var(--mgshop-fg);
}

.mgshop-modal__close {
	position: absolute;
	top: 10px;
	right: 10px;
	padding: 6px;
	border: 0;
	background: transparent;
	color: var(--mgshop-muted);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}

.mgshop-modal__image {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-height: 220px;
	margin-bottom: 14px;
	overflow: hidden;
	border: 1px solid var(--mgshop-border);
	border-radius: 14px;
	background: rgba(255, 255, 255, .035);
}

.mgshop-modal__image img { max-width: 100%; max-height: 220px; object-fit: contain; }
.mgshop-modal__title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; font-size: 18px; font-weight: 700; }
.mgshop-modal__desc { margin-bottom: 14px; color: var(--mgshop-muted); font-size: 13px; white-space: pre-line; }
.mgshop-modal__availability { margin: -4px 0 14px; color: #b9c5ff; font-size: 12px; font-weight: 550; }
.mgshop-modal__section-title { margin: 14px 0 6px; color: var(--mgshop-muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.mgshop-modal__requirements { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.mgshop-modal__requirements li { display: flex; align-items: center; gap: 6px; }
.mgshop-modal__requirements li.is-unmet,
.mgshop-modal__reason { color: var(--mgshop-danger); }
.mgshop-modal__requirements li.is-met { color: var(--mgshop-success); }
.mgshop-modal__price { margin: 14px 0 4px; font-size: 15px; font-weight: 700; }
.mgshop-modal__balance { margin-bottom: 14px; color: var(--mgshop-muted); font-size: 12px; }
.mgshop-modal__reason { margin-bottom: 12px; font-size: 13px; }
.mgshop-modal__action { width: 100%; margin-top: 6px; }
.mgshop-modal__login { display: inline-block; margin-top: 6px; color: #91a8ff; font-weight: 600; }

.mgshop-toast {
	position: fixed;
	top: 24px;
	left: 50%;
	z-index: 100100;
	max-width: min(420px, calc(100vw - 32px));
	padding: 13px 18px;
	border: 1px solid rgba(101, 217, 162, .5);
	border-radius: 12px;
	background: rgba(16, 35, 28, .97);
	box-shadow: 0 14px 38px rgba(0, 0, 0, .42);
	color: #d8ffed;
	font: 600 13px/1.35 Poppins, sans-serif;
	text-align: center;
	transform: translate(-50%, -18px);
	opacity: 0;
	pointer-events: none;
	transition: opacity .18s ease, transform .18s ease;
}

.mgshop-toast.is-visible { transform: translate(-50%, 0); opacity: 1; }
.mgshop-toast.is-error { border-color: rgba(255, 135, 148, .55); background: rgba(47, 20, 25, .97); color: #ffdce1; }

@media (max-width: 600px) {
	.mgshop-storefront { padding: 11px; border-radius: 14px; }
	.mgshop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
	.mgshop-toolbar { align-items: stretch; }
	.mgshop-toolbar .mgshop-input { flex-basis: 100%; width: 100% !important; }
	.mgshop-toggle { flex: 1 1 140px; }
	.mgshop-modal__dialog { padding: 18px; }
}
