/* assets/css/style.css */
:root {
    --primary-color: #4F46E5; /* Indigo 600 */
    --primary-hover: #4338CA;
    --bg-color: #F3F4F6;
    --text-color: #1F2937;
    --card-bg: rgba(255, 255, 255, 0.65);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #F1F5F9;
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background khusus halaman Login & TOS */
body.auth-page {
    background-image: url('../img/bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-color: #e2e8f0;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
}

/* Glassmorphism utilities */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 1.5rem;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

/* Custom Inputs */
.form-control {
    border-radius: 0.75rem;
    padding: 0.8rem 1.2rem;
    border: 1px solid #e5e7eb;
    background-color: rgba(255,255,255,0.9);
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.form-control:focus {
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
    border-color: var(--primary-color);
    background-color: #fff;
}

.input-group .btn {
    border-radius: 0 0.75rem 0.75rem 0;
    border: 1px solid #e5e7eb;
    border-left: none;
    background-color: rgba(255,255,255,0.9);
    color: #6b7280;
    transition: all 0.3s ease;
}

.input-group:focus-within .btn {
    border-color: var(--primary-color);
}

.input-group:focus-within .form-control {
    border-right-color: transparent;
    border-left-color: transparent;
}

.input-group-text {
    border-radius: 0.75rem 0 0 0.75rem;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.input-group:focus-within .input-group-text {
    border-color: var(--primary-color);
    border-right-color: transparent;
}

/* Primary Button Styling */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    border-radius: 0.75rem;
    padding: 0.85rem 1.5rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.35);
}

/* ============================================
   BUTTON UNIFORMITY (Desktop)
   Semua tombol: pill, padding & ukuran konsisten.
   2 level: normal (.btn) dan kecil (.btn-sm).
   Pengecualian: btn-link, tombol bundar (rounded-circle),
   tombol dalam input-group / btn-group.
============================================ */
@media (min-width: 769px) {
    .btn:not(.btn-link):not(.rounded-circle):not(.btn-toggle):not(.btn-bayar-iuran):not(.input-group .btn):not(.btn-group .btn) {
        border-radius: 50rem !important;
        font-weight: 600;
        letter-spacing: 0.02em;
        line-height: 1.3;
        min-height: 44px;
        padding: 0.55rem 1.25rem !important;
        font-size: 0.9rem !important;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.35rem;
        white-space: nowrap;
    }

    .btn-sm:not(.btn-link):not(.rounded-circle):not(.btn-toggle):not(.btn-bayar-iuran):not(.input-group .btn):not(.btn-group .btn) {
        min-height: 36px;
        padding: 0.35rem 0.9rem !important;
        font-size: 0.8rem !important;
        gap: 0.25rem;
    }
}

/* SweetAlert overrides for rounder corners */
div:where(.swal2-container) div:where(.swal2-popup) {
    border-radius: 1.5rem;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.tracking-wide {
    letter-spacing: 0.05em;
}

/* ============================================
   MODALS
============================================ */
.modal-header {
    background-color: #e0f2fe; /* Light blue */
}

/* ============================================
   LAYOUT WRAPPER (Sidebar + Content)
============================================ */
.wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR
============================================ */
#sidebar {
    width: 260px;
    min-width: 260px;
    min-height: 100vh;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

#sidebar .sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    min-height: 70px;
    flex-shrink: 0;
}

#sidebar .sidebar-header h5 {
    font-size: 1.1rem;
    transition: all 0.3s ease;
    white-space: nowrap;
}

#sidebar ul.components {
    padding: 1rem 0.75rem;
    margin: 0;
    flex: 1;
}

#sidebar ul li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    color: #4B5563;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
}

#sidebar ul li a i {
    font-size: 1.1rem;
    min-width: 24px;
    text-align: center;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

#sidebar ul li a:hover {
    background: rgba(79, 70, 229, 0.08);
    color: var(--primary-color);
    transform: translateX(3px);
}

