<?php
try {
    $pdo = new PDO(
        'mysql:host=76.13.160.64;port=3306;dbname=italvet;charset=utf8mb4',
        'italvet_usr',
        'US_(DlUVH\j\dpyI',
        [
            PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
            PDO::ATTR_TIMEOUT => 5,
        ]
    );
    $stmt = $pdo->query('SELECT 1 as test, NOW() as hora, VERSION() as version, USER() as usuario');
    $row = $stmt->fetch(PDO::FETCH_ASSOC);
    echo '<h2 style="color:green">✅ Conexión exitosa</h2>';
    echo '<pre>';
    print_r($row);
    echo '</pre>';

    $stmt2 = $pdo->query('SELECT COUNT(*) as total FROM leads');
    $count = $stmt2->fetch(PDO::FETCH_ASSOC);
    echo "<p>Total leads en BD: <strong>{$count['total']}</strong></p>";

} catch (PDOException $e) {
    echo '<h2 style="color:red">❌ Error de conexión</h2>';
    echo '<pre>' . $e->getMessage() . '</pre>';
}
