<?php include 'koneksi.php';
session_start();
if (!isset($_SESSION['login_admin'])) {
    header('Location: dashboard.php');
    exit;
}

$query = "SELECT * FROM tb_alamat LIMIT 1";
$result = mysqli_query($host, $query);
$row = mysqli_fetch_assoc($result);
?>
<!DOCTYPE html>
<html lang="en">
<head><link rel="icon" href="upload/bn2.png" type="image/png">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Kelola Informasi Alamat | SMK Budiniah 2</title>
    <link rel="stylesheet" href="style_admin.css">
    <link rel="icon" href="upload/bn2.png" type="image/png">
    <style>
        body {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            font-family: 'Arial', sans-serif;
            margin: 0;
            padding: 0;
            min-height: 100vh;
        }
        .container {
            max-width: 800px;
            margin: 50px auto;
            padding: 30px;
            background: #fff;
            border-radius: 15px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.2);
        }
        h1 {
            text-align: center;
            color: #0037fd;
            margin-bottom: 30px;
            font-size: 28px;
            font-weight: bold;
        }
        .info-section {
            margin-bottom: 20px;
        }
        .info-label {
            font-weight: bold;
            color: #333;
            margin-bottom: 5px;
        }
        .info-value {
            color: #666;
            line-height: 1.5;
            word-wrap: break-word;
        }
        .info-value iframe {
            width: 100%;
            height: 300px;
            border: none;
            border-radius: 5px;
        }
        .edit-btn {
            display: block;
            width: 100%;
            padding: 12px;
            background: linear-gradient(135deg, #0037fd, #5b8cffff);
            color: #fff;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 16px;
            font-weight: bold;
            text-align: center;
            text-decoration: none;
            transition: all 0.3s ease;
            margin-top: 30px;
        }
        .edit-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(0,55,253,0.4);
        }
        @media (max-width: 768px) {
            .container {
                max-width: 600px;
                padding: 15px;
                margin: 20px 20px 40px 15%;
            }
            h1 {
                font-size: 24px;
                margin-bottom: 20px;
            }
            .info-section {
                margin-bottom: 15px;
            }
            .info-label {
                font-size: 16px;
            }
            .info-value {
                font-size: 14px;
            }
            .info-value iframe {
                height: 250px;
            }
            .edit-btn {
                padding: 10px;
                font-size: 14px;
            }
        }
        @media (max-width: 480px) {
            .container {
                max-width: 600px;
                padding: 10px;
                margin: 20px 20px 0 15%;
            }
            h1 {
                font-size: 20px;
                margin-bottom: 15px;
            }
            .info-section {
                margin-bottom: 10px;
            }
            .info-label {
                font-size: 14px;
            }
            .info-value {
                font-size: 12px;
            }
            .info-value iframe {
                height: 200px;
            }
            .edit-btn {
                padding: 8px;
                font-size: 12px;
            }
        }
    </style>
</head>
<body>
    <?php include 'navbar_admin.php'; ?>
    <div class="container">
        <h1>Kelola Informasi Alamat</h1>
        
        <div class="info-section">
            <div class="info-label">Alamat:</div>
            <div class="info-value"><?php echo htmlspecialchars($row['alamat']); ?></div>
        </div>
        
        <div class="info-section">
            <div class="info-label">Nomor Sekolah:</div>
            <div class="info-value"><?php echo htmlspecialchars($row['nomor_sekolahh']); ?></div>
        </div>
        
        <div class="info-section">
            <div class="info-label">Nomor WhatsApp:</div>
            <div class="info-value"><?php echo htmlspecialchars($row['nomor_whatsapp']); ?></div>
        </div>
        
        <div class="info-section">
            <div class="info-label">Email:</div>
            <div class="info-value"><?php echo htmlspecialchars($row['email']); ?></div>
        </div>
        
        <div class="info-section">
            <div class="info-label">Link Instagram:</div>
            <div class="info-value"><a href="<?php echo htmlspecialchars($row['link_instagram']); ?>" target="_blank"><?php echo htmlspecialchars($row['link_instagram']); ?></a></div>
        </div>
        
        <div class="info-section">
            <div class="info-label">Link YouTube:</div>
            <div class="info-value"><a href="<?php echo htmlspecialchars($row['link_youtube']); ?>" target="_blank"><?php echo htmlspecialchars($row['link_youtube']); ?></a></div>
        </div>
        
        <div class="info-section">
            <div class="info-label">Iframe Peta:</div>
            <div class="info-value"><?php echo $row['iframe']; ?></div>
        </div>
        
        <a href="edit_informasi.php" class="edit-btn">Edit Informasi</a>
    </div>
</body>
</html>

