/* =========================================================
   Custom Stylesheet - Website Informasi & Pelayanan Publik Desa
   Framework: Bootstrap 5.3 + Custom Enhancements
========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Open+Sans:wght@400;500;600&display=swap');

:root {
    --primary-color: #0D7C66;
    --primary-dark: #075E4D;
    --primary-light: #E8F5E9;
    --secondary-color: #1E293B;
    --accent-color: #F59E0B;
    --accent-red: #EF4444;
    --bg-light: #F8FAFC;
    --font-heading: 'Plus Jakarta Sans', sans-serif;
    --font-body: 'Open Sans', sans-serif;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-light);
    color: #334155;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6, .fw-heading {
    font-family: var(--font-heading);
    font-weight: 700;
}

/* Navbar Custom */
.navbar-desa {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.navbar-brand .brand-logo {
    width: 44px;
    height: 44px;
    background: var(--primary-light);
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.nav-link {
    font-weight: 500;
    color: #475569 !important;
    padding: 0.5rem 1rem !important;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary-color) !important;
    background-color: var(--primary-light);
}

/* Hero Section */
.hero-section {
    position: relative;
    background: linear-gradient(135deg, rgba(7, 94, 77, 0.95), rgba(13, 124, 102, 0.85)), 
                url('https://images.unsplash.com/photo-1500382017468-9049fed747ef?auto=format&fit=crop&w=1920&q=80') center/cover no-repeat;
    color: white;
    padding: 100px 0 80px;
    border-radius: 0 0 40px 40px;
}

.hero-search-box {
    background: white;
    border-radius: 16px;
    padding: 8px 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Quick Service Cards */
.service-card {
    background: white;
    border-radius: 16px;
    border: 1px solid #E2E8F0;
    transition: all 0.3s ease;
    height: 100%;
}

.service-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 15px 30px rgba(13, 124, 102, 0.12);
    border-color: var(--primary-color);
}

.service-icon-wrapper {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    background: var(--primary-light);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
}

.service-card:hover .service-icon-wrapper {
    background: var(--primary-color);
    color: white;
}

/* Section Titles */
.section-tag {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    background-color: var(--primary-light);
    color: var(--primary-color);
    margin-bottom: 10px;
}

/* Stats Counter Box */
.stat-box {
    background: white;
    border-radius: 16px;
    padding: 24px 20px;
    border-bottom: 4px solid var(--primary-color);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.04);
}

.stat-number {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary-color);
    font-family: var(--font-heading);
}

/* Announcement Cards */
.announcement-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #E2E8F0;
    transition: all 0.3s ease;
    height: 100%;
}

.announcement-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
}

.badge-official {
    background-color: #FEF3C7;
    color: #92400E;
    font-weight: 600;
}

.badge-urgent {
    background-color: #FEE2E2;
    color: #991B1B;
    font-weight: 600;
}

/* Tracking Card */
.tracking-card {
    background: white;
    border-radius: 20px;
    border: 1px solid #E2E8F0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

/* Buttons */
.btn-primary-desa {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    font-weight: 600;
    border-radius: 10px;
    padding: 10px 22px;
    transition: all 0.2s ease;
}

.btn-primary-desa:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    color: white;
}

.btn-outline-desa {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
    border-radius: 10px;
    padding: 8px 20px;
    background: transparent;
    transition: all 0.2s ease;
}

.btn-outline-desa:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Admin Specific Styles */
.admin-sidebar {
    width: 260px;
    min-height: 100vh;
    background-color: #0F172A;
    color: #94A3B8;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.admin-content {
    margin-left: 260px;
    min-height: 100vh;
    background-color: #F1F5F9;
    padding-bottom: 50px;
    width: calc(100% - 260px);
    max-width: 100vw;
}

@media (max-width: 991.98px) {
    .admin-sidebar {
        margin-left: -280px;
        width: 280px;
        box-shadow: 6px 0 25px rgba(0, 0, 0, 0.35);
        z-index: 1050;
    }
    .admin-sidebar.show {
        margin-left: 0;
    }
    .admin-content {
        margin-left: 0;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }
}