#sidebar ul li a:hover i {
    transform: scale(1.15);
}

#sidebar ul li.active > a {
    background: linear-gradient(135deg, var(--primary-color), #6366F1);
    color: #fff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

#sidebar ul li.active > a i { color: #fff; }

/* Collapsed Sidebar (Desktop) */
#sidebar.collapsed {
    width: 72px;
    min-width: 72px;
}

#sidebar.collapsed .sidebar-header .header-text,
#sidebar.collapsed ul li a span {
    display: none !important;
}

#sidebar.collapsed .sidebar-header {
    justify-content: center !important;
}

#sidebar.collapsed ul li a {
    justify-content: center;
    padding: 0.75rem;
    gap: 0;
}

/* ============================================
   MAIN CONTENT AREA
============================================ */
#content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: transparent;
}

/* ============================================
   TOP NAVBAR
============================================ */
.top-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.5rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    position: sticky;
    top: 0;
    z-index: 999;
    min-height: 70px;
}

.btn-toggle {
    background: rgba(79, 70, 229, 0.08);
    border: none;
    color: var(--primary-color);
    width: 40px;
    height: 40px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-toggle:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

/* ============================================
   SIDEBAR OVERLAY (Mobile)
============================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 999;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    display: block;
}

/* ============================================
   DASHBOARD CARDS
============================================ */
.stat-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, rgba(248, 250, 252, 1) 100%);
    border: 1px solid rgba(0,0,0,0.03);
    border-radius: 20px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.stat-card > * {
    position: relative;
    z-index: 2;
}

.stat-card .watermark-icon {
    position: absolute;
    right: -5%;
    bottom: -15%;
    font-size: 8rem;
    opacity: 0.08;
    z-index: 0;
    pointer-events: none;
}

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

.stat-card .icon-wrap {
    width: 52px; height: 52px;
    border-radius: 1rem;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -1px;
    margin-bottom: 0.25rem;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #6B7280;
}

/* Post card (Pengumuman): dropdown Edit/Hapus harus terlihat & bisa diklik
   — .stat-card default overflow:hidden memotong dropdown-menu,
     dan .stat-card > * (z-index:2) membuat paragraf konten menutupi menu */
.post-card {
    overflow: visible;
}
.post-card:hover,
.post-card:has(.dropdown-menu.show) {
    z-index: 20;
}
.post-card > .d-flex.align-items-start.mb-2.mt-2 {
    z-index: 3;
}
.post-card .dropdown-menu {
    z-index: 21;
}

/* ============================================
   MOBILE RESPONSIVE — Native Android App Feel
   ============================================ */
