/**
 * SnappyReturns — customer portal styles.
 *
 * Separate from the admin stylesheet so a shopper never downloads dashboard
 * CSS, and an admin page never downloads this.
 *
 * Direction: logical properties throughout (margin-inline, inset-inline,
 * text-align: start), so Arabic and English share one file with nothing
 * mirrored by hand.
 *
 * Theme fit: colours come from custom properties with conservative fallbacks,
 * so the portal inherits a store's palette where one is exposed and still looks
 * deliberate where it is not. Selectors are single-class and unnested to keep
 * specificity low enough that a theme can override anything here without
 * !important.
 */

.snpr-portal {
	--snpr-bg: #fff;
	--snpr-border: #e2e4e7;
	--snpr-text: #1f2328;
	--snpr-muted: #6a7280;
	--snpr-accent: var(--wp--preset--color--primary, #2563eb);
	--snpr-accent-text: #fff;
	--snpr-danger: #b3261e;
	--snpr-success: #1a7f37;
	--snpr-radius: 10px;
	--snpr-gap: 16px;

	max-inline-size: 780px;
	margin-inline: auto;
	color: var(--snpr-text);
	font-size: 15px;
	line-height: 1.6;
}

.snpr-hidden {
	display: none !important;
}

.snpr-muted {
	color: var(--snpr-muted);
	font-size: 13px;
}

/* ---------------------------------------------------------------------------
 * Panels
 * ------------------------------------------------------------------------ */

.snpr-panel {
	padding: 20px;
	margin-block-end: var(--snpr-gap);
	background: var(--snpr-bg);
	border: 1px solid var(--snpr-border);
	border-radius: var(--snpr-radius);
}

.snpr-panel-title {
	margin-block: 0 14px;
	font-size: 16px;
	font-weight: 600;
}

.snpr-intro {
	padding-block-end: 4px;
	margin-block-end: var(--snpr-gap);
}

.snpr-policy-link {
	color: var(--snpr-accent);
}

.snpr-panel-success {
	border-color: var(--snpr-success);
	border-inline-start-width: 4px;
}

.snpr-success-code {
	font-weight: 600;
}

/* ---------------------------------------------------------------------------
 * Fields
 * ------------------------------------------------------------------------ */

.snpr-field {
	margin-block-end: 14px;
}

.snpr-label {
	display: block;
	margin-block-end: 6px;
	font-size: 14px;
	font-weight: 600;
}

.snpr-input {
	inline-size: 100%;
	padding: 10px 12px;
	background: var(--snpr-bg);
	border: 1px solid var(--snpr-border);
	border-radius: 8px;
	color: inherit;
	font: inherit;
	box-sizing: border-box;
}

.snpr-input:focus {
	border-color: var(--snpr-accent);
	outline: 2px solid transparent;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, .18);
}

.snpr-hint {
	margin-block-start: 6px;
	color: var(--snpr-muted);
	font-size: 13px;
}

.snpr-optional {
	color: var(--snpr-muted);
	font-weight: 400;
}

.snpr-required-hint {
	color: var(--snpr-danger);
}

/* ---------------------------------------------------------------------------
 * Buttons
 * ------------------------------------------------------------------------ */

.snpr-button {
	display: inline-block;
	padding: 11px 20px;
	background: #f2f3f5;
	border: 1px solid var(--snpr-border);
	border-radius: 8px;
	color: inherit;
	font: inherit;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: opacity .15s ease;
}

.snpr-button:hover {
	opacity: .88;
}

.snpr-button-primary {
	background: var(--snpr-accent);
	border-color: var(--snpr-accent);
	color: var(--snpr-accent-text);
}

.snpr-button-ghost {
	background: transparent;
}

.snpr-button:disabled,
.snpr-is-busy {
	opacity: .6;
	cursor: not-allowed;
}

.snpr-actions {
	display: flex;
	gap: 10px;
	margin-block-start: 18px;
}

