/* TR Buyer — Mobile-first responsive styles
   ============================================ */

/* ── Custom properties ───────────────────────── */
:root {
	--tr-buyer-primary:      #1a202c;
	--tr-buyer-accent:       #f59e0b;
	--tr-buyer-accent-hover: #d97706;
	--tr-buyer-success:      #059669;
	--tr-buyer-warning:      #d97706;
	--tr-buyer-error:        #dc2626;
	--tr-buyer-info:         #2563eb;
	--tr-buyer-bg:           #f8fafc;
	--tr-buyer-card-bg:      #ffffff;
	--tr-buyer-border:       #e2e8f0;
	--tr-buyer-muted:        #64748b;
	--tr-buyer-radius:       10px;
	--tr-buyer-radius-sm:    6px;
	--tr-buyer-shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
	--tr-buyer-shadow-md:    0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
	--tr-buyer-transition:   0.18s ease;
	--tr-buyer-font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Base ─────────────────────────────────────── */
.tr-buyer-register,
.tr-buyer-auth,
.tr-buyer-myaccount {
	font-family: var(--tr-buyer-font);
	color: var(--tr-buyer-primary);
	box-sizing: border-box;
}

*, *::before, *::after { box-sizing: inherit; }

/* ── Notices ─────────────────────────────────── */
.tr-buyer-notice {
	padding: 12px 16px;
	border-radius: var(--tr-buyer-radius-sm);
	margin-bottom: 16px;
	font-size: 14px;
	line-height: 1.5;
}
.tr-buyer-notice--error   { background: #fef2f2; color: var(--tr-buyer-error); border-left: 3px solid var(--tr-buyer-error); }
.tr-buyer-notice--success { background: #f0fdf4; color: var(--tr-buyer-success); border-left: 3px solid var(--tr-buyer-success); }
.tr-buyer-notice--warning { background: #fffbeb; color: var(--tr-buyer-warning); border-left: 3px solid var(--tr-buyer-warning); }
.tr-buyer-notice--info    { background: #eff6ff; color: var(--tr-buyer-info); border-left: 3px solid var(--tr-buyer-info); }

/* ── Buttons ─────────────────────────────────── */
.tr-buyer-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 20px;
	border-radius: var(--tr-buyer-radius-sm);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	border: 2px solid transparent;
	text-decoration: none;
	transition: background var(--tr-buyer-transition), color var(--tr-buyer-transition), border-color var(--tr-buyer-transition);
	white-space: nowrap;
}
.tr-buyer-btn--primary {
	background: var(--tr-buyer-primary);
	color: #fff;
}
.tr-buyer-btn--primary:hover { background: #2d3748; color: #fff; }
.tr-buyer-btn--outline {
	background: transparent;
	border-color: var(--tr-buyer-border);
	color: var(--tr-buyer-primary);
}
.tr-buyer-btn--outline:hover { border-color: var(--tr-buyer-primary); }
.tr-buyer-btn--link { background: none; border: none; color: var(--tr-buyer-info); padding: 0; font-weight: 500; text-decoration: underline; }
.tr-buyer-btn--link:hover { color: var(--tr-buyer-primary); }
.tr-buyer-btn--sm { padding: 6px 14px; font-size: 13px; }
.tr-buyer-btn--full { width: 100%; }
.tr-buyer-btn.is-loading .tr-buyer-btn__text { display: none; }
.tr-buyer-btn:disabled { opacity: .6; cursor: not-allowed; }

/* Spinner */
.tr-buyer-spinner {
	display: none;
	width: 16px; height: 16px;
	border: 2px solid currentColor;
	border-top-color: transparent;
	border-radius: 50%;
	animation: tr-spin .7s linear infinite;
}
.is-loading .tr-buyer-spinner { display: inline-block; }
@keyframes tr-spin { to { transform: rotate(360deg); } }

/* ── Form elements ───────────────────────────── */
.tr-buyer-field { margin-bottom: 18px; }
.tr-buyer-label {
	display: block;
	font-size: 14px;
	font-weight: 600;
	margin-bottom: 6px;
	color: var(--tr-buyer-primary);
}
.tr-buyer-label--required::after { content: ' *'; color: var(--tr-buyer-error); }
.tr-buyer-input {
	width: 100%;
	padding: 10px 14px;
	border: 1.5px solid var(--tr-buyer-border);
	border-radius: var(--tr-buyer-radius-sm);
	font-size: 15px;
	transition: border-color var(--tr-buyer-transition), box-shadow var(--tr-buyer-transition);
	background: #fff;
	color: var(--tr-buyer-primary);
}
.tr-buyer-input:focus {
	outline: none;
	border-color: var(--tr-buyer-primary);
	box-shadow: 0 0 0 3px rgba(26,32,44,.1);
}
.tr-buyer-input::placeholder { color: #94a3b8; }
.tr-buyer-input--code { letter-spacing: .2em; font-family: monospace; font-size: 18px; text-align: center; }
.tr-buyer-field__hint { display: block; font-size: 12px; color: var(--tr-buyer-muted); margin-top: 4px; }

.tr-buyer-checkbox-label {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-size: 14px;
	cursor: pointer;
}
.tr-buyer-checkbox { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; accent-color: var(--tr-buyer-primary); }

/* Email + code rows */
.tr-buyer-email-row,
.tr-buyer-code-row,
.tr-buyer-pass-row {
	display: flex;
	gap: 8px;
	align-items: stretch;
}
.tr-buyer-email-row .tr-buyer-input,
.tr-buyer-code-row .tr-buyer-input { flex: 1; }
.tr-buyer-toggle-pass {
	background: none; border: 1.5px solid var(--tr-buyer-border);
	border-radius: var(--tr-buyer-radius-sm);
	padding: 0 12px; cursor: pointer; color: var(--tr-buyer-muted);
	flex-shrink: 0;
}
.tr-buyer-toggle-pass:hover { border-color: var(--tr-buyer-primary); color: var(--tr-buyer-primary); }

/* Password strength */
.tr-buyer-strength { margin-top: 6px; font-size: 12px; font-weight: 600; }
.tr-buyer-strength--weak   { color: var(--tr-buyer-error); }
.tr-buyer-strength--medium { color: var(--tr-buyer-warning); }
.tr-buyer-strength--strong { color: var(--tr-buyer-success); }

/* ── Registration card ───────────────────────── */
.tr-buyer-register { background: var(--tr-buyer-bg); min-height: 100vh; padding: 24px 16px; }
.tr-buyer-register__card {
	background: var(--tr-buyer-card-bg);
	border-radius: var(--tr-buyer-radius);
	box-shadow: var(--tr-buyer-shadow-md);
	padding: 32px 24px;
	max-width: 520px;
	margin: 0 auto;
}
.tr-buyer-register__header { margin-bottom: 28px; text-align: center; }
.tr-buyer-register__title { font-size: 26px; font-weight: 700; margin: 0 0 8px; }
.tr-buyer-register__subtitle { font-size: 14px; color: var(--tr-buyer-muted); margin: 0; }
.tr-buyer-register__subtitle a { color: var(--tr-buyer-info); text-decoration: none; font-weight: 600; }

.tr-buyer-form__row--split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tr-buyer-form__actions { margin-top: 24px; }
.tr-buyer-register__divider { text-align: center; color: var(--tr-buyer-muted); font-size: 13px; margin: 20px 0 0; position: relative; }
.tr-buyer-register__divider::before,
.tr-buyer-register__divider::after { content: ''; position: absolute; top: 50%; width: 40%; height: 1px; background: var(--tr-buyer-border); }
.tr-buyer-register__divider::before { left: 0; }
.tr-buyer-register__divider::after  { right: 0; }

/* ── Auth / Login ────────────────────────────── */
.tr-buyer-auth { max-width: 440px; margin: 0 auto; padding: 24px 16px; }
.tr-buyer-form__footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20px;
	flex-wrap: wrap;
	gap: 8px;
}
.tr-buyer-auth__register-link { text-align: center; font-size: 14px; color: var(--tr-buyer-muted); margin-top: 20px; }
.tr-buyer-auth__register-link a { color: var(--tr-buyer-info); font-weight: 600; text-decoration: none; }

/* ── My Account layout ───────────────────────── */
.tr-buyer-myaccount { padding: 0; }
.tr-buyer-myaccount__layout {
	display: flex;
	flex-direction: column;
	gap: 0;
}

/* Nav */
.tr-buyer-myaccount__nav {
	background: var(--tr-buyer-card-bg);
	border-bottom: 1px solid var(--tr-buyer-border);
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}
.tr-buyer-nav {
	display: flex;
	list-style: none;
	margin: 0;
	padding: 0;
	min-width: max-content;
}
.tr-buyer-nav__link {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 14px 18px;
	font-size: 14px;
	font-weight: 500;
	color: var(--tr-buyer-muted);
	text-decoration: none;
	border-bottom: 2px solid transparent;
	white-space: nowrap;
	transition: color var(--tr-buyer-transition), border-color var(--tr-buyer-transition);
}
.tr-buyer-nav__link:hover { color: var(--tr-buyer-primary); }
.tr-buyer-nav__item.is-active .tr-buyer-nav__link,
.tr-buyer-nav__link[aria-current="page"] {
	color: var(--tr-buyer-primary);
	border-bottom-color: var(--tr-buyer-primary);
	font-weight: 700;
}

.tr-buyer-myaccount__content { padding: 24px 16px; }

/* ── Account header ──────────────────────────── */
.tr-buyer-account-header {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 20px 16px;
	background: var(--tr-buyer-card-bg);
	border-bottom: 1px solid var(--tr-buyer-border);
}
.tr-buyer-avatar { border-radius: 50%; display: block; }
.tr-buyer-account-header__name { display: block; font-weight: 700; font-size: 17px; }
.tr-buyer-account-header__orders { display: block; font-size: 13px; color: var(--tr-buyer-muted); margin-top: 2px; }

/* ── Dashboard ───────────────────────────────── */
.tr-buyer-dashboard__welcome { margin-bottom: 24px; }
.tr-buyer-dashboard__greeting { font-size: 22px; font-weight: 700; margin: 0 0 8px; }
.tr-buyer-dashboard__sub { font-size: 14px; color: var(--tr-buyer-muted); margin: 0; }

/* Stats grid */
.tr-buyer-stats-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
	margin-bottom: 28px;
}
.tr-buyer-stat {
	background: var(--tr-buyer-card-bg);
	border: 1px solid var(--tr-buyer-border);
	border-radius: var(--tr-buyer-radius);
	padding: 20px 16px;
	text-align: center;
}
.tr-buyer-stat__number { display: block; font-size: 28px; font-weight: 700; line-height: 1; }
.tr-buyer-stat__label  { display: block; font-size: 13px; color: var(--tr-buyer-muted); margin-top: 6px; }

/* Section header */
.tr-buyer-section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.tr-buyer-section-title  { font-size: 18px; font-weight: 700; margin: 0; }

/* Order cards */
.tr-buyer-order-cards { display: flex; flex-direction: column; gap: 12px; }
.tr-buyer-order-card {
	background: var(--tr-buyer-card-bg);
	border: 1px solid var(--tr-buyer-border);
	border-radius: var(--tr-buyer-radius);
	padding: 16px;
}
.tr-buyer-order-card__head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 10px;
}
.tr-buyer-order-card__number { font-weight: 700; font-size: 15px; }
.tr-buyer-order-card__body {
	display: flex;
	justify-content: space-between;
	font-size: 14px;
	color: var(--tr-buyer-muted);
	margin-bottom: 14px;
}
.tr-buyer-order-card__total { font-weight: 600; color: var(--tr-buyer-primary); }
.tr-buyer-order-card__actions { display: flex; gap: 8px; }

/* Status badges */
.tr-buyer-status {
	font-size: 12px;
	font-weight: 600;
	padding: 3px 10px;
	border-radius: 20px;
	text-transform: capitalize;
}
.tr-buyer-status--processing { background: #dbeafe; color: #1d4ed8; }
.tr-buyer-status--completed  { background: #dcfce7; color: #166534; }
.tr-buyer-status--on-hold    { background: #fef3c7; color: #92400e; }
.tr-buyer-status--cancelled  { background: #fee2e2; color: #991b1b; }
.tr-buyer-status--pending    { background: #f1f5f9; color: #475569; }
.tr-buyer-status--refunded   { background: #f3e8ff; color: #6b21a8; }

/* Empty state */
.tr-buyer-empty-state {
	text-align: center;
	padding: 48px 24px;
	color: var(--tr-buyer-muted);
}
.tr-buyer-empty-state svg { margin: 0 auto 16px; display: block; opacity: .4; }
.tr-buyer-empty-state p { margin: 0 0 20px; font-size: 15px; }

/* Endpoint pages */
.tr-buyer-endpoint { padding-top: 4px; }
.tr-buyer-endpoint__title { font-size: 20px; font-weight: 700; margin: 0 0 20px; }

/* Notifications */
.tr-buyer-notifications { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.tr-buyer-notification {
	padding: 14px 16px;
	border-radius: var(--tr-buyer-radius-sm);
	border: 1px solid var(--tr-buyer-border);
	background: var(--tr-buyer-card-bg);
}
.tr-buyer-notification.is-unread { border-left: 3px solid var(--tr-buyer-accent); }
.tr-buyer-notification p { margin: 0 0 4px; }
.tr-buyer-notification time { font-size: 12px; color: var(--tr-buyer-muted); }
.tr-buyer-notification--info    { border-left-color: var(--tr-buyer-info); }
.tr-buyer-notification--success { border-left-color: var(--tr-buyer-success); }
.tr-buyer-notification--warning { border-left-color: var(--tr-buyer-warning); }
.tr-buyer-notification--error   { border-left-color: var(--tr-buyer-error); }

/* Links */
.tr-buyer-link { color: var(--tr-buyer-info); text-decoration: none; font-size: 14px; font-weight: 500; }
.tr-buyer-link:hover { text-decoration: underline; }
.tr-buyer-link--muted { color: var(--tr-buyer-muted); }

/* Do URL / slug row for Do plugin */
.tr-do-split-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.tr-do-form-group { margin-bottom: 18px; }
.tr-do-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.tr-do-label--required::after { content: ' *'; color: var(--tr-buyer-error); }
.tr-do-input { width: 100%; padding: 10px 14px; border: 1.5px solid var(--tr-buyer-border); border-radius: var(--tr-buyer-radius-sm); font-size: 15px; }
.tr-do-input:focus { outline: none; border-color: var(--tr-buyer-primary); }
.tr-do-url-row { display: flex; align-items: center; gap: 0; }
.tr-do-url-prefix { font-size: 13px; color: var(--tr-buyer-muted); white-space: nowrap; padding: 10px 8px 10px 0; }
.tr-do-url-status { display: block; font-size: 12px; margin-top: 4px; }
.tr-do-radio-label { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 15px; margin-bottom: 10px; }
.tr-do-user-role { margin-bottom: 20px; }
.tr-do-checkbox-label { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; }
.tr-do-result-count { font-size: 14px; color: var(--tr-buyer-muted); margin-bottom: 16px; }
.tr-do-sold-by { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-top: 6px; color: var(--tr-buyer-muted); }
.tr-do-sold-by__link { color: var(--tr-buyer-info); text-decoration: none; }
.tr-do-sold-by__link:hover { text-decoration: underline; }
.tr-do-no-products { color: var(--tr-buyer-muted); font-size: 14px; }
.tr-do-more-products__heading { font-size: 18px; font-weight: 700; margin-bottom: 16px; }

/* ── Responsive ───────────────────────────────── */

/* ≥480px: register split row stays side-by-side */
@media (max-width: 479px) {
	.tr-buyer-form__row--split { grid-template-columns: 1fr; }
	.tr-do-split-row { grid-template-columns: 1fr; }
	.tr-buyer-stats-grid { grid-template-columns: 1fr; }
	.tr-buyer-register__card { padding: 24px 16px; }
}

/* ≥768px: My Account goes sidebar layout */
@media (min-width: 768px) {
	.tr-buyer-myaccount__layout {
		flex-direction: row;
		align-items: flex-start;
		gap: 0;
	}
	.tr-buyer-myaccount__nav {
		width: 220px;
		min-width: 220px;
		flex-shrink: 0;
		border-bottom: none;
		border-right: 1px solid var(--tr-buyer-border);
		overflow-x: visible;
		position: sticky;
		top: 80px;
		align-self: flex-start;
		min-height: calc(100vh - 80px);
	}
	.tr-buyer-nav {
		flex-direction: column;
		min-width: auto;
	}
	.tr-buyer-nav__link {
		border-bottom: none;
		border-left: 2px solid transparent;
		padding: 12px 20px;
	}
	.tr-buyer-nav__item.is-active .tr-buyer-nav__link,
	.tr-buyer-nav__link[aria-current="page"] {
		border-left-color: var(--tr-buyer-primary);
		border-bottom-color: transparent;
		background: var(--tr-buyer-bg);
	}
	.tr-buyer-myaccount__content { flex: 1; padding: 32px; min-width: 0; }
	.tr-buyer-account-header { padding: 24px 32px; }
	.tr-buyer-order-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}

/* ≥1024px: wider stats */
@media (min-width: 1024px) {
	.tr-buyer-stats-grid { grid-template-columns: repeat(3, 1fr); }
	.tr-buyer-myaccount__nav { width: 260px; min-width: 260px; }
}

/* ── Nav icons (emoji via ::before) ─────────────── */
.tr-buyer-nav__icon {
	display: inline-block;
	font-style: normal;
	font-size: 1em;
	line-height: 1;
	flex-shrink: 0;
}
.tr-buyer-nav__icon::before { content: ''; }
.tr-buyer-nav__icon--dashboard::before        { content: '🏠'; }
.tr-buyer-nav__icon--orders::before           { content: '📦'; }
.tr-buyer-nav__icon--downloads::before        { content: '⬇️'; }
.tr-buyer-nav__icon--edit-account::before     { content: '👤'; }
.tr-buyer-nav__icon--edit-address::before     { content: '📍'; }
.tr-buyer-nav__icon--payment-methods::before  { content: '💳'; }
.tr-buyer-nav__icon--tr-wishlist::before      { content: '❤️'; }
.tr-buyer-nav__icon--tr-notifications::before { content: '🔔'; }
.tr-buyer-nav__icon--tr-track-order::before   { content: '🚚'; }
.tr-buyer-nav__icon--tr-history::before       { content: '🕑'; }
.tr-buyer-nav__icon--customer-logout::before  { content: '🚪'; }

/* ── Browsing History ─────────────────────────── */
.tr-buyer-history {
	font-family: var(--tr-buyer-font);
}

.tr-buyer-history__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 24px;
}

.tr-buyer-history__title {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--tr-buyer-primary);
	margin: 0;
}

.tr-buyer-history__clear {
	background: transparent;
	border: 1px solid var(--tr-buyer-border);
	color: var(--tr-buyer-muted);
	padding: 6px 14px;
	border-radius: var(--tr-buyer-radius-sm);
	cursor: pointer;
	font-size: 0.85rem;
	transition: var(--tr-buyer-transition);
}
.tr-buyer-history__clear:hover {
	border-color: var(--tr-buyer-error);
	color: var(--tr-buyer-error);
}

.tr-buyer-history__empty {
	text-align: center;
	padding: 48px 24px;
	color: var(--tr-buyer-muted);
}
.tr-buyer-history__empty .button {
	margin-top: 16px;
	display: inline-block;
	padding: 10px 24px;
	background: var(--tr-buyer-accent);
	color: #fff;
	border-radius: var(--tr-buyer-radius-sm);
	text-decoration: none;
	font-weight: 600;
	transition: background var(--tr-buyer-transition);
}
.tr-buyer-history__empty .button:hover { background: var(--tr-buyer-accent-hover); }

.tr-buyer-history__grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: 1fr;
	gap: 16px;
}

.tr-buyer-history__card {
	display: flex;
	align-items: flex-start;
	gap: 16px;
	background: var(--tr-buyer-card-bg);
	border: 1px solid var(--tr-buyer-border);
	border-radius: var(--tr-buyer-radius);
	padding: 16px;
	position: relative;
	box-shadow: var(--tr-buyer-shadow);
	transition: box-shadow var(--tr-buyer-transition);
}
.tr-buyer-history__card:hover { box-shadow: var(--tr-buyer-shadow-md); }

.tr-buyer-history__img-link {
	flex-shrink: 0;
	width: 80px;
	height: 80px;
	display: block;
	border-radius: var(--tr-buyer-radius-sm);
	overflow: hidden;
}
.tr-buyer-history__img-link img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.tr-buyer-history__info {
	flex: 1;
	min-width: 0;
}

.tr-buyer-history__name {
	display: block;
	font-weight: 600;
	color: var(--tr-buyer-primary);
	text-decoration: none;
	margin-bottom: 4px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.tr-buyer-history__name:hover { color: var(--tr-buyer-accent); }

.tr-buyer-history__price {
	display: block;
	font-weight: 700;
	color: var(--tr-buyer-accent);
	margin-bottom: 4px;
}

.tr-buyer-history__rating { margin-bottom: 4px; }

.tr-buyer-history__time {
	display: block;
	font-size: 0.78rem;
	color: var(--tr-buyer-muted);
	margin-top: 4px;
}

.tr-buyer-history__remove {
	position: absolute;
	top: 10px;
	right: 10px;
	background: transparent;
	border: none;
	color: var(--tr-buyer-muted);
	font-size: 1.1rem;
	cursor: pointer;
	line-height: 1;
	padding: 4px 6px;
	border-radius: var(--tr-buyer-radius-sm);
	transition: var(--tr-buyer-transition);
}
.tr-buyer-history__remove:hover {
	background: #fee2e2;
	color: var(--tr-buyer-error);
}

@media (min-width: 640px) {
	.tr-buyer-history__grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1024px) {
	.tr-buyer-history__grid {
		grid-template-columns: repeat(3, 1fr);
	}
}
