<?php
include 'koneksi.php';

// ========== CEK DAN BUAT TABEL JIKA BELUM ADA ==========
// Buat tabel pengaduan jika belum ada
$create_table = "CREATE TABLE IF NOT EXISTS pengaduan (
    id INT AUTO_INCREMENT PRIMARY KEY,
    nama VARCHAR(100) NOT NULL,
    email VARCHAR(100) NOT NULL,
    no_hp VARCHAR(20),
    kategori VARCHAR(50),
    judul VARCHAR(200) NOT NULL,
    pesan TEXT NOT NULL,
    lampiran VARCHAR(255),
    status ENUM('baru', 'dibaca', 'diproses', 'selesai', 'ditolak') DEFAULT 'baru',
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    kode_unik VARCHAR(20) UNIQUE
)";

mysqli_query($koneksi, $create_table);

// ========== HITUNG STATISTIK ==========
$total_pengaduan = 0;
$query_total = mysqli_query($koneksi, "SELECT COUNT(*) as total FROM pengaduan");
if($query_total && mysqli_num_rows($query_total) > 0) {
    $row = mysqli_fetch_assoc($query_total);
    $total_pengaduan = $row['total'];
}

$bulan_ini = 0;
$query_bulan = mysqli_query($koneksi, "SELECT COUNT(*) as total FROM pengaduan WHERE MONTH(created_at) = MONTH(CURDATE()) AND YEAR(created_at) = YEAR(CURDATE())");
if($query_bulan && mysqli_num_rows($query_bulan) > 0) {
    $row = mysqli_fetch_assoc($query_bulan);
    $bulan_ini = $row['total'];
}

$diproses = 0;
$query_diproses = mysqli_query($koneksi, "SELECT COUNT(*) as total FROM pengaduan WHERE status = 'diproses'");
if($query_diproses && mysqli_num_rows($query_diproses) > 0) {
    $row = mysqli_fetch_assoc($query_diproses);
    $diproses = $row['total'];
}

$selesai = 0;
$query_selesai = mysqli_query($koneksi, "SELECT COUNT(*) as total FROM pengaduan WHERE status = 'selesai'");
if($query_selesai && mysqli_num_rows($query_selesai) > 0) {
    $row = mysqli_fetch_assoc($query_selesai);
    $selesai = $row['total'];
}

// ========== AMBIL PENGADUAN TERBARU ==========
$query_terbaru = mysqli_query($koneksi, "SELECT * FROM pengaduan ORDER BY created_at DESC LIMIT 5");
?>

