/* My Orders page styles */
.container { max-width: 780px; margin: 0 auto; padding: 32px 24px 60px; }
.page-title { font-size: 24px; font-weight: 700; margin-bottom: 24px; }

/* Filter bar */
.filter-bar {
	display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap;
}
.filter-search {
	flex: 1; min-width: 180px; padding: 8px 12px; border: 1px solid var(--border);
	border-radius: var(--radius); font-size: 14px; background: var(--bg-surface);
}
.filter-search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79,70,229,0.1); }
.filter-select {
	padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius);
	font-size: 14px; background: var(--bg-surface); cursor: pointer; min-width: 130px;
}

/* Form group sections */
.form-group-section { margin-bottom: 32px; }
.form-group-title {
	font-size: 18px; font-weight: 600; color: var(--text);
	margin-bottom: 12px; padding-bottom: 8px;
	border-bottom: 1px solid var(--border);
}

/* Order cards */
.my-order-card {
	background: var(--bg-surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	margin-bottom: 10px;
	box-shadow: var(--shadow);
	overflow: hidden;
	transition: box-shadow 0.15s;
}
.my-order-card:hover { box-shadow: var(--shadow-lg); }

/* Status left border */
.my-order-card.status-pending { border-left: 3px solid #f59e0b; }
.my-order-card.status-confirmed { border-left: 3px solid #3b82f6; }
.my-order-card.status-ordered { border-left: 3px solid #6366f1; }
.my-order-card.status-shipped { border-left: 3px solid #8b5cf6; }
.my-order-card.status-delivered { border-left: 3px solid #10b981; }
.my-order-card.status-cancelled { border-left: 3px solid #ef4444; }

.my-order-summary {
	padding: 16px 20px; cursor: pointer; user-select: none;
}
.my-order-header {
	display: flex; justify-content: space-between; align-items: center;
	margin-bottom: 6px;
}
.my-order-date { font-size: 14px; font-weight: 600; color: var(--text); }
.my-order-items {
	font-size: 13px; color: var(--text-muted); line-height: 1.5;
	margin-bottom: 8px;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.my-order-footer {
	display: flex; justify-content: space-between; align-items: center;
	padding-top: 8px; border-top: 1px solid var(--gray-100);
}
.my-order-total { font-size: 16px; font-weight: 700; color: var(--text); }
.my-order-meta {
	display: flex; align-items: center; gap: 10px;
}
.my-order-id { font-size: 12px; color: var(--text-faint); font-family: monospace; }
.my-order-expand {
	font-size: 18px; color: var(--text-faint); transition: transform 0.2s;
	line-height: 1;
}
.my-order-card.expanded .my-order-expand { transform: rotate(180deg); }

/* Detail view */
.my-order-detail {
	display: none; padding: 0 20px 20px;
	border-top: 1px solid var(--gray-100);
}
.my-order-card.expanded .my-order-detail { display: block; }

/* Status progress bar */
.status-progress {
	display: flex; align-items: center; justify-content: space-between;
	margin: 16px 0 20px; position: relative;
}
.status-progress::before {
	content: ''; position: absolute; top: 14px; left: 24px; right: 24px;
	height: 3px; background: var(--gray-200); z-index: 0;
}
.status-step {
	display: flex; flex-direction: column; align-items: center;
	position: relative; z-index: 1; flex: 1;
}
.status-dot {
	width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--gray-200);
	background: var(--bg-surface); display: flex; align-items: center; justify-content: center;
	font-size: 12px; margin-bottom: 6px; transition: all 0.2s;
}
.status-step.active .status-dot {
	border-color: var(--primary); background: var(--primary); color: white;
}
.status-step.completed .status-dot {
	border-color: #10b981; background: #10b981; color: white;
}
.status-step-label {
	font-size: 11px; color: var(--text-faint); text-align: center;
}
.status-step.active .status-step-label,
.status-step.completed .status-step-label { color: var(--text); font-weight: 600; }

/* Cancelled state */
.status-progress.cancelled .status-step .status-dot {
	border-color: var(--border); background: var(--bg-surface); color: var(--gray-300);
}
.status-progress.cancelled .status-step.cancelled-step .status-dot {
	border-color: #ef4444; background: #ef4444; color: white;
}

/* Tracking section */
.tracking-section {
	background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: var(--radius);
	padding: 12px 16px; margin-bottom: 16px;
}
.tracking-label { font-size: 12px; font-weight: 600; color: #15803d; margin-bottom: 4px; }
.tracking-number {
	font-size: 15px; font-weight: 700; font-family: monospace; color: #166534;
	word-break: break-all;
}
.tracking-link {
	display: inline-block; margin-top: 6px; font-size: 13px; color: var(--primary);
	text-decoration: none; font-weight: 500;
}
.tracking-link:hover { text-decoration: underline; }

/* Detail sections */
.detail-section { margin-bottom: 16px; }
.detail-section-title {
	font-size: 12px; font-weight: 700; color: var(--text-faint);
	text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px;
}

/* Items table */
.detail-items-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.detail-items-table th {
	text-align: left; padding: 6px 8px; font-size: 11px; font-weight: 600;
	color: var(--text-muted); text-transform: uppercase; border-bottom: 1px solid var(--border);
}
.detail-items-table th:last-child { text-align: right; }
.detail-items-table td { padding: 8px; border-bottom: 1px solid var(--gray-100); color: var(--text); }
.detail-items-table td:last-child { text-align: right; font-weight: 600; }
.detail-items-table .shipping-row td { color: var(--text-muted); font-style: italic; }
.detail-items-table .discount-row td { color: #16a34a; }
.detail-items-table .total-row td {
	font-size: 15px; font-weight: 700; color: var(--text);
	border-top: 2px solid var(--gray-300); border-bottom: none;
}

/* Custom fields list */
.detail-fields { list-style: none; padding: 0; margin: 0; }
.detail-fields li {
	padding: 6px 0; border-bottom: 1px solid var(--gray-100); font-size: 13px;
	display: flex; gap: 8px;
}
.detail-fields li:last-child { border-bottom: none; }
.detail-field-label { color: var(--text-muted); min-width: 120px; flex-shrink: 0; }
.detail-field-value { color: var(--text); word-break: break-word; }

/* Shipping address */
.detail-address { font-size: 13px; line-height: 1.6; color: var(--text); }

/* Notes */
.detail-notes {
	font-size: 13px; color: var(--text-muted); line-height: 1.6;
	font-style: italic; background: var(--bg-surface-2); padding: 10px 14px;
	border-radius: var(--radius); border-left: 3px solid var(--gray-300);
}

/* Action buttons */
.detail-actions {
	display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px;
	padding-top: 16px; border-top: 1px solid var(--gray-100);
}
.detail-btn {
	padding: 8px 16px; font-size: 13px; font-weight: 600;
	border-radius: var(--radius); cursor: pointer; border: 1px solid var(--border);
	background: var(--bg-surface); color: var(--text); text-decoration: none;
	display: inline-flex; align-items: center; gap: 6px;
	transition: all 0.15s;
}
.detail-btn:hover { background: var(--bg-surface-2); border-color: var(--border-strong); }
.detail-btn-edit {
	background: #f0f9ff; color: #0369a1; border-color: #bae6fd;
}
.detail-btn-edit:hover { background: #e0f2fe; border-color: #7dd3fc; }
.detail-btn-primary {
	background: var(--primary); color: white; border-color: var(--primary);
}
.detail-btn-primary:hover { background: #4338ca; }
/* Mark-as-received button — green tint reads as a positive/affirmative
   action, distinct from the primary/edit/reorder buttons. Mirrors the
   light-tint pattern of .detail-btn-edit so the row stays visually balanced. */
.detail-btn-success {
	background: #f0fdf4; color: #15803d; border-color: #bbf7d0;
}
.detail-btn-success:hover { background: #dcfce7; border-color: #86efac; }

/* Contact modal */
.modal-backdrop {
	position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000;
	display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-card {
	background: var(--bg-surface); border-radius: var(--radius-lg); padding: 32px;
	max-width: 420px; width: 100%; box-shadow: var(--shadow-lg);
}

/* Badge */
.badge {
	display: inline-block; padding: 2px 10px; border-radius: 999px;
	font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}
.badge-pending { background: var(--warn-bg); color: #92400e; }
.badge-confirmed { background: #dbeafe; color: #1e40af; }
.badge-shipped { background: #ede9fe; color: #5b21b6; }
.badge-delivered { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }

/* Empty / no results */
.empty-state {
	text-align: center; padding: 60px 24px; color: var(--text-faint);
}
.empty-state h2 { font-size: 20px; color: var(--text-muted); margin-bottom: 8px; }
.empty-state p { font-size: 14px; margin-bottom: 24px; }

/* Payment proof */
.payment-proof-thumb {
	max-width: 120px; max-height: 80px; border-radius: var(--radius);
	border: 1px solid var(--border); cursor: pointer;
}

@media (max-width: 600px) {
	.container { padding: 20px 16px 40px; }
	.my-order-summary { padding: 14px 16px; }
	.filter-bar { flex-direction: column; }
	.filter-search, .filter-select { width: 100%; }
	.status-step-label { font-size: 10px; }
	.status-dot { width: 24px; height: 24px; font-size: 10px; }
	.detail-actions { flex-direction: column; }
	.detail-btn { width: 100%; justify-content: center; }
	.detail-items-table { font-size: 12px; }
}

/* =====================================================================
 * Buyer-side archive: filter toggles, archive button, archived-state card
 * ===================================================================== */

/* Toolbar checkbox toggles */
.filter-toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	color: var(--text);
	cursor: pointer;
	user-select: none;
	padding: 6px 10px;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--bg-surface);
}
.filter-toggle input { margin: 0; }
.filter-toggle:hover { border-color: var(--border-strong); }
.filter-toggle-count {
	color: var(--text-faint);
	font-size: 12px;
	font-weight: 500;
	margin-left: 2px;
}

/* Per-order archive/restore button */
.my-order-archive-btn {
	background: transparent;
	border: 1px solid var(--border);
	color: var(--text-muted);
	font-size: 12px;
	font-weight: 500;
	padding: 4px 10px;
	border-radius: 6px;
	cursor: pointer;
	transition: background .15s, color .15s, border-color .15s;
}
.my-order-archive-btn:hover {
	background: var(--bg-hover);
	color: var(--text);
	border-color: var(--border-strong);
}
.my-order-archive-btn.restore {
	color: var(--primary);
	border-color: var(--primary);
}
.my-order-archive-btn.restore:hover {
	background: var(--primary-light);
}
.my-order-archive-btn:disabled { opacity: .5; cursor: wait; }

/* Archived state — fade the card a bit so it reads as inactive */
.my-order-card.is-archived {
	opacity: .75;
}
.my-order-card.is-archived .my-order-summary {
	background: var(--bg-surface-2);
}
.my-order-archived-pill {
	display: inline-block;
	margin-left: 8px;
	padding: 1px 7px;
	font-size: 10px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--text-muted);
	background: var(--bg-hover);
	border-radius: 999px;
	vertical-align: middle;
}

/* Bulk-archive bar at the top of the list when there's stuff to clean up */
.my-orders-bulkbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 16px;
	margin-bottom: 16px;
	background: var(--primary-light);
	border: 1px solid var(--primary);
	border-radius: 10px;
	font-size: 13px;
	color: var(--text);
	flex-wrap: wrap;
}
.my-orders-bulkbar strong { color: var(--primary); }
.my-orders-bulk-btn {
	background: var(--primary);
	color: var(--primary-fg);
	border: none;
	font-size: 13px;
	font-weight: 600;
	padding: 6px 14px;
	border-radius: 6px;
	cursor: pointer;
}
.my-orders-bulk-btn:hover { background: var(--primary-hover); }

@media (max-width: 540px) {
	.filter-bar { flex-direction: column; align-items: stretch; }
	.filter-toggle { justify-content: flex-start; }
	.my-order-meta { flex-wrap: wrap; gap: 6px; }
}

/* =====================================================================
 * Multi-select / bulk actions
 * ===================================================================== */

/* Per-card checkbox */
.my-order-checkbox {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-right: 12px;
	padding: 6px;
	margin-left: -6px;
	cursor: pointer;
	flex-shrink: 0;
}
.my-order-checkbox input {
	width: 18px;
	height: 18px;
	margin: 0;
	cursor: pointer;
	accent-color: var(--primary);
}
.my-order-summary {
	display: flex;
	align-items: flex-start;
	gap: 0;
}
.my-order-summary > .my-order-header,
.my-order-summary > .my-order-items,
.my-order-summary > .my-order-footer {
	flex: 1 1 auto;
	min-width: 0;
}
.my-order-summary {
	flex-wrap: wrap;
}
.my-order-summary .my-order-header {
	flex-basis: 100%;
}
.my-order-summary .my-order-checkbox {
	flex-shrink: 0;
	order: -1;
}
/* Selected-state highlight */
.my-order-card.is-selected {
	border-color: var(--primary) !important;
	box-shadow: 0 0 0 2px var(--primary-light);
}

/* Selection-mode bulk bar variant */
.my-orders-bulkbar.selection {
	background: var(--bg-surface);
	border-color: var(--primary);
}
.my-orders-bulkbar-actions {
	display: inline-flex;
	gap: 8px;
	align-items: center;
	flex-wrap: wrap;
}
.my-orders-bulk-link {
	background: transparent;
	border: none;
	color: var(--text-muted);
	font-size: 12.5px;
	cursor: pointer;
	padding: 4px 6px;
	border-radius: 4px;
}
.my-orders-bulk-link:hover { color: var(--text); background: var(--bg-hover); }

/* =====================================================================
 * Review button + modal
 * ===================================================================== */
.my-order-review-btn {
	background: transparent;
	border: 1px solid var(--border);
	color: var(--text-muted);
	font-size: 12px;
	font-weight: 500;
	padding: 4px 10px;
	border-radius: 6px;
	cursor: pointer;
	transition: background .15s, color .15s, border-color .15s;
}
.my-order-review-btn:hover {
	background: var(--primary-light);
	color: var(--primary);
	border-color: var(--primary);
}
.my-order-review-btn.done {
	color: #f59e0b;
	border-color: #f59e0b;
	background: rgba(245, 158, 11, 0.08);
}
.my-order-review-btn.done:hover { background: rgba(245, 158, 11, 0.15); }

/* Modal */
.rev-modal-overlay {
	position: fixed; inset: 0;
	background: rgba(0,0,0,0.5);
	display: flex; align-items: center; justify-content: center;
	padding: 16px;
	z-index: 600;
}
.rev-modal {
	background: var(--bg-surface);
	border-radius: 14px;
	padding: 24px;
	width: 100%;
	max-width: 460px;
	position: relative;
	box-shadow: 0 20px 50px rgba(0,0,0,.3);
	max-height: 90vh;
	overflow-y: auto;
}
.rev-modal h3 { margin: 0 0 6px; font-size: 18px; color: var(--text); }
.rev-modal-close {
	position: absolute; top: 12px; right: 12px;
	background: transparent; border: none;
	font-size: 22px; line-height: 1;
	color: var(--text-muted); cursor: pointer;
	padding: 4px 8px; border-radius: 4px;
}
.rev-modal-close:hover { background: var(--bg-hover); color: var(--text); }
.rev-modal-banner {
	font-size: 12px;
	color: var(--primary);
	background: var(--primary-light);
	border-radius: 6px;
	padding: 8px 10px;
	margin: 8px 0 14px;
}
.rev-modal-banner.subtle {
	color: var(--text-muted);
	background: var(--bg-surface-2);
}
.rev-modal-stars {
	display: flex; gap: 4px;
	margin: 4px 0 16px;
}
.rev-star {
	background: transparent;
	border: none;
	font-size: 32px;
	line-height: 1;
	color: var(--border-strong);
	cursor: pointer;
	padding: 0 2px;
	transition: color .12s, transform .12s;
}
.rev-star.on { color: #f59e0b; }
.rev-star:hover { transform: scale(1.1); }
.rev-modal-label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: .04em;
	margin: 10px 0 6px;
}
.rev-req { color: var(--danger); }
.rev-modal textarea { resize: vertical; min-height: 90px; font-family: inherit; }
.rev-modal-foot {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
	margin-top: 16px;
}
