/**
 * Public-facing styles for Self-Service Refunds
 *
 * IMPORTANT:
 * Keep these styles theme-friendly. Avoid hard-coded colors and "button theming".
 * Focus on layout/structure only, and let the active theme (and WooCommerce) style
 * typography, buttons, and form controls.
 *
 * @package    SelfServiceRefunds
 * @subpackage SelfServiceRefunds/assets/css
 * @since      1.0.0
 */

/* Utilities */
.ssr-visually-hidden {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

/* Refund Modal */
.ssr-refund-modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	z-index: 9999;
	align-items: center;
	justify-content: center;
	padding: 16px;
	box-sizing: border-box;
}

.ssr-refund-modal.active {
	display: flex;
}

.ssr-modal-content {
	/* Use system colors where supported; fallback to white for older browsers */
	background: Canvas;
	color: CanvasText;
	background: #fff;
	padding: 24px;
	border-radius: 4px;
	max-width: 600px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
	box-sizing: border-box;
}

.ssr-modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	margin-bottom: 16px;
}

.ssr-modal-header h2 {
	margin: 0;
}

.ssr-modal-close {
	background: none;
	border: none;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	padding: 0;
	color: rgba(0,0,0,0.25);
}

.ssr-modal-close:hover {
	background: transparent;
	color: rgba(0,0,0,0.5);
}

/* Forms: keep layout, let theme style inputs */
.ssr-form-group {
	margin-bottom: 16px;
}

.ssr-form-group > label {
	display: block;
	margin-bottom: 6px;
	font-weight: inherit;
}

label.ssr-label-strong {
	font-weight: 600;
}

/* Guest refund form: bold labels for clarity */
.ssr-guest-refund-form-wrapper .ssr-form-group > label,
.ssr-guest-refund-form-wrapper label.ssr-label-strong {
	font-weight: 600;
}

.ssr-form-group input[type="text"],
.ssr-form-group input[type="email"],
.ssr-form-group input[type="date"],
.ssr-form-group textarea,
.ssr-form-group select {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.ssr-form-group textarea {
	resize: vertical;
}

/* Refund type options */
.ssr-refund-type-option {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 8px 0;
}

.ssr-refund-type-option input[type="radio"] {
	flex: 0 0 auto;
}

/* Keep option text normal; the group label above is bold */
.ssr-refund-type-option {
	font-weight: normal;
}

.ssr-option-label {
	font-weight: normal;
}

/* Line Item Selection (minimal structure) */
.ssr-line-items {
	margin-top: 8px;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 4px;
	overflow: hidden;
}

.ssr-line-item {
	padding: 10px 12px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.ssr-line-item + .ssr-line-item {
	border-top: 1px solid rgba(0, 0, 0, 0.12);
}

.ssr-line-item-label {
	display: flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	flex: 1 1 auto;
	min-width: 0;
}

.ssr-line-item-header {
	background: rgba(0, 0, 0, 0.03);
}

.ssr-line-item-header .ssr-line-item-label,
.ssr-line-item-header .ssr-line-item-qty {
	cursor: default;
	pointer-events: none;
}

.ssr-line-item-header .ssr-line-item-name,
.ssr-line-item-header .ssr-line-item-qty-label {
	font-weight: 600;
}

.ssr-line-item-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ssr-line-item-qty {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 6px;
	flex: 0 0 auto;
	min-width: 90px;
}

.ssr-line-item-qty-label {
	font-size: 0.9em;
	opacity: 0.85;
}

.ssr-line-item-qty-input {
	width: 80px;
	max-width: 80px;
}

/* Non-refundable items */
.ssr-line-item-non-refundable {
	opacity: 0.6;
}

.ssr-line-item-non-refundable .ssr-line-item-label {
	cursor: not-allowed;
}

.ssr-line-item-non-refundable .ssr-line-item-checkbox:disabled {
	cursor: not-allowed;
}

.ssr-non-refundable-badge {
	font-size: 0.85em;
	font-weight: 600;
	color: rgba(0, 0, 0, 0.6);
	margin-left: 4px;
}

/* Actions: spacing only; theme styles buttons */
.ssr-form-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 16px;
}

/* Loading Spinner (neutral; adapts to text color) */
.ssr-loading {
	display: inline-block;
	width: 1em;
	height: 1em;
	border: 2px solid rgba(0, 0, 0, 0.2);
	border-top-color: currentColor;
	border-radius: 50%;
	animation: ssr-spin 1s linear infinite;
	vertical-align: middle;
	margin-right: 0.35em;
}

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

/* Messages: use WooCommerce classes; keep SSR spacing minimal */
.ssr-message {
	margin: 0 0 16px;
}

/* Tooltip */
.ssr-tooltip {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.25em;
	height: 1.25em;
	font-size: 0.85em;
	line-height: 1;
	border: 1px solid currentColor;
	border-radius: 999px;
	cursor: help;
	user-select: none;
}

.ssr-tooltip::after {
	content: attr(data-tooltip);
	position: absolute;
	left: 50%;
	bottom: calc(100% + 8px);
	transform: translateX(-50%);
	z-index: 10000;

	/* system colors where supported; fallback for older browsers */
	background: CanvasText;
	color: Canvas;
	background: rgba(0, 0, 0, 0.85);
	color: #fff;

	padding: 6px 8px;
	border-radius: 4px;
	font-size: 12px;
	line-height: 1.3;

	width: max-content;
	max-width: 260px;
	white-space: normal;

	opacity: 0;
	visibility: hidden;
	transition: opacity 0.12s ease-in-out, visibility 0.12s ease-in-out;
}

.ssr-tooltip:hover::after,
.ssr-tooltip:focus::after {
	opacity: 1;
	visibility: visible;
}

/* Notes / help text: spacing only */
.ssr-form-note,
.ssr-help-text {
	margin-top: 1em;
}

.ssr-form-note p,
.ssr-help-text p {
	margin: 0;
	font-size: 0.8em;
}

/* Guest form: do not enforce background/borders; keep width/layout only */
.ssr-guest-refund-form {
	width: 100%;
	max-width: none;
	margin: 0;
}

/* Refund History */
.ssr-refund-history {
	margin-top: 2em;
}

.ssr-refund-history-list {
	margin-top: 1em;
}

.ssr-refund-history-entry {
	margin-bottom: 1.5em;
	padding: 1.25em;
	border: 1px solid currentColor;
	border-width: 0 0 0 3px;
	border-radius: 2px;
	opacity: 0.9;
}

.ssr-refund-history-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	margin-bottom: 1em;
	flex-wrap: wrap;
	gap: 1em;
}

