/**
 * EDD Product Packages - Frontend Styles
 */

/* ─── Selector wrapper ─── */
.rt-pkg-selector-wrap {
	position: relative;
	margin: 24px 0;
	padding: 30px;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 0 30px rgba(0, 0, 0, 0.05);
}

/* ─── Header ─── */
.rt-pkg-header {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	margin-bottom: 18px;
	padding-bottom: 16px;
	border-bottom: 1px solid #f1f5f9;
}

.rt-pkg-header-icon {
	color: #4545ff;
	flex-shrink: 0;
	margin-top: 4px;
}

.rt-pkg-header h4 {
	margin: 0 !important;
	padding: 0 !important;
	font-size: 16px;
	font-weight: 700;
	color: #0f172a;
	line-height: 1.3;
}

.rt-pkg-subtitle {
	font-size: 13px;
	color: #64748b;
	line-height: 1.3;
}

/* ─── Options list ─── */
.rt-pkg-options {
	display: flex;
	flex-direction: column;
	gap: 15px;
}

/* ─── Individual option card ─── */
#edd_checkout_form_wrap .rt-pkg-option {
	position: relative;
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 16px 15px;
	border: 1px solid #e2e8f0;
	border-radius: 6px;
	background: #fff;
	cursor: pointer;
	transition: all 0.2s ease;
	margin-bottom: 0;
}

#edd_checkout_form_wrap .rt-pkg-option:has(input[type="radio"]:checked) {
	border-color: #4545ff;
	box-shadow: none;
}

/* ─── Custom radio button ─── */
.rt-pkg-radio-wrap {
	position: relative;
	flex-shrink: 0;
	margin-top: 1px;
}

.rt-pkg-radio-wrap input[type="radio"] {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.rt-pkg-radio-custom {
	display: block;
	width: 20px;
	height: 20px;
	border: 2px solid #cbd5e1;
	border-radius: 50%;
	background: #fff;
	transition: all 0.15s ease;
	box-sizing: border-box;
}

.rt-pkg-radio-custom::after {
	content: '';
	display: block;
	width: 10px;
	height: 10px;
	margin: 3px;
	border-radius: 50%;
	background: transparent;
	transition: background 0.15s ease;
}

.rt-pkg-radio-wrap input[type="radio"]:checked + .rt-pkg-radio-custom {
	border-color: #4545ff;
}

.rt-pkg-radio-wrap input[type="radio"]:checked + .rt-pkg-radio-custom::after {
	background: #4545ff;
}

/* ─── Content block ─── */
.rt-pkg-content {
	display: flex;
	flex-direction: column;
	gap: 4px;
	flex: 1;
	min-width: 0;
}

/* ─── Title ─── */
.rt-pkg-title {
	font-weight: 600;
	font-size: 15px;
	color: #0f172a;
	line-height: 1.3;
}

/* ─── Description ─── */
.rt-pkg-description {
	font-size: 14px;
	color: #64748b;
	line-height: 1.5;
	font-weight: 400;
}

/* ─── Price tag (right-aligned, top) ─── */
.rt-pkg-price-tag {
	flex-shrink: 0;
	text-align: right;
	margin-left: auto;
	padding-left: 12px;
	align-self: flex-start;
	line-height: 1.6;
}

/* ─── Collapsible content area ─── */
.rt-pkg-collapsible {
	display: flex;
	flex-direction: column;
	gap: 4px;
	max-height: 80px;
	overflow: hidden;
	position: relative;
	transition: max-height 0.3s ease;
}

.rt-pkg-collapsible.rt-pkg-collapsible--expanded {
	max-height: none;
	margin-bottom: 6px;
}

/* Fade-out gradient at the bottom when collapsed and overflowing */
.rt-pkg-collapsible.rt-pkg-collapsible--overflowing::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 30px;
	background: linear-gradient(to bottom, transparent, #fff);
	pointer-events: none;
}

.rt-pkg-collapsible.rt-pkg-collapsible--expanded::after {
	display: none;
}

/* Show more / Show less toggle */
.rt-pkg-toggle-more {
	display: none;
	background: none;
	border: none;
	padding: 0;
	margin: 0;
	cursor: pointer;
	font-size: 12px;
	font-weight: 600;
	color: #4545ff;
	text-align: left;
	line-height: 1;
}

.rt-pkg-toggle-more:hover {
	text-decoration: underline;
}

.rt-pkg-toggle-more.rt-pkg-toggle--visible {
	display: inline-block;
	background-color: transparent;
}

.rt-pkg-amount {
	display: block;
	font-weight: 700;
	font-size: 16px;
	color: #0f172a;
	white-space: nowrap;
}

.rt-pkg-option:has(input[type="radio"]:checked) .rt-pkg-amount {
	color: #4545ff;
}

.rt-pkg-pct {
	display: block;
	font-weight: 400;
	font-size: 11px;
	color: #94a3b8;
	margin-top: 1px;
}

/* ─── Features list ─── */
ul.rt-pkg-features,
.rt-pkg-selector-wrap ul.rt-pkg-features,
.rt-pkg-option ul.rt-pkg-features {
	list-style: none !important;
	margin: 6px 0 2px !important;
	padding: 0 !important;
	padding-left: 0 !important;
	display: flex;
	flex-wrap: wrap;
	gap: 4px 16px;
}

.rt-pkg-feature-item {
	display: flex;
	align-items: center;
	gap: 5px;
	font-size: 14px;
	color: #475569;
	line-height: 1.5;
	font-weight: 500;
}

.rt-pkg-check-icon {
	flex-shrink: 0;
	color: #059669;
}

/* ─── Sale badge ─── */
.rt-pkg-sale-badge {
	position: absolute;
	top: -9px;
	right: 16px;
	display: inline-block;
	padding: 2px 10px;
	background: linear-gradient(135deg, #059669, #10b981);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	border-radius: 4px;
	line-height: 1.5;
	box-shadow: 0 1px 3px rgba(5, 150, 105, 0.3);
}

/* ─── Sale price styling ─── */
.rt-pkg-regular-price {
	display: block;
	color: #94a3b8;
	font-weight: 400;
	font-size: 13px;
	text-decoration: line-through;
}

.rt-pkg-option--on-sale:has(input[type="radio"]:checked) .rt-pkg-amount {
	color: #0807ff;
}

/* ─── Cart fee remove link ─── */
a.rt-pkg-cart-remove {
	vertical-align: middle;
	cursor: pointer;
	color: inherit;
}

#edd_checkout_form_wrap  #edd_checkout_cart .edd_cart_remove_item_btn {
	width: auto;
	min-width: 1em;
}

/* ─── None option ─── */
#edd_checkout_form_wrap .rt-pkg-option--none {
	padding: 12px 18px;
	border-color: #e2e8f0;
	background: #fafafa;
}

