/**
 * Amazing Orders & Reorder for WooCommerce — front-end styles.
 */

:root {
	--aorwc-accent: #111111;
	--aorwc-border: #e6e6e6;
	--aorwc-muted: #8a8a8a;
	--aorwc-radius: 10px;
}

.aorwc-wrap {
	color: #1a1a1a;
}

.woocommerce-orders-table__wrap {
	margin-bottom: 2rem;
}

/* Toolbar / search ------------------------------------------------------ */
.aorwc-toolbar {
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
	flex-wrap: wrap;
	gap: 1rem;
	margin: 0 0 1rem;
}

/* Date range ------------------------------------------------------------ */
.aorwc-daterange {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
}

.aorwc-daterange__field {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.aorwc-daterange__label {
	font-size: 11px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var( --aorwc-muted );
}

.aorwc-date {
	box-sizing: border-box;
	height: 46px;
	padding: 0 16px;
	border: 1px solid var( --aorwc-border );
	border-radius: 999px;
	font-size: 15px;
	line-height: normal;
	outline: none;
	transition: border-color 0.15s ease;
}

.aorwc-date:focus {
	border-color: var( --aorwc-accent );
}

/* Desktop: keep the date range and the search on a single row. */
@media ( min-width: 783px ) {
	.aorwc-toolbar {
		flex-wrap: nowrap;
	}

	.aorwc-daterange {
		flex: 0 0 auto;
	}

	.aorwc-search {
		flex: 0 1 320px;
		width: auto;
		min-width: 0;
	}

	.aorwc-search__input {
		min-width: 0;
	}
}

.aorwc-search {
	position: relative;
	display: inline-flex;
	align-items: center;
	width: 100%;
}

.aorwc-search__icon {
	position: absolute;
	left: 14px;
	opacity: 0.55;
	pointer-events: none;
	font-size: 14px;
}

.aorwc-search__input {
	width: 100%;
	box-sizing: border-box;
	height: 46px;
	padding: 0 16px;
	border: 1px solid var( --aorwc-border );
	border-radius: 999px;
	font-size: 15px;
	line-height: normal;
	outline: none;
	transition: border-color 0.15s ease;
}

.aorwc-search__input:focus {
	border-color: var( --aorwc-accent );
}

#aorwc-search {
	padding-left: 38px;
}

.aorwc-search__spinner {
	position: absolute;
	right: 14px;
	width: 16px;
	height: 16px;
	border: 2px solid var( --aorwc-border );
	border-top-color: var( --aorwc-accent );
	border-radius: 50%;
	opacity: 0;
	animation: aorwc-spin 0.7s linear infinite;
}

.aorwc-search.is-loading .aorwc-search__spinner {
	opacity: 1;
}

/* Order rows ------------------------------------------------------------ */
.aorwc-list {
	border-top: 1px solid var( --aorwc-border );
}

.aorwc-order {
	display: grid;
	grid-template-columns: minmax( 0, 1fr ) auto;
	gap: 1.25rem 1.5rem;
	align-items: center;
	padding: 1.5rem 0;
	border-bottom: 1px solid var( --aorwc-border );
}

.aorwc-order__thumbs {
	grid-column: 1 / -1;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
}

.aorwc-thumb {
	display: block;
	width: 56px;
	height: 56px;
	flex: 0 0 auto;
}

.aorwc-thumb__img,
.aorwc-thumb img {
	width: 56px;
	height: 56px;
	object-fit: contain;
	border-radius: 6px;
	background: #fff;
}

.aorwc-thumb--hidden {
	display: none;
}

.aorwc-order__thumbs.is-expanded .aorwc-thumb--hidden {
	display: block;
}

.aorwc-thumb--more {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	border: 1px solid var( --aorwc-border );
	border-radius: 50%;
	background: #fff;
	font-family: inherit;
	font-weight: 600;
	font-size: 14px;
	line-height: 1;
	color: #333;
	white-space: nowrap;
	cursor: pointer;
	transition: border-color 0.15s ease;
}

.aorwc-thumb--more:hover {
	border-color: var( --aorwc-accent );
}

/* Meta columns ---------------------------------------------------------- */
.aorwc-order__meta {
	display: grid;
	grid-template-columns: repeat( 4, minmax( 0, 1fr ) );
	gap: 1rem;
}

.aorwc-col {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.aorwc-label {
	font-size: 11px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var( --aorwc-muted );
}

.aorwc-value {
	font-size: 16px;
	font-weight: 600;
	word-break: break-word;
}

.aorwc-status {
	text-transform: capitalize;
}

.aorwc-status--completed {
	color: #1a9d54;
}

.aorwc-status--processing,
.aorwc-status--on-hold {
	color: #b7791f;
}

.aorwc-status--cancelled,
.aorwc-status--failed,
.aorwc-status--refunded {
	color: #c0392b;
}

/* Actions --------------------------------------------------------------- */
.aorwc-order__actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
	align-items: stretch;
	justify-self: end;
	min-width: 150px;
}

