/**
 * Frontend styles for Dynamic Pricing Cards.
 *
 * @package DynamicPricingCards
 */

/* Grid container styling */
.dpc-pricing-grid {
	display: grid;
	gap: 32px;
	margin: 20px 0;
	font-family: 'Inter', system-ui, -apple-system, sans-serif;
	box-sizing: border-box;
}

.dpc-pricing-grid * {
	box-sizing: border-box;
}

/* Layout columns */
.dpc-layout-3-col {
	grid-template-columns: repeat(3, 1fr);
}

.dpc-layout-2-col {
	grid-template-columns: repeat(2, 1fr);
}

.dpc-layout-1-col {
	grid-template-columns: 1fr;
}

/* Responsive Grid Adapters */
@media (max-width: 991px) {
	.dpc-layout-3-col {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 767px) {
	.dpc-layout-3-col,
	.dpc-layout-2-col {
		grid-template-columns: 1fr;
	}
}

/* Card Styling */
.dpc-card {
	position: relative;
	background: #ffffff;
	border: 1px solid #eaeaea;
	box-shadow: 0 4px 24px rgba(0,0,0,0.08);
	border-radius: 16px;
	padding: 32px;
	color: #1a1a1a;
	text-align: left;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.dpc-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 12px 32px rgba(0,0,0,0.12);
}

.dpc-card.featured {
	background: #1a1a1a;
	color: #ffffff;
	border: 1px solid #1a1a1a;
}

/* Header & Typography */
.dpc-card .plan-title {
	font-size: 1.6rem;
	font-weight: 700;
	margin: 0 0 8px 0;
	color: inherit;
	line-height: 1.2;
}

.dpc-card .plan-tagline {
	font-size: 0.95rem;
	color: #666666;
	margin: 0 0 28px 0;
	line-height: 1.5;
}
.dpc-card.featured .plan-tagline {
	color: #aaaaaa;
}

/* Price block */
.dpc-card-price {
	font-size: 2.75rem;
	font-weight: 800;
	color: #E8540A !important; /* Always orange accent */
	margin-bottom: 28px;
	display: flex;
	align-items: baseline;
	line-height: 1;
}

.dpc-card-price .currency {
	font-size: 1.6rem;
	font-weight: 600;
	margin-right: 2px;
}

.dpc-card-price .suffix {
	font-size: 1rem;
	font-weight: 400;
	color: #666666;
	margin-left: 4px;
}
.dpc-card.featured .dpc-card-price .suffix {
	color: #aaaaaa;
}

/* Checklist features */
.dpc-card .plan-features {
	list-style: none;
	padding: 0;
	margin: 0 0 36px 0;
	display: flex;
	flex-direction: column;
	gap: 14px;
	flex-grow: 1;
}

.dpc-card .plan-features li {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	font-size: 0.98rem;
	line-height: 1.4;
	color: inherit;
}

.dpc-card .checkmark-icon {
	flex-shrink: 0;
	display: inline-block;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	position: relative;
	margin-top: 1px;
}
.dpc-card .checkmark-icon::after {
	content: '';
	position: absolute;
	left: 7px;
	top: 4px;
	width: 5px;
	height: 9px;
	border: solid white;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

/* Button & Spinners */
.dpc-card-footer {
	margin-top: auto;
}

.dpc-action-btn {
	width: 100%;
	border-radius: 12px;
	padding: 16px 32px;
	font-weight: 700;
	font-size: 1rem;
	cursor: pointer;
	position: relative;
	outline: none;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.dpc-action-btn:hover {
	box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Button State Transitions */
.dpc-action-btn .dpc-btn-text,
.dpc-action-btn .dpc-btn-spinner,
.dpc-action-btn .dpc-btn-success {
	transition: all 0.2s ease;
}

.dpc-action-btn .dpc-btn-spinner,
.dpc-action-btn .dpc-btn-success {
	position: absolute;
	opacity: 0;
	transform: scale(0.6);
	pointer-events: none;
}

/* Spinner element */
.dpc-btn-spinner {
	width: 20px;
	height: 20px;
	border: 3px solid rgba(255,255,255,0.3);
	border-radius: 50%;
	animation: dpcSpin 0.8s linear infinite;
}

/* Non-featured button spinner is dark */
.dpc-card:not(.featured) .dpc-btn-spinner {
	border-color: rgba(0,0,0,0.1);
	border-top-color: #1a1a1a;
}
.dpc-card.featured .dpc-btn-spinner {
	border-top-color: #ffffff;
}

/* Button loading state */
.dpc-action-btn.loading {
	pointer-events: none;
}
.dpc-action-btn.loading .dpc-btn-text {
	opacity: 0;
}
.dpc-action-btn.loading .dpc-btn-spinner {
	opacity: 1;
	transform: scale(1);
}

/* Button success state */
.dpc-action-btn.success {
	pointer-events: none;
	background-color: #28a745 !important;
	border-color: #28a745 !important;
	color: #ffffff !important;
}
.dpc-action-btn.success .dpc-btn-text {
	opacity: 0;
}
.dpc-action-btn.success .dpc-btn-success {
	opacity: 1;
	transform: scale(1);
	display: flex;
}

@keyframes dpcSpin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

/* Floating Cart Badge / Icon Widget */
.dpc-cart-widget {
	position: relative;
	display: inline-block;
	cursor: pointer;
	padding: 5px;
	color: inherit;
}

.dpc-cart-widget svg {
	display: block;
}

.dpc-cart-count-badge {
	position: absolute;
	top: -4px;
	right: -4px;
	background: #E8540A;
	color: #ffffff;
	border-radius: 50%;
	min-width: 18px;
	height: 18px;
	font-size: 10px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 4px;
	line-height: 1;
	border: 1.5px solid #ffffff;
	box-shadow: 0 2px 5px rgba(0,0,0,0.1);
	transform: scale(1);
	transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dpc-cart-count-badge.dpc-bump {
	transform: scale(1.4);
}

/* Cart Overlay Backdrop */
.dpc-cart-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0,0,0,0.4);
	backdrop-filter: blur(2px);
	z-index: 99990;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease;
}

.dpc-cart-overlay.open {
	opacity: 1;
	pointer-events: auto;
}

/* Cart Panel Drawer */
.dpc-cart-panel {
	position: fixed;
	top: 0;
	right: 0;
	width: 100%;
	max-width: 420px;
	height: 100%;
	background: #ffffff;
	box-shadow: -10px 0 30px rgba(0,0,0,0.15);
	z-index: 99995;
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
	font-family: 'Inter', system-ui, sans-serif;
	color: #1a1a1a;
}

.dpc-cart-panel.open {
	transform: translateX(0);
}

.dpc-cart-header {
	padding: 24px;
	border-bottom: 1px solid #f0f0f0;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.dpc-cart-header h3 {
	margin: 0;
	font-size: 1.2rem;
	font-weight: 700;
}

.dpc-cart-close {
	background: none;
	border: none;
	font-size: 32px;
	line-height: 1;
	cursor: pointer;
	color: #a0a0a0;
	padding: 0;
}
.dpc-cart-close:hover {
	color: #dc3232;
}

/* Cart Items Body Scrollable */
.dpc-cart-body {
	padding: 24px;
	overflow-y: auto;
	flex-grow: 1;
}

.dpc-cart-empty {
	text-align: center;
	color: #888888;
	padding: 40px 0;
}

.dpc-cart-item-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 16px 0;
	border-bottom: 1px solid #f5f5f5;
	gap: 15px;
}

.dpc-cart-item-info {
	flex-grow: 1;
}

.dpc-cart-item-name {
	font-weight: 600;
	font-size: 0.95rem;
	margin-bottom: 4px;
}

.dpc-cart-item-price {
	font-size: 0.9rem;
	color: #E8540A;
	font-weight: 700;
}

.dpc-cart-item-qty {
	font-size: 0.85rem;
	color: #888888;
}

.dpc-cart-item-remove {
	background: none;
	border: none;
	color: #ccc;
	cursor: pointer;
	font-size: 20px;
	padding: 5px;
	line-height: 1;
}
.dpc-cart-item-remove:hover {
	color: #dc3232;
}

/* Cart Footer summary styles */
.dpc-cart-footer {
	padding: 24px;
	border-top: 1px solid #f0f0f0;
	background: #fafafa;
}

.dpc-cart-subtotal-row {
	display: flex;
	justify-content: space-between;
	font-size: 1.1rem;
	font-weight: 700;
	margin-bottom: 20px;
}

.dpc-cart-subtotal-row .val {
	color: #E8540A;
}

.dpc-cart-actions {
	display: flex;
	flex-direction: column;
	gap: 12px;
	text-align: center;
}

.dpc-checkout-btn {
	display: block;
	width: 100%;
	background: #E8540A;
	color: #ffffff !important;
	border-radius: 8px;
	padding: 14px 20px;
	font-weight: 700;
	text-decoration: none;
	font-size: 0.95rem;
	box-shadow: 0 4px 10px rgba(232, 84, 10, 0.2);
	transition: background 0.2s;
	border: none;
	text-align: center;
}
.dpc-checkout-btn:hover {
	background: #d44900;
}

.dpc-checkout-btn.dpc-disabled {
	background: #ccc;
	box-shadow: none;
	pointer-events: none;
}

.dpc-clear-cart-btn {
	background: none;
	border: none;
	color: #888888;
	font-size: 0.85rem;
	cursor: pointer;
	text-decoration: underline;
}
.dpc-clear-cart-btn:hover {
	color: #dc3232;
}

.dpc-continue-browsing {
	color: #666666;
	font-size: 0.9rem;
	text-decoration: none;
}
.dpc-continue-browsing:hover {
	text-decoration: underline;
}

/* Custom badges grid and keyframes positioning */
.dpc-card-badge-container {
	position: absolute;
	top: 0;
	right: 0;
	z-index: 10;
}

.dpc-badge-pill {
	display: inline-block;
	font-weight: 700;
	border-radius: 20px;
	padding: 6px 14px;
	white-space: nowrap;
	margin: 20px 20px 0 0;
	box-shadow: 0 4px 10px rgba(0,0,0,0.12);
	font-family: inherit;
	line-height: 1;
}

.dpc-badge-ribbon {
	font-weight: 700;
	padding: 6px 30px;
	text-align: center;
	position: absolute;
	top: 15px;
	right: -30px;
	transform: rotate(45deg);
	width: 130px;
	box-shadow: 0 2px 5px rgba(0,0,0,0.2);
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	line-height: 1;
}

.dpc-badge-starburst {
	position: absolute;
	top: 15px;
	right: 15px;
	width: 65px;
	height: 65px;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	filter: drop-shadow(0px 3px 5px rgba(0,0,0,0.15));
}
.dpc-badge-starburst svg {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 1;
}
.dpc-badge-starburst .starburst-text {
	position: relative;
	z-index: 2;
	font-weight: 800;
	line-height: 1.1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 4px;
}

.dpc-badge-corner-fold {
	position: absolute;
	top: 0;
	right: 0;
	width: 75px;
	height: 75px;
	overflow: hidden;
}
.dpc-badge-corner-fold::before {
	content: '';
	position: absolute;
	top: -50px;
	right: -50px;
	width: 100px;
	height: 100px;
	transform: rotate(45deg);
	box-shadow: 0 2px 6px rgba(0,0,0,0.15);
	z-index: 1;
}
.dpc-badge-corner-fold .corner-text {
	position: absolute;
	z-index: 2;
	top: 12px;
	right: 4px;
	width: 60px;
	text-align: center;
	font-weight: 700;
	transform: rotate(45deg);
	font-size: 10px;
	text-transform: uppercase;
	line-height: 1;
}

/* Animations */
.dpc-anim-pulse {
	animation: dpcPulseKeyframe 2s infinite ease-in-out;
}
.dpc-anim-bounce {
	animation: dpcBounceKeyframe 2s infinite ease-in-out;
}
.dpc-anim-shimmer {
	position: relative;
	overflow: hidden;
}
.dpc-anim-shimmer::after {
	content: '';
	position: absolute;
	top: -50%;
	left: -60%;
	width: 20%;
	height: 200%;
	background: rgba(255, 255, 255, 0.4);
	transform: rotate(30deg);
	animation: dpcShimmerKeyframe 3s infinite linear;
}

@keyframes dpcPulseKeyframe {
	0% { transform: scale(1); }
	50% { transform: scale(1.08); }
	100% { transform: scale(1); }
}
@keyframes dpcBounceKeyframe {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-6px); }
}
@keyframes dpcShimmerKeyframe {
	0% { left: -60%; }
	30%, 100% { left: 140%; }
}

/* Accessibility / Reduced Motion overrides */
.dpc-disable-animations .dpc-anim-pulse,
.dpc-disable-animations .dpc-anim-bounce,
.dpc-disable-animations .dpc-anim-shimmer,
.dpc-disable-animations .dpc-anim-shimmer::after,
.dpc-disable-animations .dpc-btn-spinner,
.dpc-disable-animations .dpc-cart-count-badge {
	animation: none !important;
	transition: none !important;
	transform: none !important;
}
