/* ==========================================================================
   Archive wrapper — used by the plugin-owned archive and taxonomy templates.
   ========================================================================== */
html {
	scroll-behavior: smooth;
}

.al-collections-archive {
	padding: 0 var(--gutter-width);
}

.al-collections-archive-inner {
	max-width: var(--max-width-wide);
	margin: 0 auto;
}

/* ==========================================================================
   Archive page layout overrides
   ========================================================================== */
#main {
	padding: 0 var(--gutter_width);
}

.entry-header,
.entry-content,
.entry-footer {
	max-width: var(--max-width-wide);
	padding: 0;
}

.entry-header-wrapper,
.entry-content-wrapper,
.entry-footer-wrapper {
	max-width: none;
}

.year-select-wrapper {
	display: flex;
	align-items: center;
	gap: .5rem;
	margin-bottom: 2rem;
}

.year-select-wrapper label {
	font-weight: 600;
	white-space: nowrap;
}

.year-select {
	min-width: 100px;
}

.collections-container.loading {
	opacity: 0.5;
	pointer-events: none;
}

.collections-container h2 small,
.collections-container h3 small {
	color: var(--gray-xdark);
}

.collections-container h2 {
	font-size: var(--font-size-h1);
}

.collection {
	margin-top: 1.5rem;
}

.collection h3 {
	font-size: var(--font-size-h2);
	margin: 0 0 1rem 0;
}

.collection-grid {
	display: grid;
	gap: 1rem;
	grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.collection-product {
	border: 1px solid var(--border-color);
	border-radius: var(--border-radius);
	padding: 1rem;
}

.collection-product-inner {
	display: flex;
	flex-direction: column;
	gap: .25rem;
	position: relative;
	height: 100%;
}

.collection-product img {
	order: 1;
	border: 0;
	margin-bottom: .5rem;
}

.collection-product :is(h4, p) {
	margin: 0;
	order: 2;
}

.collection-product h4 {
	font-size: var(--font-size-medium);
}

.collection-product h4 .sku {
	font-size: var(--font-size-small);
	color: var(--gray-xdark);
}

.collection-product .update {
	float: none;
	align-self: flex-start;
	order: 2;
	margin-top: .35rem;
	background: transparent;
	border: 0;
	color: var(--button-background-color);
	cursor: pointer;
	padding: 0;
	text-decoration: underline;
}

.collection-product .note {
	line-height: 1.2;
	margin-top: .25rem;
}

.collection-product .note-label {
	color: var(--gray-dark);
}

.collection-product p {
	line-height: 1.5;
}

#collection-edit-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 9999;
}

#collection-edit-modal .modal-content {
	background: #fff;
	padding: 2rem;
	border-radius: var(--border-radius);
	width: 100%;
	max-width: 400px;
	position: relative;
}

.modal-content h3 {
	margin-top: 0;
	font-family: inherit;
}

.modal-content .form-group {
	line-height: 1;
	margin-bottom: .75rem;
}

.modal-content .form-group label {
	line-height: 1.6;
}

.modal-content textarea {
	width: 100%;
	resize: none;
}

.modal-loading {
	display: none;
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(255, 255, 255, 0.8);
	cursor: wait;
}

#collection-edit-modal.loading .modal-loading {
	display: block;
}

/* ==========================================================================
   View Toggle
   ========================================================================== */
.view-toggle {
	display: flex;
	gap: .5rem;
	margin-bottom: 1rem;
}

