/* Order History — list of past orders */

/* --- Page Header with Filter --- */

.dtec-history__header {
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
}

.dtec-history__filter {
	display: flex;
}

.dtec-history__filter-label {
	font-size: 18px;
}

.dtec-history__filter-dates {
	display: flex;
}

.dtec-history__filter-sep {
	color: rgba(46, 40, 38, 0.5);
}

.dtec-history__list {
	display: flex;
	flex-direction: column;
	gap: 40px;
}

.dtec-history__footer {
	margin-top: 20px;
}

/* --- Order List Container --- */

.dtec-history {
	display: flex;
	flex-direction: column;
	gap: 40px;
}

.dtec-history__card {
	background: var(--white, #FFF);
	border: 2px solid var(--aubergine-gleam-500, #8F385D);
	border-radius: 20px;
	padding: 20px 52px;
	display: flex;
	flex-direction: column;
}

.dtec-history__card--loading {
	min-height: 320px;
	justify-content: center;
}

.dtec-history__card--loading .dtec-loading {
	margin: 0;
	text-align: center;
}

/* --- Order Row --- */

.dtec-history__row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 36px 0;
	gap: 40px;
	border-bottom: 1px solid var(--aubergine-gleam-300, #DC98B5);
}

.dtec-history__row--last {
	border-bottom: none;
}

.dtec-history__row-content {
	display: flex;
	flex-direction: column;
	gap: 12px;
	flex: 1;
	min-width: 0;
}

/* --- Top line: Order ID | Total --- */

.dtec-history__row-top {
	display: flex;
	align-items: center;
	gap: 24px;
}

.dtec-history__order-id {
	font-size: 32px;
	font-weight: 600;
	color: var(--dark-gray, #2E2826);
	line-height: 1;
	white-space: nowrap;
}

.dtec-history__row-sep {
	width: 1px;
	height: 24px;
	background: rgba(46, 40, 38, 0.3);
	flex-shrink: 0;
}

.dtec-history__order-total {
	font-size: 32px;
	font-weight: 600;
	color: var(--lime-500, #A0BA18);
	line-height: 1;
	white-space: nowrap;
}

/* --- Meta line: meal count + plan + date --- */

.dtec-history__row-meta {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.dtec-history__meta-item {
	font-size: 20px;
	font-weight: 600;
	color: #000;
	line-height: normal;
	white-space: nowrap;
}

.dtec-history__row-meta svg {
	flex-shrink: 0;
}

.dtec-history__meta-date {
	font-size: 20px;
	font-weight: 600;
	color: rgba(46, 40, 38, 0.75);
	line-height: normal;
	white-space: nowrap;
}

/* --- Items line: comma-separated meals --- */

.dtec-history__row-items {
	font-size: 16px;
	font-weight: 400;
	color: rgba(46, 40, 38, 0.75);
	line-height: normal;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* --- Receipt Button --- */

.dtec-history__row-action {
	flex-shrink: 0;
}

.dtec-history__receipt-btn {
	display: flex;
	height: 64px;
	padding: 20px 25px;
	align-items: center;
	justify-content: center;
	gap: 10px;
	border: 1px solid var(--aubergine-gleam-500, #8F385D);
	border-radius: 5px;
	background: var(--white, #FFF);
	color: var(--aubergine-gleam-500, #8F385D);
	font-size: 20px;
	font-weight: 700;
	cursor: pointer;
	white-space: nowrap;
	transition: background 150ms ease, color 150ms ease;
}

.dtec-history__receipt-btn:hover:not(:disabled) {
	background: var(--aubergine-gleam-500, #8F385D);
	color: var(--white, #FFF);
}

.dtec-history__receipt-btn:hover:not(:disabled) svg path {
	fill: var(--white, #FFF);
}

.dtec-history__receipt-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* --- Section title (link mode on overview) --- */

.dtec-history__section-title {
	font-size: 28px;
	font-weight: 600;
	color: var(--dark-gray, #2E2826);
	margin: 0;
	padding-bottom: 20px;
	border-bottom: 1px solid rgba(46, 40, 38, 0.15);
}

/* --- Load More --- */

.dtec-history__load-more {
	display: flex;
	justify-content: center;
}

.dtec-history__load-more-btn {
	display: flex;
	width: 100%;
	height: 64px;
	padding: 20px 25px;
	justify-content: center;
	align-items: center;
	gap: 10px;
	flex: 1 0 0;
	border-radius: 5px;
	border: 1px solid var(--aubergine-gleam-500, #8F385D);
	background: var(--white, #FFF);
	color: var(--aubergine-gleam-500, #8F385D);
	font-size: 20px;
	font-weight: 700;
	line-height: normal;
	cursor: pointer;
	transition: background 150ms ease, color 150ms ease;
}

.dtec-history__load-more-btn:hover:not(:disabled) {
	background: var(--aubergine-gleam-500, #8F385D);
	color: var(--white, #FFF);
}

.dtec-history__load-more-btn:hover:not(:disabled) svg path {
	stroke: var(--white, #FFF);
}

.dtec-history__load-more-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* --- Responsive --- */

@media (max-width: 980px) {
	.dtec-history__header {
		flex-direction: column;
		align-items: flex-start;
		gap: 20px;
	}

	.dtec-history__card {
		padding: 20px 32px;
	}

	.dtec-history__order-id,
	.dtec-history__order-total {
		font-size: 24px;
	}

	.dtec-history__meta-item,
	.dtec-history__meta-date {
		font-size: 16px;
	}
}

@media (max-width: 768px) {
	.dtec-history__filter {
		flex-wrap: wrap;
		gap: 10px;
	}

	.dtec-history__card {
		padding: 16px 20px;
	}

	.dtec-history__row {
		flex-direction: column;
		align-items: flex-start;
		gap: 16px;
		padding: 24px 0;
	}

	.dtec-history__order-id,
	.dtec-history__order-total {
		font-size: 20px;
	}

	.dtec-history__row-top {
		gap: 12px;
	}

	.dtec-history__row-items {
		white-space: normal;
	}

	.dtec-history__receipt-btn {
		font-size: 16px;
		padding: 14px 18px;
		height: auto;
		width: 100%;
	}

	.dtec-history__row-action {
		width: 100%;
	}

	.dtec-history__load-more-btn {
		font-size: 16px;
		height: 48px;
	}

}

@media (max-width: 480px) {
	.dtec-history__card {
		padding: 12px 16px;
	}

	.dtec-history__filter-sep {
		display: none;
	}

	.dtec-history__filter-input {
		width: 100%;
	}

	.dtec-history__filter {
		width: 100%;
	}

	.dtec-history__row-top {
		flex-wrap: wrap;
		gap: 8px;
	}

	.dtec-history__row-sep {
		display: none;
	}

	.dtec-history__order-id,
	.dtec-history__order-total {
		font-size: 18px;
	}

	.dtec-history__meta-item,
	.dtec-history__meta-date {
		font-size: 14px;
	}

	.dtec-history__row-items {
		font-size: 14px;
	}
}


/* ==========================================================================
   Receipt Modal
   ========================================================================== */

.dtec-receipt-modal__overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.4);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10000;
	animation: dtec-receipt-fade-in 200ms ease;
}

@keyframes dtec-receipt-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

.dtec-receipt-modal {
	background: var(--white, #FFF);
	border: 2px solid var(--aubergine-gleam-500, #8F385D);
	border-radius: 20px;
	padding: 40px;
	max-width: 560px;
	width: 90%;
	max-height: 85vh;
	overflow-y: auto;
	position: relative;
	animation: dtec-receipt-slide-up 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes dtec-receipt-slide-up {
	from { opacity: 0; transform: translateY(20px); }
	to { opacity: 1; transform: translateY(0); }
}

.dtec-receipt-modal__loading {
	text-align: center;
	padding: 40px 0;
	font-size: 18px;
	color: var(--medium-gray, rgba(46, 40, 38, 0.75));
}

.dtec-receipt-modal__error {
	text-align: center;
	padding: 20px 0;
}

.dtec-receipt-modal__error p {
	font-size: 16px;
	color: var(--dtec-error, #ef4444);
	margin: 0 0 20px;
}

.dtec-receipt-modal__close-btn {
	display: inline-flex;
	padding: 12px 24px;
	border: 1px solid var(--aubergine-gleam-500, #8F385D);
	border-radius: 5px;
	background: var(--white, #FFF);
	color: var(--aubergine-gleam-500, #8F385D);
	font-size: 16px;
	font-weight: 700;
	cursor: pointer;
}

/* --- Close X button --- */

.dtec-receipt-modal__close {
	position: absolute;
	top: 16px;
	right: 16px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: background 150ms ease;
}

.dtec-receipt-modal__close:hover {
	background: rgba(46, 40, 38, 0.08);
}

/* --- Header --- */

.dtec-receipt-modal__header {
	margin-bottom: 24px;
	padding-bottom: 20px;
	border-bottom: 1px solid var(--aubergine-gleam-300, #DC98B5);
}

.dtec-receipt-modal__title {
	font-size: 28px;
	font-weight: 600;
	color: var(--dark-gray, #2E2826);
	margin: 0 0 6px;
}

.dtec-receipt-modal__date {
	font-size: 16px;
	font-weight: 400;
	color: var(--medium-gray, rgba(46, 40, 38, 0.75));
}

/* --- Sections --- */

.dtec-receipt-modal__section {
	padding: 20px 0;
	border-bottom: 1px solid var(--aubergine-gleam-300, #DC98B5);
}

.dtec-receipt-modal__section:last-child {
	border-bottom: none;
	padding-bottom: 0;
}

.dtec-receipt-modal__section-title {
	font-size: 18px;
	font-weight: 700;
	color: var(--dark-gray, #2E2826);
	margin: 0 0 12px;
}

/* --- Meta (plan / frequency / meal count) --- */

.dtec-receipt-modal__meta {
	display: flex;
	gap: 32px;
	flex-wrap: wrap;
}

.dtec-receipt-modal__meta-item {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.dtec-receipt-modal__meta-label {
	font-size: 13px;
	font-weight: 600;
	color: var(--medium-gray, rgba(46, 40, 38, 0.75));
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.dtec-receipt-modal__meta-value {
	font-size: 18px;
	font-weight: 600;
	color: var(--dark-gray, #2E2826);
}

/* --- Delivery date chips --- */

.dtec-receipt-modal__dates {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.dtec-receipt-modal__date-chip {
	display: inline-flex;
	padding: 6px 14px;
	border: 1px solid var(--aubergine-gleam-500, #8F385D);
	border-radius: 20px;
	font-size: 14px;
	font-weight: 600;
	color: var(--aubergine-gleam-500, #8F385D);
	background: var(--white, #FFF);
}

/* --- Item lists (meals / addons) --- */

.dtec-receipt-modal__items {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.dtec-receipt-modal__item {
	font-size: 16px;
	font-weight: 400;
	color: var(--dark-gray, #2E2826);
	padding: 4px 0;
}

/* --- Pricing breakdown --- */

.dtec-receipt-modal__pricing {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.dtec-receipt-modal__pricing-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 16px;
	font-weight: 400;
	color: var(--dark-gray, #2E2826);
}

.dtec-receipt-modal__pricing-row--discount {
	color: var(--lime-600, #8A9F15);
}

.dtec-receipt-modal__pricing-row--total {
	margin-top: 8px;
	padding-top: 12px;
	border-top: 1px solid var(--aubergine-gleam-300, #DC98B5);
	font-size: 20px;
	font-weight: 700;
	color: var(--dark-gray, #2E2826);
}

/* --- Receipt modal footer --- */

.dtec-receipt-modal__footer {
	display: flex;
	justify-content: center;
	padding-top: 20px;
}

.dtec-receipt-modal__copy-link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: none;
	border: none;
	color: var(--aubergine-gleam-500, #8F385D);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	padding: 8px 16px;
	border-radius: 5px;
	transition: background 150ms ease;
}

.dtec-receipt-modal__copy-link:hover {
	background: rgba(143, 56, 93, 0.06);
}

.dtec-receipt-modal__copy-link svg {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}

/* --- Receipt modal responsive --- */

@media (max-width: 768px) {
	.dtec-receipt-modal__overlay {
		align-items: flex-end;
	}

	.dtec-receipt-modal {
		padding: 28px 20px 36px;
		max-height: 90vh;
		width: 100%;
		max-width: 100%;
		border-radius: 20px 20px 0 0;
		border-bottom: none;
		animation: dtec-receipt-slide-up-mobile 300ms cubic-bezier(0.4, 0, 0.2, 1);
	}

	@keyframes dtec-receipt-slide-up-mobile {
		from { opacity: 0; transform: translateY(100%); }
		to { opacity: 1; transform: translateY(0); }
	}

	.dtec-receipt-modal__title {
		font-size: 22px;
	}

	.dtec-receipt-modal__meta {
		gap: 20px;
	}

	.dtec-receipt-modal__pricing-row--total {
		font-size: 18px;
	}
}
