/*
 * Themeve Marketplace – neutral base styles.
 * Themes can restyle everything via the tvm- classes or these variables.
 */
.tvm {
	--tvm-primary: var(--mb-primary, #e11d48);
	--tvm-secondary: var(--mb-secondary, #1e40af);
	--tvm-radius: var(--mb-radius, 12px);
	--tvm-text: var(--mb-text, #18181b);
	--tvm-muted: var(--mb-muted, #71717a);
	--tvm-border: var(--mb-border, #e4e4e7);
	--tvm-surface: var(--mb-surface, #ffffff);
	--tvm-soft: var(--mb-soft, #f4f4f5);
	--tvm-success: #059669;
	--tvm-warning: #d97706;
	--tvm-danger: #dc2626;
	color: var(--tvm-text);
	font-size: 15px;
	line-height: 1.5;
	box-sizing: border-box;
}
.tvm *, .tvm *::before, .tvm *::after { box-sizing: inherit; }
.tvm img { max-width: 100%; height: auto; }
.tvm a { color: inherit; }

/* Generic */
.tvm-card { background: var(--tvm-surface); border: 1px solid var(--tvm-border); border-radius: var(--tvm-radius); padding: 16px; }
.tvm-title { font-size: 1.35em; line-height: 1.25; margin: 0 0 8px; }
.tvm-subtitle { font-size: 1.05em; margin: 0 0 12px; font-weight: 600; }
.tvm-muted { color: var(--tvm-muted); font-size: .92em; }
.tvm-center { text-align: center; }
.tvm-empty { color: var(--tvm-muted); padding: 24px 0; text-align: center; }
.tvm-link { color: var(--tvm-secondary); text-decoration: none; font-weight: 500; }
.tvm-link:hover { text-decoration: underline; }
.tvm-icon { display: inline-block; vertical-align: -3px; flex-shrink: 0; }
.tvm-verified { color: var(--tvm-secondary); display: inline-flex; vertical-align: middle; }
.tvm .screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }
.tvm-hp { position: absolute; left: -9999px; }

/* Buttons */
.tvm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 8px 18px; border-radius: var(--tvm-radius); border: 1px solid var(--tvm-border); background: var(--tvm-surface); color: var(--tvm-text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; transition: filter .15s, background .15s; }
.tvm-btn:hover { filter: brightness(.95); }
.tvm-btn:focus-visible { outline: 2px solid var(--tvm-secondary); outline-offset: 2px; }
.tvm-btn--primary { background: var(--tvm-primary); border-color: var(--tvm-primary); color: #fff; }
.tvm-btn--outline { background: transparent; border-color: var(--tvm-primary); color: var(--tvm-primary); }
.tvm-btn--sm { min-height: 36px; padding: 6px 12px; font-size: .9em; }
.tvm-btn--block { width: 100%; }
.tvm-btn[disabled] { opacity: .6; cursor: default; }

/* Notices / states */
.tvm-notice { padding: 12px 14px; border-radius: var(--tvm-radius); background: var(--tvm-soft); border-left: 4px solid var(--tvm-secondary); margin: 0 0 16px; }
.tvm-notice ul { margin: 0; padding-left: 18px; }
.tvm-notice--success { border-left-color: var(--tvm-success); background: #ecfdf5; }
.tvm-notice--error { border-left-color: var(--tvm-danger); background: #fef2f2; }
.tvm-state { text-align: center; padding: 32px 16px; max-width: 560px; margin: 0 auto; }
.tvm-state__icon { font-size: 40px; margin-bottom: 8px; }

/* Forms */
.tvm-form { display: grid; gap: 14px; }
.tvm-field { display: grid; gap: 6px; min-width: 0; }
.tvm-field label { font-weight: 600; font-size: .92em; }
.tvm-field input:not([type=checkbox]):not([type=file]), .tvm-field select, .tvm-field textarea { width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid var(--tvm-border); border-radius: calc(var(--tvm-radius) * .66); background: var(--tvm-surface); color: inherit; font: inherit; }
.tvm-field input:focus, .tvm-field select:focus, .tvm-field textarea:focus { outline: none; border-color: var(--tvm-secondary); box-shadow: 0 0 0 3px rgba(30, 64, 175, .15); }
.tvm-field-row { display: grid; gap: 14px; }
.tvm-fieldset { margin: 0; display: grid; gap: 14px; }
.tvm-fieldset legend { float: left; width: 100%; padding: 0; }
.tvm-req { color: var(--tvm-danger); }
.tvm-check { display: flex; gap: 8px; align-items: flex-start; font-size: .92em; }
.tvm-check input { margin-top: 3px; }
.tvm-input-prefix { display: flex; align-items: stretch; }
.tvm-input-prefix span { display: flex; align-items: center; padding: 0 10px; background: var(--tvm-soft); border: 1px solid var(--tvm-border); border-right: 0; border-radius: calc(var(--tvm-radius) * .66) 0 0 calc(var(--tvm-radius) * .66); color: var(--tvm-muted); font-size: .9em; white-space: nowrap; }
.tvm-input-prefix input { border-radius: 0 calc(var(--tvm-radius) * .66) calc(var(--tvm-radius) * .66) 0 !important; }
.tvm-preview { display: block; border-radius: calc(var(--tvm-radius) * .66); border: 1px solid var(--tvm-border); object-fit: cover; }
.tvm-preview--logo { width: 72px; height: 72px; }
.tvm-preview--banner { width: 100%; max-height: 120px; }
.tvm-inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.tvm-inline-form .tvm-field { flex: 1 1 160px; }

/* Register */
.tvm-register { max-width: 620px; margin: 0 auto; }
.tvm-register__intro { text-align: center; margin-bottom: 16px; }

/* Tabs */
.tvm-tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--tvm-border); margin: 0 0 16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tvm-tabs::-webkit-scrollbar { display: none; }
.tvm-tabs__item { flex: 0 0 auto; padding: 10px 14px; text-decoration: none; color: var(--tvm-muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tvm-tabs__item:hover { color: var(--tvm-text); }
.tvm-tabs__item.is-active { color: var(--tvm-primary); border-bottom-color: var(--tvm-primary); }

/* Dashboard */
.tvm-dashboard__head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.tvm-dashboard__logo, .tvm-logo--placeholder { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.tvm-logo--placeholder { display: inline-flex; align-items: center; justify-content: center; background: var(--tvm-primary); color: #fff; font-weight: 700; font-size: 1.25em; }
.tvm-dashboard__who { display: grid; gap: 2px; }
.tvm-dashboard__store { font-size: 1.1em; }
.tvm-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.tvm-stat { display: grid; gap: 4px; padding: 14px; }
.tvm-stat__label { color: var(--tvm-muted); font-size: .85em; }
.tvm-stat__value { font-size: 1.3em; line-height: 1.2; }
.tvm-chart { display: flex; align-items: flex-end; gap: 2px; height: 140px; padding-top: 8px; border-bottom: 1px solid var(--tvm-border); }
.tvm-chart__bar { flex: 1 1 0; min-width: 0; height: var(--h, 0%); background: var(--tvm-primary); border-radius: 3px 3px 0 0; opacity: .85; position: relative; }
.tvm-chart__bar:hover { opacity: 1; }
.tvm-chart__axis { display: flex; justify-content: space-between; color: var(--tvm-muted); font-size: .8em; margin-top: 6px; }
.tvm-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.tvm-withdraw { display: grid; gap: 14px; margin-bottom: 20px; }
.tvm-withdraw__balance { display: grid; gap: 2px; }

/* Tables → cards on mobile */
.tvm-table-wrap { width: 100%; }
.tvm-table { width: 100%; border-collapse: collapse; font-size: .92em; }
.tvm-table th { text-align: left; font-weight: 600; color: var(--tvm-muted); padding: 10px; border-bottom: 1px solid var(--tvm-border); }
.tvm-table td { padding: 10px; border-bottom: 1px solid var(--tvm-border); vertical-align: middle; }
.tvm-product-cell { display: flex; align-items: center; gap: 10px; }
.tvm-product-cell img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; }
@media (max-width: 719px) {
	.tvm-table thead { display: none; }
	.tvm-table, .tvm-table tbody, .tvm-table tr, .tvm-table td { display: block; width: 100%; }
	.tvm-table tr { border: 1px solid var(--tvm-border); border-radius: var(--tvm-radius); margin-bottom: 10px; padding: 6px 12px; background: var(--tvm-surface); }
	.tvm-table td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 6px 0; text-align: right; }
	.tvm-table td[data-label]::before { content: attr(data-label); color: var(--tvm-muted); font-weight: 600; text-align: left; }
	.tvm-table td.tvm-actions { justify-content: flex-end; }
}

/* Badges */
.tvm-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8em; font-weight: 600; background: var(--tvm-soft); color: var(--tvm-muted); white-space: nowrap; }
.tvm-badge--publish, .tvm-badge--available, .tvm-badge--paid { background: #d1fae5; color: #065f46; }
.tvm-badge--pending, .tvm-badge--requested { background: #fef3c7; color: #92400e; }
.tvm-badge--approved { background: #dbeafe; color: #1e3a8a; }
.tvm-badge--refunded, .tvm-badge--rejected { background: #fee2e2; color: #991b1b; }

/* Pagination */
.tvm-pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 20px 0; }
.tvm-pagination__item { min-width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--tvm-border); border-radius: calc(var(--tvm-radius) * .66); text-decoration: none; }
.tvm-pagination__item.is-current { background: var(--tvm-primary); border-color: var(--tvm-primary); color: #fff; }

/* Store page */
.tvm-store { max-width: 1280px; margin: 0 auto; padding: 0 12px 32px; }
.tvm-store__header { background: var(--tvm-surface); border: 1px solid var(--tvm-border); border-radius: var(--tvm-radius); overflow: hidden; margin: 12px 0 8px; }
.tvm-store__banner { aspect-ratio: 4 / 1; min-height: 110px; max-height: 240px; background: linear-gradient(120deg, var(--tvm-primary), var(--tvm-secondary)); background-size: cover; background-position: center; }
.tvm-store__bar { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 0 14px 14px; align-items: end; }
.tvm-store__logo { width: 76px; height: 76px; border-radius: 50%; border: 3px solid var(--tvm-surface); margin-top: -38px; object-fit: cover; background: var(--tvm-surface); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
.tvm-store__logo.tvm-logo--placeholder { font-size: 1.8em; }
.tvm-store__info { min-width: 0; }
.tvm-store__name { font-size: 1.3em; line-height: 1.2; margin: 8px 0 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tvm-store__meta { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--tvm-muted); font-size: .88em; }
.tvm-store__actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.tvm-store__actions .tvm-btn { flex: 1; }
.tvm-follow.is-following { background: var(--tvm-surface); color: var(--tvm-primary); }
.tvm-follow.is-following .tvm-icon path { fill: currentColor; }
.tvm-sort { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-bottom: 12px; }
.tvm-sort select { min-height: 38px; padding: 4px 10px; border: 1px solid var(--tvm-border); border-radius: calc(var(--tvm-radius) * .66); background: var(--tvm-surface); font: inherit; }
.tvm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tvm-about__list { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 16px 0 0; }
.tvm-about__list dt { color: var(--tvm-muted); }
.tvm-about__list dd { margin: 0; }
.tvm-social { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tvm-social a { display: inline-block; padding: 4px 12px; border: 1px solid var(--tvm-border); border-radius: 999px; text-decoration: none; font-size: .9em; }
.tvm-rating-summary { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.tvm-rating-summary__value { font-size: 2em; line-height: 1; }

/* Reviews */
.tvm-reviews { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tvm-review { border: 1px solid var(--tvm-border); border-radius: var(--tvm-radius); padding: 12px 14px; background: var(--tvm-surface); }
.tvm-review__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tvm-review__date { color: var(--tvm-muted); font-size: .85em; margin-left: auto; }
.tvm-review__product { display: block; color: var(--tvm-secondary); font-size: .88em; text-decoration: none; margin-top: 2px; }
.tvm-review__text p { margin: 6px 0 0; }
.tvm-stars { display: inline-flex; gap: 1px; color: #d4d4d8; }
.tvm-star.is-on { color: #f59e0b; }

/* Stores list */
.tvm-stores { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tvm-store-card { padding: 0; overflow: hidden; text-decoration: none; display: flex; flex-direction: column; transition: box-shadow .15s; }
.tvm-store-card:hover { box-shadow: 0 6px 20px rgba(0, 0, 0, .08); }
.tvm-store-card__banner { display: block; height: 64px; background: linear-gradient(120deg, var(--tvm-primary), var(--tvm-secondary)); background-size: cover; background-position: center; }
.tvm-store-card__body { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 10px 14px; gap: 4px; }
.tvm-store-card__logo { width: 56px; height: 56px; border-radius: 50%; margin-top: -28px; border: 3px solid var(--tvm-surface); object-fit: cover; background: var(--tvm-surface); }
.tvm-store-card__name { font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.tvm-store-card__meta { color: var(--tvm-muted); font-size: .82em; }

/* Seller box (product page) */
.tvm-seller-box { border: 1px solid var(--tvm-border); border-radius: var(--tvm-radius); padding: 14px; background: var(--tvm-surface); display: grid; gap: 12px; }
.tvm-seller-box__head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tvm-seller-box__logo { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 1px solid var(--tvm-border); }
.tvm-seller-box__info { display: grid; gap: 1px; min-width: 0; }
.tvm-seller-box__label { color: var(--tvm-muted); font-size: .78em; text-transform: uppercase; letter-spacing: .04em; }
.tvm-seller-box__name { font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; overflow: hidden; text-overflow: ellipsis; }
.tvm-seller-box__rating { color: var(--tvm-success); font-size: .85em; font-weight: 600; }
.tvm-seller-box__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tvm-seller-box__actions .tvm-btn:only-child { grid-column: 1 / -1; }

@media (min-width: 600px) {
	.tvm-field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.tvm-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.tvm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
	.tvm-stores { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
	.tvm-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
	.tvm-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
	.tvm-stores { grid-template-columns: repeat(4, minmax(0, 1fr)); }
	.tvm-store__bar { grid-template-columns: auto 1fr auto; padding: 0 20px 18px; }
	.tvm-store__logo { width: 104px; height: 104px; margin-top: -52px; }
	.tvm-store__name { font-size: 1.6em; }
	.tvm-store__actions { grid-column: auto; }
	.tvm-store__actions .tvm-btn { flex: 0 0 auto; }
}
@media (min-width: 1200px) {
	.tvm-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

.tvm-seller-box__logo[src*="logo"] { object-fit: contain; background: #fff; padding: 3px; }
