/**
 * Design tokens and the shared components every marketplace screen uses.
 *
 * The palette is built for card trading: a deep arcane indigo carries the
 * brand, a warm gold marks anything valuable or actionable, and surfaces stay
 * near-neutral so card artwork is the brightest thing on the page.
 */

:root {
	/* Brand, sampled from the site logo: cyan lettering on a deep navy card,
	   with gold trim and a crimson flame. */
	--tcgmp-brand-teal: #2a8686;
	--tcgmp-brand-charcoal: #282830;

	/* #44d1df is too light to carry text on white, so interactive elements use
	   a darkened cyan that clears 4.5:1, and the bright logo cyan is kept for
	   dark surfaces and highlights. */
	--tcgmp-primary: #206464;
	--tcgmp-primary-dark: #17494a;
	--tcgmp-primary-soft: #e3f1f0;
	--tcgmp-accent: #c8951f;
	--tcgmp-accent-soft: #fdf3dc;

	/* Neutrals, tinted toward the navy so nothing reads as flat grey. */
	--tcgmp-ink: #24242c;
	--tcgmp-ink-soft: #454550;
	--tcgmp-muted: #62626e;
	--tcgmp-border: #e2e2e8;
	--tcgmp-surface: #ffffff;
	--tcgmp-surface-alt: #f7f8fa;
	--tcgmp-bg: #f3f4f7;

	/* Status */
	--tcgmp-success: #17845a;
	--tcgmp-success-soft: #e3f5ed;
	--tcgmp-warn: #9a6a08;
	--tcgmp-warn-soft: #fdf2dd;
	--tcgmp-danger: #b21127;
	--tcgmp-danger-soft: #fdeaec;

	/* Shape */
	--tcgmp-radius: 10px;
	--tcgmp-radius-sm: 6px;
	--tcgmp-shadow: 0 1px 2px rgba( 19, 26, 58, 0.07 ), 0 4px 16px rgba( 19, 26, 58, 0.06 );
	--tcgmp-shadow-lg: 0 8px 40px rgba( 19, 26, 58, 0.16 );

	/* Rhythm */
	--tcgmp-gap: 20px;
	--tcgmp-gap-sm: 12px;

	/* Matches the Elementor container so marketplace pages line up with the
	   theme-built header and footer. */
	--tcgmp-max-width: 1248px;
}

/*
 * Dark mode.
 *
 * Opt-in via data-tcgmp-theme, which the storefront theme's toggle sets
 * alongside its own attribute — so the dashboard follows the same switch
 * without this plugin depending on that theme. Light stays the default.
 *
 * Contrast checked against each surface: body text 11:1, muted 5.1:1,
 * interactive cyan 6.8:1.
 */
:root[ data-tcgmp-theme='dark' ] {
	--tcgmp-primary: #5fc8c4;
	--tcgmp-primary-dark: #8adbd7;
	--tcgmp-primary-soft: #14302f;
	--tcgmp-accent: #f0c45c;
	--tcgmp-accent-soft: #3a2d10;

	--tcgmp-ink: #f2f2f6;
	--tcgmp-ink-soft: #cdcdd6;
	--tcgmp-muted: #9c9caa;
	--tcgmp-border: #34343f;
	--tcgmp-surface: #22222b;
	--tcgmp-surface-alt: #2a2a34;
	--tcgmp-bg: #17171e;

	--tcgmp-success: #4ed3a0;
	--tcgmp-success-soft: #113228;
	--tcgmp-warn: #e5b45a;
	--tcgmp-warn-soft: #34280e;
	--tcgmp-danger: #ff8a95;
	--tcgmp-danger-soft: #3d151b;

	--tcgmp-shadow: 0 1px 2px rgba( 0, 0, 0, 0.45 ), 0 4px 16px rgba( 0, 0, 0, 0.35 );
	--tcgmp-shadow-lg: 0 12px 48px rgba( 0, 0, 0, 0.6 );

	color-scheme: dark;
}

