<?php
// admin/pixel-diagnostics.php

$pageTitle = 'Diagnóstico do Pixel IntegraOn';
$pageHeader = 'Diagnóstico do Pixel IntegraOn';
$currentPage = 'pixel-diagnostics';

// Define BASE_PATH se não estiver definido
if (!defined('BASE_PATH')) {
    define('BASE_PATH', dirname(dirname(__FILE__)));
}

require_once '../includes/config.php';
require_once '../includes/db.php';
require_once '../includes/functions.php';
require_once '../includes/auth.php';
require_once '../includes/integraon-pixel.php';

// Requer autenticação
if (!$auth->isLoggedIn()) {
    redirect('admin/login.php');
    exit;
}

// Função para testar conectividade
function testConnectivity($url) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_NOBODY, true);
    
    $result = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    $error = curl_error($ch);
    curl_close($ch);
    
    return [
        'success' => $httpCode === 200,
        'http_code' => $httpCode,
        'error' => $error
    ];
}

// Função para testar API do IntegraOn
function testIntegraOnAPI($accessToken, $password, $testUrl = null) {
    if (empty($accessToken) || empty($password)) {
        return [
            'success' => false,
            'error' => 'Access Token ou Senha não configurados'
        ];
    }
    
    $testUrl = $testUrl ?: 'https://example.com?utm_campaign=teste_diagnostico';
    
    $curl = curl_init();
    curl_setopt_array($curl, array(
        CURLOPT_URL => 'https://api.integraon.com.br/v1/' . $accessToken . '/pixel/purchase',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => '',
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => 'POST',
        CURLOPT_POSTFIELDS => json_encode(array(
            "url" => $testUrl, 
            "senha" => $password
        )),
        CURLOPT_HTTPHEADER => array('Content-Type: application/json'),
        CURLOPT_VERBOSE => true
    ));
    
    $response = curl_exec($curl);
    $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    $error = curl_error($curl);
    $info = curl_getinfo($curl);
    curl_close($curl);
    
    return [
        'success' => $httpCode === 200,
        'http_code' => $httpCode,
        'response' => $response,
        'error' => $error,
        'info' => $info
    ];
}

$diagnostics = [];
$settings = $integraOnPixel->getSettings();