.admin-sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(3px);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.admin-sidebar-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.admin-nav-item {
    color: #94A3B8;
    padding: 12px 18px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    text-decoration: none;
    margin-bottom: 4px;
    transition: all 0.2s ease;
}

.admin-nav-item:hover, .admin-nav-item.active {
    background-color: rgba(255, 255, 255, 0.08);
    color: white;
}

.admin-nav-item.active {
    background-color: var(--primary-color);
}

.admin-topbar {
    background: white;
    padding: 16px 28px;
    border-bottom: 1px solid #E2E8F0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-dashboard {
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
}

.admin-section {
    padding: 8px 0;
}

.table-custom th {
    background-color: #F8FAFC;
    color: #475569;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #E2E8F0;
}

.badge-status-pending {
    background-color: #FEF3C7;
    color: #D97706;
}

.badge-status-approved {
    background-color: #D1FAE5;
    color: #059669;
}

.badge-status-rejected {
    background-color: #FEE2E2;
    color: #DC2626;
}

/* Footer */
.footer-desa {
    background-color: #0F172A;
    color: #94A3B8;
    padding: 70px 0 25px;
}

.footer-title {
    color: white;
    font-weight: 700;
    margin-bottom: 20px;
}

.footer-link {
    color: #94A3B8;
    text-decoration: none;
    display: block;
    margin-bottom: 10px;
    transition: color 0.2s;
}

.footer-link:hover {
    color: white;
}

/* =========================================================
   Responsive Mobile & Tablet Optimizations
========================================================= */

.btn-hamburger {
    background: rgba(13, 124, 102, 0.08);
    border: 1px solid rgba(13, 124, 102, 0.2);
    border-radius: 10px;
    padding: 4px 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-hamburger:hover, .btn-hamburger:focus {
    background: rgba(13, 124, 102, 0.16);
}

@media (max-width: 1199.98px) {
    .navbar-collapse {
        background: #ffffff;
        padding: 16px 20px;
        border-radius: 16px;
        margin-top: 12px;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
        border: 1px solid #E2E8F0;
    }
    .navbar-nav .nav-link {
        padding: 10px 14px !important;
        border-radius: 8px;
    }
}

.section-stats {
    margin-top: -30px;
    position: relative;
    z-index: 10;
}

.stat-box {
    background: white;
    border-radius: 16px;
    padding: 20px 14px;
    border-bottom: 4px solid var(--primary-color);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.04);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s ease;
}

@media (max-width: 767.98px) {
    .container {
        padding-left: 18px !important;
        padding-right: 18px !important;
    }
    .hero-section {
        padding: 50px 0 35px;
        border-radius: 0 0 24px 24px;
        text-align: center;
    }
    .hero-section h1 {
        font-size: 1.65rem !important;
        line-height: 1.35;
        margin-bottom: 0.75rem !important;
    }
    .hero-section .lead {
        font-size: 0.92rem !important;
        line-height: 1.5;
        margin-bottom: 1.25rem !important;
    }
    .hero-cta-buttons {
        flex-direction: column;
        gap: 10px !important;
        max-width: 320px;
        margin-left: auto;
        margin-right: auto;
    }
    .hero-cta-buttons .btn {
        width: 100%;
        padding: 10px 16px !important;
        font-size: 0.95rem;
    }
    .section-stats {
        margin-top: 0 !important;
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
    .stat-number {
        font-size: 1.65rem !important;
        line-height: 1.2;
        margin: 4px 0;
    }
    .stat-box {
        padding: 16px 10px !important;
    }
    .stat-box small {
        font-size: 0.76rem !important;
        line-height: 1.3;
    }
    .profil-badge-card {
        position: static !important;
        max-width: 100% !important;
        margin: 14px 0 0 0 !important;
    }
    .tracking-card {
        padding: 22px 16px !important;
        border-radius: 16px;
    }
    #formTrackRequest .input-group {
        flex-direction: column;
        gap: 10px;
    }
    #formTrackRequest .input-group input,
    #formTrackRequest .input-group button {
        width: 100% !important;
        border-radius: 10px !important;
    }
}

/* =========================================================
   Admin Dashboard — Smooth Horizontal Scroll Tables (HP & Tablet)
   Membuat tabel tetap utuh dan bisa di-scroll kiri-kanan dengan lancar
========================================================= */