/* ---------------------------------------------------------------------------
 * Order picker
 * ------------------------------------------------------------------------ */

.snpr-order-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.snpr-order-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding-block: 14px;
	border-block-end: 1px solid var(--snpr-border);
}

.snpr-order-row:last-child {
	border-block-end: 0;
}

.snpr-order-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 10px;
}

.snpr-order-total {
	font-weight: 600;
}

.snpr-order-summary {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 10px;
}

/* ---------------------------------------------------------------------------
 * Type and payout choices
 * ------------------------------------------------------------------------ */

.snpr-choice-group {
	display: grid;
	gap: 10px;
}

.snpr-choice {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 14px 16px;
	border: 1px solid var(--snpr-border);
	border-radius: 8px;
	cursor: pointer;
	transition: border-color .15s ease, background .15s ease;
}

.snpr-choice:hover {
	border-color: var(--snpr-accent);
}

/* Highlights the chosen option without any JavaScript keeping a class in sync. */
.snpr-choice:has(input:checked) {
	border-color: var(--snpr-accent);
	background: rgba(37, 99, 235, .05);
}

.snpr-choice input {
	margin-block-start: 4px;
	flex-shrink: 0;
}

.snpr-choice-body {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.snpr-choice-title {
	font-weight: 600;
}

.snpr-choice-hint {
	color: var(--snpr-muted);
	font-size: 13px;
}

/* ---------------------------------------------------------------------------
 * Items
 * ------------------------------------------------------------------------ */

.snpr-item {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 12px;
	padding: 14px;
	margin-block-end: 10px;
	border: 1px solid var(--snpr-border);
	border-radius: 8px;
	transition: border-color .15s ease, background .15s ease;
}

.snpr-item-selected {
	border-color: var(--snpr-accent);
	background: rgba(37, 99, 235, .04);
}

.snpr-item-main {
	display: flex;
	align-items: center;
	gap: 12px;
	cursor: pointer;
	min-inline-size: 0;
}

.snpr-item-thumb {
	inline-size: 56px;
	block-size: 56px;
	object-fit: cover;
	border-radius: 6px;
	flex-shrink: 0;
}

.snpr-item-info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-inline-size: 0;
}

.snpr-item-name {
	font-weight: 600;
	overflow-wrap: anywhere;
}

.snpr-item-price {
	color: var(--snpr-muted);
	font-size: 13px;
}

.snpr-item-qty {
	display: flex;
	align-items: center;
	gap: 8px;
}

.snpr-qty-label {
	color: var(--snpr-muted);
	font-size: 13px;
}

.snpr-qty-input {
	inline-size: 72px;
	text-align: center;
}

/* Spans every column so the exchange fields sit on their own full-width row. */
.snpr-item-exchange {
	grid-column: 1 / -1;
	padding-block-start: 12px;
	border-block-start: 1px dashed var(--snpr-border);
}

/* ---------------------------------------------------------------------------
 * Photos
 * ------------------------------------------------------------------------ */

.snpr-file {
	inline-size: 100%;
	font: inherit;
}

/* One row per photo: thumbnail, picker, remove button. Laid out with logical
 * properties throughout, so the remove button sits at the trailing edge in
 * both reading directions without a separate RTL rule. */

.snpr-photo-slots {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-block-start: 6px;
}

.snpr-photo-slot {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px;
	border: 1px solid var(--snpr-border);
	border-radius: 6px;
}

.snpr-photo-slot .snpr-photo-input {
	flex: 1 1 auto;
	min-inline-size: 0;
}

.snpr-photo-thumb {
	flex: 0 0 auto;
	inline-size: 48px;
	block-size: 48px;
	object-fit: cover;
	border-radius: 4px;
}

/* Round, quiet until hovered. Sized to the 44px touch target phones expect,
 * since removing a photo is most often a phone gesture. */
