/**
 * E-Commerce Customer UI — profile, orders, cart/checkout modals, chat page
 */
:root {
	--ec-primary: #4f46e5;
	--ec-primary-dark: #4338ca;
	--ec-primary-soft: rgba(79, 70, 229, 0.1);
	--ec-accent: #0ea5e9;
	--ec-surface: #ffffff;
	--ec-bg: #f4f6fc;
	--ec-border: #e8ecf4;
	--ec-text: #111827;
	--ec-muted: #6b7280;
	--ec-radius: 16px;
	--ec-radius-sm: 12px;
	--ec-shadow: 0 8px 30px rgba(15, 23, 42, 0.07);
	--ec-shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.12);
}

/* ─── Page shell ─── */
.ec-page {
	max-width: 920px;
	margin: 0 auto;
}

.ec-page-hero {
	background: linear-gradient(135deg, #312e81 0%, #4f46e5 55%, #6366f1 100%);
	border-radius: var(--ec-radius);
	padding: 1.5rem 1.5rem 1.25rem;
	color: #fff;
	margin-bottom: 1.25rem;
	box-shadow: var(--ec-shadow-lg);
	position: relative;
	overflow: hidden;
}

.ec-page-hero::after {
	content: "";
	position: absolute;
	top: -40%;
	right: -10%;
	width: 220px;
	height: 220px;
	background: rgba(255, 255, 255, 0.08);
	border-radius: 50%;
	pointer-events: none;
}

.ec-page-hero h1,
.ec-page-hero .ec-page-hero__title {
	font-size: 1.35rem;
	font-weight: 700;
	margin: 0 0 0.35rem;
	letter-spacing: -0.02em;
	position: relative;
	z-index: 1;
}

.ec-page-hero p {
	margin: 0;
	opacity: 0.9;
	font-size: 0.875rem;
	position: relative;
	z-index: 1;
}

.ec-page-hero__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: 1rem;
	position: relative;
	z-index: 1;
}

.ec-page-hero__actions .btn {
	border-radius: 999px;
	font-weight: 600;
	font-size: 0.8125rem;
	padding: 0.4rem 1rem;
}

.ec-page-hero__actions .btn-light {
	background: rgba(255, 255, 255, 0.95);
	color: var(--ec-primary-dark);
	border: none;
}

.ec-page-hero__actions .btn-outline-light {
	border-color: rgba(255, 255, 255, 0.5);
	color: #fff;
}

.ec-page-hero__actions .btn-outline-light:hover {
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
}

.ec-surface-card {
	background: var(--ec-surface);
	border: 1px solid var(--ec-border);
	border-radius: var(--ec-radius);
	box-shadow: var(--ec-shadow);
	overflow: hidden;
}

.ec-surface-card__body {
	padding: 1.25rem 1.5rem;
}

/* ─── Profile ─── */
.ec-profile-avatar-wrap {
	text-align: center;
	padding: 1.5rem 1rem 1rem;
	background: linear-gradient(180deg, var(--ec-primary-soft) 0%, transparent 100%);
	border-bottom: 1px solid var(--ec-border);
}

.ec-profile-avatar {
	width: 112px;
	height: 112px;
	border-radius: 50%;
	object-fit: cover;
	border: 4px solid #fff;
	box-shadow: 0 8px 24px rgba(79, 70, 229, 0.25);
	display: inline-block;
	background-size: cover;
	background-position: center;
}

.ec-profile-avatar-wrap h2 {
	font-size: 1.25rem;
	font-weight: 700;
	margin: 1rem 0 0.25rem;
	color: var(--ec-text);
}

.ec-profile-badge {
	display: inline-block;
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--ec-primary);
	background: var(--ec-primary-soft);
	padding: 0.25rem 0.75rem;
	border-radius: 999px;
}

.ec-info-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ec-info-list li {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1rem;
	padding: 1rem 1.5rem;
	border-bottom: 1px solid #f1f5f9;
	align-items: flex-start;
}

