/* SubPortal – Subscription Customer Portal for WooCommerce
 * Mobile-first card dashboard, pills, and modals. Scoped under .subportal-dashboard.
 */

/* --- Notice ------------------------------------------------------------- */

.subportal-notice {
	margin: 0 0 1em;
	padding: 0.75em 1em;
	border-left: 4px solid transparent;
	border-radius: 3px;
}

.subportal-notice--success {
	background: #f0f8f0;
	border-left-color: #46b450;
}

.subportal-notice--error {
	background: #fbeaea;
	border-left-color: #dc3232;
}

/* --- Cards -------------------------------------------------------------- */

.subportal-cards {
	display: flex;
	flex-direction: column;
	gap: 1em;
}

.subportal-card {
	display: flex;
	flex-direction: column;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	background: #fff;
	overflow: hidden;
}

/* One-shot highlight on the card an action was just performed on. */
.subportal-card--flash {
	animation: subportal-card-flash 1.6s ease-out 1;
}

@keyframes subportal-card-flash {
	0% {
		box-shadow: 0 0 0 4px rgba( 70, 180, 80, 0.5 );
	}
	100% {
		box-shadow: 0 0 0 4px rgba( 70, 180, 80, 0 );
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.subportal-card--flash {
		animation: none;
	}
}

.subportal-card__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5em;
	padding: 0.75em 1em;
	border-bottom: 1px solid #eee;
}

.subportal-card__number {
	font-weight: 600;
	text-decoration: none;
}

.subportal-card__schedule {
	display: block;
	font-size: 0.85em;
	line-height: 0.85em;
	color: #666;
}

.subportal-status {
	padding: 0.15em 0.65em;
	border-radius: 999px;
	font-size: 0.8em;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	background: #f0f0f0;
	color: #555;
}

.subportal-status--active {
	background: #e6f4ea;
	color: #1e7e34;
}

.subportal-status--on-hold {
	background: #fff8e1;
	color: #8a6d3b;
}

.subportal-status--cancelled,
.subportal-status--pending-cancel,
.subportal-status--expired {
	background: #fbeaea;
	color: #a94442;
}

.subportal-card__body {
	flex: 1;
	padding: 0.75em 1em;
}

.subportal-card__items {
	list-style: none;
	margin: 0 0 0.75em;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.6em;
}

.subportal-card__item {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.75em;
}

.subportal-card__item-image {
	flex: 0 0 auto;
	width: 56px;
	height: 56px;
	padding: 3px;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	background: #fff;
}

.subportal-card__item-image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.subportal-card__item-name {
	display: block;
	font-weight: 600;
}

.subportal-card__item-price {
	display: block;
	font-size: 0.9em;
	color: #666;
}

.subportal-card__item-side {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 0.75em;
	font-size: 0.9em;
	color: #444;
	white-space: nowrap;
}

.subportal-card__meta {
	display: flex;
	flex-direction: column;
	gap: 0.35em;
}

.subportal-card__meta-row {
	display: flex;
	justify-content: space-between;
	gap: 1em;
	font-size: 0.92em;
}

.subportal-card__meta-label {
	color: #666;
}

.subportal-card__meta-value {
	text-align: right;
}

.subportal-card__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5em;
	padding: 0.75em 1em;
	border-top: 1px solid #eee;
	background: #fafafa;
}

.subportal-card__actions .button {
	margin: 0;
	font-size: 0.88em;
}

.subportal-action--cancel {
	margin-left: auto;
	padding: 0;
	border: 0;
	background: none;
	color: #a94442;
	font-size: 0.88em;
	text-decoration: underline;
	cursor: pointer;
}

/* --- Pause preset pills -------------------------------------------------- */

.subportal-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4em;
	margin: 0 0 1em;
}

.subportal-pill {
	padding: 0.3em 0.9em;
	border: 1px solid #ccc;
	border-radius: 999px;
	background: #fff;
	font-size: 0.88em;
	cursor: pointer;
}

.subportal-pill.is-selected {
	border-color: #333;
	background: #333;
	color: #fff;
}

/* --- Modals -------------------------------------------------------------- */

.subportal-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1em;
	background: rgba( 0, 0, 0, 0.55 );
}

.subportal-modal[hidden] {
	display: none;
}

body.subportal-modal-open {
	overflow: hidden;
}

.subportal-modal__dialog {
	width: 100%;
	max-width: 460px;
	max-height: 90vh;
	overflow-y: auto;
	padding: 1.5em;
	border-radius: 8px;
	background: #fff;
}

.subportal-modal__dialog h3 {
	margin: 0 0 0.75em;
}

.subportal-modal__actions {
	display: flex;
	justify-content: flex-end;
	gap: 0.5em;
	margin-top: 1.25em;
}

.subportal-button--danger {
	background: #a94442;
	color: #fff;
}

.subportal-pause-date label,
.subportal-cancel-text label {
	display: block;
	margin-bottom: 0.25em;
	font-size: 0.9em;
	color: #666;
}

.subportal-pause-indefinite {
	display: block;
	margin-top: 0.5em;
	font-size: 0.9em;
}

.subportal-cancel-reasons {
	display: flex;
	flex-direction: column;
	gap: 0.4em;
	margin: 0 0 1em;
}

.subportal-cancel-reason {
	display: block;
}

.subportal-cancel-text textarea {
	width: 100%;
}
