/* TEKA MOBILE - Android e iOS */

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

* {
    box-sizing: border-box;
}

@media (max-width: 768px) {
    body {
        margin: 0;
        max-width: 100%;
        overflow-x: hidden;
    }

    main, .container, .content, .dashboard {
        max-width: 100%;
        min-width: 0;
    }

    input, select, textarea {
        max-width: 100%;
        font-size: 16px;
    }

    button, .btn, .button {
        min-height: 44px;
        touch-action: manipulation;
    }

    .cards, .cards-grid, .dashboard-grid,
    .grid, .menu-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
    }

    img {
        max-width: 100%;
        height: auto;
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 380px) {
    .container, main {
        padding-left: 12px;
        padding-right: 12px;
    }
}


/* TEKA MOBILE MENU */
.teka-mobile-toggle {
    display: none;
}

@media (max-width: 768px) {
    .teka-mobile-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
        border: 0;
        border-radius: 10px;
        background: #123b65;
        color: #fff;
        font-size: 24px;
        cursor: pointer;
        z-index: 1101;
    }

    #tekaSidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(85vw, 320px);
        max-width: 320px;
        height: 100dvh;
        overflow-y: auto;
        transform: translateX(-105%);
        transition: transform .25s ease;
        z-index: 1100;
    }

    #tekaSidebar.teka-mobile-open {
        transform: translateX(0);
    }
}


/* TEKA MOBILE AJUSTE V2 */
@media (max-width: 768px) {

    header.topbar {
        position: relative !important;
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 8px !important;
        height: auto !important;
        min-height: 72px !important;
        padding: 12px 12px 12px 68px !important;
        max-width: 100% !important;
    }

    header.topbar .teka-mobile-toggle {
        position: absolute !important;
        top: 12px !important;
        left: 12px !important;
        display: inline-flex !important;
        width: 44px !important;
        min-width: 44px !important;
        max-width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
        padding: 0 !important;
        margin: 0 !important;
        flex: none !important;
        font-size: 23px !important;
        line-height: 1 !important;
        border-radius: 10px !important;
    }

    header.topbar > :not(.teka-mobile-toggle) {
        min-width: 0 !important;
        max-width: 100% !important;
    }

    main.main {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .dashboard-grid,
    .management-grid,
    .access-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}


/* TEKA MOBILE MENU V3 */
@media (max-width: 768px) {

    #tekaSidebar {
        width: min(85vw, 320px) !important;
        max-width: 320px !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        padding: 16px 12px !important;
        overflow-x: hidden !important;
        text-align: left !important;
    }

    #tekaSidebar .menu,
    #tekaSidebar .menu-group {
        width: 100% !important;
        align-items: stretch !important;
    }

    #tekaSidebar .menu-title {
        display: block !important;
        visibility: visible !important;
        text-align: left !important;
        font-size: 11px !important;
    }

    #tekaSidebar .menu-item {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 12px !important;
        width: 100% !important;
        min-height: 44px !important;
        padding: 12px !important;
        font-size: 14px !important;
        text-align: left !important;
    }

    #tekaSidebar .menu-item span {
        display: inline !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: auto !important;
        max-width: none !important;
        font-size: 14px !important;
        color: inherit !important;
    }

    #tekaSidebar .menu-item svg,
    #tekaSidebar .menu-item i {
        flex-shrink: 0 !important;
    }

    body:has(#tekaSidebar.teka-mobile-open)::before {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 1090;
    }
}