// Executar diagnósticos
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['run_diagnostics'])) {
    
    // 1. Teste de configurações
    $diagnostics['config'] = [
        'access_token_set' => !empty($settings['access_token']),
        'password_set' => !empty($settings['password']),
        'access_token_length' => strlen($settings['access_token']),
        'password_length' => strlen($settings['password'])
    ];
    
    // 2. Teste de conectividade geral
    $diagnostics['connectivity'] = testConnectivity('https://api.integraon.com.br');
    
    // 3. Teste específico da API
    if ($diagnostics['config']['access_token_set'] && $diagnostics['config']['password_set']) {
        $testUrl = isset($_POST['test_url']) && !empty($_POST['test_url']) 
                   ? $_POST['test_url'] 
                   : SITE_URL . '?utm_campaign=teste_diagnostico&utm_source=admin';
        
        $diagnostics['api'] = testIntegraOnAPI(
            $settings['access_token'], 
            $settings['password'], 
            $testUrl
        );
    }
    
    // 4. Verificar últimos eventos com erro
    try {
        $db->query("SELECT url, api_response, created_at, ip_address 
                   FROM pixel_events 
                   WHERE api_response IS NOT NULL 
                   AND (api_response LIKE '%error%' OR api_response LIKE '%Error%' OR api_response NOT LIKE '%success%')
                   ORDER BY created_at DESC 
                   LIMIT 5");
        $diagnostics['recent_errors'] = $db->resultSet();
    } catch (Exception $e) {
        $diagnostics['recent_errors'] = [];
    }
    
    // 5. Verificar configuração de PHP
    $diagnostics['php'] = [
        'curl_enabled' => extension_loaded('curl'),
        'json_enabled' => extension_loaded('json'),
        'openssl_enabled' => extension_loaded('openssl'),
        'allow_url_fopen' => ini_get('allow_url_fopen'),
        'user_agent_restriction' => ini_get('user_agent'),
        'max_execution_time' => ini_get('max_execution_time'),
        'memory_limit' => ini_get('memory_limit')
    ];
    
    // 6. Verificar arquivos
    $diagnostics['files'] = [
        'pixel_class_exists' => file_exists(BASE_PATH . '/includes/integraon-pixel.php'),
        'api_endpoint_exists' => file_exists(BASE_PATH . '/pixel.php'),
        'api_endpoint_accessible' => testConnectivity(SITE_URL . '/pixel.php')['success']
    ];
}

require_once 'inc/header.php';
?>

<div class="container-fluid px-4">
    <div class="page-header mb-4">
        <div class="row align-items-center">
            <div class="col-md-8">
                <h1 class="page-title"><?php echo $pageTitle; ?></h1>
                <p class="text-muted">Ferramentas para identificar e corrigir problemas com o pixel.</p>
            </div>
            <div class="col-md-4 text-md-end">
                <a href="pixel-settings.php" class="btn btn-outline-primary">
                    <i class="fas fa-arrow-left me-2"></i>Voltar para Configurações
                </a>
            </div>
        </div>
    </div>

    <!-- Formulário de Diagnóstico -->
    <div class="card border-0 shadow-sm mb-4">
        <div class="card-header bg-primary text-white">
            <h5 class="card-title mb-0">
                <i class="fas fa-search me-2"></i>Executar Diagnóstico Completo
            </h5>
        </div>
        <div class="card-body">
            <form method="post" action="">
                <div class="row">
                    <div class="col-md-8">
                        <label for="test_url" class="form-label">URL de Teste (opcional)</label>
                        <input type="url" class="form-control" id="test_url" name="test_url" 
                               value="<?php echo SITE_URL; ?>?utm_campaign=teste_diagnostico&utm_source=admin"
                               placeholder="URL para testar o envio do pixel">
                        <div class="form-text">Deixe em branco para usar a URL padrão de teste.</div>
                    </div>
                    <div class="col-md-4 d-flex align-items-end">
                        <button type="submit" name="run_diagnostics" class="btn btn-primary w-100">
                            <i class="fas fa-play me-2"></i>Executar Diagnóstico
                        </button>
                    </div>
                </div>
            </form>
        </div>
    </div>

    <?php if (!empty($diagnostics)): ?>
    
    <!-- Resultados do Diagnóstico -->
    <div class="row">
        
        <!-- 1. Configurações -->
        <div class="col-md-6 mb-4">
            <div class="card border-0 shadow-sm h-100">
                <div class="card-header">
                    <h5 class="card-title mb-0">
                        <i class="fas fa-cog me-2"></i>Configurações
                    </h5>
                </div>
                <div class="card-body">
                    <div class="diagnostic-item">
                        <span class="badge <?php echo $diagnostics['config']['access_token_set'] ? 'bg-success' : 'bg-danger'; ?>">
                            <?php echo $diagnostics['config']['access_token_set'] ? '✓' : '✗'; ?>
                        </span>
                        <span class="ms-2">Access Token configurado</span>
                        <?php if ($diagnostics['config']['access_token_set']): ?>
                            <small class="text-muted d-block ms-4">
                                Comprimento: <?php echo $diagnostics['config']['access_token_length']; ?> caracteres
                            </small>
                        <?php endif; ?>
                    </div>
                    
                    <div class="diagnostic-item">
                        <span class="badge <?php echo $diagnostics['config']['password_set'] ? 'bg-success' : 'bg-danger'; ?>">
                            <?php echo $diagnostics['config']['password_set'] ? '✓' : '✗'; ?>
                        </span>
                        <span class="ms-2">Senha configurada</span>
                        <?php if ($diagnostics['config']['password_set']): ?>
                            <small class="text-muted d-block ms-4">
                                Comprimento: <?php echo $diagnostics['config']['password_length']; ?> caracteres
                            </small>
                        <?php endif; ?>
                    </div>
                    
                    <?php if (!$diagnostics['config']['access_token_set'] || !$diagnostics['config']['password_set']): ?>
                    <div class="alert alert-danger mt-3">
                        <strong>Problema:</strong> Configurações da API não estão completas.
                        <br><strong>Solução:</strong> <a href="pixel-settings.php">Configure o Access Token e Senha</a>
                    </div>
                    <?php endif; ?>
                </div>
            </div>
        </div>

        <!-- 2. Conectividade -->
        <div class="col-md-6 mb-4">
            <div class="card border-0 shadow-sm h-100">
                <div class="card-header">
                    <h5 class="card-title mb-0">
                        <i class="fas fa-wifi me-2"></i>Conectividade
                    </h5>
                </div>
                <div class="card-body">
                    <div class="diagnostic-item">
                        <span class="badge <?php echo $diagnostics['connectivity']['success'] ? 'bg-success' : 'bg-danger'; ?>">
                            <?php echo $diagnostics['connectivity']['success'] ? '✓' : '✗'; ?>
                        </span>
                        <span class="ms-2">Conexão com API IntegraOn</span>
                        <small class="text-muted d-block ms-4">
                            HTTP <?php echo $diagnostics['connectivity']['http_code']; ?>
                            <?php if (!empty($diagnostics['connectivity']['error'])): ?>
                                - <?php echo htmlspecialchars($diagnostics['connectivity']['error']); ?>
                            <?php endif; ?>
                        </small>
                    </div>
                    
                    <?php if (!$diagnostics['connectivity']['success']): ?>
                    <div class="alert alert-danger mt-3">
                        <strong>Problema:</strong> Não é possível conectar com a API do IntegraOn.
                        <br><strong>Possíveis causas:</strong>
                        <ul class="mb-0">
                            <li>Firewall bloqueando conexões HTTPS</li>
                            <li>Problemas de DNS</li>
                            <li>Servidor da IntegraOn indisponível</li>
                        </ul>
                    </div>
                    <?php endif; ?>
                </div>
            </div>
        </div>

        <!-- 3. Teste da API -->
        <?php if (isset($diagnostics['api'])): ?>
        <div class="col-12 mb-4">
            <div class="card border-0 shadow-sm">
                <div class="card-header">
                    <h5 class="card-title mb-0">
                        <i class="fas fa-flask me-2"></i>Teste da API IntegraOn
                    </h5>
                </div>
                <div class="card-body">
                    <div class="row">
                        <div class="col-md-6">
                            <div class="diagnostic-item">
                                <span class="badge <?php echo $diagnostics['api']['success'] ? 'bg-success' : 'bg-danger'; ?>">
                                    <?php echo $diagnostics['api']['success'] ? '✓' : '✗'; ?>
                                </span>
                                <span class="ms-2">Resposta da API</span>
                                <small class="text-muted d-block ms-4">
                                    HTTP <?php echo $diagnostics['api']['http_code']; ?>
                                    <?php if (!empty($diagnostics['api']['error'])): ?>
                                        - <?php echo htmlspecialchars($diagnostics['api']['error']); ?>
                                    <?php endif; ?>
                                </small>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <strong>Resposta da API:</strong>
                            <pre class="bg-light p-2 rounded mt-2" style="max-height: 200px; overflow-y: auto;">
<?php echo htmlspecialchars($diagnostics['api']['response']); ?>
                            </pre>
                        </div>
                    </div>
                    
                    <?php if (!$diagnostics['api']['success']): ?>
                    <div class="alert alert-danger mt-3">
                        <strong>Problema:</strong> A API retornou um erro.
                        <br><strong>Possíveis causas:</strong>
                        <ul>
                            <?php if ($diagnostics['api']['http_code'] === 401): ?>
                            <li><strong>Erro 401:</strong> Access Token ou Senha incorretos</li>
                            <?php elseif ($diagnostics['api']['http_code'] === 403): ?>
                            <li><strong>Erro 403:</strong> Acesso negado - verifique permissões da conta</li>
                            <?php elseif ($diagnostics['api']['http_code'] === 429): ?>
                            <li><strong>Erro 429:</strong> Muitas requisições - aguarde alguns minutos</li>
                            <?php elseif ($diagnostics['api']['http_code'] === 500): ?>
                            <li><strong>Erro 500:</strong> Problema no servidor da IntegraOn</li>
                            <?php else: ?>
                            <li>Verifique se as credenciais estão corretas</li>
                            <li>Confirme se a conta IntegraOn está ativa</li>
                            <li>Verifique se não há limitações de rate limit</li>
                            <?php endif; ?>
                        </ul>
                    </div>
                    <?php endif; ?>
                </div>
            </div>
        </div>
        <?php endif; ?>

        <!-- 4. Configuração do PHP -->
        <div class="col-md-6 mb-4">
            <div class="card border-0 shadow-sm h-100">
                <div class="card-header">
                    <h5 class="card-title mb-0">
                        <i class="fab fa-php me-2"></i>Configuração do PHP
                    </h5>
                </div>
                <div class="card-body">
                    <div class="diagnostic-item">
                        <span class="badge <?php echo $diagnostics['php']['curl_enabled'] ? 'bg-success' : 'bg-danger'; ?>">
                            <?php echo $diagnostics['php']['curl_enabled'] ? '✓' : '✗'; ?>
                        </span>
                        <span class="ms-2">Extensão cURL habilitada</span>
                    </div>
                    
                    <div class="diagnostic-item">
                        <span class="badge <?php echo $diagnostics['php']['json_enabled'] ? 'bg-success' : 'bg-danger'; ?>">
                            <?php echo $diagnostics['php']['json_enabled'] ? '✓' : '✗'; ?>
                        </span>
                        <span class="ms-2">Extensão JSON habilitada</span>
                    </div>
                    
                    <div class="diagnostic-item">
                        <span class="badge <?php echo $diagnostics['php']['openssl_enabled'] ? 'bg-success' : 'bg-danger'; ?>">
                            <?php echo $diagnostics['php']['openssl_enabled'] ? '✓' : '✗'; ?>
                        </span>
                        <span class="ms-2">Extensão OpenSSL habilitada</span>
                    </div>
                    
                    <div class="diagnostic-item">
                        <span class="ms-2">Tempo máximo de execução:</span>
                        <small class="text-muted"><?php echo $diagnostics['php']['max_execution_time']; ?>s</small>
                    </div>
                    
                    <div class="diagnostic-item">
                        <span class="ms-2">Limite de memória:</span>
                        <small class="text-muted"><?php echo $diagnostics['php']['memory_limit']; ?></small>
                    </div>
                </div>
            </div>
        </div>

        <!-- 5. Arquivos do Sistema -->
        <div class="col-md-6 mb-4">
            <div class="card border-0 shadow-sm h-100">
                <div class="card-header">
                    <h5 class="card-title mb-0">
                        <i class="fas fa-file-code me-2"></i>Arquivos do Sistema
                    </h5>
                </div>
                <div class="card-body">
                    <div class="diagnostic-item">
                        <span class="badge <?php echo $diagnostics['files']['pixel_class_exists'] ? 'bg-success' : 'bg-danger'; ?>">
                            <?php echo $diagnostics['files']['pixel_class_exists'] ? '✓' : '✗'; ?>
                        </span>
                        <span class="ms-2">Classe do Pixel</span>
                        <small class="text-muted d-block ms-4">includes/integraon-pixel.php</small>
                    </div>
                    
                    <div class="diagnostic-item">
                        <span class="badge <?php echo $diagnostics['files']['api_endpoint_exists'] ? 'bg-success' : 'bg-danger'; ?>">
                            <?php echo $diagnostics['files']['api_endpoint_exists'] ? '✓' : '✗'; ?>
                        </span>
                        <span class="ms-2">Endpoint da API</span>
                        <small class="text-muted d-block ms-4">pixel.php</small>
                    </div>
                    
                    <div class="diagnostic-item">
                        <span class="badge <?php echo $diagnostics['files']['api_endpoint_accessible'] ? 'bg-success' : 'bg-danger'; ?>">
                            <?php echo $diagnostics['files']['api_endpoint_accessible'] ? '✓' : '✗'; ?>
                        </span>
                        <span class="ms-2">API acessível via HTTP</span>
                        <small class="text-muted d-block ms-4"><?php echo SITE_URL; ?>/pixel.php</small>
                    </div>
                </div>
            </div>
        </div>

        <!-- 6. Erros Recentes -->
        <?php if (!empty($diagnostics['recent_errors'])): ?>
        <div class="col-12 mb-4">
            <div class="card border-0 shadow-sm">
                <div class="card-header">
                    <h5 class="card-title mb-0">
                        <i class="fas fa-exclamation-triangle me-2"></i>Últimos Eventos com Erro
                    </h5>
                </div>
                <div class="card-body">
                    <div class="table-responsive">
                        <table class="table table-sm">
                            <thead>
                                <tr>
                                    <th>Data/Hora</th>
                                    <th>URL</th>
                                    <th>IP</th>
                                    <th>Resposta da API</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php foreach ($diagnostics['recent_errors'] as $error): ?>
                                <tr>
                                    <td><?php echo formatDate($error['created_at'], 'd/m/Y H:i:s'); ?></td>
                                    <td>
                                        <small title="<?php echo htmlspecialchars($error['url']); ?>">
                                            <?php echo htmlspecialchars(substr($error['url'], 0, 40)) . (strlen($error['url']) > 40 ? '...' : ''); ?>
                                        </small>
                                    </td>
                                    <td><?php echo htmlspecialchars($error['ip_address']); ?></td>
                                    <td>
                                        <small class="text-danger">
                                            <?php echo htmlspecialchars(substr($error['api_response'], 0, 50)) . (strlen($error['api_response']) > 50 ? '...' : ''); ?>
                                        </small>
                                    </td>
                                </tr>
                                <?php endforeach; ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <?php endif; ?>

    </div>

    <?php endif; ?>

    <!-- Soluções Comuns -->
    <div class="card border-0 shadow-sm">
        <div class="card-header">
            <h5 class="card-title mb-0">
                <i class="fas fa-tools me-2"></i>Soluções para Problemas Comuns
            </h5>
        </div>
        <div class="card-body">
            <div class="accordion" id="solutionsAccordion">
                
                <!-- Problema 1: Credenciais incorretas -->
                <div class="accordion-item">
                    <h2 class="accordion-header" id="heading1">
                        <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapse1">
                            <i class="fas fa-key text-danger me-2"></i>
                            Erro 401 - Credenciais Incorretas
                        </button>
                    </h2>
                    <div id="collapse1" class="accordion-collapse collapse" data-bs-parent="#solutionsAccordion">
                        <div class="accordion-body">
                            <p><strong>Problema:</strong> A API retorna erro 401 (Unauthorized)</p>
                            <p><strong>Causas:</strong></p>
                            <ul>
                                <li>Access Token ou Senha incorretos</li>
                                <li>Credenciais expiradas</li>
                                <li>Conta IntegraOn suspensa</li>
                            </ul>
                            <p><strong>Soluções:</strong></p>
                            <ol>
                                <li>Verifique se copiou corretamente o Access Token (sem espaços extras)</li>
                                <li>Confirme se a senha está correta</li>
                                <li>Acesse sua conta IntegraOn e gere novas credenciais</li>
                                <li>Verifique se a conta está ativa e não suspensa</li>
                            </ol>
                        </div>
                    </div>
                </div>

                <!-- Problema 2: Rate Limiting -->
                <div class="accordion-item">
                    <h2 class="accordion-header" id="heading2">
                        <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapse2">
                            <i class="fas fa-clock text-warning me-2"></i>
                            Erro 429 - Muitas Requisições
                        </button>
                    </h2>
                    <div id="collapse2" class="accordion-collapse collapse" data-bs-parent="#solutionsAccordion">
                        <div class="accordion-body">
                            <p><strong>Problema:</strong> A API retorna erro 429 (Too Many Requests)</p>
                            <p><strong>Causa:</strong> Excedeu o limite de requisições por minuto/hora</p>
                            <p><strong>Soluções:</strong></p>
                            <ol>
                                <li>Aguarde alguns minutos antes de testar novamente</li>
                                <li>Verifique se não há múltiplos testes sendo executados simultaneamente</li>
                                <li>Entre em contato com o suporte da IntegraOn para aumentar o limite</li>
                                <li>Implemente um sistema de cache para reduzir requisições duplicadas</li>
                            </ol>
                        </div>
                    </div>
                </div>

                <!-- Problema 3: Problemas de conectividade -->
                <div class="accordion-item">
                    <h2 class="accordion-header" id="heading3">
                        <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapse3">
                            <i class="fas fa-wifi text-danger me-2"></i>
                            Problemas de Conectividade
                        </button>
                    </h2>
                    <div id="collapse3" class="accordion-collapse collapse" data-bs-parent="#solutionsAccordion">
                        <div class="accordion-body">
                            <p><strong>Problema:</strong> Não consegue conectar com a API da IntegraOn</p>
                            <p><strong>Possíveis causas:</strong></p>
                            <ul>
                                <li>Firewall bloqueando conexões HTTPS</li>
                                <li>Problemas de DNS</li>
                                <li>Servidor sem acesso à internet</li>
                                <li>Certificados SSL desatualizados</li>
                            </ul>
                            <p><strong>Soluções:</strong></p>
                            <ol>
                                <li>Verifique se o servidor tem acesso à internet</li>
                                <li>Teste a conectividade: <code>curl -I https://api.integraon.com.br</code></li>
                                <li>Verifique configurações de firewall</li>
                                <li>Atualize certificados SSL do servidor</li>
                                <li>Configure proxy se necessário</li>
                            </ol>
                        </div>
                    </div>
                </div>

                <!-- Problema 4: JavaScript não carrega -->
                <div class="accordion-item">
                    <h2 class="accordion-header" id="heading4">
                        <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapse4">
                            <i class="fab fa-js text-warning me-2"></i>
                            JavaScript Não Carrega
                        </button>
                    </h2>
                    <div id="collapse4" class="accordion-collapse collapse" data-bs-parent="#solutionsAccordion">
                        <div class="accordion-body">
                            <p><strong>Problema:</strong> O pixel não é ativado nas páginas</p>
                            <p><strong>Possíveis causas:</strong></p>
                            <ul>
                                <li>Código do pixel não incluído no footer</li>
                                <li>Erros de JavaScript na página</li>
                                <li>Conflitos com outros scripts</li>
                            </ul>
                            <p><strong>Soluções:</strong></p>
                            <ol>
                                <li>Verifique se o código está no footer de todas as páginas</li>
                                <li>Abra o console do navegador (F12) e verifique erros</li>
                                <li>Teste em uma página simples sem outros scripts</li>
                                <li>Verifique se a URL contém parâmetros UTM</li>
                            </ol>
                            <p><strong>Código para adicionar no footer:</strong></p>
                            <pre class="bg-light p-2 rounded"><code>&lt;?php 
// Inclui o pixel IntegraOn
if (file_exists(BASE_PATH . '/includes/integraon-pixel.php')) {
    require_once BASE_PATH . '/includes/integraon-pixel.php';
    if (isset($integraOnPixel) && is_object($integraOnPixel)) {
        echo $integraOnPixel->generatePixelScript();
    }
}
?&gt;</code></pre>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>

</div>

<style>
.diagnostic-item {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.diagnostic-item:last-child {
    border-bottom: none;
}

pre {
    font-size: 12px;
    max-height: 200px;
    overflow-y: auto;
}

.accordion-button {
    font-weight: 500;
}

.accordion-button:not(.collapsed) {
    background-color: rgba(13, 110, 253, 0.1);
}
</style>

<?php require_once 'inc/footer.php'; ?>