/**
 * Catalogue Search Interface Styles
 *
 * Styles for the archive catalogue page with filters, search, and results
 * Redesigned to match WordPress admin dashboard aesthetic
 *
 * @package NEC_Archives
 * @since 1.0.0
 */

/* ========================================
   CATALOGUE CONTAINER
   ======================================== */

.catalogue-container {
	display: grid;
	grid-template-columns: 300px 1fr;
	gap: 2rem;
	max-width: 1400px;
	margin: 2rem auto;
	padding: 0 2rem;
}

@media (max-width: 992px) {
	.catalogue-container {
		grid-template-columns: 1fr;
		gap: 1.5rem;
	}
}

/* ========================================
   SIDEBAR & FILTERS
   ======================================== */

.catalogue-sidebar {
	position: sticky;
	top: 120px;
	align-self: start;
}

.catalogue-filters {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 8px;
	padding: 1.5rem;
	box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.filter-section {
	margin-bottom: 1.5rem;
	padding-bottom: 1.5rem;
	border-bottom: 1px solid #e9ecef;
}

.filter-section:last-child {
	margin-bottom: 0;
	padding-bottom: 0;
	border-bottom: none;
}

.filter-section h3 {
	font-size: 14px;
	font-weight: 600;
	margin: 0 0 1rem;
	color: #2c3e50;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.filter-group {
	margin-bottom: 1rem;
}

.filter-group:last-child {
	margin-bottom: 0;
}

.filter-group label {
	display: block;
	font-size: 13px;
	font-weight: 500;
	margin-bottom: 0.5rem;
	color: #2c3e50;
}

/* Increase specificity to override style.css */
body .site-main.catalogue-content .catalogue-sidebar .catalogue-filters .search-input,
body .site-main.catalogue-content .catalogue-sidebar .catalogue-filters .filter-select,
body .site-main.catalogue-content .catalogue-sidebar .catalogue-filters .filter-input,
body .site-main.catalogue-content .catalogue-sidebar .catalogue-filters .year-input,
body .site-main.catalogue-content .catalogue-sidebar .catalogue-filters input[type="text"],
body .site-main.catalogue-content .catalogue-sidebar .catalogue-filters input[type="number"],
body .site-main.catalogue-content .catalogue-sidebar .catalogue-filters input[type="search"],
body .site-main.catalogue-content .catalogue-sidebar .catalogue-filters select {
	width: 100%;
	padding: 0.75rem 1rem;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 14px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	transition: all 0.2s;
	background: #fff;
	line-height: 1.5;
	color: #2c3e50;
	box-sizing: border-box;
}

body .site-main.catalogue-content .catalogue-sidebar .catalogue-filters .search-input:focus,
body .site-main.catalogue-content .catalogue-sidebar .catalogue-filters .filter-select:focus,
body .site-main.catalogue-content .catalogue-sidebar .catalogue-filters .filter-input:focus,
body .site-main.catalogue-content .catalogue-sidebar .catalogue-filters .year-input:focus,
body .site-main.catalogue-content .catalogue-sidebar .catalogue-filters input[type="text"]:focus,
body .site-main.catalogue-content .catalogue-sidebar .catalogue-filters input[type="number"]:focus,
body .site-main.catalogue-content .catalogue-sidebar .catalogue-filters input[type="search"]:focus,
body .site-main.catalogue-content .catalogue-sidebar .catalogue-filters select:focus {
	outline: none;
	border-color: #334196;
	box-shadow: 0 0 0 3px rgba(51, 65, 150, 0.1);
	background: #fff;
	color: #111;
}

.filter-select[multiple] {
	min-height: 120px;
}

/* Year range inputs */
.year-inputs {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.year-input {
	flex: 1;
}

.year-separator {
	font-weight: 500;
	color: #6c757d;
}

.year-hint {
	display: block;
	margin-top: 0.5rem;
	font-size: 12px;
	color: #666;
}

/* Checkbox Groups */
.checkbox-group {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 12px;
	background: #f9f9f9;
	border: 1px solid #e0e0e0;
	border-radius: 4px;
	max-height: 250px;
	overflow-y: auto;
}

.checkbox-label {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 10px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 14px;
	color: #2c3e50;
	transition: background 0.2s;
	user-select: none;
}

.checkbox-label:hover {
	background: #f5f5f5;
}

.filter-checkbox {
	width: 18px;
	height: 18px;
	cursor: pointer;
	accent-color: #334196;
	margin: 0;
	flex-shrink: 0;
}

/* ========================================
   MAIN CONTENT AREA
   ======================================== */

.catalogue-main {
	min-width: 0; /* Prevents grid blowout */
}

/* Management Container Wrapper */
.management-container {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 8px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.08);
	padding: 2rem;
}

/* Results Header */
.results-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 1.5rem;
	padding-bottom: 1rem;
	border-bottom: 1px solid #e9ecef;
}