#edd_checkout_form_wrap .rt-pkg-option--none:hover {
	background: #f8f8ff;
	border-color: #9e9eff;
}

#edd_checkout_form_wrap .rt-pkg-option--none:has(input[type="radio"]:checked) {
	background: #f8fafc;
	border-color: #94a3b8;
	border-style: solid;
	box-shadow: none;
}

#edd_checkout_form_wrap .rt-pkg-option--none:has(input[type="radio"]:checked) .rt-pkg-radio-custom {
	border-color: #64748b;
}

#edd_checkout_form_wrap .rt-pkg-option--none:has(input[type="radio"]:checked) .rt-pkg-radio-custom::after {
	background: #64748b;
}

#edd_checkout_form_wrap .rt-pkg-option--none .rt-pkg-title {
	color: #64748b;
	font-weight: 500;
	font-size: 14px;
}

#edd_checkout_form_wrap .rt-pkg-option--none .rt-pkg-price-tag {
	font-size: 14px;
	font-weight: 500;
	color: #94a3b8;
}

/* ─── Loading overlay ─── */
.rt-pkg-loading-overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(255, 255, 255, 0.6);
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10;
	backdrop-filter: blur(1px);
}

.rt-pkg-loading-overlay .spinner {
	float: none;
	margin: 0;
}

/* ─── Notice/error ─── */
.rt-pkg-notice {
	margin-top: 12px;
	padding: 10px 14px;
	background: #fef2f2;
	color: #991b1b;
	border: 1px solid #fecaca;
	border-radius: 6px;
	font-size: 13px;
}

/* ─── Receipt info ─── */
.rt-pkg-receipt-info {
	background: #f8fafc;
	padding: 12px 14px;
	border-radius: 6px;
	font-size: 14px;
	border: 1px solid #e2e8f0;
}

/* ─── Responsive ─── */
@media (max-width: 480px) {
	.rt-pkg-selector-wrap {
		padding: 16px;
	}

	.rt-pkg-option {
		flex-wrap: wrap;
		padding: 14px;
	}

	.rt-pkg-price-tag {
		width: 100%;
		text-align: left;
		padding-left: 34px;
		margin-top: 4px;
	}

	.rt-pkg-amount {
		display: inline;
		font-size: 15px;
	}

	.rt-pkg-regular-price {
		display: inline;
		margin-right: 6px;
	}

	.rt-pkg-pct {
		display: inline;
		margin-left: 4px;
	}
}