@media (max-width: 768px) {
    #sidebar {
        display: none !important;
    }

    /* Login Card - Smaller on Mobile */
    .login-card-box {
        max-width: 280px !important;
        padding: 0.85rem !important;
    }

    .login-card-box .text-center {
        margin-bottom: 0.75rem !important;
    }

    .login-card-box .text-center img {
        max-height: 50px !important;
        margin-bottom: 0.4rem !important;
    }

    .login-card-box .text-center h5 {
        font-size: 1rem !important;
    }

    .login-card-box .mb-3, .login-card-box .mb-2 {
        margin-bottom: 0.6rem !important;
    }

    .login-card-box .form-label {
        font-size: 0.75rem !important;
        margin-bottom: 0.25rem !important;
    }

    .login-card-box .input-group-text {
        padding: 0.5rem 0.6rem !important;
        font-size: 0.9rem !important;
    }

    .login-card-box .form-control {
        padding: 0.6rem 0.75rem !important;
        font-size: 0.9rem !important;
    }

    .login-card-box .btn-primary {
        padding: 0.7rem !important;
        font-size: 0.9rem !important;
    }

    .login-card-box .input-group .btn {
        padding: 0.5rem 0.6rem !important;
    }

    /* Prevent text selection & highlights for native feel */
    body {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        overscroll-behavior: none;
    }

    /* Allow text selection only on inputs */
    input, textarea, select, label, p, span, td, th, a, li {
        -webkit-user-select: auto;
        user-select: auto;
    }

    /* Top Navbar — Android App Bar Style */
    .top-navbar {
        padding: 0.6rem 1rem;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: none;
        box-shadow: 0 1px 3px rgba(0,0,0,0.06);
        justify-content: space-between;
        min-height: 56px;
        position: sticky;
        top: 0;
        z-index: 999;
    }

    .top-navbar.scrolled {
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }

    /* Content area adjustments */
    #content {
        padding-bottom: 72px !important;
    }

    .p-4.p-md-5 {
        padding: 0.875rem !important;
    }

    /* Cards — Native Material Style */
    .stat-card {
        border-radius: 16px;
        padding: 0.8rem;
        box-shadow: 0 4px 12px rgba(0,0,0,0.05);
        border: 1px solid rgba(0,0,0,0.03);
        background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    }

    .stat-card .watermark-icon {
        font-size: 5rem;
        right: -8%;
        bottom: -10%;
    }

    .stat-card:hover {
        transform: none;
        box-shadow: 0 1px 2px rgba(0,0,0,0.08);
    }

    .stat-card .icon-wrap {
        width: 28px;
        height: 28px;
        border-radius: 8px;
        font-size: 1rem;
        margin-bottom: 0.3rem;
    }

    .stat-card .stat-number {
        font-size: 1.1rem;
        margin-bottom: 0.1rem;
    }

    .stat-card .stat-label {
        font-size: 0.65rem;
        line-height: 1.1;
    }

    /* Buttons — Full width on mobile, larger touch targets */
    .btn {
        min-height: 44px;
        font-weight: 600;
    }

    .btn-sm {
        min-height: 36px;
        padding: 0.4rem 0.875rem;
    }

    /* Form elements — larger touch targets */
    .form-control, .form-select {
        min-height: 48px;
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 0.625rem 1rem;
        border-radius: 12px;
    }

    .form-label {
        font-size: 0.82rem;
        font-weight: 600;
        margin-bottom: 0.375rem;
    }

    /* Tables — horizontal scroll hint */
    .table-responsive {
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    }

    .table {
        font-size: 0.85rem;
    }

    .table th {
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: #6b7280;
        font-weight: 600;
        background: #f9fafb;
    }

    /* Modals — Bottom sheet style on mobile */
    .modal-content {
        border-radius: 1.25rem 1.25rem 0 0 !important;
        margin: 0;
        border: none;
    }

    .modal-dialog {
        margin: 0 !important;
        max-width: 100% !important;
    }

    .modal-dialog-centered {
        align-items: flex-end !important;
    }

    /* Dropdown menus — full width on mobile */
    .dropdown-menu {
        border-radius: 1rem 1rem 0 0;
        border: none;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* SweetAlert — full width on mobile */
    div:where(.swal2-container) {
        padding: 0.5rem !important;
    }

    div:where(.swal2-container) div:where(.swal2-popup) {
        width: calc(100% - 1rem) !important;
        border-radius: 1rem !important;
        padding: 1.5rem 1rem !important;
    }

    /* Page headers — tighter spacing */
    h4.fw-bold {
        font-size: 1.2rem;
    }

    h5.fw-bold {
        font-size: 1.05rem;
    }

    h6.fw-bold {
        font-size: 0.95rem;
    }

    /* Badges — slightly smaller */
    .badge {
        font-size: 0.7rem;
    }

    /* Progress bars */
    .progress {
        height: 5px;
    }

    /* Lists & menu items — native feel */
    .list-group-item {
        padding: 0.875rem 1rem;
        border-left: none;
        border-right: none;
    }

    /* Scrollbar hidden for cleaner look */
    ::-webkit-scrollbar {
        width: 0;
        height: 0;
    }

    /* Page transition animation */
    #content > .p-4 {
        animation: fadeInUp 0.2s ease-out;
    }

    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(8px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* Swipe hint for horizontal scroll */
    .table-responsive {
        position: relative;
    }

    .table-responsive::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 24px;
        background: linear-gradient(to left, rgba(255,255,255,0.9), transparent);
        pointer-events: none;
        border-radius: 0 12px 12px 0;
    }

    /* Stat cards grid — tighter */
    .row.g-4 {
        --bs-gutter-y: 0.75rem;
        --bs-gutter-x: 0.75rem;
    }

    /* Mobile Horizontal Quick Menu */
    .mobile-menu-scroll {
        display: flex;
        overflow-x: auto;
        gap: 0.75rem;
        padding-bottom: 0.5rem;
        margin-bottom: 1rem;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
    }
    
    .mobile-menu-scroll::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Opera */
    }

    .mobile-menu-item {
        flex: 0 0 auto;
        width: 72px;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        text-decoration: none;
        color: var(--text-color);
    }

    .mobile-menu-item .icon-box {
        width: 48px;
        height: 48px;
        border-radius: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.3rem;
        margin-bottom: 0.4rem;
        box-shadow: 0 2px 6px rgba(0,0,0,0.04);
        border: 1px solid rgba(0,0,0,0.03);
        background: #fff;
    }

    .mobile-menu-item span {
        font-size: 0.65rem;
        font-weight: 600;
        line-height: 1.1;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        width: 100%;
    }

    /* Alert boxes */
    .alert {
        border-radius: 12px;
        font-size: 0.85rem;
        padding: 0.75rem 1rem;
    }

    /* Pagination */
    .page-link {
        min-width: 40px;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 10px !important;
        margin: 0 2px;
        font-size: 0.85rem;
    }
}