.ssr-refund-history-title {
	flex: 1;
	min-width: 200px;
}

.ssr-refund-history-title__heading {
	margin: 0 0 0.5em 0;
	font-size: 1.1em;
}

.ssr-refund-history-title__date {
	margin: 0;
	font-size: 0.9em;
	opacity: 0.8;
}

.ssr-refund-history-status {
	margin-left: 1em;
}

.ssr-status-badge {
	display: inline-block;
	padding: 0.3em 0.75em;
	border-radius: 3px;
	font-size: 0.85em;
	font-weight: 600;
	border: 1px solid currentColor;
	opacity: 0.8;
}

.ssr-status-pending {
	opacity: 0.9;
}

.ssr-status-processed {
	opacity: 0.9;
}

.ssr-status-rejected {
	opacity: 0.9;
}

.ssr-status-cancelled {
	opacity: 0.9;
}

.ssr-refund-history-details {
	margin-top: 1em;
}

.ssr-refund-history-detail {
	margin-bottom: 0 !important;
}

.ssr-refund-history-rejection {
	margin-top: 1em;
	padding: 1em;
	border: 1px solid currentColor;
	border-width: 1px;
	border-radius: 2px;
	opacity: 0.9;
}

.ssr-refund-history-rejection__heading {
	margin: 0 0 0.625em 0;
	font-weight: 600;
}

.ssr-refund-history-rejection__message {
	line-height: 1.6;
}

.ssr-refund-history-pending-message {
	margin: 1em 0 0 0;
	font-style: italic;
	opacity: 0.8;
}

.ssr-refund-history-actions {
	margin-top: 1em;
}

/* Mobile Responsive */
@media (max-width: 768px) {
	.ssr-modal-content {
		padding: 16px;
	}

	.ssr-refund-history-header {
		flex-direction: column;
	}

	.ssr-refund-history-status {
		margin-left: 0;
	}
}