/* Pastikan container dashboard tidak melebar keluar layar */
.admin-section {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden;
}

.card-dashboard {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden;
    position: relative;
}

/* Wrapper tabel wajib scroll horizontal */
.table-responsive {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x pan-y !important;
    border-radius: 10px;
    margin-bottom: 6px;
    padding-bottom: 6px;
    cursor: grab;
    /* Custom scrollbar tebal yang jelas terlihat */
    scrollbar-width: auto !important;
    scrollbar-color: #0D7C66 #E2E8F0 !important;
}

.table-responsive:active,
.table-responsive.active-dragging {
    cursor: grabbing !important;
    user-select: none !important;
}

.table-responsive::-webkit-scrollbar {
    height: 10px !important;
    display: block !important;
}

.table-responsive::-webkit-scrollbar-track {
    background: #E2E8F0 !important;
    border-radius: 6px !important;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #0D7C66 !important;
    border-radius: 6px !important;
    border: 2px solid #E2E8F0 !important;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #075E4D !important;
}

/* Tabel Admin: Memiliki lebar minimum 860px agar kolom tetap lega dan pasti bisa digeser ke samping */
.table-custom {
    width: 100% !important;
    min-width: 860px !important;
    margin-bottom: 0 !important;
    border-collapse: collapse;
}

.table-custom th {
    background-color: #F8FAFC !important;
    color: #475569 !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #E2E8F0 !important;
    white-space: nowrap !important;
    padding: 12px 14px !important;
}

.table-custom td {
    padding: 12px 14px !important;
    color: #334155;
    font-size: 0.86rem;
    vertical-align: middle;
    white-space: nowrap !important;
}

/* Kolom keperluan / pesan / judul boleh wrap dengan lebar minimum */
.table-custom td .text-wrap,
.table-custom td p,
.table-custom td small.d-inline-block {
    white-space: normal !important;
}

/* Kolom Aksi */
.table-custom td:last-child,
.table-custom th:last-child {
    white-space: nowrap !important;
    min-width: 140px !important;
}

/* Badge status */
.table-custom .badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    font-weight: 600;
}

/* ===== TABLET VIEW (768px - 991.98px) ===== */
@media (min-width: 768px) and (max-width: 991.98px) {
    .admin-topbar {
        padding: 12px 18px;
        flex-wrap: nowrap;
        gap: 12px;
    }

    .admin-topbar h5 {
        font-size: 1rem !important;
    }

    .admin-section {
        padding: 18px 12px !important;
    }
}

/* ===== SMARTPHONE VIEW (< 768px) ===== */
@media (max-width: 767.98px) {
    /* Topbar HP */
    .admin-topbar {
        padding: 10px 14px;
        gap: 8px;
    }

    .admin-topbar h5 {
        font-size: 0.88rem !important;
        line-height: 1.25;
    }

    /* Container & Section */
    .admin-section {
        padding: 12px 6px !important;
    }

    .admin-section h4 {
        font-size: 1.05rem !important;
    }

    .admin-section p.text-muted {
        font-size: 0.8rem !important;
    }

    /* Header & Filter Controls */
    .admin-section .d-flex.justify-content-between.flex-wrap,
    .admin-section .d-flex.justify-content-between.align-items-center {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    /* Button Group Filter: Flex wrap touch-friendly */
    .btn-group.shadow-sm {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        box-shadow: none !important;
        width: 100% !important;
    }

    .btn-group.shadow-sm .btn {
        border-radius: 8px !important;
        flex: 1 1 calc(50% - 6px) !important;
        text-align: center !important;
        font-size: 0.78rem !important;
        padding: 7px 10px !important;
    }

    /* Card Wrapper */
    .card-dashboard {
        padding: 14px 12px !important;
        border-radius: 14px !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
    }

    /* Di HP, tabel tetap min-width 860px agar leluasa di-scroll samping */
    .table-custom {
        min-width: 860px !important;
        font-size: 0.82rem !important;
    }

    .table-custom th,
    .table-custom td {
        padding: 10px 10px !important;
    }

    /* Modal size di HP */
    .modal-lg {
        --bs-modal-width: 95vw;
    }
}