/* White on the bright dark-mode cyan fails contrast; these flip to dark ink. */
:root[ data-tcgmp-theme='dark' ] .tcgmp-btn.tcgmp-btn--primary,
:root[ data-tcgmp-theme='dark' ] .tcgmp-btn.tcgmp-btn--primary:hover {
	color: #0a1020;
}

/* Status pills carry their own foreground, so they need dark-mode text too. */
:root[ data-tcgmp-theme='dark' ] .tcgmp-badge {
	color: #2e2100;
}

/* --------------------------------------------------------------------------
 * Buttons
 * ----------------------------------------------------------------------- */

.tcgmp-btn.tcgmp-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 18px;
	border: 1px solid var( --tcgmp-border );
	border-radius: var( --tcgmp-radius-sm );
	background: var( --tcgmp-surface );
	color: var( --tcgmp-ink );
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tcgmp-btn.tcgmp-btn:hover,
.tcgmp-btn.tcgmp-btn:focus-visible {
	background: var( --tcgmp-surface-alt );
	border-color: var( --tcgmp-muted );
	color: var( --tcgmp-ink );
}

.tcgmp-btn.tcgmp-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.tcgmp-btn.tcgmp-btn--primary {
	background: var( --tcgmp-primary );
	border-color: var( --tcgmp-primary );
	color: #fff;
}

.tcgmp-btn.tcgmp-btn--primary:hover,
.tcgmp-btn.tcgmp-btn--primary:focus-visible {
	background: var( --tcgmp-primary-dark );
	border-color: var( --tcgmp-primary-dark );
	color: #fff;
}

.tcgmp-btn.tcgmp-btn--block {
	width: 100%;
	margin-bottom: 8px;
}

.tcgmp-btn.tcgmp-btn--small {
	padding: 8px 12px; /* 36px tall: the smallest comfortable tap target */
	font-size: 13px;
}

/* --------------------------------------------------------------------------
 * Cards, states, tables
 * ----------------------------------------------------------------------- */

.tcgmp-card {
	margin: 0 0 var( --tcgmp-gap );
	padding: var( --tcgmp-gap );
	border: 1px solid var( --tcgmp-border );
	border-radius: var( --tcgmp-radius );
	background: var( --tcgmp-surface );
	box-shadow: var( --tcgmp-shadow );
}

.tcgmp-card__title {
	margin: 0 0 var( --tcgmp-gap-sm );
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.01em;
	color: var( --tcgmp-ink );
}

.tcgmp-state,
.tcgmp-empty-state {
	padding: 48px 24px;
	border: 1px dashed var( --tcgmp-border );
	border-radius: var( --tcgmp-radius );
	background: var( --tcgmp-surface-alt );
	text-align: center;
	color: var( --tcgmp-ink-soft );
}

.tcgmp-state__title,
.tcgmp-empty-state h2 {
	margin: 0 0 8px;
	font-size: 20px;
	color: var( --tcgmp-ink );
}

.tcgmp-empty {
	margin: 0;
	color: var( --tcgmp-muted );
	font-size: 14px;
}

.tcgmp-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

.tcgmp-table th,
.tcgmp-table td {
	padding: 12px 10px;
	border-bottom: 1px solid var( --tcgmp-border );
	text-align: left;
	vertical-align: middle;
}

.tcgmp-table thead th {
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var( --tcgmp-muted );
}

.tcgmp-table__title {
	font-weight: 600;
	text-decoration: none;
	color: var( --tcgmp-ink );
}

.tcgmp-table__sku {
	display: block;
	font-size: 12px;
	color: var( --tcgmp-muted );
}

.tcgmp-table__image img {
	width: 44px;
	height: 44px;
	border-radius: var( --tcgmp-radius-sm );
	object-fit: cover;
}

.tcgmp-table__actions {
	text-align: right;
	white-space: nowrap;
}