.ec-info-list li:last-child {
	border-bottom: none;
}

.ec-info-list__label {
	flex: 0 0 140px;
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--ec-muted);
}

.ec-info-list__value {
	flex: 1;
	min-width: 0;
	font-weight: 500;
	color: var(--ec-text);
	word-break: break-word;
}

.ec-info-list__icon {
	width: 36px;
	height: 36px;
	border-radius: 10px;
	background: var(--ec-primary-soft);
	color: var(--ec-primary);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	margin-right: 0.25rem;
}

.ec-form-section {
	padding: 1.25rem 1.5rem;
	border-bottom: 1px solid var(--ec-border);
}

.ec-form-section:last-of-type {
	border-bottom: none;
}

.ec-form-section__title {
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--ec-muted);
	margin-bottom: 1rem;
}

.ec-photo-upload {
	text-align: center;
	padding: 1rem;
	border: 2px dashed var(--ec-border);
	border-radius: var(--ec-radius-sm);
	background: #fafbfc;
	transition: border-color 0.15s, background 0.15s;
}

.ec-photo-upload:hover {
	border-color: var(--ec-primary);
	background: var(--ec-primary-soft);
}

.ec-photo-upload .ec-profile-avatar {
	width: 88px;
	height: 88px;
	margin-bottom: 0.75rem;
}

/* ─── Order list ─── */
.ec-orders-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 1rem;
	padding: 1rem 1.5rem;
	background: #f8fafc;
	border-bottom: 1px solid var(--ec-border);
}

.ec-orders-toolbar label {
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: var(--ec-muted);
	margin-bottom: 0.5rem;
	display: block;
	line-height: 1.4;
	white-space: normal;
	overflow: visible;
}

.ec-orders-toolbar .ec-orders-filter {
	min-width: 200px;
	max-width: 100%;
}

.ec-orders-toolbar select,
body.wms-ui .ec-orders-toolbar select.form-control {
	height: auto !important;
	min-height: 2.5rem;
	line-height: 1.5 !important;
	padding: 0.5rem 2.25rem 0.5rem 0.85rem !important;
	font-size: 0.875rem !important;
	border-radius: var(--ec-radius-sm) !important;
	border-color: var(--ec-border) !important;
	background-color: #fff;
	-webkit-appearance: auto;
	appearance: auto;
	overflow: visible;
}

.ec-orders-table-wrap {
	padding: 0;
}

.ec-orders-table {
	width: 100%;
	margin: 0;
}

.ec-orders-table thead th {
	background: #f8fafc;
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--ec-muted);
	padding: 0.85rem 1.25rem;
	border: none;
}

.ec-orders-table tbody td {
	padding: 1rem 1.25rem;
	vertical-align: middle;
	border-top: 1px solid #f1f5f9;
}

.ec-orders-table tbody tr {
	transition: background 0.15s;
}

.ec-orders-table tbody tr:hover {
	background: #fafbff;
}

.ec-order-no {
	font-weight: 700;
	color: var(--ec-text);
}

.ec-order-date {
	font-size: 0.8125rem;
	color: var(--ec-muted);
}

.ec-status-pill {
	display: inline-flex;
	align-items: center;
	padding: 0.35rem 0.75rem;
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: 700;
}

.ec-btn-detail {
	border-radius: 999px;
	font-weight: 600;
	font-size: 0.8125rem;
	padding: 0.35rem 1rem;
	border: 1px solid var(--ec-primary);
	color: var(--ec-primary);
	background: transparent;
	transition: all 0.15s;
}

.ec-btn-detail:hover {
	background: var(--ec-primary);
	color: #fff;
	text-decoration: none;
}

.ec-orders-empty {
	text-align: center;
	padding: 3rem 1.5rem;
}

.ec-orders-empty i {
	font-size: 3rem;
	color: #c7d2fe;
	display: block;
	margin-bottom: 1rem;
}