.results-header h2 {
	font-size: 1.5rem;
	font-weight: 600;
	margin: 0;
	color: #2c3e50;
}

.results-controls {
	display: flex;
	align-items: center;
	gap: 1rem;
}

.results-sort {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.results-sort label {
	font-size: 13px;
	font-weight: 500;
	color: #2c3e50;
	white-space: nowrap;
}

.sort-select {
	padding: 0.5rem 2rem 0.5rem 0.75rem;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 13px;
	background-color: white;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 8px center;
	background-size: 12px;
	appearance: none;
	cursor: pointer;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	transition: border-color 0.3s;
}

.sort-select:focus {
	outline: none;
	border-color: #334196;
	box-shadow: 0 0 0 3px rgba(51, 65, 150, 0.1);
}

/* Add New Item Button */
.add-new-item-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 24px;
	background: #334196;
	color: white !important;
	border: 1px solid #334196;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 500;
	text-decoration: none !important;
	cursor: pointer;
	transition: all 0.2s;
	white-space: nowrap;
	line-height: 1.5;
}

.add-new-item-btn:hover {
	background: #2a3578;
	border-color: #2a3578;
	transform: translateY(-1px);
	box-shadow: 0 4px 8px rgba(51, 65, 150, 0.2);
}

.add-new-item-btn svg {
	flex-shrink: 0;
}

/* ========================================
   ACTIVE FILTERS
   ======================================== */

