/**
 * Nventory — Admin Styles
 * Refined, utilitarian dashboard aesthetic.
 */

/* ── Reset & Base ── */

.nventory-wrap {
	max-width: 1080px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.nventory-wrap *,
.nventory-wrap *::before,
.nventory-wrap *::after {
	box-sizing: border-box;
}

/* ── Dashboard Header ── */

.nventory-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 24px;
	background: #111827;
	border-radius: 10px;
	margin: 16px 0 0;
	position: relative;
	overflow: hidden;
}

.nventory-header::before {
	content: '';
	position: absolute;
	top: 0;
	right: 0;
	width: 300px;
	height: 100%;
	background: linear-gradient(135deg, rgba(99,102,241,0.12) 0%, transparent 70%);
	pointer-events: none;
}

.nventory-header__left {
	display: flex;
	align-items: center;
	gap: 14px;
	position: relative;
	z-index: 1;
}

.nventory-header__logo {
	width: 36px;
	height: 36px;
	background: rgba(255,255,255,0.1);
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.nventory-header__logo svg {
	width: 20px;
	height: 20px;
	fill: #fff;
}

.nventory-header__title {
	margin: 0;
	padding: 0;
	font-size: 18px;
	font-weight: 600;
	color: #fff;
	letter-spacing: -0.3px;
}

.nventory-header__pills {
	display: flex;
	align-items: center;
	gap: 8px;
}

.nventory-header__right {
	position: relative;
	z-index: 1;
}

.nventory-header__right .nventory-btn-dash {
	background: #fff;
	color: #111827;
	border: none;
	padding: 8px 18px;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	transition: background 0.15s, transform 0.1s;
	line-height: 1.4;
}

.nventory-header__right .nventory-btn-dash:hover {
	background: #f3f4f6;
	transform: translateY(-1px);
}

.nventory-header__right .nventory-btn-dash:active {
	transform: translateY(0);
}

.nventory-header__right .nventory-btn-dash svg {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
}

/* ── Pills ── */

.nventory-pill {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 3px 10px;
	border-radius: 20px;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	line-height: 1.4;
}

.nventory-pill--connected {
	background: rgba(16,185,129,0.15);
	color: #34d399;
}

.nventory-pill--connected::before {
	content: '';
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #10b981;
	animation: nventoryPulse 2s ease-in-out infinite;
}

@keyframes nventoryPulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.4; }
}

.nventory-pill--mode {
	background: rgba(255,255,255,0.1);
	color: rgba(255,255,255,0.8);
}

.nventory-pill--active {
	background: #ecfdf5;
	color: #047857;
}

.nventory-pill--active::before {
	content: '';
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: #10b981;
}

.nventory-pill--inactive {
	background: #fef2f2;
	color: #b91c1c;
}

.nventory-pill--inactive::before {
	content: '';
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: #ef4444;
}

/* ── Welcome Banner ── */

.nventory-welcome {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	margin: 16px 0;
	gap: 16px;
}

.nventory-welcome__text {
	font-size: 13px;
	color: #475569;
	line-height: 1.5;
}

.nventory-welcome__text strong {
	color: #0f172a;
}

.nventory-welcome__dismiss {
	background: none;
	border: none;
	color: #94a3b8;
	cursor: pointer;
	padding: 4px;
	flex-shrink: 0;
}

.nventory-welcome__dismiss:hover {
	color: #64748b;
}

/* ── Stats Grid ── */

.nventory-stats {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
	margin: 16px 0;
}

.nventory-stat {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	padding: 18px 20px;
	transition: border-color 0.15s, box-shadow 0.15s;
	position: relative;
	overflow: hidden;
}

