<!DOCTYPE html>
<html lang="pt-br">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>SON</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 20px;
            background-color: #f5f5f5;
        }
        .container {
            max-width: 1200px;
            margin: 0 auto;
        }
        .formulario {
            background: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            margin-bottom: 20px;
        }
        .quadro-colunas {
            display: flex;
            gap: 15px;
            margin-top: 20px;
        }
        .coluna {
            flex: 1;
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            padding: 15px;
            min-height: 500px;
        }
        .coluna h2 {
            text-align: center;
            margin-top: 0;
            padding-bottom: 10px;
            border-bottom: 1px solid #eee;
        }
        .coluna-1 { border-top: 4px solid #006600; }
        .coluna-2 { border-top: 4px solid #3498db; }
        .coluna-3 { border-top: 4px solid #FFD700; }
        .cliente-item {
            background: #f9f9f9;
            border-left: 3px solid #3498db;
            padding: 10px;
            margin-bottom: 10px;
            border-radius: 4px;
            cursor: move;
            user-select: none;
        }
        .cliente-item h3 {
            margin: 0 0 5px 0;
        }
        .cliente-item p {
            margin: 5px 0;
            font-size: 0.9em;
            color: #666;
        }
        .cliente-nome {
            color: #3498db;
            text-decoration: underline;
            cursor: pointer;
        }
        .cliente-nome:hover {
            color: #2980b9;
        }
        input, button {
            width: 100%;
            padding: 8px;
            margin: 5px 0 15px;
            box-sizing: border-box;
        }
        button {
            background: #3498db;
            color: white;
            border: none;
            cursor: pointer;
        }
        button:hover {
            background: #2980b9;
        }
        .mensagem {
            margin: 10px 0;
            padding: 10px;
            background: #dff0d8;
            color: #3c763d;
            border-radius: 4px;
        }
    </style>
</head>
<body>
    <?php
    // Configurações do banco
    $host = "localhost";
    $user = "root";
    $password = "Aa123456@"; // Senha 
    $database = "test"; // Troque pelo nome do seu banco

    // Criar conexão
    $conn = new mysqli($host, $user, $password, $database);

    // Verificar conexão
    if ($conn->connect_error) {
        die("Falha na conexão: " . $conn->connect_error);
    }

    // Consulta para obter clientes
    $sql = "SELECT id, Nome_Cliente, Email, Telefone FROM clientes"; // Ajuste os nomes dos campos conforme sua tabela
    $result = $conn->query($sql);

    $clientes = [];
    if ($result->num_rows > 0) {
        while($row = $result->fetch_assoc()) {
            $clientes[] = $row;
        }
    }
    ?>

    <img src="C:\Users\thiago.vieira\Pictures\tvitec.png" alt="Descrição da imagem">  
    <B><center>Sistema de organização de negócios</center></B>
    
    <div class="quadro-colunas">
        <div class="coluna coluna-1">
            <h2>Contactar</h2>
            <?php foreach ($clientes as $cliente): ?>
                <div class="cliente-item" draggable="true" data-id="<?php echo $cliente['id']; ?>">
                    <h3><span class="cliente-nome" onclick="window.location.href='detalhes_cliente.php?id=<?php echo $cliente['id']; ?>'">
                        <?php echo htmlspecialchars($cliente['Nome_Cliente']); ?>
                    </span></h3>
                    <p>Email: <?php echo htmlspecialchars($cliente['Email']); ?></p>
                    <p>Tel: <?php echo htmlspecialchars($cliente['Telefone']); ?></p>
                </div>
            <?php endforeach; ?>
        </div>
    </div>

    <?php
    // Fechar conexão
    $conn->close();
    ?>
</body>
</html>