.snpr-photo-remove {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	inline-size: 28px;
	block-size: 28px;
	padding: 0;
	font-size: 18px;
	line-height: 1;
	color: var(--snpr-danger, #b32d2e);
	background: none;
	border: 1px solid var(--snpr-border);
	border-radius: 50%;
	cursor: pointer;
}

.snpr-photo-remove:hover,
.snpr-photo-remove:focus-visible {
	color: #fff;
	background: var(--snpr-danger, #b32d2e);
	border-color: var(--snpr-danger, #b32d2e);
}

.snpr-photo-add {
	display: inline-block;
	margin-block-start: 8px;
	padding: 6px 12px;
	font: inherit;
	color: inherit;
	background: none;
	border: 1px dashed var(--snpr-border);
	border-radius: 6px;
	cursor: pointer;
}

.snpr-photo-add:hover,
.snpr-photo-add:focus-visible {
	border-style: solid;
}

/* `hidden` loses to the display above without this, which would leave the add
 * button on screen after the limit is reached. */
.snpr-photo-add[hidden] {
	display: none;
}

/* ---------------------------------------------------------------------------
 * Terms and notices
 * ------------------------------------------------------------------------ */

.snpr-terms {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-block-start: 8px;
	cursor: pointer;
}

.snpr-terms input {
	margin-block-start: 4px;
	flex-shrink: 0;
}

.snpr-notice {
	padding: 14px 16px;
	margin-block-start: var(--snpr-gap);
	border-radius: 8px;
	border-inline-start: 4px solid var(--snpr-danger);
	background: #fdf2f2;
	color: var(--snpr-danger);
}

.snpr-notice-success {
	border-inline-start-color: var(--snpr-success);
	background: #f0f9f2;
	color: var(--snpr-success);
}

.snpr-warnings {
	margin-block-start: 10px;
	padding-inline-start: 20px;
	color: var(--snpr-muted);
	font-size: 13px;
}

/* ---------------------------------------------------------------------------
 * My Account
 * ------------------------------------------------------------------------ */

.snpr-rejection-reason {
	margin-block-start: 6px;
	color: var(--snpr-muted);
	font-size: 13px;
}

/* ---------------------------------------------------------------------------
 * Small screens
 * ------------------------------------------------------------------------ */

@media screen and (max-width: 600px) {

	.snpr-item {
		grid-template-columns: auto 1fr;
	}

	/* Quantity drops to its own row rather than squeezing the product name. */
	.snpr-item-qty {
		grid-column: 1 / -1;
		justify-content: space-between;
	}

	.snpr-order-row {
		align-items: stretch;
		flex-direction: column;
	}

	.snpr-actions {
		flex-direction: column-reverse;
	}

	.snpr-button {
		inline-size: 100%;
		text-align: center;
	}
}

/* ---------------------------------------------------------------------------
 * My Account orders list
 * ------------------------------------------------------------------------ */

/* This cell renders inside a table the theme owns, and outside `.snpr-portal`,
 * so none of the custom properties defined there reach it. Every value here is
 * therefore literal rather than a var() with a fallback, and every property the
 * badge needs is stated rather than inherited: a theme that restyles spans,
 * or resets font-size inside table cells, must not be able to leave the badge
 * looking half-finished.
 *
 * The badge was originally styled only in the admin sheet and, in the portal,
 * only under a selector these tables never matched, which is why it landed here
 * unstyled. That scoped rule is gone; the badge now states its own appearance
 * wherever it appears on the front end. */

.snpr-return-cell {
	display: inline-flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
	text-align: start;
}

.snpr-return-cell .snpr-badge {
	display: inline-block;
	padding: 3px 10px;
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.6;
	text-transform: none;
	letter-spacing: normal;
	border: 0;
	border-radius: 12px;
	white-space: nowrap;
}

.snpr-return-summary {
	display: block;
	color: #6a7280;
	font-size: 12px;
	line-height: 1.5;
	text-transform: none;
}

/* ---------------------------------------------------------------------------
 * Returns tables — account Returns page and the order-details section
 *
 * Both render inside templates the theme owns, and outside `.snpr-portal`, so
 * none of the custom properties defined there reach them. Every value below is
 * literal for that reason, and every property these elements need is stated
 * rather than inherited: a theme that restyles table cells, strips their
 * padding, or resets font sizes must not be able to leave the section looking
 * half-finished. Tested against the default theme and page builders alike by
 * owning the appearance outright rather than matching any one of them.
 * ------------------------------------------------------------------------ */

.snpr-section {
	margin-block: 32px;
}

/* Page builders frequently zero out heading margins, which is what left the
 * title sitting flush against the table. Stated here so it cannot be lost. */
.snpr-section-title {
	margin-block: 0 12px;
	font-size: 1.15em;
	line-height: 1.4;
}

.snpr-returns-table {
	inline-size: 100%;
	margin-block: 0;
	border-collapse: collapse;
}

.snpr-returns-table th,
.snpr-returns-table td {
	padding-block: 12px;
	padding-inline: 12px;
	text-align: start;
	vertical-align: middle;
	border-block-end: 1px solid rgba(0, 0, 0, 0.08);
}

.snpr-returns-table thead th {
	font-weight: 600;
	font-size: 13px;
	line-height: 1.5;
	text-transform: none;
	letter-spacing: normal;
}

.snpr-returns-table tbody tr:last-child th,
.snpr-returns-table tbody tr:last-child td {
	border-block-end: 0;
}

/* The badge is given its full appearance here because it is only otherwise
 * styled in the admin sheet, and in the portal only under a selector that does
 * not match these tables — which is why it arrived unstyled. */
.snpr-returns-table .snpr-badge {
	display: inline-block;
	padding: 3px 10px;
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.6;
	text-transform: none;
	letter-spacing: normal;
	border: 0;
	border-radius: 12px;
	white-space: nowrap;
}

.snpr-item-count {
	display: block;
	margin-block-start: 4px;
	color: #6a7280;
	font-size: 12px;
	line-height: 1.5;
}

.snpr-returns-table .snpr-rejection-reason {
	margin-block: 6px 0;
	color: #6a7280;
	font-size: 12px;
	line-height: 1.5;
}

/* ---------------------------------------------------------------------------
 * Small screens
 *
 * WooCommerce ships the rules that turn `shop_table_responsive` into stacked
 * cards, but a theme that does not enqueue WooCommerce's own stylesheet never
 * gets them, and the table stays five columns wide on a phone. Restating them
 * here means the layout no longer depends on which theme is active. A
 * horizontal scrollbar was the alternative and is worse: reading one row would
 * mean dragging back and forth across it.
 * ------------------------------------------------------------------------ */

@media screen and (max-width: 768px) {

	.snpr-returns-table thead {
		display: none;
	}

	.snpr-returns-table,
	.snpr-returns-table tbody,
	.snpr-returns-table tr,
	.snpr-returns-table td {
		display: block;
		inline-size: auto;
	}

	.snpr-returns-table tr {
		margin-block-end: 12px;
		padding: 4px 0;
		border: 1px solid rgba(0, 0, 0, 0.12);
		border-radius: 8px;
	}

	.snpr-returns-table tr:last-child {
		margin-block-end: 0;
	}

	.snpr-returns-table td {
		display: flex;
		align-items: baseline;
		justify-content: space-between;
		gap: 12px;
		padding-block: 8px;
		text-align: end;
		border-block-end: 1px solid rgba(0, 0, 0, 0.06);
	}

	.snpr-returns-table tr td:last-child {
		border-block-end: 0;
	}

	/* The column heading each value belongs to, taken from the markup so the
	 * stacked card stays readable without its header row. */
	.snpr-returns-table td::before {
		content: attr(data-title);
		flex: 0 0 auto;
		color: #6a7280;
		font-size: 12px;
		font-weight: 600;
		text-align: start;
	}

	.snpr-item-count,
	.snpr-returns-table .snpr-rejection-reason {
		text-align: end;
	}
}

/* --------------------------------------------------------------------------- */

.snpr-account-pagination {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-block-start: 16px;
}

.snpr-account-empty .button {
	margin-inline-start: 8px;
}

/* ---------------------------------------------------------------------------
 * Single request detail
 *
 * Same approach as the tables above: literal values, every needed property
 * stated, no reliance on `.snpr-portal` custom properties, and logical
 * properties throughout so the page reads correctly in both directions.
 * ------------------------------------------------------------------------ */

.snpr-detail-back {
	margin-block: 0 16px;
	font-size: 13px;
}

.snpr-detail-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin-block-end: 16px;
}

.snpr-detail-code {
	margin: 0;
	font-size: 1.4em;
	line-height: 1.3;
}

.snpr-detail .snpr-badge {
	display: inline-block;
	padding: 3px 10px;
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.6;
	text-transform: none;
	letter-spacing: normal;
	border: 0;
	border-radius: 12px;
	white-space: nowrap;
}

.snpr-detail-subtitle {
	margin-block: 28px 10px;
	font-size: 1.05em;
	line-height: 1.4;
}

.snpr-detail-notice {
	margin-block-end: 20px;
	padding: 12px 14px;
	background: rgba(179, 45, 46, 0.06);
	border-inline-start: 3px solid #b32d2e;
	border-radius: 4px;
	font-size: 13px;
}

.snpr-detail-notice p {
	margin-block: 4px 0;
}

/* Two columns on anything roomy, stacked on a phone. Grid rather than a table
 * so the labels and values stay paired when they wrap. */
.snpr-detail-facts {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 8px 16px;
	margin: 0;
	font-size: 14px;
}

.snpr-detail-facts dt {
	margin: 0;
	color: #6a7280;
	font-size: 13px;
	font-weight: 600;
}

.snpr-detail-facts dd {
	margin: 0;
}

.snpr-detail-items {
	margin: 0;
	padding: 0;
	list-style: none;
}

.snpr-detail-item {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px 16px;
	padding-block: 10px;
	border-block-end: 1px solid rgba(0, 0, 0, 0.08);
}

.snpr-detail-item:last-child {
	border-block-end: 0;
}

.snpr-detail-item-name {
	flex: 1 1 60%;
}

.snpr-detail-item-meta {
	flex: 0 0 auto;
	color: #6a7280;
	font-size: 13px;
	white-space: nowrap;
}

.snpr-detail-note {
	margin: 0;
	padding: 12px 14px;
	background: rgba(0, 0, 0, 0.03);
	border-radius: 4px;
	font-size: 14px;
	white-space: pre-line;
}

/* The connecting line is drawn with a border on the list itself and dots on
 * each step, so there is nothing to redraw if a status is added or renamed. */
.snpr-timeline {
	margin: 0;
	padding: 0;
	padding-inline-start: 18px;
	border-inline-start: 2px solid rgba(0, 0, 0, 0.1);
	list-style: none;
}

.snpr-timeline-step {
	position: relative;
	padding-block: 6px;
	font-size: 14px;
}

.snpr-timeline-step::before {
	content: "";
	position: absolute;
	inset-block-start: 12px;
	inset-inline-start: -25px;
	inline-size: 10px;
	block-size: 10px;
	background: #fff;
	border: 2px solid rgba(0, 0, 0, 0.25);
	border-radius: 50%;
}

.snpr-timeline-step.is-current::before {
	background: #2271b1;
	border-color: #2271b1;
}

.snpr-timeline-label {
	font-weight: 600;
}

.snpr-timeline-date {
	display: block;
	color: #6a7280;
	font-size: 12px;
	line-height: 1.5;
}

@media screen and (max-width: 480px) {

	.snpr-detail-facts {
		grid-template-columns: 1fr;
		gap: 2px 0;
	}

	.snpr-detail-facts dd {
		margin-block-end: 10px;
	}
}
