/* ==========================================================
   KWETUNET ADMIN — MOBILE NAVIGATION OVERRIDES
   ========================================================== */

@media (max-width: 991px) {

    /* Main app shell */
    .ant-layout {
        min-width: 0 !important;
    }

    /* ------------------------------------------------------
       SIDEBAR CLOSED
       Ant Design normally leaves 80px visible.
       On mobile we want it completely gone.
       ------------------------------------------------------ */

    .sidebar.ant-layout-sider-collapsed {
        position: fixed !important;

        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;

        width: 0 !important;
        min-width: 0 !important;
        max-width: 0 !important;
        flex: 0 0 0 !important;

        overflow: hidden !important;

        transform: translateX(-100%) !important;

        z-index: 1000 !important;

        transition:
            width .22s ease,
            transform .22s ease !important;
    }


    /* ------------------------------------------------------
       SIDEBAR OPEN
       Full drawer overlay instead of pushing page content
       ------------------------------------------------------ */

    .sidebar:not(.ant-layout-sider-collapsed) {
        position: fixed !important;

        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;

        width: 250px !important;
        min-width: 250px !important;
        max-width: 250px !important;
        flex: 0 0 250px !important;

        height: 100vh !important;

        transform: translateX(0) !important;

        z-index: 1100 !important;

        box-shadow:
            10px 0 30px rgba(0, 0, 0, .28) !important;

        transition:
            width .22s ease,
            transform .22s ease !important;
    }


    /* ------------------------------------------------------
       MAIN CONTENT
       Always use full phone width
       ------------------------------------------------------ */

    .sidebar + .ant-layout {
        width: 100% !important;
        min-width: 0 !important;
        margin-left: 0 !important;
    }

    .ant-layout-content {
        width: 100% !important;
        min-width: 0 !important;

        padding: 12px !important;

        overflow-x: hidden !important;
        overflow-y: auto !important;
    }


    /* ------------------------------------------------------
       TOP NAV
       ------------------------------------------------------ */

    .ant-layout-header {
        height: 56px !important;
        line-height: 56px !important;

        padding: 0 12px !important;

        position: sticky !important;
        top: 0 !important;

        z-index: 900 !important;

        box-shadow:
            0 1px 5px rgba(0, 0, 0, .08) !important;
    }

    .menu-trigger {
        display: inline-flex !important;

        align-items: center !important;
        justify-content: center !important;

        width: 38px !important;
        height: 38px !important;

        font-size: 20px !important;

        border-radius: 8px !important;

        cursor: pointer !important;

        transition: background .2s ease !important;
    }

    .menu-trigger:active {
        background: #f0f3f7 !important;
    }


    /* ------------------------------------------------------
       SIDEBAR CONTENT
       ------------------------------------------------------ */

    .sidebar-container,
    .main-sidebar {
        height: 100% !important;
    }

    .sidebar .ant-menu {
        width: 100% !important;
    }

    .sidebar .close-icon {
        position: absolute !important;

        right: 16px !important;
        top: 18px !important;

        z-index: 1200 !important;

        font-size: 19px !important;

        color: rgba(255,255,255,.88) !important;

        cursor: pointer !important;
    }


    /* ------------------------------------------------------
       PAGE HEADERS
       Prevent clipped title like your screenshot
       ------------------------------------------------------ */

    .page-header-wrapper {
        height: auto !important;
        min-height: 54px !important;

        border-radius: 8px !important;

        overflow: hidden !important;
    }

    .custom-page-header {
        padding: 0 12px !important;
    }

    .custom-page-header .ant-page-header-heading-title {
        white-space: normal !important;

        overflow: visible !important;

        font-size: 17px !important;
        line-height: 1.3 !important;
    }

    .title-with-icon {
        display: flex !important;

        align-items: center !important;

        min-width: 0 !important;

        gap: 8px !important;
    }


    /* ------------------------------------------------------
       DASHBOARD
       ------------------------------------------------------ */

    .dashboard-page {
        width: 100% !important;
        min-width: 0 !important;

        overflow-x: hidden !important;
    }

    .filter-bar-container {
        padding: 12px 0 !important;
    }

    .filter-bar-mobile {
        display: grid !important;

        grid-template-columns: minmax(0, 1fr) 44px !important;

        gap: 8px !important;

        width: 100% !important;
    }

    .filter-bar-mobile .ant-select {
        width: 100% !important;
    }

    .filter-bar-mobile .ant-btn {
        width: 44px !important;
        min-width: 44px !important;
        padding: 0 !important;
    }


    /* Stats: two cards per row */
    .dashboard-stat-row > .ant-col {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    .dashboard-page .stat-card {
        min-height: 96px !important;

        border-radius: 10px !important;

        box-shadow:
            0 2px 7px rgba(0,0,0,.06) !important;
    }

    .dashboard-page .stat-card .ant-card-body {
        padding: 13px !important;
    }

    .dashboard-page .stat-content {
        gap: 10px !important;
    }

    .dashboard-page .stat-icon {
        font-size: 22px !important;
    }

    .dashboard-page .stat-title {
        font-size: 11px !important;
        line-height: 1.25 !important;
    }

    .dashboard-page .stat-value {
        margin-top: 4px !important;

        font-size: 19px !important;
        line-height: 1.15 !important;

        overflow-wrap: anywhere !important;
    }


    /* Chart */
    .dashboard-chart-row {
        margin-top: 4px !important;
    }

    .dashboard-page .chart-card {
        border-radius: 10px !important;
    }

    .dashboard-page .chart-card .ant-card-head {
        min-height: 48px !important;

        padding: 0 12px !important;
    }

    .dashboard-page .chart-card .ant-card-head-title {
        white-space: normal !important;

        font-size: 13px !important;
    }

    .dashboard-page .chart-card .ant-card-body {
        padding: 10px !important;
    }

    .dashboard-page .chart-wrapper {
        height: 220px !important;
        min-height: 220px !important;
    }


    /* Activity */
    .dashboard-page .activity-card {
        border-radius: 10px !important;
    }

    .dashboard-page .activity-card .ant-card-head {
        padding: 0 12px !important;
    }

    .dashboard-page .activity-card .ant-card-body {
        padding: 12px !important;
    }

    .dashboard-page .activity-item {
        font-size: 12px !important;
    }


    /* ------------------------------------------------------
       TABLE / CARD PAGES
       ------------------------------------------------------ */

    .form-container {
        width: 100% !important;

        padding: 12px !important;

        overflow-x: hidden !important;
    }

    .filters-row {
        display: flex !important;

        flex-direction: column !important;

        gap: 9px !important;

        width: 100% !important;
    }

    .mobile-card {
        width: 100% !important;

        margin-bottom: 10px !important;

        border-radius: 10px !important;

        box-shadow:
            0 2px 7px rgba(0,0,0,.06) !important;
    }

}


/* ==========================================================
   EXTRA SMALL PHONES
   ========================================================== */

@media (max-width: 420px) {

    .ant-layout-content {
        padding: 9px !important;
    }

    .dashboard-page .stat-card .ant-card-body {
        padding: 11px !important;
    }

    .dashboard-page .stat-title {
        font-size: 10px !important;
    }

    .dashboard-page .stat-value {
        font-size: 17px !important;
    }

}


/* ==========================================================
   KWETUNET MOBILE BOTTOM NAVIGATION
   ========================================================== */

#kw-mobile-bottom-nav {
    display: none;
}

