<?php
require_once 'includes/config.php';

$site_name = getSetting('site_name', $pdo, 'Car Rental Albania');
$page_title = t('faq_title') . ' - ' . $site_name;

$cancellation_policy = getSetting('cancellation_policy', $pdo, 'Free cancellation up to 24 hours before pickup.');
$working_hours_start = getSetting('working_hours_start', $pdo, '08:00');
$working_hours_end = getSetting('working_hours_end', $pdo, '20:00');
$site_phone = getSetting('site_phone', $pdo, '+355 69 123 4567');
$site_email = getSetting('site_email', $pdo, 'info@carrental.com');

require_once 'header.php';
?>

<!DOCTYPE html>
<html lang="<?php echo getCurrentLanguage(); ?>">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover, user-scalable=yes">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta name="format-detection" content="telephone=yes">
    <title><?php echo sanitize($page_title); ?></title>
    <style>
        :root {
            --primary: #0066ff;
            --primary-dark: #0052cc;
            --secondary: #1a1f36;
            --text-light: #5a6e8a;
            --bg-light: #f8fafc;
            --white: #ffffff;
            --border: #eef2f6;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            -webkit-tap-highlight-color: transparent;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            background: var(--bg-light);
            color: var(--secondary);
            line-height: 1.5;
            overflow-x: hidden;
            -webkit-font-smoothing: antialiased;
        }

        .page-container { 
            max-width: 1200px; 
            margin: 0 auto; 
            padding: 20px 5%;
        }
        
        .page-header { 
            margin-bottom: 32px; 
            text-align: center; 
        }
        .page-header h1 { 
            font-size: clamp(28px, 6vw, 36px); 
            font-weight: 700; 
            margin-bottom: 12px; 
            color: #000000;
        }
        .page-header p { 
            color: var(--text-light); 
            font-size: clamp(14px, 4vw, 16px); 
            max-width: 600px; 
            margin: 0 auto; 
        }
        
        .faq-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 24px;
            margin-bottom: 48px;
        }
        
        .faq-card {
            background: white;
            border-radius: 20px;
            border: 1px solid var(--border);
            overflow: hidden;
        }
        
        .faq-question {
            padding: 20px 24px;
            background: var(--bg-light);
            cursor: pointer;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-weight: 600;
            font-size: 16px;
            transition: all 0.3s;
            -webkit-tap-highlight-color: transparent;
            color: #000000;
        }
        
        .faq-question:active {
            background: rgba(0,102,255,0.05);
        }
        
        .faq-question i {
            color: var(--primary);
            transition: transform 0.3s;
        }
        
        .faq-question.active i {
            transform: rotate(180deg);
        }
        
        .faq-answer {
            padding: 0 24px;
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.3s ease, padding 0.3s ease;
            color: var(--text-light);
            line-height: 1.6;
            font-size: 15px;
        }
        
        .faq-answer.active {
            padding: 0 24px 20px 24px;
            max-height: 300px;
        }
        
        .policy-section {
            background: white;
            border-radius: 20px;
            border: 1px solid var(--border);
            padding: 28px;
            margin-bottom: 30px;
        }
        
        .policy-section h2 {
            font-size: clamp(20px, 5vw, 24px);
            font-weight: 700;
            margin-bottom: 20px;
            display: flex;
            align-items: center;
            gap: 12px;
            flex-wrap: wrap;
            color: #000000;
        }
        
        .policy-section h2 i {
            color: var(--primary);
            font-size: 28px;
        }
        
        .policy-section p {
            color: var(--text-light);
            line-height: 1.7;
            margin-bottom: 16px;
            font-size: 15px;
        }
        
        .policy-section ul {
            margin-left: 20px;
            color: var(--text-light);
            line-height: 1.7;
        }
        
        .policy-section li {
            margin-bottom: 10px;
            font-size: 15px;
        }
        
        .info-box {
            background: linear-gradient(135deg, rgba(0,102,255,0.08) 0%, rgba(0,102,255,0.02) 100%);
            border-radius: 16px;
            padding: 20px 24px;
            margin-top: 20px;
            border: 1px solid rgba(0,102,255,0.1);
        }
        
        .info-box i {
            color: var(--primary);
            margin-right: 10px;
        }
        
        .contact-card {
            background: white;
            border-radius: 20px;
            border: 1px solid var(--border);
            padding: 32px;
            text-align: center;
        }
        
        .contact-card h3 {
            font-size: clamp(20px, 5vw, 22px);
            margin-bottom: 16px;
            color: #000000;
        }
        
        .contact-card .phone {
            font-size: clamp(24px, 6vw, 32px);
            font-weight: 700;
            color: var(--primary);
            margin: 16px 0;
        }
        
        .contact-card .phone i {
            margin-right: 8px;
        }
        
        .fade-up {
            opacity: 0;
            transform: translateY(30px);
            transition: all 0.6s ease;
        }
        
        .fade-up.visible {
            opacity: 1;
            transform: translateY(0);
        }
        
        @media (max-width: 768px) {
            .faq-grid {
                grid-template-columns: 1fr;
                gap: 16px;
            }
            .page-header h1 { font-size: 28px; }
            .policy-section { padding: 20px; }
            .contact-card { padding: 24px; }
            .faq-question { font-size: 15px; padding: 16px 20px; }
            .faq-answer.active { font-size: 14px; }
        }
        
        @media (max-width: 480px) {
            .page-container { padding: 16px 4%; }
            .policy-section ul { margin-left: 16px; }
            .policy-section li { font-size: 14px; }
            .contact-card .phone { font-size: 26px; }
        }
        
        button, .faq-question {
            cursor: pointer;
            touch-action: manipulation;
        }
    </style>