/* Order detail */
.ec-order-detail-meta {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 1rem;
	padding: 1.25rem 1.5rem;
	background: #f8fafc;
	border-bottom: 1px solid var(--ec-border);
}

.ec-order-detail-meta__block .ec-meta-label {
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--ec-muted);
	margin-bottom: 0.35rem;
}

.ec-order-invoice-banner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.75rem;
	padding: 0.85rem 1.25rem;
	background: linear-gradient(135deg, #eef2ff 0%, #f0fdf4 100%);
	border-bottom: 1px solid var(--ec-border);
}

.ec-order-actions {
	white-space: nowrap;
}

.ec-order-actions .ec-order-cancel-form {
	margin-left: 0.35rem;
}

.ec-order-detail-footer form {
	margin: 0;
}

.ec-order-timeline-hint {
	font-size: 0.8125rem;
	color: var(--ec-muted);
	margin: 0;
}

/* ─── Cart & Checkout modals ─── */
.ec-modal .modal-content {
	border: none;
	border-radius: var(--ec-radius);
	box-shadow: var(--ec-shadow-lg);
	overflow: hidden;
}

.ec-modal .modal-header {
	background: linear-gradient(135deg, #312e81 0%, #4f46e5 100%);
	color: #fff;
	border: none;
	padding: 1.25rem 1.5rem;
	align-items: flex-start;
}

.ec-modal .modal-header .modal-title {
	color: #fff;
	font-weight: 700;
	font-size: 1.15rem;
}

.ec-modal .modal-header .ec-modal-subtitle {
	color: rgba(255, 255, 255, 0.85);
	font-size: 0.8125rem;
	margin-top: 0.25rem;
}

.ec-modal .modal-header .close {
	color: #fff;
	opacity: 0.85;
	text-shadow: none;
	margin: -0.25rem -0.5rem 0 0;
}

.ec-modal .modal-header .close:hover {
	opacity: 1;
}

.ec-modal .modal-body {
	padding: 1.25rem 1.5rem;
	background: #fafbfc;
}

.ec-modal .modal-footer {
	border-top: 1px solid var(--ec-border);
	background: #fff;
	padding: 1rem 1.5rem;
}

.ec-modal-cart-summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.5rem;
	padding: 0.75rem 1rem;
	background: var(--ec-primary-soft);
	border-radius: var(--ec-radius-sm);
	margin-bottom: 1rem;
	font-size: 0.875rem;
}

.ec-modal-cart-summary strong {
	color: var(--ec-primary-dark);
	font-size: 1rem;
}

.ec-cart-empty {
	text-align: center;
	padding: 2.5rem 1rem;
}

.ec-cart-empty__icon {
	width: 72px;
	height: 72px;
	margin: 0 auto 1rem;
	border-radius: 50%;
	background: var(--ec-primary-soft);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--ec-primary);
	font-size: 2rem;
}

.ec-cart-select-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.5rem;
	padding: 0.65rem 0.85rem;
	margin-bottom: 0.75rem;
	background: #f8fafc;
	border: 1px solid var(--ec-border);
	border-radius: var(--ec-radius-sm);
}

.ec-cart-select-all {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--ec-text);
	cursor: pointer;
	user-select: none;
}

.ec-cart-select-all input[type="checkbox"] {
	width: 1.05rem;
	height: 1.05rem;
	margin: 0;
	cursor: pointer;
	accent-color: var(--ec-primary);
}

.ec-cart-item__check {
	padding-top: 0.15rem;
}

.ec-cart-item__check input[type="checkbox"] {
	width: 1.1rem;
	height: 1.1rem;
	margin: 0;
	cursor: pointer;
	accent-color: var(--ec-primary);
}

.ec-cart-item.is-unselected {
	opacity: 0.62;
	background: #f8fafc;
}

.ec-cart-item.is-unselected:hover {
	opacity: 0.85;
}

