<?php
session_start();
include 'koneksi.php';

// ================= DATA VISI MISI =================
$query = mysqli_query($koneksi, "SELECT * FROM visi_misi WHERE id='1'");
$data = mysqli_fetch_assoc($query);

$visi = $data['visi'] ?? "Menjadikan perpustakaan dan arsip bekal ilmu dan materi pemerintahan serta sebagai bukti pertanggungjawaban";

$misi = $data['misi'] ?? "Menumbuhkembangkan minat baca masyarakat dan aparatur pemerintah Solok Selatan|Menumbuhkembangkan kepedulian terhadap pengelolaan kearsipan serta tanggung jawab untuk pelestarian|Meningkatkan sumber daya aparatur pengelola Perpustakaan dan Arsip|Menjamin pelestarian bukti-bukti kepemilikan aset daerah";

$misi_array = explode("|", $misi);

// ========== HIT COUNTER PENGUNJUNG ==========
$ip = $_SERVER['REMOTE_ADDR'];
$tanggal = date('Y-m-d');

mysqli_query($koneksi, "
    CREATE TABLE IF NOT EXISTS visitor_counter (
        id INT AUTO_INCREMENT PRIMARY KEY,
        ip_address VARCHAR(100),
        tanggal DATE,
        user_agent VARCHAR(255)
    )
");

$cek = mysqli_query($koneksi, "
    SELECT * FROM visitor_counter 
    WHERE ip_address = '$ip' AND tanggal = '$tanggal'
");

if(mysqli_num_rows($cek) == 0){
    mysqli_query($koneksi, "
        INSERT INTO visitor_counter (ip_address, tanggal) 
        VALUES ('$ip', '$tanggal')
    ");
}

$totalVisitor = mysqli_fetch_assoc(mysqli_query($koneksi, "
    SELECT COUNT(DISTINCT ip_address) as total FROM visitor_counter
"))['total'];
?>

<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
    <title>Profil Instansi | DPAD Solok Selatan</title>

    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css">
    <link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">

    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Inter', sans-serif;
            background: #f5f7fb;
            color: #1e293b;
        }

        /* ========== HEADER PREMIUM ========== */
        .header {
            background: linear-gradient(135deg, #0a3d32, #1a5f4b);
            padding: 15px 40px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            position: sticky;
            top: 0;
            z-index: 100;
            box-shadow: 0 4px 20px rgba(0,0,0,0.1);
        }

        .logo-area {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .logo-box {
            width: 50px;
            height: 50px;
            background: rgba(255,255,255,0.15);
            border-radius: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: 0.3s;
        }

        .logo-box:hover {
            transform: scale(1.05);
            background: rgba(255,255,255,0.25);
        }

        .logo-box img {
            width: 35px;
            height: 35px;
            object-fit: contain;
        }

        .logo-box i {
            font-size: 26px;
            color: #f5c542;
        }

        .logo-text h2 {
            color: white;
            font-size: 1rem;
            font-weight: 700;
            line-height: 1.3;
        }

        .logo-text p {
            color: rgba(255,255,255,0.7);
            font-size: 0.65rem;
            margin-top: 3px;
        }

        .header-actions {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .icon-btn {
            position: relative;
            background: rgba(255,255,255,0.12);
            backdrop-filter: blur(10px);
            color: white;
            width: 42px;
            height: 42px;
            border-radius: 50%;
            text-decoration: none;
            font-size: 1.2rem;
            transition: all 0.3s;
            border: 1px solid rgba(255,255,255,0.2);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
        }

        .icon-btn:hover {
            background: white;
            color: #1a5f4b;
            transform: translateY(-3px);
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        }

        .icon-btn .tooltip {
            position: absolute;
            bottom: -40px;
            left: 50%;
            transform: translateX(-50%);
            background: #1e293b;
            color: white;
            padding: 6px 12px;
            border-radius: 8px;
            font-size: 0.7rem;
            font-weight: 500;
            white-space: nowrap;
            opacity: 0;
            visibility: hidden;
            transition: all 0.3s;
            z-index: 100;
            pointer-events: none;
        }

        .icon-btn .tooltip::before {
            content: '';
            position: absolute;
            top: -5px;
            left: 50%;
            transform: translateX(-50%);
            border-left: 5px solid transparent;
            border-right: 5px solid transparent;
            border-bottom: 5px solid #1e293b;
        }

        .icon-btn:hover .tooltip {
            opacity: 1;
            visibility: visible;
            bottom: -35px;
        }

        /* ========== HERO SECTION ========== */
        .hero {
            background: linear-gradient(135deg, #1a5f4b 0%, #0f3b2c 100%);
            padding: 80px 20px;
            text-align: center;
            position: relative;
            overflow: hidden;
        }

        .hero::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="rgba(255,255,255,0.05)" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,122.7C672,117,768,139,864,154.7C960,171,1056,181,1152,165.3C1248,149,1344,107,1392,85.3L1440,64L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') repeat-x bottom;
            background-size: cover;
            opacity: 0.15;
        }

        .hero::after {
            content: "🏛️";
            position: absolute;
            right: -30px;
            top: -30px;
            font-size: 180px;
            opacity: 0.08;
            transform: rotate(15deg);
        }

        .hero-content {
            position: relative;
            z-index: 2;
        }

        .hero-badge {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            background: rgba(255,255,255,0.15);
            backdrop-filter: blur(10px);
            padding: 6px 18px;
            border-radius: 40px;
            font-size: 0.8rem;
            margin-bottom: 20px;
            color: #ffd966;
        }

        .hero h1 {
            font-size: 2.8rem;
            font-weight: 800;
            color: white;
            margin-bottom: 15px;
        }

        .hero h1 i {
            color: #f5c542;
            margin-right: 10px;
        }

        .hero p {
            max-width: 700px;
            margin: 0 auto;
            font-size: 1rem;
            color: rgba(255,255,255,0.9);
            line-height: 1.6;
        }

        /* ========== BREADCRUMB ========== */
        .breadcrumb {
            background: white;
            padding: 12px 40px;
            border-bottom: 1px solid #e2e8f0;
        }

        .breadcrumb .container {
            max-width: 1280px;
            margin: 0 auto;
        }

        .breadcrumb a {
            color: #1a5f4b;
            text-decoration: none;
            font-size: 14px;
        }

        .breadcrumb a:hover {
            text-decoration: underline;
        }

        .breadcrumb span {
            color: #94a3b8;
            font-size: 14px;
        }

        /* ========== MAIN CONTENT ========== */
        .container {
            max-width: 1280px;
            margin: 0 auto;
            padding: 60px 20px;
        }

        /* ========== CARD STYLE ========== */
        .card {
            background: white;
            border-radius: 24px;
            padding: 40px;
            margin-bottom: 30px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.05);
            transition: all 0.3s;
            border: 1px solid rgba(0,0,0,0.03);
        }

        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0,0,0,0.1);
        }

        .card .card-header {
            display: flex;
            align-items: center;
            gap: 15px;
            margin-bottom: 25px;
            padding-bottom: 15px;
            border-bottom: 2px solid #f5c542;
        }

        .card .card-header i {
            font-size: 2rem;
            color: #1a5f4b;
            background: #dcfce7;
            padding: 15px;
            border-radius: 16px;
            min-width: 60px;
            text-align: center;
        }

        .card .card-header h2 {
            font-size: 1.5rem;
            font-weight: 700;
            color: #0f3b2c;
        }

        /* ========== SECTION TITLE ========== */
        .section-title {
            text-align: center;
            margin-bottom: 45px;
        }

        .section-title h2 {
            color: #0f3b2c;
            font-size: 2rem;
            font-weight: 700;
            margin-bottom: 10px;
        }

        .section-title p {
            color: #64748b;
            font-size: 1rem;
        }

        .section-title .line {
            width: 80px;
            height: 3px;
            background: linear-gradient(90deg, #f5c542, #1a5f4b);
            margin: 15px auto 0;
            border-radius: 3px;
        }

        /* ========== GRID ========== */
        .grid-4 {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 25px;
        }

        .grid-3 {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 25px;
        }

        .grid-2 {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 30px;
        }

        .info-box {
            background: #f8fafc;
            padding: 25px;
            border-radius: 16px;
            transition: all 0.3s;
            border: 1px solid #e2e8f0;
        }

        .info-box:hover {
            transform: translateY(-5px);
            border-color: #1a5f4b;
            box-shadow: 0 10px 25px rgba(0,0,0,0.1);
        }

        .info-box h3 {
            margin-bottom: 15px;
            color: #1a5f4b;
            font-size: 1.1rem;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .info-box h3 i {
            color: #f5c542;
        }

        .info-box p {
            line-height: 1.8;
            color: #475569;
            margin-bottom: 5px;
            font-size: 0.9rem;
        }

        .info-box p strong {
            color: #1e293b;
        }

        /* ========== VISI ========== */
        .visi-card {
            background: linear-gradient(135deg, #1a5f4b, #0f3b2c);
            color: white;
            text-align: center;
            position: relative;
            overflow: hidden;
        }

        .visi-card::before {
            content: "✨";
            position: absolute;
            font-size: 120px;
            right: 20px;
            bottom: 20px;
            opacity: 0.06;
        }

        .visi-card h2 {
            color: #f5c542;
            font-size: 2rem;
            margin-bottom: 20px;
        }

        .visi-card p {
            font-size: 1.3rem;
            line-height: 1.8;
            font-weight: 500;
        }

        /* ========== MISI ========== */
        .misi-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 25px;
        }

        .misi-card {
            background: #f8fafc;
            border-radius: 16px;
            padding: 25px;
            transition: all 0.3s;
            border: 1px solid #e2e8f0;
            position: relative;
            overflow: hidden;
        }

        .misi-card::before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 3px;
            background: linear-gradient(90deg, #1a5f4b, #f5c542);
            transform: scaleX(0);
            transition: transform 0.3s;
        }

        .misi-card:hover::before {
            transform: scaleX(1);
        }

        .misi-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(0,0,0,0.1);
        }

        .misi-number {
            width: 45px;
            height: 45px;
            border-radius: 12px;
            background: linear-gradient(135deg, #1a5f4b, #0f3b2c);
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            font-size: 1.2rem;
            margin-bottom: 15px;
        }

        .misi-card p {
            line-height: 1.8;
            color: #475569;
        }

        /* ========== MAP ========== */
        .map-container {
            border-radius: 16px;
            overflow: hidden;
            box-shadow: 0 5px 15px rgba(0,0,0,0.1);
            margin-bottom: 20px;
        }

        .map-container iframe {
            display: block;
            width: 100%;
            height: 350px;
            border: 0;
        }

        .location-info {
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 20px;
            padding-top: 20px;
            border-top: 1px solid #e2e8f0;
        }

        .location-address {
            display: flex;
            gap: 15px;
            align-items: flex-start;
        }

        .location-address i {
            font-size: 24px;
            color: #f5c542;
            margin-top: 3px;
        }

        .location-address strong {
            color: #1e293b;
            font-size: 1rem;
        }

        .location-address div {
            color: #475569;
            font-size: 0.85rem;
            line-height: 1.6;
        }

        .direction-btn {
            display: inline-flex;
            align-items: center;
            gap: 10px;
            background: linear-gradient(135deg, #1a5f4b, #0f3b2c);
            color: white;
            padding: 12px 24px;
            border-radius: 40px;
            text-decoration: none;
            font-weight: 600;
            font-size: 0.85rem;
            transition: all 0.3s;
            white-space: nowrap;
        }

        .direction-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(26,95,75,0.3);
            gap: 15px;
        }

        /* ========== STATISTIK ========== */
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 25px;
        }

        .stat-card {
            text-align: center;
            padding: 25px;
            background: #f8fafc;
            border-radius: 16px;
            transition: all 0.3s;
            border: 1px solid #e2e8f0;
        }

        .stat-card:hover {
            transform: translateY(-5px);
            background: linear-gradient(135deg, #1a5f4b, #0f3b2c);
            color: white;
        }

        .stat-card:hover h3,
        .stat-card:hover p {
            color: white;
        }

        .stat-card i {
            font-size: 40px;
            color: #f5c542;
            margin-bottom: 15px;
        }

        .stat-card h3 {
            font-size: 28px;
            color: #1a5f4b;
            margin-bottom: 5px;
            font-weight: 800;
        }

        .stat-card p {
            color: #64748b;
            font-weight: 500;
            font-size: 0.85rem;
        }

        /* ========== DASAR HUKUM ========== */
        .hukum-list {
            padding-left: 0;
            list-style: none;
        }

        .hukum-list li {
            padding: 10px 0;
            display: flex;
            align-items: center;
            gap: 12px;
            border-bottom: 1px solid #e2e8f0;
            color: #475569;
        }

        .hukum-list li:last-child {
            border-bottom: none;
        }

        .hukum-list li i {
            color: #1a5f4b;
            font-size: 18px;
            width: 25px;
            flex-shrink: 0;
        }

        /* ========== FOOTER PREMIUM ========== */
        .footer-premium {
            background: linear-gradient(135deg, #0a3d32, #0f3b2c);
            color: #ffffff;
            position: relative;
            overflow: hidden;
            padding-top: 60px;
            margin-top: 60px;
        }

        .footer-premium::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 3px;
            background: linear-gradient(90deg, #f5c542, #eab308, #f5c542);
        }

        .footer-premium::after {
            content: '📚';
            position: absolute;
            bottom: 20px;
            right: 20px;
            font-size: 120px;
            opacity: 0.03;
            pointer-events: none;
        }

        .footer-container {
            max-width: 1280px;
            margin: 0 auto;
            padding: 0 20px;
        }

        .footer-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 35px;
            margin-bottom: 50px;
        }

        .footer-col h3 {
            font-size: 1.1rem;
            font-weight: 700;
            margin-bottom: 25px;
            position: relative;
            display: inline-block;
            padding-bottom: 10px;
            color: #f5c542;
        }

        .footer-col h3::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 40px;
            height: 2px;
            background: #f5c542;
            border-radius: 2px;
        }

        .footer-logo {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 20px;
        }

        .footer-logo .logo-icon {
            width: 50px;
            height: 50px;
            background: rgba(255,255,255,0.1);
            border-radius: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .footer-logo .logo-icon i {
            font-size: 28px;
            color: #f5c542;
        }

        .footer-logo .logo-text h3 {
            font-size: 1.1rem;
            font-weight: 700;
            margin-bottom: 4px;
            color: white;
        }

        .footer-logo .logo-text p {
            font-size: 0.7rem;
            opacity: 0.7;
            color: rgba(255,255,255,0.7);
        }

        .footer-description {
            color: #cbd5e1;
            line-height: 1.6;
            margin-bottom: 20px;
            font-size: 0.85rem;
        }

        .footer-menu {
            list-style: none;
        }

        .footer-menu li {
            margin-bottom: 12px;
        }

        .footer-menu li a {
            color: #cbd5e1;
            text-decoration: none;
            transition: all 0.3s;
            display: inline-flex;
            align-items: center;
            gap: 10px;
            font-size: 0.85rem;
        }

        .footer-menu li a i {
            width: 20px;
            font-size: 0.8rem;
            color: #f5c542;
        }

        .footer-menu li a:hover {
            color: #f5c542;
            transform: translateX(8px);
        }

        .social-links {
            display: flex;
            gap: 12px;
            margin-top: 20px;
        }

        .social-icon {
            width: 38px;
            height: 38px;
            border-radius: 50%;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            color: white;
            transition: all 0.3s;
            font-size: 1rem;
            text-decoration: none;
        }

        .social-fb { background: #1877f2; }
        .social-ig { background: #e4405f; }
        .social-yt { background: #ff0000; }
        .social-tt { background: #010101; }

        .social-icon:hover {
            transform: translateY(-3px);
            filter: brightness(1.1);
            box-shadow: 0 5px 15px rgba(0,0,0,0.2);
        }

        .footer-contact-item {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 15px;
            color: #cbd5e1;
            font-size: 0.85rem;
        }

        .footer-contact-item i {
            width: 35px;
            height: 35px;
            background: rgba(245,197,66,0.12);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #f5c542;
            font-size: 0.9rem;
            flex-shrink: 0;
        }

        .footer-bottom {
            border-top: 1px solid rgba(255,255,255,0.08);
            padding-top: 25px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 15px;
        }

        .footer-bottom p {
            color: rgba(255,255,255,0.6);
            font-size: 0.75rem;
        }

        .visitor-badge {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background: rgba(255,255,255,0.08);
            padding: 5px 12px;
            border-radius: 30px;
            font-size: 0.7rem;
            color: #f5c542;
        }

        .dev-credit {
            text-align: center;
            padding-top: 20px;
            margin-top: 20px;
            border-top: 1px solid rgba(255,255,255,0.05);
            color: #94a3b8;
            font-size: 0.75rem;
        }

        .dev-credit a {
            color: #f5c542;
            text-decoration: none;
            font-weight: 500;
        }

        /* ========== RESPONSIVE ========== */
        @media (max-width: 1200px) {
            .grid-4 {
                grid-template-columns: repeat(2, 1fr);
            }
            .stats-grid {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        @media (max-width: 992px) {
            .grid-3 {
                grid-template-columns: repeat(2, 1fr);
            }
            .grid-2 {
                grid-template-columns: 1fr;
                gap: 20px;
            }
            .footer-grid {
                grid-template-columns: repeat(2, 1fr);
                gap: 30px;
            }
            .hero h1 {
                font-size: 2rem;
            }
        }

        @media (max-width: 768px) {
            .header {
                padding: 12px 20px;
            }
            .logo-text h2 {
                font-size: 0.8rem;
            }
            .logo-box {
                width: 40px;
                height: 40px;
            }
            .icon-btn {
                width: 38px;
                height: 38px;
                font-size: 1rem;
            }
            .hero {
                padding: 50px 20px 70px;
            }
            .hero h1 {
                font-size: 1.6rem;
            }
            .hero p {
                font-size: 0.85rem;
            }
            .breadcrumb {
                padding: 10px 20px;
            }
            .container {
                padding: 40px 15px;
            }
            .card {
                padding: 25px;
            }
            .card .card-header h2 {
                font-size: 1.2rem;
            }
            .card .card-header i {
                font-size: 1.5rem;
                padding: 12px;
                min-width: 48px;
            }
            .grid-4 {
                grid-template-columns: 1fr 1fr;
                gap: 15px;
            }
            .grid-3 {
                grid-template-columns: 1fr;
                gap: 20px;
            }
            .stats-grid {
                grid-template-columns: 1fr 1fr;
                gap: 15px;
            }
            .section-title h2 {
                font-size: 1.5rem;
            }
            .visi-card p {
                font-size: 1.1rem;
            }
            .misi-grid {
                grid-template-columns: 1fr;
                gap: 20px;
            }
            .location-info {
                flex-direction: column;
                align-items: flex-start;
            }
            .direction-btn {
                width: 100%;
                justify-content: center;
            }
            .map-container iframe {
                height: 250px;
            }
            .footer-grid {
                grid-template-columns: 1fr 1fr;
                gap: 30px;
            }
        }

        @media (max-width: 576px) {
            .header-actions {
                gap: 8px;
            }
            .icon-btn {
                width: 35px;
                height: 35px;
                font-size: 0.9rem;
            }
            .hero-badge {
                font-size: 0.7rem;
            }
            .grid-4 {
                grid-template-columns: 1fr;
                gap: 15px;
            }
            .stats-grid {
                grid-template-columns: 1fr;
                gap: 15px;
            }
            .stat-card {
                padding: 20px;
            }
            .stat-card i {
                font-size: 30px;
            }
            .stat-card h3 {
                font-size: 22px;
            }
            .footer-grid {
                grid-template-columns: 1fr;
                gap: 25px;
                text-align: center;
            }
            .footer-logo {
                justify-content: center;
            }
            .footer-col h3::after {
                left: 50%;
                transform: translateX(-50%);
            }
            .footer-menu li a {
                justify-content: center;
            }
            .social-links {
                justify-content: center;
            }
            .footer-contact-item {
                justify-content: center;
            }
            .footer-bottom {
                flex-direction: column;
                text-align: center;
            }
            .dev-credit {
                font-size: 0.65rem;
            }
        }

        @media (max-width: 480px) {
            .container {
                padding: 30px 12px;
            }
            .card {
                padding: 20px;
            }
            .card .card-header {
                flex-wrap: wrap;
            }
            .card .card-header h2 {
                font-size: 1rem;
            }
            .card .card-header i {
                font-size: 1.2rem;
                padding: 10px;
                min-width: 40px;
            }
            .info-box {
                padding: 20px;
            }
            .info-box h3 {
                font-size: 1rem;
            }
            .info-box p {
                font-size: 0.8rem;
            }
            .misi-card {
                padding: 20px;
            }
            .misi-number {
                width: 40px;
                height: 40px;
                font-size: 1rem;
            }
            .section-title h2 {
                font-size: 1.3rem;
            }
            .visi-card h2 {
                font-size: 1.5rem;
            }
            .visi-card p {
                font-size: 1rem;
            }
            .location-address strong {
                font-size: 0.85rem;
            }
            .location-address div {
                font-size: 0.75rem;
            }
            .direction-btn {
                font-size: 0.75rem;
                padding: 10px 16px;
            }
            .hukum-list li {
                font-size: 0.8rem;
                padding: 8px 0;
            }
            .hukum-list li i {
                font-size: 14px;
                width: 20px;
            }
        }
        .header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ===== MENU ITEM DENGAN TOOLTIP DI BAWAH ===== */
.menu-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.header-icon {
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(10px);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    text-decoration: none;
    font-size: 1.1rem;
    transition: all 0.3s;
    border: 1px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.header-icon:hover {
    background: white;
    color: #1a5f4b;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.back-btn {
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(10px);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    text-decoration: none;
    font-size: 1.1rem;
    transition: all 0.3s;
    border: 1px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.back-btn:hover {
    background: white;
    color: #1a5f4b;
    transform: translateX(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ===== TOOLTIP STYLING ===== */
.menu-item .tooltip {
    position: absolute;
    bottom: -38px;
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(10px);
    color: white;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    pointer-events: none;
    border: 1px solid rgba(255,255,255,0.08);
    letter-spacing: 0.3px;
    z-index: 99999;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.menu-item .tooltip::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    background: rgba(0,0,0,0.85);
    border-radius: 2px;
    border-top: 1px solid rgba(255,255,255,0.08);
    border-left: 1px solid rgba(255,255,255,0.08);
    z-index: 99999;
}

.menu-item:hover .tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scale(1);
    bottom: -42px;
}
    </style>
</head>
<body>

<!-- ========== HEADER PREMIUM ========== -->
<div class="header">
    <div class="logo-area">
        <div class="logo-box">
            <?php if(file_exists("img/logo.png")): ?>
                <img src="img/logo.png" alt="Logo DPAD">
            <?php else: ?>
                <i class="fas fa-archive"></i>
            <?php endif; ?>
        </div>
        <div class="logo-text">
            <h2>DINAS KEARSIPAN<br>KABUPATEN SOLOK SELATAN</h2>
            <p>Dinas Perpustakaan dan Arsip Daerah</p>
        </div>
    </div>
    
  <div class="header-actions">
    <!-- Beranda -->
    <div class="header-actions">
        <a href="dashboard.php" class="icon-btn">
            <i class="fas fa-home"></i>
            <span class="tooltip">Beranda</span>
        </a>
        <div class="menu-item">
        <a href="sejarah.php" class="header-icon">
            <i class="fas fa-user-circle"></i>
        </a>
        <span class="tooltip">Profil</span>
    </div>
        <a href="javascript:history.back()" class="icon-btn">
            <i class="fas fa-arrow-left"></i>
            <span class="tooltip">Kembali</span>
        </a>
    </div>
    <!-- Profil -->
    
    
</div>
</div>

<!-- ========== HERO SECTION ========== -->
<section class="hero">
    <div class="hero-content" data-aos="fade-up">
        <div class="hero-badge">
            <i class="fas fa-building"></i> Profil Instansi
        </div>
        <h1>
            <i class="fas fa-info-circle"></i> 
            Profil Dinas Kearsipan dan Perpustakaan
        </h1>
        <p>Dinas Perpustakaan dan Arsip Daerah Kabupaten Solok Selatan</p>
    </div>
</section>

<!-- ========== BREADCRUMB ========== -->
<div class="breadcrumb">
    <div class="container">
        <a href="dashboard.php">Beranda</a> / <span>Profil Instansi</span>
    </div>
</div>

<!-- ========== MAIN CONTENT ========== -->
<div class="container">

    <!-- ===== PROFIL LEMBAGA ===== -->
    <div class="card" data-aos="fade-up">
        <div class="section-title">
            <h2>Profil Lembaga</h2>
            <p>Informasi Umum Dinas Perpustakaan dan Arsip Daerah</p>
            <div class="line"></div>
        </div>
        <div class="grid-4">
            <div class="info-box">
                <h3><i class="fas fa-building"></i> Informasi</h3>
                <p><strong>Status Lembaga :</strong> Dinas Tipe B</p>
                <p><strong>SK Lembaga :</strong> Perda No. 5 Tahun 2016</p>
                <p><strong>Tahun Berdiri :</strong> 2009</p>
                <p><strong>Kepala Dinas :</strong> SYAMSURIA, S.Pd. MM</p>
            </div>
            <div class="info-box">
                <h3><i class="fas fa-location-dot"></i> Alamat</h3>
                <p>Jalan Rimbo Tangah</p>
                <p>Lubuk Gadang</p>
                <p>Kecamatan Sangir</p>
                <p>Kabupaten Solok Selatan</p>
                <p>Sumatera Barat - 27778</p>
            </div>
            <div class="info-box">
                <h3><i class="fas fa-envelope"></i> Kontak</h3>
                <p><strong>Email :</strong> pustaka.arsipsolsel@gmail.com</p>
                <p><strong>Website :</strong> perpustakaan.solselkab.go.id</p>
                <p><strong>Instagram :</strong> @arsip_solsel</p>
                <p><strong>Facebook :</strong> perpusda_solsel</p>
            </div>
            <div class="info-box">
                <h3><i class="fas fa-clock"></i> Jam Layanan</h3>
                <p><strong>Senin - Kamis :</strong> 08.00 - 16.00 WIB</p>
                <p><strong>Jumat :</strong> 08.00 - 16.30 WIB</p>
                <p style="margin-top:8px;"><strong>Istirahat :</strong></p>
                <p>Senin - Kamis : 12.00 - 13.00 WIB</p>
                <p>Jumat : 11.30 - 13.30 WIB</p>
            </div>
        </div>
    </div>
    <!-- ===== LOKASI & PETA ===== -->
    <div class="card" data-aos="fade-up">
        <div class="section-title">
            <h2><i class="fas fa-map-marker-alt"></i> Lokasi Kami</h2>
            <p>Mudah dijangkau dan strategis</p>
            <div class="line"></div>
        </div>
        
        <div class="map-container">
            <iframe 
                src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d127628.41027355246!2d101.10841049726561!3d-1.5343267999999959!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x2e2cf506b0697671%3A0x6483adcc85c683cb!2sGedung%20layanan%20perpustakaan%20daerah%20kabupaten%20solok%20selatan!5e0!3m2!1sid!2sid!4v1780452106554!5m2!1sid!2sid" 
                allowfullscreen="" 
                loading="lazy" 
                referrerpolicy="no-referrer-when-downgrade">
            </iframe>
        </div>
        
        <div class="location-info">
            <div class="location-address">
                <i class="fas fa-map-pin"></i>
                <div>
                    <strong>Dinas Perpustakaan dan Arsip Daerah</strong><br>
                    Gedung Layanan Perpustakaan Daerah Kabupaten Solok Selatan<br>
                    Jalan Rimbo Tangah, Lubuk Gadang, Sangir<br>
                    Kabupaten Solok Selatan, Sumatera Barat 27778
                </div>
            </div>
            <a href="https://www.google.com/maps/dir/?api=1&destination=-1.5343268,101.1084105&destination_place_id=ChIJcWdpBbTyLiwRg8aFzYPNZgQ" 
               target="_blank" class="direction-btn">
                <i class="fas fa-directions"></i> Petunjuk Arah
            </a>
        </div>
    </div>

    <!-- ===== STATISTIK ===== -->
    <div class="card" data-aos="fade-up">
        <div class="section-title">
            <h2>Wilayah Kabupaten Solok Selatan</h2>
            <div class="line"></div>
        </div>
        <div class="stats-grid">
            <div class="stat-card">
                <i class="fas fa-mountain"></i>
                <h3>3.346 km²</h3>
                <p>Luas Wilayah</p>
            </div>
            <div class="stat-card">
                <i class="fas fa-users"></i>
                <h3>182.027</h3>
                <p>Jumlah Penduduk</p>
            </div>
            <div class="stat-card">
                <i class="fas fa-tractor"></i>
                <h3>Pertanian</h3>
                <p>Potensi Unggulan</p>
            </div>
            <div class="stat-card">
                <i class="fas fa-umbrella-beach"></i>
                <h3>Pariwisata</h3>
                <p>Destinasi Menarik</p>
            </div>
        </div>
    </div>

    <!-- ===== SEJARAH ===== -->
    <div class="card" data-aos="fade-up">
        <div class="section-title">
            <h2>Sejarah Singkat</h2>
            <div class="line"></div>
        </div>
        <p style="line-height: 2; margin-bottom: 15px;">
            Kantor Perpustakaan dan Arsip berdiri pada tahun 2009
            berdasarkan Peraturan Bupati Solok Selatan Nomor 40 Tahun 2009
            tentang rincian tugas pokok Kantor Perpustakaan dan Arsip
            Kabupaten Solok Selatan.
        </p>
        <p style="line-height: 2; margin-bottom: 15px;">
            Pada tahun 2017 terjadi perubahan berdasarkan Peraturan
            Pemerintah Daerah No. 15 Tahun 2016 tentang Pembentukan dan
            Susunan Perangkat Daerah sehingga berubah menjadi Dinas
            Perpustakaan dan Kearsipan Kabupaten Solok Selatan.
        </p>
        <p style="line-height: 2;">
            Fungsi utama dinas adalah merumuskan kebijakan teknis bidang
            perpustakaan dan kearsipan serta mendukung penyelenggaraan
            pemerintahan daerah di bidang perpustakaan dan kearsipan.
        </p>
    </div>

    <!-- ===== DASAR HUKUM ===== -->
    <div class="card" data-aos="fade-up">
        <div class="section-title">
            <h2>Dasar Hukum</h2>
            <div class="line"></div>
        </div>
        <ul class="hukum-list">
            <li><i class="fas fa-gavel"></i> UU No. 38 Tahun 2003 tentang Pembentukan Kabupaten Solok Selatan</li>
            <li><i class="fas fa-gavel"></i> UU No. 43 Tahun 2007 tentang Perpustakaan</li>
            <li><i class="fas fa-gavel"></i> UU No. 43 Tahun 2009 tentang Kearsipan</li>
            <li><i class="fas fa-gavel"></i> PP No. 38 Tahun 2007 tentang Pembagian Urusan Pemerintahan</li>
            <li><i class="fas fa-gavel"></i> PP No. 24 Tahun 2017 tentang Pengelolaan Arsip</li>
            <li><i class="fas fa-gavel"></i> Peraturan Bupati Solok Selatan No. 15 Tahun 2018</li>
            <li><i class="fas fa-gavel"></i> Peraturan Bupati Solok Selatan No. 103 Tahun 2018</li>
            <li><i class="fas fa-gavel"></i> Peraturan Bupati Solok Selatan No. 51 Tahun 2019</li>
            <li><i class="fas fa-gavel"></i> Peraturan Bupati Solok Selatan No. 65 Tahun 2019</li>
        </ul>
    </div>

</div>

<!-- ========== FOOTER PREMIUM ========== -->
<footer class="footer-premium">
    <div class="footer-container">
        <div class="footer-grid">
            <div class="footer-col" data-aos="fade-up">
                <div class="footer-logo">
                    <div class="logo-icon">
                        <?php if(file_exists("img/logo.png")): ?>
                            <img src="img/logo.png" style="width:35px; height:35px; object-fit:contain;">
                        <?php else: ?>
                            <i class="fas fa-archive"></i>
                        <?php endif; ?>
                    </div>
                    <div class="logo-text">
                        <h3>Dinas Arsip Solok Selatan</h3>
                        <p>Dinas Perpustakaan & Arsip Daerah</p>
                    </div>
                </div>
                <p class="footer-description">
                    Melestarikan sejarah, menjaga arsip, dan membangun peradaban literasi untuk masyarakat Solok Selatan yang cerdas dan berbudaya.
                </p>
                <div class="social-links">
                    <a href="https://www.facebook.com/profile.php?id=61573699960407" class="social-icon social-fb"><i class="fab fa-facebook-f"></i></a>
                    <a href="https://www.instagram.com/arsip_solsel/" class="social-icon social-ig" target="_blank"><i class="fab fa-instagram"></i></a>
                    <a href="https://www.youtube.com/@pustakadpksolsel" class="social-icon social-yt"><i class="fab fa-youtube"></i></a>
                    <a href="https://www.tiktok.com/@solselnews" class="social-icon social-tt"><i class="fab fa-tiktok"></i></a>
                </div>
            </div>

            <div class="footer-col" data-aos="fade-up" data-aos-delay="100">
                <h3><i class="fas fa-link"></i> Menu Cepat</h3>
                <ul class="footer-menu">
                    <li><a href="dashboard.php"><i class="fas fa-home"></i> Beranda</a></li>
                    <li><a href="profil_istansi.php"><i class="fas fa-building"></i> Profil</a></li>
                    <li><a href="visi.php"><i class="fas fa-eye"></i> Visi & Misi</a></li>
                    <li><a href="struktur.php"><i class="fas fa-diagram-project"></i> Struktur Organisasi</a></li>
                    <li><a href="berita.php"><i class="fas fa-newspaper"></i> Berita</a></li>
                </ul>
            </div>

            <div class="footer-col" data-aos="fade-up" data-aos-delay="200">
                <h3><i class="fas fa-star"></i> Layanan</h3>
                <ul class="footer-menu">
                    <li><a href="https://perpustakaan.solselkab.go.id/read/166/bidang-kearsipan"><i class="fas fa-book"></i> Perpustakaan</a></li>
                    <li><a href="layanan_arsip.php"><i class="fas fa-archive"></i> Kearsipan</a></li>
                    <li><a href="layanan_kunjungan.php"><i class="fas fa-users"></i> Kunjungan Edukasi</a></li>
                    <li><a href="layanan_konsultasi.php"><i class="fas fa-comments"></i> Konsultasi Arsip</a></li>
                    <li><a href="pengaduan.php"><i class="fas fa-headset"></i> Pengaduan Masyarakat</a></li>
                </ul>
            </div>

            <div class="footer-col" data-aos="fade-up" data-aos-delay="300">
                <h3><i class="fas fa-map-marker-alt"></i> Lokasi & Kontak</h3>
                <div class="footer-contact-item">
                    <i class="fas fa-map-marker-alt"></i>
                    <span>Jl. Lubuk Gadang - Simpang Tigo Rimbo Tangah, Sangir, Solok Selatan</span>
                </div>
                <div class="footer-contact-item">
                    <i class="fas fa-envelope"></i>
                    <span>pustaka.arsipsolsel@gmail.com</span>
                </div>
                <div class="footer-contact-item">
                    <i class="fas fa-clock"></i>
                    <span>Senin - Jumat, 08:00 - 16:00 WIB</span>
                </div>
            </div>
        </div>

        <div class="footer-bottom">
            <div>
                <p>&copy; <?php echo date('Y'); ?> Dinas Perpustakaan dan Arsip Daerah Kabupaten Solok Selatan</p>
                <p style="margin-top: 5px;">All Rights Reserved | <a>Kebijakan Privasi</a> | <a>Sitemap</a></p>
            </div>
            <div>
                <p>Sistem Informasi Perpustakaan dan Arsip Daerah</p>
                <div class="visitor-badge">
                    <i class="fas fa-eye"></i> <?php echo number_format($totalVisitor); ?> Pengunjung
                </div>
            </div>
        </div>
        
        <div class="dev-credit">
            Developed by <a href="https://www.pnp.ac.id/download/psdku-solok-selatan/" target="_blank">PSDKU Solok Selatan</a>
        </div>
    </div>
</footer>

<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
<script>
    AOS.init({
        duration: 800,
        once: true,
        offset: 50,
        easing: 'ease-in-out'
    });
</script>

</body>
</html>