</head>
<body>
    <div class="page-container">
        <div class="page-header">
            <h1><?php echo t('faq_title'); ?></h1>
            <p><?php echo t('faq_subtitle'); ?></p>
        </div>
        
        <div class="faq-grid">
            <div class="faq-card fade-up">
                <div class="faq-question" onclick="toggleFaq(this)">
                    <?php echo t('faq_question_1'); ?>
                    <i class="fas fa-chevron-down"></i>
                </div>
                <div class="faq-answer">
                    <?php echo t('faq_answer_1'); ?>
                </div>
            </div>
            
            <div class="faq-card fade-up">
                <div class="faq-question" onclick="toggleFaq(this)">
                    <?php echo t('faq_question_2'); ?>
                    <i class="fas fa-chevron-down"></i>
                </div>
                <div class="faq-answer">
                    <?php echo t('faq_answer_2'); ?>
                </div>
            </div>
            
            <div class="faq-card fade-up">
                <div class="faq-question" onclick="toggleFaq(this)">
                    <?php echo t('faq_question_3'); ?>
                    <i class="fas fa-chevron-down"></i>
                </div>
                <div class="faq-answer">
                    <?php echo t('faq_answer_3'); ?>
                </div>
            </div>
            
            <div class="faq-card fade-up">
                <div class="faq-question" onclick="toggleFaq(this)">
                    <?php echo t('faq_question_4'); ?>
                    <i class="fas fa-chevron-down"></i>
                </div>
                <div class="faq-answer">
                    <?php echo t('faq_answer_4'); ?>
                </div>
            </div>
            
            <div class="faq-card fade-up">
                <div class="faq-question" onclick="toggleFaq(this)">
                    <?php echo t('faq_question_5'); ?>
                    <i class="fas fa-chevron-down"></i>
                </div>
                <div class="faq-answer">
                    <?php echo t('faq_answer_5'); ?>
                </div>
            </div>
            
            <div class="faq-card fade-up">
                <div class="faq-question" onclick="toggleFaq(this)">
                    <?php echo t('faq_question_6'); ?>
                    <i class="fas fa-chevron-down"></i>
                </div>
                <div class="faq-answer">
                    <?php echo t('faq_answer_6'); ?>
                </div>
            </div>
            
            <div class="faq-card fade-up">
                <div class="faq-question" onclick="toggleFaq(this)">
                    <?php echo t('faq_question_7'); ?>
                    <i class="fas fa-chevron-down"></i>
                </div>
                <div class="faq-answer">
                    <?php echo t('faq_answer_7'); ?>
                </div>
            </div>
            
            <div class="faq-card fade-up">
                <div class="faq-question" onclick="toggleFaq(this)">
                    <?php echo t('faq_question_8'); ?>
                    <i class="fas fa-chevron-down"></i>
                </div>
                <div class="faq-answer">
                    <?php echo t('faq_answer_8'); ?>
                </div>
            </div>
            
            <div class="faq-card fade-up">
                <div class="faq-question" onclick="toggleFaq(this)">
                    <?php echo t('faq_question_9'); ?>
                    <i class="fas fa-chevron-down"></i>
                </div>
                <div class="faq-answer">
                    <?php echo t('faq_answer_9'); ?>
                </div>
            </div>
            
            <div class="faq-card fade-up">
                <div class="faq-question" onclick="toggleFaq(this)">
                    <?php echo t('faq_question_10'); ?>
                    <i class="fas fa-chevron-down"></i>
                </div>
                <div class="faq-answer">
                    <?php echo t('faq_answer_10'); ?>
                </div>
            </div>
        </div>
        
        <div class="policy-section fade-up">
            <h2><i class="fas fa-shield-alt"></i> <?php echo t('faq_policies_title'); ?></h2>
            <p><strong>Fuel Policy:</strong> <?php echo t('faq_policies_fuel'); ?></p>
            <p><strong>Security Deposit:</strong> <?php echo t('faq_policies_deposit'); ?></p>
            <p><strong>Cleaning Policy:</strong> <?php echo t('faq_policies_cleaning'); ?></p>
            <p><strong>Smoking Policy:</strong> <?php echo t('faq_policies_smoking'); ?></p>
        </div>
        
        <div class="policy-section fade-up">
            <h2><i class="fas fa-car-crash"></i> <?php echo t('faq_accident_title'); ?></h2>
            <p><?php echo t('faq_accident_text'); ?></p>
            <ul>
                <li><?php echo t('faq_accident_1'); ?></li>
                <li><?php echo t('faq_accident_2'); ?></li>
                <li><?php echo t('faq_accident_3'); ?></li>
                <li><?php echo t('faq_accident_4'); ?></li>
                <li><?php echo t('faq_accident_5'); ?></li>
            </ul>
            <div class="info-box">
                <i class="fas fa-info-circle"></i> <?php echo t('faq_accident_note'); ?>
            </div>
        </div>
        
        <div class="policy-section fade-up">
            <h2><i class="fas fa-gavel"></i> <?php echo t('faq_terms_title'); ?></h2>
            <p><?php echo t('faq_terms_text'); ?></p>
            <ul>
                <li><?php echo t('faq_terms_1'); ?></li>
                <li><?php echo t('faq_terms_2'); ?></li>
                <li><?php echo t('faq_terms_3'); ?></li>
                <li><?php echo t('faq_terms_4'); ?></li>
                <li><?php echo t('faq_terms_5'); ?></li>
                <li><?php echo t('faq_terms_6'); ?></li>
            </ul>
            <p><?php echo t('faq_terms_violation'); ?></p>
        </div>
        
        <div class="contact-card fade-up">
            <h3><?php echo t('faq_contact_title'); ?></h3>
            <p><?php echo t('faq_contact_text'); ?></p>
            <div class="phone">
                <i class="fas fa-phone-alt"></i> <?php echo sanitize($site_phone); ?>
            </div>
            <p>or email us at: <a href="mailto:<?php echo sanitize($site_email); ?>" style="color: var(--primary); text-decoration: none;"><?php echo sanitize($site_email); ?></a></p>
        </div>
    </div>
    
    <script>
        function toggleFaq(element) {
            element.classList.toggle('active');
            const answer = element.nextElementSibling;
            answer.classList.toggle('active');
        }
        
        const observerOptions = { threshold: 0.1 };
        const observer = new IntersectionObserver((entries) => {
            entries.forEach(entry => { if(entry.isIntersecting) entry.target.classList.add('visible'); });
        }, observerOptions);
        document.querySelectorAll('.fade-up').forEach(el => observer.observe(el));
    </script>
</body>
</html>

<?php 
if(file_exists('footer.php')) {
    include 'footer.php';
}
?>