/**
 * Orders CSS.
 *
 * Styles for order history and order detail views.
 *
 * @package EM_Epic_HQ
 */

/* ==========================================================================
   Orders List
   ========================================================================== */

.em-portal-orders {
	max-width: 1200px;
}

/* Stats Bar */
.em-portal-stats-bar {
	display: flex;
	gap: 2rem;
	padding: 1.5rem;
	background: #f8f9fa;
	border-radius: 8px;
	margin-bottom: 1.5rem;
}

.em-portal-stat {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.em-portal-stat__value {
	font-size: 1.5rem;
	font-weight: 700;
	color: #1a1a1a;
}

.em-portal-stat__label {
	font-size: 0.875rem;
	color: #666;
}

/* Filters */
.em-portal-filters {
	display: flex;
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.em-portal-filters__search {
	flex: 1;
	max-width: 400px;
}

.em-portal-filters__status select {
	min-width: 150px;
}

/* Orders Table */
.em-portal-table {
	width: 100%;
	border-collapse: collapse;
	background: #fff;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.em-portal-table thead {
	background: #f8f9fa;
}

.em-portal-table th {
	padding: 1rem;
	text-align: left;
	font-weight: 600;
	font-size: 0.875rem;
	color: #666;
	border-bottom: 1px solid #e9ecef;
}

.em-portal-table td {
	padding: 1rem;
	border-bottom: 1px solid #e9ecef;
	vertical-align: middle;
}

.em-portal-table tbody tr:last-child td {
	border-bottom: none;
}

.em-portal-table tbody tr:hover {
	background: #f8f9fa;
}

/* Order Number */
.em-portal-orders__number {
	font-weight: 600;
	color: #1a1a1a;
	text-decoration: none;
	display: block;
}

.em-portal-orders__number:hover {
	color: #ff6600;
}

.em-portal-orders__customer {
	display: block;
	font-size: 0.875rem;
	color: #666;
	margin-top: 0.25rem;
}

/* Date */
.em-portal-orders__date {
	display: block;
	font-weight: 500;
}

.em-portal-orders__time {
	display: block;
	font-size: 0.875rem;
	color: #666;
}

/* Actions */
.em-portal-orders__actions {
	display: flex;
	gap: 0.5rem;
}

/* Order Status */
.em-portal-status {
	display: inline-flex;
	align-items: center;
	padding: 0.25rem 0.75rem;
	border-radius: 9999px;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.em-portal-status--pending {
	background: #fff3cd;
	color: #856404;
}

.em-portal-status--processing {
	background: #cce5ff;
	color: #004085;
}

.em-portal-status--on-hold {
	background: #e2e3e5;
	color: #383d41;
}

.em-portal-status--completed {
	background: #d4edda;
	color: #155724;
}

.em-portal-status--cancelled,
.em-portal-status--refunded,
.em-portal-status--failed {
	background: #f8d7da;
	color: #721c24;
}

/* Pagination */
.em-portal-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	margin-top: 1.5rem;
	padding: 1rem;
}

.em-portal-pagination__current {
	color: #666;
}

/* ==========================================================================
   Order Detail
   ========================================================================== */

.em-portal-order-detail {
	max-width: 1200px;
}

.em-portal-order-detail__header {
	margin-bottom: 1.5rem;
}

.em-portal-order-detail__title {
	display: flex;
	align-items: center;
	gap: 1rem;
	flex-wrap: wrap;
}

.em-portal-order-detail__title h1 {
	margin: 0;
	font-size: 1.75rem;
}

.em-portal-order-detail__date {
	color: #666;
	margin: 0.5rem 0 0;
}

/* Layout */
.em-portal-order-detail__layout {
	display: grid;
	grid-template-columns: 1fr 350px;
	gap: 1.5rem;
}

.em-portal-order-detail__main {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

.em-portal-order-detail__sidebar {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

/* Cards */
.em-portal-card {
	background: #fff;
	border-radius: 8px;
	padding: 1.5rem;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.em-portal-card__title {
	margin: 0 0 1rem;
	font-size: 1rem;
	font-weight: 600;
	color: #1a1a1a;
}

/* Order Items Table */
.em-portal-order-items {
	width: 100%;
	border-collapse: collapse;
}

.em-portal-order-items th {
	padding: 0.75rem 0;
	text-align: left;
	font-weight: 600;
	font-size: 0.875rem;
	color: #666;
	border-bottom: 1px solid #e9ecef;
}

.em-portal-order-items td {
	padding: 1rem 0;
	border-bottom: 1px solid #e9ecef;
	vertical-align: top;
}

.em-portal-order-items tbody tr:last-child td {
	border-bottom: none;
}

.em-portal-order-items__product-info {
	display: flex;
	gap: 1rem;
}

.em-portal-order-items__mockup,
.em-portal-order-items__image {
	flex-shrink: 0;
	width: 80px;
	height: 80px;
	border-radius: 4px;
	overflow: hidden;
	background: #f8f9fa;
}

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

.em-portal-order-items__details {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.em-portal-order-items__name {
	font-weight: 600;
	color: #1a1a1a;
}

.em-portal-order-items__template {
	font-size: 0.875rem;
	color: #666;
}

.em-portal-order-items__variation {
	font-size: 0.875rem;
	color: #666;
}

.em-portal-order-items__personalization {
	margin-top: 0.5rem;
	font-size: 0.875rem;
}

.em-portal-order-items__personalization strong {
	font-weight: 600;
}

.em-portal-order-items__personalization ul {
	margin: 0.25rem 0 0;
	padding-left: 1rem;
}

.em-portal-order-items__personalization li {
	color: #666;
}

.em-portal-order-items__qty {
	text-align: center;
	width: 60px;
}

.em-portal-order-items__total {
	text-align: right;
	font-weight: 600;
	width: 100px;
}

/* Order Summary */
.em-portal-order-summary {
	margin: 0;
}

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

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

.em-portal-order-summary__row dt {
	color: #666;
}

.em-portal-order-summary__row dd {
	margin: 0;
	font-weight: 500;
}

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

.em-portal-order-summary__row--total {
	padding-top: 1rem;
	margin-top: 0.5rem;
	border-top: 2px solid #1a1a1a;
}

.em-portal-order-summary__row--total dt,
.em-portal-order-summary__row--total dd {
	font-size: 1.125rem;
	font-weight: 700;
	color: #1a1a1a;
}

.em-portal-order-summary__payment {
	margin-top: 1rem;
	padding-top: 1rem;
	border-top: 1px solid #e9ecef;
	font-size: 0.875rem;
	color: #666;
}

.em-portal-order-summary__payment strong {
	color: #1a1a1a;
}

/* Address */
.em-portal-address {
	font-style: normal;
	line-height: 1.6;
	color: #666;
}

.em-portal-address a {
	color: #1a1a1a;
	text-decoration: none;
}

.em-portal-address a:hover {
	color: #ff6600;
}

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

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

	.em-portal-order-detail__sidebar {
		order: -1;
	}
}

@media (max-width: 768px) {
	.em-portal-stats-bar {
		flex-wrap: wrap;
	}

	.em-portal-filters {
		flex-direction: column;
	}

	.em-portal-filters__search {
		max-width: none;
	}

	.em-portal-table {
		display: block;
		overflow-x: auto;
	}

	.em-portal-orders__actions {
		flex-direction: column;
	}

	.em-portal-order-items__product-info {
		flex-direction: column;
	}

	.em-portal-order-items__mockup,
	.em-portal-order-items__image {
		width: 60px;
		height: 60px;
	}
}

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

.em-portal-empty {
	text-align: center;
	padding: 3rem;
	background: #f8f9fa;
	border-radius: 8px;
}

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

/* ==========================================================================
   Loading State
   ========================================================================== */

.em-portal-loading {
	text-align: center;
	padding: 2rem;
	color: #666;
}

.em-portal-loading::after {
	content: '';
	display: inline-block;
	width: 20px;
	height: 20px;
	margin-left: 0.5rem;
	border: 2px solid #e9ecef;
	border-top-color: #1a1a1a;
	border-radius: 50%;
	animation: em-spin 0.8s linear infinite;
	vertical-align: middle;
}

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