.nventory-stat:hover {
	border-color: #d1d5db;
	box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.nventory-stat--warn {
	border-left: 3px solid #f59e0b;
}

.nventory-stat--danger {
	border-left: 3px solid #ef4444;
}

.nventory-stat__top {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	margin-bottom: 10px;
}

.nventory-stat__icon {
	width: 32px;
	height: 32px;
	border-radius: 7px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.nventory-stat__icon svg {
	width: 16px;
	height: 16px;
}

.nventory-stat__icon--products { background: #ede9fe; }
.nventory-stat__icon--products svg { stroke: #7c3aed; fill: none; }

.nventory-stat__icon--orders { background: #dbeafe; }
.nventory-stat__icon--orders svg { stroke: #2563eb; fill: none; }

.nventory-stat__icon--revenue { background: #dcfce7; }
.nventory-stat__icon--revenue svg { stroke: #16a34a; fill: none; }

.nventory-stat__icon--pending { background: #fef3c7; }
.nventory-stat__icon--pending svg { stroke: #d97706; fill: none; }

.nventory-stat__icon--lowstock { background: #ffedd5; }
.nventory-stat__icon--lowstock svg { stroke: #ea580c; fill: none; }

.nventory-stat__icon--outofstock { background: #fee2e2; }
.nventory-stat__icon--outofstock svg { stroke: #dc2626; fill: none; }

.nventory-stat__value {
	font-size: 26px;
	font-weight: 700;
	color: #111827;
	line-height: 1.1;
	letter-spacing: -0.5px;
}

.nventory-stat__label {
	font-size: 11px;
	color: #6b7280;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.4px;
	margin-top: 4px;
}

/* ── Cards ── */

.nventory-card {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	margin: 16px 0;
	overflow: hidden;
}

.nventory-card--muted {
	background: #fafafa;
}

.nventory-card__head {
	padding: 14px 20px;
	border-bottom: 1px solid #e5e7eb;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.nventory-card__head-left {
	display: flex;
	align-items: center;
	gap: 8px;
}

.nventory-card__head-icon {
	width: 20px;
	height: 20px;
	flex-shrink: 0;
}

.nventory-card__head-icon svg {
	width: 20px;
	height: 20px;
	stroke: #6b7280;
	fill: none;
}

.nventory-card__title {
	font-size: 13px;
	font-weight: 600;
	color: #374151;
	margin: 0;
}

.nventory-card__count {
	font-size: 11px;
	font-weight: 600;
	color: #9ca3af;
	background: #f3f4f6;
	padding: 2px 8px;
	border-radius: 10px;
}

.nventory-card__body {
	padding: 20px;
}

.nventory-card__body--flush {
	padding: 0;
}

/* ── Channels List ── */

.nventory-channels {
	display: flex;
	flex-direction: column;
}

.nventory-channel {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 20px;
	border-bottom: 1px solid #f3f4f6;
	transition: background 0.1s;
}

.nventory-channel:last-child {
	border-bottom: none;
}

.nventory-channel:hover {
	background: #fafafa;
}

.nventory-channel__info {
	display: flex;
	align-items: center;
	gap: 12px;
}

.nventory-channel__icon {
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 8px;
	flex-shrink: 0;
}

.nventory-channel__icon svg {
	width: 20px;
	height: 20px;
}

.nventory-channel__icon--woocommerce { background: #f3e8ff; }
.nventory-channel__icon--woocommerce svg { fill: #7c3aed; }

.nventory-channel__icon--shopify { background: #dcfce7; }
.nventory-channel__icon--shopify svg { fill: #16a34a; }

.nventory-channel__icon--amazon { background: #ffedd5; }
.nventory-channel__icon--amazon svg { fill: #ea580c; }

.nventory-channel__icon--ebay { background: #dbeafe; }
.nventory-channel__icon--ebay svg { fill: #2563eb; }

.nventory-channel__icon--bigcommerce { background: #f0f9ff; }
.nventory-channel__icon--bigcommerce svg { fill: #0284c7; }

.nventory-channel__icon--square { background: #f3f4f6; }
.nventory-channel__icon--square svg { fill: #374151; }

.nventory-channel__icon--default { background: #f3f4f6; }
.nventory-channel__icon--default svg { fill: #6b7280; }

.nventory-channel__name {
	font-size: 13px;
	font-weight: 600;
	color: #111827;
}

.nventory-channel__url {
	font-size: 12px;
	color: #9ca3af;
	margin-top: 2px;
	max-width: 300px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.nventory-channel__meta {
	display: flex;
	align-items: center;
	gap: 10px;
}

.nventory-channel__date {
	font-size: 11px;
	color: #9ca3af;
}

/* ── Subscription Banner ── */

.nventory-banner {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 16px 20px;
	border-radius: 8px;
	margin: 16px 0;
}

.nventory-banner--upgrade {
	background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
	border: 1px solid #bfdbfe;
}

.nventory-banner--warning {
	background: #fffbeb;
	border: 1px solid #fde68a;
}

.nventory-banner__icon {
	width: 40px;
	height: 40px;
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.nventory-banner--upgrade .nventory-banner__icon {
	background: #dbeafe;
}

.nventory-banner--upgrade .nventory-banner__icon svg {
	width: 20px;
	height: 20px;
	stroke: #2563eb;
	fill: none;
}

.nventory-banner--warning .nventory-banner__icon {
	background: #fef3c7;
}

.nventory-banner--warning .nventory-banner__icon svg {
	width: 20px;
	height: 20px;
	stroke: #d97706;
	fill: none;
}

.nventory-banner__content {
	flex: 1;
	min-width: 0;
}

.nventory-banner__content strong {
	display: block;
	font-size: 14px;
	color: #111827;
	margin-bottom: 2px;
}

.nventory-banner__content p {
	margin: 0;
	font-size: 13px;
	color: #6b7280;
	line-height: 1.5;
}

.nventory-banner__highlight {
	font-weight: 700;
	color: #2563eb;
}

.nventory-banner__action {
	flex-shrink: 0;
	white-space: nowrap;
}

/* ── Seller Hub ── */

.nventory-seller-hub {
	text-align: center;
	padding: 48px 32px;
	margin: 16px 0;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
}

.nventory-seller-hub__icon {
	width: 56px;
	height: 56px;
	background: #f3f4f6;
	border-radius: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 auto 16px;
}

.nventory-seller-hub__icon svg {
	width: 28px;
	height: 28px;
	stroke: #6b7280;
	fill: none;
}

.nventory-seller-hub h2 {
	font-size: 20px;
	font-weight: 700;
	color: #111827;
	margin: 0 0 8px;
	letter-spacing: -0.3px;
}

.nventory-seller-hub p {
	font-size: 14px;
	color: #6b7280;
	line-height: 1.6;
	margin: 0 0 24px;
	max-width: 440px;
	margin-left: auto;
	margin-right: auto;
}

.nventory-seller-hub__btn {
	display: inline-flex !important;
	align-items: center;
	gap: 8px;
	background: #111827 !important;
	border-color: #111827 !important;
	color: #fff !important;
	border-radius: 8px !important;
	font-weight: 600 !important;
	padding: 12px 28px !important;
	font-size: 15px !important;
	transition: background 0.15s !important;
	cursor: pointer;
}

.nventory-seller-hub__btn:hover {
	background: #1f2937 !important;
	border-color: #1f2937 !important;
}

.nventory-seller-hub__btn svg {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}

/* ── Sync Configuration (Editable) ── */

.nventory-sync-item {
	border-bottom: 1px solid #f3f4f6;
	padding: 0;
}

.nventory-sync-item:last-child {
	border-bottom: none;
}

.nventory-sync-item__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 0;
	gap: 12px;
}

.nventory-sync-item__left {
	display: flex;
	align-items: center;
	gap: 10px;
}

.nventory-sync-item__entity {
	font-size: 13px;
	font-weight: 600;
	color: #111827;
}

.nventory-sync-item__right {
	display: flex;
	align-items: center;
	gap: 8px;
}

.nventory-sync-direction {
	font-size: 12px;
	padding: 4px 8px;
	border: 1px solid #d1d5db;
	border-radius: 5px;
	background: #fff;
	color: #374151;
	cursor: pointer;
	outline: none;
}

.nventory-sync-direction:focus {
	border-color: #111827;
	box-shadow: 0 0 0 1px #111827;
}

/* Toggle Switch */

.nventory-toggle {
	position: relative;
	display: inline-block;
	width: 36px;
	height: 20px;
	flex-shrink: 0;
}

.nventory-toggle input {
	opacity: 0;
	width: 0;
	height: 0;
	position: absolute;
}

.nventory-toggle__slider {
	position: absolute;
	cursor: pointer;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: #d1d5db;
	border-radius: 20px;
	transition: background-color 0.2s;
}

.nventory-toggle__slider::before {
	position: absolute;
	content: '';
	height: 14px;
	width: 14px;
	left: 3px;
	bottom: 3px;
	background-color: #fff;
	border-radius: 50%;
	transition: transform 0.2s;
}

.nventory-toggle input:checked + .nventory-toggle__slider {
	background-color: #10b981;
}

.nventory-toggle input:checked + .nventory-toggle__slider::before {
	transform: translateX(16px);
}

/* Sync Fields Grid */

.nventory-sync-item__fields {
	padding: 0 0 14px 46px;
}

.nventory-sync-fields-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 16px;
}

.nventory-sync-field-label {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 12px;
	color: #6b7280;
	cursor: pointer;
	padding: 2px 0;
}

.nventory-sync-field-label input[type="checkbox"] {
	margin: 0;
}

.nventory-sync-field-label span {
	line-height: 1;
}

/* Sync Save Status */

.nventory-sync-save-status {
	font-size: 11px;
	font-weight: 600;
	color: #9ca3af;
	transition: color 0.15s;
}

.nventory-sync-save-status--ok {
	color: #10b981;
}

.nventory-sync-save-status--error {
	color: #ef4444;
}

/* ── Connection Details ── */

.nventory-details {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 16px;
	margin-bottom: 16px;
}

.nventory-detail__label {
	display: block;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: #9ca3af;
	margin-bottom: 4px;
}

.nventory-detail__value {
	font-size: 13px;
	color: #374151;
	word-break: break-all;
}

code.nventory-detail__value {
	background: #f3f4f6;
	padding: 3px 8px;
	border-radius: 4px;
	font-size: 11px;
	font-family: "SF Mono", SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

/* ── Actions ── */

.nventory-actions {
	display: flex;
	gap: 8px;
	margin-top: 16px;
	flex-wrap: wrap;
}

.nventory-btn--danger {
	color: #dc2626 !important;
	border-color: #fca5a5 !important;
}

.nventory-btn--danger:hover {
	background: #dc2626 !important;
	color: #fff !important;
	border-color: #dc2626 !important;
}

/* ── Test Result ── */

.nventory-test-result {
	margin-top: 12px;
	padding: 10px 14px;
	border-radius: 6px;
	font-size: 13px;
	display: flex;
	align-items: center;
	gap: 8px;
}

.nventory-test-result--success {
	background: #ecfdf5;
	color: #047857;
	border: 1px solid #a7f3d0;
}

.nventory-test-result--error {
	background: #fef2f2;
	color: #dc2626;
	border: 1px solid #fecaca;
}

/* ── Loading ── */

.nventory-loading {
	text-align: center;
	padding: 40px 0;
	color: #9ca3af;
	font-size: 13px;
}

.nventory-loading .spinner {
	float: none;
	margin-right: 8px;
	vertical-align: middle;
}

.nventory-empty-text {
	color: #9ca3af;
	font-size: 13px;
	text-align: center;
	padding: 24px 0;
}

/* ── Skeleton Loading ── */

.nventory-skeleton {
	background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
	background-size: 200% 100%;
	animation: nventorySkeleton 1.5s ease-in-out infinite;
	border-radius: 4px;
}

@keyframes nventorySkeleton {
	0% { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

/* ── Setup / Not Connected ── */

.nventory-setup {
	text-align: center;
	max-width: 640px;
	margin: 40px auto;
}

.nventory-setup__logo {
	width: 56px;
	height: 56px;
	background: #111827;
	border-radius: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 auto 20px;
}

.nventory-setup__logo svg {
	width: 28px;
	height: 28px;
	fill: #fff;
}

.nventory-setup__header h1 {
	font-size: 26px;
	font-weight: 700;
	color: #111827;
	margin-bottom: 8px;
	letter-spacing: -0.3px;
}

.nventory-setup__description {
	color: #6b7280;
	font-size: 14px;
	line-height: 1.6;
	margin-bottom: 24px;
}

.nventory-setup-features {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
	margin: 24px 0;
	text-align: left;
}

.nventory-feature {
	padding: 20px;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	background: #fff;
	transition: border-color 0.15s;
}

.nventory-feature:hover {
	border-color: #d1d5db;
}

.nventory-feature__icon {
	width: 40px;
	height: 40px;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 12px;
}

.nventory-feature__icon--supplier {
	background: #f3e8ff;
}

.nventory-feature__icon--supplier svg {
	width: 20px;
	height: 20px;
	stroke: #7c3aed;
	fill: none;
}

.nventory-feature__icon--seller {
	background: #dbeafe;
}

.nventory-feature__icon--seller svg {
	width: 20px;
	height: 20px;
	stroke: #2563eb;
	fill: none;
}

.nventory-feature strong {
	display: block;
	margin-bottom: 6px;
	font-size: 14px;
	color: #111827;
}

.nventory-feature p {
	margin: 0;
	color: #6b7280;
	font-size: 13px;
	line-height: 1.5;
}

.nventory-setup__cta {
	margin-top: 8px;
}

.nventory-setup__cta .button-hero {
	background: #111827 !important;
	border-color: #111827 !important;
	color: #fff !important;
	border-radius: 8px;
	font-weight: 600;
	padding: 12px 32px !important;
	font-size: 15px !important;
	transition: background 0.15s !important;
}

.nventory-setup__cta .button-hero:hover {
	background: #1f2937 !important;
	border-color: #1f2937 !important;
}

/* ── Subtitle ── */

.nventory-subtitle {
	color: #646970;
	font-size: 13px;
	margin: 0 0 16px;
}

/* ── Badges (product table) ── */

.nventory-badge {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 10px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.3px;
}

.nventory-badge--published {
	background: #ecfdf5;
	color: #047857;
}

.nventory-badge--unpublished {
	background: #f3f4f6;
	color: #6b7280;
}

/* ── Toolbar ── */

.nventory-toolbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin: 16px 0;
	gap: 12px;
	flex-wrap: wrap;
}

.nventory-search-input {
	min-width: 280px;
	padding: 6px 12px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
}

.nventory-search-input:focus {
	outline: none;
	border-color: #111827;
	box-shadow: 0 0 0 1px #111827;
}

.nventory-bulk-actions {
	display: flex;
	gap: 6px;
}

/* ── Product Table ── */

#nventory-products-table .column-cb {
	width: 30px;
}

#nventory-products-table img.nventory-thumb {
	width: 36px;
	height: 36px;
	object-fit: cover;
	border-radius: 6px;
	border: 1px solid #e5e7eb;
}

#nventory-products-table .nventory-no-image {
	width: 36px;
	height: 36px;
	background: #f3f4f6;
	border-radius: 6px;
	display: inline-block;
}

/* ── Pagination ── */

.nventory-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	margin: 16px 0;
}

#nventory-page-info {
	font-size: 13px;
	color: #6b7280;
}

/* ── Empty State ── */

.nventory-empty {
	text-align: center;
	padding: 48px 0;
	color: #6b7280;
}

/* ── Sync Fields ── */

.nventory-sync-fields {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 16px;
	margin-top: 8px;
}

.nventory-sync-field-item {
	display: flex;
	align-items: center;
	gap: 4px;
}

.nventory-sync-field-item label {
	cursor: pointer;
	font-size: 13px;
}

/* ── Dashboard Loading Skeleton ── */

.nventory-dashboard-loading {
	text-align: center;
	padding: 32px 0;
	color: #6b7280;
	font-size: 13px;
}

.nventory-dashboard-loading .spinner {
	float: none;
	margin-right: 8px;
	vertical-align: middle;
}

/* ── Responsive ── */

@media screen and (max-width: 960px) {
	.nventory-stats {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media screen and (max-width: 782px) {
	.nventory-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 14px;
	}

	.nventory-setup-features {
		grid-template-columns: 1fr;
	}

	.nventory-toolbar {
		flex-direction: column;
		align-items: stretch;
	}

	.nventory-search-input {
		min-width: unset;
		width: 100%;
	}

	.nventory-channel__url {
		max-width: 200px;
	}
}

@media screen and (max-width: 480px) {
	.nventory-stats {
		grid-template-columns: 1fr;
	}

	.nventory-header__pills {
		flex-wrap: wrap;
	}
}
