<?php
session_start();

include 'koneksi.php';

// Cek koneksi database
if (!$koneksi) {
    die("Koneksi database gagal: " . mysqli_connect_error());
}

// Statistik Otomatis dengan penanganan error
// Total Berita
$q_berita = mysqli_query($koneksi, "SELECT COUNT(*) as total FROM berita");
if ($q_berita && mysqli_num_rows($q_berita) > 0) {
    $total_berita = mysqli_fetch_assoc($q_berita)['total'];
} else {
    $total_berita = 0;
}

// Total Galeri
$q_galeri = mysqli_query($koneksi, "SELECT COUNT(*) as total FROM arsip_foto");
if ($q_galeri && mysqli_num_rows($q_galeri) > 0) {
    $total_galeri = mysqli_fetch_assoc($q_galeri)['total'];
} else {
    $total_galeri = 0;
}

// Total Pengguna
$q_user = mysqli_query($koneksi, "SELECT COUNT(*) as total FROM users");
if ($q_user && mysqli_num_rows($q_user) > 0) {
    $total_user = mysqli_fetch_assoc($q_user)['total'];
} else {
    $total_user = 0;
}

// Total Arsip - coba beberapa kemungkinan nama tabel
$tabel_arsip = '';
$cek_tabel1 = mysqli_query($koneksi, "SHOW TABLES LIKE 'arsip'");
$cek_tabel2 = mysqli_query($koneksi, "SHOW TABLES LIKE 'tb_arsip'");
$cek_tabel3 = mysqli_query($koneksi, "SHOW TABLES LIKE 'data_arsip'");

if ($cek_tabel1 && mysqli_num_rows($cek_tabel1) > 0) {
    $tabel_arsip = 'arsip';
} elseif ($cek_tabel2 && mysqli_num_rows($cek_tabel2) > 0) {
    $tabel_arsip = 'tb_arsip';
} elseif ($cek_tabel3 && mysqli_num_rows($cek_tabel3) > 0) {
    $tabel_arsip = 'data_arsip';
}

if ($tabel_arsip != '') {
    $q_arsip = mysqli_query($koneksi, "SELECT COUNT(*) as total FROM $tabel_arsip");
    if ($q_arsip && mysqli_num_rows($q_arsip) > 0) {
        $total_arsip = mysqli_fetch_assoc($q_arsip)['total'];
    } else {
        $total_arsip = 0;
    }
} else {
    $total_arsip = 0;
}

// Hitung statistik arsip tambahan (opsional - jika tabel ditemukan)
if ($tabel_arsip != '') {
    // Cek struktur tabel untuk menentukan kolom yang tersedia
    $cek_kolom = mysqli_query($koneksi, "DESCRIBE $tabel_arsip");
    $kolom_tersedia = [];
    if ($cek_kolom) {
        while ($kolom = mysqli_fetch_assoc($cek_kolom)) {
            $kolom_tersedia[] = $kolom['Field'];
        }
    }
    
    // Query dinamis berdasarkan kolom yang tersedia
    if (in_array('jenis_arsip', $kolom_tersedia)) {
        $q_arsip_dinamis = mysqli_query($koneksi, "SELECT COUNT(*) as total FROM $tabel_arsip WHERE jenis_arsip = 'dinamis'");
        $total_arsip_dinamis = ($q_arsip_dinamis && mysqli_num_rows($q_arsip_dinamis) > 0) ? mysqli_fetch_assoc($q_arsip_dinamis)['total'] : 0;
        
        $q_arsip_statis = mysqli_query($koneksi, "SELECT COUNT(*) as total FROM $tabel_arsip WHERE jenis_arsip = 'statis'");
        $total_arsip_statis = ($q_arsip_statis && mysqli_num_rows($q_arsip_statis) > 0) ? mysqli_fetch_assoc($q_arsip_statis)['total'] : 0;
    } else {
        $total_arsip_dinamis = 0;
        $total_arsip_statis = 0;
    }
    
    if (in_array('is_digital', $kolom_tersedia) || in_array('file_digital', $kolom_tersedia)) {
        $kolom_digital = in_array('is_digital', $kolom_tersedia) ? 'is_digital = 1' : "file_digital IS NOT NULL AND file_digital != ''";
        $q_arsip_terdigitalisasi = mysqli_query($koneksi, "SELECT COUNT(*) as total FROM $tabel_arsip WHERE $kolom_digital");
        $total_arsip_terdigitalisasi = ($q_arsip_terdigitalisasi && mysqli_num_rows($q_arsip_terdigitalisasi) > 0) ? mysqli_fetch_assoc($q_arsip_terdigitalisasi)['total'] : 0;
    } else {
        $total_arsip_terdigitalisasi = 0;
    }
} else {
    $total_arsip_dinamis = 0;
    $total_arsip_statis = 0;
    $total_arsip_terdigitalisasi = 0;
}