/*
 * .aorwc-btn is layout-only. The visible styling comes from the theme's native
 * .button / .wp-element-button / .woocommerce-button classes, so the buttons
 * always match the rest of the store. Set an accent color in the settings to
 * override (emitted as the inline #aorwc-accent style).
 */
.aorwc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	text-decoration: none;
	cursor: pointer;
}

.aorwc-order__actions .aorwc-btn {
	width: 100%;
	text-align: center;
}

.aorwc-btn.is-loading {
	opacity: 0.6;
	pointer-events: none;
}

/*
 * Cancel action: muted by default so Pay/Details stand out. Higher specificity
 * than the theme's .button; a color set in the settings overrides it (!important).
 */
.aorwc-order__actions .aorwc-btn--cancel {
	background: transparent;
	border-color: var( --aorwc-border );
	color: var( --aorwc-muted );
}

.aorwc-order__actions .aorwc-btn--cancel:hover,
.aorwc-order__actions .aorwc-btn--cancel:focus {
	background: transparent;
	border-color: var( --aorwc-muted );
	color: #1a1a1a;
}

/* Review prompt --------------------------------------------------------- */
.aorwc-review {
	display: flex;
	flex-direction: column;
	align-items: center;
	margin-top: 2.5rem;
	padding: 2rem 1.5rem;
	border: 1px solid var( --aorwc-border );
	border-radius: var( --aorwc-radius );
	text-align: center;
}

.aorwc-review > * {
	margin-left: auto;
	margin-right: auto;
}

.aorwc-review__title {
	margin: 0 0 0.5rem;
	font-size: 22px;
}

.aorwc-review__stars {
	font-size: 22px;
	letter-spacing: 3px;
	margin-bottom: 1rem;
}

.aorwc-review__image {
	display: block;
	margin-bottom: 1.25rem;
}

.aorwc-review__image img {
	max-width: 160px;
	height: auto;
}

/* Pagination / empty ---------------------------------------------------- */
.aorwc-pagination {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	justify-content: center;
	align-items: center;
	margin: 1.75rem 0 0;
}

.aorwc-page {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 42px;
	height: 42px;
	padding: 0 12px;
	border: 1px solid var( --aorwc-border );
	border-radius: 9px;
	background: #fff;
	color: #1a1a1a;
	font-weight: 600;
	text-decoration: none;
	transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.aorwc-page:hover {
	border-color: var( --aorwc-accent );
	text-decoration: none;
}

.aorwc-page--current {
	background: var( --aorwc-accent );
	border-color: var( --aorwc-accent );
	color: #fff;
	cursor: default;
}

.aorwc-page--dots {
	min-width: auto;
	padding: 0 4px;
	border: 0;
	background: transparent;
	color: var( --aorwc-muted );
	font-weight: 600;
}

.aorwc-empty {
	text-align: center;
	padding: 3rem 1rem;
	color: var( --aorwc-muted );
}

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

/* Responsive ------------------------------------------------------------ */
@media ( max-width: 782px ) {
	.aorwc-order {
		grid-template-columns: 1fr;
	}

	.aorwc-order__meta {
		grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	}

	.aorwc-order__actions {
		flex-direction: row;
		justify-self: stretch;
	}

	.aorwc-order__actions .aorwc-btn {
		flex: 1;
	}

	.aorwc-toolbar {
		justify-content: stretch;
	}

	.aorwc-search {
		max-width: none;
	}
}

@media ( max-width: 480px ) {
	.aorwc-order__meta {
		grid-template-columns: 1fr 1fr;
	}
}

/* Accessibility helper ---------------------------------------------------- */
.aorwc-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect( 0 0 0 0 );
	white-space: nowrap;
	border: 0;
}

/* Filters group + status select ----------------------------------------- */
.aorwc-filters {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.75rem;
}

.aorwc-statusfilter {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

select.aorwc-date {
	padding-right: 34px;
	cursor: pointer;
	background: #fff;
}

/* Tracking column ------------------------------------------------------- */
.aorwc-tracking {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.aorwc-tracking__item {
	font-size: 14px;
}

/* Toast ----------------------------------------------------------------- */
.aorwc-toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	transform: translate( -50%, 20px );
	background: #111;
	color: #fff;
	padding: 12px 22px;
	border-radius: 999px;
	font-size: 15px;
	z-index: 100001;
	opacity: 0;
	transition: opacity 0.25s ease, transform 0.25s ease;
	box-shadow: 0 6px 24px rgba( 0, 0, 0, 0.25 );
}

.aorwc-toast.is-visible {
	opacity: 1;
	transform: translate( -50%, 0 );
}

/* Choose-items modal ---------------------------------------------------- */
.aorwc-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
}

.aorwc-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba( 0, 0, 0, 0.5 );
}

.aorwc-modal__dialog {
	position: relative;
	background: #fff;
	color: #1a1a1a;
	border-radius: 12px;
	max-width: 520px;
	width: calc( 100% - 32px );
	max-height: 85vh;
	overflow: auto;
	padding: 24px;
	box-shadow: 0 10px 40px rgba( 0, 0, 0, 0.25 );
}

