/**
 * PPA Purchase Modal Styles
 *
 * Modern, clean, light design with RTL support.
 *
 * @package ProjectProgressAutomation
 * @since   4.12.0
 */

/* ================================================
   1. Body scroll lock
   ================================================ */
body.ppa-pm-open {
	overflow: hidden !important;
}

/* ================================================
   2. Overlay & Backdrop
   ================================================ */
.ppa-pm-overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.ppa-pm-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.45);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
}

/* ================================================
   3. Container
   ================================================ */
.ppa-pm-container {
	position: relative;
	background: #ffffff;
	border-radius: 18px;
	box-shadow:
		0 25px 50px -12px rgba(0, 0, 0, 0.15),
		0 0 0 1px rgba(0, 0, 0, 0.04);
	width: 480px;
	max-width: 100%;
	max-height: 80vh;
	overflow: visible;
	padding: 22px 24px;
	direction: rtl;
	text-align: right;
	font-family: var(--e-global-typography-text-font-family, var(--theme-font-family, inherit));
	line-height: 1.5;
	color: #1e293b;
	animation: ppa-pm-enter 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ppa-pm-container::-webkit-scrollbar {
	width: 6px;
}

.ppa-pm-container::-webkit-scrollbar-track {
	background: transparent;
}

.ppa-pm-container::-webkit-scrollbar-thumb {
	background: #cbd5e1;
	border-radius: 3px;
}

/* ================================================
   4. Close button
   ================================================ */
.ppa-pm-close {
	position: absolute;
	top: 14px;
	left: 14px;
	width: 30px;
	height: 30px;
	border: none;
	background: #f1f5f9;
	color: #64748b;
	border-radius: 50%;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	padding: 0;
	z-index: 2;
}

.ppa-pm-close:hover,
.ppa-pm-close:focus {
	background: #e2e8f0 !important;
	color: #1e293b !important;
	transform: rotate(90deg);
	outline: none;
}

/* ================================================
   5. Header (product info)
   ================================================ */
.ppa-pm-header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 16px;
	padding-bottom: 14px;
	border-bottom: 1px solid #f1f5f9;
}

.ppa-pm-img {
	width: 52px;
	height: 52px;
	border-radius: 12px;
	object-fit: cover;
	flex-shrink: 0;
	border: 1px solid #f1f5f9;
}

.ppa-pm-info {
	flex: 1;
	min-width: 0;
}

.ppa-pm-title {
	font-size: 15px;
	font-weight: 700;
	color: #0f172a;
	margin: 0 0 2px;
	line-height: 1.3;
}

.ppa-pm-price {
	font-size: 13px;
	color: #6366f1;
	font-weight: 600;
}

.ppa-pm-price del {
	color: #94a3b8;
	font-weight: 400;
}

.ppa-pm-price ins {
	text-decoration: none;
}

/* ================================================
   6. Section labels
   ================================================ */
.ppa-pm-section {
	margin-bottom: 14px;
}

.ppa-pm-label {
	font-size: 13px;
	font-weight: 600;
	color: #475569;
	margin: 0 0 7px;
	display: flex;
	align-items: center;
	gap: 5px;
}

.ppa-pm-label i {
	font-size: 13px;
	color: #6366f1;
}

/* ================================================
   7. Variation cards
   ================================================ */
