/**
 * Artwork Library Styles
 *
 * @package EM_Epic_HQ
 */

/* ==========================================================================
   Page Header
   ========================================================================== */

.em-hq-artwork .em-hq-page-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.em-hq-page-header__content {
	flex: 1;
}

.em-hq-page-header__description {
	margin: 0.5rem 0 0;
	color: var(--em-text-muted, #6b7280);
}

#em-artwork-upload-btn svg {
	margin-right: 0.5rem;
}

/* ==========================================================================
   Filters
   ========================================================================== */

.em-artwork-filters {
	display: flex;
	gap: 0.5rem;
	margin-bottom: 1.5rem;
	flex-wrap: wrap;
}

.em-filter-btn {
	padding: 0.5rem 1rem;
	border: 1px solid var(--em-border, #e5e7eb);
	border-radius: 0.375rem;
	background: var(--em-bg-white, #fff);
	color: var(--em-text, #374151);
	cursor: pointer;
	transition: all 0.2s ease;
	font-size: 0.875rem;
}

.em-filter-btn:hover {
	background: var(--em-bg-gray, #f9fafb);
	border-color: var(--em-border-hover, #d1d5db);
}

.em-filter-btn.active {
	background: var(--em-primary, #1a1a1a);
	border-color: var(--em-primary, #1a1a1a);
	color: #fff;
}

/* ==========================================================================
   Artwork Grid
   ========================================================================== */

.em-artwork-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 1rem;
}

.em-artwork-loading {
	grid-column: 1 / -1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	padding: 3rem;
	color: var(--em-text-muted, #6b7280);
}

.em-spinner {
	width: 1.25rem;
	height: 1.25rem;
	border: 2px solid var(--em-border, #e5e7eb);
	border-top-color: var(--em-primary, #1a1a1a);
	border-radius: 50%;
	animation: em-spin 0.8s linear infinite;
}

@keyframes em-spin {
	to { transform: rotate(360deg); }
}

/* ==========================================================================
   Artwork Card
   ========================================================================== */

.em-artwork-card {
	position: relative;
	background: var(--em-bg-white, #fff);
	border: 1px solid var(--em-border, #e5e7eb);
	border-radius: 0.5rem;
	overflow: hidden;
	cursor: pointer;
	transition: all 0.2s ease;
}

.em-artwork-card:hover {
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	transform: translateY(-2px);
}

.em-artwork-card__image {
	position: relative;
	aspect-ratio: 1;
	background: var(--em-bg-gray, #f9fafb);
	display: flex;
	align-items: center;
	justify-content: center;
}

.em-artwork-card__image img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

.em-artwork-card__image .em-badge {
	position: absolute;
	top: 0.5rem;
	right: 0.5rem;
}

.em-artwork-card__info {
	padding: 0.75rem;
	border-top: 1px solid var(--em-border, #e5e7eb);
}

.em-artwork-card__info h4 {
	margin: 0;
	font-size: 0.875rem;
	font-weight: 500;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.em-artwork-card__type {
	display: block;
	margin-top: 0.25rem;
	font-size: 0.75rem;
	color: var(--em-text-muted, #6b7280);
	text-transform: capitalize;
}

/* ==========================================================================
   Badges
   ========================================================================== */

.em-badge {
	display: inline-block;
	padding: 0.25rem 0.5rem;
	font-size: 0.6875rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.025em;
	border-radius: 0.25rem;
}

.em-badge--warning {
	background: #fef3c7;
	color: #92400e;
}

.em-badge--success {
	background: #d1fae5;
	color: #065f46;
}

.em-badge--danger {
	background: #fee2e2;
	color: #991b1b;
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.em-artwork-empty {
	text-align: center;
	padding: 4rem 2rem;
	color: var(--em-text-muted, #6b7280);
}

.em-artwork-empty svg {
	margin-bottom: 1rem;
	opacity: 0.5;
}

.em-artwork-empty h3 {
	margin: 0 0 0.5rem;
	color: var(--em-text, #374151);
}

.em-artwork-empty p {
	margin: 0;
}

/* ==========================================================================
   Modal Base
   ========================================================================== */

.em-modal {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.em-modal[hidden] {
	display: none;
}

.em-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
}

.em-modal__content {
	position: relative;
	width: 100%;
	max-width: 500px;
	max-height: 90vh;
	background: var(--em-bg-white, #fff);
	border-radius: 0.5rem;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.em-modal--preview .em-modal__content {
	max-width: 700px;
}

.em-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1rem 1.5rem;
	border-bottom: 1px solid var(--em-border, #e5e7eb);
}

.em-modal__header h2 {
	margin: 0;
	font-size: 1.125rem;
}

.em-modal__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	padding: 0;
	border: none;
	background: transparent;
	color: var(--em-text-muted, #6b7280);
	cursor: pointer;
	border-radius: 0.25rem;
	transition: all 0.2s ease;
}

.em-modal__close:hover {
	background: var(--em-bg-gray, #f3f4f6);
	color: var(--em-text, #374151);
}

.em-modal__body {
	flex: 1;
	padding: 1.5rem;
	overflow-y: auto;
}

.em-modal__footer {
	display: flex;
	justify-content: flex-end;
	gap: 0.75rem;
	padding: 1rem 1.5rem;
	border-top: 1px solid var(--em-border, #e5e7eb);
	background: var(--em-bg-gray, #f9fafb);
}

/* ==========================================================================
   Dropzone
   ========================================================================== */

.em-dropzone {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 2.5rem 1.5rem;
	border: 2px dashed var(--em-border, #d1d5db);
	border-radius: 0.5rem;
	background: var(--em-bg-gray, #f9fafb);
	cursor: pointer;
	transition: all 0.2s ease;
	text-align: center;
}

.em-dropzone:hover,
.em-dropzone.dragover {
	border-color: var(--em-primary, #1a1a1a);
	background: var(--em-bg-white, #fff);
}

.em-dropzone svg {
	margin-bottom: 1rem;
	color: var(--em-text-muted, #9ca3af);
}

.em-dropzone__text {
	margin: 0;
	font-weight: 500;
	color: var(--em-text, #374151);
}

.em-dropzone__hint {
	margin: 0.5rem 0 0;
	font-size: 0.875rem;
	color: var(--em-text-muted, #6b7280);
}

/* ==========================================================================
   Upload Queue
   ========================================================================== */

.em-upload-queue {
	margin-top: 1rem;
}

.em-upload-queue:empty {
	display: none;
}

.em-upload-item {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.75rem;
	background: var(--em-bg-gray, #f9fafb);
	border-radius: 0.375rem;
	margin-bottom: 0.5rem;
}

.em-upload-item__name {
	flex: 1;
	font-size: 0.875rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.em-upload-item__status {
	font-size: 0.75rem;
	color: var(--em-text-muted, #6b7280);
}

.em-upload-item.success .em-upload-item__status {
	color: #059669;
}

.em-upload-item.error .em-upload-item__status {
	color: #dc2626;
}

.em-upload-item__progress {
	width: 60px;
	height: 4px;
	background: var(--em-border, #e5e7eb);
	border-radius: 2px;
	overflow: hidden;
}

.em-upload-item__progress .bar {
	height: 100%;
	background: var(--em-primary, #1a1a1a);
	width: 0%;
	transition: width 0.3s ease;
}

.em-upload-item.success .em-upload-item__progress,
.em-upload-item.error .em-upload-item__progress {
	display: none;
}

/* ==========================================================================
   Artwork Preview Modal
   ========================================================================== */

.em-artwork-preview {
	display: grid;
	gap: 1.5rem;
}

@media (min-width: 600px) {
	.em-artwork-preview {
		grid-template-columns: 1fr 1fr;
	}
}

.em-artwork-preview__image {
	aspect-ratio: 1;
	background: var(--em-bg-gray, #f9fafb);
	border-radius: 0.5rem;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.em-artwork-preview__image img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

.em-artwork-preview__info h3 {
	margin: 0 0 1rem;
	font-size: 1.125rem;
}

.em-artwork-preview__meta {
	margin: 0;
}

.em-artwork-preview__meta dt {
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.025em;
	color: var(--em-text-muted, #6b7280);
	margin-top: 0.75rem;
}

.em-artwork-preview__meta dt:first-child {
	margin-top: 0;
}

.em-artwork-preview__meta dd {
	margin: 0.25rem 0 0;
	font-size: 0.875rem;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.em-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.625rem 1.25rem;
	font-size: 0.875rem;
	font-weight: 500;
	line-height: 1.25;
	border-radius: 0.375rem;
	cursor: pointer;
	transition: all 0.2s ease;
	border: 1px solid transparent;
	text-decoration: none;
}

.em-btn--primary {
	background: var(--em-primary, #1a1a1a);
	color: #fff;
}

.em-btn--primary:hover {
	background: var(--em-primary-dark, #000);
}

.em-btn--secondary {
	background: var(--em-bg-white, #fff);
	color: var(--em-text, #374151);
	border-color: var(--em-border, #d1d5db);
}

.em-btn--secondary:hover {
	background: var(--em-bg-gray, #f3f4f6);
}

.em-btn--danger {
	background: #dc2626;
	color: #fff;
}

.em-btn--danger:hover {
	background: #b91c1c;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 640px) {
	.em-hq-artwork .em-hq-page-header {
		flex-direction: column;
	}

	.em-artwork-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}