.tcgmp-table__total td,
.tcgmp-table__total th {
	border-top: 2px solid var( --tcgmp-border );
	border-bottom: 0;
}

.tcgmp-action.tcgmp-action {
	display: inline-block;
	padding: 4px 8px;
	border: 0;
	background: none;
	color: var( --tcgmp-primary );
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
}

.tcgmp-action.tcgmp-action--danger {
	color: var( --tcgmp-danger );
}

/* --------------------------------------------------------------------------
 * Status pills
 * ----------------------------------------------------------------------- */

.tcgmp-status {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 999px;
	background: var( --tcgmp-surface-alt );
	color: var( --tcgmp-ink-soft );
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
}

.tcgmp-status--completed,
.tcgmp-status--publish,
.tcgmp-status--withdraw-1 {
	background: var( --tcgmp-success-soft );
	color: var( --tcgmp-success );
}

.tcgmp-status--processing,
.tcgmp-status--pending,
.tcgmp-status--on-hold,
.tcgmp-status--withdraw-0 {
	background: var( --tcgmp-warn-soft );
	color: var( --tcgmp-warn );
}

.tcgmp-status--cancelled,
.tcgmp-status--failed,
.tcgmp-status--refunded,
.tcgmp-status--withdraw-2 {
	background: var( --tcgmp-danger-soft );
	color: var( --tcgmp-danger );
}

.tcgmp-badge {
	display: inline-block;
	min-width: 20px;
	padding: 1px 6px;
	border-radius: 999px;
	background: var( --tcgmp-accent );
	color: #3a2600;
	font-size: 11px;
	font-weight: 700;
	text-align: center;
}

/* --------------------------------------------------------------------------
 * Forms
 * ----------------------------------------------------------------------- */

.tcgmp-field {
	margin-bottom: var( --tcgmp-gap-sm );
}

.tcgmp-field label,
.tcgmp-field__label {
	display: block;
	margin-bottom: 5px;
	font-size: 13px;
	font-weight: 600;
	color: var( --tcgmp-ink-soft );
}

.tcgmp-field input[ type='text' ],
.tcgmp-field input[ type='email' ],
.tcgmp-field input[ type='url' ],
.tcgmp-field input[ type='tel' ],
.tcgmp-field input[ type='number' ],
.tcgmp-field input[ type='search' ],
.tcgmp-field input[ type='password' ],
.tcgmp-field input[ type='time' ],
.tcgmp-field select,
.tcgmp-field textarea {
	width: 100%;
	padding: 9px 12px;
	border: 1px solid var( --tcgmp-border );
	border-radius: var( --tcgmp-radius-sm );
	background: var( --tcgmp-surface );
	color: var( --tcgmp-ink );
	font-size: 14px;
	font-family: inherit;
}

.tcgmp-field input:focus-visible,
.tcgmp-field select:focus-visible,
.tcgmp-field textarea:focus-visible {
	outline: 2px solid var( --tcgmp-primary );
	outline-offset: 1px;
	border-color: var( --tcgmp-primary );
}

.tcgmp-field--check label,
label.tcgmp-field--check {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin-bottom: var( --tcgmp-gap-sm );
	font-weight: 500;
	color: var( --tcgmp-ink );
	cursor: pointer;
}

.tcgmp-field--check input {
	margin-top: 2px;
	flex: 0 0 auto;
}

.tcgmp-field__help {
	display: block;
	margin-top: 4px;
	font-size: 12px;
	font-weight: 400;
	color: var( --tcgmp-muted );
}

.tcgmp-field-row {
	display: flex;
	flex-wrap: wrap;
	gap: var( --tcgmp-gap-sm );
}

.tcgmp-field-row > .tcgmp-field {
	flex: 1 1 180px;
	min-width: 0;
}

.tcgmp-form__status {
	margin: 8px 0 0;
	font-size: 13px;
	color: var( --tcgmp-muted );
	min-height: 1em;
}

