/**
 * CNA Collection Manager — tool-specific styles.
 * Loaded after cna-core(.css|-fallback.css), which supplies the CSS custom
 * properties (--cna-primary etc.) and shared component classes (.cna-btn,
 * .cna-field, .cna-tag, .cna-swatch, .cna-stats, .cna-empty, .cna-error…)
 * this file builds on rather than re-declares.
 */

.cna-cm-hexrow {
	display: flex;
	gap: 8px;
	align-items: center;
}

.cna-cm-hexrow input[type='text'] {
	flex: 1;
}

.cna-cm-hexrow input[type='color'] {
	width: 44px;
	height: 40px;
	padding: 2px;
	border: 1px solid var(--cna-line);
	border-radius: 8px;
	background: none;
	cursor: pointer;
}

.cna-cm-form-errors:empty {
	display: none;
}

.cna-cm-form-errors ul {
	margin: 0 0 12px;
	padding: 10px 14px;
	background: rgba(200, 40, 40, 0.08);
	border: 1px solid rgba(200, 40, 40, 0.25);
	border-radius: var(--cna-radius);
	color: #9c1f1f;
	list-style: none;
}

.cna-cm-quickadd {
	position: relative;
}

.cna-cm-qa-results {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin-top: 6px;
	max-height: 260px;
	overflow-y: auto;
}

.cna-cm-qa-row {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 8px 10px;
	background: #fff;
	border: 1px solid var(--cna-line);
	border-radius: 10px;
	cursor: pointer;
	text-align: left;
	font: inherit;
	color: inherit;
}

.cna-cm-qa-row:hover,
.cna-cm-qa-row:focus-visible {
	border-color: var(--cna-primary);
}

.cna-cm-approx-notice {
	margin-top: 6px;
}

/* ---------- Duplicate-detector modal ---------- */

.cna-cm-dup-modal {
	margin: 16px 0;
}

.cna-cm-dup-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 10px 0;
}

.cna-cm-dup-row {
	display: flex;
	align-items: center;
	gap: 10px;
	background: #fff;
	border: 1px solid var(--cna-line);
	border-radius: 10px;
	padding: 8px 10px;
}

.cna-cm-dup-info {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

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

.cna-cm-filters {
	margin-bottom: 18px;
}

/* ---------- Grid ---------- */

.cna-cm-grid {
	list-style: none;
	margin: 0 0 12px;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 14px;
}

.cna-cm-card {
	display: flex;
	gap: 12px;
	background: #fff;
	border: 1px solid var(--cna-line);
	border-radius: var(--cna-radius);
	padding: 12px;
	box-shadow: var(--cna-shadow);
}

.cna-cm-card > .cna-swatch {
	flex: 0 0 auto;
}

.cna-cm-card__body {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.cna-cm-card__shade {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.cna-cm-card__brand {
	color: var(--cna-muted);
	font-size: 0.85rem;
}

.cna-cm-card__tags {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-top: 2px;
}

.cna-cm-card__meta {
	display: flex;
	gap: 10px;
	font-size: 0.82rem;
	color: var(--cna-muted);
}

.cna-cm-card__actions {
	flex-direction: column;
	margin-left: auto;
}

.cna-cm-card__confirm {
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, 0.97);
	border-radius: var(--cna-radius);
	padding: 12px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 8px;
}

.cna-cm-card {
	position: relative;
}

.cna-cm-status--owned {
	background: rgba(74, 158, 90, 0.15);
	color: #2c6b3a;
}

.cna-cm-status--wishlist {
	background: rgba(123, 79, 168, 0.15);
	color: #5a3a80;
}

.cna-cm-status--used_up {
	background: rgba(150, 150, 150, 0.18);
	color: #5a5a5a;
}

/* ---------- Stats / gaps ---------- */

.cna-cm-breakdown {
	margin-bottom: 14px;
}

.cna-cm-breakdown h4 {
	margin: 0 0 6px;
	font-size: 0.95rem;
}

.cna-cm-gaps {
	list-style: disc;
	margin: 0;
	padding-left: 20px;
}

/* ---------- Import / export ---------- */

.cna-cm-import-export .cna-actions {
	align-items: center;
}

.cna-cm-export-reminder {
	margin-top: 8px;
}

.cna-cm-privacy-note {
	background: rgba(123, 79, 168, 0.06);
	border: 1px solid rgba(123, 79, 168, 0.2);
	border-radius: var(--cna-radius);
	padding: 10px 14px;
}

/* ---------- Print — the collection itself, not the controls ---------- */

@media print {
	.cna-cm .cna-toolbar,
	.cna-cm-add-form,
	.cna-cm-quickadd,
	.cna-cm-filters,
	.cna-cm-import-export,
	.cna-cm-card__actions,
	.cna-cm-card__confirm,
	.cna-suggestions,
	.cna-capture,
	.cna-cm-export-reminder {
		display: none !important;
	}

	.cna-cm-grid {
		grid-template-columns: repeat(3, 1fr);
	}

	.cna-cm-card {
		box-shadow: none;
		break-inside: avoid;
	}
}
