/**
 * Product Template Styles.
 *
 * Styles for product library listing, configuration, and order forms.
 *
 * @package EM_Epic_HQ
 */

/* ==========================================================================
   Product Grid
   ========================================================================== */

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

/* ==========================================================================
   Product Card
   ========================================================================== */

.em-product-card {
	background: #fff;
	border: 1px solid var(--em-border-color, #e0e0e0);
	border-radius: 8px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	position: relative;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

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

.em-product-card--inactive {
	opacity: 0.7;
}

.em-product-card__badge {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
	padding: 0.25rem 0.5rem;
	font-size: 0.75rem;
	font-weight: 600;
	border-radius: 4px;
	z-index: 1;
}

.em-product-card__badge--inactive {
	background: #6c757d;
	color: #fff;
}

.em-product-card__badge--global {
	background: var(--em-primary-color, #1e3a5f);
	color: #fff;
}

.em-product-card__image {
	aspect-ratio: 1 / 1;
	background: #f8f9fa;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.em-product-card__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.em-product-card__placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	color: #ccc;
}

.em-product-card__body {
	padding: 1rem;
	flex: 1;
	display: flex;
	flex-direction: column;
}

.em-product-card__title {
	font-size: 1.125rem;
	font-weight: 600;
	margin: 0 0 0.5rem;
	color: var(--em-text-color, #333);
}

.em-product-card__description {
	font-size: 0.875rem;
	color: #666;
	margin: 0 0 0.75rem;
	line-height: 1.4;
}

.em-product-card__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-bottom: 0.75rem;
}

.em-product-card__meta-item {
	display: flex;
	align-items: center;
	gap: 0.25rem;
	font-size: 0.75rem;
	color: #666;
}

.em-product-card__meta-item svg {
	flex-shrink: 0;
}

.em-product-card__price {
	margin-top: auto;
	font-size: 1rem;
	font-weight: 600;
	color: var(--em-primary-color, #1e3a5f);
}

.em-product-card__discount {
	background: #28a745;
	color: #fff;
	font-size: 0.75rem;
	padding: 0.125rem 0.375rem;
	border-radius: 3px;
	margin-left: 0.25rem;
}

.em-product-card__warning {
	display: flex;
	align-items: center;
	gap: 0.375rem;
	font-size: 0.75rem;
	color: #dc3545;
	margin-top: 0.5rem;
}

.em-product-card__actions {
	padding: 1rem;
	border-top: 1px solid var(--em-border-color, #e0e0e0);
	display: flex;
	gap: 0.5rem;
}

.em-product-card__actions .em-btn--full {
	flex: 1;
}

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

.em-portal-empty-state {
	text-align: center;
	padding: 3rem 1.5rem;
	background: #f8f9fa;
	border-radius: 8px;
	border: 1px dashed var(--em-border-color, #e0e0e0);
}

.em-portal-empty-state__icon {
	color: #ccc;
	margin-bottom: 1rem;
}

.em-portal-empty-state h3 {
	margin: 0 0 0.5rem;
	font-size: 1.25rem;
	color: var(--em-text-color, #333);
}

.em-portal-empty-state p {
	margin: 0 0 1.5rem;
	color: #666;
}

/* ==========================================================================
   Configure Layout
   ========================================================================== */

.em-portal-configure-layout {
	display: grid;
	grid-template-columns: 1fr;
	gap: 2rem;
}

@media (min-width: 992px) {
	.em-portal-configure-layout {
		grid-template-columns: 400px 1fr;
	}
}

.em-portal-configure-preview {
	position: sticky;
	top: 1rem;
	align-self: start;
}

.em-portal-configure-preview__image {
	position: relative;
	aspect-ratio: 1 / 1;
	background: #f8f9fa;
	border-radius: 8px;
	overflow: hidden;
	margin-bottom: 1rem;
}

.em-portal-configure-preview__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.em-portal-configure-preview__locations {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	pointer-events: none;
}

.em-portal-configure-preview__info h2 {
	margin: 0 0 0.5rem;
	font-size: 1.5rem;
}

.em-portal-configure-preview__info p {
	color: #666;
	margin: 0 0 0.75rem;
}

.em-portal-configure-preview__price {
	font-size: 1.125rem;
}

/* ==========================================================================
   Print Location Markers
   ========================================================================== */

.em-print-location-marker {
	position: absolute;
	width: 24px;
	height: 24px;
	background: var(--em-primary-color, #1e3a5f);
	border: 2px solid #fff;
	border-radius: 50%;
	transform: translate(-50%, -50%);
	cursor: pointer;
	z-index: 10;
}

.em-print-location-marker::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 8px;
	height: 8px;
	background: #fff;
	border-radius: 50%;
	transform: translate(-50%, -50%);
}

.em-print-location-marker__label {
	position: absolute;
	bottom: 100%;
	left: 50%;
	transform: translateX(-50%);
	white-space: nowrap;
	background: rgba(0, 0, 0, 0.8);
	color: #fff;
	font-size: 0.75rem;
	padding: 0.25rem 0.5rem;
	border-radius: 4px;
	margin-bottom: 0.25rem;
	opacity: 0;
	transition: opacity 0.2s;
	pointer-events: none;
}

.em-print-location-marker:hover .em-print-location-marker__label {
	opacity: 1;
}

/* ==========================================================================
   Configure Form
   ========================================================================== */

.em-portal-configure-form {
	background: #fff;
	border: 1px solid var(--em-border-color, #e0e0e0);
	border-radius: 8px;
	padding: 1.5rem;
}

.em-form-section {
	margin-bottom: 2rem;
	padding-bottom: 2rem;
	border-bottom: 1px solid var(--em-border-color, #e0e0e0);
}

.em-form-section:last-of-type {
	border-bottom: none;
	padding-bottom: 0;
}

.em-form-section h3 {
	margin: 0 0 1rem;
	font-size: 1rem;
	font-weight: 600;
}

.em-form-group {
	margin-bottom: 1rem;
}

.em-form-group label {
	display: block;
	margin-bottom: 0.375rem;
	font-weight: 500;
}

.em-form-input {
	display: block;
	width: 100%;
	padding: 0.5rem 0.75rem;
	font-size: 1rem;
	border: 1px solid var(--em-border-color, #e0e0e0);
	border-radius: 4px;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.em-form-input:focus {
	outline: none;
	border-color: var(--em-primary-color, #1e3a5f);
	box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.em-form-input--small {
	width: auto;
	max-width: 100px;
}

.em-form-help {
	font-size: 0.875rem;
	color: #666;
	margin: 0.375rem 0 0;
}

.em-form-actions {
	display: flex;
	gap: 0.75rem;
	justify-content: flex-end;
	margin-top: 1.5rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--em-border-color, #e0e0e0);
}

/* ==========================================================================
   Checkbox Grid
   ========================================================================== */

.em-checkbox-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
}

.em-checkbox {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	cursor: pointer;
}

.em-checkbox input {
	position: absolute;
	opacity: 0;
}

.em-checkbox__box {
	width: 18px;
	height: 18px;
	border: 2px solid var(--em-border-color, #e0e0e0);
	border-radius: 3px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s;
}

.em-checkbox input:checked + .em-checkbox__box {
	background: var(--em-primary-color, #1e3a5f);
	border-color: var(--em-primary-color, #1e3a5f);
}

.em-checkbox input:checked + .em-checkbox__box::after {
	content: '';
	width: 5px;
	height: 9px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
	margin-top: -2px;
}

.em-checkbox__label {
	font-size: 0.875rem;
}

/* ==========================================================================
   Toggle Switch
   ========================================================================== */

.em-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.75rem;
	cursor: pointer;
}

.em-toggle input {
	position: absolute;
	opacity: 0;
}

.em-toggle__slider {
	width: 48px;
	height: 24px;
	background: #ccc;
	border-radius: 24px;
	position: relative;
	transition: background 0.2s;
}

.em-toggle__slider::after {
	content: '';
	position: absolute;
	top: 2px;
	left: 2px;
	width: 20px;
	height: 20px;
	background: #fff;
	border-radius: 50%;
	transition: transform 0.2s;
}

.em-toggle input:checked + .em-toggle__slider {
	background: #28a745;
}

.em-toggle input:checked + .em-toggle__slider::after {
	transform: translateX(24px);
}

/* ==========================================================================
   Print Locations List
   ========================================================================== */

.em-print-locations-list {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.em-print-location-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.75rem;
	background: #f8f9fa;
	border-radius: 4px;
}

.em-print-location-item__info strong {
	display: block;
}

.em-print-location-item__id {
	font-size: 0.75rem;
	color: #666;
	font-family: monospace;
}

.em-print-location-item__meta {
	display: flex;
	gap: 0.75rem;
	align-items: center;
	font-size: 0.875rem;
	color: #666;
}

/* ==========================================================================
   Personalization Fields List
   ========================================================================== */

.em-personalization-fields-list {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.em-personalization-field-item {
	padding: 0.75rem;
	background: #f8f9fa;
	border-radius: 4px;
}

.em-personalization-field-item strong {
	margin-right: 0.5rem;
}

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

.em-badge {
	display: inline-block;
	padding: 0.125rem 0.5rem;
	font-size: 0.75rem;
	font-weight: 500;
	border-radius: 3px;
	background: var(--em-primary-color, #1e3a5f);
	color: #fff;
}

.em-badge--success {
	background: #28a745;
}

.em-badge--warning {
	background: #ffc107;
	color: #212529;
}

.em-badge--danger {
	background: #dc3545;
}

/* ==========================================================================
   Table Styles
   ========================================================================== */

.em-table {
	width: 100%;
	border-collapse: collapse;
}

.em-table th,
.em-table td {
	padding: 0.75rem;
	text-align: left;
	border-bottom: 1px solid var(--em-border-color, #e0e0e0);
}

.em-table th {
	font-weight: 600;
	background: #f8f9fa;
}

.em-table--compact th,
.em-table--compact td {
	padding: 0.5rem;
}

/* ==========================================================================
   Order Layout
   ========================================================================== */

.em-portal-order-layout {
	display: grid;
	grid-template-columns: 1fr;
	gap: 2rem;
}

@media (min-width: 992px) {
	.em-portal-order-layout {
		grid-template-columns: 400px 1fr;
	}
}

.em-portal-order-preview {
	position: sticky;
	top: 1rem;
	align-self: start;
}

.em-portal-order-preview__image {
	position: relative;
	aspect-ratio: 1 / 1;
	background: #f8f9fa;
	border-radius: 8px;
	overflow: hidden;
	margin-bottom: 1rem;
}

.em-portal-order-preview__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.em-portal-order-preview__locations {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	pointer-events: none;
}

.em-portal-order-preview__info h2 {
	margin: 0 0 0.5rem;
	font-size: 1.5rem;
}

.em-portal-order-preview__info p {
	color: #666;
	margin: 0;
}

.em-portal-order-form {
	background: #fff;
	border: 1px solid var(--em-border-color, #e0e0e0);
	border-radius: 8px;
	padding: 1.5rem;
}

/* ==========================================================================
   Color Selector
   ========================================================================== */

.em-color-selector {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
}

.em-color-option {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.375rem;
	cursor: pointer;
}

.em-color-option input {
	position: absolute;
	opacity: 0;
}

.em-color-option__swatch {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: 2px solid #e0e0e0;
	transition: all 0.2s;
}

.em-color-option input:checked + .em-color-option__swatch {
	border-color: var(--em-primary-color, #1e3a5f);
	box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.2);
	transform: scale(1.1);
}

.em-color-option__label {
	font-size: 0.75rem;
	text-align: center;
}

/* ==========================================================================
   Size Quantity Grid
   ========================================================================== */

.em-size-quantity-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
	gap: 0.75rem;
	margin-bottom: 1rem;
}

.em-size-quantity-item {
	text-align: center;
}

.em-size-quantity-item label {
	display: block;
	font-weight: 600;
	margin-bottom: 0.375rem;
}

.em-size-quantity-item input {
	width: 100%;
	text-align: center;
}

.em-size-quantity-total {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.75rem;
	background: #f8f9fa;
	border-radius: 4px;
	font-size: 1rem;
}

.em-size-quantity-total strong {
	font-size: 1.25rem;
	color: var(--em-primary-color, #1e3a5f);
}

/* ==========================================================================
   Print Location Selector
   ========================================================================== */

.em-print-location-selector {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

/* ==========================================================================
   Order Summary
   ========================================================================== */

.em-order-summary {
	background: #f8f9fa;
	border-radius: 8px;
	padding: 1.25rem !important;
	margin-top: 1.5rem;
}

.em-order-summary h3 {
	margin-bottom: 1rem;
}

.em-order-summary__row {
	display: flex;
	justify-content: space-between;
	padding: 0.5rem 0;
	border-bottom: 1px solid #e0e0e0;
}

.em-order-summary__row:last-of-type {
	border-bottom: none;
}

.em-order-summary__row--discount {
	color: #28a745;
}

.em-order-summary__row--total {
	font-size: 1.125rem;
	font-weight: 600;
	padding-top: 0.75rem;
	margin-top: 0.5rem;
	border-top: 2px solid var(--em-primary-color, #1e3a5f);
	border-bottom: none;
}

.em-order-summary__breaks {
	margin-top: 1rem;
	padding-top: 1rem;
	border-top: 1px dashed #e0e0e0;
}

.em-order-summary__breaks ul {
	margin: 0.5rem 0 0;
	padding-left: 1.25rem;
}

.em-order-summary__breaks li {
	font-size: 0.875rem;
	color: #28a745;
}

/* ==========================================================================
   Required Indicator
   ========================================================================== */

.em-required {
	color: #dc3545;
}

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

.em-portal-page-header__breadcrumb {
	font-size: 0.875rem;
	color: #666;
	margin-bottom: 0.5rem;
}

.em-portal-page-header__breadcrumb a {
	color: var(--em-primary-color, #1e3a5f);
	text-decoration: none;
}

.em-portal-page-header__breadcrumb a:hover {
	text-decoration: underline;
}

.em-portal-page-header__separator {
	margin: 0 0.5rem;
	color: #999;
}

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

@media (max-width: 768px) {
	.em-product-grid {
		grid-template-columns: 1fr;
	}

	.em-portal-configure-preview,
	.em-portal-order-preview {
		position: static;
	}

	.em-form-actions {
		flex-direction: column;
	}

	.em-form-actions .em-btn {
		width: 100%;
	}
}