.tcgmp-form__status.is-success {
	color: var( --tcgmp-success );
}

.tcgmp-form__status.is-error {
	color: var( --tcgmp-danger );
}

.tcgmp-form__submit {
	display: flex;
	align-items: center;
	gap: var( --tcgmp-gap-sm );
}

.required {
	color: var( --tcgmp-danger );
}

.tcgmp-checklist {
	max-height: 220px;
	overflow-y: auto;
	padding-right: 4px;
}

.tcgmp-checklist label {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 3px 0;
	font-size: 14px;
	font-weight: 400;
	color: var( --tcgmp-ink );
	cursor: pointer;
}

/* --------------------------------------------------------------------------
 * Rating stars — one element, driven by --rating
 * ----------------------------------------------------------------------- */

.tcgmp-rating {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	color: var( --tcgmp-muted );
}

.tcgmp-rating__stars {
	position: relative;
	display: inline-block;
	width: 5.6em;
	height: 1.1em;
	font-size: 13px;
	background: linear-gradient( var( --tcgmp-border ), var( --tcgmp-border ) );
	-webkit-mask: var( --tcgmp-star-mask );
	mask: var( --tcgmp-star-mask );
}

.tcgmp-rating__stars::before {
	content: '';
	position: absolute;
	inset: 0;
	width: calc( var( --rating, 0 ) / 5 * 100% );
	background: var( --tcgmp-accent );
}

:root {
	--tcgmp-star-mask: url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='70' height='14' viewBox='0 0 70 14'%3E%3Cpath d='M7 0l2.2 4.4 4.8.7-3.5 3.4.8 4.8L7 11l-4.3 2.3.8-4.8L0 5.1l4.8-.7zM21 0l2.2 4.4 4.8.7-3.5 3.4.8 4.8L21 11l-4.3 2.3.8-4.8-3.5-3.4 4.8-.7zM35 0l2.2 4.4 4.8.7-3.5 3.4.8 4.8L35 11l-4.3 2.3.8-4.8-3.5-3.4 4.8-.7zM49 0l2.2 4.4 4.8.7-3.5 3.4.8 4.8L49 11l-4.3 2.3.8-4.8-3.5-3.4 4.8-.7zM63 0l2.2 4.4 4.8.7-3.5 3.4.8 4.8L63 11l-4.3 2.3.8-4.8-3.5-3.4 4.8-.7z' fill='%23000'/%3E%3C/svg%3E" );
}

.tcgmp-verified {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 999px;
	background: var( --tcgmp-primary-soft );
	color: var( --tcgmp-primary-dark );
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	vertical-align: middle;
}

/* --------------------------------------------------------------------------
 * Filters / toolbar
 * ----------------------------------------------------------------------- */

.tcgmp-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var( --tcgmp-gap-sm );
	margin-bottom: var( --tcgmp-gap );
}

.tcgmp-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tcgmp-filters a {
	display: inline-block;
	padding: 8px 12px;
	border-radius: var( --tcgmp-radius-sm );
	color: var( --tcgmp-muted );
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
}

.tcgmp-filters .is-current a,
.tcgmp-filters a:hover {
	background: var( --tcgmp-primary-soft );
	color: var( --tcgmp-primary-dark );
}

.tcgmp-count {
	font-weight: 400;
	opacity: 0.7;
}

.tcgmp-search {
	display: flex;
	gap: 6px;
}

.tcgmp-search input {
	padding: 8px 12px;
	border: 1px solid var( --tcgmp-border );
	border-radius: var( --tcgmp-radius-sm );
	background: var( --tcgmp-surface );
	color: var( --tcgmp-ink );
	font-size: 14px;
}

/* --------------------------------------------------------------------------
 * Modal
 * ----------------------------------------------------------------------- */