.active-filters {
	margin-bottom: 1.5rem;
	padding: 16px 20px;
	background: #f8f9fa;
	border: 1px solid #e0e0e0;
	border-radius: 4px;
	animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
	from {
		opacity: 0;
		transform: translateY(-10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.filter-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

.filter-tag {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 12px;
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	font-size: 13px;
	color: #2c3e50;
	font-weight: 500;
	transition: all 0.2s;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.filter-tag:hover {
	border-color: #334196;
	box-shadow: 0 2px 4px rgba(51, 65, 150, 0.1);
}

.filter-tag .remove {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	padding: 0;
	background: #999;
	color: white;
	border: none;
	border-radius: 50%;
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	transition: all 0.2s;
	font-weight: 700;
}

.filter-tag .remove:hover {
	background: #e74c3c;
	transform: scale(1.1);
}

.clear-filters {
	padding: 6px 16px;
	background: transparent;
	color: #e74c3c;
	border: 1px solid #e74c3c;
	border-radius: 4px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s;
}

.clear-filters:hover {
	background: #e74c3c;
	color: white;
	box-shadow: 0 2px 4px rgba(231, 76, 60, 0.2);
}

/* ========================================
   RESULTS TABLE
   ======================================== */

.catalogue-results {
	position: relative;
	min-height: 400px;
}

.catalogue-results.is-loading {
	opacity: 0.5;
	pointer-events: none;
}

.results-summary {
	margin-bottom: 1rem;
	padding: 12px 15px;
	background: #f8f9fa;
	border-left: 4px solid #334196;
	border-radius: 4px;
}

.results-summary p {
	margin: 0;
	font-size: 14px;
	font-weight: 500;
	color: #2c3e50;
}

.catalogue-table {
	width: 100%;
	border-collapse: collapse;
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

.catalogue-table thead {
	background: #f8f9fa;
	border-bottom: 2px solid #dee2e6;
}

.catalogue-table th {
	padding: 1rem;
	text-align: left;
	font-size: 13px;
	font-weight: 600;
	color: #2c3e50;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	line-height: 1.3em;
}

.catalogue-table tbody tr {
	border-bottom: 1px solid #e9ecef;
	transition: background-color 0.2s;
}

.catalogue-table tbody tr:last-child {
	border-bottom: none;
}

.catalogue-table tbody tr:hover {
	background-color: #f8f9fa;
}

.catalogue-table td {
	padding: 1rem;
	font-size: 13px;
	color: #3c434a;
	vertical-align: middle;
	line-height: 1.5em;
}

/* Column widths */
.col-identifier {
	width: 12%;
}

.col-title {
	width: 35%;
}

.col-year {
	width: 10%;
}

.col-type {
	width: 15%;
}

.col-languages {
	width: 15%;
}

.col-actions {
	width: 13%;
	text-align: right;
}

/* Title column */
.col-title a {
	font-weight: 500;
	color: #0073aa;
	text-decoration: none;
	transition: color 0.2s;
}

.col-title a:hover {
	color: #005177;
}

.item-description {
	margin: 5px 0 0;
	font-size: 13px;
	color: #646970;
	line-height: 1.5;
}

/* Status badge */
.status-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 6px 0 0 6px;
	padding: 6px 12px;
	font-size: 13px;
	font-weight: 500;
	border-radius: 16px;
	line-height: 1;
}

.status-badge.status-draft {
	background: #fff3cd;
	color: #856404;
}

/* Action buttons */
.action-buttons {	
	display: flex;
	gap: 0.5rem;
	align-items: center;
	margin: 10px auto;
}



.btn-view {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 8px 12px;
	text-decoration: none;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 500;
	transition: all 0.2s;
	border: 1px solid;
	cursor: pointer;
	white-space: nowrap;
	background: #fff;
	color: #334196;
	border-color: #334196;
}

.btn-view:hover {
	background: #334196;
	color: white;
	text-decoration: none;
	transform: translateY(-1px);
	box-shadow: 0 2px 4px rgba(51, 65, 150, 0.2);
}

/* Action Buttons */
.action-buttons {
	display: flex;
	gap: 0.5rem;
}

/* Icon buttons for Edit and Delete */
.btn-icon {
	background: #fff;
	border: 1px solid #ddd;
	padding: 10px;
	border-radius: 6px;
	cursor: pointer;
	display: block;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
	color: #666;
	position: relative;
}

.btn-icon::before {
	content: '';
	width: 16px;
	height: 16px;
	display: block;
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
}

/* Edit icon */
.btn-icon.btn-edit::before {
	background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjNjY2IiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PHBhdGggZD0iTTExIDRINGEyIDIgMCAwIDAtMiAydjE0YTIgMiAwIDAgMCAyIDJoMTRhMiAyIDAgMCAwIDItMnYtNyIvPjxwYXRoIGQ9Ik0xOC41IDIuNWEyLjEyMSAyLjEyMSAwIDAgMSAzIDNMMTIgMTVsLTQgMSAxLTQgOS41LTkuNXoiLz48L3N2Zz4=');
}

.btn-icon.btn-edit:hover::before {
	background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMzM0MTk2IiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PHBhdGggZD0iTTExIDRINGEyIDIgMCAwIDAtMiAydjE0YTIgMiAwIDAgMCAyIDJoMTRhMiAyIDAgMCAwIDItMnYtNyIvPjxwYXRoIGQ9Ik0xOC41IDIuNWEyLjEyMSAyLjEyMSAwIDAgMSAzIDNMMTIgMTVsLTQgMSAxLTQgOS41LTkuNXoiLz48L3N2Zz4=');
}

/* Delete icon */
.btn-icon.btn-delete::before {
	background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjNjY2IiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PHBvbHlsaW5lIHBvaW50cz0iMyA2IDUgNiAyMSA2Ii8+PHBhdGggZD0iTTE5IDZ2MTRhMiAyIDAgMCAxLTIgMkg3YTIgMiAwIDAgMS0yLTJWNm0zIDBWNGEyIDIgMCAwIDEgMi0yaDRhMiAyIDAgMCAxIDIgMnYyIi8+PC9zdmc+');
}

.btn-icon.btn-delete:hover::before {
	background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZTc0YzNjIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PHBvbHlsaW5lIHBvaW50cz0iMyA2IDUgNiAyMSA2Ii8+PHBhdGggZD0iTTE5IDZ2MTRhMiAyIDAgMCAxLTIgMkg3YTIgMiAwIDAgMS0yLTJWNm0zIDBWNGEyIDIgMCAwIDEgMi0yaDRhMiAyIDAgMCAxIDIgMnYyIi8+PC9zdmc+');
}
.btn-icon:hover {
	background: #f8f9fa;
	transform: translateY(-2px);
	box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-icon.btn-edit:hover {
	border-color: #334196;
}

.btn-icon.btn-delete:hover {
	border-color: #e74c3c;
}

.btn-icon.btn-delete:disabled {
	background: #f8f9fa;
	color: #999;
	border-color: #ddd;
	cursor: not-allowed;
	opacity: 0.6;
}

/* Empty states */
.no-results,
.error-message,
.loading-placeholder {
	padding: 60px 20px;
	text-align: center;
	color: #646970;
}

.no-results p,
.error-message p,
.loading-placeholder p {
	margin: 0;
	font-size: 14px;
}

.error-message {
	color: #e74c3c;
}

.loading-spinner {
	width: 40px;
	height: 40px;
	border: 4px solid #f3f3f3;
	border-top: 4px solid #334196;
	border-radius: 50%;
	animation: spin 1s linear infinite;
	margin: 0 auto 1rem;
}

@keyframes spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

/* ========================================
   PAGINATION
   ======================================== */

.catalogue-pagination {
	margin-top: 2rem;
}

.pagination-wrapper {
	display: flex;
	justify-content: center;
}

.pagination {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.page-link {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 12px;
	background: white;
	border: 1px solid #ddd;
	border-radius: 4px;
	color: #334196;
	text-decoration: none;
	font-size: 13px;
	font-weight: 500;
	transition: all 0.2s;
}

.page-link:hover {
	background: #334196;
	border-color: #334196;
	color: white;
	text-decoration: none;
	transform: translateY(-1px);
	box-shadow: 0 2px 4px rgba(51, 65, 150, 0.2);
}

.page-link.current {
	background: #334196;
	border-color: #334196;
	color: white;
	cursor: default;
	pointer-events: none;
}

.page-link.prev,
.page-link.next {
	padding: 0 16px;
}

.page-dots {
	display: flex;
	align-items: center;
	padding: 0 8px;
	color: #646970;
	font-size: 14px;
	user-select: none;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 992px) {
	.catalogue-container {
		padding: 0 1rem;
	}

	.catalogue-sidebar {
		position: static;
	}

	.results-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 1rem;
	}

	.results-controls {
		width: 100%;
		flex-wrap: wrap;
	}

	.results-sort {
		flex: 1;
		min-width: 200px;
	}

	.sort-select {
		flex: 1;
	}

	.add-new-item-btn {
		width: 100%;
	}
}

@media (max-width: 768px) {
	.catalogue-container {
		margin: 1rem auto;
		padding: 0 1rem;
	}

	.management-container {
		padding: 1rem;
	}

	.catalogue-filters {
		padding: 1rem;
	}

	.results-header h2 {
		font-size: 1.25rem;
	}

	.catalogue-table {
		display: block;
		overflow-x: auto;
		white-space: nowrap;
	}

	.col-identifier {
		width: 100px;
	}

	.col-title {
		width: 250px;
	}

	.col-year {
		width: 80px;
	}

	.col-type {
		width: 120px;
	}

	.col-languages {
		width: 120px;
	}

	.col-actions {
		width: 100px;
	}

	.item-description {
		white-space: normal;
		max-width: 240px;
	}

	.btn-view,
	.btn-edit,
	.btn-delete {
		padding: 6px 10px;
		font-size: 12px;
	}
}

@media (max-width: 576px) {
	.catalogue-container {
		padding: 0 0.75rem;
	}

	.filter-tags {
		gap: 0.5rem;
	}

	.filter-tag {
		font-size: 12px;
		padding: 5px 10px;
	}

	.clear-filters {
		padding: 5px 12px;
		font-size: 12px;
	}

	.pagination {
		gap: 0.25rem;
	}

	.page-link {
		min-width: 36px;
		height: 36px;
		padding: 0 8px;
		font-size: 12px;
	}

	.page-link.prev,
	.page-link.next {
		padding: 0 10px;
	}
}