.ec-cart-item {
	background: #fff;
	border: 1px solid var(--ec-border);
	border-radius: var(--ec-radius-sm);
	padding: 1rem;
	margin-bottom: 0.75rem;
	transition: box-shadow 0.15s, border-color 0.15s, opacity 0.15s;
}

.ec-cart-item:hover {
	border-color: #c7d2fe;
	box-shadow: 0 4px 16px rgba(79, 70, 229, 0.08);
}

.ec-cart-item .title,
.ec-cart-item__name {
	font-weight: 700;
	font-size: 0.95rem;
	color: var(--ec-text);
	line-height: 1.3;
}

.ec-cart-item .meta,
.ec-cart-item__meta {
	font-size: 0.8rem;
	color: var(--ec-muted);
	margin-top: 0.35rem;
}

.ec-cart-item .meta code,
.ec-cart-item__sku {
	display: inline-block;
	font-size: 0.75rem;
	background: #f1f5f9;
	color: #475569;
	padding: 0.15rem 0.5rem;
	border-radius: 6px;
	font-family: ui-monospace, monospace;
}

.ec-cart-item .small.text-muted.mt-2,
.ec-cart-item__price {
	font-weight: 700;
	color: var(--ec-primary);
	font-size: 0.9rem;
	margin-top: 0.5rem;
}

.ec-cart-item .qty-input,
.ec-cart-item__qty .form-control {
	border-radius: 10px;
	width: 90px;
	font-weight: 700;
	text-align: center;
}

.ec-cart-item__sku {
	display: inline-block;
	font-size: 0.75rem;
	background: #f1f5f9;
	color: #475569;
	padding: 0.15rem 0.5rem;
	border-radius: 6px;
	font-family: ui-monospace, monospace;
}

.ec-cart-item__meta {
	font-size: 0.8rem;
	color: var(--ec-muted);
	margin-top: 0.35rem;
}

.ec-cart-item__price {
	font-weight: 700;
	color: var(--ec-primary);
	font-size: 0.9rem;
	margin-top: 0.5rem;
}

.ec-cart-item__qty label {
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	color: var(--ec-muted);
}

.ec-cart-item__qty .form-control {
	border-radius: 10px;
	width: 90px;
	font-weight: 700;
	text-align: center;
}

.ec-cart-item__remove {
	border-radius: 10px;
	margin-top: 0.5rem;
}

.ec-modal-footer-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	width: 100%;
	align-items: center;
}