/* ============================================
   BOTTOM NAVIGATION (Material Design 3 - Native Android)
   ============================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1040;
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom)) 0;
    border-top: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.1);
}

.bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 500;
    flex: 1;
    padding: 4px 0;
    gap: 2px;
    -webkit-tap-highlight-color: transparent;
    line-height: 1;
}

.bottom-nav .nav-item .icon-wrapper {
    width: 48px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    transition: background-color 0.2s ease;
}

.bottom-nav .nav-item i {
    font-size: 1.2rem;
    line-height: 1;
}

.bottom-nav .nav-item span {
    font-size: 10px;
    line-height: 1;
    white-space: nowrap;
}

/* Active State */
.bottom-nav .nav-item.active {
    color: var(--primary-color);
    font-weight: 700;
}

.bottom-nav .nav-item.active .icon-wrapper {
    background-color: #E0E7FF;
}

.bottom-nav .nav-item.active i {
    color: var(--primary-color);
}

/* Press state */
.bottom-nav .nav-item:active .icon-wrapper {
    background-color: #CBD5E1;
    transition-duration: 0.05s;
}

/* Remove focus outlines */
.bottom-nav .nav-item:focus,
.bottom-nav .nav-item:hover {
    outline: none;
    color: inherit;
    text-decoration: none;
}

/* ============================================
   BOTTOM SHEET "LAINNYA" — custom, animasi ringan
   (teknik sama dengan bottom sheet "Chat Baru":
    buka transform 300ms ease-out, tutup 250ms ease-in)
============================================ */
.app-bottom-sheet {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1080;
    display: none;
}

.app-bottom-sheet-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 250ms ease;
}

.app-bottom-sheet.show .app-bottom-sheet-overlay {
    opacity: 1;
}

.app-bottom-sheet-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 1.25rem 1.25rem 0 0;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(100%);
    transition: transform 300ms ease-out;
}

.app-bottom-sheet.show .app-bottom-sheet-panel {
    transform: translateY(0);
}

.app-bottom-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    height: 52px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.app-bottom-sheet-close {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
    color: #6b7280;
    font-size: 1.5rem;
    padding: 0;
}