if (mysqli_error($koneksi)) {
    // echo "<!-- Database Error: " . mysqli_error($koneksi) . " -->";
}
?>

<!DOCTYPE html>
<html lang="id">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=yes">
    <meta name="theme-color" content="#0a3d32">
    <title>Layanan Kearsipan | 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">

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

        html {
            scroll-behavior: smooth;
        }

        body {
            font-family: 'Inter', sans-serif;
            background: #f5f7fa;
            color: #1a2332;
            overflow-x: hidden;
        }

        /* ===== HEADER ===== */
        .header {
            background: linear-gradient(135deg, #0a3d32, #1a5f4b);
            padding: 12px 30px;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 999;
            box-shadow: 0 2px 15px rgba(0,0,0,0.15);
            transition: 0.3s;
        }

        .header-content {
            max-width: 1200px;
            margin: 0 auto;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

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

        .logo-wrapper {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .logo-icon {
            width: 50px;
            height: 50px;
            background: rgba(255,255,255,0.12);
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 2px solid rgba(255,255,255,0.1);
            overflow: hidden;
            flex-shrink: 0;
        }

        .logo-icon img {
            width: 100%;
            height: 100%;
            object-fit: contain;
            padding: 5px;
        }

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

        .logo-text h2 {
            color: white;
            font-size: 16px;
            font-weight: 700;
            line-height: 1.2;
            letter-spacing: 0.5px;
        }

        .logo-text p {
            color: rgba(255,255,255,0.7);
            font-size: 11px;
            letter-spacing: 0.5px;
        }

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

        .header-icon {
            width: 40px;
            height: 40px;
            background: rgba(255,255,255,0.1);
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 18px;
            border: 1px solid rgba(255,255,255,0.05);
            transition: 0.2s;
            text-decoration: none;
            position: relative;
            cursor: pointer;
        }

        .header-icon:hover {
            background: rgba(255,255,255,0.2);
            transform: translateY(-2px);
        }

        /* Tooltip untuk icon */
        .header-icon .tooltip {
            visibility: hidden;
            opacity: 0;
            position: absolute;
            bottom: -30px;
            left: 50%;
            transform: translateX(-50%);
            background: #1a2332;
            color: white;
            padding: 4px 10px;
            border-radius: 6px;
            font-size: 11px;
            white-space: nowrap;
            transition: 0.2s;
            font-weight: 500;
        }

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

        .back-btn {
            background: rgba(255,255,255,0.12);
            color: white;
            padding: 8px 18px;
            border-radius: 10px;
            text-decoration: none;
            font-size: 13px;
            font-weight: 500;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: 0.2s;
            border: 1px solid rgba(255,255,255,0.08);
            position: relative;
        }

        .back-btn:hover {
            background: rgba(255,255,255,0.2);
            transform: translateY(-1px);
        }

        .back-btn i {
            font-size: 14px;
        }

        /* ===== HERO ===== */
        .hero {
            background: linear-gradient(135deg, #0a3d32, #1a5f4b);
            padding: 110px 20px 50px;
            text-align: center;
            position: relative;
        }

        .hero::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            height: 4px;
            background: linear-gradient(90deg, transparent, #f5c542, transparent);
        }

        .hero h1 {
            font-size: 32px;
            font-weight: 800;
            color: white;
            margin-bottom: 10px;
            letter-spacing: -0.5px;
        }

        .hero p {
            font-size: 15px;
            color: rgba(255,255,255,0.85);
            max-width: 600px;
            margin: 0 auto;
            line-height: 1.6;
        }

        /* ===== BREADCRUMB ===== */
        .breadcrumb {
            max-width: 1200px;
            margin: 18px auto 0;
            padding: 0 20px;
            font-size: 13px;
            color: #64748b;
        }

        .breadcrumb a {
            color: #1a5f4b;
            text-decoration: none;
            font-weight: 500;
            transition: 0.2s;
        }

        .breadcrumb a:hover {
            text-decoration: underline;
            color: #0a3d32;
        }

        .breadcrumb span {
            color: #94a3b8;
        }

        /* ===== STATISTIK ===== */
        .stats-wrap {
            max-width: 1200px;
            margin: -25px auto 0;
            padding: 0 20px;
            position: relative;
            z-index: 10;
        }

        .stats-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 18px;
        }

        .stat-card {
            background: white;
            border-radius: 14px;
            padding: 22px 18px;
            text-align: center;
            box-shadow: 0 4px 15px rgba(0,0,0,0.06);
            border: 1px solid #e8edf2;
            transition: 0.3s;
            cursor: default;
        }

        .stat-card:hover {
            transform: translateY(-4px);
            box-shadow: 0 8px 25px rgba(0,0,0,0.1);
            border-color: #1a5f4b;
        }

        .stat-card i {
            font-size: 32px;
            color: #1a5f4b;
            display: block;
            margin-bottom: 6px;
        }

        .stat-card .number {
            font-size: 28px;
            font-weight: 800;
            color: #0a3d32;
            line-height: 1.2;
        }

        .stat-card p {
            font-size: 13px;
            color: #64748b;
            margin-top: 2px;
        }

        /* ===== LAYANAN ===== */
        .layanan-wrap {
            max-width: 1200px;
            margin: 45px auto 0;
            padding: 0 20px 45px;
        }

        .section-title {
            text-align: center;
            margin-bottom: 35px;
        }

        .section-title h2 {
            font-size: 26px;
            font-weight: 800;
            color: #0a3d32;
            display: inline-block;
            padding-bottom: 10px;
            border-bottom: 3px solid #f5c542;
            letter-spacing: -0.5px;
        }

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

        .layanan-card {
            background: white;
            border-radius: 14px;
            padding: 28px 22px;
            text-align: center;
            border: 1px solid #e8edf2;
            transition: 0.3s;
            box-shadow: 0 2px 10px rgba(0,0,0,0.04);
        }

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

        .layanan-icon {
            width: 65px;
            height: 65px;
            background: #eaf5ed;
            border-radius: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 14px;
            transition: 0.3s;
        }

        .layanan-card:hover .layanan-icon {
            background: #1a5f4b;
        }

        .layanan-card:hover .layanan-icon i {
            color: white;
            transform: scale(1.1);
        }

        .layanan-icon i {
            font-size: 30px;
            color: #1a5f4b;
            transition: 0.3s;
        }

        .layanan-card h3 {
            font-size: 17px;
            font-weight: 700;
            color: #0a3d32;
            margin-bottom: 8px;
        }

        .layanan-card p {
            font-size: 13px;
            color: #64748b;
            line-height: 1.5;
            margin-bottom: 14px;
        }

        .layanan-link {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            color: #1a5f4b;
            text-decoration: none;
            font-weight: 600;
            font-size: 13px;
            transition: 0.3s;
        }

        .layanan-link:hover {
            gap: 12px;
            color: #0a3d32;
        }

        /* ===== ALUR ===== */
        .alur-wrap {
            background: #f0f4f8;
            padding: 45px 20px;
        }

        .alur-grid {
            max-width: 1200px;
            margin: 0 auto;
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 18px;
        }

        .alur-item {
            background: white;
            border-radius: 14px;
            padding: 22px 18px;
            text-align: center;
            border: 1px solid #e8edf2;
            transition: 0.3s;
        }

        .alur-item:hover {
            transform: translateY(-4px);
            box-shadow: 0 8px 20px rgba(0,0,0,0.08);
            border-color: #1a5f4b;
        }

        .alur-number {
            width: 44px;
            height: 44px;
            background: #1a5f4b;
            color: white;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 17px;
            font-weight: 700;
            margin: 0 auto 10px;
            transition: 0.3s;
        }

        .alur-item:hover .alur-number {
            background: #f5c542;
            color: #0a3d32;
            transform: scale(1.1);
        }

        .alur-item h4 {
            font-size: 15px;
            font-weight: 700;
            color: #0a3d32;
            margin-bottom: 5px;
        }

        .alur-item p {
            font-size: 12px;
            color: #64748b;
            line-height: 1.4;
        }

        /* ===== SYARAT ===== */
        .syarat-wrap {
            max-width: 1200px;
            margin: 45px auto;
            padding: 0 20px;
        }

        .syarat-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 22px;
        }

        .syarat-card {
            background: white;
            border-radius: 14px;
            padding: 28px 25px;
            border: 1px solid #e8edf2;
            box-shadow: 0 2px 10px rgba(0,0,0,0.04);
            transition: 0.3s;
        }

        .syarat-card:hover {
            box-shadow: 0 8px 25px rgba(0,0,0,0.08);
            border-color: #1a5f4b;
        }

        .syarat-card h3 {
            font-size: 17px;
            font-weight: 700;
            color: #0a3d32;
            margin-bottom: 16px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .syarat-card h3 i {
            color: #1a5f4b;
            font-size: 20px;
        }

        .syarat-list {
            list-style: none;
        }

        .syarat-list li {
            padding: 9px 0;
            border-bottom: 1px solid #f0f4f8;
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 13px;
            color: #334155;
            transition: 0.2s;
        }

        .syarat-list li:hover {
            padding-left: 5px;
        }

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

        .syarat-list li i {
            color: #1a5f4b;
            width: 18px;
            font-size: 14px;
        }

        .syarat-list li strong {
            color: #0a3d32;
        }

        /* ===== KONTAK ===== */
        .kontak-wrap {
            background: linear-gradient(135deg, #0a3d32, #1a5f4b);
            padding: 45px 20px;
            text-align: center;
        }

        .kontak-wrap h3 {
            font-size: 24px;
            font-weight: 700;
            color: white;
            margin-bottom: 8px;
        }

        .kontak-wrap p {
            color: rgba(255,255,255,0.85);
            font-size: 14px;
            margin-bottom: 18px;
        }

        .kontak-btn {
            display: inline-flex;
            align-items: center;
            gap: 10px;
            background: #f5c542;
            color: #0a3d32;
            padding: 12px 32px;
            border-radius: 30px;
            text-decoration: none;
            font-weight: 700;
            font-size: 14px;
            transition: 0.3s;
        }

        .kontak-btn:hover {
            background: white;
            transform: translateY(-3px);
            box-shadow: 0 8px 25px rgba(0,0,0,0.2);
        }

        /* ===== SCROLL TO TOP ===== */
        .scroll-top {
            position: fixed;
            bottom: 30px;
            right: 30px;
            width: 45px;
            height: 45px;
            background: #1a5f4b;
            color: white;
            border: none;
            border-radius: 50%;
            font-size: 18px;
            cursor: pointer;
            box-shadow: 0 4px 15px rgba(0,0,0,0.2);
            transition: 0.3s;
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 100;
        }

        .scroll-top:hover {
            background: #0a3d32;
            transform: translateY(-3px);
            box-shadow: 0 8px 25px rgba(0,0,0,0.3);
        }

        .scroll-top.show {
            display: flex;
        }

        /* ===== WHATSAPP FLOAT ===== */
        .whatsapp-float {
            position: fixed;
            bottom: 90px;
            right: 30px;
            width: 55px;
            height: 55px;
            background: #25d366;
            color: white;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 28px;
            box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
            text-decoration: none;
            transition: 0.3s;
            z-index: 100;
            animation: pulse 2s infinite;
        }

        .whatsapp-float:hover {
            transform: scale(1.1);
            box-shadow: 0 6px 30px rgba(37, 211, 102, 0.6);
        }

        @keyframes pulse {
            0% {
                box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.4);
            }
            70% {
                box-shadow: 0 0 0 15px rgba(37, 211, 102, 0);
            }
            100% {
                box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
            }
        }

        .whatsapp-float .tooltip-wa {
            position: absolute;
            right: 65px;
            background: #1a2332;
            color: white;
            padding: 5px 12px;
            border-radius: 6px;
            font-size: 12px;
            white-space: nowrap;
            opacity: 0;
            visibility: hidden;
            transition: 0.3s;
        }

        .whatsapp-float:hover .tooltip-wa {
            opacity: 1;
            visibility: visible;
        }

        /* ===== FOOTER ===== */
        .footer {
            background: #072d24;
            color: rgba(255,255,255,0.6);
            text-align: center;
            padding: 28px 20px;
            font-size: 13px;
        }

        .footer p:last-child {
            font-size: 11px;
            margin-top: 5px;
            opacity: 0.5;
        }

        /* ===== RESPONSIVE ===== */
        @media (max-width: 1200px) {
            .stats-grid {
                gap: 15px;
            }
        }

        @media (max-width: 992px) {
            .stats-grid {
                grid-template-columns: repeat(2, 1fr);
            }
            .layanan-grid {
                grid-template-columns: repeat(2, 1fr);
            }
            .alur-grid {
                grid-template-columns: repeat(2, 1fr);
            }
            .syarat-grid {
                grid-template-columns: 1fr;
            }
        }

        @media (max-width: 768px) {
            .header {
                padding: 10px 15px;
            }
            
            .logo-icon {
                width: 40px;
                height: 40px;
            }
            
            .logo-icon i {
                font-size: 20px;
            }
            
            .logo-text h2 {
                font-size: 14px;
            }
            
            .logo-text p {
                font-size: 10px;
            }
            
            .header-right {
                gap: 8px;
            }
            
            .header-icon {
                width: 36px;
                height: 36px;
                font-size: 15px;
            }
            
            .header-icon .tooltip {
                display: none;
            }
            
            .back-btn {
                padding: 6px 14px;
                font-size: 12px;
            }
            
            .back-btn span {
                display: none;
            }
            
            .hero {
                padding: 100px 15px 35px;
            }
            
            .hero h1 {
                font-size: 24px;
            }
            
            .hero p {
                font-size: 13px;
            }
            
            .stats-grid {
                grid-template-columns: 1fr 1fr;
                gap: 12px;
            }
            
            .stat-card {
                padding: 16px 12px;
            }
            
            .stat-card .number {
                font-size: 22px;
            }
            
            .stat-card i {
                font-size: 24px;
            }
            
            .stat-card p {
                font-size: 11px;
            }
            
            .layanan-grid {
                grid-template-columns: 1fr;
                gap: 16px;
            }
            
            .alur-grid {
                grid-template-columns: 1fr;
                gap: 14px;
            }
            
            .section-title h2 {
                font-size: 22px;
            }
            
            .layanan-card {
                padding: 22px 18px;
            }
            
            .kontak-wrap h3 {
                font-size: 20px;
            }
            
            .kontak-wrap p {
                font-size: 13px;
            }
            
            .kontak-btn {
                padding: 10px 24px;
                font-size: 13px;
            }
            
            .scroll-top {
                bottom: 20px;
                right: 20px;
                width: 40px;
                height: 40px;
                font-size: 16px;
            }
            
            .whatsapp-float {
                bottom: 75px;
                right: 20px;
                width: 48px;
                height: 48px;
                font-size: 24px;
            }
        }

        @media (max-width: 480px) {
            .stats-grid {
                gap: 8px;
            }
            
            .stat-card {
                padding: 12px 8px;
                border-radius: 10px;
            }
            
            .stat-card .number {
                font-size: 18px;
            }
            
            .stat-card i {
                font-size: 20px;
            }
            
            .stat-card p {
                font-size: 10px;
            }
            
            .logo-icon {
                width: 36px;
                height: 36px;
            }
            
            .logo-text h2 {
                font-size: 12px;
            }
            
            .logo-text p {
                font-size: 9px;
            }
            
            .header-icon {
                width: 32px;
                height: 32px;
                font-size: 13px;
            }
            
            .hero h1 {
                font-size: 20px;
            }
            
            .section-title h2 {
                font-size: 18px;
            }
            
            .layanan-card {
                padding: 18px 14px;
            }
            
            .layanan-icon {
                width: 55px;
                height: 55px;
            }
            
            .layanan-icon i {
                font-size: 24px;
            }
            
            .syarat-card {
                padding: 20px 15px;
            }
            
            .whatsapp-float {
                bottom: 70px;
                right: 15px;
                width: 44px;
                height: 44px;
                font-size: 20px;
            }
        }

        @media (max-width: 360px) {
            .header {
                padding: 8px 10px;
            }
            
            .logo-icon {
                width: 30px;
                height: 30px;
            }
            
            .logo-text h2 {
                font-size: 11px;
            }
            
            .logo-text p {
                font-size: 8px;
            }
            
            .stats-grid {
                grid-template-columns: 1fr 1fr;
                gap: 6px;
            }
            
            .stat-card {
                padding: 10px 6px;
            }
            
            .stat-card .number {
                font-size: 16px;
            }
        }

        /* ===== PRINT STYLE ===== */
        @media print {
            .header {
                position: static;
                background: #0a3d32 !important;
            }
            .header-icon, .back-btn, .scroll-top, .whatsapp-float {
                display: none !important;
            }
            .hero {
                padding: 50px 20px !important;
            }
            .stat-card, .layanan-card, .alur-item, .syarat-card {
                break-inside: avoid;
                box-shadow: none !important;
                border: 1px solid #ddd !important;
            }
        }
    </style>
</head>
<body>

<!-- HEADER FIXED -->
<div class="header">
    <div class="header-content">
        <div class="logo-area">
            <div class="logo-wrapper">
                <div class="logo-icon">
                    <?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</h2>
                    <p>Kabupaten Solok Selatan</p>
                </div>
            </div>
        </div>
        <div class="header-right">
            <a href="dashboard.php" class="header-icon" title="Dashboard">
                <i class="fas fa-home"></i>
                <span class="tooltip">Dashboard</span>
            </a>
            <a href="sejarah_video.php" class="header-icon" title="Video">
    <i class="fas fa-video"></i>
    <span class="tooltip">Video</span>
</a>
            <a href="sejarah_poto.php" class="header-icon" title="Galeri">
                <i class="fas fa-images"></i>
                <span class="tooltip">Galeri</span>
            </a>
            <a href="sejarah.php" class="header-icon" title="Profil">
                <i class="fas fa-user"></i>
                <span class="tooltip">Profil</span>
            </a>
        </div>
    </div>
</div>

<!-- HERO -->
<section class="hero">
    <h1>Layanan Kearsipan</h1>
    <p>Pengelolaan arsip yang tertib, aman, dan terpercaya untuk mendukung tata kelola pemerintahan yang baik</p>
</section>

<!-- BREADCRUMB -->
<div class="breadcrumb">
    <a href="dashboard.php"><i class="fas fa-home"></i> Beranda</a> / <span>Layanan Kearsipan</span>
</div>

<!-- LAYANAN -->
<div class="layanan-wrap">
    <div class="section-title">
        <h2>Layanan Unggulan</h2>
    </div>

    <div class="layanan-grid">
        <div class="layanan-card">
            <div class="layanan-icon"><i class="fas fa-file-alt"></i></div>
            <h3>Arsip Dinamis</h3>
            <p>Pengelolaan arsip aktif dan inaktif di lingkungan Pemkab Solok Selatan</p>
            <a href="layanan_arsip_dinamis.php" class="layanan-link">Selengkapnya <i class="fas fa-arrow-right"></i></a>
        </div>

        <div class="layanan-card">
            <div class="layanan-icon"><i class="fas fa-archive"></i></div>
            <h3>Arsip Statis</h3>
            <p>Pengelolaan arsip bernilai permanen sebagai bukti pertanggungjawaban</p>
            <a href="layanan_arsip_statis.php" class="layanan-link">Selengkapnya <i class="fas fa-arrow-right"></i></a>
        </div>

        <div class="layanan-card">
            <div class="layanan-icon"><i class="fas fa-laptop"></i></div>
            <h3>Digitalisasi Arsip</h3>
            <p>Pengalihan arsip konvensional ke digital untuk kemudahan akses</p>
            <a href="layanan_digitalisasi.php" class="layanan-link">Selengkapnya <i class="fas fa-arrow-right"></i></a>
        </div>

        <div class="layanan-card">
            <div class="layanan-icon"><i class="fas fa-chalkboard-user"></i></div>
            <h3>Bimbingan Teknis</h3>
            <p>Pelatihan dan pendampingan pengelolaan arsip bagi aparatur daerah</p>
            <a href="layanan_bimtek.php" class="layanan-link">Selengkapnya <i class="fas fa-arrow-right"></i></a>
        </div>

        <div class="layanan-card">
            <div class="layanan-icon"><i class="fas fa-search"></i></div>
            <h3>Akses Arsip</h3>
            <p>Pelayanan akses arsip bagi masyarakat dan peneliti</p>
            <a href="layanan_akses.php" class="layanan-link">Selengkapnya <i class="fas fa-arrow-right"></i></a>
        </div>

        <div class="layanan-card">
            <div class="layanan-icon"><i class="fas fa-headset"></i></div>
            <h3>Konsultasi</h3>
            <p>Konsultasi pengelolaan arsip bagi instansi dan masyarakat</p>
            <a href="layanan_konsultasi.php" class="layanan-link">Selengkapnya <i class="fas fa-arrow-right"></i></a>
        </div>
    </div>
</div>

<!-- ALUR -->
<div class="alur-wrap">
    <div class="section-title">
        <h2>Alur Layanan</h2>
    </div>

    <div class="alur-grid">
        <div class="alur-item">
            <div class="alur-number">1</div>
            <h4>Pengajuan</h4>
            <p>Mengajukan permohonan melalui surat atau formulir online</p>
        </div>
        <div class="alur-item">
            <div class="alur-number">2</div>
            <h4>Verifikasi</h4>
            <p>Petugas memeriksa kelengkapan persyaratan</p>
        </div>
        <div class="alur-item">
            <div class="alur-number">3</div>
            <h4>Proses</h4>
            <p>Pelaksanaan layanan sesuai jenis yang diminta</p>
        </div>
        <div class="alur-item">
            <div class="alur-number">4</div>
            <h4>Hasil</h4>
            <p>Penyerahan hasil layanan kepada pemohon</p>
        </div>
    </div>
</div>

<!-- SYARAT -->
<div class="syarat-wrap">
    <div class="syarat-grid">
        <div class="syarat-card">
            <h3><i class="fas fa-file-alt"></i> Persyaratan Umum</h3>
            <ul class="syarat-list">
                <li><i class="fas fa-check-circle"></i> Surat Permohonan</li>
                <li><i class="fas fa-check-circle"></i> Fotokopi KTP</li>
                <li><i class="fas fa-check-circle"></i> Surat tugas/keterangan</li>
                <li><i class="fas fa-check-circle"></i> Daftar arsip yang dimaksud</li>
            </ul>
        </div>
        <div class="syarat-card">
            <h3><i class="fas fa-clock"></i> Jadwal Pelayanan</h3>
            <ul class="syarat-list">
                <li><i class="fas fa-clock"></i> <strong>Senin - Kamis:</strong> 08.00 - 16.00</li>
                <li><i class="fas fa-clock"></i> <strong>Jumat:</strong> 08.00 - 16.30</li>
                <li><i class="fas fa-utensils"></i> <strong>Istirahat:</strong> 12.00 - 13.00</li>
                <li><i class="fas fa-utensils"></i> <strong>Istirahat Jumat:</strong> 11.30 - 13.30</li>
            </ul>
        </div>
    </div>
</div>

<!-- WHATSAPP FLOAT -->
<a href="https://wa.me/6281234567890?text=Halo%20saya%20ingin%20bertanya%20tentang%20layanan%20kearsipan" 
   class="whatsapp-float" 
   target="_blank"
   title="Chat via WhatsApp">
    <i class="fab fa-whatsapp"></i>
    <span class="tooltip-wa">Chat WhatsApp</span>
</a>

<!-- SCROLL TO TOP -->
<button class="scroll-top" id="scrollTop" title="Kembali ke atas">
    <i class="fas fa-chevron-up"></i>
</button>

<!-- FOOTER -->
<footer class="footer">
    <p>&copy; <?php echo date('Y'); ?> Dinas Perpustakaan dan Arsip Daerah Kabupaten Solok Selatan</p>
    <p>Jl. Lubuk Gadang - Simpang Tigo Rimbo Tangah, Sangir</p>
</footer>

<script>
    // Scroll to top button
    const scrollBtn = document.getElementById('scrollTop');
    
    window.addEventListener('scroll', function() {
        if (window.scrollY > 300) {
            scrollBtn.classList.add('show');
        } else {
            scrollBtn.classList.remove('show');
        }
    });
    
    scrollBtn.addEventListener('click', function() {
        window.scrollTo({ top: 0, behavior: 'smooth' });
    });

    // Header shadow on scroll
    const header = document.querySelector('.header');
    window.addEventListener('scroll', function() {
        if (window.scrollY > 10) {
            header.style.boxShadow = '0 4px 20px rgba(0,0,0,0.2)';
        } else {
            header.style.boxShadow = '0 2px 15px rgba(0,0,0,0.15)';
        }
    });

    // Touch friendly for mobile
    document.querySelectorAll('.layanan-card, .stat-card, .alur-item, .syarat-card').forEach(el => {
        el.addEventListener('touchstart', function() {
            this.style.transform = 'scale(0.98)';
        });
        el.addEventListener('touchend', function() {
            this.style.transform = '';
        });
    });
</script>

</body>
</html>