.aorwc-modal__close {
	position: absolute;
	top: 10px;
	right: 12px;
	border: 0;
	background: transparent;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	color: #666;
}

.aorwc-modal__title {
	margin: 0 0 1rem;
	font-size: 20px;
}

.aorwc-modal__list {
	list-style: none;
	margin: 0 0 1.25rem;
	padding: 0;
}

.aorwc-modal__item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 0;
	border-bottom: 1px solid var( --aorwc-border );
}

.aorwc-modal__item > label {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 1;
	cursor: pointer;
	margin: 0;
}

.aorwc-modal__thumb img {
	width: 40px;
	height: 40px;
	object-fit: contain;
	border-radius: 4px;
}

.aorwc-modal__qty {
	width: 68px;
	height: 40px;
	padding: 4px 8px;
	border: 1px solid var( --aorwc-border );
	border-radius: 8px;
	background: #fff;
	color: #1a1a1a;
	font-size: 15px;
	font-weight: 600;
	text-align: center;
	box-sizing: border-box;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.aorwc-modal__qty:focus {
	outline: none;
	border-color: var( --aorwc-accent );
	box-shadow: 0 0 0 3px rgba( 17, 17, 17, 0.08 );
}

.aorwc-modal__qty:disabled {
	background: #f4f4f4;
	color: #b3b3b3;
	cursor: not-allowed;
}

.aorwc-modal__badge {
	display: inline-block;
	margin-left: 8px;
	font-size: 11px;
	color: #c0392b;
}

.aorwc-modal__submit {
	width: 100%;
}

/* Buy it again grid ----------------------------------------------------- */
.aorwc-ba-section {
	margin: 2rem 0;
}

.aorwc-ba-heading {
	margin: 0 0 1rem;
	font-size: 20px;
}

.aorwc-view-reorder {
	margin-top: 1rem;
}

.aorwc-buyagain {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 160px, 1fr ) );
	gap: 1.25rem;
}

/* Fixed column count (Buy it again — columns setting). */
.aorwc-buyagain--cols {
	grid-template-columns: repeat( var( --aorwc-ba-cols, 4 ), minmax( 0, 1fr ) );
}

@media ( max-width: 600px ) {
	.aorwc-buyagain--cols {
		grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	}
}

/* Compact layout — denser cards for the dashboard/tab strips. */
.aorwc-buyagain--compact {
	gap: 0.85rem;
}

.aorwc-buyagain--compact .aorwc-ba-card {
	padding: 10px;
	gap: 6px;
}

.aorwc-buyagain--compact .aorwc-ba-card__image img {
	max-width: 76px;
}

.aorwc-buyagain--compact .aorwc-ba-card__title {
	font-size: 14px;
}

.aorwc-buyagain--compact .aorwc-ba-card__price {
	font-size: 13px;
}

.aorwc-buyagain--compact .aorwc-btn--buyagain,
.aorwc-buyagain--compact .woocommerce-button {
	padding: 5px 10px !important;
}

.aorwc-ba-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 8px;
	border: 1px solid var( --aorwc-border );
	border-radius: var( --aorwc-radius );
	padding: 16px;
}

.aorwc-ba-card__image img {
	max-width: 120px;
	height: auto;
}

.aorwc-ba-card__title {
	font-weight: 600;
	color: inherit;
	text-decoration: none;
}

.aorwc-ba-card__price {
	color: var( --aorwc-muted );
	font-size: 14px;
}

.aorwc-ba-card__action {
	display: flex;
	justify-content: center;
	width: 100%;
	margin-top: auto;
}

/* Inline review form ---------------------------------------------------- */
.aorwc-review__form {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	width: 100%;
	max-width: 420px;
}

.aorwc-stars-input {
	display: inline-flex;
	flex-direction: row-reverse;
	justify-content: center;
	gap: 2px;
}

.aorwc-stars-input input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.aorwc-stars-input label {
	font-size: 30px;
	line-height: 1;
	color: #d9d9d9;
	cursor: pointer;
	transition: color 0.1s ease;
	margin: 0;
}

.aorwc-stars-input label:hover,
.aorwc-stars-input label:hover ~ label,
.aorwc-stars-input input:checked ~ label {
	color: #f4b400;
}

.aorwc-stars-input input:focus + label {
	outline: 2px solid var( --aorwc-accent );
	outline-offset: 2px;
}

.aorwc-review__text {
	width: 100%;
	border: 1px solid var( --aorwc-border );
	border-radius: 8px;
	padding: 10px 12px;
	font: inherit;
	box-sizing: border-box;
}

.aorwc-review__actions {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 14px;
}

.aorwc-review__dismiss {
	background: none;
	border: 0;
	color: var( --aorwc-muted );
	text-decoration: underline;
	cursor: pointer;
	font: inherit;
}

.aorwc-review__msg {
	min-height: 1em;
	font-size: 14px;
}

.aorwc-review__msg.is-error {
	color: #c0392b;
}

.aorwc-review--done {
	color: #1a9d54;
	text-align: center;
	padding: 1.5rem;
}