@media (max-width: 991px) {

    #kw-mobile-bottom-nav {
        position: fixed;

        left: 10px;
        right: 10px;
        bottom: 9px;

        z-index: 1050;

        display: grid;

        grid-template-columns: repeat(5, 1fr);

        min-height: 62px;

        padding:
            5px
            4px
            calc(5px + env(safe-area-inset-bottom));

        background: rgba(255, 255, 255, .97);

        border: 1px solid rgba(24, 34, 49, .10);
        border-radius: 17px;

        box-shadow:
            0 8px 30px rgba(26, 39, 55, .16),
            0 2px 7px rgba(26, 39, 55, .08);

        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
    }


    #kw-mobile-bottom-nav .kw-mobile-nav-item {
        position: relative;

        display: flex;

        flex-direction: column;

        align-items: center;
        justify-content: center;

        gap: 3px;

        min-width: 0;
        min-height: 52px;

        padding: 5px 2px;

        border: 0;
        border-radius: 12px;

        outline: none;

        background: transparent;

        color: #77818d;

        font-family: inherit;

        cursor: pointer;

        -webkit-tap-highlight-color: transparent;

        transition:
            background .18s ease,
            color .18s ease,
            transform .12s ease;
    }


    #kw-mobile-bottom-nav .kw-mobile-nav-item:active {
        transform: scale(.94);

        background: #eef5fb;
    }


    #kw-mobile-bottom-nav .kw-mobile-nav-icon {
        display: flex;

        align-items: center;
        justify-content: center;

        width: 23px;
        height: 23px;
    }


    #kw-mobile-bottom-nav .kw-mobile-nav-icon svg {
        width: 21px;
        height: 21px;

        fill: currentColor;
    }


    #kw-mobile-bottom-nav .kw-mobile-nav-label {
        display: block;

        width: 100%;

        overflow: hidden;

        font-size: 9.5px;
        font-weight: 600;
        line-height: 1;

        white-space: nowrap;
        text-overflow: ellipsis;

        text-align: center;
    }


    #kw-mobile-bottom-nav .kw-mobile-nav-item.active {
        color: #286ca6;

        background: #edf6fd;
    }


    #kw-mobile-bottom-nav .kw-mobile-nav-item.active::before {
        content: "";

        position: absolute;

        top: 2px;
        left: 50%;

        width: 20px;
        height: 3px;

        transform: translateX(-50%);

        border-radius: 20px;

        background: #286ca6;
    }


    /* Keep dashboard/page content above the floating nav */
    .ant-layout-content {
        padding-bottom: 92px !important;
    }

}


/* Extra-small phones */
@media (max-width: 390px) {

    #kw-mobile-bottom-nav {
        left: 6px;
        right: 6px;
        bottom: 6px;

        border-radius: 15px;
    }

    #kw-mobile-bottom-nav .kw-mobile-nav-label {
        font-size: 8.5px;
    }

    #kw-mobile-bottom-nav .kw-mobile-nav-icon svg {
        width: 20px;
        height: 20px;
    }

}