.app-bottom-sheet-close:hover,
.app-bottom-sheet-close:active {
    background: rgba(0, 0, 0, 0.05);
    color: #1f2937;
}

.app-bottom-sheet-body {
    padding: 0 0 0.5rem;
    overflow-y: auto;
    max-height: calc(90vh - 52px);
    -webkit-overflow-scrolling: touch;
}

/* Animasi closing — sama dengan sheet chat */
.app-bottom-sheet.closing .app-bottom-sheet-panel {
    transition: transform 250ms ease-in;
    transform: translateY(100%);
}

.app-bottom-sheet.closing .app-bottom-sheet-overlay {
    opacity: 0;
}

/* ============================================
   PULL TO REFRESH
============================================ */
html, body {
    overscroll-behavior-y: contain;
}

#ptr-indicator {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    opacity: 0;
    transform: translateY(-100%);
    transition: opacity 0.15s ease;
    pointer-events: none;
    will-change: transform, opacity;
}

#ptr-indicator i { transition: transform 0.15s ease; }
#ptr-indicator .spin { animation: ptr-spin 0.8s linear infinite; }

@keyframes ptr-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ============================================
   MOBILE TABLE TO CARD LIST (Responsive Tables)
   ============================================ */
@media (max-width: 768px) {
    .table-responsive {
        border: none !important;
        background: transparent !important;
        padding: 0 !important;
    }
    .table-responsive table {
        display: block;
        width: 100%;
        background: transparent;
    }
    .table-responsive table thead {
        display: none; /* Hide headers */
    }
    .table-responsive table tbody {
        display: block;
        width: 100%;
    }
    .table-responsive table tr {
        display: block;
        width: 100%;
        margin-bottom: 1.25rem;
        background: #fff;
        border-radius: 16px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.04);
        border: 1px solid rgba(0,0,0,0.04);
        padding: 0;
        overflow: hidden;
        transition: transform 0.2s, box-shadow 0.2s;
    }
    .table-responsive table tr:active {
        transform: scale(0.98);
    }
    .table-responsive table td {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        text-align: right;
        padding: 0.75rem 1.25rem !important;
        border: none !important;
        border-bottom: 1px dashed rgba(0,0,0,0.06) !important;
        font-size: 0.88rem;
        gap: 0.4rem;
        flex-wrap: wrap;
    }
    .table-responsive table td:last-child {
        border-bottom: none !important;
        background: rgba(79, 70, 229, 0.02);
    }
    .table-responsive table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #4b5563;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        text-align: left;
        flex-shrink: 0;
        margin-right: auto;
    }
    .table-responsive table td > * {
        text-align: right;
        word-break: break-word;
    }
    /* Fix action buttons wrapping and make them icon-only circles on mobile */
    .table-responsive table td .btn,
    .table-responsive table td .dropdown {
        display: inline-block;
    }
    
    .table-responsive table td .btn {
        font-size: 0 !important;
        padding: 0 !important;
        width: 36px;
        height: 36px;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        border-radius: 50% !important;
    }
    .table-responsive table td .btn i {
        font-size: 1.1rem !important;
        margin: 0 !important;
    }
}

/* ============================================
   DATA RUMAH & BANGUNAN - MOBILE CARDS
   ============================================ */
