.pricing-toggle {
font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
display: flex;
align-items: center;
gap: 15px;
background: #f9fafb;
padding: 10px 20px;
border-radius: 50px;
display: inline-flex;
border: 1px solid #e5e7eb;
}
.toggle-bg {
width: 50px;
height: 26px;
background: #e5e7eb;
border-radius: 50px;
position: relative;
cursor: pointer;
transition: background 0.3s;
}
.toggle-circle {
width: 20px;
height: 20px;
background: white;
border-radius: 50%;
position: absolute;
top: 3px;
left: 3px;
transition: transform 0.3s;
box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.label {
font-weight: 500;
color: #9ca3af;
cursor: pointer;
transition: color 0.3s;
}
.label.active {
color: #1f2937;
font-weight: 600;
}
.discount {
font-size: 0.7rem;
background: #dbeafe;
color: #2563eb;
padding: 2px 6px;
border-radius: 4px;
margin-left: 5px;
}
/* Active State for Toggle */
.pricing-toggle.yearly .toggle-bg {
background: #3b82f6;
}
.pricing-toggle.yearly .toggle-circle {
transform: translateX(24px);
}
function togglePricing() {
const container = document.querySelector(".pricing-toggle");
const mLabel = document.getElementById("monthly");
const yLabel = document.getElementById("yearly");
container.classList.toggle("yearly");
if (container.classList.contains("yearly")) {
mLabel.classList.remove("active");
yLabel.classList.add("active");
// Add logic to update prices here
} else {
mLabel.classList.add("active");
yLabel.classList.remove("active");
}
}