.tcgmp-modal {
	width: min( 520px, 92vw );
	padding: 24px;
	border: 1px solid var( --tcgmp-border );
	border-radius: var( --tcgmp-radius );
	background: var( --tcgmp-surface );
	color: var( --tcgmp-ink );
	box-shadow: var( --tcgmp-shadow-lg );
}

.tcgmp-modal::backdrop {
	background: rgba( 20, 18, 31, 0.5 );
}

.tcgmp-modal__title {
	margin: 0 0 var( --tcgmp-gap-sm );
	font-size: 18px;
}

.tcgmp-modal__actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: var( --tcgmp-gap-sm );
}

/* --------------------------------------------------------------------------
 * Media picker
 * ----------------------------------------------------------------------- */

.tcgmp-media__preview img {
	display: block;
	max-width: 100%;
	height: auto;
	margin-bottom: 8px;
	border-radius: var( --tcgmp-radius-sm );
}

.tcgmp-media__grid {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 64px, 1fr ) );
	gap: 6px;
	margin-bottom: 8px;
}

.tcgmp-media__item {
	position: relative;
	display: block;
}

.tcgmp-media__item img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: var( --tcgmp-radius-sm );
}

.tcgmp-media__remove.tcgmp-media__remove {
	position: absolute;
	top: -6px;
	right: -6px;
	width: 20px;
	height: 20px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var( --tcgmp-danger );
	color: #fff;
	font-size: 14px;
	line-height: 20px;
	cursor: pointer;
}

/* --------------------------------------------------------------------------
 * Pagination
 * ----------------------------------------------------------------------- */

.page-numbers {
	display: inline-block;
	padding: 7px 12px;
	margin-right: 4px;
	border: 1px solid var( --tcgmp-border );
	border-radius: var( --tcgmp-radius-sm );
	color: var( --tcgmp-ink-soft );
	font-size: 14px;
	text-decoration: none;
}

.page-numbers.current {
	background: var( --tcgmp-primary );
	border-color: var( --tcgmp-primary );
	color: #fff;
}

.tcgmp-store,
.tcgmp-dash,
.tcgmp-register-page {
	max-width: var( --tcgmp-max-width );
}

/* Link reset.
 *
 * Themes routinely style descendant links inside the content area —
 * hello-elementor uses `.page-content a`, which is (0,2,1) and outranks any
 * single-class rule of ours no matter the load order. Repeating the wrapper
 * class three times gets us to (0,3,1) and wins without !important. Our own
 * components always set their colours explicitly, so this only strips the
 * theme's underline. */
.tcgmp-store.tcgmp-store.tcgmp-store a,
.tcgmp-store-listing.tcgmp-store-listing.tcgmp-store-listing a,
.tcgmp-dash.tcgmp-dash.tcgmp-dash a,
.tcgmp-register-page.tcgmp-register-page.tcgmp-register-page a,
.tcgmp-my-orders.tcgmp-my-orders.tcgmp-my-orders a {
	text-decoration: none;
}

.tcgmp-store.tcgmp-store.tcgmp-store a:hover,
.tcgmp-store-listing.tcgmp-store-listing.tcgmp-store-listing a:hover,
.tcgmp-dash.tcgmp-dash.tcgmp-dash a:hover {
	text-decoration: underline;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect( 1px, 1px, 1px, 1px );
	white-space: nowrap;
}

/* Phones: 16px controls stop iOS zooming the page on focus. */
@media ( max-width: 900px ) {
	.tcgmp-field input[ type='text' ],
	.tcgmp-field input[ type='email' ],
	.tcgmp-field input[ type='url' ],
	.tcgmp-field input[ type='tel' ],
	.tcgmp-field input[ type='number' ],
	.tcgmp-field input[ type='search' ],
	.tcgmp-field input[ type='password' ],
	.tcgmp-field input[ type='time' ],
	.tcgmp-field select,
	.tcgmp-field textarea,
	.tcgmp-search input,
	.tcgmp-store-listing__filters input,
	.tcgmp-store-listing__filters select {
		font-size: 16px;
	}
}