@media (max-width: 768px) {
    #tableRumah tbody tr {
        position: relative;
        overflow: hidden;
        margin-bottom: 1rem;
        border-radius: 20px;
        border: none;
        background: linear-gradient(135deg, #ffffff 0%, #f8faff 100%);
        box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
        padding-left: 0;
    }

    /* Accent bar kiri sesuai status rumah */
    #tableRumah tbody tr::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 6px;
        background: #9CA3AF;
    }
    #tableRumah tbody tr.rumah-berpenghuni::before { background: linear-gradient(180deg, #10B981, #059669); }
    #tableRumah tbody tr.rumah-kosong::before      { background: linear-gradient(180deg, #9CA3AF, #6B7280); }
    #tableRumah tbody tr.rumah-direnovasi::before  { background: linear-gradient(180deg, #F59E0B, #D97706); }

    /* Header kartu: Blok & Nomor */
    #tableRumah tbody tr td:first-child {
        background: linear-gradient(135deg, rgba(79,70,229,0.08), rgba(79,70,229,0.02));
        padding: 1rem 1.25rem !important;
        border-bottom: 1px solid rgba(0,0,0,0.05) !important;
        align-items: center;
    }
    #tableRumah tbody tr td:first-child::before {
        color: #4F46E5;
    }
    #tableRumah tbody tr td:first-child .fw-bold {
        font-size: 1.25rem !important;
        color: #1F2937 !important;
        letter-spacing: 0.02em;
    }

    /* Badge status */
    #tableRumah tbody tr td:nth-child(2) .badge {
        font-size: 0.8rem !important;
        padding: 0.4rem 1rem !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    }

    /* Penghuni / Alamat / Keterangan */
    #tableRumah tbody tr td:nth-child(n+3):nth-child(-n+5) {
        padding: 0.6rem 1.25rem !important;
        font-size: 0.85rem;
    }

    /* Aksi: deretan tombol di bagian bawah */
    #tableRumah tbody tr td:last-child {
        display: flex !important;
        justify-content: center;
        gap: 0.75rem;
        padding: 0.9rem 1.25rem !important;
        background: rgba(0,0,0,0.02) !important;
    }
    #tableRumah tbody tr td:last-child::before {
        display: none;
    }
    #tableRumah tbody tr td:last-child .btn {
        width: 42px;
        height: 42px;
        box-shadow: 0 4px 12px rgba(79,70,229,0.15);
    }
    #tableRumah tbody tr td:last-child .btn.text-primary { background: rgba(79,70,229,0.08) !important; }
    #tableRumah tbody tr td:last-child .btn.text-danger  { background: rgba(239,68,68,0.08) !important; box-shadow: 0 4px 12px rgba(239,68,68,0.12); }
}

/* Notification Dropdown � Full-width on Mobile */
@media (max-width: 768px) {
    .notif-dropdown-menu {
        position: fixed !important;
        left: 8px !important;
        right: 8px !important;
        width: auto !important;
        top: 60px !important;
        transform: none !important;
    }
}




/* ============================================
   DESKTOP RESPONSIVE — Login Form Position
   ============================================ */
@media (min-width: 769px) {
    /* Login Card - Position adjustment for desktop */
    .login-card-box {
        margin-top: 34vh !important;
        max-width: 360px !important;
    }
}

/* ============================================
   MOBILE BOTTOM SHEET — Semua modal jadi bottom sheet
   Muncul dari bawah dengan animasi slide-up,
   saat ditutup slide-down kembali ke bawah.
   Berlaku untuk semua Bootstrap modal (form dll).
============================================ */
@media (max-width: 768px) {
    .modal {
        align-items: flex-end;
        padding: 0 !important;
    }

    .modal.show {
        display: flex !important;
    }

    /* Samakan durasi fade modal dengan durasi slide agar
       animasi tutup tidak terpotong */
    .modal.fade {
        transition: opacity 0.35s ease;
    }

    .modal-dialog,
    .modal-dialog-centered {
        width: 100%;
        max-width: 100%;
        margin: 0 !important;
        min-height: auto;
    }

    .modal.fade .modal-dialog,
    .modal.fade .modal-dialog-centered {
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .modal.show .modal-dialog,
    .modal.show .modal-dialog-centered {
        transform: translateY(0);
    }

    .modal-content {
        border-radius: 1.25rem 1.25rem 0 0 !important;
        border: none !important;
        max-height: 92vh;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.2);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .modal-header,
    .modal-footer {
        flex-shrink: 0;
    }

    .modal-body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