.ppa-pm-vars {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.ppa-pm-var-card {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 14px;
	border: 2px solid #e2e8f0;
	border-radius: 12px;
	cursor: pointer;
	transition: all 0.2s ease;
	background: #ffffff;
	position: relative;
	overflow: visible;
}

.ppa-pm-var-card:hover {
	border-color: #c7d2fe;
	background: #fafafe;
}

.ppa-pm-var-card.ppa-pm-var-selected {
	border-color: #6366f1;
	background: #eef2ff;
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.ppa-pm-var-card.ppa-pm-var-disabled {
	opacity: 0.5;
	cursor: not-allowed;
	background: #f8fafc;
}

.ppa-pm-var-card.ppa-pm-var-disabled:hover {
	border-color: #e2e8f0;
	background: #f8fafc;
}

/* Radio circle */
.ppa-pm-var-check {
	width: 18px;
	height: 18px;
	border: 2px solid #cbd5e1;
	border-radius: 50%;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
}

.ppa-pm-var-check span {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: transparent;
	transition: all 0.2s ease;
}

.ppa-pm-var-selected .ppa-pm-var-check {
	border-color: #6366f1;
}

.ppa-pm-var-selected .ppa-pm-var-check span {
	background: #6366f1;
}

/* Variation info */
.ppa-pm-var-details {
	flex: 1;
	min-width: 0;
}

.ppa-pm-var-name {
	font-size: 13px;
	font-weight: 600;
	color: #1e293b;
	line-height: 1.3;
}

/* Meta (price + description toggle) */
.ppa-pm-var-meta {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
	position: relative;
}

.ppa-pm-var-desc-toggle {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	border: none;
	background: transparent !important;
	color: #dc2626 !important;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	padding: 0;
	line-height: 1;
	-webkit-appearance: none;
	appearance: none;
	box-shadow: none !important;
}

.ppa-pm-var-desc-toggle:hover,
.ppa-pm-var-desc-toggle:focus {
	background: transparent !important;
	box-shadow: none !important;
	color: #b91c1c !important;
	outline: none;
}

.ppa-pm-var-desc-toggle:active {
	background: transparent !important;
	box-shadow: none !important;
}

.ppa-pm-var-desc-toggle i {
	color: currentColor !important;
}

.ppa-pm-var-desc-panel {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	min-width: 220px;
	max-width: 260px;
	background: #0f172a;
	border: 1px solid #1e293b;
	border-radius: 12px;
	padding: 10px 12px;
	font-size: 12px;
	color: #e2e8f0;
	line-height: 1.6;
	text-align: justify;
	box-shadow: 0 16px 32px rgba(2, 6, 23, 0.4);
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	transition: all 0.2s ease;
	z-index: 10;
}

.ppa-pm-var-desc-panel p {
	margin: 0;
}

.ppa-pm-var-card:hover .ppa-pm-var-desc-panel,
.ppa-pm-var-card.ppa-pm-var-desc-open .ppa-pm-var-desc-panel {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.ppa-pm-var-price {
	font-size: 13px;
	font-weight: 700;
	color: #6366f1;
	white-space: nowrap;
	flex-shrink: 0;
}

.ppa-pm-var-price del {
	color: #94a3b8;
	font-weight: 400;
	font-size: 12px;
}

.ppa-pm-var-price ins {
	text-decoration: none;
}

/* Out of stock badge */
.ppa-pm-oos-badge {
	position: absolute;
	top: -8px;
	left: 12px;
	background: #fef2f2;
	color: #dc2626;
	font-size: 11px;
	font-weight: 600;
	padding: 2px 10px;
	border-radius: 20px;
	border: 1px solid #fecaca;
}

/* ================================================
   8. Quantity controls
   ================================================ */
.ppa-pm-qty-section {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.ppa-pm-qty-section .ppa-pm-label {
	margin: 0;
}

.ppa-pm-qty-wrap {
	display: flex;
	align-items: center;
	gap: 6px;
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	padding: 4px 6px;
	box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.08);
}

.ppa-pm-qty-btn {
	width: 34px;
	height: 34px;
	border: 1px solid #e2e8f0;
	background: #f8fafc;
	color: #334155;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 8px;
	transition: all 0.2s ease;
	padding: 0;
	line-height: 1;
	-webkit-appearance: none;
	appearance: none;
}

.ppa-pm-qty-btn:hover {
	background: #eef2ff !important;
	color: #4338ca !important;
	border-color: #c7d2fe !important;
}

.ppa-pm-qty-input {
	width: 44px;
	height: 34px;
	border: 1px solid #e2e8f0;
	background: #ffffff;
	text-align: center;
	font-size: 14px;
	font-weight: 600;
	color: #1e293b;
	-moz-appearance: textfield;
	-webkit-appearance: none;
	appearance: none;
	padding: 0;
	border-radius: 8px;
}

.ppa-pm-qty-input::-webkit-inner-spin-button,
.ppa-pm-qty-input::-webkit-outer-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.ppa-pm-qty-input:focus {
	outline: none;
	border-color: #a5b4fc;
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* ================================================
   9. Terms checkbox
   ================================================ */
.ppa-pm-terms-section {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	padding: 12px 14px;
}

.ppa-pm-terms-label {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	cursor: pointer;
	font-size: 12px;
	line-height: 1.6;
	color: #475569;
}

.ppa-pm-terms-check {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.ppa-pm-terms-box {
	width: 20px;
	height: 20px;
	min-width: 20px;
	border: 2px solid #cbd5e1;
	border-radius: 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	margin-top: 1px;
	flex-shrink: 0;
}

.ppa-pm-terms-box::after {
	content: '';
	display: block;
	width: 6px;
	height: 10px;
	border: solid transparent;
	border-width: 0 2.5px 2.5px 0;
	transform: rotate(45deg);
	margin-bottom: 2px;
	transition: border-color 0.2s ease;
}

.ppa-pm-terms-check:checked + .ppa-pm-terms-box {
	background: #6366f1;
	border-color: #6366f1;
}

.ppa-pm-terms-check:checked + .ppa-pm-terms-box::after {
	border-color: #ffffff;
}

.ppa-pm-terms-text {
	flex: 1;
}

.ppa-pm-terms-text a {
	color: #6366f1;
	font-weight: 600;
	text-decoration: none;
}

.ppa-pm-terms-text a:hover {
	text-decoration: underline;
}

/* ================================================
   10. Error messages
   ================================================ */
.ppa-pm-error {
	color: #dc2626;
	font-size: 12px;
	font-weight: 500;
	margin-top: 6px;
	display: flex;
	align-items: center;
	gap: 4px;
}

.ppa-pm-error::before {
	content: '\f06a';
	font-family: 'Font Awesome 5 Free', 'Font Awesome 6 Free', sans-serif;
	font-weight: 900;
	font-size: 12px;
}

/* ================================================
   11. Submit button
   ================================================ */
.ppa-pm-footer {
	margin-top: 16px;
}

.ppa-pm-submit {
	width: 100%;
	padding: 12px 20px;
	border: none;
	border-radius: 12px;
	background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
	color: #ffffff !important;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	transition: all 0.25s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	-webkit-appearance: none;
	appearance: none;
	box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.ppa-pm-submit:hover {
	background: linear-gradient(135deg, #16a34a 0%, #15803d 100%) !important;
	box-shadow: 0 6px 20px rgba(34, 197, 94, 0.45) !important;
	transform: translateY(-1px);
}

.ppa-pm-submit:active {
	transform: translateY(0);
}

.ppa-pm-submit:disabled {
	opacity: 0.7;
	cursor: not-allowed;
	transform: none;
}

.ppa-pm-submit-loading {
	display: flex;
	align-items: center;
	gap: 8px;
}

/* ================================================
   12. Spinner
   ================================================ */
.ppa-pm-spinner {
	display: inline-block;
	width: 18px;
	height: 18px;
	border: 2.5px solid rgba(255, 255, 255, 0.3);
	border-top-color: #ffffff;
	border-radius: 50%;
	animation: ppa-pm-spin 0.6s linear infinite;
}

/* ================================================
   13. Animations
   ================================================ */
@keyframes ppa-pm-enter {
	from {
		opacity: 0;
		transform: translateY(24px) scale(0.96);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@keyframes ppa-pm-spin {
	to {
		transform: rotate(360deg);
	}
}

/* ================================================
   14. Responsive
   ================================================ */
@media screen and (max-width: 600px) {
	.ppa-pm-overlay {
		padding: 12px;
		align-items: flex-end;
	}

	.ppa-pm-container {
		width: 100%;
		max-height: 90vh;
		padding: 18px 20px;
		border-radius: 18px 18px 0 0;
		animation: ppa-pm-enter-mobile 0.35s cubic-bezier(0.16, 1, 0.3, 1);
	}

	.ppa-pm-header {
		gap: 10px;
		margin-bottom: 14px;
		padding-bottom: 12px;
	}

	.ppa-pm-img {
		width: 46px;
		height: 46px;
		border-radius: 10px;
	}

	.ppa-pm-title {
		font-size: 14px;
	}

	.ppa-pm-var-card {
		padding: 9px 12px;
		gap: 8px;
	}

	.ppa-pm-qty-section {
		flex-wrap: wrap;
	}

	.ppa-pm-close {
		top: 10px;
		left: 10px;
		width: 28px;
		height: 28px;
		font-size: 16px;
	}
}

@keyframes ppa-pm-enter-mobile {
	from {
		opacity: 0;
		transform: translateY(100%);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}
