<?php
    include('loginsession.php');
    error_reporting(E_ALL);
    $filename = basename(__FILE__);
    $save = mysqli_query($conn, "INSERT INTO novia_abc_user_logs (userid,filename) VALUES ('$userini_id','$filename')");
//-------------
$today = date("Y-m-d");
//-------------
?>

<!DOCTYPE html>
<html lang="id">
<head>
    <title>Administrasi - Dashboard</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover">
    <link href="images/balance.ico" rel="icon" type="image/icon" />
    
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome Icons -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <!-- Google Fonts -->
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
    
    <style>
        * {
            font-family: 'Poppins', sans-serif;
        }
        
        body {
            background: linear-gradient(135deg, #f5f0e8 0%, #e8dfd3 100%);
            background-attachment: fixed;
            padding: 0;
            margin: 0;
        }
        
        /* Warna dominan kecoklatan */
        :root {
            --brown-dark: #5D4037;
            --brown-medium: #8D6E63;
            --brown-light: #D7CCC8;
            --brown-soft: #EFEBE9;
            --brown-gold: #A1887F;
            --cream: #FFF8F0;
        }
        
        /* Container khusus untuk HP */
        .container-custom {
            max-width: 1400px;
            margin: 0 auto;
            padding: 12px;
        }
        
        /* Hero header lebih kecil di HP */
        .hero-image {
            background: linear-gradient(135deg, var(--brown-dark), var(--brown-medium));
            border-radius: 16px;
            padding: 20px 15px;
            margin-bottom: 20px;
            text-align: center;
        }
        
        .hero-image h2 {
            color: white;
            font-weight: 700;
            margin: 0;
            font-size: 1.3rem;
        }
        
        .hero-image p {
            color: rgba(255,255,255,0.85);
            margin-top: 5px;
            font-size: 0.8rem;
        }
        
        /* Section title lebih hemat space */
        .section-title {
            color: var(--brown-dark);
            font-weight: 700;
            margin: 20px 0 12px 0;
            padding-bottom: 8px;
            border-bottom: 2px solid var(--brown-gold);
            display: inline-block;
            font-size: 1.2rem;
        }
        
        /* Grid 2 kolom untuk HP dengan jarak minimal */
        .row.g-2 {
            --bs-gutter-y: 0.5rem;
            --bs-gutter-x: 0.5rem;
        }
        
        /* Tombol dengan padding lebih kecil di HP */
        .btn-brown, .btn-brown-light, .btn-brown-soft {
            padding: 10px 6px;
            border-radius: 10px;
            font-weight: 500;
            transition: all 0.2s ease;
            width: 100%;
            margin: 0;
            font-size: 0.75rem;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
        }
        
        /* Ukuran icon lebih kecil di HP */
        .btn-brown i, .btn-brown-light i, .btn-brown-soft i {
            font-size: 0.85rem;
            margin: 0;
        }
        
        /* Tombol utama warna coklat */
        .btn-brown {
            background: linear-gradient(135deg, var(--brown-dark), var(--brown-medium));
            color: white;
            border: none;
        }
        
        .btn-brown:hover {
            background: linear-gradient(135deg, #4a3228, #7a5a4f);
            color: white;
            transform: translateY(-1px);
        }
        
        /* Tombol secondary */
        .btn-brown-light {
            background: var(--brown-light);
            color: var(--brown-dark);
            border: none;
            font-weight: 600;
        }
        
        .btn-brown-light:hover {
            background: var(--brown-medium);
            color: white;
        }
        
        /* Tombol soft */
        .btn-brown-soft {
            background: var(--brown-soft);
            color: var(--brown-dark);
            border: 1px solid var(--brown-light);
        }
        
        .btn-brown-soft:hover {
            background: var(--brown-light);
            color: var(--brown-dark);
        }
        
        /* Tombol logout khusus */
        .btn-logout {
            background: linear-gradient(135deg, #8B0000, #A52A2A);
            color: white;
            padding: 10px;
            font-weight: 600;
        }
        
        /* Spacing antar section lebih rapat */
        .section-spacing {
            margin-top: 0;
        }
        
        /* Footer lebih ringkas */
        .footer-note {
            text-align: center;
            padding: 20px 0 15px;
            color: var(--brown-medium);
            font-size: 0.7rem;
        }
        
        /* Tombol full width untuk kasus tertentu */
        .btn-full {
            grid-column: span 2;
        }
        
        /* Untuk tablet dan desktop - tetap 2 kolom sampai ukuran tertentu */
        @media (min-width: 768px) {
            .container-custom {
                padding: 20px;
            }
            
            .btn-brown, .btn-brown-light, .btn-brown-soft {
                padding: 12px 8px;
                font-size: 0.85rem;
                white-space: normal;
            }
            
            .btn-brown i, .btn-brown-light i, .btn-brown-soft i {
                font-size: 1rem;
            }
            
            .section-title {
                font-size: 1.5rem;
                margin: 30px 0 20px 0;
            }
            
            .hero-image h2 {
                font-size: 1.8rem;
            }
            
            .hero-image {
                padding: 30px;
            }
        }
        
        /* Untuk layar lebih besar bisa 3-4 kolom */
        @media (min-width: 992px) {
            .row-cols-lg-4 > * {
                flex: 0 0 auto;
                width: 25%;
            }
        }
        
        /* Animasi tap feedback untuk HP */
        .btn-brown:active, .btn-brown-light:active, .btn-brown-soft:active {
            transform: scale(0.97);
            transition: transform 0.05s;
        }
        
        /* Menghilangkan outline saat tap di HP */
        .btn-brown:focus, .btn-brown-light:focus, .btn-brown-soft:focus {
            outline: none;
            box-shadow: none;
        }
        
        /* Baris dengan jarak minimal */
        .g-2 {
            --bs-gutter-y: 0.5rem;
        }
    </style>
</head>
<body>

<div class="container-custom">
    <!-- Hero / Header ringkas -->
    <div class="hero-image">
        <h2><i class="fas fa-clinic-medical me-2"></i>Administrasi Klinik</h2>
        <p>Halo, <?php echo htmlspecialchars($userini_name); ?></p>
    </div>

    <!-- DATA PASIEN Section -->
    <h3 class="section-title">
        <i class="fas fa-users me-2"></i>DATA PASIEN
    </h3>
    
    <div class="row g-2">
        <div class="col-6 col-md-4 col-lg-3">
            <a href="https://www.drrocky.skin" class="text-decoration-none" title="Web Dr Rocky">
                <button class="btn-brown"><i class="fas fa-globe"></i> WEBSITE</button>
            </a>
        </div>
        <div class="col-6 col-md-4 col-lg-3">
            <a href="index.php" class="text-decoration-none" title="Halaman Awal">
                <button class="btn-brown"><i class="fas fa-home"></i> HOME</button>
            </a>
        </div>
        <div class="col-6 col-md-4 col-lg-3">
            <a href="visit-stat.php" class="text-decoration-none">
                <button class="btn-brown-light"><i class="fas fa-chart-line"></i> Stat Pasien</button>
            </a>
        </div>
        <div class="col-6 col-md-4 col-lg-3">
            <a href="cash/cash-stat.php?tanggal=<?php echo $today;?>" class="text-decoration-none">
                <button class="btn-brown-light"><i class="fas fa-chart-bar"></i> Stat Keuangan</button>
            </a>
        </div>
    </div>

    <div class="row g-2 mt-1">
        <div class="col-6 col-md-4">
            <a href="visit-yearly.php?tanggal=<?php echo date("Y-m-d");?>" class="text-decoration-none">
                <button class="btn-brown-soft"><i class="fas fa-calendar-alt"></i> Tahunan</button>
            </a>
        </div>
        <div class="col-6 col-md-4">
            <a href="visit-monthly.php?tanggal=<?php echo date("Y-m-d");?>" class="text-decoration-none">
                <button class="btn-brown-soft"><i class="fas fa-calendar-week"></i> Bulanan</button>
            </a>
        </div>
        <div class="col-6 col-md-4">
            <a href="visit-daily.php?tanggal=<?php echo date("Y-m-d");?>" class="text-decoration-none">
                <button class="btn-brown-soft"><i class="fas fa-calendar-day"></i> Harian</button>
            </a>
        </div>
        <div class="col-6 col-md-4">
            <a href="_kelurahan.php" class="text-decoration-none">
                <button class="btn-brown-soft"><i class="fas fa-database"></i> Reset Kelurahan</button>
            </a>
        </div>
    </div>

    <div class="row g-2 mt-1">
        <div class="col-6 col-md-6">
            <a href="_index_lengkap.php" class="text-decoration-none">
                <button class="btn-brown-soft"><i class="fas fa-table"></i> Data Lengkap</button>
            </a>
        </div>
        <div class="col-6 col-md-6">
            <a href="visit-last.php" class="text-decoration-none">
                <button class="btn-brown-soft"><i class="fas fa-clock"></i> Terakhir Datang</button>
            </a>
        </div>
    </div>

    <div class="row g-2 mt-1">
        <div class="col-6">
            <a href="administrasi1.php" class="text-decoration-none">
                <button class="btn-brown-soft"><i class="fas fa-box"></i>ADM 1</button>
            </a>
        </div>
        <div class="col-6">
            <a href="online_view.php" class="text-decoration-none">
                <button class="btn-brown-soft"><i class="fas fa-user-plus"></i> Online</button>
            </a>
        </div>
    </div>
    
    <div class="row g-2 mt-1">
        <div class="col-6">
            <a href="administrasi2.php" class="text-decoration-none">
                <button class="btn-brown-soft"><i class="fas fa-box"></i>ADM 2</button>
            </a>
        </div>
        <div class="col-6">
            <a href="administrasi3.php" class="text-decoration-none">
                <button class="btn-brown-soft"><i class="fas fa-user-plus"></i>ADM 3</button>
            </a>
        </div>
        <div class="col-6">
            <a href="administrasi4.php" class="text-decoration-none">
                <button class="btn-brown-soft"><i class="fas fa-user-plus"></i>ADM 4</button>
            </a>
        </div>
    </div>

    <!-- KEUANGAN Section -->
    <h3 class="section-title">
        <i class="fas fa-money-bill-wave me-2"></i>KEUANGAN
    </h3>
    
    <div class="row g-2">
        <div class="col-6 col-md-3">
            <a href="cash/cash-stat.php?tanggal=<?php echo $today;?>" class="text-decoration-none">
                <button class="btn-brown"><i class="fas fa-chart-pie"></i> STATISTIK</button>
            </a>
        </div>
        <div class="col-6 col-md-3">
            <a href="cash/cash-piutang.php?userid=1" class="text-decoration-none">
                <button class="btn-brown"><i class="fas fa-hand-holding-usd"></i> PIUTANG</button>
            </a>
        </div>
        <div class="col-6 col-md-3">
            <a href="cash/cash-main.php" class="text-decoration-none">
                <button class="btn-brown"><i class="fas fa-plus-circle"></i> TAMBAH BELANJA</button>
            </a>
        </div>
        <div class="col-6">
            <a href="cash/stock.php" class="text-decoration-none">
                <button class="btn-brown"><i class="fas fa-boxes"></i> STOCK</button>
            </a>
        </div>        

    </div>
    
    <div class="row g-2 mt-1">
        <div class="col-6">
            <a href="cash/cash-view-daily.php?tanggal=<?php echo date("Y-m-d");?>" class="text-decoration-none">
                <button class="btn-brown-light"><i class="fas fa-chart-simple"></i> Harian</button>
            </a>
        </div>
        <div class="col-6 col-md-3">
            <a href="cash/cash-view-monthly.php?tanggal=<?php echo date("Y-m-d");?>" class="text-decoration-none">
                <button class="btn-brown-light"><i class="fas fa-chart-line"></i> Bulanan</button>
            </a>
        </div>
    </div>

    <!-- PENGEMBANGAN DIRI Section -->
    <h3 class="section-title">
        <i class="fas fa-brain me-2"></i>PENGEMBANGAN DIRI
    </h3>
    
    <div class="row g-2">
        <div class="col-6">
            <a href="aero/meditation.php" class="text-decoration-none">
                <button class="btn-brown-light"><i class="fas fa-spa"></i> MEDITASI</button>
            </a>
        </div>
        <div class="col-6">
            <a href="aero/aero_main.php" class="text-decoration-none">
                <button class="btn-brown-light"><i class="fas fa-heartbeat"></i> AEROBIK</button>
            </a>
        </div>
    </div>
    
    <div class="row g-2 mt-1">
        <div class="col-6">
            <?php if($userini_id == "3"){ ?>
                <a href="diary/index.php?check=1" class="text-decoration-none">
                    <button class="btn-brown-soft"><i class="fas fa-book"></i> Catatan Harian</button>
                </a>
            <?php } else { ?>
                <a href="diary/index.php?check=0" class="text-decoration-none">
                    <button class="btn-brown-soft"><i class="fas fa-book"></i> Catatan Harian</button>
                </a>
            <?php } ?>
        </div>
        <div class="col-6">
            <a href="todo/routine.php" class="text-decoration-none">
                <button class="btn-brown-soft"><i class="fas fa-check-circle"></i> Rutinitas</button>
            </a>
        </div>
    </div>
    
    <div class="row g-2 mt-1">
        <div class="col-6">
            <a href="todo/todo.php" class="text-decoration-none">
                <button class="btn-brown-soft"><i class="fas fa-tasks"></i> RENCANA</button>
            </a>
        </div>
        <div class="col-6">
            <a href="counter/counter.php?item=1" class="text-decoration-none">
                <button class="btn-brown-soft"><i class="fas fa-smoking-ban"></i> SMOKING</button>
            </a>
        </div>
    </div>

    <?php if($userini_id == 3){ ?>
    <!-- ADMIN AREA Section -->
    <h3 class="section-title">
        <i class="fas fa-shield-alt me-2"></i>ADMIN AREA
    </h3>
    
    <div class="row g-2">
        <div class="col-6">
            <a href="todo/routine_edit.php" class="text-decoration-none">
                <button class="btn-brown"><i class="fas fa-edit"></i> PDA EDIT</button>
            </a>
        </div>
        <div class="col-6">
            <a href="coding/coding_main.php" class="text-decoration-none">
                <button class="btn-brown"><i class="fas fa-code"></i> CODING</button>
            </a>
        </div>
    </div>
    
    <div class="row g-2 mt-1">
        <div class="col-6">
            <a href="userlog.php" class="text-decoration-none">
                <button class="btn-brown-light"><i class="fas fa-history"></i> ACTIVITY</button>
            </a>
        </div>
        <div class="col-6">
            <a href="coding/page.php" class="text-decoration-none">
                <button class="btn-brown-soft"><i class="fas fa-file-alt"></i> Page</button>
            </a>
        </div>
    </div>
    
    <div class="row g-2 mt-1">
        <div class="col-6">
            <a href="coding/page-01.php" class="text-decoration-none">
                <button class="btn-brown-soft"><i class="fas fa-file-code"></i> Page-01</button>
            </a>
        </div>
        <div class="col-6">
            <a href="https://scr.drrocky.skin" class="text-decoration-none">
                <button class="btn-brown-soft"><i class="fas fa-terminal"></i> MY SCRIPT</button>
            </a>
        </div>
    </div>
    
    <div class="row g-2 mt-1">
        <div class="col-6">
            <a href="https://form.drrocky.skin" class="text-decoration-none">
                <button class="btn-brown-soft"><i class="fas fa-wpforms"></i> Online Form</button>
            </a>
        </div>
        <div class="col-6">
            <a href="player/index.php" class="text-decoration-none">
                <button class="btn-brown-soft"><i class="fas fa-play-circle"></i> Player Utama</button>
            </a>
        </div>
    </div>
    
    <div class="row g-2 mt-1">
        <div class="col-6">
            <a href="#" class="text-decoration-none">
                <button class="btn-brown-soft"><i class="fas fa-hourglass-half"></i> KOSONG</button>
            </a>
        </div>
        <div class="col-6">
            <a href="player/player_01/index3.html" class="text-decoration-none">
                <button class="btn-brown-soft"><i class="fas fa-music"></i> PLAYER 01</button>
            </a>
        </div>
    </div>
    <?php } ?>
    
    <!-- Logout Button - full width -->
    <div class="row g-2 mt-3">
        <div class="col-12">
            <a href="logout.php" class="text-decoration-none">
                <button class="btn-brown btn-logout"><i class="fas fa-sign-out-alt me-2"></i> LOGOUT</button>
            </a>
        </div>
    </div>
    
    <div class="footer-note">
        <i class="fas fa-heart" style="color: #A1887F;"></i> Sistem Administrasi Klinik 
        <i class="fas fa-heart" style="color: #A1887F;"></i>
    </div>
</div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>