<!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>Pengaduan Masyarakat | DPAD Solok Selatan</title>
    
    <meta name="description" content="Layanan pengaduan masyarakat Dinas Perpustakaan dan Arsip Daerah Kabupaten Solok Selatan.">
    
    <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">
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
    
    <style>
        /* ====== STYLE SAMA SEPERTI SEBELUMNYA ====== */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Inter', sans-serif;
            background: #f8fafc;
            color: #1e293b;
        }
        
        /* Header */
        .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-icon {
            width: 50px;
            height: 50px;
            background: rgba(255,255,255,0.15);
            border-radius: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            transition: 0.3s;
        }
        
        .logo-icon:hover {
            transform: scale(1.05);
            background: rgba(255,255,255,0.25);
        }
        
        .logo-icon 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;
            box-shadow: 0 4px 10px rgba(0,0,0,0.2);
        }
        
        .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 */
        .hero {
            background: linear-gradient(135deg, #1a5f4b, #0f3b2c);
            padding: 50px 20px;
            text-align: center;
            position: relative;
            overflow: hidden;
        }
        
        .hero::after {
            content: "💬";
            position: absolute;
            right: -30px;
            top: -30px;
            font-size: 160px;
            opacity: 0.06;
            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.12);
            backdrop-filter: blur(10px);
            padding: 6px 18px;
            border-radius: 30px;
            font-size: 0.8rem;
            margin-bottom: 18px;
            color: #ffd966;
        }
        
        .hero h1 {
            font-size: 2.2rem;
            font-weight: 800;
            color: white;
            margin-bottom: 12px;
        }
        
        .hero h1 i {
            color: #f5c542;
            margin-right: 10px;
        }
        
        .hero p {
            max-width: 600px;
            margin: 0 auto;
            font-size: 1rem;
            color: rgba(255,255,255,0.85);
            line-height: 1.6;
        }
        
        /* Breadcrumb */
        .breadcrumb {
            max-width: 1200px;
            margin: 20px auto;
            padding: 10px 20px;
            font-size: 0.85rem;
            color: #64748b;
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 4px;
        }
        
        .breadcrumb a {
            color: #1a5f4b;
            text-decoration: none;
            transition: 0.3s;
            padding: 3px 8px;
            border-radius: 4px;
        }
        
        .breadcrumb a:hover {
            background: #dcfce7;
            color: #0a3d32;
        }
        
        .breadcrumb .separator {
            margin: 0 4px;
            color: #94a3b8;
            font-size: 8px;
        }
        
        .breadcrumb .current {
            color: #1e293b;
            font-weight: 500;
            padding: 3px 8px;
            background: #f0fdf4;
            border-radius: 4px;
        }
        
        /* Stats */
        .stats-wrapper {
            max-width: 1200px;
            margin: -30px auto 0;
            padding: 0 20px;
            position: relative;
            z-index: 10;
        }
        
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 20px;
        }
        
        .stat-item {
            background: white;
            padding: 24px 20px;
            border-radius: 16px;
            text-align: center;
            border: 1px solid #eef2f5;
            box-shadow: 0 2px 10px rgba(0,0,0,0.03);
            transition: all 0.3s ease;
        }
        
        .stat-item:hover {
            transform: translateY(-5px);
            box-shadow: 0 12px 30px rgba(0,0,0,0.08);
            border-color: #dce7e2;
        }
        
        .stat-icon-top {
            width: 52px;
            height: 52px;
            background: #f0fdf4;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 14px;
            transition: all 0.3s ease;
        }
        
        .stat-item:hover .stat-icon-top {
            background: #1a5f4b;
        }
        
        .stat-item:hover .stat-icon-top i {
            color: white;
        }
        
        .stat-icon-top i {
            font-size: 22px;
            color: #1a5f4b;
            transition: color 0.3s ease;
        }
        
        .stat-number {
            font-size: 1.8rem;
            font-weight: 700;
            color: #0f3b2c;
            display: block;
            line-height: 1.2;
        }
        
        .stat-label {
            font-size: 0.8rem;
            color: #94a3b8;
            display: block;
            margin-top: 4px;
            font-weight: 500;
        }
        
        /* Quick Links */
        .quick-links {
            max-width: 1200px;
            margin: 30px auto 0;
            padding: 0 20px;
        }
        
        .quick-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 16px;
        }
        
        .quick-item {
            background: white;
            padding: 18px 20px;
            border-radius: 14px;
            display: flex;
            align-items: center;
            gap: 14px;
            text-decoration: none;
            border: 1px solid #eef2f5;
            transition: all 0.3s ease;
            box-shadow: 0 2px 8px rgba(0,0,0,0.03);
        }
        
        .quick-item:hover {
            transform: translateY(-4px);
            box-shadow: 0 8px 25px rgba(0,0,0,0.08);
            border-color: #1a5f4b;
        }
        
        .quick-icon {
            width: 44px;
            height: 44px;
            background: #f0fdf4;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }
        
        .quick-icon i {
            font-size: 18px;
            color: #1a5f4b;
        }
        
        .quick-text {
            flex: 1;
        }
        
        .quick-title {
            display: block;
            font-size: 0.9rem;
            font-weight: 600;
            color: #1e293b;
        }
        
        .quick-desc {
            display: block;
            font-size: 0.7rem;
            color: #94a3b8;
            margin-top: 2px;
        }
        
        /* Main Content */
        .main-content {
            max-width: 1200px;
            margin: 50px auto;
            padding: 0 20px;
        }
        
        .content-grid {
            display: grid;
            grid-template-columns: 1fr 360px;
            gap: 30px;
        }
        
        /* Form Card */
        .form-card {
            background: white;
            border-radius: 20px;
            box-shadow: 0 4px 15px rgba(0,0,0,0.04);
            border: 1px solid #eef2f5;
            overflow: hidden;
        }
        
        .form-header {
            background: linear-gradient(135deg, #0a3d32, #1a5f4b);
            padding: 24px 30px;
            color: white;
            position: relative;
        }
        
        .form-header::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            height: 3px;
            background: linear-gradient(90deg, #f5c542, #eab308, #f5c542);
        }
        
        .form-header h2 {
            font-size: 1.3rem;
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .form-header h2 i {
            color: #f5c542;
        }
        
        .form-header p {
            margin-top: 6px;
            font-size: 0.85rem;
            opacity: 0.85;
        }
        
        .form-body {
            padding: 28px 30px;
        }
        
        .form-group {
            margin-bottom: 20px;
        }
        
        .form-group label {
            display: flex;
            align-items: center;
            gap: 8px;
            font-weight: 600;
            font-size: 0.85rem;
            color: #1e293b;
            margin-bottom: 6px;
        }
        
        .form-group label i {
            color: #1a5f4b;
            width: 18px;
            font-size: 0.9rem;
        }
        
        .required {
            color: #ef4444;
        }
        
        input, select, textarea {
            width: 100%;
            padding: 11px 16px;
            border: 1.5px solid #e2e8f0;
            border-radius: 10px;
            font-family: 'Inter', sans-serif;
            font-size: 0.9rem;
            transition: all 0.3s ease;
            background: #fafbfc;
            color: #1e293b;
        }
        
        input:focus, select:focus, textarea:focus {
            outline: none;
            border-color: #1a5f4b;
            background: white;
            box-shadow: 0 0 0 3px rgba(26,95,75,0.08);
        }
        
        textarea {
            resize: vertical;
            min-height: 120px;
        }
        
        .row-2 {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 16px;
        }
        
        .btn-submit {
            width: 100%;
            background: linear-gradient(135deg, #0a3d32, #1a5f4b);
            color: white;
            border: none;
            padding: 13px 24px;
            border-radius: 40px;
            font-size: 0.95rem;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            margin-top: 4px;
        }
        
        .btn-submit:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(26,95,75,0.25);
            gap: 14px;
        }
        
        /* Sidebar */
        .sidebar {
            display: flex;
            flex-direction: column;
            gap: 20px;
        }
        
        .info-card {
            background: white;
            border-radius: 16px;
            padding: 22px 24px;
            border: 1px solid #eef2f5;
            box-shadow: 0 2px 10px rgba(0,0,0,0.03);
        }
        
        .info-card h3 {
            font-size: 1rem;
            font-weight: 700;
            color: #0f3b2c;
            margin-bottom: 16px;
            padding-bottom: 10px;
            border-bottom: 2px solid #f5c542;
            display: inline-block;
        }
        
        .info-card h3 i {
            margin-right: 8px;
            color: #f5c542;
        }
        
        .contact-list {
            display: flex;
            flex-direction: column;
            gap: 16px;
        }
        
        .contact-item {
            display: flex;
            align-items: center;
            gap: 14px;
        }
        
        .contact-icon {
            width: 40px;
            height: 40px;
            background: #f8fafc;
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            border: 1px solid #eef2f5;
        }
        
        .contact-icon i {
            font-size: 18px;
            color: #1a5f4b;
        }
        
        .contact-detail h4 {
            font-size: 0.8rem;
            font-weight: 600;
            color: #1e293b;
            margin-bottom: 2px;
        }
        
        .contact-detail p {
            font-size: 0.75rem;
            color: #94a3b8;
        }
        
        .alur-steps {
            display: flex;
            flex-direction: column;
            gap: 14px;
            margin-top: 4px;
        }
        
        .step {
            display: flex;
            align-items: center;
            gap: 14px;
        }
        
        .step-number {
            width: 32px;
            height: 32px;
            background: #1a5f4b;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: 700;
            font-size: 0.85rem;
            flex-shrink: 0;
        }
        
        .step-text {
            font-size: 0.85rem;
            color: #475569;
        }
        
        .info-list {
            list-style: none;
        }
        
        .info-list li {
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 0.85rem;
            color: #475569;
            padding: 8px 0;
            border-bottom: 1px solid #f1f5f9;
        }
        
        .info-list li:last-child {
            border-bottom: none;
        }
        
        .info-list li i {
            color: #1a5f4b;
            width: 18px;
            font-size: 0.85rem;
        }
        
        /* Pengaduan Terbaru */
        .pengaduan-terbaru {
            max-width: 1200px;
            margin: 30px auto 0;
            padding: 0 20px;
        }
        
        .terbaru-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;
        }
        
        .terbaru-header h3 {
            font-size: 1rem;
            font-weight: 700;
            color: #1e293b;
        }
        
        .terbaru-header h3 i {
            color: #1a5f4b;
            margin-right: 8px;
        }
        
        .terbaru-list {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        
        .terbaru-item {
            background: white;
            padding: 14px 18px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            gap: 14px;
            border: 1px solid #eef2f5;
            transition: 0.3s;
        }
        
        .terbaru-item:hover {
            border-color: #dce7e2;
        }
        
        .terbaru-badge {
            padding: 3px 12px;
            border-radius: 20px;
            font-size: 0.6rem;
            font-weight: 600;
            text-transform: uppercase;
            flex-shrink: 0;
        }
        
        .terbaru-badge.baru {
            background: #fee2e2;
            color: #dc2626;
        }
        
        .terbaru-badge.dibaca {
            background: #fef3c7;
            color: #d97706;
        }
        
        .terbaru-badge.diproses {
            background: #dbeafe;
            color: #2563eb;
        }
        
        .terbaru-badge.selesai {
            background: #dcfce7;
            color: #059669;
        }
        
        .terbaru-badge.ditolak {
            background: #f1f5f9;
            color: #64748b;
        }
        
        .terbaru-content {
            flex: 1;
        }
        
        .terbaru-content h4 {
            font-size: 0.85rem;
            font-weight: 600;
            color: #1e293b;
        }
        
        .terbaru-content p {
            font-size: 0.7rem;
            color: #94a3b8;
            margin-top: 2px;
        }
        
        .terbaru-time {
            font-size: 0.65rem;
            color: #94a3b8;
            display: block;
            margin-top: 4px;
        }
        
        .terbaru-time i {
            margin-right: 4px;
        }
        
        .lihat-semua {
            font-size: 0.8rem;
            color: #1a5f4b;
            text-decoration: none;
            font-weight: 600;
            transition: 0.3s;
        }
        
        .lihat-semua:hover {
            color: #0f3b2c;
        }
        
        .lihat-semua:hover i {
            transform: translateX(4px);
        }
        
        /* Footer */
        .footer {
            background: linear-gradient(135deg, #0a3d32, #0f3b2c);
            color: rgba(255,255,255,0.7);
            text-align: center;
            padding: 30px 20px;
            margin-top: 50px;
        }
        
        .footer p {
            font-size: 0.75rem;
            margin-bottom: 4px;
        }
        
        .footer a {
            color: #f5c542;
            text-decoration: none;
        }
        
        /* Responsive */
        @media (max-width: 992px) {
            .content-grid {
                grid-template-columns: 1fr;
            }
            .sidebar {
                display: grid;
                grid-template-columns: repeat(2, 1fr);
                gap: 20px;
            }
            .stats-grid {
                grid-template-columns: repeat(2, 1fr);
            }
            .quick-grid {
                grid-template-columns: repeat(2, 1fr);
            }
        }
        
        @media (max-width: 768px) {
            .header {
                padding: 12px 20px;
                flex-wrap: wrap;
            }
            .logo-text h2 {
                font-size: 0.8rem;
            }
            .logo-icon {
                width: 40px;
                height: 40px;
            }
            .icon-btn {
                width: 38px;
                height: 38px;
                font-size: 1rem;
            }
            .header-actions {
                gap: 8px;
            }
            .icon-btn .tooltip {
                display: none;
            }
            
            .hero h1 {
                font-size: 1.6rem;
            }
            .hero p {
                font-size: 0.9rem;
            }
            
            .stats-grid {
                grid-template-columns: 1fr;
            }
            
            .quick-grid {
                grid-template-columns: 1fr;
            }
            
            .content-grid {
                gap: 20px;
            }
            
            .sidebar {
                grid-template-columns: 1fr;
            }
            
            .row-2 {
                grid-template-columns: 1fr;
            }
            
            .form-header {
                padding: 20px;
            }
            .form-header h2 {
                font-size: 1.1rem;
            }
            .form-body {
                padding: 20px;
            }
            
            .main-content {
                margin: 30px auto;
                padding: 0 16px;
            }
            
            .stats-wrapper {
                padding: 0 16px;
            }
            
            .pengaduan-terbaru {
                padding: 0 16px;
            }
        }
        
        @media (max-width: 480px) {
            .header {
                padding: 10px 15px;
            }
            .logo-text h2 {
                font-size: 0.7rem;
            }
            .logo-text p {
                font-size: 0.5rem;
            }
            .logo-icon {
                width: 35px;
                height: 35px;
            }
            .icon-btn {
                width: 34px;
                height: 34px;
                font-size: 0.9rem;
            }
            
            .hero h1 {
                font-size: 1.3rem;
            }
            
            .stat-number {
                font-size: 1.2rem;
            }
            
            .quick-item {
                padding: 14px 16px;
            }
            
            .form-body {
                padding: 16px;
            }
            
            .btn-submit {
                padding: 12px 18px;
                font-size: 0.9rem;
            }
        }
    </style>
</head>
<body>

<!-- ========== HEADER ========== -->
<div class="header">
    <div class="logo-area">
        <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">
            <h2>DINAS KEARSIPAN<br>KABUPATEN SOLOK SELATAN</h2>
            <p>Dinas Perpustakaan dan Arsip Daerah</p>
        </div>
    </div>
    
    <div class="header-actions">
        <a href="dashboard.php" class="icon-btn">
            <i class="fas fa-home"></i>
            <span class="tooltip">Halaman Utama</span>
        </a>
        <a href="layanan_arsip.php" class="icon-btn">
            <i class="fas fa-th-list"></i>
            <span class="tooltip">Layanan</span>
        </a>
        <a href="javascript:history.back()" class="icon-btn">
            <i class="fas fa-arrow-left"></i>
            <span class="tooltip">Kembali</span>
        </a>
    </div>
</div>

<!-- ========== HERO ========== -->
<section class="hero">
    <div class="hero-content" data-aos="fade-up">
        <div class="hero-badge">
            <i class="fas fa-comment-dots"></i> Layanan Pengaduan
        </div>
        <h1><i class="fas fa-comment"></i> Pengaduan Masyarakat</h1>
        <p>Sampaikan saran, kritik, atau keluhan Anda untuk meningkatkan kualitas pelayanan publik Dinas Perpustakaan dan Arsip Daerah</p>
    </div>
</section>

<!-- ========== BREADCRUMB ========== -->
<div class="breadcrumb">
    <a href="dashboard.php"><i class="fas fa-home"></i> Beranda</a>
    <span class="separator"><i class="fas fa-chevron-right" style="font-size:8px;"></i></span>
    <span class="current">Pengaduan Masyarakat</span>
</div>

<!-- ========== QUICK LINKS ========== -->
<div class="quick-links" data-aos="fade-up" data-aos-delay="50">
    <div class="quick-grid">
        <a href="https://perpustakaan.solselkab.go.id/read/166/bidang-kearsipan" class="quick-item">
            <div class="quick-icon"><i class="fas fa-book"></i></div>
            <div class="quick-text">
                <span class="quick-title">Perpustakaan</span>
                <span class="quick-desc">Layanan perpustakaan digital</span>
            </div>
        </a>
        <a href="layanan_arsip.php" class="quick-item">
            <div class="quick-icon"><i class="fas fa-archive"></i></div>
            <div class="quick-text">
                <span class="quick-title">Kearsipan</span>
                <span class="quick-desc">Layanan pengelolaan arsip</span>
            </div>
        </a>
        <a href="layanan_kunjungan.php" class="quick-item">
            <div class="quick-icon"><i class="fas fa-users"></i></div>
            <div class="quick-text">
                <span class="quick-title">Kunjungan</span>
                <span class="quick-desc">Kunjungan edukasi & studi banding</span>
            </div>
        </a>
        <a href="layanan_konsultasi.php" class="quick-item">
            <div class="quick-icon"><i class="fas fa-comments"></i></div>
            <div class="quick-text">
                <span class="quick-title">Konsultasi</span>
                <span class="quick-desc">Konsultasi & pengaduan</span>
            </div>
        </a>
    </div>
</div>

<!-- ========== MAIN CONTENT ========== -->
<div class="main-content">
    <div class="content-grid">
        
        <!-- ========== FORM ========== -->
        <div class="form-card" data-aos="fade-up">
            <div class="form-header">
                <h2>
                    <i class="fas fa-pen-alt"></i>
                    Form Pengaduan Online
                </h2>
                <p>Isi data dengan lengkap dan benar untuk memudahkan proses verifikasi</p>
            </div>
            <div class="form-body">
                <form action="proses_pengaduan.php" method="POST" enctype="multipart/form-data" id="formPengaduan">
                    <div class="form-group">
                        <label><i class="fas fa-user"></i> Nama Lengkap <span class="required">*</span></label>
                        <input type="text" name="nama" placeholder="Masukkan nama lengkap Anda" required>
                    </div>
                    
                    <div class="row-2">
                        <div class="form-group">
                            <label><i class="fas fa-envelope"></i> Alamat Email <span class="required">*</span></label>
                            <input type="email" name="email" placeholder="contoh@email.com" required>
                        </div>
                        <div class="form-group">
                            <label><i class="fas fa-phone-alt"></i> Nomor Telepon</label>
                            <input type="tel" name="no_hp" placeholder="0812-3456-7890">
                        </div>
                    </div>
                    
                    <div class="row-2">
                        <div class="form-group">
                            <label><i class="fas fa-tag"></i> Kategori <span class="required">*</span></label>
                            <select name="kategori" required>
                                <option value="">Pilih Kategori</option>
                                <option value="layanan">Layanan Perpustakaan</option>
                                <option value="arsip">Layanan Kearsipan</option>
                                <option value="saran">Saran & Masukan</option>
                                <option value="keluhan">Keluhan Pelayanan</option>
                                <option value="informasi">Permintaan Informasi</option>
                                <option value="lainnya">Lainnya</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label><i class="fas fa-heading"></i> Judul <span class="required">*</span></label>
                            <input type="text" name="judul" placeholder="Judul pengaduan" required>
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label><i class="fas fa-align-left"></i> Isi Pengaduan <span class="required">*</span></label>
                        <textarea name="pesan" placeholder="Tuliskan keluhan, saran, atau pertanyaan Anda secara lengkap..." required></textarea>
                    </div>
                    
                    <div class="form-group">
                        <label><i class="fas fa-paperclip"></i> Lampiran</label>
                        <input type="file" name="lampiran" accept=".jpg,.jpeg,.png,.pdf,.doc,.docx">
                        <small style="color: #94a3b8; font-size: 0.7rem; display: block; margin-top: 4px;">Format: JPG, PNG, PDF, DOC (Max 5MB)</small>
                    </div>
                    
                    <button type="submit" class="btn-submit" name="submit">
                        <i class="fas fa-paper-plane"></i>
                        Kirim Pengaduan
                        <i class="fas fa-arrow-right"></i>
                    </button>
                </form>
            </div>
        </div>
        
        <!-- ========== SIDEBAR ========== -->
        <div class="sidebar">
            <!-- Kontak -->
            <div class="info-card" data-aos="fade-up" data-aos-delay="100">
                <h3><i class="fas fa-headset"></i> Kontak Kami</h3>
                <div class="contact-list">
                    <div class="contact-item">
                        <div class="contact-icon"><i class="fas fa-phone-alt"></i></div>
                        <div class="contact-detail">
                            <h4>Call Center</h4>
                            <p>0812-0000-0000</p>
                        </div>
                    </div>
                    <div class="contact-item">
                        <div class="contact-icon"><i class="fab fa-whatsapp"></i></div>
                        <div class="contact-detail">
                            <h4>WhatsApp</h4>
                            <p>0812-0000-0000</p>
                        </div>
                    </div>
                    <div class="contact-item">
                        <div class="contact-icon"><i class="fas fa-envelope"></i></div>
                        <div class="contact-detail">
                            <h4>Email</h4>
                            <p>pengaduan@dpad.solselkab.go.id</p>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- Alur -->
            <div class="info-card" data-aos="fade-up" data-aos-delay="150">
                <h3><i class="fas fa-route"></i> Alur Pengaduan</h3>
                <div class="alur-steps">
                    <div class="step">
                        <div class="step-number">1</div>
                        <div class="step-text">Isi formulir pengaduan online</div>
                    </div>
                    <div class="step">
                        <div class="step-number">2</div>
                        <div class="step-text">Verifikasi data oleh admin</div>
                    </div>
                    <div class="step">
                        <div class="step-number">3</div>
                        <div class="step-text">Diproses oleh unit terkait</div>
                    </div>
                    <div class="step">
                        <div class="step-number">4</div>
                        <div class="step-text">Respon 2x24 jam</div>
                    </div>
                </div>
            </div>
            
            <!-- Info -->
            <div class="info-card" data-aos="fade-up" data-aos-delay="200">
                <h3><i class="fas fa-info-circle"></i> Informasi</h3>
                <ul class="info-list">
                    <li><i class="fas fa-shield-alt"></i> Identitas Anda aman</li>
                    <li><i class="fas fa-bolt"></i> Respon cepat 2x24 jam</li>
                    <li><i class="fas fa-chart-bar"></i> Setiap pengaduan ditindaklanjuti</li>
                    <li><i class="fas fa-lock"></i> Rahasia pribadi terjamin</li>
                </ul>
            </div>
        </div>
        
    </div>
</div>


<!-- ========== FOOTER ========== -->
<footer class="footer">
    <p>&copy; <?php echo date('Y'); ?> Dinas Perpustakaan dan Arsip Daerah Kabupaten Solok Selatan</p>
    <p style="font-size:0.7rem;">Jl. Lubuk Gadang - Simpang Tigo Rimbo Tangah, Sangir, Solok Selatan</p>
    <p style="font-size:0.7rem; margin-top:8px;">
        <a href="#">Kebijakan Privasi</a> | 
        <a href="#">Sitemap</a>
    </p>
</footer>

<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
<script>
    AOS.init({
        duration: 500,
        once: true,
        offset: 30,
        easing: 'ease-out'
    });
    
    // Form validation
    document.getElementById('formPengaduan').addEventListener('submit', function(e) {
        const nama = document.querySelector('input[name="nama"]').value.trim();
        const email = document.querySelector('input[name="email"]').value.trim();
        const judul = document.querySelector('input[name="judul"]').value.trim();
        const pesan = document.querySelector('textarea[name="pesan"]').value.trim();
        
        if(!nama || !email || !judul || !pesan) {
            e.preventDefault();
            Swal.fire({
                icon: 'warning',
                title: 'Data Belum Lengkap!',
                text: 'Silakan isi semua field yang bertanda * (wajib diisi)',
                confirmButtonColor: '#1a5f4b'
            });
        }
    });
</script>

</body>
</html>