.ec-modal-footer-actions .btn-checkout-main {
	background: linear-gradient(135deg, var(--ec-primary) 0%, #6366f1 100%);
	border: none;
	font-weight: 700;
	border-radius: var(--ec-radius-sm);
	padding: 0.55rem 1.25rem;
	box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.ec-modal-footer-actions .btn-checkout-main:hover {
	transform: translateY(-1px);
	box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

/* Checkout modal */
.ec-checkout-modal .modal-dialog {
	max-width: 480px;
}

.ec-checkout-steps {
	display: flex;
	gap: 0.5rem;
	margin-bottom: 1.25rem;
}

.ec-checkout-step {
	flex: 1;
	text-align: center;
	padding: 0.5rem;
	border-radius: 10px;
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	background: #e5e7eb;
	color: var(--ec-muted);
}

.ec-checkout-step.active {
	background: var(--ec-primary);
	color: #fff;
}

.ec-dropship-toggle {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.5rem;
	background: #eef2ff;
	padding: 0.35rem;
	border-radius: var(--ec-radius-sm);
	border: 1px solid #c7d2fe;
}

.ec-dropship-opt {
	display: block;
	width: 100%;
	border: 2px solid transparent;
	border-radius: 10px;
	padding: 0.65rem 1rem;
	font-size: 0.875rem;
	font-weight: 700;
	text-align: center;
	cursor: pointer;
	background: #fff;
	color: var(--ec-muted);
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.ec-dropship-opt:hover:not(.is-active) {
	background: #f8fafc;
	color: var(--ec-text);
	border-color: #e5e7eb;
}

.ec-dropship-opt.is-active,
body.wms-ui .ec-modal .ec-dropship-opt.is-active {
	background: linear-gradient(135deg, var(--ec-primary) 0%, #6366f1 100%) !important;
	border-color: var(--ec-primary-dark) !important;
	color: #fff !important;
	box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4) !important;
}

.ec-checkout-hint {
	font-size: 0.8125rem;
	color: var(--ec-muted);
	margin-top: 0.5rem;
	padding: 0.65rem 0.85rem;
	background: #fff;
	border-radius: 10px;
	border-left: 3px solid var(--ec-accent);
}

.ec-checkout-section-title {
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--ec-muted);
	margin: 1.25rem 0 0.75rem;
	padding-top: 1rem;
	border-top: 1px dashed var(--ec-border);
}

.ec-checkout-section-title:first-child {
	margin-top: 0;
	padding-top: 0;
	border-top: none;
}

.ec-checkout-modal .form-control {
	border-radius: 10px;
	border-color: var(--ec-border);
}

.ec-checkout-modal .form-control:focus {
	border-color: var(--ec-primary);
	box-shadow: 0 0 0 3px var(--ec-primary-soft);
}

/* ─── Chat page (customer) ─── */
.ec-chat-page-wrap {
	max-width: 1100px;
	margin: 0 auto;
}

.ec-chat-page-hero {
	background: linear-gradient(135deg, #312e81 0%, #4f46e5 100%);
	border-radius: var(--ec-radius);
	padding: 1.25rem 1.5rem;
	color: #fff;
	margin-bottom: 1rem;
	box-shadow: var(--ec-shadow);
}

.ec-chat-page-hero h4 {
	color: #fff;
	font-weight: 700;
	margin-bottom: 0.35rem;
}

.ec-chat-page-hero p {
	color: rgba(255, 255, 255, 0.88);
	margin: 0;
	font-size: 0.875rem;
}

.ec-chat-page .wms-chat-shell {
	border-radius: var(--ec-radius);
	box-shadow: var(--ec-shadow-lg);
}

@media (min-width: 768px) {
	.ec-orders-table .text-md-center {
		text-align: center;
	}

	.ec-orders-table .text-md-right {
		text-align: right;
	}
}

/* ─── Mobile ─── */
@media (max-width: 767.98px) {
	.ec-page-hero {
		padding: 1.15rem;
	}

	.ec-page-hero h1,
	.ec-page-hero .ec-page-hero__title {
		font-size: 1.15rem;
	}

	.ec-surface-card__body,
	.ec-form-section {
		padding: 1rem;
	}

	.ec-info-list li {
		flex-direction: column;
		padding: 0.85rem 1rem;
	}

	.ec-info-list__label {
		flex: none;
	}

	.ec-orders-table thead {
		display: none;
	}

	.ec-orders-table tbody tr {
		display: block;
		padding: 1rem;
		margin: 0.75rem 1rem;
		border: 1px solid var(--ec-border);
		border-radius: var(--ec-radius-sm);
		background: #fff;
	}

	.ec-orders-table tbody td {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 0.35rem 0;
		border: none;
	}

	.ec-orders-table tbody td::before {
		content: attr(data-label);
		font-size: 0.7rem;
		font-weight: 700;
		text-transform: uppercase;
		color: var(--ec-muted);
	}

	.ec-orders-table tbody td:last-child {
		justify-content: center;
		padding-top: 0.75rem;
		margin-top: 0.5rem;
		border-top: 1px solid #f1f5f9;
	}

	.ec-orders-table tbody td:last-child::before {
		display: none;
	}

	.ec-modal .modal-dialog {
		margin: 0.5rem;
	}

	.ec-modal-footer-actions .btn {
		flex: 1 1 auto;
		min-width: calc(50% - 0.25rem);
	}

	.ec-chat-page .wms-chat-shell .wms-chat-layout {
		min-height: calc(100dvh - 140px);
		max-height: calc(100dvh - 120px);
	}
}
