<div class="faq-container">
<div class="faq-demo">
<div class="faq-header">
<h2>Frequently Asked Questions</h2>
<p>Find answers to common questions</p>
</div>
<div class="faq-search">
<input type="text" id="faqSearch" placeholder="Search questions...">
<span class="search-icon">🔍</span>
</div>
<div class="faq-categories">
<button class="category-btn active" data-category="all">All</button>
<button class="category-btn" data-category="general">General</button>
<button class="category-btn" data-category="account">Account</button>
<button class="category-btn" data-category="billing">Billing</button>
<button class="category-btn" data-category="technical">Technical</button>
</div>
<div class="faq-accordion" id="faqAccordion">
<!-- FAQ Item 1 -->
<div class="faq-item" data-category="general">
<div class="faq-question" tabindex="0">
<h3>How do I create an account?</h3>
<span class="faq-toggle">+</span>
</div>
<div class="faq-answer">
<p>To create an account, click on the "Sign Up" button in the top right corner of our website. Fill in your details and verify your email address. You'll receive a confirmation email once your account is activated.</p>
</div>
</div>
<!-- FAQ Item 2 -->
<div class="faq-item" data-category="account">
<div class="faq-question" tabindex="0">
<h3>How can I reset my password?</h3>
<span class="faq-toggle">+</span>
</div>
<div class="faq-answer">
<p>If you've forgotten your password, click on the "Forgot Password" link on the login page. Enter your email address and we'll send you a password reset link. The link will expire in 24 hours for security reasons.</p>
</div>
</div>
<!-- FAQ Item 3 -->
<div class="faq-item" data-category="billing">
<div class="faq-question" tabindex="0">
<h3>What payment methods do you accept?</h3>
<span class="faq-toggle">+</span>
</div>
<div class="faq-answer">
<p>We accept all major credit cards including Visa, MasterCard, American Express, and Discover. We also support PayPal, Apple Pay, and Google Pay for your convenience. All transactions are secured with 256-bit SSL encryption.</p>
</div>
</div>
<!-- FAQ Item 4 -->
<div class="faq-item" data-category="technical">
<div class="faq-question" tabindex="0">
<h3>How do I troubleshoot connection issues?</h3>
<span class="faq-toggle">+</span>
</div>
<div class="faq-answer">
<p>If you're experiencing connection issues, try these steps: 1) Check your internet connection, 2) Restart your router, 3) Clear your browser cache, 4) Disable browser extensions, 5) Try a different browser. If problems persist, contact our support team.</p>
</div>
</div>
<!-- FAQ Item 5 -->
<div class="faq-item" data-category="general">
<div class="faq-question" tabindex="0">
<h3>Can I cancel my subscription anytime?</h3>
<span class="faq-toggle">+</span>
</div>
<div class="faq-answer">
<p>Yes, you can cancel your subscription at any time with no cancellation fees. Your access will continue until the end of your current billing period. To cancel, go to your account settings and click "Cancel Subscription".</p>
</div>
</div>
</div>
<div class="faq-footer">
<p>Still have questions? <a href="#" class="contact-link">Contact our support team</a></p>
</div>
</div>
</div>
.faq-container {
background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
padding: 30px;
border-radius: 20px;
max-width: 800px;
margin: 0 auto;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}
.faq-demo {
background: white;
border-radius: 15px;
padding: 30px;
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.03);
}
.faq-header {
text-align: center;
margin-bottom: 30px;
}
.faq-header h2 {
margin: 0 0 10px 0;
color: #333;
font-size: 2rem;
font-weight: 700;
}
.faq-header p {
color: #666;
font-size: 1.1rem;
margin: 0;
}
.faq-search {
position: relative;
margin-bottom: 25px;
}
.faq-search input {
width: 100%;
padding: 15px 20px 15px 50px;
border: 2px solid #e2e8f0;
border-radius: 12px;
font-size: 1rem;
transition: all 0.3s ease;
box-sizing: border-box;
}
.faq-search input:focus {
outline: none;
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.search-icon {
position: absolute;
left: 20px;
top: 50%;
transform: translateY(-50%);
color: #999;
font-size: 1.2rem;
}
.faq-categories {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-bottom: 25px;
justify-content: center;
}
.category-btn {
padding: 8px 16px;
background: #f1f5f9;
color: #666;
border: none;
border-radius: 20px;
font-size: 0.9rem;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
}
.category-btn:hover,
.category-btn.active {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}
.faq-accordion {
margin-bottom: 30px;
}
.faq-item {
border: 1px solid #e2e8f0;
border-radius: 12px;
margin-bottom: 15px;
overflow: hidden;
transition: all 0.3s ease;
animation: slideInUp 0.6s ease-out;
}
.faq-item:nth-child(1) { animation-delay: 0.1s; }
.faq-item:nth-child(2) { animation-delay: 0.2s; }
.faq-item:nth-child(3) { animation-delay: 0.3s; }
.faq-item:nth-child(4) { animation-delay: 0.4s; }
.faq-item:nth-child(5) { animation-delay: 0.5s; }
.faq-question {
padding: 20px 25px;
background: #f8fafc;
cursor: pointer;
display: flex;
justify-content: space-between;
align-items: center;
transition: all 0.3s ease;
}
.faq-question:hover {
background: #f1f5f9;
}
.faq-question h3 {
margin: 0;
color: #333;
font-size: 1.1rem;
font-weight: 600;
flex: 1;
text-align: left;
}
.faq-toggle {
font-size: 1.5rem;
font-weight: 300;
color: #999;
transition: all 0.3s ease;
width: 30px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
}
.faq-item.active .faq-toggle {
transform: rotate(45deg);
color: #667eea;
}
.faq-answer {
padding: 0 25px;
max-height: 0;
overflow: hidden;
transition: all 0.3s ease;
background: white;
}
.faq-item.active .faq-answer {
padding: 0 25px 25px;
max-height: 500px;
}
.faq-answer p {
margin: 0;
color: #666;
line-height: 1.6;
font-size: 0.95rem;
}
.faq-footer {
text-align: center;
padding-top: 20px;
border-top: 1px solid #e2e8f0;
}
.faq-footer p {
margin: 0;
color: #666;
font-size: 1rem;
}
.contact-link {
color: #667eea;
text-decoration: none;
font-weight: 600;
transition: all 0.3s ease;
}
.contact-link:hover {
color: #5a6fd8;
text-decoration: underline;
}
/* Animations */
@keyframes slideInUp {
from {
opacity: 0;
transform: translateY(30px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
/* Responsive */
@media (max-width: 768px) {
.faq-container {
padding: 20px;
}
.faq-demo {
padding: 20px;
}
.faq-header h2 {
font-size: 1.7rem;
}
.faq-search input {
padding: 12px 15px 12px 45px;
}
.search-icon {
left: 15px;
font-size: 1rem;
}
.faq-question {
padding: 15px 20px;
}
.faq-question h3 {
font-size: 1rem;
}
.faq-answer {
padding: 0 20px;
}
.faq-item.active .faq-answer {
padding: 0 20px 20px;
}
}
@media (max-width: 480px) {
.faq-categories {
justify-content: flex-start;
overflow-x: auto;
padding-bottom: 10px;
}
.category-btn {
white-space: nowrap;
}
}
document.addEventListener('DOMContentLoaded', function() {
// Get DOM elements
const faqItems = document.querySelectorAll('.faq-item');
const faqQuestions = document.querySelectorAll('.faq-question');
const categoryButtons = document.querySelectorAll('.category-btn');
const searchInput = document.getElementById('faqSearch');
// Add event listeners to FAQ questions
faqQuestions.forEach(question => {
question.addEventListener('click', function() {
const faqItem = this.parentElement;
toggleFAQ(faqItem);
});
// Add keyboard support
question.addEventListener('keydown', function(e) {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
const faqItem = this.parentElement;
toggleFAQ(faqItem);
}
});
});
// Toggle FAQ item
function toggleFAQ(faqItem) {
// Close all other FAQ items
faqItems.forEach(item => {
if (item !== faqItem) {
item.classList.remove('active');
}
});
// Toggle current FAQ item
faqItem.classList.toggle('active');
}
// Add event listeners to category buttons
categoryButtons.forEach(button => {
button.addEventListener('click', function() {
// Remove active class from all buttons
categoryButtons.forEach(btn => btn.classList.remove('active'));
// Add active class to clicked button
this.classList.add('active');
// Get category
const category = this.getAttribute('data-category');
// Filter FAQ items
filterFAQItems(category);
});
});
// Add event listener to search input
searchInput.addEventListener('input', function() {
const searchTerm = this.value.toLowerCase();
filterFAQBySearch(searchTerm);
});
// Filter FAQ items by category
function filterFAQItems(category) {
faqItems.forEach(item => {
if (category === 'all' || item.getAttribute('data-category') === category) {
item.style.display = 'block';
item.classList.remove('filtered');
} else {
item.style.display = 'none';
item.classList.add('filtered');
}
});
}
// Filter FAQ items by search term
function filterFAQBySearch(searchTerm) {
faqItems.forEach(item => {
const question = item.querySelector('.faq-question h3').textContent.toLowerCase();
const answer = item.querySelector('.faq-answer p').textContent.toLowerCase();
if (searchTerm === '' || question.includes(searchTerm) || answer.includes(searchTerm)) {
item.style.display = 'block';
item.classList.remove('search-hidden');
} else {
item.style.display = 'none';
item.classList.add('search-hidden');
}
});
}
// Initialize with all categories visible
filterFAQItems('all');
// Add smooth scrolling to contact link
const contactLink = document.querySelector('.contact-link');
contactLink.addEventListener('click', function(e) {
e.preventDefault();
// In a real implementation, this would scroll to the contact form
alert('Contact form would open here');
});
});