.view-toggle button.active {
	background: var(--button-background-color, #c81e11);
	color: #fff;
	border-color: var(--button-background-color, #c81e11);
}

/* ==========================================================================
   Table Container + Loading State
   ========================================================================== */
.collections-table-container {
	margin-top: 1rem;
}

.collections-table-container.loading {
	opacity: .5;
	pointer-events: none;
}

/* ==========================================================================
   Filter Bar
   ========================================================================== */
.collections-filter-bar {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	align-items: center;
	gap: .5rem .75rem;
	background: #f8f8f8;
	border: 1px solid #e0e0e0;
	border-radius: 4px;
	padding: .6rem .75rem;
	margin-bottom: 1rem;
}

.collections-filter-bar .filter-select {
	display: inline-block;
	width: auto;
	min-width: 150px;
	max-width: 240px;
	flex: 0 0 auto;
	padding: .35rem .5rem;
	font-size: .875rem;
	border: 1px solid #ccc;
	border-radius: 3px;
	background: #fff;
	height: auto;
	line-height: 1.4;
	box-sizing: border-box;
}

.collections-filter-bar .filter-search {
	display: inline-block;
	width: auto;
	min-width: 180px;
	flex: 1 1 180px;
	padding: .35rem .5rem;
	font-size: .875rem;
	border: 1px solid #ccc;
	border-radius: 3px;
	background: #fff;
	height: auto;
	line-height: 1.4;
	box-sizing: border-box;
}

.filter-count {
	color: var(--gray-xdark);
	font-size: var(--font-size-small);
	white-space: nowrap;
	margin-left: auto;
	flex-shrink: 0;
}

/* ==========================================================================
   Bulk Bar
   ========================================================================== */
.collections-bulk-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .75rem;
	background: var(--gray-xlight, #f5f5f5);
	border: 1px solid var(--border-color);
	border-radius: var(--border-radius);
	padding: .5rem .75rem;
	margin-bottom: .5rem;
}

.collections-bulk-bar .selected-count {
	font-weight: 600;
}

.collections-bulk-bar .bulk-qty {
	width: 70px;
}

/* ==========================================================================
   Table Actions (Save All)
   ========================================================================== */
.collections-table-actions {
	display: flex;
	align-items: center;
	gap: .75rem;
	margin-bottom: .5rem;
}

.save-status {
	color: var(--button-background-color);
	font-size: var(--font-size-small);
}

/* ==========================================================================
   Collections Table
   ========================================================================== */
.collections-table-wrapper {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.collections-table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--font-size-small, .875rem);
}

.collections-table thead th {
	position: sticky;
	top: 0;
	background: #fff;
	border-bottom: 2px solid var(--border-color);
	padding: .5rem .6rem;
	text-align: left;
	white-space: nowrap;
	z-index: 1;
}

.collections-table tbody tr {
	border-bottom: 1px solid var(--border-color);
}

.collections-table tbody tr:nth-child(even) {
	background: var(--gray-xlight, #f9f9f9);
}

.collections-table tbody tr.dirty {
	border-left: 3px solid var(--button-background-color);
}

.collections-table td {
	padding: .4rem .6rem;
	vertical-align: middle;
}

/* Column widths */
.collections-table .check-col { width: 30px; }

.collections-table .img-col   { width: 60px; }

.collections-table .sku-col   { white-space: nowrap; }

.collections-table .price-col { white-space: nowrap; }

.collections-table .avail-col { white-space: nowrap; }

.collections-table .qty-col   { width: 90px; }

.collections-table .note-col  { min-width: 160px; }

/* Quantity input */
.collections-table .qty-input {
	width: 70px;
	padding: .25rem .35rem;
	font-size: inherit;
}

/* Note cell */
.collections-table .note-text {
	display: inline-block;
	max-width: 200px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	vertical-align: middle;
	color: var(--gray-dark);
}

.collections-table .edit-note {
	font-size: var(--font-size-small);
	margin-left: .25rem;
	vertical-align: middle;
	padding: 2px 6px;
}

/* Thumbnail */
.collections-table .img-col img {
	display: block;
	width: 50px;
	height: 50px;
	object-fit: contain;
	border: 0;
}

/* ==========================================================================
   Pagination
   ========================================================================== */
.collections-pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .5rem;
	margin-top: .75rem;
}

.page-indicator {
	font-size: var(--font-size-small);
	color: var(--gray-xdark);
}

/* ==========================================================================
   Tracker Content Polish (Grid + Table)
   ========================================================================== */

.view-toggle {
	margin-bottom: 1.25rem;
}

.view-toggle .button {
	border-radius: 999px;
	padding: .45rem .9rem;
	font-weight: 600;
	transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.view-toggle .button:not(.active) {
	background: #fff;
	border-color: var(--border-color);
	color: var(--gray-dark);
}

.view-toggle .view-grid-toggle:not(.active) {
	opacity: .7;
	font-weight: 500;
	padding-inline: .75rem;
}

.collection {
	padding: 1rem 1.1rem 1.25rem;
	margin-top: 1.75rem;
	background: #fff;
	border: 1px solid var(--border-color);
	border-radius: calc(var(--border-radius) + 2px);
	box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
}

.collection h3 {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: .75rem;
	padding-bottom: .65rem;
	margin-bottom: 1rem;
	border-bottom: 1px solid var(--border-color);
}

.collection-grid {
	gap: 1.15rem;
	grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.collection-product {
	padding: .9rem;
	background: linear-gradient(180deg, #ffffff 0%, #fcfcfc 100%);
	transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}

.collection-product:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 18px rgba(0, 0, 0, .08);
	border-color: #d8d8d8;
}

.collection-product[data-owned="1"] {
	border-color: var(--button-background-color);
	border-left-width: 3px;
}

.collection-product h4 {
	line-height: 1.35;
	margin-bottom: .2rem;
}

.collection-product .update {
	float: none;
	align-self: flex-start;
	margin-top: .35rem;
	padding: .28rem .65rem;
	border-radius: 999px;
	text-decoration: none;
	border: 1px solid var(--button-background-color, #7b1723);
	background: var(--button-background-color, #7b1723);
	color: #fff;
}

.collection-product .update.button {
	border-color: var(--button-background-color, #7b1723);
	background: var(--button-background-color, #7b1723);
	color: #fff;
}

.collections-table-actions,
.collections-filter-bar,
.collections-bulk-bar {
	background: #fff;
	border-color: var(--border-color);
	border-radius: calc(var(--border-radius) + 1px);
	box-shadow: 0 1px 4px rgba(0, 0, 0, .04);
}

.collections-table-wrapper {
	border: 1px solid var(--border-color);
	border-radius: calc(var(--border-radius) + 2px);
	background: #fff;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .04);
}

.collections-table {
	border-collapse: separate;
	border-spacing: 0;
}

.collections-table thead th {
	background: #f6f7f8;
	font-size: .78rem;
	letter-spacing: .02em;
	text-transform: uppercase;
	color: var(--gray-dark);
	padding-top: .6rem;
	padding-bottom: .6rem;
}

.collections-table td {
	padding-top: .55rem;
	padding-bottom: .55rem;
	border-bottom: 1px solid #efefef;
}

.collections-table tbody tr:nth-child(even) {
	background: #fafafa;
}

.collections-table tbody tr:hover {
	background: #f3f7fa;
}

.collections-table .qty-input {
	border: 1px solid #cfcfcf;
	border-radius: 6px;
	padding: .3rem .42rem;
	min-height: 2rem;
}

.collections-table .qty-input:focus,
.collections-filter-bar :is(.filter-select, .filter-search):focus {
	outline: none;
	border-color: var(--button-background-color);
	box-shadow: 0 0 0 3px rgba(33, 115, 170, .18);
}

.collections-table .edit-note {
	border-radius: 999px;
	padding: .22rem .6rem;
	line-height: 1.3;
}

.collections-pagination {
	margin-top: 1rem;
	padding: .75rem;
	border: 1px solid var(--border-color);
	border-radius: calc(var(--border-radius) + 1px);
	background: #fff;
}

@media (max-width: 900px) {
	
	.collection {
		padding: .85rem .8rem 1rem;
	}

	.collections-filter-bar {
		gap: .5rem;
	}

	.collections-filter-bar .filter-select,
	.collections-filter-bar .filter-search {
		min-width: 100%;
		max-width: 100%;
		flex-basis: 100%;
	}

	.filter-count {
		margin-left: 0;
		width: 100%;
	}

	.collections-pagination {
		justify-content: flex-start;
	}
}

