﻿/* =========================================================
   VisitX Master Mobile Responsive Engine (v15)
   ========================================================= */
*, *::before, *::after {
    box-sizing: border-box !important;
}

html, body {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
}

.vx-mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid #E2E8F0;
    background: #F8FAFC;
    color: #1E1B4B;
    font-size: 20px;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

#vxSidebarBackdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    z-index: 1090;
}
#vxSidebarBackdrop.show {
    display: block;
}

.vx-gate-dt { width: 175px; }
.vx-gate-sel { width: 118px; }
.vx-vis-search { width: 170px; }

/* TABLET & MOBILE DRAWER (<= 991px) */
@media (max-width: 991px) {
    .vx-mobile-menu-btn {
        display: inline-flex !important;
    }

    .vx-shell {
        display: block !important;
        width: 100% !important;
    }

    .vx-sidebar, aside.vx-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 260px !important;
        max-width: 82vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        background: #16183D !important;
        z-index: 1100 !important;
        transform: translateX(-105%) !important;
        transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
        padding: 22px 16px !important;
        overflow-y: auto !important;
    }

    .vx-sidebar.vx-open {
        transform: translateX(0) !important;
        box-shadow: 12px 0 35px rgba(0, 0, 0, 0.35) !important;
    }

    .vx-nav {
        display: flex !important;
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        gap: 6px !important;
    }

    .vx-main {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
    }

    .vx-topbar {
        padding: 10px 14px !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 950 !important;
        width: 100% !important;
    }

    .vx-content {
        padding: 14px !important;
        width: 100% !important;
    }

    .vx-welcome-tag {
        display: none !important;
    }

    .vx-dash-grid, .vx-dashboard-grid, .vx-vt-grid {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 14px !important;
        width: 100% !important;
    }
}

/* MOBILE PHONES (<= 640px) */
@media (max-width: 640px) {
    /* Topbar Header */
    .vx-greeting h2 {
        font-size: 14.5px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 150px !important;
    }
    .vx-greeting p {
        font-size: 11px !important;
    }
    .vx-profile-text {
        display: none !important;
    }
    .vx-top-actions {
        gap: 6px !important;
    }

    /* Notification Popover */
    .vxb-card, .vx-bell-dropdown {
        position: fixed !important;
        top: 62px !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        max-width: none !important;
    }
    .vxb-card::before {
        display: none !important;
    }

    /* Cards & Boxes - Force 100% inside viewport */
    .vx-box, .vx-card, .card, .vx-vt-card, .vxs-card, .vx-notif-page-card {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        border-radius: 14px !important;
    }

    .card-header, .vx-box-head, .vx-vt-card-head, .vxs-head, .vx-notif-page-head {
        padding: 12px 14px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }

    .card-body, .vxs-body, .vx-vt-form {
        padding: 14px !important;
    }

    /* Form Rows & Grid Columns */
    .row {
        display: flex !important;
        flex-direction: column !important;
        gap: 14px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    .col-md-4, .col-md-6, .col-md-8, .col-md-12, [class*="col-"] {
        flex: 1 1 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Filter Forms & Search Bars */
    .card-header form, .vx-vis-search {
        width: 100% !important;
    }
    .card-header form select,
    .card-header form input,
    .card-header form button {
        width: 100% !important;
    }

    /* Gate Check-Out Row Inside Table */
    .vx-gate-dt, .vx-gate-sel {
        width: 100% !important;
        min-width: 140px !important;
    }

    /* Security Scanner Page */
    .vxs-wrap {
        margin: 0 !important;
        width: 100% !important;
    }
    .vxs-scan-box {
        padding: 14px !important;
    }
    .vxs-input-row {
        flex-direction: column !important;
    }
    .vxs-btn-submit, .vxs-cam-toggle {
        width: 100% !important;
        justify-content: center !important;
    }
    .vxs-res-details {
        grid-template-columns: 1fr !important;
    }

    /* Visitor Pass Toolbar */
    .pass-toolbar {
        flex-direction: column !important;
        width: 100% !important;
        max-width: 380px !important;
    }
    .pass-btn {
        width: 100% !important;
        justify-content: center !important;
    }

    /* Notifications Full Page */
    .vx-notif-row {
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 14px !important;
    }
    .vx-notif-gate-btn {
        width: 100% !important;
        text-align: center !important;
        display: block !important;
    }

    /* Prevent Mobile Input Auto-Zoom */
    input, select, textarea, .form-control, .form-select, .vx-vt-input, .vxs-input {
        font-size: 16px !important;
    }

    /* Tables: Always Smooth Horizontal Scroll Inside Card */
    .table-responsive, .vx-table-scroll {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    table, .table, .vx-table, .vx-vt-table {
        width: 100% !important;
        min-width: 580px !important;
    }
    th, td {
        padding: 9px 10px !important;
        font-size: 12.5px !important;
    }

    /* Pagination Bar Compact */
    .vx-pagination-bar {
        padding: 10px 12px !important;
        justify-content: center !important;
        text-align: center !important;
    }
}
